aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimo Rothenpieler <timo@rothenpieler.org>2025-07-04 18:52:25 +0200
committerTimo Rothenpieler <timo@rothenpieler.org>2025-07-11 17:49:58 +0200
commit8304a1abc79a00b846be534bdc4056a11ded8e8e (patch)
treec6f50363ee707f3949f0f787df8c62b7f72b0329
parent02a7c85753ad3d4a2cf414849ba4bf28cddb3ffa (diff)
downloadffmpeg-8304a1abc79a00b846be534bdc4056a11ded8e8e.tar.gz
avcodec/nvenc: add support for new 10 bit MSB pixel formats
-rw-r--r--libavcodec/nvenc.c33
1 files 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: