[FFmpeg-devel] [PATCH] Implement function to compute bits per pixel
Michael Niedermayer
michaelni
Tue Apr 28 00:51:05 CEST 2009
On Tue, Apr 28, 2009 at 12:06:53AM +0200, Stefano Sabatini wrote:
> 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
> pixdesc.c | 31 +++++++++++++++++++++++++++++++
> pixdesc.h | 10 ++++++++++
> 2 files changed, 41 insertions(+)
ok without the test code
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
In a rich man's house there is no place to spit but his face.
-- Diogenes of Sinope
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090428/919c660e/attachment.pgp>
More information about the ffmpeg-devel
mailing list