[FFmpeg-devel] [PATCH] avutil: Add NV24 and NV42 pixel formats

Manoj Bonda mbonda at nvidia.com
Tue May 7 12:16:40 EEST 2019


Thanks philip for taking this up. 

LGTM.

Thanks,
ManojGupta.

> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces at ffmpeg.org> On Behalf Of Philip
> Langdale
> Sent: Tuesday, May 7, 2019 10:03 AM
> To: ffmpeg-devel at ffmpeg.org
> Cc: Philip Langdale <philipl at overt.org>
> Subject: [FFmpeg-devel] [PATCH] avutil: Add NV24 and NV42 pixel formats
> 
> These are the 4:4:4 variants of the semi-planar NV12/NV21 formats.
> 
> I'm surprised we've not had a reason to add them until now, but they are
> the format that VDPAU uses when doing interop for 4:4:4 surfaces.
> 
> Signed-off-by: Philip Langdale <philipl at overt.org>
> ---
>  libavutil/pixdesc.c           | 24 ++++++++++++++++++++++++
>  libavutil/pixfmt.h            |  3 +++
>  libavutil/tests/pixfmt_best.c |  1 +
>  libavutil/version.h           |  2 +-
>  4 files changed, 29 insertions(+), 1 deletion(-)
> 
> diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c index
> fe38344d73..b97b0665b0 100644
> --- a/libavutil/pixdesc.c
> +++ b/libavutil/pixdesc.c
> @@ -2320,6 +2320,30 @@ static const AVPixFmtDescriptor
> av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
>          },
>          .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
>      },
> +    [AV_PIX_FMT_NV24] = {
> +        .name = "nv24",
> +        .nb_components = 3,
> +        .log2_chroma_w = 0,
> +        .log2_chroma_h = 0,
> +        .comp = {
> +            { 0, 1, 0, 0, 8, 0, 7, 1 },        /* Y */
> +            { 1, 2, 0, 0, 8, 1, 7, 1 },        /* U */
> +            { 1, 2, 1, 0, 8, 1, 7, 2 },        /* V */
> +        },
> +        .flags = AV_PIX_FMT_FLAG_PLANAR,
> +    },
> +    [AV_PIX_FMT_NV42] = {
> +        .name = "nv42",
> +        .nb_components = 3,
> +        .log2_chroma_w = 0,
> +        .log2_chroma_h = 0,
> +        .comp = {
> +            { 0, 1, 0, 0, 8, 0, 7, 1 },        /* Y */
> +            { 1, 2, 1, 0, 8, 1, 7, 2 },        /* U */
> +            { 1, 2, 0, 0, 8, 1, 7, 1 },        /* V */
> +        },
> +        .flags = AV_PIX_FMT_FLAG_PLANAR,
> +    },
>  };
>  #if FF_API_PLUS1_MINUS1
>  FF_ENABLE_DEPRECATION_WARNINGS
> diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h index
> 24d1b7e415..8b54c9415b 100644
> --- a/libavutil/pixfmt.h
> +++ b/libavutil/pixfmt.h
> @@ -345,6 +345,9 @@ enum AVPixelFormat {
>      AV_PIX_FMT_YUVA444P12BE, ///< planar YUV 4:4:4,36bpp, (1 Cr & Cb
> sample per 1x1 Y samples), 12b alpha, big-endian
>      AV_PIX_FMT_YUVA444P12LE, ///< planar YUV 4:4:4,36bpp, (1 Cr & Cb
> sample per 1x1 Y samples), 12b alpha, little-endian
> 
> +    AV_PIX_FMT_NV24,      ///< planar YUV 4:4:4, 24bpp, 1 plane for Y and 1
> plane for the UV components, which are interleaved (first byte U and the
> following byte V)
> +    AV_PIX_FMT_NV42,      ///< as above, but U and V bytes are swapped
> +
>      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
>  };
> 
> diff --git a/libavutil/tests/pixfmt_best.c b/libavutil/tests/pixfmt_best.c index
> e98fcc19a5..53f7264207 100644
> --- a/libavutil/tests/pixfmt_best.c
> +++ b/libavutil/tests/pixfmt_best.c
> @@ -76,6 +76,7 @@ int main(void)
>      TEST(AV_PIX_FMT_P010,      AV_PIX_FMT_YUV420P10);
>      TEST(AV_PIX_FMT_P016,      AV_PIX_FMT_YUV420P16);
>      TEST(AV_PIX_FMT_NV16,      AV_PIX_FMT_YUV422P);
> +    TEST(AV_PIX_FMT_NV24,      AV_PIX_FMT_YUV444P);
>      TEST(AV_PIX_FMT_YUYV422,   AV_PIX_FMT_YUV422P);
>      TEST(AV_PIX_FMT_UYVY422,   AV_PIX_FMT_YUV422P);
>      TEST(AV_PIX_FMT_BGR565,    AV_PIX_FMT_RGB565);
> diff --git a/libavutil/version.h b/libavutil/version.h index
> c0968de621..4922e267cc 100644
> --- a/libavutil/version.h
> +++ b/libavutil/version.h
> @@ -80,7 +80,7 @@
> 
>  #define LIBAVUTIL_VERSION_MAJOR  56
>  #define LIBAVUTIL_VERSION_MINOR  26
> -#define LIBAVUTIL_VERSION_MICRO 101
> +#define LIBAVUTIL_VERSION_MICRO 102
> 
>  #define LIBAVUTIL_VERSION_INT
> AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
>                                                 LIBAVUTIL_VERSION_MINOR, \
> --
> 2.20.1
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email ffmpeg-devel-request at ffmpeg.org
> with subject "unsubscribe".

-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------


More information about the ffmpeg-devel mailing list