[FFmpeg-devel] [PATCH v2 7/7] lavc/qsvenc: add an option to set MB numbers of each slice

Mark Thompson sw at jkqxz.net
Mon Nov 5 20:20:13 EET 2018


On 05/11/18 12:15, Zhong Li wrote:
> This option specifies suggested macroblocks numbers in each slice.
> MSDK may adjust it based on platform capability.
> And slice_number will be ignored if this option set to a non-zero
> value.
> 
> Signed-off-by: Zhong Li <zhong.li at intel.com>
> ---
>  libavcodec/qsvenc.c      | 1 +
>  libavcodec/qsvenc.h      | 1 +
>  libavcodec/qsvenc_h264.c | 1 +
>  3 files changed, 3 insertions(+)
> 
> diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
> index 7d74068..1797279 100644
> --- a/libavcodec/qsvenc.c
> +++ b/libavcodec/qsvenc.c
> @@ -655,6 +655,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
>  #if QSV_VERSION_ATLEAST(1, 8)
>              q->extco2.LookAheadDS = q->look_ahead_downsampling;
>              q->extco2.RepeatPPS   = q->repeat_pps ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF;
> +            q->extco2.NumMbPerSlice = q->num_mb_per_slice;
>  
>  #if FF_API_PRIVATE_OPT
>  FF_DISABLE_DEPRECATION_WARNINGS
> diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h
> index 4316a10..c2aa88e 100644
> --- a/libavcodec/qsvenc.h
> +++ b/libavcodec/qsvenc.h
> @@ -163,6 +163,7 @@ typedef struct QSVEncContext {
>      int recovery_point_sei;
>  
>      int repeat_pps;
> +    int num_mb_per_slice;
>  
>      int a53_cc;
>  
> diff --git a/libavcodec/qsvenc_h264.c b/libavcodec/qsvenc_h264.c
> index 13217b4..693a9e3 100644
> --- a/libavcodec/qsvenc_h264.c
> +++ b/libavcodec/qsvenc_h264.c
> @@ -156,6 +156,7 @@ static const AVOption options[] = {
>  #endif
>  
>      { "repeat_pps", "repeat pps for every frame", OFFSET(qsv.repeat_pps), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
> +    { "num_mb_per_slice","Suggested macroblocks numbers of each slice", OFFSET(qsv.num_mb_per_slice), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE },
>  
>      { NULL },
>  };
> 

>From the point of view of just passing in opaque magic options, sure.

Still, I feel like this option wants a bit more explanation somewhere.  How does it interact with the normal -slices option?  If it's just a suggestion, can the library ignore it?

- Mark


More information about the ffmpeg-devel mailing list