Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Diego Felix de Souza via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
To: <ffmpeg-devel@ffmpeg.org>
Cc: ddesouza@nvidia.com
Subject: [FFmpeg-devel] [PATCH v2 2/2] avcodec/nvenc: Multi NVENC Split Frame Encoding in HEVC and AV1
Date: Fri, 12 Apr 2024 20:08:13 +0000
Message-ID: <20240412200813.611054-2-ddesouza@nvidia.com> (raw)
In-Reply-To: <20240412200813.611054-1-ddesouza@nvidia.com>

From: Diego Felix de Souza <ddesouza@nvidia.com>

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.

Signed-off-by: Diego Felix de Souza <ddesouza@nvidia.com>
---
 libavcodec/nvenc.c      | 14 ++++----------
 libavcodec/nvenc_av1.c  |  2 +-
 libavcodec/nvenc_hevc.c |  2 +-
 3 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index f4d0d21715..469ef3bebd 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -1697,18 +1697,12 @@ FF_ENABLE_DEPRECATION_WARNINGS
         ctx->init_encode_params.enableWeightedPrediction = 1;

 #ifdef NVENC_HAVE_SPLIT_FRAME_ENCODING
-    if (avctx->codec->id != AV_CODEC_ID_H264 )
-        ctx->init_encode_params.splitEncodeMode = ctx->split_encode_mode;
+    ctx->init_encode_params.splitEncodeMode = ctx->split_encode_mode;

     if ((ctx->split_encode_mode != NV_ENC_SPLIT_DISABLE_MODE) &&
-    ((ctx->weighted_pred == 1) && (avctx->codec->id == AV_CODEC_ID_HEVC ))) {
-        av_log(avctx, AV_LOG_WARNING, "Split encoding is not "
-            "supported if any of the following features: weighted prediction, "
-            "alpha layer encoding, subframe mode, output into video memory "
-            "buffer, picture timing/buffering period SEI message insertion "
-            "with DX12 interface are enabled in case of HEVC. For AV1, split "
-            "encoding is not supported when output into video memory buffer "
-            "is enabled.\n");
+        ((ctx->weighted_pred == 1) && (avctx->codec->id == AV_CODEC_ID_HEVC)))
+    {
+        av_log(avctx, AV_LOG_WARNING, "Split encoding not supported with weighted prediction enabled.\n");
     }
 #endif

diff --git a/libavcodec/nvenc_av1.c b/libavcodec/nvenc_av1.c
index 45dc3c26e0..a9e065e3b9 100644
--- a/libavcodec/nvenc_av1.c
+++ b/libavcodec/nvenc_av1.c
@@ -159,7 +159,7 @@ static const AVOption options[] = {
     { "3",            "",                                   0,                    AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LOOKAHEAD_LEVEL_3 }, 0, 0, VE, .unit = "lookahead_level" },
 #endif
 #ifdef NVENC_HAVE_SPLIT_FRAME_ENCODING
-    { "split_encode_mode", "Specifies the split encoding mode", OFFSET(split_encode_mode), AV_OPT_TYPE_INT, { .i64 = NV_ENC_SPLIT_DISABLE_MODE }, 0, NV_ENC_SPLIT_DISABLE_MODE, VE, .unit = "split_encode_mode" },
+    { "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" },
     { "disabled",          "Disabled for all configurations",                                                0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_SPLIT_DISABLE_MODE },      0, 0, VE, .unit = "split_encode_mode" },
     { "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" },
     { "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" },
diff --git a/libavcodec/nvenc_hevc.c b/libavcodec/nvenc_hevc.c
index 1f5e56ecd0..b949cb1bd7 100644
--- a/libavcodec/nvenc_hevc.c
+++ b/libavcodec/nvenc_hevc.c
@@ -218,7 +218,7 @@ static const AVOption options[] = {
     { "unidir_b",     "Enable use of unidirectional B-Frames.", OFFSET(unidir_b), AV_OPT_TYPE_BOOL,  { .i64 = 0 }, 0, 1, VE },
 #endif
 #ifdef NVENC_HAVE_SPLIT_FRAME_ENCODING
-    { "split_encode_mode", "Specifies the split encoding mode", OFFSET(split_encode_mode), AV_OPT_TYPE_INT, { .i64 = NV_ENC_SPLIT_DISABLE_MODE }, 0, NV_ENC_SPLIT_DISABLE_MODE, VE, .unit = "split_encode_mode" },
+    { "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" },
     { "disabled",          "Disabled for all configurations",                                                0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_SPLIT_DISABLE_MODE },      0, 0, VE, .unit = "split_encode_mode" },
     { "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" },
     { "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" },
--
2.34.1

-----------------------------------------------------------------------------------
NVIDIA GmbH
Wuerselen
Amtsgericht Aachen
HRB 8361
Managing Directors: Rebecca Peters, Donald Robertson, Janet Hall, Ludwig von Reiche

-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

  reply	other threads:[~2024-04-12 20:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-11 11:58 [FFmpeg-devel] [PATCH] " Diego Felix de Souza via ffmpeg-devel
2024-04-11 13:50 ` Timo Rothenpieler
2024-04-12  8:59   ` Diego Felix de Souza via ffmpeg-devel
2024-04-12 20:08 ` [FFmpeg-devel] [PATCH v2 1/2] avcodec/nvenc: " Diego Felix de Souza via ffmpeg-devel
2024-04-12 20:08   ` Diego Felix de Souza via ffmpeg-devel [this message]
2024-04-13 16:02     ` [FFmpeg-devel] [PATCH v2 2/2] " Timo Rothenpieler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240412200813.611054-2-ddesouza@nvidia.com \
    --to=ffmpeg-devel@ffmpeg.org \
    --cc=ddesouza@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git