[FFmpeg-devel] [PATCH] Factorize dither string logging in sws_getContext()

Reimar Döffinger Reimar.Doeffinger
Sat Jan 16 17:03:59 CET 2010


On Sat, Jan 16, 2010 at 04:45:50PM +0100, Stefano Sabatini wrote:
> Hi, another very minor minor factorization.
> -- 
> FFmpeg = Freak and Faithful Magic Portable Elaborated Gadget

> Index: ffmpeg/libswscale/swscale.c
> ===================================================================
> --- ffmpeg.orig/libswscale/swscale.c	2010-01-16 16:39:19.000000000 +0100
> +++ ffmpeg/libswscale/swscale.c	2010-01-16 16:43:08.000000000 +0100
> @@ -2827,11 +2827,6 @@
>      assert(c->chrDstH <= dstH);
>  
>      if (flags&SWS_PRINT_INFO) {
> -#ifdef DITHER1XBPP
> -        const char *dither= " dithered";
> -#else
> -        const char *dither= "";
> -#endif
>          for (i = 0; i < FF_ARRAY_ELEMS(scaler_algos); i++)
>              if (flags & scaler_algos[i].flag) {
>                  av_log(c, AV_LOG_INFO, "%s scaler, ", scaler_algos[i].description);
> @@ -2842,7 +2837,13 @@
>  
>          av_log(c, AV_LOG_INFO, "from %s to%s %s ",
>                 sws_format_name(srcFormat),
> -               dstFormat == PIX_FMT_BGR555 || dstFormat == PIX_FMT_BGR565 ? dither : "",
> +               dstFormat == PIX_FMT_BGR555 || dstFormat == PIX_FMT_BGR565 ?
> +#ifdef DITHER1XBPP
> +               " dithered"
> +#else
> +               ""
> +#endif
> +               : "",

What? A bit much obfuscated.

#ifdef DITHER1XBPP
dstFormat == PIX_FMT_BGR555 || dstFormat == PIX_FMT_BGR565 ? " dithered" : "",
#else
"",
#endif

Or make DITHER1XBPP 0/1 and do
DITHER1XBPP && (dstFormat == PIX_FMT_BGR555 || dstFormat == PIX_FMT_BGR565) ? " dithered" : "",



More information about the ffmpeg-devel mailing list