diff options
author | nyanmisaka <nst799610810@gmail.com> | 2022-11-02 01:58:06 +0800 |
---|---|---|
committer | Haihao Xiang <haihao.xiang@intel.com> | 2022-11-07 10:57:12 +0800 |
commit | 09775cfea7def7a7ba8f0f179c75cec05fbbb8b0 (patch) | |
tree | ae33e2e9b1c4b32186bb2222a7195b19d067a142 /libavcodec | |
parent | e137d197b54a3accfae27d7458f1ee80491cfa7e (diff) | |
download | ffmpeg-09775cfea7def7a7ba8f0f179c75cec05fbbb8b0.tar.gz |
libavcodec/qsvenc_hevc: add tier option
Without this change, MSDK/VPL always defaults the HEVC tier to MAIN if the -level is specified.
Also, according to the HEVC specs, only level >= 4 can support High Tier.
Signed-off-by: nyanmisaka <nst799610810@gmail.com>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/qsvenc.c | 5 | ||||
-rw-r--r-- | libavcodec/qsvenc.h | 1 | ||||
-rw-r--r-- | libavcodec/qsvenc_hevc.c | 3 |
3 files changed, 8 insertions, 1 deletions
diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index 0db774ea63..f15ab15e9b 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -709,8 +709,11 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q) return AVERROR_BUG; q->param.mfx.CodecId = ret; - if (avctx->level > 0) + if (avctx->level > 0) { q->param.mfx.CodecLevel = avctx->level; + if (avctx->codec_id == AV_CODEC_ID_HEVC && avctx->level >= MFX_LEVEL_HEVC_4) + q->param.mfx.CodecLevel |= q->tier; + } if (avctx->compression_level == FF_COMPRESSION_DEFAULT) { avctx->compression_level = q->preset; diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h index eb79db9871..8ed230b10f 100644 --- a/libavcodec/qsvenc.h +++ b/libavcodec/qsvenc.h @@ -185,6 +185,7 @@ typedef struct QSVEncContext { int async_depth; int idr_interval; int profile; + int tier; int preset; int avbr_accuracy; int avbr_convergence; diff --git a/libavcodec/qsvenc_hevc.c b/libavcodec/qsvenc_hevc.c index 28d2cfcae1..7a2bb392a7 100644 --- a/libavcodec/qsvenc_hevc.c +++ b/libavcodec/qsvenc_hevc.c @@ -338,6 +338,9 @@ static const AVOption options[] = { #if QSV_VERSION_ATLEAST(1, 32) { "scc", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_PROFILE_HEVC_SCC }, INT_MIN, INT_MAX, VE, "profile" }, #endif + { "tier", "Set the encoding tier (only level >= 4 can support high tier)", OFFSET(qsv.tier), AV_OPT_TYPE_INT, { .i64 = MFX_TIER_HEVC_HIGH }, MFX_TIER_HEVC_MAIN, MFX_TIER_HEVC_HIGH, VE, "tier" }, + { "main", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_TIER_HEVC_MAIN }, INT_MIN, INT_MAX, VE, "tier" }, + { "high", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_TIER_HEVC_HIGH }, INT_MIN, INT_MAX, VE, "tier" }, { "gpb", "1: GPB (generalized P/B frame); 0: regular P frame", OFFSET(qsv.gpb), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, VE}, |