When Split frame encoding is enabled, each input frame is partitioned into horizontal strips which are encoded independently and simultaneously by separate NVENCs, usually resulting in increased encoding speed compared to single NVENC encoding.
Showing the changes to libavcodec (5 of 5 files). Show all
Unified · Split
| @@ -1696,6 +1696,15 @@ FF_ENABLE_DEPRECATION_WARNINGS · 1695 unmodified lines | ||
| 1696 | 1696 | if (ctx->weighted_pred == 1) |
| 1697 | 1697 | ctx->init_encode_params.enableWeightedPrediction = 1; |
| 1698 | 1698 | |
| 1699 | +#ifdef NVENC_HAVE_SPLIT_FRAME_ENCODING | |
| 1700 | + ctx->init_encode_params.splitEncodeMode = ctx->split_encode_mode; | |
| 1701 | + | |
| 1702 | + if (ctx->split_encode_mode != NV_ENC_SPLIT_DISABLE_MODE) { | |
| 1703 | + if (avctx->codec->id == AV_CODEC_ID_HEVC && ctx->weighted_pred == 1) | |
| 1704 | + av_log(avctx, AV_LOG_WARNING, "Split encoding not supported with weighted prediction enabled.\n"); | |
| 1705 | + } | |
| 1706 | +#endif | |
| 1707 | + | |
| 1699 | 1708 | if (ctx->bluray_compat) { |
| 1700 | 1709 | ctx->aud = 1; |
| 1701 | 1710 | ctx->dpb_size = FFMIN(FFMAX(avctx->refs, 0), 6); |
| @@ -81,6 +81,7 @@ typedef void ID3D11Device; · 80 unmodified lines | ||
| 81 | 81 | // SDK 12.1 compile time feature checks |
| 82 | 82 | #if NVENCAPI_CHECK_VERSION(12, 1) |
| 83 | 83 | #define NVENC_NO_DEPRECATED_RC |
| 84 | +#define NVENC_HAVE_SPLIT_FRAME_ENCODING | |
| 84 | 85 | #endif |
| 85 | 86 | |
| 86 | 87 | // SDK 12.2 compile time feature checks |
| @@ -280,6 +281,7 @@ typedef struct NvencContext · 193 unmodified lines | ||
| 280 | 281 | int tf_level; |
| 281 | 282 | int lookahead_level; |
| 282 | 283 | int unidir_b; |
| 284 | + int split_encode_mode; | |
| 283 | 285 | } NvencContext; |
| 284 | 286 | |
| 285 | 287 | int ff_nvenc_encode_init(AVCodecContext *avctx); |
| @@ -157,6 +157,14 @@ static const AVOption options[] = { · 156 unmodified lines | ||
| 157 | 157 | { "1", "", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LOOKAHEAD_LEVEL_1 }, 0, 0, VE, .unit = "lookahead_level" }, |
| 158 | 158 | { "2", "", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LOOKAHEAD_LEVEL_2 }, 0, 0, VE, .unit = "lookahead_level" }, |
| 159 | 159 | { "3", "", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LOOKAHEAD_LEVEL_3 }, 0, 0, VE, .unit = "lookahead_level" }, |
| 160 | +#endif | |
| 161 | +#ifdef NVENC_HAVE_SPLIT_FRAME_ENCODING | |
| 162 | + { "split_encode_mode", "Specifies the split encoding mode", OFFSET(split_encode_mode), AV_OPT_TYPE_INT, { .i64 = NV_ENC_SPLIT_AUTO_MODE }, 0, NV_ENC_SPLIT_DISABLE_MODE, VE, .unit = "split_encode_mode" }, | |
| 163 | + { "disabled", "Disabled for all configurations", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_SPLIT_DISABLE_MODE }, 0, 0, VE, .unit = "split_encode_mode" }, | |
| 164 | + { "auto", "Enabled or disabled depending on the preset and tuning info", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_SPLIT_AUTO_MODE }, 0, 0, VE, .unit = "split_encode_mode" }, | |
| 165 | + { "forced", "Enabled with number of horizontal strips selected by the driver", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_SPLIT_AUTO_FORCED_MODE }, 0, 0, VE, .unit = "split_encode_mode" }, | |
| 166 | + { "2", "Enabled with number of horizontal strips forced to 2 when number of NVENCs > 1", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_SPLIT_TWO_FORCED_MODE }, 0, 0, VE, .unit = "split_encode_mode" }, | |
| 167 | + { "3", "Enabled with number of horizontal strips forced to 3 when number of NVENCs > 2", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_SPLIT_THREE_FORCED_MODE }, 0, 0, VE, .unit = "split_encode_mode" }, | |
| 160 | 168 | #endif |
| 161 | 169 | { NULL } |
| 162 | 170 | }; |
| @@ -216,6 +216,14 @@ static const AVOption options[] = { · 215 unmodified lines | ||
| 216 | 216 | #endif |
| 217 | 217 | #ifdef NVENC_HAVE_UNIDIR_B |
| 218 | 218 | { "unidir_b", "Enable use of unidirectional B-Frames.", OFFSET(unidir_b), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, |
| 219 | +#endif | |
| 220 | +#ifdef NVENC_HAVE_SPLIT_FRAME_ENCODING | |
| 221 | + { "split_encode_mode", "Specifies the split encoding mode", OFFSET(split_encode_mode), AV_OPT_TYPE_INT, { .i64 = NV_ENC_SPLIT_AUTO_MODE }, 0, NV_ENC_SPLIT_DISABLE_MODE, VE, .unit = "split_encode_mode" }, | |
| 222 | + { "disabled", "Disabled for all configurations", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_SPLIT_DISABLE_MODE }, 0, 0, VE, .unit = "split_encode_mode" }, | |
| 223 | + { "auto", "Enabled or disabled depending on the preset and tuning info", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_SPLIT_AUTO_MODE }, 0, 0, VE, .unit = "split_encode_mode" }, | |
| 224 | + { "forced", "Enabled with number of horizontal strips selected by the driver", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_SPLIT_AUTO_FORCED_MODE }, 0, 0, VE, .unit = "split_encode_mode" }, | |
| 225 | + { "2", "Enabled with number of horizontal strips forced to 2 when number of NVENCs > 1", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_SPLIT_TWO_FORCED_MODE }, 0, 0, VE, .unit = "split_encode_mode" }, | |
| 226 | + { "3", "Enabled with number of horizontal strips forced to 3 when number of NVENCs > 2", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_SPLIT_THREE_FORCED_MODE }, 0, 0, VE, .unit = "split_encode_mode" }, | |
| 219 | 227 | #endif |
| 220 | 228 | { NULL } |
| 221 | 229 | }; |
| @@ -30,7 +30,7 @@ · 29 unmodified lines | ||
| 30 | 30 | #include "version_major.h" |
| 31 | 31 | |
| 32 | 32 | #define LIBAVCODEC_VERSION_MINOR 5 |
| 33 | −#define LIBAVCODEC_VERSION_MICRO 102 | |
| 33 | +#define LIBAVCODEC_VERSION_MICRO 103 | |
| 34 | 34 | |
| 35 | 35 | #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ |
| 36 | 36 | LIBAVCODEC_VERSION_MINOR, \ |