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

Stefano Sabatini stefano.sabatini-lala
Sat Jan 16 17:16:36 CET 2010


On date Saturday 2010-01-16 17:03:59 +0100, Reimar D?ffinger encoded:
> 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

Yes that's better.
 
> Or make DITHER1XBPP 0/1 and do
> DITHER1XBPP && (dstFormat == PIX_FMT_BGR555 || dstFormat == PIX_FMT_BGR565) ? " dithered" : "",

Regards.
-- 
FFmpeg = Forgiving & Friendly Muttering Patchable Encoding/decoding Gorilla
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lsws-factorize-dither-str.patch
Type: text/x-diff
Size: 1103 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100116/f774f310/attachment.patch>



More information about the ffmpeg-devel mailing list