[FFmpeg-devel] [PATCH] libswscale: Extend the generic path of the yuv2rgb converter with support for rgb444 output format

Janusz Krzysztofik jkrzyszt
Thu Mar 18 15:44:00 CET 2010


Michael,

Sorry for bothering you again, but just in case you might have missed this 
one: any chances for your review?

Thanks,
Janusz

--------------
Saturday 06 March 2010 02:43:03 Janusz Krzysztofik wrote:
> In order to play different video sources on a 12-bit display, like OMAP1
> frambuffer with 12-bit LCD controller that my Amstrad Delta videophone is
> equipped with, more rgb444 support is required in addition to that already
> added to the unaccelerated path of the unscaled yuv2rgb special converter.
>
> This patch tries to provide necessary support for the generic (slower) code
> path.
>
> Created and tested against libswscale svn revision 30842.
>
> Tested on Amstrad Delta, using patched mplayer video output drivers, with
> 24bpp IJPG sourcers that required scaling and with 8bpp RGB (gif) source.
>
> Signed-off-by: Janusz Krzysztofik <jkrzyszt at tis.icnet.pl>
> ---
> --- trunk/libswscale/swscale.c.orig	2010-03-05 14:13:14.000000000 +0100
> +++ trunk/libswscale/swscale.c	2010-03-05 20:31:46.000000000 +0100
> @@ -39,7 +39,7 @@
> 
>  /*
>  tested special converters (most are tested actually, but I did not write it down ...)
> - YV12 -> BGR16 
> + YV12 -> BGR12/BGR16
>   YV12 -> YV12
>   BGR15 -> BGR16
>   BGR16 -> BGR16
> @@ -806,6 +806,23 @@ static inline void yuv2nv12XinC(const in
>              }\
>          }\
>          break;\
> +    case PIX_FMT_RGB444BE:\
> +    case PIX_FMT_RGB444LE:\
> +    case PIX_FMT_BGR444BE:\
> +    case PIX_FMT_BGR444LE:\
> +        {\
> +            const int dr1= dither_4x4_16[y&3    ][0];\
> +            const int dg1= dither_4x4_16[y&3    ][1];\
> +            const int db1= dither_4x4_16[(y&3)^3][0];\
> +            const int dr2= dither_4x4_16[y&3    ][1];\
> +            const int dg2= dither_4x4_16[y&3    ][0];\
> +            const int db2= dither_4x4_16[(y&3)^3][1];\
> +            func(uint16_t,0)\
> +                ((uint16_t*)dest)[i2+0]= r[Y1+dr1] + g[Y1+dg1] + b[Y1+db1];\
> +                ((uint16_t*)dest)[i2+1]= r[Y2+dr2] + g[Y2+dg2] + b[Y2+db2];\
> +            }\ 
> +        }\
> +        break;\
>      case PIX_FMT_RGB8:\
>      case PIX_FMT_BGR8:\
>          {\
> --- trunk/libswscale/utils.c.orig	2010-03-05 14:13:14.000000000 +0100
> +++ trunk/libswscale/utils.c	2010-03-05 20:31:46.000000000 +0100
> @@ -1115,7 +1115,9 @@ SwsContext *sws_getContext(int srcW, int
>          av_log(c, AV_LOG_INFO, "from %s to %s%s ",
>                 sws_format_name(srcFormat),
>  #ifdef DITHER1XBPP
> -               dstFormat == PIX_FMT_BGR555 || dstFormat == PIX_FMT_BGR565 ? "dithered " : "",
> +               dstFormat == PIX_FMT_BGR555 || dstFormat == PIX_FMT_BGR565 ||
> +               dstFormat == PIX_FMT_RGB444BE || dstFormat == PIX_FMT_RGB444LE ||
> +               dstFormat == PIX_FMT_BGR444BE || dstFormat == PIX_FMT_BGR444LE ? "dithered" : "",
>  #else 
>                 "",
>  #endif
> @@ -1184,6 +1186,9 @@ SwsContext *sws_getContext(int srcW, int
>              av_log(c, AV_LOG_VERBOSE, "using %s YV12->BGR16 converter\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
>          else if > (dstFormat==PIX_FMT_BGR555)
>              av_log(c, AV_LOG_VERBOSE, "using %s YV12->BGR15 converter\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
> +        else if (dstFormat == PIX_FMT_RGB444BE || dstFormat == PIX_FMT_RGB444LE ||
> +                 dstFormat == PIX_FMT_BGR444BE || dstFormat == PIX_FMT_BGR444LE)
> +            av_log(c, AV_LOG_VERBOSE, "using %s YV12->BGR12 converter\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
> 
>          av_log(c, AV_LOG_VERBOSE, "%dx%d -> %dx%d\n", srcW, srcH, dstW, dstH);
>          av_log(c, AV_LOG_DEBUG, "lum srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n",



More information about the ffmpeg-devel mailing list