libavcodec/qsvenc_av1: Add max_frame_size support to av1_qsv encoder

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
pull/388/head
Wenbin Chen 2 years ago committed by Haihao Xiang
parent c8e73558fe
commit 13d04e30d7
  1. 5
      doc/encoders.texi
  2. 3
      libavcodec/qsvenc.c
  3. 1
      libavcodec/qsvenc_av1.c

@ -3855,6 +3855,11 @@ Depth of look ahead in number frames, available when extbrc option is enabled.
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
@item max_frame_size
Set the allowed max size in bytes for each frame. If the frame size exceeds
the limitation, encoder will adjust the QP value to control the frame size.
Invalid in CQP rate control mode.
@end table
@section snow

@ -538,6 +538,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));
av_log(avctx, AV_LOG_VERBOSE, "MaxFrameSize: %d;\n", co2->MaxFrameSize);
}
#endif
@ -1034,6 +1035,8 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q)
q->extco2.AdaptiveI = q->adaptive_i ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF;
if (q->adaptive_b >= 0)
q->extco2.AdaptiveB = q->adaptive_b ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF;
if (q->max_frame_size >= 0)
q->extco2.MaxFrameSize = q->max_frame_size;
q->extco2.Header.BufferId = MFX_EXTBUFF_CODING_OPTION2;
q->extco2.Header.BufferSz = sizeof(q->extco2);

@ -111,6 +111,7 @@ static const AVOption options[] = {
QSV_OPTION_ADAPTIVE_B
QSV_OPTION_EXTBRC
QSV_OPTION_LOW_DELAY_BRC
QSV_OPTION_MAX_FRAME_SIZE
{ "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" },

Loading…
Cancel
Save