[FFmpeg-devel,2/5] lavu/hwcontext_vaapi: add vaapi_format_map for Y210/AYUV/Y410

Submitted by Linjie Fu on June 28, 2019, 2:27 a.m.

Details

Message ID 1561688829-32492-1-git-send-email-linjie.fu@intel.com
State New
Headers show

Commit Message

Linjie Fu June 28, 2019, 2:27 a.m.
Signed-off-by: Linjie Fu <linjie.fu@intel.com>
---
 libavutil/hwcontext_vaapi.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Zhong Li June 27, 2019, 3:41 p.m.
> From: ffmpeg-devel [mailto:ffmpeg-devel-bounces@ffmpeg.org] On Behalf

> Of Linjie Fu

> Sent: Friday, June 28, 2019 10:27 AM

> To: ffmpeg-devel@ffmpeg.org

> Cc: Fu, Linjie <linjie.fu@intel.com>

> Subject: [FFmpeg-devel] [PATCH 2/5] lavu/hwcontext_vaapi: add

> vaapi_format_map for Y210/AYUV/Y410

> 

> Signed-off-by: Linjie Fu <linjie.fu@intel.com>

> ---

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

>  1 file changed, 8 insertions(+)

> 

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

> 4227c3c..6378d0e 100644

> --- a/libavutil/hwcontext_vaapi.c

> +++ b/libavutil/hwcontext_vaapi.c

> @@ -116,6 +116,14 @@ static const VAAPIFormatDescriptor

> vaapi_format_map[] = {  #endif

>      MAP(UYVY, YUV422,  UYVY422, 0),

>      MAP(YUY2, YUV422,  YUYV422, 0),

> +#ifdef VA_FOURCC_Y210

> +    MAP(Y210, YUV422_10,Y210LE, 0),

> +#endif

> +#define VA_RT_FORMAT_AYUV VA_FOURCC_AYUV


Probably you want to add "#ifdef VA_FOURCC_AYUV" too.
And would better to #undef VA_RT_FORMAT_AYUV here once map is done.
(If you want to get a longer life cycle, would better define it outside)

> +    MAP(AYUV,   AYUV,     AYUV, 0),

> +#ifdef VA_FOURCC_Y410

> +    MAP(Y410, YUV444_10,Y410LE, 0),

> +#endif

>      MAP(411P, YUV411,  YUV411P, 0),

>      MAP(422V, YUV422,  YUV440P, 0),

>      MAP(444P, YUV444,  YUV444P, 0),

> --

> 2.7.4
Linjie Fu June 28, 2019, 2:45 a.m.
> -----Original Message-----

> From: Li, Zhong

> Sent: Thursday, June 27, 2019 23:41

> To: FFmpeg development discussions and patches <ffmpeg-

> devel@ffmpeg.org>

> Cc: Fu, Linjie <linjie.fu@intel.com>

> Subject: RE: [FFmpeg-devel] [PATCH 2/5] lavu/hwcontext_vaapi: add

> vaapi_format_map for Y210/AYUV/Y410

> 

> > From: ffmpeg-devel [mailto:ffmpeg-devel-bounces@ffmpeg.org] On

> Behalf

> > Of Linjie Fu

> > Sent: Friday, June 28, 2019 10:27 AM

> > To: ffmpeg-devel@ffmpeg.org

> > Cc: Fu, Linjie <linjie.fu@intel.com>

> > Subject: [FFmpeg-devel] [PATCH 2/5] lavu/hwcontext_vaapi: add

> > vaapi_format_map for Y210/AYUV/Y410

> >

> > Signed-off-by: Linjie Fu <linjie.fu@intel.com>

> > ---

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

> >  1 file changed, 8 insertions(+)

> >

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

> > 4227c3c..6378d0e 100644

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

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

> > @@ -116,6 +116,14 @@ static const VAAPIFormatDescriptor

> > vaapi_format_map[] = {  #endif

> >      MAP(UYVY, YUV422,  UYVY422, 0),

> >      MAP(YUY2, YUV422,  YUYV422, 0),

> > +#ifdef VA_FOURCC_Y210

> > +    MAP(Y210, YUV422_10,Y210LE, 0),

> > +#endif

> > +#define VA_RT_FORMAT_AYUV VA_FOURCC_AYUV

> 

> Probably you want to add "#ifdef VA_FOURCC_AYUV" too.


Since VA_FOURCC_AYUV was defined in libva early (same with YUY2 and UYVY 
in commit bd592e38, 2009), I didn't add #ifdef query for AYUV.

> And would better to #undef VA_RT_FORMAT_AYUV here once map is done.

> (If you want to get a longer life cycle, would better define it outside)


I prefer to put the macro #define just ahead of the usage in vaapi_format_map
to make it more directly.
Will add #undef.

> > +    MAP(AYUV,   AYUV,     AYUV, 0),

> > +#ifdef VA_FOURCC_Y410

> > +    MAP(Y410, YUV444_10,Y410LE, 0),

> > +#endif

> >      MAP(411P, YUV411,  YUV411P, 0),

> >      MAP(422V, YUV422,  YUV440P, 0),

> >      MAP(444P, YUV444,  YUV444P, 0),

> > --

> > 2.7.4
Zachary Zhou June 28, 2019, 3:32 a.m.
> -----Original Message-----

> From: ffmpeg-devel [mailto:ffmpeg-devel-bounces@ffmpeg.org] On Behalf Of

> Linjie Fu

> Sent: Friday, June 28, 2019 10:27 AM

> To: ffmpeg-devel@ffmpeg.org

> Cc: Fu, Linjie <linjie.fu@intel.com>

> Subject: [FFmpeg-devel] [PATCH 2/5] lavu/hwcontext_vaapi: add

> vaapi_format_map for Y210/AYUV/Y410

> 

> Signed-off-by: Linjie Fu <linjie.fu@intel.com>

> ---

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

>  1 file changed, 8 insertions(+)

> 

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

> 4227c3c..6378d0e 100644

> --- a/libavutil/hwcontext_vaapi.c

> +++ b/libavutil/hwcontext_vaapi.c

> @@ -116,6 +116,14 @@ static const VAAPIFormatDescriptor

> vaapi_format_map[] = {  #endif

>      MAP(UYVY, YUV422,  UYVY422, 0),

>      MAP(YUY2, YUV422,  YUYV422, 0),

> +#ifdef VA_FOURCC_Y210

> +    MAP(Y210, YUV422_10,Y210LE, 0),

> +#endif

> +#define VA_RT_FORMAT_AYUV VA_FOURCC_AYUV

> +    MAP(AYUV,   AYUV,     AYUV, 0),

> +#ifdef VA_FOURCC_Y410

> +    MAP(Y410, YUV444_10,Y410LE, 0),

> +#endif

>      MAP(411P, YUV411,  YUV411P, 0),

>      MAP(422V, YUV422,  YUV440P, 0),

>      MAP(444P, YUV444,  YUV444P, 0),

> --


are you also considering to add Y210/AYUV/Y410 support in vaapi_drm_format_map in libavutil/hwcontext_vaapi.c ?

Thanks,
Zachary

> 2.7.4

> 

> _______________________________________________

> 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".
Linjie Fu June 28, 2019, 5:34 a.m.
> -----Original Message-----

> From: Zhou, Zachary

> Sent: Friday, June 28, 2019 11:33

> To: FFmpeg development discussions and patches <ffmpeg-

> devel@ffmpeg.org>

> Cc: Fu, Linjie <linjie.fu@intel.com>

> Subject: RE: [FFmpeg-devel] [PATCH 2/5] lavu/hwcontext_vaapi: add

> vaapi_format_map for Y210/AYUV/Y410


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

> > 4227c3c..6378d0e 100644

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

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

> > @@ -116,6 +116,14 @@ static const VAAPIFormatDescriptor

> > vaapi_format_map[] = {  #endif

> >      MAP(UYVY, YUV422,  UYVY422, 0),

> >      MAP(YUY2, YUV422,  YUYV422, 0),

> > +#ifdef VA_FOURCC_Y210

> > +    MAP(Y210, YUV422_10,Y210LE, 0),

> > +#endif

> > +#define VA_RT_FORMAT_AYUV VA_FOURCC_AYUV

> > +    MAP(AYUV,   AYUV,     AYUV, 0),

> > +#ifdef VA_FOURCC_Y410

> > +    MAP(Y410, YUV444_10,Y410LE, 0),

> > +#endif

> >      MAP(411P, YUV411,  YUV411P, 0),

> >      MAP(422V, YUV422,  YUV440P, 0),

> >      MAP(444P, YUV444,  YUV444P, 0),

> > --

> 

> are you also considering to add Y210/AYUV/Y410 support in

> vaapi_drm_format_map in libavutil/hwcontext_vaapi.c ?

> 

It could be added in vaapi_drm_format_map, however is not quite relevant with
the enabling of HEVC Rext decoding.
Maybe a separate patch can be sent and not include in this patch set.
Mark Thompson July 7, 2019, 12:13 p.m.
On 28/06/2019 03:27, Linjie Fu wrote:
> Signed-off-by: Linjie Fu <linjie.fu@intel.com>
> ---
>  libavutil/hwcontext_vaapi.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
> index 4227c3c..6378d0e 100644
> --- a/libavutil/hwcontext_vaapi.c
> +++ b/libavutil/hwcontext_vaapi.c
> @@ -116,6 +116,14 @@ static const VAAPIFormatDescriptor vaapi_format_map[] = {
>  #endif
>      MAP(UYVY, YUV422,  UYVY422, 0),
>      MAP(YUY2, YUV422,  YUYV422, 0),
> +#ifdef VA_FOURCC_Y210
> +    MAP(Y210, YUV422_10,Y210LE, 0),
> +#endif
> +#define VA_RT_FORMAT_AYUV VA_FOURCC_AYUV

VA_RT_FORMAT_* is a mask, VA_FOURCC_* is effectively a set of enum values.  They aren't usable as each other like this.

> +    MAP(AYUV,   AYUV,     AYUV, 0),

Is AYUV actually intended to support decoding alpha, or is it just a packed representation for YUV 4:4:4 data (like RGB0)?  If the former, you should probably add a new render target format to libva.  If the latter, you can use VA_RT_FORMAT_YUV444 with it.

> +#ifdef VA_FOURCC_Y410
> +    MAP(Y410, YUV444_10,Y410LE, 0),
> +#endif
>      MAP(411P, YUV411,  YUV411P, 0),
>      MAP(422V, YUV422,  YUV440P, 0),
>      MAP(444P, YUV444,  YUV444P, 0),
> 

- Mark
Linjie Fu July 7, 2019, 2:09 p.m.
> -----Original Message-----

> From: ffmpeg-devel [mailto:ffmpeg-devel-bounces@ffmpeg.org] On Behalf

> Of Mark Thompson

> Sent: Sunday, July 7, 2019 20:13

> To: ffmpeg-devel@ffmpeg.org

> Subject: Re: [FFmpeg-devel] [PATCH 2/5] lavu/hwcontext_vaapi: add

> vaapi_format_map for Y210/AYUV/Y410

> 

> On 28/06/2019 03:27, Linjie Fu wrote:

> > Signed-off-by: Linjie Fu <linjie.fu@intel.com>

> > ---

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

> >  1 file changed, 8 insertions(+)

> >

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

> > index 4227c3c..6378d0e 100644

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

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

> > @@ -116,6 +116,14 @@ static const VAAPIFormatDescriptor

> vaapi_format_map[] = {

> >  #endif

> >      MAP(UYVY, YUV422,  UYVY422, 0),

> >      MAP(YUY2, YUV422,  YUYV422, 0),

> > +#ifdef VA_FOURCC_Y210

> > +    MAP(Y210, YUV422_10,Y210LE, 0),

> > +#endif

> > +#define VA_RT_FORMAT_AYUV VA_FOURCC_AYUV

> 

> VA_RT_FORMAT_* is a mask, VA_FOURCC_* is effectively a set of enum

> values.  They aren't usable as each other like this.

> 

> > +    MAP(AYUV,   AYUV,     AYUV, 0),

> 

> Is AYUV actually intended to support decoding alpha, or is it just a packed

> representation for YUV 4:4:4 data (like RGB0)?  If the former, you should

> probably add a new render target format to libva.  If the latter, you can use

> VA_RT_FORMAT_YUV444 with it.


There is no VA_RT_FORMAT_AYUV in defined in libva, and currently in media-driver,
VA_FOURCC_AYUV is used to represent VA_RT_FORMAT_AYUV in a hacky way.

Agreed there may be some hidden work in libva/media-driver to avoid hack.
Thanks for review.

Patch hide | download patch | download mbox

diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
index 4227c3c..6378d0e 100644
--- a/libavutil/hwcontext_vaapi.c
+++ b/libavutil/hwcontext_vaapi.c
@@ -116,6 +116,14 @@  static const VAAPIFormatDescriptor vaapi_format_map[] = {
 #endif
     MAP(UYVY, YUV422,  UYVY422, 0),
     MAP(YUY2, YUV422,  YUYV422, 0),
+#ifdef VA_FOURCC_Y210
+    MAP(Y210, YUV422_10,Y210LE, 0),
+#endif
+#define VA_RT_FORMAT_AYUV VA_FOURCC_AYUV
+    MAP(AYUV,   AYUV,     AYUV, 0),
+#ifdef VA_FOURCC_Y410
+    MAP(Y410, YUV444_10,Y410LE, 0),
+#endif
     MAP(411P, YUV411,  YUV411P, 0),
     MAP(422V, YUV422,  YUV440P, 0),
     MAP(444P, YUV444,  YUV444P, 0),