From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id EEF9946843 for ; Wed, 17 Apr 2024 14:27:26 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 11D2B68D2D1; Wed, 17 Apr 2024 17:27:24 +0300 (EEST) Received: from btbn.de (btbn.de [144.76.60.213]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2537068CEE6 for ; Wed, 17 Apr 2024 17:27:18 +0300 (EEST) Received: from [authenticated] by btbn.de (Postfix) with ESMTPSA id 683C427FFD872; Wed, 17 Apr 2024 16:27:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rothenpieler.org; s=mail; t=1713364037; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=khyupOk+09gtU2WMuPXDvSs2R+zEaOTlKZdkHd5R/JI=; b=sT9R527pMJlxsrGO+edPkXqWPGXDP/TfygQaqITb1wwjuT7HyzYUY3/UzxGegjYaznLS0X fiJqi/WxQY2HdJlKpinTTWmG+cqK+VdX0jt5Mq0ObMAtwHZtBFGb9/Of70mQec+hJnDVPp 1fTDIZpjkKe/txss9/6/CjAXQHc59+xKORQLLB3PYbLgNyjLzXDoO9Z6F+WT+COSzXX0Ux sRCgaeIrSpVZMZvBU5gRwKlhCaDuR3eOcgnZLxoPmii9b1KPlftFG1XRMHPhc/wn+dZOfX 4W0rES/OR3yW/TVKBqORchGcI4vQAQjqsxeigs2uI5YErwZ4N9GieEH8bIyAxQ== Message-ID: <26df08ee-ee02-408a-98ea-ef5fe77c93c7@rothenpieler.org> Date: Wed, 17 Apr 2024 16:27:25 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: FFmpeg development discussions and patches References: <20240415143932.338380-1-ddesouza@nvidia.com> Content-Language: en-US, de-DE From: Timo Rothenpieler In-Reply-To: <20240415143932.338380-1-ddesouza@nvidia.com> Subject: Re: [FFmpeg-devel] [PATCH] avcodec/nvenc: High bit depth encoding for HEVC X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: ddesouza@nvidia.com Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 15/04/2024 16:39, Diego Felix de Souza via ffmpeg-devel wrote: > From: Diego Felix de Souza > > Adding 10-bit encoding support for HEVC if the input is 8-bit. In > case of 8-bit input content, NVENC performs an internal CUDA 8 to > 10-bit conversion of the input prior to encoding. Currently, only > AV1 supports encoding 8-bit content as 10-bit. I'm not sure about this one. Since it's just "SW", or rather CUDA based, conversion, this job could also be done by scale_cuda, outside of some niche formats it doesn't support yet. Which would also allow for more consistent command lines across versions. > Signed-off-by: Diego Felix de Souza > --- > libavcodec/nvenc.c | 8 ++++---- > libavcodec/nvenc_hevc.c | 1 + > 2 files changed, 5 insertions(+), 4 deletions(-) > > diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c > index 794174a53f..c302cc7dc4 100644 > --- a/libavcodec/nvenc.c > +++ b/libavcodec/nvenc.c > @@ -514,7 +514,7 @@ static int nvenc_check_capabilities(AVCodecContext *avctx) > } > > ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_10BIT_ENCODE); > - if (IS_10BIT(ctx->data_pix_fmt) && ret <= 0) { > + if ((IS_10BIT(ctx->data_pix_fmt) || ctx->highbitdepth) && ret <= 0) { > av_log(avctx, AV_LOG_WARNING, "10 bit encode not supported\n"); > return AVERROR(ENOSYS); > } > @@ -1421,7 +1421,7 @@ static av_cold int nvenc_setup_hevc_config(AVCodecContext *avctx) > } > > // force setting profile as main10 if input is 10 bit > - if (IS_10BIT(ctx->data_pix_fmt)) { > + if (IS_10BIT(ctx->data_pix_fmt) || ctx->highbitdepth) { Won't this need guarded behind the NVENC_HAVE_NEW_BIT_DEPTH_API as well? Or would this also work fine with older headers, by just setting this? > cc->profileGUID = NV_ENC_HEVC_PROFILE_MAIN10_GUID; > avctx->profile = AV_PROFILE_HEVC_MAIN_10; > } > @@ -1435,8 +1435,8 @@ static av_cold int nvenc_setup_hevc_config(AVCodecContext *avctx) > hevc->chromaFormatIDC = IS_YUV444(ctx->data_pix_fmt) ? 3 : 1; > > #ifdef NVENC_HAVE_NEW_BIT_DEPTH_API > - hevc->inputBitDepth = hevc->outputBitDepth = > - IS_10BIT(ctx->data_pix_fmt) ? NV_ENC_BIT_DEPTH_10 : NV_ENC_BIT_DEPTH_8; > + hevc->inputBitDepth = IS_10BIT(ctx->data_pix_fmt) ? NV_ENC_BIT_DEPTH_10 : NV_ENC_BIT_DEPTH_8; > + hevc->outputBitDepth = (IS_10BIT(ctx->data_pix_fmt) || ctx->highbitdepth) ? NV_ENC_BIT_DEPTH_10 : NV_ENC_BIT_DEPTH_8; > #else > hevc->pixelBitDepthMinus8 = IS_10BIT(ctx->data_pix_fmt) ? 2 : 0; > #endif > diff --git a/libavcodec/nvenc_hevc.c b/libavcodec/nvenc_hevc.c > index b949cb1bd7..02e9c9c8eb 100644 > --- a/libavcodec/nvenc_hevc.c > +++ b/libavcodec/nvenc_hevc.c > @@ -183,6 +183,7 @@ static const AVOption options[] = { > { "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 > + { "highbitdepth", "Enable 10 bit encode for 8 bit input",OFFSET(highbitdepth),AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, Same question as above, does this always work, even without the new bit depth API? If not, it also needs the #ifdef. > #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 }, > -- > 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". _______________________________________________ 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".