diff mbox

[FFmpeg-devel,2/2] lavc/vaapi_decode: fix profile search when disable exact profile match.

Message ID 84970e84-28f0-f5bd-ef1e-7ffff4304981@gmail.com
State Superseded
Headers show

Commit Message

Jun Zhao Sept. 21, 2017, 7:22 a.m. UTC
From d7dc5c00692302e810412dea44ae3d2f122fb9a4 Mon Sep 17 00:00:00 2001
From: Jun Zhao <jun.zhao@intel.com>
Date: Thu, 21 Sep 2017 02:44:42 -0400
Subject: [PATCH 2/2] lavc/vaapi_decode: fix profile search when disable exact
 profile match.

When disable exact profile match, alway use the profile found by
codecid.

Signed-off-by: Jun Zhao <jun.zhao@intel.com>
---
 libavcodec/vaapi_decode.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Mark Thompson Sept. 27, 2017, 9:40 p.m. UTC | #1
On 21/09/17 08:22, Jun Zhao wrote:
> From d7dc5c00692302e810412dea44ae3d2f122fb9a4 Mon Sep 17 00:00:00 2001
> From: Jun Zhao <jun.zhao@intel.com>
> Date: Thu, 21 Sep 2017 02:44:42 -0400
> Subject: [PATCH 2/2] lavc/vaapi_decode: fix profile search when disable exact
>  profile match.
> 
> When disable exact profile match, alway use the profile found by
> codecid.
> 
> Signed-off-by: Jun Zhao <jun.zhao@intel.com>
> ---
>  libavcodec/vaapi_decode.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c
> index cf58aae4c6..98b00e3637 100644
> --- a/libavcodec/vaapi_decode.c
> +++ b/libavcodec/vaapi_decode.c
> @@ -329,6 +329,10 @@ static int vaapi_decode_make_config(AVCodecContext *avctx)
>              if (exact_match)
>                  break;
>              alt_profile = vaapi_profile_map[i].codec_profile;
> +
> +            if (avctx->hwaccel_flags &
> +                AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH)
> +                break;
>          }
>      }
>      av_freep(&profile_list);
> -- 
> 2.11.0
> 

An exact match might exist later in the list.  Consider an H.264 high input - this change can choose H.264 constrained baseline instead even if H.264 high is present.

- Mark
Jun Zhao Sept. 28, 2017, 7:51 a.m. UTC | #2
On 2017/9/28 5:40, Mark Thompson wrote:
> On 21/09/17 08:22, Jun Zhao wrote:
>> From d7dc5c00692302e810412dea44ae3d2f122fb9a4 Mon Sep 17 00:00:00 2001
>> From: Jun Zhao <jun.zhao@intel.com>
>> Date: Thu, 21 Sep 2017 02:44:42 -0400
>> Subject: [PATCH 2/2] lavc/vaapi_decode: fix profile search when disable exact
>>  profile match.
>>
>> When disable exact profile match, alway use the profile found by
>> codecid.
>>
>> Signed-off-by: Jun Zhao <jun.zhao@intel.com>
>> ---
>>  libavcodec/vaapi_decode.c | 4 ++++
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c
>> index cf58aae4c6..98b00e3637 100644
>> --- a/libavcodec/vaapi_decode.c
>> +++ b/libavcodec/vaapi_decode.c
>> @@ -329,6 +329,10 @@ static int vaapi_decode_make_config(AVCodecContext *avctx)
>>              if (exact_match)
>>                  break;
>>              alt_profile = vaapi_profile_map[i].codec_profile;
>> +
>> +            if (avctx->hwaccel_flags &
>> +                AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH)
>> +                break;
>>          }
>>      }
>>      av_freep(&profile_list);
>> -- 
>> 2.11.0
>>
> An exact match might exist later in the list.  Consider an H.264 high input - this change can choose H.264 constrained baseline instead even if H.264 high is present.
>
> - Mark
I will double-check the logic in this case
BTW, the original issue is I found a HEVC clip use a wrong profile with
0 (avctx->profile == 0),
then FFmpeg VAAPI hwaccel will use VaProfileHEVCMain10 in Skylake lead to
vaCreateConfig fail, because Skylake don't support HEVC 10 bits decoding.
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
diff mbox

Patch

diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c
index cf58aae4c6..98b00e3637 100644
--- a/libavcodec/vaapi_decode.c
+++ b/libavcodec/vaapi_decode.c
@@ -329,6 +329,10 @@  static int vaapi_decode_make_config(AVCodecContext *avctx)
             if (exact_match)
                 break;
             alt_profile = vaapi_profile_map[i].codec_profile;
+
+            if (avctx->hwaccel_flags &
+                AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH)
+                break;
         }
     }
     av_freep(&profile_list);