diff mbox series

[FFmpeg-devel,v3,1/2] lavc/vaapi_encode_h265: Map HEVC AV REXT profile to VA REXT profile

Message ID 20240318042111.21983-1-fei.w.wang@intel.com
State New
Headers show
Series [FFmpeg-devel,v3,1/2] lavc/vaapi_encode_h265: Map HEVC AV REXT profile to VA REXT profile | 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

Wang, Fei W March 18, 2024, 4:21 a.m. UTC
From: Fei Wang <fei.w.wang@intel.com>

There is no Main8/10 profile defined in HEVC REXT profiles. Use Main12
which is compatible with 8/10bit.

Signed-off-by: Fei Wang <fei.w.wang@intel.com>
---
 libavcodec/vaapi_encode_h265.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Mark Thompson March 18, 2024, 9:11 p.m. UTC | #1
On 18/03/2024 04:21, fei.w.wang-at-intel.com@ffmpeg.org wrote:
> From: Fei Wang <fei.w.wang@intel.com>
> 
> There is no Main8/10 profile defined in HEVC REXT profiles. Use Main12
> which is compatible with 8/10bit.
> 
> Signed-off-by: Fei Wang <fei.w.wang@intel.com>
> ---
>   libavcodec/vaapi_encode_h265.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/vaapi_encode_h265.c b/libavcodec/vaapi_encode_h265.c
> index c4aabbf5ed..43755e2188 100644
> --- a/libavcodec/vaapi_encode_h265.c
> +++ b/libavcodec/vaapi_encode_h265.c
> @@ -1305,12 +1305,12 @@ static av_cold int vaapi_encode_h265_configure(AVCodecContext *avctx)
>   
>   static const VAAPIEncodeProfile vaapi_encode_h265_profiles[] = {
>       { AV_PROFILE_HEVC_MAIN,     8, 3, 1, 1, VAProfileHEVCMain       },
> -    { AV_PROFILE_HEVC_REXT,     8, 3, 1, 1, VAProfileHEVCMain       },
>   #if VA_CHECK_VERSION(0, 37, 0)
>       { AV_PROFILE_HEVC_MAIN_10, 10, 3, 1, 1, VAProfileHEVCMain10     },
> -    { AV_PROFILE_HEVC_REXT,    10, 3, 1, 1, VAProfileHEVCMain10     },
>   #endif
>   #if VA_CHECK_VERSION(1, 2, 0)
> +    { AV_PROFILE_HEVC_REXT,     8, 3, 1, 1, VAProfileHEVCMain12 },
> +    { AV_PROFILE_HEVC_REXT,    10, 3, 1, 1, VAProfileHEVCMain12 },
>       { AV_PROFILE_HEVC_REXT,    12, 3, 1, 1, VAProfileHEVCMain12 },
>       { AV_PROFILE_HEVC_REXT,     8, 3, 1, 0, VAProfileHEVCMain422_10 },
>       { AV_PROFILE_HEVC_REXT,    10, 3, 1, 0, VAProfileHEVCMain422_10 },

What are you actually trying to do here?

See 61aea246627787e80edd1f2eae01df63688dda68: these allow support for the Main Intra and Main 10 Intra profiles using Main and Main 10 encoders respectively (since they need not use any additional rext features).

Changing this to require a Main 12 encoder and marking the streams as requiring such a Main 12 decoder to decode when they don't does not seem helpful.

Thanks,

- Mark
Wang, Fei W March 20, 2024, 7:39 a.m. UTC | #2
On Mon, 2024-03-18 at 21:11 +0000, Mark Thompson wrote:
> On 18/03/2024 04:21, fei.w.wang-at-intel.com@ffmpeg.org wrote:
> > From: Fei Wang <fei.w.wang@intel.com>
> > 
> > There is no Main8/10 profile defined in HEVC REXT profiles. Use
> > Main12
> > which is compatible with 8/10bit.
> > 
> > Signed-off-by: Fei Wang <fei.w.wang@intel.com>
> > ---
> >   libavcodec/vaapi_encode_h265.c | 4 ++--
> >   1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/libavcodec/vaapi_encode_h265.c
> > b/libavcodec/vaapi_encode_h265.c
> > index c4aabbf5ed..43755e2188 100644
> > --- a/libavcodec/vaapi_encode_h265.c
> > +++ b/libavcodec/vaapi_encode_h265.c
> > @@ -1305,12 +1305,12 @@ static av_cold int
> > vaapi_encode_h265_configure(AVCodecContext *avctx)
> >   
> >   static const VAAPIEncodeProfile vaapi_encode_h265_profiles[] = {
> >       { AV_PROFILE_HEVC_MAIN,     8, 3, 1, 1,
> > VAProfileHEVCMain       },
> > -    { AV_PROFILE_HEVC_REXT,     8, 3, 1, 1,
> > VAProfileHEVCMain       },
> >   #if VA_CHECK_VERSION(0, 37, 0)
> >       { AV_PROFILE_HEVC_MAIN_10, 10, 3, 1, 1,
> > VAProfileHEVCMain10     },
> > -    { AV_PROFILE_HEVC_REXT,    10, 3, 1, 1,
> > VAProfileHEVCMain10     },
> >   #endif
> >   #if VA_CHECK_VERSION(1, 2, 0)
> > +    { AV_PROFILE_HEVC_REXT,     8, 3, 1, 1, VAProfileHEVCMain12 },
> > +    { AV_PROFILE_HEVC_REXT,    10, 3, 1, 1, VAProfileHEVCMain12 },
> >       { AV_PROFILE_HEVC_REXT,    12, 3, 1, 1, VAProfileHEVCMain12
> > },
> >       { AV_PROFILE_HEVC_REXT,     8, 3, 1, 0,
> > VAProfileHEVCMain422_10 },
> >       { AV_PROFILE_HEVC_REXT,    10, 3, 1, 0,
> > VAProfileHEVCMain422_10 },
> 
> What are you actually trying to do here?
> 
> See 61aea246627787e80edd1f2eae01df63688dda68: these allow support for
> the Main Intra and Main 10 Intra profiles using Main and Main 10
> encoders respectively (since they need not use any additional rext
> features).

The hack blocks 420 8/10bit with inter frames to use REXT. Make them to
use VAProfileHEVCMain12 should be the best way, just like 422 8/10bit
all use VAProfileHEVCMain422_10.

Thanks
Fei
> 
> Changing this to require a Main 12 encoder and marking the streams as
> requiring such a Main 12 decoder to decode when they don't does not
> seem helpful.
> 
> 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".
Xiang, Haihao April 15, 2024, 1:21 a.m. UTC | #3
On Ma, 2024-03-18 at 12:21 +0800, fei.w.wang-at-intel.com@ffmpeg.org wrote:
> From: Fei Wang <fei.w.wang@intel.com>
> 
> There is no Main8/10 profile defined in HEVC REXT profiles. Use Main12
> which is compatible with 8/10bit.
> 
> Signed-off-by: Fei Wang <fei.w.wang@intel.com>
> ---
>  libavcodec/vaapi_encode_h265.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/vaapi_encode_h265.c b/libavcodec/vaapi_encode_h265.c
> index c4aabbf5ed..43755e2188 100644
> --- a/libavcodec/vaapi_encode_h265.c
> +++ b/libavcodec/vaapi_encode_h265.c
> @@ -1305,12 +1305,12 @@ static av_cold int
> vaapi_encode_h265_configure(AVCodecContext *avctx)
>  
>  static const VAAPIEncodeProfile vaapi_encode_h265_profiles[] = {
>      { AV_PROFILE_HEVC_MAIN,     8, 3, 1, 1, VAProfileHEVCMain       },
> -    { AV_PROFILE_HEVC_REXT,     8, 3, 1, 1, VAProfileHEVCMain       },
>  #if VA_CHECK_VERSION(0, 37, 0)
>      { AV_PROFILE_HEVC_MAIN_10, 10, 3, 1, 1, VAProfileHEVCMain10     },
> -    { AV_PROFILE_HEVC_REXT,    10, 3, 1, 1, VAProfileHEVCMain10     },
>  #endif
>  #if VA_CHECK_VERSION(1, 2, 0)
> +    { AV_PROFILE_HEVC_REXT,     8, 3, 1, 1, VAProfileHEVCMain12 },
> +    { AV_PROFILE_HEVC_REXT,    10, 3, 1, 1, VAProfileHEVCMain12 },
>      { AV_PROFILE_HEVC_REXT,    12, 3, 1, 1, VAProfileHEVCMain12 },
>      { AV_PROFILE_HEVC_REXT,     8, 3, 1, 0, VAProfileHEVCMain422_10 },
>      { AV_PROFILE_HEVC_REXT,    10, 3, 1, 0, VAProfileHEVCMain422_10 },

Patchset LGTM, I'll push it if there are no comments.

Thanks
Haihao
Mark Thompson April 15, 2024, 10:07 p.m. UTC | #4
On 15/04/2024 02:21, Xiang, Haihao wrote:
> On Ma, 2024-03-18 at 12:21 +0800, fei.w.wang-at-intel.com@ffmpeg.org wrote:
>> From: Fei Wang <fei.w.wang@intel.com>
>>
>> There is no Main8/10 profile defined in HEVC REXT profiles. Use Main12
>> which is compatible with 8/10bit.
>>
>> Signed-off-by: Fei Wang <fei.w.wang@intel.com>
>> ---
>>  libavcodec/vaapi_encode_h265.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/libavcodec/vaapi_encode_h265.c b/libavcodec/vaapi_encode_h265.c
>> index c4aabbf5ed..43755e2188 100644
>> --- a/libavcodec/vaapi_encode_h265.c
>> +++ b/libavcodec/vaapi_encode_h265.c
>> @@ -1305,12 +1305,12 @@ static av_cold int
>> vaapi_encode_h265_configure(AVCodecContext *avctx)
>>  
>>  static const VAAPIEncodeProfile vaapi_encode_h265_profiles[] = {
>>      { AV_PROFILE_HEVC_MAIN,     8, 3, 1, 1, VAProfileHEVCMain       },
>> -    { AV_PROFILE_HEVC_REXT,     8, 3, 1, 1, VAProfileHEVCMain       },
>>  #if VA_CHECK_VERSION(0, 37, 0)
>>      { AV_PROFILE_HEVC_MAIN_10, 10, 3, 1, 1, VAProfileHEVCMain10     },
>> -    { AV_PROFILE_HEVC_REXT,    10, 3, 1, 1, VAProfileHEVCMain10     },
>>  #endif
>>  #if VA_CHECK_VERSION(1, 2, 0)
>> +    { AV_PROFILE_HEVC_REXT,     8, 3, 1, 1, VAProfileHEVCMain12 },
>> +    { AV_PROFILE_HEVC_REXT,    10, 3, 1, 1, VAProfileHEVCMain12 },
>>      { AV_PROFILE_HEVC_REXT,    12, 3, 1, 1, VAProfileHEVCMain12 },
>>      { AV_PROFILE_HEVC_REXT,     8, 3, 1, 0, VAProfileHEVCMain422_10 },
>>      { AV_PROFILE_HEVC_REXT,    10, 3, 1, 0, VAProfileHEVCMain422_10 },
> 
> Patchset LGTM, I'll push it if there are no comments.

Why is this change helpful?

We don't use the rext features allowed in these cases (unlike in the decoder where we have to support them), so Main / Main 10 encoders will be able to produce a compatible stream without pointlessly requiring Main 12 support which many devices do not have.

Thanks,

- Mark
Wang, Fei W April 16, 2024, 4:57 a.m. UTC | #5
On Mon, 2024-04-15 at 23:07 +0100, Mark Thompson wrote:
> On 15/04/2024 02:21, Xiang, Haihao wrote:
> > On Ma, 2024-03-18 at 12:21 +0800, 
> > fei.w.wang-at-intel.com@ffmpeg.org wrote:
> > > From: Fei Wang <fei.w.wang@intel.com>
> > > 
> > > There is no Main8/10 profile defined in HEVC REXT profiles. Use
> > > Main12
> > > which is compatible with 8/10bit.
> > > 
> > > Signed-off-by: Fei Wang <fei.w.wang@intel.com>
> > > ---
> > >  libavcodec/vaapi_encode_h265.c | 4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/libavcodec/vaapi_encode_h265.c
> > > b/libavcodec/vaapi_encode_h265.c
> > > index c4aabbf5ed..43755e2188 100644
> > > --- a/libavcodec/vaapi_encode_h265.c
> > > +++ b/libavcodec/vaapi_encode_h265.c
> > > @@ -1305,12 +1305,12 @@ static av_cold int
> > > vaapi_encode_h265_configure(AVCodecContext *avctx)
> > >  
> > >  static const VAAPIEncodeProfile vaapi_encode_h265_profiles[] = {
> > >      { AV_PROFILE_HEVC_MAIN,     8, 3, 1, 1,
> > > VAProfileHEVCMain       },
> > > -    { AV_PROFILE_HEVC_REXT,     8, 3, 1, 1,
> > > VAProfileHEVCMain       },
> > >  #if VA_CHECK_VERSION(0, 37, 0)
> > >      { AV_PROFILE_HEVC_MAIN_10, 10, 3, 1, 1,
> > > VAProfileHEVCMain10     },
> > > -    { AV_PROFILE_HEVC_REXT,    10, 3, 1, 1,
> > > VAProfileHEVCMain10     },
> > >  #endif
> > >  #if VA_CHECK_VERSION(1, 2, 0)
> > > +    { AV_PROFILE_HEVC_REXT,     8, 3, 1, 1, VAProfileHEVCMain12
> > > },
> > > +    { AV_PROFILE_HEVC_REXT,    10, 3, 1, 1, VAProfileHEVCMain12
> > > },
> > >      { AV_PROFILE_HEVC_REXT,    12, 3, 1, 1, VAProfileHEVCMain12
> > > },
> > >      { AV_PROFILE_HEVC_REXT,     8, 3, 1, 0,
> > > VAProfileHEVCMain422_10 },
> > >      { AV_PROFILE_HEVC_REXT,    10, 3, 1, 0,
> > > VAProfileHEVCMain422_10 },
> > 
> > Patchset LGTM, I'll push it if there are no comments.
> 
> Why is this change helpful?

Together with 2/2 fix on the hw support VAAPI main12 decode and encode:

$ ffmpeg -hwaccel vaapi -f lavfi -i testsrc -vf 'format=nv12,hwupload'
-c:v hevc_vaapi -profile:v rext -vframes 30 -y out.mp4

$ ffmpeg -hwaccel vaapi -i out.mp4 -f null -
...
[hevc @ 0x55b4fda0a780] HEVC profile is not found.
[hevc @ 0x55b4fda0a780] No support for codec hevc profile 4.
[hevc @ 0x55b4fda0a780] Failed setup for format vaapi: hwaccel
initialisation returned error.

Same for p010le as input of encoder.

Thanks
Fei
> 
> We don't use the rext features allowed in these cases (unlike in the
> decoder where we have to support them), so Main / Main 10 encoders
> will be able to produce a compatible stream without pointlessly
> requiring Main 12 support which many devices do not have.
> 
> 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".
Wang, Fei W April 18, 2024, 8:21 a.m. UTC | #6
On Tue, 2024-04-16 at 04:57 +0000, Wang, Fei W wrote:
> On Mon, 2024-04-15 at 23:07 +0100, Mark Thompson wrote:
> > On 15/04/2024 02:21, Xiang, Haihao wrote:
> > > On Ma, 2024-03-18 at 12:21 +0800, 
> > > fei.w.wang-at-intel.com@ffmpeg.org wrote:
> > > > From: Fei Wang <fei.w.wang@intel.com>
> > > > 
> > > > There is no Main8/10 profile defined in HEVC REXT profiles. Use
> > > > Main12
> > > > which is compatible with 8/10bit.
> > > > 
> > > > Signed-off-by: Fei Wang <fei.w.wang@intel.com>
> > > > ---
> > > >  libavcodec/vaapi_encode_h265.c | 4 ++--
> > > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > > 
> > > > diff --git a/libavcodec/vaapi_encode_h265.c
> > > > b/libavcodec/vaapi_encode_h265.c
> > > > index c4aabbf5ed..43755e2188 100644
> > > > --- a/libavcodec/vaapi_encode_h265.c
> > > > +++ b/libavcodec/vaapi_encode_h265.c
> > > > @@ -1305,12 +1305,12 @@ static av_cold int
> > > > vaapi_encode_h265_configure(AVCodecContext *avctx)
> > > >  
> > > >  static const VAAPIEncodeProfile vaapi_encode_h265_profiles[] =
> > > > {
> > > >      { AV_PROFILE_HEVC_MAIN,     8, 3, 1, 1,
> > > > VAProfileHEVCMain       },
> > > > -    { AV_PROFILE_HEVC_REXT,     8, 3, 1, 1,
> > > > VAProfileHEVCMain       },
> > > >  #if VA_CHECK_VERSION(0, 37, 0)
> > > >      { AV_PROFILE_HEVC_MAIN_10, 10, 3, 1, 1,
> > > > VAProfileHEVCMain10     },
> > > > -    { AV_PROFILE_HEVC_REXT,    10, 3, 1, 1,
> > > > VAProfileHEVCMain10     },
> > > >  #endif
> > > >  #if VA_CHECK_VERSION(1, 2, 0)
> > > > +    { AV_PROFILE_HEVC_REXT,     8, 3, 1, 1,
> > > > VAProfileHEVCMain12
> > > > },
> > > > +    { AV_PROFILE_HEVC_REXT,    10, 3, 1, 1,
> > > > VAProfileHEVCMain12
> > > > },
> > > >      { AV_PROFILE_HEVC_REXT,    12, 3, 1, 1,
> > > > VAProfileHEVCMain12
> > > > },
> > > >      { AV_PROFILE_HEVC_REXT,     8, 3, 1, 0,
> > > > VAProfileHEVCMain422_10 },
> > > >      { AV_PROFILE_HEVC_REXT,    10, 3, 1, 0,
> > > > VAProfileHEVCMain422_10 },
> > > 
> > > Patchset LGTM, I'll push it if there are no comments.
> > 
> > Why is this change helpful?
> 
> Together with 2/2 fix on the hw support VAAPI main12 decode and
> encode:
> 
> $ ffmpeg -hwaccel vaapi -f lavfi -i testsrc -vf
> 'format=nv12,hwupload'
> -c:v hevc_vaapi -profile:v rext -vframes 30 -y out.mp4
> 
> $ ffmpeg -hwaccel vaapi -i out.mp4 -f null -
> ...
> [hevc @ 0x55b4fda0a780] HEVC profile is not found.
> [hevc @ 0x55b4fda0a780] No support for codec hevc profile 4.
> [hevc @ 0x55b4fda0a780] Failed setup for format vaapi: hwaccel
> initialisation returned error.
> 
> Same for p010le as input of encoder.

Hi

Any further comments on this patchset?

Thanks
Fei
> 
> Thanks
> Fei
> > We don't use the rext features allowed in these cases (unlike in
> > the
> > decoder where we have to support them), so Main / Main 10 encoders
> > will be able to produce a compatible stream without pointlessly
> > requiring Main 12 support which many devices do not have.
> > 
> > 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".
> _______________________________________________
> 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 22, 2024, 9:20 p.m. UTC | #7
On 18/04/2024 09:21, Wang, Fei W wrote:
> On Tue, 2024-04-16 at 04:57 +0000, Wang, Fei W wrote:
>> On Mon, 2024-04-15 at 23:07 +0100, Mark Thompson wrote:
>>> Why is this change helpful?
>>
>> Together with 2/2 fix on the hw support VAAPI main12 decode and
>> encode:
>>
>> $ ffmpeg -hwaccel vaapi -f lavfi -i testsrc -vf
>> 'format=nv12,hwupload'
>> -c:v hevc_vaapi -profile:v rext -vframes 30 -y out.mp4
>>
>> $ ffmpeg -hwaccel vaapi -i out.mp4 -f null -
>> ...
>> [hevc @ 0x55b4fda0a780] HEVC profile is not found.
>> [hevc @ 0x55b4fda0a780] No support for codec hevc profile 4.
>> [hevc @ 0x55b4fda0a780] Failed setup for format vaapi: hwaccel
>> initialisation returned error.
>>
>> Same for p010le as input of encoder.
> 
> Hi
> 
> Any further comments on this patchset?

I think it is better to fix this by removing the fake constraints on the decoder rather than by adding extra constraints to the encoder.

See patchset following.

Thanks,

- Mark
diff mbox series

Patch

diff --git a/libavcodec/vaapi_encode_h265.c b/libavcodec/vaapi_encode_h265.c
index c4aabbf5ed..43755e2188 100644
--- a/libavcodec/vaapi_encode_h265.c
+++ b/libavcodec/vaapi_encode_h265.c
@@ -1305,12 +1305,12 @@  static av_cold int vaapi_encode_h265_configure(AVCodecContext *avctx)
 
 static const VAAPIEncodeProfile vaapi_encode_h265_profiles[] = {
     { AV_PROFILE_HEVC_MAIN,     8, 3, 1, 1, VAProfileHEVCMain       },
-    { AV_PROFILE_HEVC_REXT,     8, 3, 1, 1, VAProfileHEVCMain       },
 #if VA_CHECK_VERSION(0, 37, 0)
     { AV_PROFILE_HEVC_MAIN_10, 10, 3, 1, 1, VAProfileHEVCMain10     },
-    { AV_PROFILE_HEVC_REXT,    10, 3, 1, 1, VAProfileHEVCMain10     },
 #endif
 #if VA_CHECK_VERSION(1, 2, 0)
+    { AV_PROFILE_HEVC_REXT,     8, 3, 1, 1, VAProfileHEVCMain12 },
+    { AV_PROFILE_HEVC_REXT,    10, 3, 1, 1, VAProfileHEVCMain12 },
     { AV_PROFILE_HEVC_REXT,    12, 3, 1, 1, VAProfileHEVCMain12 },
     { AV_PROFILE_HEVC_REXT,     8, 3, 1, 0, VAProfileHEVCMain422_10 },
     { AV_PROFILE_HEVC_REXT,    10, 3, 1, 0, VAProfileHEVCMain422_10 },