libavcodec/qsvenc: Add pic_timing_sei reset support to qsv

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
pull/388/head
Wenbin Chen 2 years ago committed by Haihao Xiang
parent 29a3ba8693
commit 3771d54989
  1. 4
      doc/encoders.texi
  2. 21
      libavcodec/qsvenc.c
  3. 2
      libavcodec/qsvenc.h

@ -3371,6 +3371,10 @@ Change this value to reset qsv codec's framerate configuration.
@item @var{rc_initial_buffer_occupancy}
@item @var{rc_max_rate}
Change these value to reset qsv codec's bitrate control configuration.
@item @var{pic_timing_sei}
Supported in h264_qsv and hevc_qsv.
Change this value to reset qsv codec's pic_timing_sei configuration.
@end table
@subsection H264 options

@ -784,6 +784,7 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q)
q->extco.PicTimingSEI = q->pic_timing_sei ?
MFX_CODINGOPTION_ON : MFX_CODINGOPTION_UNKNOWN;
q->old_pic_timing_sei = q->pic_timing_sei;
if (q->rdo >= 0)
q->extco.RateDistortionOpt = q->rdo > 0 ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF;
@ -1900,6 +1901,25 @@ static int update_bitrate(AVCodecContext *avctx, QSVEncContext *q)
return updated;
}
static int update_pic_timing_sei(AVCodecContext *avctx, QSVEncContext *q)
{
int updated = 0;
if (avctx->codec_id != AV_CODEC_ID_H264 && avctx->codec_id != AV_CODEC_ID_HEVC)
return 0;
UPDATE_PARAM(q->old_pic_timing_sei, q->pic_timing_sei);
if (!updated)
return 0;
q->extco.PicTimingSEI = q->pic_timing_sei ?
MFX_CODINGOPTION_ON : MFX_CODINGOPTION_UNKNOWN;
av_log(avctx, AV_LOG_DEBUG, "Reset PicTimingSEI: %s\n",
print_threestate(q->extco.PicTimingSEI));
return updated;
}
static int update_parameters(AVCodecContext *avctx, QSVEncContext *q,
const AVFrame *frame)
{
@ -1915,6 +1935,7 @@ static int update_parameters(AVCodecContext *avctx, QSVEncContext *q,
needReset |= update_low_delay_brc(avctx, q);
needReset |= update_frame_rate(avctx, q);
needReset |= update_bitrate(avctx, q);
needReset |= update_pic_timing_sei(avctx, q);
ret = update_min_max_qp(avctx, q);
if (ret < 0)
return ret;

@ -278,6 +278,8 @@ typedef struct QSVEncContext {
int old_rc_buffer_size;
int old_rc_initial_buffer_occupancy;
int old_rc_max_rate;
// This is used for SEI Timing reset
int old_pic_timing_sei;
} QSVEncContext;
int ff_qsv_enc_init(AVCodecContext *avctx, QSVEncContext *q);

Loading…
Cancel
Save