[FFmpeg-devel] [PATCH 1/2] libavcodec/qsvenc_av1: Add low_delay_brc support to av1_qsv encoder

Xiang, Haihao haihao.xiang at intel.com
Tue Jan 3 03:08:35 EET 2023


On Ma, 2022-12-26 at 14:02 +0800, wenbin.chen-at-intel.com at ffmpeg.org wrote:
> From: Wenbin Chen <wenbin.chen at intel.com>
> 
> Signed-off-by: Wenbin Chen <wenbin.chen at intel.com>
> ---
>  doc/encoders.texi       | 5 +++++
>  libavcodec/qsvenc.c     | 4 ++++
>  libavcodec/qsvenc_av1.c | 1 +
>  3 files changed, 10 insertions(+)
> 
> diff --git a/doc/encoders.texi b/doc/encoders.texi
> index b8051cda3f..543b5e26a9 100644
> --- a/doc/encoders.texi
> +++ b/doc/encoders.texi
> @@ -3850,6 +3850,11 @@ Extended bitrate control.
>  
>  @item @var{look_ahead_depth}
>  Depth of look ahead in number frames, available when extbrc option is
> enabled.
> +
> + at item @var{low_delay_brc}
> +Setting this flag turns on or off LowDelayBRC feautre in qsv plugin, which
> provides
> +more accurate bitrate control to minimize the variance of bitstream size
> frame
> +by frame. Value: -1-default 0-off 1-on
>  @end table
>  
>  @section snow
> diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
> index 514a1e8148..f5c6a164bb 100644
> --- a/libavcodec/qsvenc.c
> +++ b/libavcodec/qsvenc.c
> @@ -537,6 +537,7 @@ static void dump_video_av1_param(AVCodecContext *avctx,
> QSVEncContext *q,
>  
>      av_log(avctx, AV_LOG_VERBOSE, "WriteIVFHeaders: %s \n",
>             print_threestate(av1_bs_param->WriteIVFHeaders));
> +    av_log(avctx, AV_LOG_VERBOSE, "LowDelayBRC: %s\n", print_threestate(co3-
> >LowDelayBRC));
>  }
>  #endif
>  
> @@ -1090,6 +1091,9 @@ static int init_video_param(AVCodecContext *avctx,
> QSVEncContext *q)
>                  q->extco3.MaxFrameSizeP = q->max_frame_size_p;
>  
>              q->extco3.ScenarioInfo = q->scenario;
> +        } else if (avctx->codec_id == AV_CODEC_ID_AV1) {
> +            if (q->low_delay_brc >= 0)
> +                q->extco3.LowDelayBRC = q->low_delay_brc ?
> MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF;
>          }
>  
>          if (avctx->codec_id == AV_CODEC_ID_HEVC) {
> diff --git a/libavcodec/qsvenc_av1.c b/libavcodec/qsvenc_av1.c
> index bb9ad16927..1e7801fefe 100644
> --- a/libavcodec/qsvenc_av1.c
> +++ b/libavcodec/qsvenc_av1.c
> @@ -110,6 +110,7 @@ static const AVOption options[] = {
>      QSV_OPTION_ADAPTIVE_I
>      QSV_OPTION_ADAPTIVE_B
>      QSV_OPTION_EXTBRC
> +    QSV_OPTION_LOW_DELAY_BRC
>      { "profile", NULL, OFFSET(qsv.profile), AV_OPT_TYPE_INT, { .i64 =
> MFX_PROFILE_UNKNOWN }, 0, INT_MAX, VE, "profile" },
>          { "unknown" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 =
> MFX_PROFILE_UNKNOWN      }, INT_MIN, INT_MAX,     VE, "profile" },
>          { "main"    , NULL, 0, AV_OPT_TYPE_CONST, { .i64 =
> MFX_PROFILE_AV1_MAIN     }, INT_MIN, INT_MAX,     VE, "profile" },

Patchset LGTM, will apply, 

-Haihao 


More information about the ffmpeg-devel mailing list