diff mbox series

[FFmpeg-devel] lavc/vaapi_hevc: Add support for Main Intra & Main 10 Intra

Message ID 20240328020704.4109636-1-haihao.xiang@intel.com
State New
Headers show
Series [FFmpeg-devel] lavc/vaapi_hevc: Add support for Main Intra & Main 10 Intra | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Xiang, Haihao March 28, 2024, 2:07 a.m. UTC
From: Haihao Xiang <haihao.xiang@intel.com>

Both Main Intra and Main 10 Intra are Rext, we may use Main and Main 10
instead for decoding. This patch fixes the error below:

[hevc @ 0x55a771b80a00] No support for codec hevc profile 4.
[hevc @ 0x55a771b80a00] Failed setup for format vaapi: hwaccel
initialisation returned error.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
---
 libavcodec/vaapi_hevc.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Xiang, Haihao April 1, 2024, 6:10 a.m. UTC | #1
On Do, 2024-03-28 at 10:07 +0800, Xiang, Haihao wrote:
> From: Haihao Xiang <haihao.xiang@intel.com>
> 
> Both Main Intra and Main 10 Intra are Rext, we may use Main and Main 10
> instead for decoding. This patch fixes the error below:
> 
> [hevc @ 0x55a771b80a00] No support for codec hevc profile 4.
> [hevc @ 0x55a771b80a00] Failed setup for format vaapi: hwaccel
> initialisation returned error.
> 
> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
> ---
>  libavcodec/vaapi_hevc.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/libavcodec/vaapi_hevc.c b/libavcodec/vaapi_hevc.c
> index 3bdd2dd1b8..83b94d1a55 100644
> --- a/libavcodec/vaapi_hevc.c
> +++ b/libavcodec/vaapi_hevc.c
> @@ -612,6 +612,13 @@ VAProfile
> ff_vaapi_parse_hevc_rext_scc_profile(AVCodecContext *avctx)
>          av_log(avctx, AV_LOG_VERBOSE, "HEVC profile %s is found.\n", profile-
> >name);
>      }
>  
> +#if VA_CHECK_VERSION(0, 37, 0)
> +    if (!strcmp(profile->name, "Main Intra"))
> +        return VAProfileHEVCMain;
> +    else if (!strcmp(profile->name, "Main 10 Intra"))
> +        return VAProfileHEVCMain10;
> +#endif
> +
>  #if VA_CHECK_VERSION(1, 2, 0)
>      if (!strcmp(profile->name, "Main 12") ||
>          !strcmp(profile->name, "Main 12 Intra"))

Will apply,

- Haihao
Mark Thompson April 1, 2024, 8:11 p.m. UTC | #2
On 28/03/2024 02:07, Xiang, Haihao wrote:
> From: Haihao Xiang <haihao.xiang@intel.com>
> 
> Both Main Intra and Main 10 Intra are Rext, we may use Main and Main 10
> instead for decoding. This patch fixes the error below:
> 
> [hevc @ 0x55a771b80a00] No support for codec hevc profile 4.
> [hevc @ 0x55a771b80a00] Failed setup for format vaapi: hwaccel
> initialisation returned error.
> 
> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
> ---
>   libavcodec/vaapi_hevc.c | 7 +++++++
>   1 file changed, 7 insertions(+)
> 
> diff --git a/libavcodec/vaapi_hevc.c b/libavcodec/vaapi_hevc.c
> index 3bdd2dd1b8..83b94d1a55 100644
> --- a/libavcodec/vaapi_hevc.c
> +++ b/libavcodec/vaapi_hevc.c
> @@ -612,6 +612,13 @@ VAProfile ff_vaapi_parse_hevc_rext_scc_profile(AVCodecContext *avctx)
>           av_log(avctx, AV_LOG_VERBOSE, "HEVC profile %s is found.\n", profile->name);
>       }
>   
> +#if VA_CHECK_VERSION(0, 37, 0)
> +    if (!strcmp(profile->name, "Main Intra"))
> +        return VAProfileHEVCMain;
> +    else if (!strcmp(profile->name, "Main 10 Intra"))
> +        return VAProfileHEVCMain10;
> +#endif
> +
>   #if VA_CHECK_VERSION(1, 2, 0)
>       if (!strcmp(profile->name, "Main 12") ||
>           !strcmp(profile->name, "Main 12 Intra"))

What if high_precision_offsets_enabled_flag is set?

