[FFmpeg-devel] [PATCH 3/8] Optimize / simplify av_get_pix_fmt_name().

Stefano Sabatini stefano.sabatini-lala
Fri Nov 5 13:14:46 CET 2010


On date Friday 2010-11-05 12:10:51 +0100, Jean-Daniel Dupas encoded:
> 
> Le 5 nov. 2010 ? 12:00, Stefano Sabatini a ?crit :
> 
> > ---
> > libavutil/pixdesc.c |    6 ++----
> > 1 files changed, 2 insertions(+), 4 deletions(-)
> > 
> > diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
> > index c099d03..01e2917 100644
> > --- a/libavutil/pixdesc.c
> > +++ b/libavutil/pixdesc.c
> > @@ -816,10 +816,8 @@ static enum PixelFormat get_pix_fmt_internal(const char *name)
> > 
> > const char *av_get_pix_fmt_name(enum PixelFormat pix_fmt)
> > {
> > -    if (pix_fmt < 0 || pix_fmt >= PIX_FMT_NB)
> > -        return NULL;
> > -    else
> > -        return av_pix_fmt_descriptors[pix_fmt].name;
> > +    return ((unsigned)pix_fmt >= PIX_FMT_NB) ?
> > +        av_pix_fmt_descriptors[pix_fmt].name : NULL;
> > }
> > 
> 
> shouldn't it be "<= PIX_FMT_NB" ? 

No, it should be "< PIX_FMT_NB", thanks for spotting.

Patch updated.
-- 
FFmpeg = Fostering & Frenzy Mere Pitiful Elastic Governor



More information about the ffmpeg-devel mailing list