diff mbox

[FFmpeg-devel,1/8] lavu/pix_fmt: add new pixel format y210

Message ID 1577636914-12413-1-git-send-email-linjie.fu@intel.com
State Superseded
Headers show

Commit Message

Fu, Linjie Dec. 29, 2019, 4:28 p.m. UTC
Add some packed 4:2:2 10-bit pixel formats for hardware decode support
in VAAPI and QSV.

Signed-off-by: Linjie Fu <linjie.fu@intel.com>
---
 libavutil/pixdesc.c              | 23 +++++++++++++++++++++++
 libavutil/pixfmt.h               |  5 +++++
 libavutil/version.h              |  2 +-
 tests/ref/fate/sws-pixdesc-query |  7 +++++++
 4 files changed, 36 insertions(+), 1 deletion(-)

Comments

Mark Thompson Jan. 8, 2020, 9:47 p.m. UTC | #1
On 29/12/2019 16:28, Linjie Fu wrote:
> Add some packed 4:2:2 10-bit pixel formats for hardware decode support
> in VAAPI and QSV.
> 
> Signed-off-by: Linjie Fu <linjie.fu@intel.com>
> ---
>  libavutil/pixdesc.c              | 23 +++++++++++++++++++++++
>  libavutil/pixfmt.h               |  5 +++++
>  libavutil/version.h              |  2 +-
>  tests/ref/fate/sws-pixdesc-query |  7 +++++++
>  4 files changed, 36 insertions(+), 1 deletion(-)
> 
> diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
> index 05dd4a1..1e118ef 100644
> --- a/libavutil/pixdesc.c
> +++ b/libavutil/pixdesc.c
> @@ -205,6 +205,29 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
>              { 0, 4, 1, 0, 8, 3, 7, 2 },        /* V */
>          },
>      },
> +    [AV_PIX_FMT_Y210LE] = {
> +        .name = "y210le",
> +        .nb_components = 3,
> +        .log2_chroma_w = 1,
> +        .log2_chroma_h = 0,
> +        .comp = {
> +            { 0, 4, 0, 6, 10, 3, 9, 1 },        /* Y */
> +            { 0, 8, 2, 6, 10, 7, 9, 3 },        /* U */
> +            { 0, 8, 6, 6, 10, 7, 9, 7 },        /* V */
> +        },
> +    },
> +    [AV_PIX_FMT_Y210BE] = {
> +        .name = "y210be",
> +        .nb_components = 3,
> +        .log2_chroma_w = 1,
> +        .log2_chroma_h = 0,
> +        .comp = {
> +            { 0, 4, 0, 6, 10, 3, 9, 1 },        /* Y */
> +            { 0, 8, 2, 6, 10, 7, 9, 3 },        /* U */
> +            { 0, 8, 6, 6, 10, 7, 9, 7 },        /* V */
> +        },
> +        .flags = AV_PIX_FMT_FLAG_BE,
> +    },
>      [AV_PIX_FMT_RGB24] = {
>          .name = "rgb24",
>          .nb_components = 3,
> diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
> index 37ecebd..7ffa5a0 100644
> --- a/libavutil/pixfmt.h
> +++ b/libavutil/pixfmt.h
> @@ -348,6 +348,9 @@ enum AVPixelFormat {
>      AV_PIX_FMT_NV24,      ///< planar YUV 4:4:4, 24bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (first byte U and the following byte V)
>      AV_PIX_FMT_NV42,      ///< as above, but U and V bytes are swapped
>  
> +    AV_PIX_FMT_Y210BE,    ///< packed YUV 4:2:2, 32bpp, Y0 Cb Y1 Cr, big-endian
> +    AV_PIX_FMT_Y210LE,    ///< packed YUV 4:2:2, 32bpp, Y0 Cb Y1 Cr, little-endian

These comments should be clear that the data are in the high bits (like P010), rather than in the low bits (like most formats used by software codecs).

Being consistent with other comments would write 20bpp rather than 32bpp, though I'm not sure how much information that number is really adding.

> +
>      AV_PIX_FMT_NB         ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions
>  };
>  
> @@ -436,6 +439,8 @@ enum AVPixelFormat {
>  #define AV_PIX_FMT_P010       AV_PIX_FMT_NE(P010BE,  P010LE)
>  #define AV_PIX_FMT_P016       AV_PIX_FMT_NE(P016BE,  P016LE)
>  
> +#define AV_PIX_FMT_Y210       AV_PIX_FMT_NE(Y210BE,  Y210LE)
> +
>  /**
>    * Chromaticity coordinates of the source primaries.
>    * These values match the ones defined by ISO/IEC 23001-8_2013 § 7.1.
> ...

Thanks,

- Mark
Fu, Linjie Jan. 12, 2020, 7:57 a.m. UTC | #2
> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> Mark Thompson
> Sent: Thursday, January 9, 2020 05:47
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH 1/8] lavu/pix_fmt: add new pixel format
> y210
> 
> On 29/12/2019 16:28, Linjie Fu wrote:
> > Add some packed 4:2:2 10-bit pixel formats for hardware decode support
> > in VAAPI and QSV.
> >
> > Signed-off-by: Linjie Fu <linjie.fu@intel.com>
> > ---
> >  libavutil/pixdesc.c              | 23 +++++++++++++++++++++++
> >  libavutil/pixfmt.h               |  5 +++++
> >  libavutil/version.h              |  2 +-
> >  tests/ref/fate/sws-pixdesc-query |  7 +++++++
> >  4 files changed, 36 insertions(+), 1 deletion(-)
> >
> > diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
> > index 05dd4a1..1e118ef 100644
> > --- a/libavutil/pixdesc.c
> > +++ b/libavutil/pixdesc.c
> > @@ -205,6 +205,29 @@ static const AVPixFmtDescriptor
> av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
> >              { 0, 4, 1, 0, 8, 3, 7, 2 },        /* V */
> >          },
> >      },
> > +    [AV_PIX_FMT_Y210LE] = {
> > +        .name = "y210le",
> > +        .nb_components = 3,
> > +        .log2_chroma_w = 1,
> > +        .log2_chroma_h = 0,
> > +        .comp = {
> > +            { 0, 4, 0, 6, 10, 3, 9, 1 },        /* Y */
> > +            { 0, 8, 2, 6, 10, 7, 9, 3 },        /* U */
> > +            { 0, 8, 6, 6, 10, 7, 9, 7 },        /* V */
> > +        },
> > +    },
> > +    [AV_PIX_FMT_Y210BE] = {
> > +        .name = "y210be",
> > +        .nb_components = 3,
> > +        .log2_chroma_w = 1,
> > +        .log2_chroma_h = 0,
> > +        .comp = {
> > +            { 0, 4, 0, 6, 10, 3, 9, 1 },        /* Y */
> > +            { 0, 8, 2, 6, 10, 7, 9, 3 },        /* U */
> > +            { 0, 8, 6, 6, 10, 7, 9, 7 },        /* V */
> > +        },
> > +        .flags = AV_PIX_FMT_FLAG_BE,
> > +    },
> >      [AV_PIX_FMT_RGB24] = {
> >          .name = "rgb24",
> >          .nb_components = 3,
> > diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
> > index 37ecebd..7ffa5a0 100644
> > --- a/libavutil/pixfmt.h
> > +++ b/libavutil/pixfmt.h
> > @@ -348,6 +348,9 @@ enum AVPixelFormat {
> >      AV_PIX_FMT_NV24,      ///< planar YUV 4:4:4, 24bpp, 1 plane for Y and 1
> plane for the UV components, which are interleaved (first byte U and the
> following byte V)
> >      AV_PIX_FMT_NV42,      ///< as above, but U and V bytes are swapped
> >
> > +    AV_PIX_FMT_Y210BE,    ///< packed YUV 4:2:2, 32bpp, Y0 Cb Y1 Cr, big-
> endian
> > +    AV_PIX_FMT_Y210LE,    ///< packed YUV 4:2:2, 32bpp, Y0 Cb Y1 Cr, little-
> endian
> 
> These comments should be clear that the data are in the high bits (like P010),
> rather than in the low bits (like most formats used by software codecs).
> 
> Being consistent with other comments would write 20bpp rather than 32bpp,
> though I'm not sure how much information that number is really adding.
> 
Would update the comments like:
packed YUV 4:2:2 like YUYV422, 20bpp, data in the high bits, zeros in the low bits, big-endian

Thanks.
Carl Eugen Hoyos Jan. 12, 2020, 4:41 p.m. UTC | #3
Am So., 12. Jan. 2020 um 08:57 Uhr schrieb Fu, Linjie <linjie.fu@intel.com>:
>
> > -----Original Message-----
> > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> > Mark Thompson
> > Sent: Thursday, January 9, 2020 05:47
> > To: ffmpeg-devel@ffmpeg.org
> > Subject: Re: [FFmpeg-devel] [PATCH 1/8] lavu/pix_fmt: add new pixel format
> > y210
> >
> > On 29/12/2019 16:28, Linjie Fu wrote:
> > > Add some packed 4:2:2 10-bit pixel formats for hardware decode support
> > > in VAAPI and QSV.
> > >
> > > Signed-off-by: Linjie Fu <linjie.fu@intel.com>
> > > ---
> > >  libavutil/pixdesc.c              | 23 +++++++++++++++++++++++
> > >  libavutil/pixfmt.h               |  5 +++++
> > >  libavutil/version.h              |  2 +-
> > >  tests/ref/fate/sws-pixdesc-query |  7 +++++++
> > >  4 files changed, 36 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
> > > index 05dd4a1..1e118ef 100644
> > > --- a/libavutil/pixdesc.c
> > > +++ b/libavutil/pixdesc.c
> > > @@ -205,6 +205,29 @@ static const AVPixFmtDescriptor
> > av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
> > >              { 0, 4, 1, 0, 8, 3, 7, 2 },        /* V */
> > >          },
> > >      },
> > > +    [AV_PIX_FMT_Y210LE] = {
> > > +        .name = "y210le",
> > > +        .nb_components = 3,
> > > +        .log2_chroma_w = 1,
> > > +        .log2_chroma_h = 0,
> > > +        .comp = {
> > > +            { 0, 4, 0, 6, 10, 3, 9, 1 },        /* Y */
> > > +            { 0, 8, 2, 6, 10, 7, 9, 3 },        /* U */
> > > +            { 0, 8, 6, 6, 10, 7, 9, 7 },        /* V */
> > > +        },
> > > +    },
> > > +    [AV_PIX_FMT_Y210BE] = {
> > > +        .name = "y210be",
> > > +        .nb_components = 3,
> > > +        .log2_chroma_w = 1,
> > > +        .log2_chroma_h = 0,
> > > +        .comp = {
> > > +            { 0, 4, 0, 6, 10, 3, 9, 1 },        /* Y */
> > > +            { 0, 8, 2, 6, 10, 7, 9, 3 },        /* U */
> > > +            { 0, 8, 6, 6, 10, 7, 9, 7 },        /* V */
> > > +        },
> > > +        .flags = AV_PIX_FMT_FLAG_BE,
> > > +    },
> > >      [AV_PIX_FMT_RGB24] = {
> > >          .name = "rgb24",
> > >          .nb_components = 3,
> > > diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
> > > index 37ecebd..7ffa5a0 100644
> > > --- a/libavutil/pixfmt.h
> > > +++ b/libavutil/pixfmt.h
> > > @@ -348,6 +348,9 @@ enum AVPixelFormat {
> > >      AV_PIX_FMT_NV24,      ///< planar YUV 4:4:4, 24bpp, 1 plane for Y and 1
> > plane for the UV components, which are interleaved (first byte U and the
> > following byte V)
> > >      AV_PIX_FMT_NV42,      ///< as above, but U and V bytes are swapped
> > >
> > > +    AV_PIX_FMT_Y210BE,    ///< packed YUV 4:2:2, 32bpp, Y0 Cb Y1 Cr, big-
> > endian
> > > +    AV_PIX_FMT_Y210LE,    ///< packed YUV 4:2:2, 32bpp, Y0 Cb Y1 Cr, little-
> > endian
> >
> > These comments should be clear that the data are in the high bits (like P010),
> > rather than in the low bits (like most formats used by software codecs).
> >
> > Being consistent with other comments would write 20bpp rather than 32bpp,
> > though I'm not sure how much information that number is really adding.
> >
> Would update the comments like:
> packed YUV 4:2:2 like YUYV422, 20bpp, data in the high bits, zeros in the low bits, big-endian

Please do not write "zeros in the low bits", this is just confusing.

Carl Eugen
Fu, Linjie Jan. 14, 2020, 2:38 a.m. UTC | #4
> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> Carl Eugen Hoyos
> Sent: Monday, January 13, 2020 00:41
> To: FFmpeg development discussions and patches <ffmpeg-
> devel@ffmpeg.org>
> Subject: Re: [FFmpeg-devel] [PATCH 1/8] lavu/pix_fmt: add new pixel format
> y210
> 
> Am So., 12. Jan. 2020 um 08:57 Uhr schrieb Fu, Linjie <linjie.fu@intel.com>:
> >
> > > -----Original Message-----
> > > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> > > Mark Thompson
> > > Sent: Thursday, January 9, 2020 05:47
> > > To: ffmpeg-devel@ffmpeg.org
> > > Subject: Re: [FFmpeg-devel] [PATCH 1/8] lavu/pix_fmt: add new pixel
> format
> > > y210
> > >
> > > On 29/12/2019 16:28, Linjie Fu wrote:
> > > > Add some packed 4:2:2 10-bit pixel formats for hardware decode
> support
> > > > in VAAPI and QSV.
> > > >
> > > > Signed-off-by: Linjie Fu <linjie.fu@intel.com>
> > > > ---
> > > >  libavutil/pixdesc.c              | 23 +++++++++++++++++++++++
> > > >  libavutil/pixfmt.h               |  5 +++++
> > > >  libavutil/version.h              |  2 +-
> > > >  tests/ref/fate/sws-pixdesc-query |  7 +++++++
> > > >  4 files changed, 36 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
> > > > index 05dd4a1..1e118ef 100644
> > > > --- a/libavutil/pixdesc.c
> > > > +++ b/libavutil/pixdesc.c
> > > > @@ -205,6 +205,29 @@ static const AVPixFmtDescriptor
> > > av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
> > > >              { 0, 4, 1, 0, 8, 3, 7, 2 },        /* V */
> > > >          },
> > > >      },
> > > > +    [AV_PIX_FMT_Y210LE] = {
> > > > +        .name = "y210le",
> > > > +        .nb_components = 3,
> > > > +        .log2_chroma_w = 1,
> > > > +        .log2_chroma_h = 0,
> > > > +        .comp = {
> > > > +            { 0, 4, 0, 6, 10, 3, 9, 1 },        /* Y */
> > > > +            { 0, 8, 2, 6, 10, 7, 9, 3 },        /* U */
> > > > +            { 0, 8, 6, 6, 10, 7, 9, 7 },        /* V */
> > > > +        },
> > > > +    },
> > > > +    [AV_PIX_FMT_Y210BE] = {
> > > > +        .name = "y210be",
> > > > +        .nb_components = 3,
> > > > +        .log2_chroma_w = 1,
> > > > +        .log2_chroma_h = 0,
> > > > +        .comp = {
> > > > +            { 0, 4, 0, 6, 10, 3, 9, 1 },        /* Y */
> > > > +            { 0, 8, 2, 6, 10, 7, 9, 3 },        /* U */
> > > > +            { 0, 8, 6, 6, 10, 7, 9, 7 },        /* V */
> > > > +        },
> > > > +        .flags = AV_PIX_FMT_FLAG_BE,
> > > > +    },
> > > >      [AV_PIX_FMT_RGB24] = {
> > > >          .name = "rgb24",
> > > >          .nb_components = 3,
> > > > diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
> > > > index 37ecebd..7ffa5a0 100644
> > > > --- a/libavutil/pixfmt.h
> > > > +++ b/libavutil/pixfmt.h
> > > > @@ -348,6 +348,9 @@ enum AVPixelFormat {
> > > >      AV_PIX_FMT_NV24,      ///< planar YUV 4:4:4, 24bpp, 1 plane for Y
> and 1
> > > plane for the UV components, which are interleaved (first byte U and the
> > > following byte V)
> > > >      AV_PIX_FMT_NV42,      ///< as above, but U and V bytes are
> swapped
> > > >
> > > > +    AV_PIX_FMT_Y210BE,    ///< packed YUV 4:2:2, 32bpp, Y0 Cb Y1 Cr,
> big-
> > > endian
> > > > +    AV_PIX_FMT_Y210LE,    ///< packed YUV 4:2:2, 32bpp, Y0 Cb Y1 Cr,
> little-
> > > endian
> > >
> > > These comments should be clear that the data are in the high bits (like
> P010),
> > > rather than in the low bits (like most formats used by software codecs).
> > >
> > > Being consistent with other comments would write 20bpp rather than
> 32bpp,
> > > though I'm not sure how much information that number is really adding.
> > >
> > Would update the comments like:
> > packed YUV 4:2:2 like YUYV422, 20bpp, data in the high bits, zeros in the
> low bits, big-endian
> 
> Please do not write "zeros in the low bits", this is just confusing.
>
 
P010LE/P010BE are using similar comments, and there is identical description in the doc:
"The 10-bit formats also use 16 bits for each channel, with the lowest 6 bits set to zero"
https://docs.microsoft.com/en-us/windows/win32/medfound/10-bit-and-16-bit-yuv-video-formats

Hi Carl, would you please help to elaborate more on how to refine the comments?
Carl Eugen Hoyos Jan. 14, 2020, 4:42 a.m. UTC | #5
Am 14.01.2020 um 03:38 schrieb Fu, Linjie <linjie.fu@intel.com>:

>> -----Original Message-----
>> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
>> Carl Eugen Hoyos
>> Sent: Monday, January 13, 2020 00:41
>> To: FFmpeg development discussions and patches <ffmpeg-
>> devel@ffmpeg.org>
>> Subject: Re: [FFmpeg-devel] [PATCH 1/8] lavu/pix_fmt: add new pixel format
>> y210
>> 
>>> Am So., 12. Jan. 2020 um 08:57 Uhr schrieb Fu, Linjie <linjie.fu@intel.com>:
>>> 
>>>> -----Original Message-----
>>>> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
>>>> Mark Thompson
>>>> Sent: Thursday, January 9, 2020 05:47
>>>> To: ffmpeg-devel@ffmpeg.org
>>>> Subject: Re: [FFmpeg-devel] [PATCH 1/8] lavu/pix_fmt: add new pixel
>> format
>>>> y210
>>>> 
>>>>> On 29/12/2019 16:28, Linjie Fu wrote:
>>>>> Add some packed 4:2:2 10-bit pixel formats for hardware decode
>> support
>>>>> in VAAPI and QSV.
>>>>> 
>>>>> Signed-off-by: Linjie Fu <linjie.fu@intel.com>
>>>>> ---
>>>>> libavutil/pixdesc.c              | 23 +++++++++++++++++++++++
>>>>> libavutil/pixfmt.h               |  5 +++++
>>>>> libavutil/version.h              |  2 +-
>>>>> tests/ref/fate/sws-pixdesc-query |  7 +++++++
>>>>> 4 files changed, 36 insertions(+), 1 deletion(-)
>>>>> 
>>>>> diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
>>>>> index 05dd4a1..1e118ef 100644
>>>>> --- a/libavutil/pixdesc.c
>>>>> +++ b/libavutil/pixdesc.c
>>>>> @@ -205,6 +205,29 @@ static const AVPixFmtDescriptor
>>>> av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
>>>>>             { 0, 4, 1, 0, 8, 3, 7, 2 },        /* V */
>>>>>         },
>>>>>     },
>>>>> +    [AV_PIX_FMT_Y210LE] = {
>>>>> +        .name = "y210le",
>>>>> +        .nb_components = 3,
>>>>> +        .log2_chroma_w = 1,
>>>>> +        .log2_chroma_h = 0,
>>>>> +        .comp = {
>>>>> +            { 0, 4, 0, 6, 10, 3, 9, 1 },        /* Y */
>>>>> +            { 0, 8, 2, 6, 10, 7, 9, 3 },        /* U */
>>>>> +            { 0, 8, 6, 6, 10, 7, 9, 7 },        /* V */
>>>>> +        },
>>>>> +    },
>>>>> +    [AV_PIX_FMT_Y210BE] = {
>>>>> +        .name = "y210be",
>>>>> +        .nb_components = 3,
>>>>> +        .log2_chroma_w = 1,
>>>>> +        .log2_chroma_h = 0,
>>>>> +        .comp = {
>>>>> +            { 0, 4, 0, 6, 10, 3, 9, 1 },        /* Y */
>>>>> +            { 0, 8, 2, 6, 10, 7, 9, 3 },        /* U */
>>>>> +            { 0, 8, 6, 6, 10, 7, 9, 7 },        /* V */
>>>>> +        },
>>>>> +        .flags = AV_PIX_FMT_FLAG_BE,
>>>>> +    },
>>>>>     [AV_PIX_FMT_RGB24] = {
>>>>>         .name = "rgb24",
>>>>>         .nb_components = 3,
>>>>> diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
>>>>> index 37ecebd..7ffa5a0 100644
>>>>> --- a/libavutil/pixfmt.h
>>>>> +++ b/libavutil/pixfmt.h
>>>>> @@ -348,6 +348,9 @@ enum AVPixelFormat {
>>>>>     AV_PIX_FMT_NV24,      ///< planar YUV 4:4:4, 24bpp, 1 plane for Y
>> and 1
>>>> plane for the UV components, which are interleaved (first byte U and the
>>>> following byte V)
>>>>>     AV_PIX_FMT_NV42,      ///< as above, but U and V bytes are
>> swapped
>>>>> 
>>>>> +    AV_PIX_FMT_Y210BE,    ///< packed YUV 4:2:2, 32bpp, Y0 Cb Y1 Cr,
>> big-
>>>> endian
>>>>> +    AV_PIX_FMT_Y210LE,    ///< packed YUV 4:2:2, 32bpp, Y0 Cb Y1 Cr,
>> little-
>>>> endian
>>>> 
>>>> These comments should be clear that the data are in the high bits (like
>> P010),
>>>> rather than in the low bits (like most formats used by software codecs).
>>>> 
>>>> Being consistent with other comments would write 20bpp rather than
>> 32bpp,
>>>> though I'm not sure how much information that number is really adding.
>>>> 
>>> Would update the comments like:
>>> packed YUV 4:2:2 like YUYV422, 20bpp, data in the high bits, zeros in the
>> low bits, big-endian
>> 
>> Please do not write "zeros in the low bits", this is just confusing.
>> 
> 
> P010LE/P010BE are using similar comments, and there is identical description in the doc:
> "The 10-bit formats also use 16 bits for each channel, with the lowest 6 bits set to zero"
> https://docs.microsoft.com/en-us/windows/win32/medfound/10-bit-and-16-bit-yuv-video-formats
> 
> Hi Carl, would you please help to elaborate more on how to refine the comments?

Just remove „zeros in the low bits“.

Carl Eugen
diff mbox

Patch

diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index 05dd4a1..1e118ef 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -205,6 +205,29 @@  static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
             { 0, 4, 1, 0, 8, 3, 7, 2 },        /* V */
         },
     },
