[FFmpeg-devel] [PATCH] Implement av_get_pix_fmt_chroma_shift()

Stefano Sabatini stefano.sabatini-lala
Sun Jan 31 02:26:52 CET 2010


On date Sunday 2010-01-31 02:12:17 +0100, Michael Niedermayer encoded:
> On Sat, Jan 30, 2010 at 04:06:50PM +0100, Stefano Sabatini wrote:
> [...]
> > Index: ffmpeg/libavutil/pixdesc.c
> > ===================================================================
> > --- ffmpeg.orig/libavutil/pixdesc.c	2010-01-30 15:32:48.000000000 +0100
> > +++ ffmpeg/libavutil/pixdesc.c	2010-01-30 15:57:39.000000000 +0100
> > @@ -703,3 +703,11 @@
> >  
> >      return bits >> log2_pixels;
> >  }
> > +
> > +void av_get_pix_fmt_chroma_shift(int *w_shift, int *h_shift, enum PixelFormat pix_fmt)
> > +{
> > +    if (w_shift)
> > +        *w_shift = av_pix_fmt_descriptors[pix_fmt].log2_chroma_w;
> > +    if (h_shift)
> > +        *h_shift = av_pix_fmt_descriptors[pix_fmt].log2_chroma_h;
> > +}
> 
> what about a
> 
> int get_true(){
>     return 1;
> }

Not that I care so much about it, but this operation is performed *a
lot* in the codebase, so adding a very specialized function for
simplifying the code doesn't look so weird to me.

And if you don't want these kind of wrappers, we should get rid as
well of avcodec_get_chroma_subsample() and getSubSampleFactors().

Regards.
-- 
FFmpeg = Frightening & Fostering Mournful Problematic Extravagant Gargoyle



More information about the ffmpeg-devel mailing list