[1/4] Add GBRP12 pixel format support

Message ID 20161010203516.27667-2-lu_zero@gentoo.org
State Committed
Commit 1e93aa69a60815d1407a6c34d8da3f83ab193ad5
Headers show

Commit Message

Luca Barbato Oct. 10, 2016, 8:35 p.m.
From: Michael Niedermayer <michaelni@gmx.at>

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
---
 doc/APIchanges      |  3 +++
 libavutil/pixdesc.c | 25 +++++++++++++++++++++++++
 libavutil/pixfmt.h  |  4 ++++
 libavutil/version.h |  2 +-
 4 files changed, 33 insertions(+), 1 deletion(-)

Comments

Vittorio Giovara Oct. 12, 2016, 3:31 p.m. | #1
On Mon, Oct 10, 2016 at 4:35 PM, Luca Barbato <lu_zero@gentoo.org> wrote:
> From: Michael Niedermayer <michaelni@gmx.at>
>
> Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
> ---
>  doc/APIchanges      |  3 +++
>  libavutil/pixdesc.c | 25 +++++++++++++++++++++++++
>  libavutil/pixfmt.h  |  4 ++++
>  libavutil/version.h |  2 +-
>  4 files changed, 33 insertions(+), 1 deletion(-)
>
> diff --git a/doc/APIchanges b/doc/APIchanges
> index 655783e..6b984f4 100644
> --- a/doc/APIchanges
> +++ b/doc/APIchanges
> @@ -13,6 +13,9 @@ libavutil:     2015-08-28
>
>  API changes, most recent first:
>
> +2016-xx-xx - xxxxxxx - lavu 55.24.0 - pixfmt.h
> +  Add AV_PIX_FMT_GBRP12(LE/BE).
> +
>  2016-xx-xx - xxxxxxx - lavu 55.23.0 - hwcontext_vaapi.h
>    Add AV_VAAPI_DRIVER_QUIRK_ATTRIB_MEMTYPE.
>
> diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
> index 78fbdbc..38c9908 100644
> --- a/libavutil/pixdesc.c
> +++ b/libavutil/pixdesc.c
> @@ -1514,6 +1514,30 @@ 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_GBRP12LE] = {
> +        .name = "gbrp12le",
> +        .nb_components = 3,
> +        .log2_chroma_w = 0,
> +        .log2_chroma_h = 0,
> +        .comp = {
> +            { 2, 2, 0, 0, 12, 1, 11, 1 },        /* R */
> +            { 0, 2, 0, 0, 12, 1, 11, 1 },        /* G */
> +            { 1, 2, 0, 0, 12, 1, 11, 1 },        /* B */
> +        },
> +        .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
> +    },
> +    [AV_PIX_FMT_GBRP12BE] = {
> +        .name = "gbrp12be",
> +        .nb_components = 3,
> +        .log2_chroma_w = 0,
> +        .log2_chroma_h = 0,
> +        .comp = {
> +            { 2, 2, 0, 0, 12, 1, 11, 1 },        /* R */
> +            { 0, 2, 0, 0, 12, 1, 11, 1 },        /* G */
> +            { 1, 2, 0, 0, 12, 1, 11, 1 },        /* B */
> +        },
> +        .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
> +    },
>      [AV_PIX_FMT_GBRP16LE] = {
>          .name = "gbrp16le",
>          .nb_components = 3,
> @@ -1923,6 +1947,7 @@ enum AVPixelFormat av_pix_fmt_swap_endianness(enum AVPixelFormat pix_fmt)
>
>      PIX_FMT_SWAP_ENDIANNESS(GBRP9);
>      PIX_FMT_SWAP_ENDIANNESS(GBRP10);
> +    PIX_FMT_SWAP_ENDIANNESS(GBRP12);
>      PIX_FMT_SWAP_ENDIANNESS(GBRP16);
>      PIX_FMT_SWAP_ENDIANNESS(YUVA420P9);
>      PIX_FMT_SWAP_ENDIANNESS(YUVA422P9);
> diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
> index 3e040fb..473f53c 100644
> --- a/libavutil/pixfmt.h
> +++ b/libavutil/pixfmt.h
> @@ -239,6 +239,9 @@ enum AVPixelFormat {
>      AV_PIX_FMT_YUV444P12BE, ///< planar YUV 4:4:4, 36bpp, (1 Cr & Cb sample per 1x1 Y), big-endian
>      AV_PIX_FMT_YUV444P12LE, ///< planar YUV 4:4:4, 36bpp, (1 Cr & Cb sample per 1x1 Y), little-endian
>
> +    AV_PIX_FMT_GBRP12BE,  ///< planar GBR 4:4:4 36bpp, big-endian
> +    AV_PIX_FMT_GBRP12LE,  ///< planar GBR 4:4:4 36bpp, 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
>  };
>
> @@ -281,6 +284,7 @@ enum AVPixelFormat {
>
>  #define AV_PIX_FMT_GBRP9     AV_PIX_FMT_NE(GBRP9BE ,    GBRP9LE)
>  #define AV_PIX_FMT_GBRP10    AV_PIX_FMT_NE(GBRP10BE,    GBRP10LE)
> +#define AV_PIX_FMT_GBRP12    AV_PIX_FMT_NE(GBRP12BE,    GBRP12LE)
>  #define AV_PIX_FMT_GBRP16    AV_PIX_FMT_NE(GBRP16BE,    GBRP16LE)
>
>  #define AV_PIX_FMT_GBRAP16   AV_PIX_FMT_NE(GBRAP16BE,   GBRAP16LE)
> diff --git a/libavutil/version.h b/libavutil/version.h
> index 73de00e..7f7da80 100644
> --- a/libavutil/version.h
> +++ b/libavutil/version.h
> @@ -54,7 +54,7 @@
>   */
>
>  #define LIBAVUTIL_VERSION_MAJOR 55
> -#define LIBAVUTIL_VERSION_MINOR 23
> +#define LIBAVUTIL_VERSION_MINOR 24
>  #define LIBAVUTIL_VERSION_MICRO  0
>
>  #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
> --

the set looks good to me

Patch

diff --git a/doc/APIchanges b/doc/APIchanges
index 655783e..6b984f4 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,9 @@  libavutil:     2015-08-28
 
 API changes, most recent first:
 
+2016-xx-xx - xxxxxxx - lavu 55.24.0 - pixfmt.h
+  Add AV_PIX_FMT_GBRP12(LE/BE).
+
 2016-xx-xx - xxxxxxx - lavu 55.23.0 - hwcontext_vaapi.h
   Add AV_VAAPI_DRIVER_QUIRK_ATTRIB_MEMTYPE.
 
diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index 78fbdbc..38c9908 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -1514,6 +1514,30 @@  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_GBRP12LE] = {
+        .name = "gbrp12le",
+        .nb_components = 3,
+        .log2_chroma_w = 0,
+        .log2_chroma_h = 0,
+        .comp = {
+            { 2, 2, 0, 0, 12, 1, 11, 1 },        /* R */
+            { 0, 2, 0, 0, 12, 1, 11, 1 },        /* G */
+            { 1, 2, 0, 0, 12, 1, 11, 1 },        /* B */
+        },
+        .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
+    },
+    [AV_PIX_FMT_GBRP12BE] = {
+        .name = "gbrp12be",
+        .nb_components = 3,
+        .log2_chroma_w = 0,
+        .log2_chroma_h = 0,
+        .comp = {
+            { 2, 2, 0, 0, 12, 1, 11, 1 },        /* R */
+            { 0, 2, 0, 0, 12, 1, 11, 1 },        /* G */
+            { 1, 2, 0, 0, 12, 1, 11, 1 },        /* B */
+        },
+        .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
+    },
     [AV_PIX_FMT_GBRP16LE] = {
         .name = "gbrp16le",
         .nb_components = 3,
@@ -1923,6 +1947,7 @@  enum AVPixelFormat av_pix_fmt_swap_endianness(enum AVPixelFormat pix_fmt)
 
     PIX_FMT_SWAP_ENDIANNESS(GBRP9);
     PIX_FMT_SWAP_ENDIANNESS(GBRP10);
+    PIX_FMT_SWAP_ENDIANNESS(GBRP12);
     PIX_FMT_SWAP_ENDIANNESS(GBRP16);
     PIX_FMT_SWAP_ENDIANNESS(YUVA420P9);
     PIX_FMT_SWAP_ENDIANNESS(YUVA422P9);
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index 3e040fb..473f53c 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -239,6 +239,9 @@  enum AVPixelFormat {
     AV_PIX_FMT_YUV444P12BE, ///< planar YUV 4:4:4, 36bpp, (1 Cr & Cb sample per 1x1 Y), big-endian
     AV_PIX_FMT_YUV444P12LE, ///< planar YUV 4:4:4, 36bpp, (1 Cr & Cb sample per 1x1 Y), little-endian
 
+    AV_PIX_FMT_GBRP12BE,  ///< planar GBR 4:4:4 36bpp, big-endian
+    AV_PIX_FMT_GBRP12LE,  ///< planar GBR 4:4:4 36bpp, 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
 };
 
@@ -281,6 +284,7 @@  enum AVPixelFormat {
 
 #define AV_PIX_FMT_GBRP9     AV_PIX_FMT_NE(GBRP9BE ,    GBRP9LE)
 #define AV_PIX_FMT_GBRP10    AV_PIX_FMT_NE(GBRP10BE,    GBRP10LE)
+#define AV_PIX_FMT_GBRP12    AV_PIX_FMT_NE(GBRP12BE,    GBRP12LE)
 #define AV_PIX_FMT_GBRP16    AV_PIX_FMT_NE(GBRP16BE,    GBRP16LE)
 
 #define AV_PIX_FMT_GBRAP16   AV_PIX_FMT_NE(GBRAP16BE,   GBRAP16LE)
diff --git a/libavutil/version.h b/libavutil/version.h
index 73de00e..7f7da80 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -54,7 +54,7 @@ 
  */
 
 #define LIBAVUTIL_VERSION_MAJOR 55
-#define LIBAVUTIL_VERSION_MINOR 23
+#define LIBAVUTIL_VERSION_MINOR 24
 #define LIBAVUTIL_VERSION_MICRO  0
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \