[FFmpeg-devel] [PATCH v1 1/2] lavu/pixfmt: add new pixel format a2r10g10b10/a2b10g10r10

Xinpeng Sun xinpeng.sun at intel.com
Wed Sep 25 05:45:43 EEST 2019


Add two 10 bit RGBA pixel format for hardware color space conversion
support in VAAPI and QSV:

2:10:10:10 10 bit: A2R10G10B10
2:10:10:10 10 bit: A2B10G10R10

Add query support in fate.

Signed-off-by: Xinpeng Sun <xinpeng.sun at intel.com>
---
 libavutil/pixdesc.c              | 26 ++++++++++++++++++++++++++
 libavutil/pixfmt.h               |  3 +++
 libavutil/version.h              |  2 +-
 tests/ref/fate/sws-pixdesc-query | 12 ++++++++++++
 4 files changed, 42 insertions(+), 1 deletion(-)

diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index 05dd4a1e20..0ea0332d1d 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -540,6 +540,32 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
         },
         .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
     },
+    [AV_PIX_FMT_A2R10G10B10] = {
+        .name = "a2r10g10b10",
+        .nb_components = 4,
+        .log2_chroma_w = 0,
+        .log2_chroma_h = 0,
+        .comp = {
+            { 0, 32, 20, 0, 10, 31, 9, 21 },       /* R */
+            { 0, 32, 10, 0, 10, 31, 9, 11 },       /* G */
+            { 0, 32,  0, 0, 10, 31, 9,  1 },       /* B */
+            { 0, 32, 30, 0,  2, 31, 1, 31 },       /* A */
+        },
+        .flags = AV_PIX_FMT_FLAG_BITSTREAM | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
+    },
+    [AV_PIX_FMT_A2B10G10R10] = {
+        .name = "a2b10g10r10",
+        .nb_components = 4,
+        .log2_chroma_w = 0,
+        .log2_chroma_h = 0,
+        .comp = {
+            { 0, 32,  0, 0, 10, 31, 9,  1 },       /* R */
+            { 0, 32, 10, 0, 10, 31, 9, 11 },       /* G */
+            { 0, 32, 20, 0, 10, 31, 9, 21 },       /* B */
+            { 0, 32, 30, 0,  2, 31, 1, 31 },       /* A */
+        },
+        .flags = AV_PIX_FMT_FLAG_BITSTREAM | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
+    },
     [AV_PIX_FMT_0RGB] = {
         .name = "0rgb",
         .nb_components= 3,
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index d78e863d4b..7ceaccd56e 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -348,6 +348,9 @@ enum AVPixelFormat {
     AV_PIX_FMT_NV24,      ///< planar YUV 4:4:4, 24bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (first byte U and the following byte V)
     AV_PIX_FMT_NV42,      ///< as above, but U and V bytes are swapped
 
+    AV_PIX_FMT_A2R10G10B10, ///packed ARGB 2:10:10:10, 32bpp, ARGBARGB...
+    AV_PIX_FMT_A2B10G10R10, ///packed ABGR 2:10:10:10, 32bpp, ABGRABGR...
+
     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
 };
 
diff --git a/libavutil/version.h b/libavutil/version.h
index 3395769857..af3abf7265 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -79,7 +79,7 @@
  */
 
 #define LIBAVUTIL_VERSION_MAJOR  56
-#define LIBAVUTIL_VERSION_MINOR  35
+#define LIBAVUTIL_VERSION_MINOR  36
 #define LIBAVUTIL_VERSION_MICRO 100
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
diff --git a/tests/ref/fate/sws-pixdesc-query b/tests/ref/fate/sws-pixdesc-query
index e23492293e..7316abab44 100644
--- a/tests/ref/fate/sws-pixdesc-query
+++ b/tests/ref/fate/sws-pixdesc-query
@@ -33,6 +33,8 @@ is16BPS:
   yuva444p16le
 
 isNBPS:
+  a2b10g10r10
+  a2r10g10b10
   gbrap10be
   gbrap10le
   gbrap12be
@@ -363,6 +365,8 @@ isSemiPlanarYUV:
 isRGB:
   0bgr
   0rgb
+  a2b10g10r10
+  a2r10g10b10
   bayer_bggr16be
   bayer_bggr16le
   bayer_bggr8
@@ -507,6 +511,8 @@ Bayer:
 AnyRGB:
   0bgr
   0rgb
+  a2b10g10r10
+  a2r10g10b10
   bayer_bggr16be
   bayer_bggr16le
   bayer_bggr8
@@ -579,6 +585,8 @@ AnyRGB:
   rgba64le
 
 ALPHA:
+  a2b10g10r10
+  a2r10g10b10
   ayuv64be
   ayuv64le
   bgr32
@@ -631,6 +639,8 @@ ALPHA:
 Packed:
   0bgr
   0rgb
+  a2b10g10r10
+  a2r10g10b10
   ayuv64be
   ayuv64le
   bayer_bggr16be
@@ -800,6 +810,8 @@ Planar:
 PackedRGB:
   0bgr
   0rgb
+  a2b10g10r10
+  a2r10g10b10
   bayer_bggr16be
   bayer_bggr16le
   bayer_bggr8
-- 
2.17.1



More information about the ffmpeg-devel mailing list