[FFmpeg-devel] [PATCH] GBRAP14 support for MagicYUV

Michael Niedermayer michael at niedermayer.cc
Thu Sep 28 13:07:44 EEST 2023


On Wed, Sep 27, 2023 at 07:24:50PM +0200, Paul B Mahol wrote:
> Attached.

>  pixdesc.c |   28 ++++++++++++++++++++++++++++
>  pixfmt.h  |    4 ++++
>  2 files changed, 32 insertions(+)
> dc323faf13db2ffbefdd8ce2c25ba3a97633e0eb  0001-avutil-add-GBRAP14-format-support.patch
> From 3e58da932f88e6781eb772d883efa6f0997de936 Mon Sep 17 00:00:00 2001
> From: Paul B Mahol <onemda at gmail.com>
> Date: Wed, 27 Sep 2023 16:06:02 +0200
> Subject: [PATCH 1/4] avutil: add GBRAP14 format support
> 
> Signed-off-by: Paul B Mahol <onemda at gmail.com>
> ---
>  libavutil/pixdesc.c | 28 ++++++++++++++++++++++++++++
>  libavutil/pixfmt.h  |  4 ++++
>  2 files changed, 32 insertions(+)
> 
> diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
> index e1e0dd2a9e..6ded9467b0 100644
> --- a/libavutil/pixdesc.c
> +++ b/libavutil/pixdesc.c
> @@ -2223,6 +2223,34 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
>          },
>          .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE,
>      },
> +    [AV_PIX_FMT_GBRAP14LE] = {
> +        .name = "gbrap14le",
> +        .nb_components = 4,
> +        .log2_chroma_w = 0,
> +        .log2_chroma_h = 0,
> +        .comp = {
> +            { 2, 2, 0, 0, 14 },       /* R */
> +            { 0, 2, 0, 0, 14 },       /* G */
> +            { 1, 2, 0, 0, 14 },       /* B */
> +            { 3, 2, 0, 0, 14 },       /* A */
> +        },
> +        .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB |
> +                 AV_PIX_FMT_FLAG_ALPHA,
> +    },
> +    [AV_PIX_FMT_GBRAP14BE] = {
> +        .name = "gbrap14be",
> +        .nb_components = 4,
> +        .log2_chroma_w = 0,
> +        .log2_chroma_h = 0,
> +        .comp = {
> +            { 2, 2, 0, 0, 14 },       /* R */
> +            { 0, 2, 0, 0, 14 },       /* G */
> +            { 1, 2, 0, 0, 14 },       /* B */
> +            { 3, 2, 0, 0, 14 },       /* A */
> +        },
> +        .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
> +                 AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
> +    },
>      [AV_PIX_FMT_GBRAP12LE] = {
>          .name = "gbrap12le",
>          .nb_components = 4,
> diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
> index 63e07ba64f..a26c72d56b 100644
> --- a/libavutil/pixfmt.h
> +++ b/libavutil/pixfmt.h
> @@ -426,6 +426,9 @@ enum AVPixelFormat {
>      AV_PIX_FMT_P412BE,      ///< interleaved chroma YUV 4:4:4, 36bpp, data in the high bits, big-endian
>      AV_PIX_FMT_P412LE,      ///< interleaved chroma YUV 4:4:4, 36bpp, data in the high bits, little-endian
>  
> +    AV_PIX_FMT_GBRAP14BE,  ///< planar GBR 4:4:4:4 56bpp, big-endian
> +    AV_PIX_FMT_GBRAP14LE,  ///< planar GBR 4:4:4:4 56bpp, little-endian
> +
>      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
>  };
>  
> @@ -484,6 +487,7 @@ enum AVPixelFormat {
>  #define AV_PIX_FMT_GBRP16    AV_PIX_FMT_NE(GBRP16BE,    GBRP16LE)
>  #define AV_PIX_FMT_GBRAP10   AV_PIX_FMT_NE(GBRAP10BE,   GBRAP10LE)
>  #define AV_PIX_FMT_GBRAP12   AV_PIX_FMT_NE(GBRAP12BE,   GBRAP12LE)
> +#define AV_PIX_FMT_GBRAP14   AV_PIX_FMT_NE(GBRAP14BE,   GBRAP14LE)
>  #define AV_PIX_FMT_GBRAP16   AV_PIX_FMT_NE(GBRAP16BE,   GBRAP16LE)
>  
>  #define AV_PIX_FMT_BAYER_BGGR16 AV_PIX_FMT_NE(BAYER_BGGR16BE,    BAYER_BGGR16LE)
> -- 
> 2.42.0
> 

>  libavformat/nut.c                        |    2 ++
>  libswscale/input.c                       |    7 +++++++
>  libswscale/output.c                      |    2 ++
>  libswscale/swscale_unscaled.c            |    3 +++
>  libswscale/utils.c                       |    6 ++++++
>  tests/ref/fate/filter-pixdesc-gbrap14be  |    1 +
>  tests/ref/fate/filter-pixdesc-gbrap14le  |    1 +
>  tests/ref/fate/filter-pixfmts-copy       |    2 ++
>  tests/ref/fate/filter-pixfmts-crop       |    2 ++
>  tests/ref/fate/filter-pixfmts-field      |    2 ++
>  tests/ref/fate/filter-pixfmts-fieldorder |    2 ++
>  tests/ref/fate/filter-pixfmts-hflip      |    2 ++
>  tests/ref/fate/filter-pixfmts-il         |    2 ++
>  tests/ref/fate/filter-pixfmts-null       |    2 ++
>  tests/ref/fate/filter-pixfmts-pad        |    1 +
>  tests/ref/fate/filter-pixfmts-scale      |    2 ++
>  tests/ref/fate/filter-pixfmts-transpose  |    2 ++
>  tests/ref/fate/filter-pixfmts-vflip      |    2 ++
>  18 files changed, 43 insertions(+)
> 025cfa7df85fab9943d3049f729c25db5934eb3f  0002-swscale-add-GBRAP14-format-support.patch
> From 517fc54c52cfdcdbc6920ede04b215ed27429b00 Mon Sep 17 00:00:00 2001
> From: Paul B Mahol <onemda at gmail.com>
> Date: Wed, 27 Sep 2023 16:13:16 +0200
> Subject: [PATCH 2/4] swscale: add GBRAP14 format support

LGTM assuming you vissually confirmed output look correct

fate tests also pass on x86 32/64 mingw32/64 (arm/mips still running, if you
hear nothing more then they passed too)

thx

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No great genius has ever existed without some touch of madness. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20230928/f2fe4cd5/attachment.sig>


More information about the ffmpeg-devel mailing list