Fixed performance issues for shadow masks on android devices - now runs at 60fps at 1440p on Snapdragon 865 (OnePlus 8 Pro)

This commit is contained in:
MajorPainTheCactus 2022-12-02 22:50:01 +00:00
parent d1b7eec005
commit 67eaa5141d

View file

@ -249,21 +249,12 @@ void main()
{ {
case k300TVL: case k300TVL:
{ {
// 300TVL #define kRGBX (kRed << 0) | (kGreen << 4) | (kBlue << 8) | (kBlack << 12)
#define kMaxApertureGrilleSize 4 #define kRBGX (kRed << 0) | (kBlue << 4) | (kGreen << 8) | (kBlack << 12)
#define kBGRX (kBlue << 0) | (kGreen << 4) | (kRed << 8) | (kBlack << 12)
#define kRGBX kRed, kGreen, kBlue, kBlack const uint rgb_mask[kBGRAxis] = { kRGBX, kRBGX, kBGRX };
#define kRBGX kRed, kBlue, kGreen, kBlack colour_mask = (rgb_mask[lcd_subpixel_layout] >> (mask * 4)) & 0xF;
#define kBGRX kBlue, kGreen, kRed, kBlack
const uint kApertureGrilleMasks1080p300TVL[kBGRAxis * kMaxApertureGrilleSize] =
{
kRGBX, kRBGX, kBGRX
};
colour_mask = kApertureGrilleMasks1080p300TVL[(lcd_subpixel_layout * kMaxApertureGrilleSize) + mask];
#undef kMaxApertureGrilleSize
#undef kRGBX #undef kRGBX
#undef kRBGX #undef kRBGX
@ -273,26 +264,17 @@ void main()
} }
case k600TVL: case k600TVL:
{ {
#define kMaxApertureGrilleSize 2 #define kMG (kMagenta << 0) | (kGreen << 6)
#define kYB (kYellow << 0) | (kBlue << 6)
#define kGM (kGreen << 0) | (kMagenta << 6)
#define kMG kMagenta, kGreen const uint rgb_mask[kBGRAxis] = { kMG, kYB, kGM };
#define kYB kYellow, kBlue colour_mask = (rgb_mask[lcd_subpixel_layout] >> (mask * 6)) & 0x3F;
#define kGM kGreen, kMagenta
const uint kApertureGrilleMasks1080p600TVL[kBGRAxis * kMaxApertureGrilleSize] =
{
kMG, kYB, kGM
};
colour_mask = kApertureGrilleMasks1080p600TVL[(lcd_subpixel_layout * kMaxApertureGrilleSize) + mask];
#undef kMaxApertureGrilleSize
#undef kMG #undef kMG
#undef kYB #undef kYB
#undef kGM #undef kGM
break; break;
} }
case k800TVL: case k800TVL:
@ -321,44 +303,27 @@ void main()
{ {
case k300TVL: case k300TVL:
{ {
#define kMaxApertureGrilleSize 7 #define kRRGGBBX (kRed << 0) | (kRed << 4) | (kGreen << 8) | (kGreen << 12) | (kBlue << 16) | (kBlue << 20) | (kBlack << 24)
#define kRRBBGGX (kRed << 0) | (kRed << 4) | (kBlue << 8) | (kBlue << 12) | (kGreen << 16) | (kGreen << 20) | (kBlack << 24)
#define kBBGGRRX (kBlue << 0) | (kBlue << 4) | (kGreen << 8) | (kGreen << 12) | (kRed << 16) | (kRed << 20) | (kBlack << 24)
#define kRRGGBBX kRed, kRed, kGreen, kGreen, kBlue, kBlue, kBlack const uint rgb_mask[kBGRAxis] = { kRRGGBBX, kRRBBGGX, kBBGGRRX };
#define kRRBBGGX kRed, kRed, kBlue, kBlue, kGreen, kGreen, kBlack colour_mask = (rgb_mask[lcd_subpixel_layout] >> (mask * 4)) & 0xF;
#define kBBGGRRX kBlue, kBlue, kGreen, kGreen, kRed, kRed, kBlack
const uint kApertureGrilleMasks4K300TVL[kBGRAxis * kMaxApertureGrilleSize] =
{
kRRGGBBX, kRRBBGGX, kBBGGRRX
};
colour_mask = kApertureGrilleMasks4K300TVL[(lcd_subpixel_layout * kMaxApertureGrilleSize) + mask];
#undef kMaxApertureGrilleSize
#undef kRRGGBBX #undef kRRGGBBX
#undef kRRBBGGX #undef kRRBBGGX
#undef kBBGGRRX #undef kBBGGRRX
break; break;
} }
case k600TVL: case k600TVL:
{ {
#define kMaxApertureGrilleSize 4 #define kRGBX (kRed << 0) | (kGreen << 4) | (kBlue << 8) | (kBlack << 12)
#define kRBGX (kRed << 0) | (kBlue << 4) | (kGreen << 8) | (kBlack << 12)
#define kBGRX (kBlue << 0) | (kGreen << 4) | (kRed << 8) | (kBlack << 12)
#define kRGBX kRed, kGreen, kBlue, kBlack const uint rgb_mask[kBGRAxis] = { kRGBX, kRBGX, kBGRX };
#define kRBGX kRed, kBlue, kGreen, kBlack colour_mask = (rgb_mask[lcd_subpixel_layout] >> (mask * 4)) & 0xF;
#define kBGRX kBlue, kGreen, kRed, kBlack
const uint kApertureGrilleMasks4K600TVL[kBGRAxis * kMaxApertureGrilleSize] =
{
kRGBX, kRBGX, kBGRX
};
colour_mask = kApertureGrilleMasks4K600TVL[(lcd_subpixel_layout * kMaxApertureGrilleSize) + mask];
#undef kMaxApertureGrilleSize
#undef kRGBX #undef kRGBX
#undef kRBGX #undef kRBGX
@ -368,44 +333,27 @@ void main()
} }
case k800TVL: case k800TVL:
{ {
#define kMaxApertureGrilleSize 3 #define kBGR (kBlue << 0) | (kGreen << 4) | (kRed << 8)
#define kGBR (kGreen << 0) | (kBlue << 4) | (kRed << 8)
#define kRGB (kRed << 0) | (kGreen << 4) | (kBlue << 8)
#define kRGB kRed, kGreen, kBlue const uint rgb_mask[kBGRAxis] = { kBGR, kGBR, kRGB };
#define kGBR kGreen, kBlue, kRed colour_mask = (rgb_mask[lcd_subpixel_layout] >> (mask * 4)) & 0xF;
#define kBGR kBlue, kGreen, kRed
const uint kApertureGrilleMasks4K800TVL[kBGRAxis * kMaxApertureGrilleSize] =
{
kBGR, kGBR, kRGB
};
colour_mask = kApertureGrilleMasks4K800TVL[(lcd_subpixel_layout * kMaxApertureGrilleSize) + mask];
#undef kMaxApertureGrilleSize
#undef kRGB #undef kRGB
#undef kGBR #undef kGBR
#undef kBGR #undef kBGR
break; break;
} }
case k1000TVL: case k1000TVL:
{ {
#define kMaxApertureGrilleSize 2 #define kMG (kMagenta << 0) | (kGreen << 6)
#define kYB (kYellow << 0) | (kBlue << 6)
#define kGM (kGreen << 0) | (kMagenta << 6)
#define kMG kMagenta, kGreen const uint rgb_mask[kBGRAxis] = { kMG, kYB, kGM };
#define kYB kYellow, kBlue colour_mask = (rgb_mask[lcd_subpixel_layout] >> (mask * 6)) & 0x3F;
#define kGM kGreen, kMagenta
const uint kApertureGrilleMasks4K1000TVL[kBGRAxis * kMaxApertureGrilleSize] =
{
kMG, kYB, kGM
};
colour_mask = kApertureGrilleMasks4K1000TVL[(lcd_subpixel_layout * kMaxApertureGrilleSize) + mask];
#undef kMaxApertureGrilleSize
#undef kMG #undef kMG
#undef kYB #undef kYB
@ -450,20 +398,13 @@ void main()
} }
case k600TVL: case k600TVL:
{ {
#define kMaxApertureGrilleSize 7 #define kRRGGBBX (kRed << 0) | (kRed << 4) | (kGreen << 8) | (kGreen << 12) | (kBlue << 16) | (kBlue << 20) | (kBlack << 24)
#define kRRBBGGX (kRed << 0) | (kRed << 4) | (kBlue << 8) | (kBlue << 12) | (kGreen << 16) | (kGreen << 20) | (kBlack << 24)
#define kBBGGRRX (kBlue << 0) | (kBlue << 4) | (kGreen << 8) | (kGreen << 12) | (kRed << 16) | (kRed << 20) | (kBlack << 24)
#define kRRGGBBX kRed, kRed, kGreen, kGreen, kBlue, kBlue, kBlack const uint rgb_mask[kBGRAxis] = { kRRGGBBX, kRRBBGGX, kBBGGRRX };
#define kRRBBGGX kRed, kRed, kBlue, kBlue, kGreen, kGreen, kBlack
#define kBBGGRRX kBlue, kBlue, kGreen, kGreen, kRed, kRed, kBlack
const uint kApertureGrilleMasks8K600TVL[kBGRAxis * kMaxApertureGrilleSize] = colour_mask = (rgb_mask[lcd_subpixel_layout] >> (mask * 4)) & 0xF;
{
kRRGGBBX, kRRBBGGX, kBBGGRRX
};
colour_mask = kApertureGrilleMasks8K600TVL[(lcd_subpixel_layout * kMaxApertureGrilleSize) + mask];
#undef kMaxApertureGrilleSize
#undef kRRGGBBX #undef kRRGGBBX
#undef kRRBBGGX #undef kRRBBGGX
@ -473,20 +414,12 @@ void main()
} }
case k800TVL: case k800TVL:
{ {
#define kMaxApertureGrilleSize 5 #define kRYCBX (kRed << 0) | (kYellow << 6) | (kCyan << 12) | (kBlue << 18) | (kBlack << 24)
#define kRMCGX (kRed << 0) | (kMagenta << 6) | (kCyan << 12) | (kGreen << 18) | (kBlack << 24)
#define kBCYRX (kBlue << 0) | (kCyan << 6) | (kYellow << 12) | (kRed << 18) | (kBlack << 24)
#define kRYCBX kRed, kYellow, kCyan, kBlue, kBlack const uint rgb_mask[kBGRAxis] = { kRYCBX, kRMCGX, kBCYRX };
#define kRMCGX kRed, kMagenta, kCyan, kGreen, kBlack colour_mask = (rgb_mask[lcd_subpixel_layout] >> (mask * 6)) & 0x3F;
#define kBCYRX kBlue, kCyan, kYellow, kRed, kBlack
const uint kApertureGrilleMasks8K800TVL[kBGRAxis * kMaxApertureGrilleSize] =
{
kRYCBX, kRMCGX, kBCYRX
};
colour_mask = kApertureGrilleMasks8K800TVL[(lcd_subpixel_layout * kMaxApertureGrilleSize) + mask];
#undef kMaxApertureGrilleSize
#undef kRYCBX #undef kRYCBX
#undef kRMCGX #undef kRMCGX
@ -496,20 +429,13 @@ void main()
} }
case k1000TVL: case k1000TVL:
{ {
#define kMaxApertureGrilleSize 4 #define kRGBX (kRed << 0) | (kGreen << 4) | (kBlue << 8) | (kBlack << 12)
#define kRBGX (kRed << 0) | (kBlue << 4) | (kGreen << 8) | (kBlack << 12)
#define kBGRX (kBlue << 0) | (kGreen << 4) | (kRed << 8) | (kBlack << 12)
#define kRGBX kRed, kGreen, kBlue, kBlack const uint rgb_mask[kBGRAxis] = { kRGBX, kRBGX, kBGRX };
#define kRBGX kRed, kBlue, kGreen, kBlack
#define kBGRX kBlue, kGreen, kRed, kBlack
const uint kApertureGrilleMasks8K1000TVL[kBGRAxis * kMaxApertureGrilleSize] = colour_mask = (rgb_mask[lcd_subpixel_layout] >> (mask * 4)) & 0xF;
{
kRGBX, kRBGX, kBGRX
};
colour_mask = kApertureGrilleMasks8K1000TVL[(lcd_subpixel_layout * kMaxApertureGrilleSize) + mask];
#undef kMaxApertureGrilleSize
#undef kRGBX #undef kRGBX
#undef kRBGX #undef kRBGX
@ -547,17 +473,14 @@ void main()
{ {
case k300TVL: case k300TVL:
{ {
#define kMaxShadowMaskSizeX 6 #define kGRRBBG (kGreen << 0) | (kRed << 4) | (kRed << 8) | (kBlue << 12) | (kBlue << 16) | (kGreen << 20)
#define kMaxShadowMaskSizeY 4 #define kBBGGRR (kBlue << 0) | (kBlue << 4) | (kGreen << 8) | (kGreen << 12) | (kRed << 16) | (kRed << 20)
#define kGRRBBG kGreen, kRed, kRed, kBlue, kBlue, kGreen #define kBRRGGB (kBlue << 0) | (kRed << 4) | (kRed << 8) | (kGreen << 12) | (kGreen << 16) | (kBlue << 20)
#define kBBGGRR kBlue, kBlue, kGreen, kGreen, kRed, kRed #define kGGBBRR (kGreen << 0) | (kGreen << 4) | (kBlue << 8) | (kBlue << 12) | (kRed << 16) | (kRed << 20)
#define kBRRGGB kBlue, kRed, kRed, kGreen, kGreen, kBlue #define kGBBRRG (kGreen << 0) | (kBlue << 4) | (kBlue << 8) | (kRed << 12) | (kRed << 16) | (kGreen << 20)
#define kGGBBRR kGreen, kGreen, kBlue, kBlue, kRed, kRed #define kRRGGBB (kRed << 0) | (kRed << 4) | (kGreen << 8) | (kGreen << 12) | (kBlue << 16) | (kBlue << 20)
#define kGBBRRG kGreen, kBlue, kBlue, kRed, kRed, kGreen
#define kRRGGBB kRed, kRed, kGreen, kGreen, kBlue, kBlue
/* /*
kGRRBBG kGRRBBG
@ -576,20 +499,17 @@ void main()
kRRGGBB kRRGGBB
*/ */
const uint rgb_mask[kBGRAxis * 2] = { kGRRBBG, kBBGGRR, kBRRGGB, kGGBBRR, kGBBRRG, kRRGGBB };
if(shadow_y < 2) if(shadow_y < 2)
{ {
const uint rgb_mask[kBGRAxis * kMaxShadowMaskSizeX] = { kGRRBBG, kBRRGGB, kGBBRRG }; colour_mask = (rgb_mask[(lcd_subpixel_layout * 2) + 0] >> (mask * 4)) & 0xF;
colour_mask = rgb_mask[(lcd_subpixel_layout * kMaxShadowMaskSizeX) + mask];
} }
else else
{ {
const uint rgb_mask[kBGRAxis * kMaxShadowMaskSizeX] = { kBBGGRR, kGGBBRR, kRRGGBB }; colour_mask = (rgb_mask[(lcd_subpixel_layout * 2) + 1] >> (mask * 4)) & 0xF;
colour_mask = rgb_mask[(lcd_subpixel_layout * kMaxShadowMaskSizeX) + mask];
} }
#undef kMaxShadowMaskSizeX
#undef kMaxShadowMaskSizeY
#undef kGRRBBG #undef kGRRBBG
#undef kBBGGRR #undef kBBGGRR
@ -599,22 +519,15 @@ void main()
#undef kGBBRRG #undef kGBBRRG
#undef kRRGGBB #undef kRRGGBB
#undef kGRRBBG_GRRBBG_BBGGRR_BBGGRR
#undef kBRRGGB_BRRGGB_GGBBRR_GGBBRR
#undef kGBBRRG_GBBRRG_RRGGBB_RRGGBB
break; break;
} }
case k600TVL: case k600TVL:
{ {
#define kMaxShadowMaskSizeX 2 #define kMG (kMagenta << 0) | (kGreen << 6)
#define kMaxShadowMaskSizeY 2 #define kGM (kGreen << 0) | (kMagenta << 6)
#define kMG kMagenta, kGreen #define kYB (kYellow << 0) | (kBlue << 6)
#define kGM kGreen, kMagenta #define kBY (kBlue << 0) | (kYellow << 6)
#define kYB kYellow, kBlue
#define kBY kBlue, kYellow
/* /*
kMG kMG
@ -627,20 +540,17 @@ void main()
kMG kMG
*/ */
const uint rgb_mask[kBGRAxis * 2] = { kMG, kGM, kYB, kBY, kGM, kMG };
if(shadow_y < 1) if(shadow_y < 1)
{ {
const uint rgb_mask[kBGRAxis * kMaxShadowMaskSizeX] = { kMG, kYB, kGM }; colour_mask = (rgb_mask[(lcd_subpixel_layout * 2) + 0] >> (mask * 6)) & 0x3F;
colour_mask = rgb_mask[(lcd_subpixel_layout * kMaxShadowMaskSizeX) + mask];
} }
else else
{ {
const uint rgb_mask[kBGRAxis * kMaxShadowMaskSizeX] = { kGM, kBY, kMG }; colour_mask = (rgb_mask[(lcd_subpixel_layout * 2) + 1] >> (mask * 6)) & 0x3F;
colour_mask = rgb_mask[(lcd_subpixel_layout * kMaxShadowMaskSizeX) + mask];
} }
#undef kMaxShadowMaskSizeX
#undef kMaxShadowMaskSizeY
#undef kMG #undef kMG
#undef kGM #undef kGM
@ -743,17 +653,14 @@ void main()
} }
case k600TVL: case k600TVL:
{ {
#define kMaxShadowMaskSizeX 6 #define kGRRBBG (kGreen << 0) | (kRed << 4) | (kRed << 8) | (kBlue << 12) | (kBlue << 16) | (kGreen << 20)
#define kMaxShadowMaskSizeY 4 #define kBBGGRR (kBlue << 0) | (kBlue << 4) | (kGreen << 8) | (kGreen << 12) | (kRed << 16) | (kRed << 20)
#define kGRRBBG kGreen, kRed, kRed, kBlue, kBlue, kGreen #define kBRRGGB (kBlue << 0) | (kRed << 4) | (kRed << 8) | (kGreen << 12) | (kGreen << 16) | (kBlue << 20)
#define kBBGGRR kBlue, kBlue, kGreen, kGreen, kRed, kRed #define kGGBBRR (kGreen << 0) | (kGreen << 4) | (kBlue << 8) | (kBlue << 12) | (kRed << 16) | (kRed << 20)
#define kBRRGGB kBlue, kRed, kRed, kGreen, kGreen, kBlue #define kGBBRRG (kGreen << 0) | (kBlue << 4) | (kBlue << 8) | (kRed << 12) | (kRed << 16) | (kGreen << 20)
#define kGGBBRR kGreen, kGreen, kBlue, kBlue, kRed, kRed #define kRRGGBB (kRed << 0) | (kRed << 4) | (kGreen << 8) | (kGreen << 12) | (kBlue << 16) | (kBlue << 20)
#define kGBBRRG kGreen, kBlue, kBlue, kRed, kRed, kGreen
#define kRRGGBB kRed, kRed, kGreen, kGreen, kBlue, kBlue
/* /*
kGRRBBG kGRRBBG
@ -772,20 +679,17 @@ void main()
kRRGGBB kRRGGBB
*/ */
const uint rgb_mask[kBGRAxis * 2] = { kGRRBBG, kBBGGRR, kBRRGGB, kGGBBRR, kGBBRRG, kRRGGBB };
if(shadow_y < 2) if(shadow_y < 2)
{ {
const uint rgb_mask[kBGRAxis * kMaxShadowMaskSizeX] = { kGRRBBG, kBRRGGB, kGBBRRG }; colour_mask = (rgb_mask[(lcd_subpixel_layout * 2) + 0] >> (mask * 4)) & 0xF;
colour_mask = rgb_mask[(lcd_subpixel_layout * kMaxShadowMaskSizeX) + mask];
} }
else else
{ {
const uint rgb_mask[kBGRAxis * kMaxShadowMaskSizeX] = { kBBGGRR, kGGBBRR, kRRGGBB }; colour_mask = (rgb_mask[(lcd_subpixel_layout * 2) + 1] >> (mask * 4)) & 0xF;
colour_mask = rgb_mask[(lcd_subpixel_layout * kMaxShadowMaskSizeX) + mask];
} }
#undef kMaxShadowMaskSizeX
#undef kMaxShadowMaskSizeY
#undef kGRRBBG #undef kGRRBBG
#undef kBBGGRR #undef kBBGGRR
@ -799,14 +703,11 @@ void main()
} }
case k800TVL: case k800TVL:
{ {
#define kMaxShadowMaskSizeX 2 #define kMG (kMagenta << 0) | (kGreen << 6)
#define kMaxShadowMaskSizeY 2 #define kGM (kGreen << 0) | (kMagenta << 6)
#define kMG kMagenta, kGreen #define kYB (kYellow << 0) | (kBlue << 6)
#define kGM kGreen, kMagenta #define kBY (kBlue << 0) | (kYellow << 6)
#define kYB kYellow, kBlue
#define kBY kBlue, kYellow
/* /*
kMG kMG
@ -819,20 +720,17 @@ void main()
kMG kMG
*/ */
const uint rgb_mask[kBGRAxis * 2] = { kMG, kGM, kYB, kBY, kGM, kMG };
if(shadow_y < 1) if(shadow_y < 1)
{ {
const uint rgb_mask[kBGRAxis * kMaxShadowMaskSizeX] = { kMG, kYB, kGM }; colour_mask = (rgb_mask[(lcd_subpixel_layout * 2) + 0] >> (mask * 6)) & 0x3F;
colour_mask = rgb_mask[(lcd_subpixel_layout * kMaxShadowMaskSizeX) + mask];
} }
else else
{ {
const uint rgb_mask[kBGRAxis * kMaxShadowMaskSizeX] = { kGM, kBY, kMG }; colour_mask = (rgb_mask[(lcd_subpixel_layout * 2) + 1] >> (mask * 6)) & 0x3F;
colour_mask = rgb_mask[(lcd_subpixel_layout * kMaxShadowMaskSizeX) + mask];
} }
#undef kMaxShadowMaskSizeX
#undef kMaxShadowMaskSizeY
#undef kMG #undef kMG
#undef kGM #undef kGM
@ -843,14 +741,11 @@ void main()
} }
case k1000TVL: case k1000TVL:
{ {
#define kMaxShadowMaskSizeX 2 #define kMG (kMagenta << 0) | (kGreen << 6)
#define kMaxShadowMaskSizeY 2 #define kGM (kGreen << 0) | (kMagenta << 6)
#define kMG kMagenta, kGreen #define kYB (kYellow << 0) | (kBlue << 6)
#define kGM kGreen, kMagenta #define kBY (kBlue << 0) | (kYellow << 6)
#define kYB kYellow, kBlue
#define kBY kBlue, kYellow
/* /*
kMG kMG
@ -863,22 +758,17 @@ void main()
kMG kMG
*/ */
const uint rgb_mask[kBGRAxis * 2] = { kMG, kGM, kYB, kBY, kGM, kMG };
if(shadow_y < 1) if(shadow_y < 1)
{ {
const uint rgb_mask[kBGRAxis * kMaxShadowMaskSizeX] = { kMG, kYB, kGM }; colour_mask = (rgb_mask[(lcd_subpixel_layout * 2) + 0] >> (mask * 6)) & 0x3F;
colour_mask = rgb_mask[(lcd_subpixel_layout * kMaxShadowMaskSizeX) + mask];
} }
else else
{ {
const uint rgb_mask[kBGRAxis * kMaxShadowMaskSizeX] = { kGM, kBY, kMG }; colour_mask = (rgb_mask[(lcd_subpixel_layout * 2) + 1] >> (mask * 6)) & 0x3F;
colour_mask = rgb_mask[(lcd_subpixel_layout * kMaxShadowMaskSizeX) + mask];
} }
#undef kMaxShadowMaskSizeX
#undef kMaxShadowMaskSizeY
#undef kXXXX
#undef kMG #undef kMG
#undef kGM #undef kGM
@ -1037,19 +927,21 @@ void main()
} }
case k800TVL: case k800TVL:
{ {
#define kMaxShadowMaskSizeX 6 #define kGRRBBG (kGreen << 0) | (kRed << 4) | (kRed << 8) | (kBlue << 12) | (kBlue << 16) | (kGreen << 20)
#define kMaxShadowMaskSizeY 4 #define kBBGGRR (kBlue << 0) | (kBlue << 4) | (kGreen << 8) | (kGreen << 12) | (kRed << 16) | (kRed << 20)
#define kGRRBBG kGreen, kRed, kRed, kBlue, kBlue, kGreen #define kBRRGGB (kBlue << 0) | (kRed << 4) | (kRed << 8) | (kGreen << 12) | (kGreen << 16) | (kBlue << 20)
#define kBBGGRR kBlue, kBlue, kGreen, kGreen, kRed, kRed #define kGGBBRR (kGreen << 0) | (kGreen << 4) | (kBlue << 8) | (kBlue << 12) | (kRed << 16) | (kRed << 20)
#define kBRRGGB kBlue, kRed, kRed, kGreen, kGreen, kBlue #define kGBBRRG (kGreen << 0) | (kBlue << 4) | (kBlue << 8) | (kRed << 12) | (kRed << 16) | (kGreen << 20)
#define kGGBBRR kGreen, kGreen, kBlue, kBlue, kRed, kRed #define kRRGGBB (kRed << 0) | (kRed << 4) | (kGreen << 8) | (kGreen << 12) | (kBlue << 16) | (kBlue << 20)
#define kGBBRRG kGreen, kBlue, kBlue, kRed, kRed, kGreen
#define kRRGGBB kRed, kRed, kGreen, kGreen, kBlue, kBlue
/* /*
kGRRBBG
kGRRBBG
kBBGGRR
kBBGGRR
kBRRGGB kBRRGGB
kBRRGGB kBRRGGB
kGGBBRR kGGBBRR
@ -1059,27 +951,19 @@ void main()
kGBBRRG kGBBRRG
kRRGGBB kRRGGBB
kRRGGBB kRRGGBB
kGRRBBG
kGRRBBG
kBBGGRR
kBBGGRR
*/ */
const uint rgb_mask[kBGRAxis * 2] = { kGRRBBG, kBBGGRR, kBRRGGB, kGGBBRR, kGBBRRG, kRRGGBB };
if(shadow_y < 2) if(shadow_y < 2)
{ {
const uint rgb_mask[kBGRAxis * kMaxShadowMaskSizeX] = { kGRRBBG, kBRRGGB, kGBBRRG }; colour_mask = (rgb_mask[(lcd_subpixel_layout * 2) + 0] >> (mask * 4)) & 0xF;
colour_mask = rgb_mask[(lcd_subpixel_layout * kMaxShadowMaskSizeX) + mask];
} }
else else
{ {
const uint rgb_mask[kBGRAxis * kMaxShadowMaskSizeX] = { kBBGGRR, kGGBBRR, kRRGGBB }; colour_mask = (rgb_mask[(lcd_subpixel_layout * 2) + 1] >> (mask * 4)) & 0xF;
colour_mask = rgb_mask[(lcd_subpixel_layout * kMaxShadowMaskSizeX) + mask];
} }
#undef kMaxShadowMaskSizeX
#undef kMaxShadowMaskSizeY
#undef kGRRBBG #undef kGRRBBG
#undef kBBGGRR #undef kBBGGRR
@ -1093,19 +977,21 @@ void main()
} }
case k1000TVL: case k1000TVL:
{ {
#define kMaxShadowMaskSizeX 6 #define kGRRBBG (kGreen << 0) | (kRed << 4) | (kRed << 8) | (kBlue << 12) | (kBlue << 16) | (kGreen << 20)
#define kMaxShadowMaskSizeY 4 #define kBBGGRR (kBlue << 0) | (kBlue << 4) | (kGreen << 8) | (kGreen << 12) | (kRed << 16) | (kRed << 20)
#define kGRRBBG kGreen, kRed, kRed, kBlue, kBlue, kGreen #define kBRRGGB (kBlue << 0) | (kRed << 4) | (kRed << 8) | (kGreen << 12) | (kGreen << 16) | (kBlue << 20)
#define kBBGGRR kBlue, kBlue, kGreen, kGreen, kRed, kRed #define kGGBBRR (kGreen << 0) | (kGreen << 4) | (kBlue << 8) | (kBlue << 12) | (kRed << 16) | (kRed << 20)
#define kBRRGGB kBlue, kRed, kRed, kGreen, kGreen, kBlue #define kGBBRRG (kGreen << 0) | (kBlue << 4) | (kBlue << 8) | (kRed << 12) | (kRed << 16) | (kGreen << 20)
#define kGGBBRR kGreen, kGreen, kBlue, kBlue, kRed, kRed #define kRRGGBB (kRed << 0) | (kRed << 4) | (kGreen << 8) | (kGreen << 12) | (kBlue << 16) | (kBlue << 20)
#define kGBBRRG kGreen, kBlue, kBlue, kRed, kRed, kGreen
#define kRRGGBB kRed, kRed, kGreen, kGreen, kBlue, kBlue
/* /*
kGRRBBG
kGRRBBG
kBBGGRR
kBBGGRR
kBRRGGB kBRRGGB
kBRRGGB kBRRGGB
kGGBBRR kGGBBRR
@ -1115,27 +1001,19 @@ void main()
kGBBRRG kGBBRRG
kRRGGBB kRRGGBB
kRRGGBB kRRGGBB
kGRRBBG
kGRRBBG
kBBGGRR
kBBGGRR
*/ */
const uint rgb_mask[kBGRAxis * 2] = { kGRRBBG, kBBGGRR, kBRRGGB, kGGBBRR, kGBBRRG, kRRGGBB };
if(shadow_y < 2) if(shadow_y < 2)
{ {
const uint rgb_mask[kBGRAxis * kMaxShadowMaskSizeX] = { kGRRBBG, kBRRGGB, kGBBRRG }; colour_mask = (rgb_mask[(lcd_subpixel_layout * 2) + 0] >> (mask * 4)) & 0xF;
colour_mask = rgb_mask[(lcd_subpixel_layout * kMaxShadowMaskSizeX) + mask];
} }
else else
{ {
const uint rgb_mask[kBGRAxis * kMaxShadowMaskSizeX] = { kBBGGRR, kGGBBRR, kRRGGBB }; colour_mask = (rgb_mask[(lcd_subpixel_layout * 2) + 1] >> (mask * 4)) & 0xF;
colour_mask = rgb_mask[(lcd_subpixel_layout * kMaxShadowMaskSizeX) + mask];
} }
#undef kMaxShadowMaskSizeX
#undef kMaxShadowMaskSizeY
#undef kGRRBBG #undef kGRRBBG
#undef kBBGGRR #undef kBBGGRR
@ -1182,12 +1060,9 @@ void main()
{ {
case k300TVL: case k300TVL:
{ {
#define kMaxSlotMaskSize 4 #define kRGBX (kRed << 0) | (kGreen << 4) | (kBlue << 8) | (kBlack << 12)
#define kMaxSlotSizeY 4 #define kRBGX (kRed << 0) | (kBlue << 4) | (kGreen << 8) | (kBlack << 12)
#define kBGRX (kBlue << 0) | (kGreen << 4) | (kRed << 8) | (kBlack << 12)
#define kRGBX kRed, kGreen, kBlue, kBlack
#define kRBGX kRed, kBlue, kGreen, kBlack
#define kBGRX kBlue, kGreen, kRed, kBlack
/* /*
kRGBX, kRGBX kRGBX, kRGBX
@ -1212,13 +1087,10 @@ void main()
} }
else else
{ {
const uint rgb_mask[kBGRAxis * kMaxSlotMaskSize] = { kRGBX, kRBGX, kBGRX }; const uint rgb_mask[kBGRAxis] = { kRGBX, kRBGX, kBGRX };
colour_mask = rgb_mask[(lcd_subpixel_layout * kMaxSlotMaskSize) + mask]; colour_mask = (rgb_mask[lcd_subpixel_layout] >> (mask * 4)) & 0xF;
} }
#undef kMaxSlotMaskSize
#undef kMaxSlotSizeY
#undef kRGBX #undef kRGBX
#undef kRBGX #undef kRBGX
#undef kBGRX #undef kBGRX
@ -1227,12 +1099,9 @@ void main()
} }
case k600TVL: case k600TVL:
{ {
#define kMaxSlotMaskSize 2 #define kMG (kMagenta << 0) | (kGreen << 6)
#define kMaxSlotSizeY 4 #define kYB (kYellow << 0) | (kBlue << 6)
#define kGM (kGreen << 0) | (kMagenta << 6)
#define kMG kMagenta, kGreen
#define kYB kYellow, kBlue
#define kGM kGreen, kMagenta
/* /*
kMG, kMG kMG, kMG
@ -1257,13 +1126,10 @@ void main()
} }
else else
{ {
const uint rgb_mask[kBGRAxis * kMaxSlotMaskSize] = { kMG, kYB, kGM }; const uint rgb_mask[kBGRAxis] = { kMG, kYB, kGM };
colour_mask = rgb_mask[(lcd_subpixel_layout * kMaxSlotMaskSize) + mask]; colour_mask = (rgb_mask[lcd_subpixel_layout] >> (mask * 6)) & 0x3F;
} }
#undef kMaxSlotMaskSize
#undef kMaxSlotSizeY
#undef kMG #undef kMG
#undef kYB #undef kYB
#undef kGM #undef kGM
@ -1348,12 +1214,9 @@ void main()
{ {
case k300TVL: case k300TVL:
{ {
#define kMaxSlotMaskSize 7 #define kRRGGBBX (kRed << 0) | (kRed << 4) | (kGreen << 8) | (kGreen << 12) | (kBlue << 16) | (kBlue << 20) | (kBlack << 24)
#define kMaxSlotSizeY 8 #define kRRBBGGX (kRed << 0) | (kRed << 4) | (kBlue << 8) | (kBlue << 12) | (kGreen << 16) | (kGreen << 20) | (kBlack << 24)
#define kBBGGRRX (kBlue << 0) | (kBlue << 4) | (kGreen << 8) | (kGreen << 12) | (kRed << 16) | (kRed << 20) | (kBlack << 24)
#define kRRGGBBX kRed, kRed, kGreen, kGreen, kBlue, kBlue, kBlack
#define kRRBBGGX kRed, kRed, kBlue, kBlue, kGreen, kGreen, kBlack
#define kBBGGRRX kBlue, kBlue, kGreen, kGreen, kRed, kRed, kBlack
/* /*
kRRGGBBX, kRRGGBBX kRRGGBBX, kRRGGBBX
@ -1390,13 +1253,10 @@ void main()
} }
else else
{ {
const uint rgb_mask[kBGRAxis * kMaxSlotMaskSize] = { kRRGGBBX, kRRBBGGX, kBBGGRRX }; const uint rgb_mask[kBGRAxis] = { kRRGGBBX, kRRBBGGX, kBBGGRRX };
colour_mask = rgb_mask[(lcd_subpixel_layout * kMaxSlotMaskSize) + mask]; colour_mask = (rgb_mask[lcd_subpixel_layout] >> (mask * 4)) & 0xF;
} }
#undef kMaxSlotMaskSize
#undef kMaxSlotSizeY
#undef kRRGGBBX #undef kRRGGBBX
#undef kRRBBGGX #undef kRRBBGGX
#undef kBBGGRRX #undef kBBGGRRX
@ -1405,34 +1265,24 @@ void main()
} }
case k600TVL: case k600TVL:
{ {
// 600 TVL #define kRGBX (kRed << 0) | (kGreen << 4) | (kBlue << 8) | (kBlack << 12)
#define kMaxSlotMaskSize 4 #define kRBGX (kRed << 0) | (kBlue << 4) | (kGreen << 8) | (kBlack << 12)
#define kMaxSlotSizeY 6 #define kBGRX (kBlue << 0) | (kGreen << 4) | (kRed << 8) | (kBlack << 12)
#define kRGBX kRed, kGreen, kBlue, kBlack
#define kRBGX kRed, kBlue, kGreen, kBlack
#define kBGRX kBlue, kGreen, kRed, kBlack
/* /*
kRGBX, kRGBX
kRGBX, kRGBX kRGBX, kRGBX
kRGBX, kXXXX kRGBX, kXXXX
kRGBX, kRGBX kRGBX, kRGBX
kRGBX, kRGBX
kXXXX, kRGBX kXXXX, kRGBX
kRBGX, kRBGX
kRBGX, kRBGX kRBGX, kRBGX
kRBGX, kXXXX kRBGX, kXXXX
kRBGX, kRBGX kRBGX, kRBGX
kRBGX, kRBGX
kXXXX, kRBGX kXXXX, kRBGX
kBGRX, kBGRX
kBGRX, kBGRX kBGRX, kBGRX
kBGRX, kXXXX kBGRX, kXXXX
kBGRX, kBGRX kBGRX, kBGRX
kBGRX, kBGRX
kXXXX, kBGRX kXXXX, kBGRX
*/ */
@ -1442,13 +1292,10 @@ void main()
} }
else else
{ {
const uint rgb_mask[kBGRAxis * kMaxSlotMaskSize] = { kRGBX, kRBGX, kBGRX }; const uint rgb_mask[kBGRAxis] = { kRGBX, kRBGX, kBGRX };
colour_mask = rgb_mask[(lcd_subpixel_layout * kMaxSlotMaskSize) + mask]; colour_mask = (rgb_mask[lcd_subpixel_layout] >> (mask * 4)) & 0xF;
} }
#undef kMaxSlotMaskSize
#undef kMaxSlotSizeY
#undef kRGBX #undef kRGBX
#undef kRBGX #undef kRBGX
#undef kBGRX #undef kBGRX
@ -1457,12 +1304,9 @@ void main()
} }
case k800TVL: case k800TVL:
{ {
#define kMaxSlotMaskSize 3 #define kBGR (kBlue << 0) | (kGreen << 4) | (kRed << 8)
#define kMaxSlotSizeY 4 #define kGBR (kGreen << 0) | (kBlue << 4) | (kRed << 8)
#define kRGB (kRed << 0) | (kGreen << 4) | (kBlue << 8)
#define kBGR kBlue, kGreen, kRed
#define kGBR kGreen, kBlue, kRed
#define kRGB kRed, kGreen, kBlue
/* /*
kBGR, kBGR kBGR, kBGR
@ -1487,13 +1331,10 @@ void main()
} }
else else
{ {
const uint rgb_mask[kBGRAxis * kMaxSlotMaskSize] = { kBGR, kGBR, kRGB }; const uint rgb_mask[kBGRAxis] = { kBGR, kGBR, kRGB };
colour_mask = rgb_mask[(lcd_subpixel_layout * kMaxSlotMaskSize) + mask]; colour_mask = (rgb_mask[lcd_subpixel_layout] >> (mask * 4)) & 0xF;
} }
#undef kMaxSlotMaskSize
#undef kMaxSlotSizeY
#undef kBGR #undef kBGR
#undef kGBR #undef kGBR
#undef kRGB #undef kRGB
@ -1502,28 +1343,25 @@ void main()
} }
case k1000TVL: case k1000TVL:
{ {
#define kMaxSlotMaskSize 2 #define kMG (kMagenta << 0) | (kGreen << 6)
#define kMaxSlotSizeY 4 #define kYB (kYellow << 0) | (kBlue << 6)
#define kGM (kGreen << 0) | (kMagenta << 6)
#define kMG kMagenta, kGreen
#define kYB kYellow, kBlue
#define kGM kGreen, kMagenta
/* /*
kMG, kMG kMG, kMG
kMG, kXX kMG, kXX
kMG, kMG kMG, kMG
kXX, kMG kXX, kMG
kYB, kYB kYB, kYB
kYB, kXX kYB, kXX
kYB, kYB kYB, kYB
kXX, kYB kXX, kYB
kGM, kGM kGM, kGM
kGM, kXX kGM, kXX
kGM, kGM kGM, kGM
kXX, kGM kXX, kGM
*/ */
if((element == 3) || (element == 6)) if((element == 3) || (element == 6))
@ -1532,13 +1370,10 @@ void main()
} }
else else
{ {
const uint rgb_mask[kBGRAxis * kMaxSlotMaskSize] = { kMG, kYB, kGM }; const uint rgb_mask[kBGRAxis] = { kMG, kYB, kGM };
colour_mask = rgb_mask[(lcd_subpixel_layout * kMaxSlotMaskSize) + mask]; colour_mask = (rgb_mask[lcd_subpixel_layout] >> (mask * 6)) & 0x3F;
} }
#undef kMaxSlotMaskSize
#undef kMaxSlotSizeY
#undef kMG #undef kMG
#undef kYB #undef kYB
#undef kGM #undef kGM
@ -1559,12 +1394,9 @@ void main()
{ {
case k300TVL: case k300TVL:
{ {
#define kMaxSlotMaskSize 7 #define kRRGGBBX (kRed << 0) | (kRed << 4) | (kGreen << 8) | (kGreen << 12) | (kBlue << 16) | (kBlue << 20) | (kBlack << 24)
#define kMaxSlotSizeY 6 #define kRRBBGGX (kRed << 0) | (kRed << 4) | (kBlue << 8) | (kBlue << 12) | (kGreen << 16) | (kGreen << 20) | (kBlack << 24)
#define kBBGGRRX (kBlue << 0) | (kBlue << 4) | (kGreen << 8) | (kGreen << 12) | (kRed << 16) | (kRed << 20) | (kBlack << 24)
#define kRRGGBBX kRed, kRed, kGreen, kGreen, kBlue, kBlue, kBlack
#define kRRBBGGX kRed, kRed, kBlue, kBlue, kGreen, kGreen, kBlack
#define kBBGGRRX kBlue, kBlue, kGreen, kGreen, kRed, kRed, kBlack
/* /*
kRRGGBBX, kRRGGBBX kRRGGBBX, kRRGGBBX
@ -1595,13 +1427,10 @@ void main()
} }
else else
{ {
const uint rgb_mask[kBGRAxis * kMaxSlotMaskSize] = { kRRGGBBX, kRRBBGGX, kBBGGRRX }; const uint rgb_mask[kBGRAxis] = { kRRGGBBX, kRRBBGGX, kBBGGRRX };
colour_mask = rgb_mask[(lcd_subpixel_layout * kMaxSlotMaskSize) + mask]; colour_mask = (rgb_mask[lcd_subpixel_layout] >> (mask * 4)) & 0xF;
} }
#undef kMaxSlotMaskSize
#undef kMaxSlotSizeY
#undef kRRGGBBX #undef kRRGGBBX
#undef kRRBBGGX #undef kRRBBGGX
#undef kBBGGRRX #undef kBBGGRRX
@ -1610,12 +1439,9 @@ void main()
} }
case k600TVL: case k600TVL:
{ {
#define kMaxSlotMaskSize 7 #define kRRGGBBX (kRed << 0) | (kRed << 4) | (kGreen << 8) | (kGreen << 12) | (kBlue << 16) | (kBlue << 20) | (kBlack << 24)
#define kMaxSlotSizeY 6 #define kRRBBGGX (kRed << 0) | (kRed << 4) | (kBlue << 8) | (kBlue << 12) | (kGreen << 16) | (kGreen << 20) | (kBlack << 24)
#define kBBGGRRX (kBlue << 0) | (kBlue << 4) | (kGreen << 8) | (kGreen << 12) | (kRed << 16) | (kRed << 20) | (kBlack << 24)
#define kRRGGBBX kRed, kRed, kGreen, kGreen, kBlue, kBlue, kBlack
#define kRRBBGGX kRed, kRed, kBlue, kBlue, kGreen, kGreen, kBlack
#define kBBGGRRX kBlue, kBlue, kGreen, kGreen, kRed, kRed, kBlack
/* /*
kRRGGBBX, kRRGGBBX kRRGGBBX, kRRGGBBX
@ -1646,8 +1472,8 @@ void main()
} }
else else
{ {
const uint rgb_mask[kBGRAxis * kMaxSlotMaskSize] = { kRRGGBBX, kRRBBGGX, kBBGGRRX }; const uint rgb_mask[kBGRAxis] = { kRRGGBBX, kRRBBGGX, kBBGGRRX };
colour_mask = rgb_mask[(lcd_subpixel_layout * kMaxSlotMaskSize) + mask]; colour_mask = (rgb_mask[lcd_subpixel_layout] >> (mask * 4)) & 0xF;
} }
#undef kMaxSlotMaskSize #undef kMaxSlotMaskSize
@ -1661,12 +1487,9 @@ void main()
} }
case k800TVL: case k800TVL:
{ {
#define kMaxSlotMaskSize 5 #define kRYCBX (kRed << 0) | (kYellow << 6) | (kCyan << 12) | (kBlue << 18) | (kBlack << 24)
#define kMaxSlotSizeY 4 #define kRMCGX (kRed << 0) | (kMagenta << 6) | (kCyan << 12) | (kGreen << 18) | (kBlack << 24)
#define kBCYRX (kBlue << 0) | (kCyan << 6) | (kYellow << 12) | (kRed << 18) | (kBlack << 24)
#define kRYCBX kRed, kYellow, kCyan, kBlue, kBlack
#define kRMCGX kRed, kMagenta, kCyan, kGreen, kBlack
#define kBCYRX kBlue, kCyan, kYellow, kRed, kBlack
/* /*
kRYCBX, kRYCBX kRYCBX, kRYCBX
@ -1691,13 +1514,10 @@ void main()
} }
else else
{ {
const uint rgb_mask[kBGRAxis * kMaxSlotMaskSize] = { kRYCBX, kRMCGX, kBCYRX }; const uint rgb_mask[kBGRAxis] = { kRYCBX, kRMCGX, kBCYRX };
colour_mask = rgb_mask[(lcd_subpixel_layout * kMaxSlotMaskSize) + mask]; colour_mask = (rgb_mask[lcd_subpixel_layout] >> (mask * 6)) & 0x3F;
} }
#undef kMaxSlotMaskSize
#undef kMaxSlotSizeY
#undef kRYCBX #undef kRYCBX
#undef kRMCGX #undef kRMCGX
#undef kBCYRX #undef kBCYRX
@ -1706,43 +1526,37 @@ void main()
} }
case k1000TVL: case k1000TVL:
{ {
#define kMaxSlotMaskSize 4 #define kRGBX (kRed << 0) | (kGreen << 4) | (kBlue << 8) | (kBlack << 12)
#define kMaxSlotSizeY 4 #define kRBGX (kRed << 0) | (kBlue << 4) | (kGreen << 8) | (kBlack << 12)
#define kBGRX (kBlue << 0) | (kGreen << 4) | (kRed << 8) | (kBlack << 12)
#define kRGBX kRed, kGreen, kBlue, kBlack
#define kRBGX kRed, kBlue, kGreen, kBlack
#define kBGRX kBlue, kGreen, kRed, kBlack
/* /*
kRGBX, kRGBX kRGBX, kRGBX
kRGBX, kXXXX kRGBX, kXXXX
kRGBX, kRGBX kRGBX, kRGBX
kXXXX, kRGBX kXXXX, kRGBX
kRBGX, kRBGX kRBGX, kRBGX
kRBGX, kXXXX kRBGX, kXXXX
kRBGX, kRBGX kRBGX, kRBGX
kXXXX, kRBGX kXXXX, kRBGX
kBGRX, kBGRX kBGRX, kBGRX
kBGRX, kXXXX kBGRX, kXXXX
kBGRX, kBGRX kBGRX, kBGRX
kXXXX, kBGRX kXXXX, kBGRX
*/ */
if((element == 3) || (element == 6)) if((element == 5) || (element == 10))
{ {
colour_mask = kBlack; colour_mask = kBlack;
} }
else else
{ {
const uint rgb_mask[kBGRAxis * kMaxSlotMaskSize] = { kRGBX, kRBGX, kBGRX }; const uint rgb_mask[kBGRAxis] = { kRGBX, kRBGX, kBGRX };
colour_mask = rgb_mask[(lcd_subpixel_layout * kMaxSlotMaskSize) + mask]; colour_mask = (rgb_mask[lcd_subpixel_layout] >> (mask * 4)) & 0xF;
} }
#undef kMaxSlotMaskSize
#undef kMaxSlotSizeY
#undef kRGBX #undef kRGBX
#undef kRBGX #undef kRBGX
#undef kBGRX #undef kBGRX