[FFmpeg-devel] [PATCH]Print bits per component in avcodec_string if smaller than expected

Carl Eugen Hoyos cehoyos at ag.or.at
Sun Dec 9 10:17:15 CET 2012


On Saturday 08 December 2012 07:44:40 pm Michael Niedermayer wrote:
> On Sat, Dec 08, 2012 at 06:38:30PM +0000, Carl Eugen Hoyos wrote:
> > Michael Niedermayer <michaelni <at> gmx.at> writes:
> > > > If a decoder specifies a value for bits_per_raw_sample that is
> > > > smaller than the pix_fmt would indicate, print the smaller value.
> > > >
> > > > Please comment, Carl Eugen
> > >
> > > this prints a lot of 8 bpc for argb, rgb24, yuv420
> > > and 10bpc for yuv420p10
> >
> > I probably miss something obvious, but I was unable to
> > trigger the message for any of the mentioned colour-spaces
> > (and I do not immediately see how it could be triggered).
> >
> > Could you give me an example so I can try to improve?
>
> i tried this:
>
> for i in fate-suite/*/* ; do  ./ffprobe -v 99 "$i" ; done >& list
>
> and greped for bpc
> there where many matches

Thank you!

New patch attached.

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index d7b3f18..0a0c446 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -2059,6 +2059,10 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
             snprintf(buf + strlen(buf), buf_size - strlen(buf),
                      ", %s",
                      av_get_pix_fmt_name(enc->pix_fmt));
+            if (enc->bits_per_raw_sample &&
+                enc->bits_per_raw_sample <= av_pix_fmt_desc_get(enc->pix_fmt)->comp[0].depth_minus1)
+                snprintf(buf + strlen(buf), buf_size - strlen(buf),
+                         " (%d bpc)", enc->bits_per_raw_sample);
         }
         if (enc->width) {
             snprintf(buf + strlen(buf), buf_size - strlen(buf),


More information about the ffmpeg-devel mailing list