summaryrefslogtreecommitdiff
path: root/libavcodec/qsvenc.c
diff options
context:
space:
mode:
authorWenbin Chen <wenbin.chen@intel.com>2022-11-24 10:47:29 +0800
committerHaihao Xiang <haihao.xiang@intel.com>2022-12-01 09:37:35 +0800
commit47fff1eda155c30fc77cae74f40e71d4203c5043 (patch)
treed4cce14a703a92e17448d9fe0440398ec0237c9d /libavcodec/qsvenc.c
parent71cded6aa3c8b572e575f3d88b5c9d9094fa735d (diff)
downloadffmpeg-47fff1eda155c30fc77cae74f40e71d4203c5043.tar.gz
libavcodec/qsvenc.c: Enable MFX_GOP_STRICT when adpative gop is disabled
adaptive_i and adaptive_b cannot work with MFX_GOP_STRICT, so only enable MFX_GOP_STRICT when these features are disabled. Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Diffstat (limited to 'libavcodec/qsvenc.c')
-rw-r--r--libavcodec/qsvenc.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index d5e9f2d420..514a1e8148 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -644,6 +644,12 @@ static int check_enc_param(AVCodecContext *avctx, QSVEncContext *q)
return 1;
}
+static int is_strict_gop(QSVEncContext *q) {
+ if (q->adaptive_b == 0 && q->adaptive_i == 0)
+ return 1;
+ return 0;
+}
+
static int init_video_param_jpeg(AVCodecContext *avctx, QSVEncContext *q)
{
enum AVPixelFormat sw_format = avctx->pix_fmt == AV_PIX_FMT_QSV ?
@@ -755,7 +761,8 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q)
q->old_gop_size = avctx->gop_size;
q->param.mfx.GopRefDist = FFMAX(-1, avctx->max_b_frames) + 1;
q->param.mfx.GopOptFlag = avctx->flags & AV_CODEC_FLAG_CLOSED_GOP ?
- MFX_GOP_CLOSED : MFX_GOP_STRICT;
+ MFX_GOP_CLOSED : is_strict_gop(q) ?
+ MFX_GOP_STRICT : 0;
q->param.mfx.IdrInterval = q->idr_interval;
q->param.mfx.NumSlice = avctx->slices;
q->param.mfx.NumRefFrame = FFMAX(0, avctx->refs);