[FFmpeg-devel] [PATCH] Implement function to compute bits per pixel
Michael Niedermayer
michaelni
Mon Apr 27 23:52:54 CEST 2009
On Mon, Apr 27, 2009 at 11:39:58PM +0200, Stefano Sabatini wrote:
> On date Monday 2009-04-27 14:40:42 +0200, Michael Niedermayer encoded:
> > On Mon, Apr 27, 2009 at 02:16:15PM +0200, Michael Niedermayer wrote:
> > > On Sun, Apr 26, 2009 at 03:15:24PM +0200, Stefano Sabatini wrote:
> >
> > [...]
> > > [...]
> > > > Index: libavfilter-soc/ffmpeg/libavcodec/pixdesc.h
> > > > ===================================================================
> > > > --- libavfilter-soc.orig/ffmpeg/libavcodec/pixdesc.h 2009-04-26 11:30:27.000000000 +0200
> > > > +++ libavfilter-soc/ffmpeg/libavcodec/pixdesc.h 2009-04-26 12:15:37.000000000 +0200
> > > > @@ -193,4 +193,10 @@
> > > > }
> > > > }
> > > >
> > > > +/**
> > > > + * Returns the number of bits per pixel used by the pixel format
> > > > + * described by pixdesc.
> > > > + */
> > > > +int av_pixdesc_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc);
> > >
> > > av_get_bits_per_pixel
> > > or
> > > av_bits_per_pixel
> > >
> > > seem better names
> >
> > The correct name that fits best in the current naming is
> > av_get_bits_per_pixel(), please use this
>
> Check again.
>
> 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
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle
-------------- 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/20090427/07368939/attachment.pgp>
More information about the ffmpeg-devel
mailing list