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