summaryrefslogtreecommitdiff
path: root/libavcodec/qsvenc.c
diff options
context:
space:
mode:
authorWenbin Chen <wenbin.chen-at-intel.com@ffmpeg.org>2022-01-25 15:12:37 +0800
committerHaihao Xiang <haihao.xiang@intel.com>2022-01-27 10:26:39 +0800
commite102fd98d6f30d3cd41debafab30d29d5f72117c (patch)
tree8ed307971b930572caffb24a759afbc16f22990c /libavcodec/qsvenc.c
parent2ecc4fde5f01289b4c2b8d58c905a408dbb96d8c (diff)
libavcodec/qsvenc: Add intra refresh to hevc_qsv and add new intra refresh parameter
Add intra refresh support to hevc_qsv as well. Add an new intra refresh type: "horizontal", and an new param ref_cycle_dist. This param specify the distance between the beginnings of the intra-refresh cycles in frames. Signed-off-by: Wenbin Chen <wenbin.chen@intel.com> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
Diffstat (limited to 'libavcodec/qsvenc.c')
-rw-r--r--libavcodec/qsvenc.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index 686dfe6610..84ad056f32 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -364,6 +364,10 @@ static void dump_video_param(AVCodecContext *avctx, QSVEncContext *q,
#if QSV_VERSION_ATLEAST(1, 26)
av_log(avctx, AV_LOG_VERBOSE, "TransformSkip: %s \n", print_threestate(co3->TransformSkip));
#endif
+
+#if QSV_VERSION_ATLEAST(1, 16)
+ av_log(avctx, AV_LOG_VERBOSE, "IntRefCycleDist: %"PRId16"\n", co3->IntRefCycleDist);
+#endif
}
static void dump_video_vp9_param(AVCodecContext *avctx, QSVEncContext *q,
@@ -865,13 +869,6 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q)
#if QSV_HAVE_CO2
if (avctx->codec_id == AV_CODEC_ID_H264) {
- if (q->int_ref_type >= 0)
- q->extco2.IntRefType = q->int_ref_type;
- if (q->int_ref_cycle_size >= 0)
- q->extco2.IntRefCycleSize = q->int_ref_cycle_size;
- if (q->int_ref_qp_delta != INT16_MIN)
- q->extco2.IntRefQPDelta = q->int_ref_qp_delta;
-
if (q->bitrate_limit >= 0)
q->extco2.BitrateLimit = q->bitrate_limit ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF;
if (q->mbbrc >= 0)
@@ -900,6 +897,12 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q)
q->extco2.ExtBRC = q->extbrc ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF;
if (q->max_frame_size >= 0)
q->extco2.MaxFrameSize = q->max_frame_size;
+ if (q->int_ref_type >= 0)
+ q->extco2.IntRefType = q->int_ref_type;
+ if (q->int_ref_cycle_size >= 0)
+ q->extco2.IntRefCycleSize = q->int_ref_cycle_size;
+ if (q->int_ref_qp_delta != INT16_MIN)
+ q->extco2.IntRefQPDelta = q->int_ref_qp_delta;
#if QSV_HAVE_MAX_SLICE_SIZE
if (q->max_slice_size >= 0)
q->extco2.MaxSliceSize = q->max_slice_size;
@@ -974,6 +977,10 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q)
"Please set max_b_frames(-bf) to 0 to enable P-pyramid\n");
}
#endif
+#if QSV_VERSION_ATLEAST(1, 16)
+ if (q->int_ref_cycle_dist >= 0)
+ q->extco3.IntRefCycleDist = q->int_ref_cycle_dist;
+#endif
}
if (avctx->codec_id == AV_CODEC_ID_HEVC) {