This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 6495133363ef86856401310d4dcf854fed4d8e7c Author: Timo Rothenpieler <[email protected]> AuthorDate: Tue Jun 23 23:36:14 2026 +0200 Commit: James Almer <[email protected]> CommitDate: Wed Jun 24 18:51:12 2026 +0000 avcodec/nvenc: remove support for SDK versions older than 11.1 --- configure | 4 +- libavcodec/nvenc.c | 160 +----------------------------------------------- libavcodec/nvenc.h | 36 ----------- libavcodec/nvenc_h264.c | 25 -------- libavcodec/nvenc_hevc.c | 19 ------ 5 files changed, 4 insertions(+), 240 deletions(-) diff --git a/configure b/configure index 2bf25e9755..b992bada96 100755 --- a/configure +++ b/configure @@ -7223,9 +7223,7 @@ if ! disabled ffnvcodec; then ffnv_hdr_list="ffnvcodec/nvEncodeAPI.h ffnvcodec/dynlink_cuda.h ffnvcodec/dynlink_cuviddec.h ffnvcodec/dynlink_nvcuvid.h" check_pkg_config ffnvcodec "ffnvcodec >= 12.1.14.0" "$ffnv_hdr_list" "" || \ check_pkg_config ffnvcodec "ffnvcodec >= 12.0.16.1 ffnvcodec < 12.1" "$ffnv_hdr_list" "" || \ - check_pkg_config ffnvcodec "ffnvcodec >= 11.1.5.3 ffnvcodec < 12.0" "$ffnv_hdr_list" "" || \ - check_pkg_config ffnvcodec "ffnvcodec >= 11.0.10.3 ffnvcodec < 11.1" "$ffnv_hdr_list" "" || \ - check_pkg_config ffnvcodec "ffnvcodec >= 8.1.24.15 ffnvcodec < 8.2" "$ffnv_hdr_list" "" + check_pkg_config ffnvcodec "ffnvcodec >= 11.1.5.3 ffnvcodec < 12.0" "$ffnv_hdr_list" "" fi if enabled_all libglslang libshaderc; then diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index 257b6d3892..5ef0ed572a 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -180,17 +180,14 @@ static int nvenc_map_error(NVENCSTATUS err, const char **desc) static int nvenc_print_error(AVCodecContext *avctx, NVENCSTATUS err, const char *error_string) { + NvencContext *ctx = avctx->priv_data; + NV_ENCODE_API_FUNCTION_LIST *p_nvenc = &ctx->nvenc_dload_funcs.nvenc_funcs; const char *desc; const char *details = "(no details)"; int ret = nvenc_map_error(err, &desc); -#ifdef NVENC_HAVE_GETLASTERRORSTRING - NvencContext *ctx = avctx->priv_data; - NV_ENCODE_API_FUNCTION_LIST *p_nvenc = &ctx->nvenc_dload_funcs.nvenc_funcs; - if (p_nvenc && ctx->nvencoder) details = p_nvenc->nvEncGetLastErrorString(ctx->nvencoder); -#endif av_log(avctx, AV_LOG_ERROR, "%s: %s (%d): %s\n", error_string, desc, err, details); @@ -210,7 +207,6 @@ typedef struct GUIDTuple { static void nvenc_map_preset(NvencContext *ctx) { GUIDTuple presets[] = { -#ifdef NVENC_HAVE_NEW_PRESETS PRESET(P1), PRESET(P2), PRESET(P3), @@ -231,20 +227,6 @@ static void nvenc_map_preset(NvencContext *ctx) PRESET_ALIAS(LOW_LATENCY_HQ, P7, NVENC_DEPRECATED_PRESET | NVENC_LOWLATENCY), PRESET_ALIAS(LOSSLESS_DEFAULT, P4, NVENC_DEPRECATED_PRESET | NVENC_LOSSLESS), PRESET_ALIAS(LOSSLESS_HP, P1, NVENC_DEPRECATED_PRESET | NVENC_LOSSLESS), -#else - PRESET(DEFAULT), - PRESET(HP), - PRESET(HQ), - PRESET(BD), - PRESET_ALIAS(SLOW, HQ, NVENC_TWO_PASSES), - PRESET_ALIAS(MEDIUM, HQ, NVENC_ONE_PASS), - PRESET_ALIAS(FAST, HP, NVENC_ONE_PASS), - PRESET(LOW_LATENCY_DEFAULT, NVENC_LOWLATENCY), - PRESET(LOW_LATENCY_HP, NVENC_LOWLATENCY), - PRESET(LOW_LATENCY_HQ, NVENC_LOWLATENCY), - PRESET(LOSSLESS_DEFAULT, NVENC_LOSSLESS), - PRESET(LOSSLESS_HP, NVENC_LOSSLESS), -#endif }; GUIDTuple *t = &presets[ctx->preset]; @@ -252,10 +234,8 @@ static void nvenc_map_preset(NvencContext *ctx) ctx->init_encode_params.presetGUID = t->guid; ctx->flags = t->flags; -#ifdef NVENC_HAVE_NEW_PRESETS if (ctx->tuning_info == NV_ENC_TUNING_INFO_LOSSLESS) ctx->flags |= NVENC_LOSSLESS; -#endif } #undef PRESET @@ -287,54 +267,12 @@ static void nvenc_print_driver_requirement(AVCodecContext *avctx, int level) # else const char *minver = "520.56.06"; # endif -#elif NVENCAPI_CHECK_VERSION(11, 1) +#else # if defined(_WIN32) || defined(__CYGWIN__) const char *minver = "471.41"; # else const char *minver = "470.57.02"; # endif -#elif NVENCAPI_CHECK_VERSION(11, 0) -# if defined(_WIN32) || defined(__CYGWIN__) - const char *minver = "456.71"; -# else - const char *minver = "455.28"; -# endif -#elif NVENCAPI_CHECK_VERSION(10, 0) -# if defined(_WIN32) || defined(__CYGWIN__) - const char *minver = "450.51"; -# else - const char *minver = "445.87"; -# endif -#elif NVENCAPI_CHECK_VERSION(9, 1) -# if defined(_WIN32) || defined(__CYGWIN__) - const char *minver = "436.15"; -# else - const char *minver = "435.21"; -# endif -#elif NVENCAPI_CHECK_VERSION(9, 0) -# if defined(_WIN32) || defined(__CYGWIN__) - const char *minver = "418.81"; -# else - const char *minver = "418.30"; -# endif -#elif NVENCAPI_CHECK_VERSION(8, 2) -# if defined(_WIN32) || defined(__CYGWIN__) - const char *minver = "397.93"; -# else - const char *minver = "396.24"; -#endif -#elif NVENCAPI_CHECK_VERSION(8, 1) -# if defined(_WIN32) || defined(__CYGWIN__) - const char *minver = "390.77"; -# else - const char *minver = "390.25"; -# endif -#else -# if defined(_WIN32) || defined(__CYGWIN__) - const char *minver = "378.66"; -# else - const char *minver = "378.13"; -# endif #endif av_log(avctx, level, "The minimum required Nvidia driver for nvenc is %s or newer\n", minver); } @@ -588,7 +526,6 @@ static int nvenc_check_capabilities(AVCodecContext *avctx) return AVERROR(ENOSYS); } -#ifdef NVENC_HAVE_BFRAME_REF_MODE tmp = (ctx->b_ref_mode >= 0) ? ctx->b_ref_mode : NV_ENC_BFRAME_REF_MODE_DISABLED; ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_BFRAME_REF_MODE); switch (tmp) { @@ -618,39 +555,18 @@ static int nvenc_check_capabilities(AVCodecContext *avctx) av_log(avctx, AV_LOG_ERROR, "Invalid b_ref_mode value %d\n", tmp); return AVERROR(EINVAL); } -#else - tmp = (ctx->b_ref_mode >= 0) ? ctx->b_ref_mode : 0; - if (tmp > 0) { - av_log(avctx, AV_LOG_WARNING, "B frames as references need SDK 8.1 at build time\n"); - return AVERROR(ENOSYS); - } -#endif -#ifdef NVENC_HAVE_MULTIPLE_REF_FRAMES ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_MULTIPLE_REF_FRAMES); if(avctx->refs != NV_ENC_NUM_REF_FRAMES_AUTOSELECT && ret <= 0) { av_log(avctx, AV_LOG_WARNING, "Multiple reference frames are not supported by the device\n"); return AVERROR(ENOSYS); } -#else - if(avctx->refs != 0) { - av_log(avctx, AV_LOG_WARNING, "Multiple reference frames need SDK 9.1 at build time\n"); - return AVERROR(ENOSYS); - } -#endif -#ifdef NVENC_HAVE_SINGLE_SLICE_INTRA_REFRESH ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SINGLE_SLICE_INTRA_REFRESH); if(ctx->single_slice_intra_refresh && ret <= 0) { av_log(avctx, AV_LOG_WARNING, "Single slice intra refresh not supported by the device\n"); return AVERROR(ENOSYS); } -#else - if(ctx->single_slice_intra_refresh) { - av_log(avctx, AV_LOG_WARNING, "Single slice intra refresh needs SDK 11.1 at build time\n"); - return AVERROR(ENOSYS); - } -#endif ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_INTRA_REFRESH); if((ctx->intra_refresh || ctx->single_slice_intra_refresh) && ret <= 0) { @@ -658,13 +574,6 @@ static int nvenc_check_capabilities(AVCodecContext *avctx) return AVERROR(ENOSYS); } -#ifndef NVENC_HAVE_HEVC_CONSTRAINED_ENCODING - if (ctx->constrained_encoding && avctx->codec->id == AV_CODEC_ID_HEVC) { - av_log(avctx, AV_LOG_WARNING, "HEVC constrained encoding needs SDK 10.0 at build time\n"); - return AVERROR(ENOSYS); - } -#endif - ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_CONSTRAINED_ENCODING); if(ctx->constrained_encoding && ret <= 0) { av_log(avctx, AV_LOG_WARNING, "Constrained encoding not supported by the device\n"); @@ -1130,7 +1039,6 @@ static av_cold int nvenc_setup_rate_control(AVCodecContext *avctx) if (avctx->rc_max_rate > 0) ctx->encode_config.rcParams.maxBitRate = avctx->rc_max_rate; -#ifdef NVENC_HAVE_MULTIPASS ctx->encode_config.rcParams.multiPass = ctx->multipass; if (ctx->flags & NVENC_ONE_PASS) @@ -1147,32 +1055,6 @@ static av_cold int nvenc_setup_rate_control(AVCodecContext *avctx) ctx->rc = NV_ENC_PARAMS_RC_VBR; } } -#else - if (ctx->rc < 0) { - if (ctx->flags & NVENC_ONE_PASS) - ctx->twopass = 0; - if (ctx->flags & NVENC_TWO_PASSES) - ctx->twopass = 1; - - if (ctx->twopass < 0) - ctx->twopass = (ctx->flags & NVENC_LOWLATENCY) != 0; - - if (ctx->cbr) { - if (ctx->twopass) { - ctx->rc = NV_ENC_PARAMS_RC_CBR_LOWDELAY_HQ; - } else { - ctx->rc = NV_ENC_PARAMS_RC_CBR; - } - } else if (ctx->cqp >= 0) { - ctx->rc = NV_ENC_PARAMS_RC_CONSTQP; - } else if (ctx->twopass) { - ctx->rc = NV_ENC_PARAMS_RC_VBR_HQ; - } else if ((avctx->qmin >= 0 && avctx->qmax >= 0) || - (ctx->qmin >= 0 && ctx->qmax >= 0)) { - ctx->rc = NV_ENC_PARAMS_RC_VBR_MINQP; - } - } -#endif if (ctx->rc >= 0 && ctx->rc & RC_MODE_DEPRECATED) { av_log(avctx, AV_LOG_WARNING, "Specified rc mode is deprecated.\n"); @@ -1181,7 +1063,6 @@ static av_cold int nvenc_setup_rate_control(AVCodecContext *avctx) ctx->rc &= ~RC_MODE_DEPRECATED; } -#ifdef NVENC_HAVE_QP_CHROMA_OFFSETS ctx->encode_config.rcParams.cbQPIndexOffset = ctx->qp_cb_offset; ctx->encode_config.rcParams.crQPIndexOffset = ctx->qp_cr_offset; @@ -1191,15 +1072,9 @@ static av_cold int nvenc_setup_rate_control(AVCodecContext *avctx) "av1_nvenc: qp_cr_offset is currently ignored by the NVENC driver " "(deltaQ_v_ac is forced equal to deltaQ_u_ac); only qp_cb_offset " "takes effect.\n"); -#else - if (ctx->qp_cb_offset || ctx->qp_cr_offset) - av_log(avctx, AV_LOG_WARNING, "Failed setting QP CB/CR offsets, SDK 11.1 or greater required at compile time.\n"); -#endif -#ifdef NVENC_HAVE_LDKFS if (ctx->ldkfs) ctx->encode_config.rcParams.lowDelayKeyFrameScale = ctx->ldkfs; -#endif if (ctx->flags & NVENC_LOSSLESS) { set_lossless(avctx); @@ -1341,9 +1216,7 @@ static av_cold int nvenc_setup_h264_config(AVCodecContext *avctx) h264->intraRefreshCnt = cc->gopLength - 1; cc->gopLength = NVENC_INFINITE_GOPLENGTH; h264->outputRecoveryPointSEI = 1; -#ifdef NVENC_HAVE_SINGLE_SLICE_INTRA_REFRESH h264->singleSliceIntraRefresh = ctx->single_slice_intra_refresh; -#endif } if (ctx->constrained_encoding) @@ -1364,9 +1237,7 @@ static av_cold int nvenc_setup_h264_config(AVCodecContext *avctx) /* Older SDKs use outputBufferingPeriodSEI to control filler data */ h264->outputBufferingPeriodSEI = ctx->cbr_padding; -#ifdef NVENC_HAVE_FILLER_DATA h264->enableFillerDataInsertion = ctx->cbr_padding; -#endif } h264->outputPictureTimingSEI = 1; @@ -1456,15 +1327,11 @@ static av_cold int nvenc_setup_h264_config(AVCodecContext *avctx) if (ctx->coder >= 0) h264->entropyCodingMode = ctx->coder; -#ifdef NVENC_HAVE_BFRAME_REF_MODE if (ctx->b_ref_mode >= 0) h264->useBFramesAsRef = ctx->b_ref_mode; -#endif -#ifdef NVENC_HAVE_MULTIPLE_REF_FRAMES h264->numRefL0 = avctx->refs; h264->numRefL1 = avctx->refs; -#endif #ifdef NVENC_HAVE_H264_AND_AV1_TEMPORAL_FILTER if (ctx->tf_level >= 0) { @@ -1539,9 +1406,7 @@ static av_cold int nvenc_setup_hevc_config(AVCodecContext *avctx) #ifdef NVENC_HAVE_HEVC_OUTPUT_RECOVERY_POINT_SEI hevc->outputRecoveryPointSEI = 1; #endif -#ifdef NVENC_HAVE_SINGLE_SLICE_INTRA_REFRESH hevc->singleSliceIntraRefresh = ctx->single_slice_intra_refresh; -#endif } #ifdef NVENC_HAVE_HEVC_AND_AV1_MASTERING_METADATA @@ -1553,10 +1418,8 @@ static av_cold int nvenc_setup_hevc_config(AVCodecContext *avctx) AV_FRAME_DATA_CONTENT_LIGHT_LEVEL); #endif -#ifdef NVENC_HAVE_HEVC_CONSTRAINED_ENCODING if (ctx->constrained_encoding) hevc->enableConstrainedEncoding = 1; -#endif hevc->disableSPSPPS = (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) ? 1 : 0; hevc->repeatSPSPPS = (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) ? 0 : 1; @@ -1573,9 +1436,7 @@ static av_cold int nvenc_setup_hevc_config(AVCodecContext *avctx) /* Older SDKs use outputBufferingPeriodSEI to control filler data */ hevc->outputBufferingPeriodSEI = ctx->cbr_padding; -#ifdef NVENC_HAVE_FILLER_DATA hevc->enableFillerDataInsertion = ctx->cbr_padding; -#endif } hevc->outputPictureTimingSEI = 1; @@ -1659,15 +1520,11 @@ static av_cold int nvenc_setup_hevc_config(AVCodecContext *avctx) hevc->tier = ctx->tier; -#ifdef NVENC_HAVE_HEVC_BFRAME_REF_MODE if (ctx->b_ref_mode >= 0) hevc->useBFramesAsRef = ctx->b_ref_mode; -#endif -#ifdef NVENC_HAVE_MULTIPLE_REF_FRAMES hevc->numRefL0 = avctx->refs; hevc->numRefL1 = avctx->refs; -#endif #ifdef NVENC_HAVE_TEMPORAL_FILTER if (ctx->tf_level >= 0) { @@ -1876,7 +1733,6 @@ static av_cold int nvenc_setup_encoder(AVCodecContext *avctx) preset_config.version = NV_ENC_PRESET_CONFIG_VER; preset_config.presetCfg.version = NV_ENC_CONFIG_VER; -#ifdef NVENC_HAVE_NEW_PRESETS ctx->init_encode_params.tuningInfo = ctx->tuning_info; if (ctx->flags & NVENC_LOSSLESS) @@ -1889,12 +1745,6 @@ static av_cold int nvenc_setup_encoder(AVCodecContext *avctx) ctx->init_encode_params.presetGUID, ctx->init_encode_params.tuningInfo, &preset_config); -#else - nv_status = p_nvenc->nvEncGetEncodePresetConfig(ctx->nvencoder, - ctx->init_encode_params.encodeGUID, - ctx->init_encode_params.presetGUID, - &preset_config); -#endif if (nv_status != NV_ENC_SUCCESS) return nvenc_print_error(avctx, nv_status, "Cannot get the preset configuration"); @@ -1921,13 +1771,11 @@ static av_cold int nvenc_setup_encoder(AVCodecContext *avctx) ctx->init_encode_params.enableEncodeAsync = 0; ctx->init_encode_params.enablePTD = 1; -#ifdef NVENC_HAVE_NEW_PRESETS /* If lookahead isn't set from CLI, use value from preset. * P6 & P7 presets may enable lookahead for better quality. * */ if (ctx->rc_lookahead == 0 && ctx->encode_config.rcParams.enableLookahead) ctx->rc_lookahead = ctx->encode_config.rcParams.lookaheadDepth; -#endif if (ctx->weighted_pred == 1) ctx->init_encode_params.enableWeightedPrediction = 1; @@ -1999,7 +1847,6 @@ static av_cold int nvenc_setup_encoder(AVCodecContext *avctx) return nvenc_print_error(avctx, nv_status, "InitializeEncoder failed"); } -#ifdef NVENC_HAVE_CUSTREAM_PTR if (ctx->cu_context) { nv_status = p_nvenc->nvEncSetIOCudaStreams(ctx->nvencoder, &ctx->cu_stream, &ctx->cu_stream); if (nv_status != NV_ENC_SUCCESS) { @@ -2007,7 +1854,6 @@ static av_cold int nvenc_setup_encoder(AVCodecContext *avctx) return nvenc_print_error(avctx, nv_status, "SetIOCudaStreams failed"); } } -#endif res = nvenc_pop_context(avctx); if (res < 0) diff --git a/libavcodec/nvenc.h b/libavcodec/nvenc.h index 32d4648f75..2f309b0f68 100644 --- a/libavcodec/nvenc.h +++ b/libavcodec/nvenc.h @@ -45,40 +45,6 @@ typedef void ID3D11Device; #define NVENCAPI_CHECK_VERSION(major, minor) \ ((major) < NVENCAPI_MAJOR_VERSION || ((major) == NVENCAPI_MAJOR_VERSION && (minor) <= NVENCAPI_MINOR_VERSION)) -// SDK 8.1 compile time feature checks -#if NVENCAPI_CHECK_VERSION(8, 1) -#define NVENC_HAVE_BFRAME_REF_MODE -#define NVENC_HAVE_QP_MAP_MODE -#endif - -// SDK 9.0 compile time feature checks -#if NVENCAPI_CHECK_VERSION(9, 0) -#define NVENC_HAVE_HEVC_BFRAME_REF_MODE -#endif - -// SDK 9.1 compile time feature checks -#if NVENCAPI_CHECK_VERSION(9, 1) -#define NVENC_HAVE_MULTIPLE_REF_FRAMES -#define NVENC_HAVE_CUSTREAM_PTR -#define NVENC_HAVE_GETLASTERRORSTRING -#define NVENC_HAVE_FILLER_DATA -#endif - -// SDK 10.0 compile time feature checks -#if NVENCAPI_CHECK_VERSION(10, 0) -#define NVENC_HAVE_NEW_PRESETS -#define NVENC_HAVE_MULTIPASS -#define NVENC_HAVE_LDKFS -#define NVENC_HAVE_H264_LVL6 -#define NVENC_HAVE_HEVC_CONSTRAINED_ENCODING -#endif - -// SDK 11.1 compile time feature checks -#if NVENCAPI_CHECK_VERSION(11, 1) -#define NVENC_HAVE_QP_CHROMA_OFFSETS -#define NVENC_HAVE_SINGLE_SLICE_INTRA_REFRESH -#endif - // SDK 12.0 compile time feature checks #if NVENCAPI_CHECK_VERSION(12, 0) #define NVENC_HAVE_HEVC_OUTPUT_RECOVERY_POINT_SEI @@ -160,7 +126,6 @@ enum { PRESET_LOW_LATENCY_HP, PRESET_LOSSLESS_DEFAULT, PRESET_LOSSLESS_HP, -#ifdef NVENC_HAVE_NEW_PRESETS PRESET_P1, PRESET_P2, PRESET_P3, @@ -168,7 +133,6 @@ enum { PRESET_P5, PRESET_P6, PRESET_P7, -#endif }; enum { diff --git a/libavcodec/nvenc_h264.c b/libavcodec/nvenc_h264.c index 6def749f2c..f5647c9dda 100644 --- a/libavcodec/nvenc_h264.c +++ b/libavcodec/nvenc_h264.c @@ -26,11 +26,7 @@ #define OFFSET(x) offsetof(NvencContext, x) #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM static const AVOption options[] = { -#ifdef NVENC_HAVE_NEW_PRESETS { "preset", "Set the encoding preset", OFFSET(preset), AV_OPT_TYPE_INT, { .i64 = PRESET_P4 }, PRESET_DEFAULT, PRESET_P7, VE, .unit = "preset" }, -#else - { "preset", "Set the encoding preset", OFFSET(preset), AV_OPT_TYPE_INT, { .i64 = PRESET_MEDIUM }, PRESET_DEFAULT, PRESET_LOSSLESS_HP, VE, .unit = "preset" }, -#endif { "default", "", 0, AV_OPT_TYPE_CONST, { .i64 = PRESET_DEFAULT }, 0, 0, VE, .unit = "preset" }, { "slow", "hq 2 passes", 0, AV_OPT_TYPE_CONST, { .i64 = PRESET_SLOW }, 0, 0, VE, .unit = "preset" }, { "medium", "hq 1 pass", 0, AV_OPT_TYPE_CONST, { .i64 = PRESET_MEDIUM }, 0, 0, VE, .unit = "preset" }, @@ -43,7 +39,6 @@ static const AVOption options[] = { { "llhp", "low latency hp", 0, AV_OPT_TYPE_CONST, { .i64 = PRESET_LOW_LATENCY_HP }, 0, 0, VE, .unit = "preset" }, { "lossless", "", 0, AV_OPT_TYPE_CONST, { .i64 = PRESET_LOSSLESS_DEFAULT }, 0, 0, VE, .unit = "preset" }, { "losslesshp", "", 0, AV_OPT_TYPE_CONST, { .i64 = PRESET_LOSSLESS_HP }, 0, 0, VE, .unit = "preset" }, -#ifdef NVENC_HAVE_NEW_PRESETS { "p1", "fastest (lowest quality)", 0, AV_OPT_TYPE_CONST, { .i64 = PRESET_P1 }, 0, 0, VE, .unit = "preset" }, { "p2", "faster (lower quality)", 0, AV_OPT_TYPE_CONST, { .i64 = PRESET_P2 }, 0, 0, VE, .unit = "preset" }, { "p3", "fast (low quality)", 0, AV_OPT_TYPE_CONST, { .i64 = PRESET_P3 }, 0, 0, VE, .unit = "preset" }, @@ -56,7 +51,6 @@ static const AVOption options[] = { { "ll", "Low latency", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_TUNING_INFO_LOW_LATENCY }, 0, 0, VE, .unit = "tune" }, { "ull", "Ultra low latency", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_TUNING_INFO_ULTRA_LOW_LATENCY }, 0, 0, VE, .unit = "tune" }, { "lossless", "Lossless", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_TUNING_INFO_LOSSLESS }, 0, 0, VE, .unit = "tune" }, -#endif { "profile", "Set the encoding profile", OFFSET(profile), AV_OPT_TYPE_INT, { .i64 = NV_ENC_H264_PROFILE_HIGH }, NV_ENC_H264_PROFILE_BASELINE, NV_ENC_H264_PROFILE_HIGH_444P, VE, .unit = "profile" }, { "baseline", "", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_H264_PROFILE_BASELINE }, 0, 0, VE, .unit = "profile" }, { "main", "", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_H264_PROFILE_MAIN }, 0, 0, VE, .unit = "profile" }, @@ -68,11 +62,7 @@ static const AVOption options[] = { { "high422", "", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_H264_PROFILE_HIGH_422 }, 0, 0, VE, .unit = "profile" }, #endif { "high444p", "", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_H264_PROFILE_HIGH_444P }, 0, 0, VE, .unit = "profile" }, -#ifdef NVENC_HAVE_H264_LVL6 { "level", "Set the encoding level restriction", OFFSET(level), AV_OPT_TYPE_INT, { .i64 = NV_ENC_LEVEL_AUTOSELECT }, NV_ENC_LEVEL_AUTOSELECT, NV_ENC_LEVEL_H264_62, VE, .unit = "level" }, -#else - { "level", "Set the encoding level restriction", OFFSET(level), AV_OPT_TYPE_INT, { .i64 = NV_ENC_LEVEL_AUTOSELECT }, NV_ENC_LEVEL_AUTOSELECT, NV_ENC_LEVEL_H264_52, VE, .unit = "level" }, -#endif { "auto", "", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_AUTOSELECT }, 0, 0, VE, .unit = "level" }, { "1", "", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_H264_1 }, 0, 0, VE, .unit = "level" }, { "1.0", "", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_H264_1 }, 0, 0, VE, .unit = "level" }, @@ -97,11 +87,9 @@ static const AVOption options[] = { { "5.0", "", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_H264_5 }, 0, 0, VE, .unit = "level" }, { "5.1", "", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_H264_51 }, 0, 0, VE, .unit = "level" }, { "5.2", "", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_H264_52 }, 0, 0, VE, .unit = "level" }, -#ifdef NVENC_HAVE_H264_LVL6 { "6.0", "", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_H264_60 }, 0, 0, VE, .unit = "level" }, { "6.1", "", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_H264_61 }, 0, 0, VE, .unit = "level" }, { "6.2", "", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_H264_62 }, 0, 0, VE, .unit = "level" }, -#endif { "rc", "Override the preset rate-control", OFFSET(rc), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, VE, .unit = "rc" }, { "constqp", "Constant QP mode", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_PARAMS_RC_CONSTQP }, 0, 0, VE, .unit = "rc" }, { "vbr", "Variable bitrate mode", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_PARAMS_RC_VBR }, 0, 0, VE, .unit = "rc" }, @@ -187,38 +175,27 @@ static const AVOption options[] = { { "cavlc", "", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_H264_ENTROPY_CODING_MODE_CAVLC }, 0, 0, VE, .unit = "coder" }, { "ac", "", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_H264_ENTROPY_CODING_MODE_CABAC }, 0, 0, VE, .unit = "coder" }, { "vlc", "", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_H264_ENTROPY_CODING_MODE_CAVLC }, 0, 0, VE, .unit = "coder" }, -#ifdef NVENC_HAVE_BFRAME_REF_MODE { "b_ref_mode", "Use B frames as references", OFFSET(b_ref_mode), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, NV_ENC_BFRAME_REF_MODE_MIDDLE, VE, .unit = "b_ref_mode" }, { "disabled", "B frames will not be used for reference", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_BFRAME_REF_MODE_DISABLED }, 0, 0, VE, .unit = "b_ref_mode" }, { "each", "Each B frame will be used for reference", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_BFRAME_REF_MODE_EACH }, 0, 0, VE, .unit = "b_ref_mode" }, { "middle", "Only (number of B frames)/2 will be used for reference", 0,AV_OPT_TYPE_CONST, { .i64 = NV_ENC_BFRAME_REF_MODE_MIDDLE }, 0, 0, VE, .unit = "b_ref_mode" }, -#else - { "b_ref_mode", "(not supported)", OFFSET(b_ref_mode), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, VE, .unit = "b_ref_mode" }, - { "disabled", "", 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, 0, 0, VE, .unit = "b_ref_mode" }, - { "each", "", 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, 0, 0, VE, .unit = "b_ref_mode" }, - { "middle", "", 0, AV_OPT_TYPE_CONST, { .i64 = 2 }, 0, 0, VE, .unit = "b_ref_mode" }, -#endif { "a53cc", "Use A53 Closed Captions (if available)", OFFSET(a53_cc), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, VE }, #ifdef NVENC_HAVE_TIME_CODE { "s12m_tc", "Use timecode (if available)", OFFSET(s12m_tc), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, VE }, #endif { "dpb_size", "Specifies the DPB size used for encoding (0 means automatic)", OFFSET(dpb_size), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE }, -#ifdef NVENC_HAVE_MULTIPASS { "multipass", "Set the multipass encoding", OFFSET(multipass), AV_OPT_TYPE_INT, { .i64 = NV_ENC_MULTI_PASS_DISABLED }, NV_ENC_MULTI_PASS_DISABLED, NV_ENC_TWO_PASS_FULL_RESOLUTION, VE, .unit = "multipass" }, { "disabled", "Single Pass", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_MULTI_PASS_DISABLED }, 0, 0, VE, .unit = "multipass" }, { "qres", "Two Pass encoding is enabled where first Pass is quarter resolution", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_TWO_PASS_QUARTER_RESOLUTION }, 0, 0, VE, .unit = "multipass" }, { "fullres", "Two Pass encoding is enabled where first Pass is full resolution", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_TWO_PASS_FULL_RESOLUTION }, 0, 0, VE, .unit = "multipass" }, -#endif #ifdef NVENC_HAVE_H264_10BIT_SUPPORT { "highbitdepth", "Enable 10 bit encode for 8 bit input",OFFSET(highbitdepth),AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, #endif -#ifdef NVENC_HAVE_LDKFS { "ldkfs", "Low delay key frame scale; Specifies the Scene Change frame size increase allowed in case of single frame VBV and CBR", OFFSET(ldkfs), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, UCHAR_MAX, VE }, -#endif { "extra_sei", "Pass on extra SEI data (e.g. a53 cc) to be included in the bitstream", OFFSET(extra_sei), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, VE }, { "udu_sei", "Pass on user data unregistered SEI if available", @@ -231,10 +208,8 @@ static const AVOption options[] = { OFFSET(max_slice_size), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE }, { "constrained-encoding", "Enable constrainedFrame encoding where each slice in the constrained picture is independent of other slices", OFFSET(constrained_encoding), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, -#ifdef NVENC_HAVE_FILLER_DATA { "cbr_padding", "Pad the bitstream to ensure bitrate does not drop below the target in CBR mode", OFFSET(cbr_padding), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, -#endif #ifdef NVENC_HAVE_H264_AND_AV1_TEMPORAL_FILTER { "tf_level", "Specifies the strength of the temporal filtering", OFFSET(tf_level), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, VE, .unit = "tf_level" }, diff --git a/libavcodec/nvenc_hevc.c b/libavcodec/nvenc_hevc.c index 31624f45b1..17f3f4f027 100644 --- a/libavcodec/nvenc_hevc.c +++ b/libavcodec/nvenc_hevc.c @@ -26,11 +26,7 @@ #define OFFSET(x) offsetof(NvencContext, x) #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM static const AVOption options[] = { -#ifdef NVENC_HAVE_NEW_PRESETS { "preset", "Set the encoding preset", OFFSET(preset), AV_OPT_TYPE_INT, { .i64 = PRESET_P4 }, PRESET_DEFAULT, PRESET_P7, VE, .unit = "preset" }, -#else - { "preset", "Set the encoding preset", OFFSET(preset), AV_OPT_TYPE_INT, { .i64 = PRESET_MEDIUM }, PRESET_DEFAULT, PRESET_LOSSLESS_HP, VE, .unit = "preset" }, -#endif { "default", "", 0, AV_OPT_TYPE_CONST, { .i64 = PRESET_DEFAULT }, 0, 0, VE, .unit = "preset" }, { "slow", "hq 2 passes", 0, AV_OPT_TYPE_CONST, { .i64 = PRESET_SLOW }, 0, 0, VE, .unit = "preset" }, { "medium", "hq 1 pass", 0, AV_OPT_TYPE_CONST, { .i64 = PRESET_MEDIUM }, 0, 0, VE, .unit = "preset" }, @@ -43,7 +39,6 @@ static const AVOption options[] = { { "llhp", "low latency hp", 0, AV_OPT_TYPE_CONST, { .i64 = PRESET_LOW_LATENCY_HP }, 0, 0, VE, .unit = "preset" }, { "lossless", "lossless", 0, AV_OPT_TYPE_CONST, { .i64 = PRESET_LOSSLESS_DEFAULT }, 0, 0, VE, .unit = "preset" }, { "losslesshp", "lossless hp", 0, AV_OPT_TYPE_CONST, { .i64 = PRESET_LOSSLESS_HP }, 0, 0, VE, .unit = "preset" }, -#ifdef NVENC_HAVE_NEW_PRESETS { "p1", "fastest (lowest quality)", 0, AV_OPT_TYPE_CONST, { .i64 = PRESET_P1 }, 0, 0, VE, .unit = "preset" }, { "p2", "faster (lower quality)", 0, AV_OPT_TYPE_CONST, { .i64 = PRESET_P2 }, 0, 0, VE, .unit = "preset" }, { "p3", "fast (low quality)", 0, AV_OPT_TYPE_CONST, { .i64 = PRESET_P3 }, 0, 0, VE, .unit = "preset" }, @@ -59,7 +54,6 @@ static const AVOption options[] = { { "ll", "Low latency", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_TUNING_INFO_LOW_LATENCY }, 0, 0, VE, .unit = "tune" }, { "ull", "Ultra low latency", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_TUNING_INFO_ULTRA_LOW_LATENCY }, 0, 0, VE, .unit = "tune" }, { "lossless", "Lossless", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_TUNING_INFO_LOSSLESS }, 0, 0, VE, .unit = "tune" }, -#endif { "profile", "Set the encoding profile", OFFSET(profile), AV_OPT_TYPE_INT, { .i64 = NV_ENC_HEVC_PROFILE_MAIN }, NV_ENC_HEVC_PROFILE_MAIN, NV_ENC_HEVC_PROFILE_COUNT - 1, VE, .unit = "profile" }, { "main", "", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_HEVC_PROFILE_MAIN }, 0, 0, VE, .unit = "profile" }, { "main10", "", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_HEVC_PROFILE_MAIN_10 }, 0, 0, VE, .unit = "profile" }, @@ -169,36 +163,25 @@ static const AVOption options[] = { OFFSET(qmax), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 51, VE }, { "weighted_pred","Set 1 to enable weighted prediction", OFFSET(weighted_pred),AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE }, -#ifdef NVENC_HAVE_HEVC_BFRAME_REF_MODE { "b_ref_mode", "Use B frames as references", OFFSET(b_ref_mode), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, NV_ENC_BFRAME_REF_MODE_MIDDLE, VE, .unit = "b_ref_mode" }, { "disabled", "B frames will not be used for reference", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_BFRAME_REF_MODE_DISABLED }, 0, 0, VE, .unit = "b_ref_mode" }, { "each", "Each B frame will be used for reference", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_BFRAME_REF_MODE_EACH }, 0, 0, VE, .unit = "b_ref_mode" }, { "middle", "Only (number of B frames)/2 will be used for reference", 0,AV_OPT_TYPE_CONST, { .i64 = NV_ENC_BFRAME_REF_MODE_MIDDLE }, 0, 0, VE, .unit = "b_ref_mode" }, -#else - { "b_ref_mode", "(not supported)", OFFSET(b_ref_mode), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, VE, .unit = "b_ref_mode" }, - { "disabled", "", 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, 0, 0, VE, .unit = "b_ref_mode" }, - { "each", "", 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, 0, 0, VE, .unit = "b_ref_mode" }, - { "middle", "", 0, AV_OPT_TYPE_CONST, { .i64 = 2 }, 0, 0, VE, .unit = "b_ref_mode" }, -#endif { "a53cc", "Use A53 Closed Captions (if available)", OFFSET(a53_cc), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, VE }, { "s12m_tc", "Use timecode (if available)", OFFSET(s12m_tc), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, VE }, { "dpb_size", "Specifies the DPB size used for encoding (0 means automatic)", OFFSET(dpb_size), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE }, -#ifdef NVENC_HAVE_MULTIPASS { "multipass", "Set the multipass encoding", OFFSET(multipass), AV_OPT_TYPE_INT, { .i64 = NV_ENC_MULTI_PASS_DISABLED }, NV_ENC_MULTI_PASS_DISABLED, NV_ENC_TWO_PASS_FULL_RESOLUTION, VE, .unit = "multipass" }, { "disabled", "Single Pass", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_MULTI_PASS_DISABLED }, 0, 0, VE, .unit = "multipass" }, { "qres", "Two Pass encoding is enabled where first Pass is quarter resolution", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_TWO_PASS_QUARTER_RESOLUTION }, 0, 0, VE, .unit = "multipass" }, { "fullres", "Two Pass encoding is enabled where first Pass is full resolution", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_TWO_PASS_FULL_RESOLUTION }, 0, 0, VE, .unit = "multipass" }, -#endif #ifdef NVENC_HAVE_NEW_BIT_DEPTH_API { "highbitdepth", "Enable 10 bit encode for 8 bit input",OFFSET(highbitdepth),AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, #endif -#ifdef NVENC_HAVE_LDKFS { "ldkfs", "Low delay key frame scale; Specifies the Scene Change frame size increase allowed in case of single frame VBV and CBR", OFFSET(ldkfs), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, UCHAR_MAX, VE }, -#endif { "extra_sei", "Pass on extra SEI data (e.g. a53 cc) to be included in the bitstream", OFFSET(extra_sei), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, VE }, { "udu_sei", "Pass on user data unregistered SEI if available", @@ -211,10 +194,8 @@ static const AVOption options[] = { OFFSET(max_slice_size), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE }, { "constrained-encoding", "Enable constrainedFrame encoding where each slice in the constrained picture is independent of other slices", OFFSET(constrained_encoding), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, -#ifdef NVENC_HAVE_FILLER_DATA { "cbr_padding", "Pad the bitstream to ensure bitrate does not drop below the target in CBR mode", OFFSET(cbr_padding), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, -#endif #ifdef NVENC_HAVE_TEMPORAL_FILTER { "tf_level", "Specifies the strength of the temporal filtering", OFFSET(tf_level), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, VE, .unit = "tf_level" }, _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
