[FFmpeg-devel] [PATCH 6/8] Make avcodec_pix_fmt_string() use the information in the pixel format descriptors for printing the number of planes. Also replace the term "nb_channels" with "nb_planes" which is more correct.

Michael Niedermayer michaelni
Mon Nov 8 15:36:36 CET 2010


On Sun, Nov 07, 2010 at 07:49:45PM +0100, Stefano Sabatini wrote:
> On date Sunday 2010-11-07 19:08:28 +0100, Michael Niedermayer encoded:
> > On Sun, Nov 07, 2010 at 02:47:47PM +0100, Stefano Sabatini wrote:
> > > On date Friday 2010-11-05 12:01:38 +0100, Stefano Sabatini encoded:
> > > > ---
> > > >  libavcodec/imgconvert.c |   12 ++++++++----
> > > >  1 files changed, 8 insertions(+), 4 deletions(-)
> > > > 
> > > > diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c
> > > > index e9477c4..0c30304 100644
> > > > --- a/libavcodec/imgconvert.c
> > > > +++ b/libavcodec/imgconvert.c
> > > > @@ -434,15 +434,19 @@ void avcodec_pix_fmt_string (char *buf, int buf_size, enum PixelFormat pix_fmt)
> > > >      /* print header */
> > > >      if (pix_fmt < 0)
> > > >          snprintf (buf, buf_size,
> > > > -                  "name      " " nb_channels" " depth"
> > > > +                  "name      " " nb_planes" " depth"
> > > >              );
> > > >      else{
> > > > -        PixFmtInfo info= pix_fmt_info[pix_fmt];
> > > > +        const AVPixFmtDescriptor *pixdesc = &av_pix_fmt_descriptors[pix_fmt];
> > > > +        int i, nb_planes = 0;
> > > > +        for (i = 0; i < pixdesc->nb_components; i++)
> > > > +            nb_planes = FFMAX(pixdesc->comp[i].plane, nb_planes);
> > > > +        nb_planes++;
> > > >  
> > > >          snprintf (buf, buf_size,
> > > > -                  "%-11s %5d %9d",
> > > > +                  "%-11s %5d %7d",
> > > >                    av_pix_fmt_descriptors[pix_fmt].name,
> > > > -                  info.nb_channels,
> > > > +                  nb_planes,
> > > >                    av_get_bits_per_pixel(&av_pix_fmt_descriptors[pix_fmt])
> > > >              );
> > > 
> > > nb_planes != nb_channels
> > 
> > well you can print one, you can print the other or both.
> > iam not sure i like the nb_components renaming though
> 
> Also I discovered they're two different things, indeed nb_channels for
> RGB8, RGB4, RGB4_BYTE, BGR8... is 1,

that i would call planes, which is 1 for packed pixel formats


> while the number of components is
> 3 (so I have no idea what's the meaning of the hackish definition of
> PixFmt.nb_channels).
> 
> So I think it's better to use nb_component to make the distinction
> clear.

iam not sure if channel of component is better. In Audio terminology
channel is clear in relation to packing several into one plane
but iam not saying iam against the renaming, just that iam unsure

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If you really think that XML is the answer, then you definitly missunderstood
the question -- Attila Kinali
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20101108/db7c24e8/attachment.pgp>



More information about the ffmpeg-devel mailing list