diff mbox

[FFmpeg-devel,5/5] avcodec/nvenc: Accept YUV444P10_MSB and YUV444P12_MSB content

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

Commit Message

Philip Langdale Oct. 20, 2018, 8:47 p.m. UTC
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 +++++++++++++-----
 2 files changed, 14 insertions(+), 5 deletions(-)

Comments

Timo Rothenpieler Oct. 20, 2018, 9:12 p.m. UTC | #1
On 20.10.2018 22:47, Philip Langdale wrote:
> 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 +++++++++++++-----
>   2 files changed, 14 insertions(+), 5 deletions(-)
> 
> diff --git a/Changelog b/Changelog
> index 1b0bc95b7a..1334eec474 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -35,6 +35,7 @@ version <next>:
>   - AV1 parser
>   - SER demuxer
>   - sinc audio filter source
> +- 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..5be98a5182 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_MSB,
> +    AV_PIX_FMT_YUV444P12_MSB, // 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_MSB || \
> +                            pix_fmt == AV_PIX_FMT_YUV444P12_MSB || \
>                               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_MSB || \
> +                            pix_fmt == AV_PIX_FMT_YUV444P12_MSB || \
>                               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_MSB:
> +    case AV_PIX_FMT_YUV444P12_MSB:
>       case AV_PIX_FMT_YUV444P16:
>           return NV_ENC_BUFFER_FORMAT_YUV444_10BIT;
>       case AV_PIX_FMT_0RGB32:
> 

LGTM
Marton Balint Oct. 20, 2018, 9:34 p.m. UTC | #2
On Sat, 20 Oct 2018, Timo Rothenpieler wrote:

> On 20.10.2018 22:47, Philip Langdale wrote:
>> 12bit is implicitly truncated to 10bit as part of doing this, but we
>> already do that for P016 and YUV444P16.
>>

Huh? I thought one of the reasons of adding a separate pixel format is to 
be able to differentiate between the actually supported depths. If 
you do implicit depth truncation, then what is the point?

Thanks,
Marton
Timo Rothenpieler Oct. 20, 2018, 9:40 p.m. UTC | #3
On 20.10.2018 23:34, Marton Balint wrote:
> 
> 
> On Sat, 20 Oct 2018, Timo Rothenpieler wrote:
> 
>> On 20.10.2018 22:47, Philip Langdale wrote:
>>> 12bit is implicitly truncated to 10bit as part of doing this, but we
>>> already do that for P016 and YUV444P16.
>>>
> 
> Huh? I thought one of the reasons of adding a separate pixel format is 
> to be able to differentiate between the actually supported depths. If 
> you do implicit depth truncation, then what is the point?

That's only nvenc, it can only encode 8 or 10 bit.
But for decoding it can actually do 12 bit.
diff mbox

Patch

diff --git a/Changelog b/Changelog
index 1b0bc95b7a..1334eec474 100644
--- a/Changelog
+++ b/Changelog
@@ -35,6 +35,7 @@  version <next>:
 - AV1 parser
 - SER demuxer
 - sinc audio filter source
+- 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..5be98a5182 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_MSB,
+    AV_PIX_FMT_YUV444P12_MSB, // 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_MSB || \
+                            pix_fmt == AV_PIX_FMT_YUV444P12_MSB || \
                             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_MSB || \
+                            pix_fmt == AV_PIX_FMT_YUV444P12_MSB || \
                             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_MSB:
+    case AV_PIX_FMT_YUV444P12_MSB:
     case AV_PIX_FMT_YUV444P16:
         return NV_ENC_BUFFER_FORMAT_YUV444_10BIT;
     case AV_PIX_FMT_0RGB32: