[FFmpeg-devel] [RFC][PATCH] Add support for 12-bit color mode.
compn
tempn
Sat Feb 27 05:23:38 CET 2010
On Sat, 27 Feb 2010 03:31:35 +0100, Janusz Krzysztofik wrote:
>@@ -1462,37 +1494,54 @@ static int rgbToRgbWrapper(SwsContext *c
> if ( (isBGRinInt(srcFormat) && isBGRinInt(dstFormat))
> || (isRGBinInt(srcFormat) && isRGBinInt(dstFormat))) {
> switch(srcId | (dstId<<4)) {
>- case 0x34: conv= rgb16to15; break;
>- case 0x36: conv= rgb24to15; break;
>- case 0x38: conv= rgb32to15; break;
>- case 0x43: conv= rgb15to16; break;
>- case 0x46: conv= rgb24to16; break;
>- case 0x48: conv= rgb32to16; break;
>- case 0x63: conv= rgb15to24; break;
>- case 0x64: conv= rgb16to24; break;
>- case 0x68: conv= rgb32to24; break;
>- case 0x83: conv= rgb15to32; break;
>- case 0x84: conv= rgb16to32; break;
>- case 0x86: conv= rgb24to32; break;
>+ case 0x56: conv= rgb15to12; break;
>+ case 0x57: conv= rgb16to12; break;
>+ case 0x5B: conv= rgb24to12; break;
>+ case 0x5F: conv= rgb32to12; break;
>+ case 0x65: conv= rgb12to15; break;
>+ case 0x67: conv= rgb16to15; break;
>+ case 0x6B: conv= rgb24to15; break;
>+ case 0x6F: conv= rgb32to15; break;
>+ case 0x75: conv= rgb12to16; break;
>+ case 0x76: conv= rgb15to16; break;
>+ case 0x7B: conv= rgb24to16; break;
>+ case 0x7F: conv= rgb32to16; break;
>+ case 0xB5: conv= rgb12to24; break;
>+ case 0xB6: conv= rgb15to24; break;
>+ case 0xB7: conv= rgb16to24; break;
>+ case 0xBF: conv= rgb32to24; break;
>+ case 0xF5: conv= rgb12to32; break;
>+ case 0xF6: conv= rgb15to32; break;
>+ case 0xF7: conv= rgb16to32; break;
>+ case 0xFB: conv= rgb24to32; break;
> }
> } else if ( (isBGRinInt(srcFormat) && isRGBinInt(dstFormat))
> || (isRGBinInt(srcFormat) && isBGRinInt(dstFormat))) {
> switch(srcId | (dstId<<4)) {
>- case 0x33: conv= rgb15tobgr15; break;
>- case 0x34: conv= rgb16tobgr15; break;
>- case 0x36: conv= rgb24tobgr15; break;
>- case 0x38: conv= rgb32tobgr15; break;
>- case 0x43: conv= rgb15tobgr16; break;
>- case 0x44: conv= rgb16tobgr16; break;
>- case 0x46: conv= rgb24tobgr16; break;
>- case 0x48: conv= rgb32tobgr16; break;
>- case 0x63: conv= rgb15tobgr24; break;
>- case 0x64: conv= rgb16tobgr24; break;
>- case 0x66: conv= rgb24tobgr24; break;
>- case 0x68: conv= rgb32tobgr24; break;
>- case 0x83: conv= rgb15tobgr32; break;
>- case 0x84: conv= rgb16tobgr32; break;
>- case 0x86: conv= rgb24tobgr32; break;
>+ case 0x55: conv= rgb12tobgr12; break;
>+ case 0x56: conv= rgb15tobgr12; break;
>+ case 0x57: conv= rgb16tobgr12; break;
>+ case 0x5B: conv= rgb24tobgr12; break;
>+ case 0x5F: conv= rgb32tobgr12; break;
>+ case 0x65: conv= rgb12tobgr15; break;
>+ case 0x66: conv= rgb15tobgr15; break;
>+ case 0x67: conv= rgb16tobgr15; break;
>+ case 0x6B: conv= rgb24tobgr15; break;
>+ case 0x6F: conv= rgb32tobgr15; break;
>+ case 0x75: conv= rgb12tobgr16; break;
>+ case 0x76: conv= rgb15tobgr16; break;
>+ case 0x77: conv= rgb16tobgr16; break;
>+ case 0x7B: conv= rgb24tobgr16; break;
>+ case 0x7F: conv= rgb32tobgr16; break;
>+ case 0xB5: conv= rgb12tobgr24; break;
>+ case 0xB6: conv= rgb15tobgr24; break;
>+ case 0xB7: conv= rgb16tobgr24; break;
>+ case 0xBB: conv= rgb24tobgr24; break;
>+ case 0xBF: conv= rgb32tobgr24; break;
>+ case 0xF5: conv= rgb12tobgr32; break;
>+ case 0xF6: conv= rgb15tobgr32; break;
>+ case 0xF7: conv= rgb16tobgr32; break;
>+ case 0xFB: conv= rgb24tobgr32; break;
why the change in case numbers?
> #if COMPILE_TEMPLATE_MMX
>- c->blueDither= ff_dither8[dstY&1];
>- if (c->dstFormat == PIX_FMT_RGB555 || c->dstFormat == PIX_FMT_BGR555)
>- c->greenDither= ff_dither8[dstY&1];
>- else
>- c->greenDither= ff_dither4[dstY&1];
>- c->redDither= ff_dither8[(dstY+1)&1];
>+ if (c->dstFormat == PIX_FMT_RGB444 || c->dstFormat == PIX_FMT_BGR444) {
>+ c->blueDither= ff_dither16[dstY&1];
>+ c->greenDither= ff_dither16[dstY&1];
>+ c->redDither= ff_dither16[(dstY+1)&1];
>+ } else {
>+ c->blueDither= ff_dither8[dstY&1];
>+ if (c->dstFormat == PIX_FMT_RGB555 || c->dstFormat == PIX_FMT_BGR555)
>+ c->greenDither= ff_dither8[dstY&1];
>+ else
>+ c->greenDither= ff_dither4[dstY&1];
>+ c->redDither= ff_dither8[(dstY+1)&1];
>+ }
should the (more common) rgb/bgr555 be before the (rare) rgb/bgr444 or
is this not speed critical?
-compn
More information about the ffmpeg-devel
mailing list