[FFmpeg-devel] [PATCH] Implement function to compute bits per pixel

Stefano Sabatini stefano.sabatini-lala
Tue Apr 28 00:06:53 CEST 2009


On date Monday 2009-04-27 23:52:54 +0200, Michael Niedermayer encoded:
> On Mon, Apr 27, 2009 at 11:39:58PM +0200, Stefano Sabatini wrote:
[...]
> > Should I keep the test program when committing?
> 
> no
> 
> 
> > 
> > Regards.
> > -- 
> > FFmpeg = Fundamental & Faboulous MultiPurpose Ecstatic Gargoyle
> 
> >  pixdesc.c |   31 +++++++++++++++++++++++++++++++
> >  pixdesc.h |   10 ++++++++++
> >  2 files changed, 41 insertions(+)
> > 6186069e7481e5c6f77716f812908c4641f3c4f3  pixdesc-get-bpp.patch
> > Index: libavfilter-soc/ffmpeg/libavcodec/pixdesc.c
> > ===================================================================
> > --- libavfilter-soc.orig/ffmpeg/libavcodec/pixdesc.c	2009-04-26 11:57:43.000000000 +0200
> > +++ libavfilter-soc/ffmpeg/libavcodec/pixdesc.c	2009-04-27 23:37:27.000000000 +0200
> > @@ -581,3 +581,34 @@
> >          .flags = PIX_FMT_BE,
> >      },
> >  };
> > +
> > +int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
> > +{
> > +    int c, bits = 0;
> > +    int pixels = 1 << (pixdesc->log2_chroma_w + pixdesc->log2_chroma_h);
> > +
> > +    for (c = 0; c < pixdesc->nb_channels; c++) {
> > +        int s = c==1 || c==2 ? 1 : pixels;
> > +        bits += s * (pixdesc->comp[c].depth_minus1+1);
> > +    }
> 
> bits += (pixdesc->comp[c].depth_minus1+1) << s;
> 
> 
> > +
> > +    return bits / pixels;
> 
> bits >> ...
> 
> and pixels is a poor name

Fixed.
-- 
FFmpeg = Freak and Free Mind-dumbing Powered Extravagant Gargoyle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pixdesc-get-bpp.patch
Type: text/x-diff
Size: 1703 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090428/b6dab89e/attachment.patch>



More information about the ffmpeg-devel mailing list