(That doesn't matter for the VAAPI encoder setting the profile because we always have it as zero.)

Thanks,

- Mark
Xiang, Haihao April 2, 2024, 6:55 a.m. UTC | #3
On Ma, 2024-04-01 at 21:11 +0100, Mark Thompson wrote:
> On 28/03/2024 02:07, Xiang, Haihao wrote:
> > From: Haihao Xiang <haihao.xiang@intel.com>
> > 
> > Both Main Intra and Main 10 Intra are Rext, we may use Main and Main 10
> > instead for decoding. This patch fixes the error below:
> > 
> > [hevc @ 0x55a771b80a00] No support for codec hevc profile 4.
> > [hevc @ 0x55a771b80a00] Failed setup for format vaapi: hwaccel
> > initialisation returned error.
> > 
> > Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
> > ---
> >   libavcodec/vaapi_hevc.c | 7 +++++++
> >   1 file changed, 7 insertions(+)
> > 
> > diff --git a/libavcodec/vaapi_hevc.c b/libavcodec/vaapi_hevc.c
> > index 3bdd2dd1b8..83b94d1a55 100644
> > --- a/libavcodec/vaapi_hevc.c
> > +++ b/libavcodec/vaapi_hevc.c
> > @@ -612,6 +612,13 @@ VAProfile
> > ff_vaapi_parse_hevc_rext_scc_profile(AVCodecContext *avctx)
> >           av_log(avctx, AV_LOG_VERBOSE, "HEVC profile %s is found.\n",
> > profile->name);
> >       }
> >   
> > +#if VA_CHECK_VERSION(0, 37, 0)
> > +    if (!strcmp(profile->name, "Main Intra"))
> > +        return VAProfileHEVCMain;
> > +    else if (!strcmp(profile->name, "Main 10 Intra"))
> > +        return VAProfileHEVCMain10;
> > +#endif
> > +
> >   #if VA_CHECK_VERSION(1, 2, 0)
> >       if (!strcmp(profile->name, "Main 12") ||
> >           !strcmp(profile->name, "Main 12 Intra"))
> 
> What if high_precision_offsets_enabled_flag is set?
> 
> (That doesn't matter for the VAAPI encoder setting the profile because we
> always have it as zero.)

Here use VAProfileHEVCMain or VAProfileHEVCMain10 to create VAConfig for
decoding,  avctx->profile (4) is not changed.
high_precision_offsets_enabled_flag is set in VAPictureParameterBufferHEVCRext
when avctx->profile is 4.

BRs
Haihao

> 
> Thanks,
> 
> - Mark
> _______________________________________________
> 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".
Mark Thompson April 2, 2024, 9:01 p.m. UTC | #4
On 02/04/2024 07:55, Xiang, Haihao wrote:
> On Ma, 2024-04-01 at 21:11 +0100, Mark Thompson wrote:
>> On 28/03/2024 02:07, Xiang, Haihao wrote:
>>> From: Haihao Xiang <haihao.xiang@intel.com>
>>>
>>> Both Main Intra and Main 10 Intra are Rext, we may use Main and Main 10
>>> instead for decoding. This patch fixes the error below:
>>>
>>> [hevc @ 0x55a771b80a00] No support for codec hevc profile 4.
>>> [hevc @ 0x55a771b80a00] Failed setup for format vaapi: hwaccel
>>> initialisation returned error.
>>>
>>> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
>>> ---
>>>    libavcodec/vaapi_hevc.c | 7 +++++++
>>>    1 file changed, 7 insertions(+)
>>>
>>> diff --git a/libavcodec/vaapi_hevc.c b/libavcodec/vaapi_hevc.c
>>> index 3bdd2dd1b8..83b94d1a55 100644
>>> --- a/libavcodec/vaapi_hevc.c
>>> +++ b/libavcodec/vaapi_hevc.c
>>> @@ -612,6 +612,13 @@ VAProfile
>>> ff_vaapi_parse_hevc_rext_scc_profile(AVCodecContext *avctx)
>>>            av_log(avctx, AV_LOG_VERBOSE, "HEVC profile %s is found.\n",
>>> profile->name);
>>>        }
>>>    
>>> +#if VA_CHECK_VERSION(0, 37, 0)
>>> +    if (!strcmp(profile->name, "Main Intra"))
>>> +        return VAProfileHEVCMain;
>>> +    else if (!strcmp(profile->name, "Main 10 Intra"))
>>> +        return VAProfileHEVCMain10;
>>> +#endif
>>> +
>>>    #if VA_CHECK_VERSION(1, 2, 0)
>>>        if (!strcmp(profile->name, "Main 12") ||
>>>            !strcmp(profile->name, "Main 12 Intra"))
>>
>> What if high_precision_offsets_enabled_flag is set?
>>
>> (That doesn't matter for the VAAPI encoder setting the profile because we
>> always have it as zero.)
> 
> Here use VAProfileHEVCMain or VAProfileHEVCMain10 to create VAConfig for
> decoding,  avctx->profile (4) is not changed.
> high_precision_offsets_enabled_flag is set in VAPictureParameterBufferHEVCRext
> when avctx->profile is 4.

But Main and Main 10 profile have:

"Active SPSs for the base layer shall have ... high_precision_offsets_enabled_flag, ... when present, equal to 0 only."

so a decoder implementing those profiles need not support it.  (It may work as a compatible extension as the field is there, but if it doesn't also support general rext cases then this is unlikely to be implemented.)

Thanks,

- Mark
Xiang, Haihao April 3, 2024, 1:26 a.m. UTC | #5
On Di, 2024-04-02 at 22:01 +0100, Mark Thompson wrote:
> On 02/04/2024 07:55, Xiang, Haihao wrote:
> > On Ma, 2024-04-01 at 21:11 +0100, Mark Thompson wrote:
> > > On 28/03/2024 02:07, Xiang, Haihao wrote:
> > > > From: Haihao Xiang <haihao.xiang@intel.com>
> > > > 
> > > > Both Main Intra and Main 10 Intra are Rext, we may use Main and Main 10
> > > > instead for decoding. This patch fixes the error below:
> > > > 
> > > > [hevc @ 0x55a771b80a00] No support for codec hevc profile 4.
> > > > [hevc @ 0x55a771b80a00] Failed setup for format vaapi: hwaccel
> > > > initialisation returned error.
> > > > 
> > > > Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
> > > > ---
> > > >    libavcodec/vaapi_hevc.c | 7 +++++++
> > > >    1 file changed, 7 insertions(+)
> > > > 
> > > > diff --git a/libavcodec/vaapi_hevc.c b/libavcodec/vaapi_hevc.c
> > > > index 3bdd2dd1b8..83b94d1a55 100644
> > > > --- a/libavcodec/vaapi_hevc.c
> > > > +++ b/libavcodec/vaapi_hevc.c
> > > > @@ -612,6 +612,13 @@ VAProfile
> > > > ff_vaapi_parse_hevc_rext_scc_profile(AVCodecContext *avctx)
> > > >            av_log(avctx, AV_LOG_VERBOSE, "HEVC profile %s is found.\n",
> > > > profile->name);
> > > >        }
> > > >    
> > > > +#if VA_CHECK_VERSION(0, 37, 0)
> > > > +    if (!strcmp(profile->name, "Main Intra"))
> > > > +        return VAProfileHEVCMain;
> > > > +    else if (!strcmp(profile->name, "Main 10 Intra"))
> > > > +        return VAProfileHEVCMain10;
> > > > +#endif
> > > > +
> > > >    #if VA_CHECK_VERSION(1, 2, 0)
> > > >        if (!strcmp(profile->name, "Main 12") ||
> > > >            !strcmp(profile->name, "Main 12 Intra"))
> > > 
> > > What if high_precision_offsets_enabled_flag is set?
> > > 
> > > (That doesn't matter for the VAAPI encoder setting the profile because we
> > > always have it as zero.)
> > 
> > Here use VAProfileHEVCMain or VAProfileHEVCMain10 to create VAConfig for
> > decoding,  avctx->profile (4) is not changed.
> > high_precision_offsets_enabled_flag is set in
> > VAPictureParameterBufferHEVCRext
> > when avctx->profile is 4.
> 
> But Main and Main 10 profile have:
> 
> "Active SPSs for the base layer shall have ...
> high_precision_offsets_enabled_flag, ... when present, equal to 0 only."
> 
> so a decoder implementing those profiles need not support it.  (It may work as
> a compatible extension as the field is there, but if it doesn't also support
> general rext cases then this is unlikely to be implemented.)
> 

I get your point, the underlying driver mightn't support
VAPictureParameterBufferHEVCRext. Seems we should add new profiles in libva. 

Thanks
Haihao
diff mbox series

Patch

diff --git a/libavcodec/vaapi_hevc.c b/libavcodec/vaapi_hevc.c
index 3bdd2dd1b8..83b94d1a55 100644
--- a/libavcodec/vaapi_hevc.c
+++ b/libavcodec/vaapi_hevc.c
@@ -612,6 +612,13 @@  VAProfile ff_vaapi_parse_hevc_rext_scc_profile(AVCodecContext *avctx)
         av_log(avctx, AV_LOG_VERBOSE, "HEVC profile %s is found.\n", profile->name);
     }
 
+#if VA_CHECK_VERSION(0, 37, 0)
+    if (!strcmp(profile->name, "Main Intra"))
+        return VAProfileHEVCMain;
+    else if (!strcmp(profile->name, "Main 10 Intra"))
+        return VAProfileHEVCMain10;
+#endif
+
 #if VA_CHECK_VERSION(1, 2, 0)
     if (!strcmp(profile->name, "Main 12") ||
         !strcmp(profile->name, "Main 12 Intra"))