diff mbox series

[FFmpeg-devel,1/1] Print bit depth when executing 'ffmpeg -pix_fmts'

Message ID MN2PR04MB5981D3323FAAA88B567A6269BAB79@MN2PR04MB5981.namprd04.prod.outlook.com
State Superseded, archived
Headers show
Series [FFmpeg-devel,1/1] Print bit depth when executing 'ffmpeg -pix_fmts' | expand

Checks

Context Check Description
andriy/commit_msg_x86 warning The first line of the commit message must start with a context terminated by a colon and a space, for example "lavu/opt: " or "doc: ".
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/commit_msg_ppc warning The first line of the commit message must start with a context terminated by a colon and a space, for example "lavu/opt: " or "doc: ".
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Soft Works Oct. 13, 2021, 4:58 a.m. UTC
New output looks like this:

Pixel formats:
I.... = Supported Input  format for conversion
.O... = Supported Output format for conversion
..H.. = Hardware accelerated format
...P. = Paletted format
....B = Bitstream format
FLAGS NAME            NB_COMPONENTS BITS_PER_PIXEL BIT_DEPTH
-----
IO... yuv420p                3             12         8
IO... yuyv422                3             16         8
IO... rgb24                  3             24         8
IO... bgr24                  3             24         8

[..]

Signed-off-by: softworkz <softworkz@hotmail.com>
---
 fftools/cmdutils.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Tobias Rapp Oct. 13, 2021, 6:56 a.m. UTC | #1
On 13/10/2021 06:58, Soft Works wrote:
> New output looks like this:
> 
> Pixel formats:
> I.... = Supported Input  format for conversion
> .O... = Supported Output format for conversion
> ..H.. = Hardware accelerated format
> ...P. = Paletted format
> ....B = Bitstream format
> FLAGS NAME            NB_COMPONENTS BITS_PER_PIXEL BIT_DEPTH
> -----
> IO... yuv420p                3             12         8
> IO... yuyv422                3             16         8
> IO... rgb24                  3             24         8
> IO... bgr24                  3             24         8
> 
> [...]
> 
> @@ -1772,7 +1772,8 @@ int show_pix_fmts(void *optctx, const char *opt, const char *arg)
>                  pix_desc->flags & AV_PIX_FMT_FLAG_BITSTREAM ? 'B' : '.',
>                  pix_desc->name,
>                  pix_desc->nb_components,
> -               av_get_bits_per_pixel(pix_desc));
> +               av_get_bits_per_pixel(pix_desc),
> +               pix_desc->comp[0].depth);
>       }
>       return 0;
>   }
> 

I think it is misleading to only print the bit-depth of the first 
component. You can already get bit-depth information for all components 
in different data formats with "ffprobe -show_pixel_formats".

Regards,
Tobias
Soft Works Oct. 13, 2021, 7:20 a.m. UTC | #2
> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> Tobias Rapp
> Sent: Wednesday, October 13, 2021 8:56 AM
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH 1/1] Print bit depth when
> executing 'ffmpeg -pix_fmts'
> 
> On 13/10/2021 06:58, Soft Works wrote:
> > New output looks like this:
> >
> > Pixel formats:
> > I.... = Supported Input  format for conversion
> > .O... = Supported Output format for conversion
> > ..H.. = Hardware accelerated format
> > ...P. = Paletted format
> > ....B = Bitstream format
> > FLAGS NAME            NB_COMPONENTS BITS_PER_PIXEL BIT_DEPTH
> > -----
> > IO... yuv420p                3             12         8
> > IO... yuyv422                3             16         8
> > IO... rgb24                  3             24         8
> > IO... bgr24                  3             24         8
> >
> > [...]
> >
> > @@ -1772,7 +1772,8 @@ int show_pix_fmts(void *optctx, const char
> *opt, const char *arg)
> >                  pix_desc->flags & AV_PIX_FMT_FLAG_BITSTREAM ? 'B'
> : '.',
> >                  pix_desc->name,
> >                  pix_desc->nb_components,
> > -               av_get_bits_per_pixel(pix_desc));
> > +               av_get_bits_per_pixel(pix_desc),
> > +               pix_desc->comp[0].depth);
> >       }
> >       return 0;
> >   }
> >
> 
> I think it is misleading to only print the bit-depth of the first
> component. You can already get bit-depth information for all
> components
> in different data formats with "ffprobe -show_pixel_formats".

The bit depth of the first component is often considered as the
"nominal" bit depth of formats: For example, yuva420p10 is 
said to be a "10bit format" even though it doesn't apply to all
components.

That's the intention of the output in this case, means it's for
user information, not a developer output.

Kind regards,
softworkz
Paul B Mahol Oct. 13, 2021, 7:28 a.m. UTC | #3
On Wed, Oct 13, 2021 at 9:20 AM Soft Works <softworkz@hotmail.com> wrote:

>
>
> > -----Original Message-----
> > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> > Tobias Rapp
> > Sent: Wednesday, October 13, 2021 8:56 AM
> > To: ffmpeg-devel@ffmpeg.org
> > Subject: Re: [FFmpeg-devel] [PATCH 1/1] Print bit depth when
> > executing 'ffmpeg -pix_fmts'
> >
> > On 13/10/2021 06:58, Soft Works wrote:
> > > New output looks like this:
> > >
> > > Pixel formats:
> > > I.... = Supported Input  format for conversion
> > > .O... = Supported Output format for conversion
> > > ..H.. = Hardware accelerated format
> > > ...P. = Paletted format
> > > ....B = Bitstream format
> > > FLAGS NAME            NB_COMPONENTS BITS_PER_PIXEL BIT_DEPTH
> > > -----
> > > IO... yuv420p                3             12         8
> > > IO... yuyv422                3             16         8
> > > IO... rgb24                  3             24         8
> > > IO... bgr24                  3             24         8
> > >
> > > [...]
> > >
> > > @@ -1772,7 +1772,8 @@ int show_pix_fmts(void *optctx, const char
> > *opt, const char *arg)
> > >                  pix_desc->flags & AV_PIX_FMT_FLAG_BITSTREAM ? 'B'
> > : '.',
> > >                  pix_desc->name,
> > >                  pix_desc->nb_components,
> > > -               av_get_bits_per_pixel(pix_desc));
> > > +               av_get_bits_per_pixel(pix_desc),
> > > +               pix_desc->comp[0].depth);
> > >       }
> > >       return 0;
> > >   }
> > >
> >
> > I think it is misleading to only print the bit-depth of the first
> > component. You can already get bit-depth information for all
> > components
> > in different data formats with "ffprobe -show_pixel_formats".
>
> The bit depth of the first component is often considered as the
> "nominal" bit depth of formats: For example, yuva420p10 is
> said to be a "10bit format" even though it doesn't apply to all
> components.
>
> That's the intention of the output in this case, means it's for
> user information, not a developer output.
>

This is again flawed design.


>
> Kind regards,
> softworkz
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>
diff mbox series

Patch

diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index 2c8e98982f..aa706c33ab 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -1754,7 +1754,7 @@  int show_pix_fmts(void *optctx, const char *opt, const char *arg)
            "..H.. = Hardware accelerated format\n"
            "...P. = Paletted format\n"
            "....B = Bitstream format\n"
-           "FLAGS NAME            NB_COMPONENTS BITS_PER_PIXEL\n"
+           "FLAGS NAME            NB_COMPONENTS BITS_PER_PIXEL BIT_DEPTH\n"
            "-----\n");
 
 #if !CONFIG_SWSCALE
@@ -1764,7 +1764,7 @@  int show_pix_fmts(void *optctx, const char *opt, const char *arg)
 
     while ((pix_desc = av_pix_fmt_desc_next(pix_desc))) {
         enum AVPixelFormat av_unused pix_fmt = av_pix_fmt_desc_get_id(pix_desc);
-        printf("%c%c%c%c%c %-16s       %d            %2d\n",
+        printf("%c%c%c%c%c %-16s       %d            %3d        %2d\n",
                sws_isSupportedInput (pix_fmt)              ? 'I' : '.',
                sws_isSupportedOutput(pix_fmt)              ? 'O' : '.',
                pix_desc->flags & AV_PIX_FMT_FLAG_HWACCEL   ? 'H' : '.',
@@ -1772,7 +1772,8 @@  int show_pix_fmts(void *optctx, const char *opt, const char *arg)
                pix_desc->flags & AV_PIX_FMT_FLAG_BITSTREAM ? 'B' : '.',
                pix_desc->name,
                pix_desc->nb_components,
-               av_get_bits_per_pixel(pix_desc));
+               av_get_bits_per_pixel(pix_desc),
+               pix_desc->comp[0].depth);
     }
     return 0;
 }