From c7546ce0ea6e451c33bf16c8ea1a341b917652a5 Mon Sep 17 00:00:00 2001 From: Diego de Souza Date: Sat, 14 Mar 2026 01:11:31 +0100 Subject: [PATCH] avutil/pixfmt: add AV_PIX_FMT_CUARRAY for opaque CUDA block-linear surfaces Add a new hardware pixel format representing opaque block-linear CUDA arrays (CUarray). This format is used by NVDEC when decoding into opaque surfaces registered with cuvidRegisterDecodeSurfaces, and can be consumed directly by NVENC as CUDA array input without requiring a pitch-linear copy. Signed-off-by: Diego de Souza --- doc/APIchanges | 3 +++ libavutil/pixdesc.c | 4 ++++ libavutil/pixfmt.h | 6 ++++++ 3 files changed, 13 insertions(+) diff --git a/doc/APIchanges b/doc/APIchanges index 34883694a6..b24ea9d8f2 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -2,6 +2,9 @@ The last version increases of all libraries were on 2026-06-23. API changes, most recent first: +2026-07-14 - xxxxxxxxxx - lavu 61.5.100 - pixfmt.h + Add AV_PIX_FMT_CUARRAY. + 2026-07-11 - xxxxxxxxxxx - lavu 61.4.100 - frame.h Add AV_FRAME_DATA_DOWNMIX_MATRIX. diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c index ba25a25617..f1e80cb31c 100644 --- a/libavutil/pixdesc.c +++ b/libavutil/pixdesc.c @@ -2278,6 +2278,10 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { .name = "cuda", .flags = AV_PIX_FMT_FLAG_HWACCEL, }, + [AV_PIX_FMT_CUARRAY] = { + .name = "cuarray", + .flags = AV_PIX_FMT_FLAG_HWACCEL, + }, [AV_PIX_FMT_AMF_SURFACE] = { .name = "amf", .flags = AV_PIX_FMT_FLAG_HWACCEL, diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h index 2e7b6457e0..b08881cc1f 100644 --- a/libavutil/pixfmt.h +++ b/libavutil/pixfmt.h @@ -499,6 +499,12 @@ enum AVPixelFormat { AV_PIX_FMT_OHCODEC, /// hardware decoding through openharmony + /** + * CUDA block-linear (opaque). data[0] is a CUarray in block-linear layout, + * e.g. from NVDEC opaque decode. Use for zero-copy to NVENC (CUDA array input). + */ + AV_PIX_FMT_CUARRAY, + AV_PIX_FMT_NB ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions };