[FFmpeg-devel] vaapi_h265: general_level_idc should times 3.

Submitted by Ruiling Song on Nov. 28, 2017, 7:46 a.m.

Details

Message ID 1511855207-3271-1-git-send-email-ruiling.song@intel.com
State New
Headers show

Commit Message

Ruiling Song Nov. 28, 2017, 7:46 a.m.
Signed-off-by: Ruiling Song <ruiling.song@intel.com>
---
 libavcodec/vaapi_encode_h265.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Zhong Li Nov. 28, 2017, 8:01 a.m.
>  libavcodec/vaapi_encode_h265.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

> 

> diff --git a/libavcodec/vaapi_encode_h265.c

> b/libavcodec/vaapi_encode_h265.c index 3ae92a7..32b8bc6 100644

> --- a/libavcodec/vaapi_encode_h265.c

> +++ b/libavcodec/vaapi_encode_h265.c

> @@ -219,7 +219,7 @@ static int

> vaapi_encode_h265_init_sequence_params(AVCodecContext *avctx)

>          .general_non_packed_constraint_flag = 1,

>          .general_frame_only_constraint_flag = 1,

> 

> -        .general_level_idc     = avctx->level,

> +        .general_level_idc     = avctx->level * 3,


LGTM. 
Actually it is a regression introduced by commit 00179664bccd1dd6fa0d1c40db453528757bf6f7. 

>      };
Mark Thompson Nov. 28, 2017, 10:26 p.m.
On 28/11/17 07:46, Ruiling Song wrote:
> Signed-off-by: Ruiling Song <ruiling.song@intel.com>
> ---
>  libavcodec/vaapi_encode_h265.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/vaapi_encode_h265.c b/libavcodec/vaapi_encode_h265.c
> index 3ae92a7..32b8bc6 100644
> --- a/libavcodec/vaapi_encode_h265.c
> +++ b/libavcodec/vaapi_encode_h265.c
> @@ -219,7 +219,7 @@ static int vaapi_encode_h265_init_sequence_params(AVCodecContext *avctx)
>          .general_non_packed_constraint_flag = 1,
>          .general_frame_only_constraint_flag = 1,
>  
> -        .general_level_idc     = avctx->level,
> +        .general_level_idc     = avctx->level * 3,
>      };
>      vps->profile_tier_level.general_profile_compatibility_flag[avctx->profile & 31] = 1;
>  
> 
The documentation has always said "profile and level set the values of general_profile_idc and general_level_idc respectively" (<http://ffmpeg.org/ffmpeg-codecs.html#VAAPI-encoders>) - the code disagreed for a while, but that was made consistent in 00179664bccd1dd6fa0d1c40db453528757bf6f7.

Why do you want to change it to be general_level_idc / 3 instead?

Thanks,

- Mark
Zhong Li Nov. 29, 2017, 3:51 a.m.
> On 28/11/17 07:46, Ruiling Song wrote:

> > Signed-off-by: Ruiling Song <ruiling.song@intel.com>

> > ---

> >  libavcodec/vaapi_encode_h265.c | 2 +-

> >  1 file changed, 1 insertion(+), 1 deletion(-)

> >

> > diff --git a/libavcodec/vaapi_encode_h265.c

> > b/libavcodec/vaapi_encode_h265.c index 3ae92a7..32b8bc6 100644

> > --- a/libavcodec/vaapi_encode_h265.c

> > +++ b/libavcodec/vaapi_encode_h265.c

> > @@ -219,7 +219,7 @@ static int

> vaapi_encode_h265_init_sequence_params(AVCodecContext *avctx)

> >          .general_non_packed_constraint_flag = 1,

> >          .general_frame_only_constraint_flag = 1,

> >

> > -        .general_level_idc     = avctx->level,

> > +        .general_level_idc     = avctx->level * 3,

> >      };

> >

> > vps->profile_tier_level.general_profile_compatibility_flag[avctx->prof

> > ile & 31] = 1;

> >

> >

> The documentation has always said "profile and level set the values of

> general_profile_idc and general_level_idc respectively"

> (<http://ffmpeg.org/ffmpeg-codecs.html#VAAPI-encoders>) - the code

> disagreed for a while, but that was made consistent in

> 00179664bccd1dd6fa0d1c40db453528757bf6f7.

> 

> Why do you want to change it to be general_level_idc / 3 instead?


As HEVC spec, "general_level_idc and sub_layer_level_idc[ i ] shall be set equal to a value of 30 times the level number specified in
Table A.4."
And use the tool "mediainfo" to check the encoded bitstream, it show the level is 1.7 if set the option "-level" to be 51.

Maybe the documentation ((<http://ffmpeg.org/ffmpeg-codecs.html#VAAPI-encoders>)) also needs to be changed?

Patch hide | download patch | download mbox

diff --git a/libavcodec/vaapi_encode_h265.c b/libavcodec/vaapi_encode_h265.c
index 3ae92a7..32b8bc6 100644
--- a/libavcodec/vaapi_encode_h265.c
+++ b/libavcodec/vaapi_encode_h265.c
@@ -219,7 +219,7 @@  static int vaapi_encode_h265_init_sequence_params(AVCodecContext *avctx)
         .general_non_packed_constraint_flag = 1,
         .general_frame_only_constraint_flag = 1,
 
-        .general_level_idc     = avctx->level,
+        .general_level_idc     = avctx->level * 3,
     };
     vps->profile_tier_level.general_profile_compatibility_flag[avctx->profile & 31] = 1;