mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-02-07 23:32:33 +00:00
libavcodec/qsvenc: Add pic_timing_sei reset support to qsv
Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
This commit is contained in:
parent
29a3ba8693
commit
3771d54989
@ -3371,6 +3371,10 @@ Change this value to reset qsv codec's framerate configuration.
|
|||||||
@item @var{rc_initial_buffer_occupancy}
|
@item @var{rc_initial_buffer_occupancy}
|
||||||
@item @var{rc_max_rate}
|
@item @var{rc_max_rate}
|
||||||
Change these value to reset qsv codec's bitrate control configuration.
|
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
|
@end table
|
||||||
|
|
||||||
@subsection H264 options
|
@subsection H264 options
|
||||||
|
@ -784,6 +784,7 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q)
|
|||||||
|
|
||||||
q->extco.PicTimingSEI = q->pic_timing_sei ?
|
q->extco.PicTimingSEI = q->pic_timing_sei ?
|
||||||
MFX_CODINGOPTION_ON : MFX_CODINGOPTION_UNKNOWN;
|
MFX_CODINGOPTION_ON : MFX_CODINGOPTION_UNKNOWN;
|
||||||
|
q->old_pic_timing_sei = q->pic_timing_sei;
|
||||||
|
|
||||||
if (q->rdo >= 0)
|
if (q->rdo >= 0)
|
||||||
q->extco.RateDistortionOpt = q->rdo > 0 ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF;
|
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;
|
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,
|
static int update_parameters(AVCodecContext *avctx, QSVEncContext *q,
|
||||||
const AVFrame *frame)
|
const AVFrame *frame)
|
||||||
{
|
{
|
||||||
@ -1915,6 +1935,7 @@ static int update_parameters(AVCodecContext *avctx, QSVEncContext *q,
|
|||||||
needReset |= update_low_delay_brc(avctx, q);
|
needReset |= update_low_delay_brc(avctx, q);
|
||||||
needReset |= update_frame_rate(avctx, q);
|
needReset |= update_frame_rate(avctx, q);
|
||||||
needReset |= update_bitrate(avctx, q);
|
needReset |= update_bitrate(avctx, q);
|
||||||
|
needReset |= update_pic_timing_sei(avctx, q);
|
||||||
ret = update_min_max_qp(avctx, q);
|
ret = update_min_max_qp(avctx, q);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -278,6 +278,8 @@ typedef struct QSVEncContext {
|
|||||||
int old_rc_buffer_size;
|
int old_rc_buffer_size;
|
||||||
int old_rc_initial_buffer_occupancy;
|
int old_rc_initial_buffer_occupancy;
|
||||||
int old_rc_max_rate;
|
int old_rc_max_rate;
|
||||||
|
// This is used for SEI Timing reset
|
||||||
|
int old_pic_timing_sei;
|
||||||
} QSVEncContext;
|
} QSVEncContext;
|
||||||
|
|
||||||
int ff_qsv_enc_init(AVCodecContext *avctx, QSVEncContext *q);
|
int ff_qsv_enc_init(AVCodecContext *avctx, QSVEncContext *q);
|
||||||
|
Loading…
Reference in New Issue
Block a user