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 ESMTPS id 998CC4DE29 for ; Fri, 25 Apr 2025 17:17:01 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 489AB6882FB; Fri, 25 Apr 2025 20:16:56 +0300 (EEST) Received: from btbn.de (btbn.de [144.76.60.213]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3BBCC687CC7 for ; Fri, 25 Apr 2025 20:16:50 +0300 (EEST) Received: from [authenticated] by btbn.de (Postfix) with ESMTPSA id AFCF92819125E for ; Fri, 25 Apr 2025 19:16:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rothenpieler.org; s=mail; t=1745601409; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Dt9J9RwFmedESL/UQgNsgEESLiQTtnMzo4zWoiSE3SM=; b=gmNmcCLqswpKkZwMPozPzMpKoRtptZd9G0pfq54LbKcFUB6uVvdkGdMw1UzpulueDtLI/F v2DvCqoGS5xiZZPo5M/3mCrvHTYc/vaSdtCVY2OoUdj3XNgee3od4yvSTp0Wl909LoFn5y eNDID2laoCwhSbmympU5xUxd8bqelnXnlh+9c/DVlX/MbbnKwrscdZsFz9IyO4sXtV/efV nN+MPNby01ysKQky1TNAFNjuYta6kaJ7vKaBQsLm14T18yK3/O3MrHpHld42kOoz/y4pzV OOf5ZChLOzv/fy1MNKc8lgRxrLGOhn2RwE0graJ5Ak7qJzBtDeyQTX4m33SF6Q== Message-ID: Date: Fri, 25 Apr 2025 19:16:50 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: ffmpeg-devel@ffmpeg.org References: <20250425110303.100424-1-dev@lynne.ee> Content-Language: en-US From: Timo Rothenpieler In-Reply-To: <20250425110303.100424-1-dev@lynne.ee> Subject: Re: [FFmpeg-devel] [PATCH] cuda: add support for yuv420p10 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 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 25.04.2025 13:02, Lynne wrote: > This patch adds support for accepting yuv420p10 in encoders and cuda. > --- > libavcodec/nvenc.c | 2 ++ > libavutil/hwcontext_cuda.c | 7 +++++-- > 2 files changed, 7 insertions(+), 2 deletions(-) > > diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c > index 41a4dc55f4..ccf8cc6d39 100644 > --- a/libavcodec/nvenc.c > +++ b/libavcodec/nvenc.c > @@ -57,6 +57,7 @@ > > const enum AVPixelFormat ff_nvenc_pix_fmts[] = { > AV_PIX_FMT_YUV420P, > + AV_PIX_FMT_YUV420P10, > AV_PIX_FMT_NV12, > AV_PIX_FMT_P010, > AV_PIX_FMT_YUV444P, > @@ -99,6 +100,7 @@ const AVCodecHWConfigInternal *const ff_nvenc_hw_configs[] = { > pix_fmt == AV_PIX_FMT_YUV444P16 || \ > pix_fmt == AV_PIX_FMT_X2RGB10 || \ > pix_fmt == AV_PIX_FMT_X2BGR10 || \ > + pix_fmt == AV_PIX_FMT_YUV420P10 || \ > pix_fmt == AV_PIX_FMT_GBRP16) > > #define IS_RGB(pix_fmt) (pix_fmt == AV_PIX_FMT_0RGB32 || \ Appears to be missing the entry in nvenc_map_buffer_format(). > diff --git a/libavutil/hwcontext_cuda.c b/libavutil/hwcontext_cuda.c > index 5721612225..495d3687c2 100644 > --- a/libavutil/hwcontext_cuda.c > +++ b/libavutil/hwcontext_cuda.c > @@ -44,6 +44,7 @@ static const enum AVPixelFormat supported_formats[] = { > AV_PIX_FMT_NV12, > AV_PIX_FMT_NV16, > AV_PIX_FMT_YUV420P, > + AV_PIX_FMT_YUV420P10, > AV_PIX_FMT_YUVA420P, > AV_PIX_FMT_YUV444P, > AV_PIX_FMT_P010, > @@ -162,7 +163,8 @@ static int cuda_frames_init(AVHWFramesContext *ctx) > // YUV420P is a special case. > // Since nvenc expects the U/V planes to have half the linesize of the Y plane > // alignment has to be doubled to ensure the U/V planes still end up aligned. > - if (ctx->sw_format == AV_PIX_FMT_YUV420P) > + if (ctx->sw_format == AV_PIX_FMT_YUV420P || > + ctx->sw_format == AV_PIX_FMT_YUV420P10) > priv->tex_alignment *= 2; > > av_pix_fmt_get_chroma_sub_sample(ctx->sw_format, &priv->shift_width, &priv->shift_height); > @@ -197,7 +199,8 @@ static int cuda_get_buffer(AVHWFramesContext *ctx, AVFrame *frame) > > // YUV420P is a special case. > // Nvenc expects the U/V planes in swapped order from how ffmpeg expects them, also chroma is half-aligned > - if (ctx->sw_format == AV_PIX_FMT_YUV420P) { > + if (ctx->sw_format == AV_PIX_FMT_YUV420P || > + ctx->sw_format == AV_PIX_FMT_YUV420P10) { > frame->linesize[1] = frame->linesize[2] = frame->linesize[0] / 2; > frame->data[2] = frame->data[1]; > frame->data[1] = frame->data[2] + frame->linesize[2] * (ctx->height / 2); _______________________________________________ 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".