[FFmpeg-cvslog] avcodec/nvenc: add support for new 10 bit MSB pixel formats

Timo Rothenpieler git at videolan.org
Fri Jul 11 19:04:30 EEST 2025


ffmpeg | branch: master | Timo Rothenpieler <timo at rothenpieler.org> | Fri Jul  4 18:52:25 2025 +0200| [8304a1abc79a00b846be534bdc4056a11ded8e8e] | committer: Timo Rothenpieler

avcodec/nvenc: add support for new 10 bit MSB pixel formats

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8304a1abc79a00b846be534bdc4056a11ded8e8e
---

 libavcodec/nvenc.c | 33 +++++++++++++++++++++------------
 1 file changed, 21 insertions(+), 12 deletions(-)

diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index a2457523b1..d81be00314 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -68,6 +68,7 @@ const enum AVPixelFormat ff_nvenc_pix_fmts[] = {
     AV_PIX_FMT_P210,
     AV_PIX_FMT_P216,
 #endif
+    AV_PIX_FMT_YUV444P10MSB,
     AV_PIX_FMT_YUV444P16, // Truncated to 10bits
     AV_PIX_FMT_0RGB32,
     AV_PIX_FMT_RGB32,
@@ -76,6 +77,7 @@ const enum AVPixelFormat ff_nvenc_pix_fmts[] = {
     AV_PIX_FMT_X2RGB10,
     AV_PIX_FMT_X2BGR10,
     AV_PIX_FMT_GBRP,
+    AV_PIX_FMT_GBRP10MSB,
     AV_PIX_FMT_GBRP16,    // Truncated to 10bits
     AV_PIX_FMT_CUDA,
 #if CONFIG_D3D11VA
@@ -94,13 +96,15 @@ const AVCodecHWConfigInternal *const ff_nvenc_hw_configs[] = {
     NULL,
 };
 
-#define IS_10BIT(pix_fmt)  (pix_fmt == AV_PIX_FMT_P010      || \
-                            pix_fmt == AV_PIX_FMT_P016      || \
-                            pix_fmt == AV_PIX_FMT_P210      || \
-                            pix_fmt == AV_PIX_FMT_P216      || \
-                            pix_fmt == AV_PIX_FMT_YUV444P16 || \
-                            pix_fmt == AV_PIX_FMT_X2RGB10   || \
-                            pix_fmt == AV_PIX_FMT_X2BGR10   || \
+#define IS_10BIT(pix_fmt)  (pix_fmt == AV_PIX_FMT_P010         || \
+                            pix_fmt == AV_PIX_FMT_P016         || \
+                            pix_fmt == AV_PIX_FMT_P210         || \
+                            pix_fmt == AV_PIX_FMT_P216         || \
+                            pix_fmt == AV_PIX_FMT_YUV444P10MSB || \
+                            pix_fmt == AV_PIX_FMT_YUV444P16    || \
+                            pix_fmt == AV_PIX_FMT_X2RGB10      || \
+                            pix_fmt == AV_PIX_FMT_X2BGR10      || \
+                            pix_fmt == AV_PIX_FMT_GBRP10MSB    || \
                             pix_fmt == AV_PIX_FMT_GBRP16)
 
 #define IS_RGB(pix_fmt)    (pix_fmt == AV_PIX_FMT_0RGB32  || \
@@ -110,17 +114,20 @@ const AVCodecHWConfigInternal *const ff_nvenc_hw_configs[] = {
                             pix_fmt == AV_PIX_FMT_X2RGB10 || \
                             pix_fmt == AV_PIX_FMT_X2BGR10)
 
-#define IS_YUV444(pix_fmt) (pix_fmt == AV_PIX_FMT_YUV444P   || \
-                            pix_fmt == AV_PIX_FMT_YUV444P16 || \
-                            pix_fmt == AV_PIX_FMT_GBRP      || \
-                            pix_fmt == AV_PIX_FMT_GBRP16    || \
+#define IS_YUV444(pix_fmt) (pix_fmt == AV_PIX_FMT_YUV444P      || \
+                            pix_fmt == AV_PIX_FMT_YUV444P10MSB || \
+                            pix_fmt == AV_PIX_FMT_YUV444P16    || \
+                            pix_fmt == AV_PIX_FMT_GBRP         || \
+                            pix_fmt == AV_PIX_FMT_GBRP10MSB    || \
+                            pix_fmt == AV_PIX_FMT_GBRP16       || \
                             (ctx->rgb_mode == NVENC_RGB_MODE_444 && IS_RGB(pix_fmt)))
 
 #define IS_YUV422(pix_fmt) (pix_fmt == AV_PIX_FMT_NV16 || \
                             pix_fmt == AV_PIX_FMT_P210 || \
                             pix_fmt == AV_PIX_FMT_P216)
 
-#define IS_GBRP(pix_fmt) (pix_fmt == AV_PIX_FMT_GBRP || \
+#define IS_GBRP(pix_fmt) (pix_fmt == AV_PIX_FMT_GBRP      || \
+                          pix_fmt == AV_PIX_FMT_GBRP10MSB || \
                           pix_fmt == AV_PIX_FMT_GBRP16)
 
 static const struct {
@@ -1991,7 +1998,9 @@ static NV_ENC_BUFFER_FORMAT nvenc_map_buffer_format(enum AVPixelFormat pix_fmt)
     case AV_PIX_FMT_YUV444P:
         return NV_ENC_BUFFER_FORMAT_YUV444;
     case AV_PIX_FMT_GBRP16:
+    case AV_PIX_FMT_GBRP10MSB:
     case AV_PIX_FMT_YUV444P16:
+    case AV_PIX_FMT_YUV444P10MSB:
         return NV_ENC_BUFFER_FORMAT_YUV444_10BIT;
     case AV_PIX_FMT_0RGB32:
     case AV_PIX_FMT_RGB32:



More information about the ffmpeg-cvslog mailing list