[FFmpeg-devel,v1] libavutil: add A2R10G10B10 & A2B10G10R10

Submitted by Zachary Zhou on Sept. 10, 2019, 9:35 a.m.

Details

Message ID 20190910093526.13442-1-zachary.zhou@intel.com
State New
Headers show

Commit Message

Zachary Zhou Sept. 10, 2019, 9:35 a.m.
---
 libavutil/hwcontext_vaapi.c | 6 ++++++
 libavutil/pixfmt.h          | 3 +++
 2 files changed, 9 insertions(+)

Comments

Carl Eugen Hoyos Sept. 10, 2019, 11:29 p.m.
Am Di., 10. Sept. 2019 um 11:35 Uhr schrieb Zachary Zhou
<zachary.zhou@intel.com>:
>
> ---
>  libavutil/hwcontext_vaapi.c | 6 ++++++
>  libavutil/pixfmt.h          | 3 +++
>  2 files changed, 9 insertions(+)
>
> diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
> index cf117640f2..9838250b66 100644
> --- a/libavutil/hwcontext_vaapi.c
> +++ b/libavutil/hwcontext_vaapi.c
> @@ -125,6 +125,12 @@ static const VAAPIFormatDescriptor vaapi_format_map[] = {
>  #endif
>      MAP(BGRA, RGB32,   BGRA, 0),
>      MAP(BGRX, RGB32,   BGR0, 0),
> +#ifdef VA_FOURCC_A2R10G10B10
> +    MAP(A2R10G10B10, RGB32_10, A2R10G10B10, 0),
> +#endif
> +#ifdef VA_FOURCC_A2B10G10R10
> +    MAP(A2B10G10R10, RGB32_10, A2B10G10R10, 0),
> +#endif
>      MAP(RGBA, RGB32,   RGBA, 0),
>      MAP(RGBX, RGB32,   RGB0, 0),
>  #ifdef VA_FOURCC_ABGR
> diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
> index d78e863d4b..e00f129b46 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_A2R10G10B10, ///< 10-bit Pixel RGB formats.
> +    AV_PIX_FMT_A2B10G10R10, ///< 10-bit Pixel BGR formats.

The patch looks insufficient, see the patch to add AYUV and other
packed formats.

The more important question imo is: Why are these formats needed,
which hardware produces them for which input?

Carl Eugen
Zachary Zhou Sept. 11, 2019, 5:57 a.m.
> -----Original Message-----

> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of Carl

> Eugen Hoyos

> Sent: Wednesday, September 11, 2019 7:30 AM

> To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>

> Subject: Re: [FFmpeg-devel] [PATCH v1] libavutil: add A2R10G10B10 &

> A2B10G10R10

> 

> Am Di., 10. Sept. 2019 um 11:35 Uhr schrieb Zachary Zhou

> <zachary.zhou@intel.com>:

> >

> > ---

> >  libavutil/hwcontext_vaapi.c | 6 ++++++

> >  libavutil/pixfmt.h          | 3 +++

> >  2 files changed, 9 insertions(+)

> >

> > diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c

> > index cf117640f2..9838250b66 100644

> > --- a/libavutil/hwcontext_vaapi.c

> > +++ b/libavutil/hwcontext_vaapi.c

> > @@ -125,6 +125,12 @@ static const VAAPIFormatDescriptor

> > vaapi_format_map[] = {  #endif

> >      MAP(BGRA, RGB32,   BGRA, 0),

> >      MAP(BGRX, RGB32,   BGR0, 0),

> > +#ifdef VA_FOURCC_A2R10G10B10

> > +    MAP(A2R10G10B10, RGB32_10, A2R10G10B10, 0), #endif #ifdef

> > +VA_FOURCC_A2B10G10R10

> > +    MAP(A2B10G10R10, RGB32_10, A2B10G10R10, 0), #endif

> >      MAP(RGBA, RGB32,   RGBA, 0),

> >      MAP(RGBX, RGB32,   RGB0, 0),

> >  #ifdef VA_FOURCC_ABGR

> > diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h index

> > d78e863d4b..e00f129b46 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_A2R10G10B10, ///< 10-bit Pixel RGB formats.

> > +    AV_PIX_FMT_A2B10G10R10, ///< 10-bit Pixel BGR formats.

> 

> The patch looks insufficient, see the patch to add AYUV and other packed

> formats.


Thank you for the review, I will refer these patches.

> 

> The more important question imo is: Why are these formats needed, which

> hardware produces them for which input?


These formats target to Intel Ice Lake platform. will be use in HDR tone mapping filter.
input is P010.

welcome to review my HDR patch: https://patchwork.ffmpeg.org/patch/15018/
I appreciate any comments.

-Zachary

> 

> Carl Eugen

> _______________________________________________

> 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".
Carl Eugen Hoyos Sept. 11, 2019, 8:43 p.m.
Am Mi., 11. Sept. 2019 um 07:59 Uhr schrieb Zhou, Zachary
<zachary.zhou@intel.com>:
>
>
>
> > -----Original Message-----
> > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of Carl
> > Eugen Hoyos
> > Sent: Wednesday, September 11, 2019 7:30 AM
> > To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
> > Subject: Re: [FFmpeg-devel] [PATCH v1] libavutil: add A2R10G10B10 &
> > A2B10G10R10
> >
> > Am Di., 10. Sept. 2019 um 11:35 Uhr schrieb Zachary Zhou
> > <zachary.zhou@intel.com>:
> > >
> > > ---
> > >  libavutil/hwcontext_vaapi.c | 6 ++++++
> > >  libavutil/pixfmt.h          | 3 +++
> > >  2 files changed, 9 insertions(+)
> > >
> > > diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
> > > index cf117640f2..9838250b66 100644
> > > --- a/libavutil/hwcontext_vaapi.c
> > > +++ b/libavutil/hwcontext_vaapi.c
> > > @@ -125,6 +125,12 @@ static const VAAPIFormatDescriptor
> > > vaapi_format_map[] = {  #endif
> > >      MAP(BGRA, RGB32,   BGRA, 0),
> > >      MAP(BGRX, RGB32,   BGR0, 0),
> > > +#ifdef VA_FOURCC_A2R10G10B10
> > > +    MAP(A2R10G10B10, RGB32_10, A2R10G10B10, 0), #endif #ifdef
> > > +VA_FOURCC_A2B10G10R10
> > > +    MAP(A2B10G10R10, RGB32_10, A2B10G10R10, 0), #endif
> > >      MAP(RGBA, RGB32,   RGBA, 0),
> > >      MAP(RGBX, RGB32,   RGB0, 0),
> > >  #ifdef VA_FOURCC_ABGR
> > > diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h index
> > > d78e863d4b..e00f129b46 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_A2R10G10B10, ///< 10-bit Pixel RGB formats.
> > > +    AV_PIX_FMT_A2B10G10R10, ///< 10-bit Pixel BGR formats.
> >
> > The patch looks insufficient, see the patch to add AYUV and other packed
> > formats.
>
> Thank you for the review, I will refer these patches.
>
> >
> > The more important question imo is: Why are these formats needed, which
> > hardware produces them for which input?
>
> These formats target to Intel Ice Lake platform. will be use in HDR tone
> mapping filter. input is P010.
>
> welcome to review my HDR patch: https://patchwork.ffmpeg.org/patch/15018/
> I appreciate any comments.

Wouldn't it be more useful if your new filter outputs AV_PIX_FMT_GBRP10
for HDR output?

Carl Eugen
Zachary Zhou Sept. 25, 2019, 2:21 a.m.
On 9/12/19 4:43 AM, Carl Eugen Hoyos wrote:
> Am Mi., 11. Sept. 2019 um 07:59 Uhr schrieb Zhou, Zachary
> <zachary.zhou@intel.com>:
>>
>>
>>> -----Original Message-----
>>> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of Carl
>>> Eugen Hoyos
>>> Sent: Wednesday, September 11, 2019 7:30 AM
>>> To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
>>> Subject: Re: [FFmpeg-devel] [PATCH v1] libavutil: add A2R10G10B10 &
>>> A2B10G10R10
>>>
>>> Am Di., 10. Sept. 2019 um 11:35 Uhr schrieb Zachary Zhou
>>> <zachary.zhou@intel.com>:
>>>> ---
>>>>   libavutil/hwcontext_vaapi.c | 6 ++++++
>>>>   libavutil/pixfmt.h          | 3 +++
>>>>   2 files changed, 9 insertions(+)
>>>>
>>>> diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
>>>> index cf117640f2..9838250b66 100644
>>>> --- a/libavutil/hwcontext_vaapi.c
>>>> +++ b/libavutil/hwcontext_vaapi.c
>>>> @@ -125,6 +125,12 @@ static const VAAPIFormatDescriptor
>>>> vaapi_format_map[] = {  #endif
>>>>       MAP(BGRA, RGB32,   BGRA, 0),
>>>>       MAP(BGRX, RGB32,   BGR0, 0),
>>>> +#ifdef VA_FOURCC_A2R10G10B10
>>>> +    MAP(A2R10G10B10, RGB32_10, A2R10G10B10, 0), #endif #ifdef
>>>> +VA_FOURCC_A2B10G10R10
>>>> +    MAP(A2B10G10R10, RGB32_10, A2B10G10R10, 0), #endif
>>>>       MAP(RGBA, RGB32,   RGBA, 0),
>>>>       MAP(RGBX, RGB32,   RGB0, 0),
>>>>   #ifdef VA_FOURCC_ABGR
>>>> diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h index
>>>> d78e863d4b..e00f129b46 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_A2R10G10B10, ///< 10-bit Pixel RGB formats.
>>>> +    AV_PIX_FMT_A2B10G10R10, ///< 10-bit Pixel BGR formats.
>>> The patch looks insufficient, see the patch to add AYUV and other packed
>>> formats.
>> Thank you for the review, I will refer these patches.
>>
>>> The more important question imo is: Why are these formats needed, which
>>> hardware produces them for which input?
>> These formats target to Intel Ice Lake platform. will be use in HDR tone
>> mapping filter. input is P010.
>>
>> welcome to review my HDR patch: https://patchwork.ffmpeg.org/patch/15018/
>> I appreciate any comments.
> Wouldn't it be more useful if your new filter outputs AV_PIX_FMT_GBRP10
> for HDR output?

Thanks for the comments, the memory layout is different between GBRP10 
and these two formats.

and It looks like vaapi doesn't have such GBRP10  support on iHD drive side.

-Zach


> Carl Eugen
> _______________________________________________
> 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".

Patch hide | download patch | download mbox

diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
index cf117640f2..9838250b66 100644
--- a/libavutil/hwcontext_vaapi.c
+++ b/libavutil/hwcontext_vaapi.c
@@ -125,6 +125,12 @@  static const VAAPIFormatDescriptor vaapi_format_map[] = {
 #endif
     MAP(BGRA, RGB32,   BGRA, 0),
     MAP(BGRX, RGB32,   BGR0, 0),
+#ifdef VA_FOURCC_A2R10G10B10
+    MAP(A2R10G10B10, RGB32_10, A2R10G10B10, 0),
+#endif
+#ifdef VA_FOURCC_A2B10G10R10
+    MAP(A2B10G10R10, RGB32_10, A2B10G10R10, 0),
+#endif
     MAP(RGBA, RGB32,   RGBA, 0),
     MAP(RGBX, RGB32,   RGB0, 0),
 #ifdef VA_FOURCC_ABGR
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index d78e863d4b..e00f129b46 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_A2R10G10B10, ///< 10-bit Pixel RGB formats.
+    AV_PIX_FMT_A2B10G10R10, ///< 10-bit Pixel BGR formats.
+
     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
 };