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 733854B62C for ; Fri, 25 Apr 2025 11:03:19 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id F23C8687C2E; Fri, 25 Apr 2025 14:03:14 +0300 (EEST) Received: from vidala.pars.ee (vidala.pars.ee [116.203.72.101]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BE3AD687D82 for ; Fri, 25 Apr 2025 14:03:07 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; s=202405r; d=lynne.ee; c=relaxed/relaxed; h=Message-ID:Date:Subject:To:From; t=1745578987; bh=rRBePbebORxfNLCs4iRBciC L6WQPrL4FF0P8tLMI+38=; b=OkAlVrOesse9RsPaS+eVP5Z05yXuXA1cqjcF0UepEEZvCzZ0V+ LGTT20IDuT5ny8ymhYOf/LFotDGTZRtGhgZXLFM29AxLxqxMPGPhY6MBzTwaTnLN5qbo/j9TaQp Fiq9J1vge6WmUGEi+P35dsZIWYaDpDb5sskX6Nz++wrcaG2Wf7VfccwEd0fwmJaPZRP0z5DIygH QdN/wyWEW3gpXBw7MvKPE8gEbO3YUh4nMjjkNCjRK7kefKl0QfT345VumXO62Z/CDMd9OGXQ/7U je4l7qJn+1ZjYFAUkfzNM0aHUxCNqste0AiCd0VuRRCYP0FXwkIaiVPMkolIlZQWbUQ==; DKIM-Signature: v=1; a=ed25519-sha256; s=202405e; d=lynne.ee; c=relaxed/relaxed; h=Message-ID:Date:Subject:To:From; t=1745578987; bh=rRBePbebORxfNLCs4iRBciC L6WQPrL4FF0P8tLMI+38=; b=BNlEcnNpomKr2Wwbx5NYdDOgRygs7bwsMUiYdDT7urCjcKRDi0 zrpgcYN5L0fGiCkCzJCVnz1gjqpHRkMgXRBQ==; From: Lynne To: ffmpeg-devel@ffmpeg.org Date: Fri, 25 Apr 2025 13:02:57 +0200 Message-ID: <20250425110303.100424-1-dev@lynne.ee> X-Mailer: git-send-email 2.49.0.395.g12beb8f557c MIME-Version: 1.0 Subject: [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 Cc: Lynne Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: 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 || \ 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); -- 2.49.0.395.g12beb8f557c _______________________________________________ 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".