[FFmpeg-devel,5/5] avcodec/nvenc: Accept YUV444P10_LSB and YUV444P12_LSB content

Submitted by Philip Langdale on Oct. 7, 2018, 5:50 p.m.

Details

Message ID 20181007175057.31070-6-philipl@overt.org
State New
Headers show

Commit Message

Philip Langdale Oct. 7, 2018, 5:50 p.m.
12bit is implicitly truncated to 10bit as part of doing this, but we
already do that for P016 and YUV444P16.

I've bundled a single version bump and changelog entry in this change
to reflect the updates to all three of nvdec/nvenc/cuviddec.

Signed-off-by: Philip Langdale <philipl@overt.org>
---
 Changelog            |  1 +
 libavcodec/nvenc.c   | 18 +++++++++++++-----
 libavcodec/version.h |  2 +-
 3 files changed, 15 insertions(+), 6 deletions(-)

Patch hide | download patch | download mbox

diff --git a/Changelog b/Changelog
index 6c5e3c1c5d..12f600f8e6 100644
--- a/Changelog
+++ b/Changelog
@@ -33,6 +33,7 @@  version <next>:
 - ilbc decoder
 - audio denoiser as afftdn filter
 - AV1 parser
+- Support for HEVC 4:4:4 content in nvdec/nvenc/cuviddec
 
 
 version 4.0:
diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index e180d7b993..74f3842a0b 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -41,8 +41,10 @@  const enum AVPixelFormat ff_nvenc_pix_fmts[] = {
     AV_PIX_FMT_NV12,
     AV_PIX_FMT_P010,
     AV_PIX_FMT_YUV444P,
-    AV_PIX_FMT_P016,      // Truncated to 10bits
-    AV_PIX_FMT_YUV444P16, // Truncated to 10bits
+    AV_PIX_FMT_P016,          // Truncated to 10bits
+    AV_PIX_FMT_YUV444P10_LSB,
+    AV_PIX_FMT_YUV444P12_LSB, // Truncated to 10bits
+    AV_PIX_FMT_YUV444P16,     // Truncated to 10bits
     AV_PIX_FMT_0RGB32,
     AV_PIX_FMT_0BGR32,
     AV_PIX_FMT_CUDA,
@@ -52,11 +54,15 @@  const enum AVPixelFormat ff_nvenc_pix_fmts[] = {
     AV_PIX_FMT_NONE
 };
 
-#define IS_10BIT(pix_fmt)  (pix_fmt == AV_PIX_FMT_P010    || \
-                            pix_fmt == AV_PIX_FMT_P016    || \
+#define IS_10BIT(pix_fmt)  (pix_fmt == AV_PIX_FMT_P010          || \
+                            pix_fmt == AV_PIX_FMT_P016          || \
+                            pix_fmt == AV_PIX_FMT_YUV444P10_LSB || \
+                            pix_fmt == AV_PIX_FMT_YUV444P12_LSB || \
                             pix_fmt == AV_PIX_FMT_YUV444P16)
 
-#define IS_YUV444(pix_fmt) (pix_fmt == AV_PIX_FMT_YUV444P || \
+#define IS_YUV444(pix_fmt) (pix_fmt == AV_PIX_FMT_YUV444P       || \
+                            pix_fmt == AV_PIX_FMT_YUV444P10_LSB || \
+                            pix_fmt == AV_PIX_FMT_YUV444P12_LSB || \
                             pix_fmt == AV_PIX_FMT_YUV444P16)
 
 static const struct {
@@ -1263,6 +1269,8 @@  static NV_ENC_BUFFER_FORMAT nvenc_map_buffer_format(enum AVPixelFormat pix_fmt)
         return NV_ENC_BUFFER_FORMAT_YUV420_10BIT;
     case AV_PIX_FMT_YUV444P:
         return NV_ENC_BUFFER_FORMAT_YUV444_PL;
+    case AV_PIX_FMT_YUV444P10_LSB:
+    case AV_PIX_FMT_YUV444P12_LSB:
     case AV_PIX_FMT_YUV444P16:
         return NV_ENC_BUFFER_FORMAT_YUV444_10BIT;
     case AV_PIX_FMT_0RGB32:
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 97d134851f..7e51585661 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -28,7 +28,7 @@ 
 #include "libavutil/version.h"
 
 #define LIBAVCODEC_VERSION_MAJOR  58
-#define LIBAVCODEC_VERSION_MINOR  32
+#define LIBAVCODEC_VERSION_MINOR  33
 #define LIBAVCODEC_VERSION_MICRO 100
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \