[FFmpeg-cvslog] lavu/pix_fmt: add pixel format for x2bgr10

Manuel Stoeckl git at videolan.org
Sun Sep 26 18:19:16 EEST 2021


ffmpeg | branch: master | Manuel Stoeckl <code at mstoeckl.com> | Thu Sep 23 23:22:31 2021 -0400| [0760d9153c39e95e175c434e56916e7d950a4f03] | committer: Michael Niedermayer

lavu/pix_fmt: add pixel format for x2bgr10

The new format (given in big/little endian forms) matches the
existing X2RGB10 format, except with B and R channels switched.

AV_PIX_FMT_X2BGR10 data often is created by OpenGL programs
whose buffers use the GL_RGB10 internal format.

Signed-off-by: Manuel Stoeckl <code at mstoeckl.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0760d9153c39e95e175c434e56916e7d950a4f03
---

 doc/APIchanges                   |  3 +++
 libavutil/pixdesc.c              | 24 ++++++++++++++++++++++++
 libavutil/pixfmt.h               |  3 +++
 libavutil/version.h              |  2 +-
 tests/ref/fate/imgutils          |  2 ++
 tests/ref/fate/sws-pixdesc-query | 11 +++++++++++
 6 files changed, 44 insertions(+), 1 deletion(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 5b5c2a6f11..7b267a79ac 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -14,6 +14,9 @@ libavutil:     2021-04-27
 
 API changes, most recent first:
 
+2021-09-21 - xxxxxxxxxx - lavu 57.7.100 - pixfmt.h
+  Add AV_PIX_FMT_X2BGR10.
+
 2021-09-20 - xxxxxxxxxx - lavu 57.6.100 - mem.h
   Deprecate av_mallocz_array() as it is identical to av_calloc().
 
diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index 2346138d04..69cb198646 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -272,6 +272,30 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
         },
         .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BE,
     },
+    [AV_PIX_FMT_X2BGR10LE] = {
+        .name = "x2bgr10le",
+        .nb_components= 3,
+        .log2_chroma_w= 0,
+        .log2_chroma_h= 0,
+        .comp = {
+            { 0, 4, 0, 0, 10 },       /* R */
+            { 0, 4, 1, 2, 10 },       /* G */
+            { 0, 4, 2, 4, 10 },       /* B */
+        },
+        .flags = AV_PIX_FMT_FLAG_RGB,
+    },
+    [AV_PIX_FMT_X2BGR10BE] = {
+        .name = "x2bgr10be",
+        .nb_components= 3,
+        .log2_chroma_w= 0,
+        .log2_chroma_h= 0,
+        .comp = {
+            { 0, 4, 2, 0, 10 },       /* R */
+            { 0, 4, 1, 2, 10 },       /* G */
+            { 0, 4, 0, 4, 10 },       /* B */
+        },
+        .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BE,
+    },
     [AV_PIX_FMT_YUV422P] = {
         .name = "yuv422p",
         .nb_components = 3,
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index 5814f3f3da..53bdecfcb7 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -350,6 +350,8 @@ enum AVPixelFormat {
 
     AV_PIX_FMT_X2RGB10LE, ///< packed RGB 10:10:10, 30bpp, (msb)2X 10R 10G 10B(lsb), little-endian, X=unused/undefined
     AV_PIX_FMT_X2RGB10BE, ///< packed RGB 10:10:10, 30bpp, (msb)2X 10R 10G 10B(lsb), big-endian, X=unused/undefined
+    AV_PIX_FMT_X2BGR10LE, ///< packed BGR 10:10:10, 30bpp, (msb)2X 10B 10G 10R(lsb), little-endian, X=unused/undefined
+    AV_PIX_FMT_X2BGR10BE, ///< packed BGR 10:10:10, 30bpp, (msb)2X 10B 10G 10R(lsb), big-endian, X=unused/undefined
     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
 };
 
@@ -440,6 +442,7 @@ enum AVPixelFormat {
 
 #define AV_PIX_FMT_Y210       AV_PIX_FMT_NE(Y210BE,  Y210LE)
 #define AV_PIX_FMT_X2RGB10    AV_PIX_FMT_NE(X2RGB10BE, X2RGB10LE)
+#define AV_PIX_FMT_X2BGR10    AV_PIX_FMT_NE(X2BGR10BE, X2BGR10LE)
 
 /**
   * Chromaticity coordinates of the source primaries.
diff --git a/libavutil/version.h b/libavutil/version.h
index a62f73639b..896e348d80 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -79,7 +79,7 @@
  */
 
 #define LIBAVUTIL_VERSION_MAJOR  57
-#define LIBAVUTIL_VERSION_MINOR   6
+#define LIBAVUTIL_VERSION_MINOR   7
 #define LIBAVUTIL_VERSION_MICRO 100
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
diff --git a/tests/ref/fate/imgutils b/tests/ref/fate/imgutils
index f510150ea1..495bbd46f0 100644
--- a/tests/ref/fate/imgutils
+++ b/tests/ref/fate/imgutils
@@ -236,3 +236,5 @@ y210be          planes: 1, linesizes: 256   0   0   0, plane_sizes: 12288     0
 y210le          planes: 1, linesizes: 256   0   0   0, plane_sizes: 12288     0     0     0, plane_offsets:     0     0     0, total_size: 12288
 x2rgb10le       planes: 1, linesizes: 256   0   0   0, plane_sizes: 12288     0     0     0, plane_offsets:     0     0     0, total_size: 12288
 x2rgb10be       planes: 1, linesizes: 256   0   0   0, plane_sizes: 12288     0     0     0, plane_offsets:     0     0     0, total_size: 12288
+x2bgr10le       planes: 1, linesizes: 256   0   0   0, plane_sizes: 12288     0     0     0, plane_offsets:     0     0     0, total_size: 12288
+x2bgr10be       planes: 1, linesizes: 256   0   0   0, plane_sizes: 12288     0     0     0, plane_offsets:     0     0     0, total_size: 12288
diff --git a/tests/ref/fate/sws-pixdesc-query b/tests/ref/fate/sws-pixdesc-query
index c3cccfa492..a74109c3d7 100644
--- a/tests/ref/fate/sws-pixdesc-query
+++ b/tests/ref/fate/sws-pixdesc-query
@@ -57,6 +57,8 @@ isNBPS:
   nv20le
   p010be
   p010le
+  x2bgr10be
+  x2bgr10le
   x2rgb10be
   x2rgb10le
   xyz12be
@@ -143,6 +145,7 @@ isBE:
   rgb555be
   rgb565be
   rgba64be
+  x2bgr10be
   x2rgb10be
   xyz12be
   y210be
@@ -439,6 +442,8 @@ isRGB:
   rgb8
   rgba64be
   rgba64le
+  x2bgr10be
+  x2bgr10le
   x2rgb10be
   x2rgb10le
 
@@ -587,6 +592,8 @@ AnyRGB:
   rgb8
   rgba64be
   rgba64le
+  x2bgr10be
+  x2bgr10le
   x2rgb10be
   x2rgb10le
 
@@ -696,6 +703,8 @@ Packed:
   rgba64le
   uyvy422
   uyyvyy411
+  x2bgr10be
+  x2bgr10le
   x2rgb10be
   x2rgb10le
   xyz12be
@@ -862,6 +871,8 @@ PackedRGB:
   rgb8
   rgba64be
   rgba64le
+  x2bgr10be
+  x2bgr10le
   x2rgb10be
   x2rgb10le
 



More information about the ffmpeg-cvslog mailing list