[FFmpeg-devel] [PATCH] avutil: add AV_PIX_FMT_GBR(A)P32F?E & AV_PIX_FMT_YUV(A)P32?E

Hendrik Leppkes h.leppkes at gmail.com
Wed Feb 10 23:14:52 CET 2016


On Wed, Feb 10, 2016 at 11:00 PM, Michael Niedermayer
<michael at niedermayer.cc> wrote:
> On Wed, Feb 10, 2016 at 10:21:34PM +0100, wm4 wrote:
>> On Wed, 10 Feb 2016 21:56:07 +0100
>> Michael Niedermayer <michael at niedermayer.cc> wrote:
>>
>> > Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
>> > ---
>> >  libavutil/pixdesc.c |  105 +++++++++++++++++++++++++++++++++++++++++++++++++++
>> >  libavutil/pixfmt.h  |   13 +++++++
>> >  2 files changed, 118 insertions(+)
>> >
>> > diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
>> > index 58833cf..5fda5bd 100644
>> > --- a/libavutil/pixdesc.c
>> > +++ b/libavutil/pixdesc.c
>> > @@ -926,6 +926,57 @@ 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_YUVA444P32FBE] = {
>> > +        .name = "yuva444p32fbe",
>> > +        .nb_components = 4,
>> > +        .log2_chroma_w = 0,
>> > +        .log2_chroma_h = 0,
>> > +        .comp = {
>> > +            { 0, 4, 0, 0, 32, 3, 31, 1 },        /* Y */
>> > +            { 1, 4, 0, 0, 32, 3, 31, 1 },        /* U */
>> > +            { 2, 4, 0, 0, 32, 3, 31, 1 },        /* V */
>> > +            { 3, 4, 0, 0, 32, 3, 31, 1 },        /* A */
>> > +        },
>> > +        .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
>> > +    },
>> > +    [AV_PIX_FMT_YUVA444P32FLE] = {
>> > +        .name = "yuva444p32fle",
>> > +        .nb_components = 4,
>> > +        .log2_chroma_w = 0,
>> > +        .log2_chroma_h = 0,
>> > +        .comp = {
>> > +            { 0, 4, 0, 0, 32, 3, 31, 1 },        /* Y */
>> > +            { 1, 4, 0, 0, 32, 3, 31, 1 },        /* U */
>> > +            { 2, 4, 0, 0, 32, 3, 31, 1 },        /* V */
>> > +            { 3, 4, 0, 0, 32, 3, 31, 1 },        /* A */
>> > +        },
>> > +        .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
>> > +    },
>> > +    [AV_PIX_FMT_YUV444P32FBE] = {
>> > +        .name = "yuv444p32fbe",
>> > +        .nb_components = 3,
>> > +        .log2_chroma_w = 0,
>> > +        .log2_chroma_h = 0,
>> > +        .comp = {
>> > +            { 0, 4, 0, 0, 32, 3, 31, 1 },        /* Y */
>> > +            { 1, 4, 0, 0, 32, 3, 31, 1 },        /* U */
>> > +            { 2, 4, 0, 0, 32, 3, 31, 1 },        /* V */
>> > +        },
>> > +        .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
>> > +    },
>> > +    [AV_PIX_FMT_YUV444P32FLE] = {
>> > +        .name = "yuv444p32fle",
>> > +        .nb_components = 3,
>> > +        .log2_chroma_w = 0,
>> > +        .log2_chroma_h = 0,
>> > +        .comp = {
>> > +            { 0, 4, 0, 0, 32, 3, 31, 1 },        /* Y */
>> > +            { 1, 4, 0, 0, 32, 3, 31, 1 },        /* U */
>> > +            { 2, 4, 0, 0, 32, 3, 31, 1 },        /* V */
>> > +        },
>> > +        .flags = AV_PIX_FMT_FLAG_PLANAR,
>> > +    },
>> > +
>> >  #if FF_API_VDPAU
>> >      [AV_PIX_FMT_VDPAU_H264] = {
>> >          .name = "vdpau_h264",
>> > @@ -1819,6 +1870,60 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
>> >          .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
>> >                   AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
>> >      },
>> > +    [AV_PIX_FMT_GBRAP32FLE] = {
>> > +        .name = "gbrap32fle",
>> > +        .nb_components = 4,
>> > +        .log2_chroma_w = 0,
>> > +        .log2_chroma_h = 0,
>> > +        .comp = {
>> > +            { 2, 4, 0, 0, 32, 3, 31, 1 },       /* R */
>> > +            { 0, 4, 0, 0, 32, 3, 31, 1 },       /* G */
>> > +            { 1, 4, 0, 0, 32, 3, 31, 1 },       /* B */
>> > +            { 3, 4, 0, 0, 32, 3, 31, 1 },       /* A */
>> > +        },
>> > +        .flags = AV_PIX_FMT_FLAG_PLANAR |
>> > +                 AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
>> > +    },
>> > +    [AV_PIX_FMT_GBRAP32FBE] = {
>> > +        .name = "gbrap32fbe",
>> > +        .nb_components = 4,
>> > +        .log2_chroma_w = 0,
>> > +        .log2_chroma_h = 0,
>> > +        .comp = {
>> > +            { 2, 4, 0, 0, 32, 3, 31, 1 },       /* R */
>> > +            { 0, 4, 0, 0, 32, 3, 31, 1 },       /* G */
>> > +            { 1, 4, 0, 0, 32, 3, 31, 1 },       /* B */
>> > +            { 3, 4, 0, 0, 32, 3, 31, 1 },       /* 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_GBRP32FLE] = {
>> > +        .name = "gbrp32fle",
>> > +        .nb_components = 3,
>> > +        .log2_chroma_w = 0,
>> > +        .log2_chroma_h = 0,
>> > +        .comp = {
>> > +            { 2, 4, 0, 0, 32, 3, 31, 1 },       /* R */
>> > +            { 0, 4, 0, 0, 32, 3, 31, 1 },       /* G */
>> > +            { 1, 4, 0, 0, 32, 3, 31, 1 },       /* B */
>> > +        },
>> > +        .flags = AV_PIX_FMT_FLAG_PLANAR |
>> > +                 AV_PIX_FMT_FLAG_RGB,
>> > +    },
>> > +    [AV_PIX_FMT_GBRP32FBE] = {
>> > +        .name = "gbrp32fbe",
>> > +        .nb_components = 3,
>> > +        .log2_chroma_w = 0,
>> > +        .log2_chroma_h = 0,
>> > +        .comp = {
>> > +            { 2, 4, 0, 0, 32, 3, 31, 1 },       /* R */
>> > +            { 0, 4, 0, 0, 32, 3, 31, 1 },       /* G */
>> > +            { 1, 4, 0, 0, 32, 3, 31, 1 },       /* B */
>> > +        },
>> > +        .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
>> > +                 AV_PIX_FMT_FLAG_RGB,
>> > +    },
>> >      [AV_PIX_FMT_VDPAU] = {
>> >          .name = "vdpau",
>> >          .log2_chroma_w = 1,
>> > diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
>> > index c01c057..24110f6 100644
>> > --- a/libavutil/pixfmt.h
>> > +++ b/libavutil/pixfmt.h
>> > @@ -292,6 +292,15 @@ enum AVPixelFormat {
>> >      AV_PIX_FMT_P010LE, ///< like NV12, with 10bpp per component, data in the high bits, zeros in the low bits, little-endian
>> >      AV_PIX_FMT_P010BE, ///< like NV12, with 10bpp per component, data in the high bits, zeros in the low bits, big-endian
>> >
>> > +    AV_PIX_FMT_YUV444P32FLE,  ///< planar YUV 4:4:4 96bpp, (1 Cr & Cb sample per 1x1 Y samples, float little-endian)
>> > +    AV_PIX_FMT_YUV444P32FBE,  ///< planar YUV 4:4:4 96bpp, (1 Cr & Cb sample per 1x1 Y samples, float big-endian)
>> > +    AV_PIX_FMT_YUVA444P32FLE, ///< planar YUVA 4:4:4 128bpp, (1 Cr & Cb sample per 1x1 Y & A samples, float little-endian)
>> > +    AV_PIX_FMT_YUVA444P32FBE, ///< planar YUVA 4:4:4 128bpp, (1 Cr & Cb sample per 1x1 Y & A samples, float big-endian)
>> > +    AV_PIX_FMT_GBRP32FLE,     ///< planar GBR 4:4:4 96bpp, float little-endian
>> > +    AV_PIX_FMT_GBRP32FBE,     ///< planar GBR 4:4:4 96bpp, float big-endian
>> > +    AV_PIX_FMT_GBRAP32FLE,    ///< planar GBRA 4:4:4 128bpp, float little-endian
>> > +    AV_PIX_FMT_GBRAP32FBE,    ///< planar GBRA 4:4:4 128bpp, float big-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
>> >  };
>> >
>> > @@ -348,6 +357,8 @@ enum AVPixelFormat {
>> >  #define AV_PIX_FMT_GBRP14    AV_PIX_FMT_NE(GBRP14BE,    GBRP14LE)
>> >  #define AV_PIX_FMT_GBRP16    AV_PIX_FMT_NE(GBRP16BE,    GBRP16LE)
>> >  #define AV_PIX_FMT_GBRAP16   AV_PIX_FMT_NE(GBRAP16BE,   GBRAP16LE)
>> > +#define AV_PIX_FMT_GBRP32F   AV_PIX_FMT_NE(GBRP32FBE,   GBRP32FLE)
>> > +#define AV_PIX_FMT_GBRAP32F  AV_PIX_FMT_NE(GBRAP32FBE,  GBRAP32FLE)
>> >
>> >  #define AV_PIX_FMT_BAYER_BGGR16 AV_PIX_FMT_NE(BAYER_BGGR16BE,    BAYER_BGGR16LE)
>> >  #define AV_PIX_FMT_BAYER_RGGB16 AV_PIX_FMT_NE(BAYER_RGGB16BE,    BAYER_RGGB16LE)
>> > @@ -364,6 +375,8 @@ enum AVPixelFormat {
>> >  #define AV_PIX_FMT_YUVA420P16 AV_PIX_FMT_NE(YUVA420P16BE, YUVA420P16LE)
>> >  #define AV_PIX_FMT_YUVA422P16 AV_PIX_FMT_NE(YUVA422P16BE, YUVA422P16LE)
>> >  #define AV_PIX_FMT_YUVA444P16 AV_PIX_FMT_NE(YUVA444P16BE, YUVA444P16LE)
>> > +#define AV_PIX_FMT_YUV444P32F AV_PIX_FMT_NE(YUV444P32FBE, YUV444P32FLE)
>> > +#define AV_PIX_FMT_YUVA444P32F AV_PIX_FMT_NE(YUVA444P32FBE, YUVA444P32FLE)
>> >
>> >  #define AV_PIX_FMT_XYZ12      AV_PIX_FMT_NE(XYZ12BE, XYZ12LE)
>> >  #define AV_PIX_FMT_NV20       AV_PIX_FMT_NE(NV20BE,  NV20LE)
>>
>> I don't think this is going to fly without some sort of
>> AV_PIX_FMT_FLAG_FLOAT16/32.
>
> locally added
>

The bitdepth is already given by the descriptor, so please only one
float flag, not many like wm4 seems to suggest.


More information about the ffmpeg-devel mailing list