+    [AV_PIX_FMT_Y210LE] = {
+        .name = "y210le",
+        .nb_components = 3,
+        .log2_chroma_w = 1,
+        .log2_chroma_h = 0,
+        .comp = {
+            { 0, 4, 0, 6, 10, 3, 9, 1 },        /* Y */
+            { 0, 8, 2, 6, 10, 7, 9, 3 },        /* U */
+            { 0, 8, 6, 6, 10, 7, 9, 7 },        /* V */
+        },
+    },
+    [AV_PIX_FMT_Y210BE] = {
+        .name = "y210be",
+        .nb_components = 3,
+        .log2_chroma_w = 1,
+        .log2_chroma_h = 0,
+        .comp = {
+            { 0, 4, 0, 6, 10, 3, 9, 1 },        /* Y */
+            { 0, 8, 2, 6, 10, 7, 9, 3 },        /* U */
+            { 0, 8, 6, 6, 10, 7, 9, 7 },        /* V */
+        },
+        .flags = AV_PIX_FMT_FLAG_BE,
+    },
     [AV_PIX_FMT_RGB24] = {
         .name = "rgb24",
         .nb_components = 3,
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index 37ecebd..7ffa5a0 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -348,6 +348,9 @@  enum AVPixelFormat {
     AV_PIX_FMT_NV24,      ///< planar YUV 4:4:4, 24bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (first byte U and the following byte V)
     AV_PIX_FMT_NV42,      ///< as above, but U and V bytes are swapped
 
+    AV_PIX_FMT_Y210BE,    ///< packed YUV 4:2:2, 32bpp, Y0 Cb Y1 Cr, big-endian
+    AV_PIX_FMT_Y210LE,    ///< packed YUV 4:2:2, 32bpp, Y0 Cb Y1 Cr, little-endian
+
     AV_PIX_FMT_NB         ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions
 };
 
@@ -436,6 +439,8 @@  enum AVPixelFormat {
 #define AV_PIX_FMT_P010       AV_PIX_FMT_NE(P010BE,  P010LE)
 #define AV_PIX_FMT_P016       AV_PIX_FMT_NE(P016BE,  P016LE)
 
+#define AV_PIX_FMT_Y210       AV_PIX_FMT_NE(Y210BE,  Y210LE)
+
 /**
   * Chromaticity coordinates of the source primaries.
   * These values match the ones defined by ISO/IEC 23001-8_2013 § 7.1.
diff --git a/libavutil/version.h b/libavutil/version.h
index 4de0fa1..af8f614 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -79,7 +79,7 @@ 
  */
 
 #define LIBAVUTIL_VERSION_MAJOR  56
-#define LIBAVUTIL_VERSION_MINOR  37
+#define LIBAVUTIL_VERSION_MINOR  38
 #define LIBAVUTIL_VERSION_MICRO 100
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
diff --git a/tests/ref/fate/sws-pixdesc-query b/tests/ref/fate/sws-pixdesc-query
index e234922..bc9a0d8 100644
--- a/tests/ref/fate/sws-pixdesc-query
+++ b/tests/ref/fate/sws-pixdesc-query
@@ -59,6 +59,8 @@  isNBPS:
   p010le
   xyz12be
   xyz12le
+  y210be
+  y210le
   yuv420p10be
   yuv420p10le
   yuv420p12be
@@ -140,6 +142,7 @@  isBE:
   rgb565be
   rgba64be
   xyz12be
+  y210be
   ya16be
   yuv420p10be
   yuv420p12be
@@ -188,6 +191,8 @@  isYUV:
   uyyvyy411
   xyz12be
   xyz12le
+  y210be
+  y210le
   ya16be
   ya16le
   ya8
@@ -686,6 +691,8 @@  Packed:
   uyyvyy411
   xyz12be
   xyz12le
+  y210be
+  y210le
   ya16be
   ya16le
   ya8