From a27096611835f1e46b0c842ad4fffe42b36bad41 Mon Sep 17 00:00:00 2001 From: Timo Rothenpieler Date: Sun, 31 Mar 2024 21:17:11 +0200 Subject: [PATCH] avcodec/nvenc: add support for uhq tune --- libavcodec/nvenc.h | 1 + libavcodec/nvenc_hevc.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/libavcodec/nvenc.h b/libavcodec/nvenc.h index 30f9800d21..3e207b1877 100644 --- a/libavcodec/nvenc.h +++ b/libavcodec/nvenc.h @@ -88,6 +88,7 @@ typedef void ID3D11Device; #define NVENC_HAVE_NEW_BIT_DEPTH_API #define NVENC_HAVE_TEMPORAL_FILTER #define NVENC_HAVE_LOOKAHEAD_LEVEL +#define NVENC_HAVE_UHQ_TUNING #endif typedef struct NvencSurface diff --git a/libavcodec/nvenc_hevc.c b/libavcodec/nvenc_hevc.c index 7509a93516..e0d16e82c7 100644 --- a/libavcodec/nvenc_hevc.c +++ b/libavcodec/nvenc_hevc.c @@ -51,8 +51,11 @@ static const AVOption options[] = { { "p5", "slow (good quality)", 0, AV_OPT_TYPE_CONST, { .i64 = PRESET_P5 }, 0, 0, VE, .unit = "preset" }, { "p6", "slower (better quality)", 0, AV_OPT_TYPE_CONST, { .i64 = PRESET_P6 }, 0, 0, VE, .unit = "preset" }, { "p7", "slowest (best quality)", 0, AV_OPT_TYPE_CONST, { .i64 = PRESET_P7 }, 0, 0, VE, .unit = "preset" }, - { "tune", "Set the encoding tuning info", OFFSET(tuning_info), AV_OPT_TYPE_INT, { .i64 = NV_ENC_TUNING_INFO_HIGH_QUALITY }, NV_ENC_TUNING_INFO_HIGH_QUALITY, NV_ENC_TUNING_INFO_LOSSLESS, VE, .unit = "tune" }, + { "tune", "Set the encoding tuning info", OFFSET(tuning_info), AV_OPT_TYPE_INT, { .i64 = NV_ENC_TUNING_INFO_HIGH_QUALITY }, NV_ENC_TUNING_INFO_HIGH_QUALITY, NV_ENC_TUNING_INFO_COUNT - 1, VE, .unit = "tune" }, { "hq", "High quality", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_TUNING_INFO_HIGH_QUALITY }, 0, 0, VE, .unit = "tune" }, +#ifdef NVENC_HAVE_UHQ_TUNING + { "uhq", "Ultra high quality", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_TUNING_INFO_ULTRA_HIGH_QUALITY }, 0, 0, VE, .unit = "tune" }, +#endif { "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" },