diff mbox

[FFmpeg-devel] avutil: add P016 pixel format

Message ID 20161120215934.12774-1-philipl@overt.org
State Superseded
Headers show

Commit Message

Philip Langdale Nov. 20, 2016, 9:59 p.m. UTC
P016 is the 16-bit variant of NV12 (planar luma, packed chroma), using
two bytes per component.

It may, and in fact is most likely to, be used in situations where
there are less than 16 bits of data. It is the responsibility of
the writer to zero out any unused LSBs.

Signed-off-by: Philip Langdale <philipl@overt.org>
---
 libavutil/pixdesc.c | 24 ++++++++++++++++++++++++
 libavutil/pixfmt.h  |  3 +++
 2 files changed, 27 insertions(+)

Comments

Ronald S. Bultje Nov. 20, 2016, 10:13 p.m. UTC | #1
Hi,

On Sun, Nov 20, 2016 at 4:59 PM, Philip Langdale <philipl@overt.org> wrote:

> diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
> index 96860ce..4cd3a77 100644
> --- a/libavutil/pixfmt.h
> +++ b/libavutil/pixfmt.h
> @@ -297,6 +297,8 @@ 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_P016LE, ///< like NV12, with 16bpp per component,
> little-endian
> +    AV_PIX_FMT_P016BE, ///< like NV12, with 16bpp per component,
> big-endian
>
>      AV_PIX_FMT_GBRAP12BE,  ///< planar GBR 4:4:4:4 48bpp, big-endian
>      AV_PIX_FMT_GBRAP12LE,  ///< planar GBR 4:4:4:4 48bpp, little-endian


Doesn't this break ABI?

Ronald
Philip Langdale Nov. 20, 2016, 10:30 p.m. UTC | #2
On Sun, 20 Nov 2016 17:13:01 -0500
"Ronald S. Bultje" <rsbultje@gmail.com> wrote:

> Hi,
> 
> On Sun, Nov 20, 2016 at 4:59 PM, Philip Langdale <philipl@overt.org>
> wrote:
> 
> > diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
> > index 96860ce..4cd3a77 100644
> > --- a/libavutil/pixfmt.h
> > +++ b/libavutil/pixfmt.h
> > @@ -297,6 +297,8 @@ 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_P016LE, ///< like NV12, with 16bpp per component,
> > little-endian
> > +    AV_PIX_FMT_P016BE, ///< like NV12, with 16bpp per component,
> > big-endian
> >
> >      AV_PIX_FMT_GBRAP12BE,  ///< planar GBR 4:4:4:4 48bpp,
> > big-endian AV_PIX_FMT_GBRAP12LE,  ///< planar GBR 4:4:4:4 48bpp,
> > little-endian  
> 
> 
> Doesn't this break ABI?
> 
> Ronald

Yep. Whoops.

--phil
diff mbox

Patch

diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index f8092ef..3b9c45d 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -2078,6 +2078,30 @@  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_P016LE] = {
+        .name = "p016le",
+        .nb_components = 3,
+        .log2_chroma_w = 1,
+        .log2_chroma_h = 1,
+        .comp = {
+            { 0, 2, 0, 0, 16, 1, 15, 1 },       /* Y */
+            { 1, 4, 0, 0, 16, 3, 15, 1 },       /* U */
+            { 1, 4, 2, 0, 16, 3, 15, 3 },       /* V */
+        },
+        .flags = AV_PIX_FMT_FLAG_PLANAR,
+    },
+    [AV_PIX_FMT_P016BE] = {
+        .name = "p016be",
+        .nb_components = 3,
+        .log2_chroma_w = 1,
+        .log2_chroma_h = 1,
+        .comp = {
+            { 0, 2, 0, 0, 16, 1, 15, 1 },       /* Y */
+            { 1, 4, 0, 0, 16, 3, 15, 1 },       /* U */
+            { 1, 4, 2, 0, 16, 3, 15, 3 },       /* V */
+        },
+        .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE,
+    },
     [AV_PIX_FMT_GBRAP12LE] = {
         .name = "gbrap12le",
         .nb_components = 4,
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index 96860ce..4cd3a77 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -297,6 +297,8 @@  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_P016LE, ///< like NV12, with 16bpp per component, little-endian
+    AV_PIX_FMT_P016BE, ///< like NV12, with 16bpp per component, big-endian
 
     AV_PIX_FMT_GBRAP12BE,  ///< planar GBR 4:4:4:4 48bpp, big-endian
     AV_PIX_FMT_GBRAP12LE,  ///< planar GBR 4:4:4:4 48bpp, little-endian
@@ -389,6 +391,7 @@  enum AVPixelFormat {
 #define AV_PIX_FMT_NV20       AV_PIX_FMT_NE(NV20BE,  NV20LE)
 #define AV_PIX_FMT_AYUV64     AV_PIX_FMT_NE(AYUV64BE, AYUV64LE)
 #define AV_PIX_FMT_P010       AV_PIX_FMT_NE(P010BE,  P010LE)
+#define AV_PIX_FMT_P016       AV_PIX_FMT_NE(P016BE,  P016LE)
 
 /**
   * Chromaticity coordinates of the source primaries.