[FFmpeg-devel,2/2] lavu/hwcontext_vaapi: add nv21 map

Submitted by Jun Zhao on May 23, 2018, 10:29 a.m.

Details

Message ID 1527071360-8938-3-git-send-email-mypopydev@gmail.com
State New
Headers show

Commit Message

Jun Zhao May 23, 2018, 10:29 a.m.
Signed-off-by: Jun Zhao <mypopydev@gmail.com>
---
 libavutil/hwcontext_vaapi.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

wm4 May 23, 2018, 3:10 p.m.
On Wed, 23 May 2018 18:29:20 +0800
Jun Zhao <mypopydev@gmail.com> wrote:

> Signed-off-by: Jun Zhao <mypopydev@gmail.com>
> ---
>  libavutil/hwcontext_vaapi.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
> index 5bdb02f..7b3cbea 100644
> --- a/libavutil/hwcontext_vaapi.c
> +++ b/libavutil/hwcontext_vaapi.c
> @@ -100,6 +100,9 @@ static const struct {
>      enum AVPixelFormat pix_fmt;
>  } vaapi_format_map[] = {
>      MAP(NV12, YUV420,  NV12),
> +#ifdef VA_FOURCC_NV21
> +    MAP(NV21, YUV420,  NV21),    // As NV12 with U and V reversed
> +#endif
>      MAP(YV12, YUV420,  YUV420P), // With U/V planes swapped.
>      MAP(IYUV, YUV420,  YUV420P),
>  #ifdef VA_FOURCC_I420

Why does this format exist and why is it "needed"?
Mark Thompson May 24, 2018, 12:07 a.m.
On 23/05/18 11:29, Jun Zhao wrote:
> Signed-off-by: Jun Zhao <mypopydev@gmail.com>
> ---
>  libavutil/hwcontext_vaapi.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
> index 5bdb02f..7b3cbea 100644
> --- a/libavutil/hwcontext_vaapi.c
> +++ b/libavutil/hwcontext_vaapi.c
> @@ -100,6 +100,9 @@ static const struct {
>      enum AVPixelFormat pix_fmt;
>  } vaapi_format_map[] = {
>      MAP(NV12, YUV420,  NV12),
> +#ifdef VA_FOURCC_NV21
> +    MAP(NV21, YUV420,  NV21),    // As NV12 with U and V reversed
> +#endif
>      MAP(YV12, YUV420,  YUV420P), // With U/V planes swapped.
>      MAP(IYUV, YUV420,  YUV420P),
>  #ifdef VA_FOURCC_I420
> 

Sure, but why would anyone ever use this format?

- Mark
mypopy@gmail.com May 24, 2018, 1:04 a.m.
2018-05-24 8:07 GMT+08:00 Mark Thompson <sw@jkqxz.net>:
> On 23/05/18 11:29, Jun Zhao wrote:
>> Signed-off-by: Jun Zhao <mypopydev@gmail.com>
>> ---
>>  libavutil/hwcontext_vaapi.c | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
>> index 5bdb02f..7b3cbea 100644
>> --- a/libavutil/hwcontext_vaapi.c
>> +++ b/libavutil/hwcontext_vaapi.c
>> @@ -100,6 +100,9 @@ static const struct {
>>      enum AVPixelFormat pix_fmt;
>>  } vaapi_format_map[] = {
>>      MAP(NV12, YUV420,  NV12),
>> +#ifdef VA_FOURCC_NV21
>> +    MAP(NV21, YUV420,  NV21),    // As NV12 with U and V reversed
>> +#endif
>>      MAP(YV12, YUV420,  YUV420P), // With U/V planes swapped.
>>      MAP(IYUV, YUV420,  YUV420P),
>>  #ifdef VA_FOURCC_I420
>>
>
> Sure, but why would anyone ever use this format?
>
> - Mark

I don't know why iHD driver return NV21 in fact, I just
want to remove an unknow enrty dump when map the pixel format

Patch hide | download patch | download mbox

diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
index 5bdb02f..7b3cbea 100644
--- a/libavutil/hwcontext_vaapi.c
+++ b/libavutil/hwcontext_vaapi.c
@@ -100,6 +100,9 @@  static const struct {
     enum AVPixelFormat pix_fmt;
 } vaapi_format_map[] = {
     MAP(NV12, YUV420,  NV12),
+#ifdef VA_FOURCC_NV21
+    MAP(NV21, YUV420,  NV21),    // As NV12 with U and V reversed
+#endif
     MAP(YV12, YUV420,  YUV420P), // With U/V planes swapped.
     MAP(IYUV, YUV420,  YUV420P),
 #ifdef VA_FOURCC_I420