[FFmpeg-devel] [PATCH 1/2] lavu/pix_fmt: add rgbx64 and bgrx64 pixel formats
ffmpeg at mstoeckl.com
ffmpeg at mstoeckl.com
Mon Aug 22 02:12:47 EEST 2022
From: Manuel Stoeckl <code at mstoeckl.com>
These new formats are equivalent to rgba64 and bgra64, except
that the contents of the alpha channel are ignored.
These formats are equivalent to the Linux DRM formats XBGR16161616 and
XRGB16161616; these are used by Wayland compositors to either provide
high bit depth image data for a DRM plane, or receive such data from
applications. Programs that make video recordings of the screen or
individual windows on Wayland will encounter such formats; adding support
for them in libavutil will simplify such programs' implementations.
Signed-off-by: Manuel Stoeckl <code at mstoeckl.com>
---
doc/APIchanges | 3 ++
libavutil/pixdesc.c | 48 ++++++++++++++++++++++++++++++++
libavutil/pixfmt.h | 7 +++++
libavutil/version.h | 4 +--
tests/ref/fate/imgutils | 4 +++
tests/ref/fate/sws-pixdesc-query | 22 +++++++++++++++
6 files changed, 86 insertions(+), 2 deletions(-)
diff --git a/doc/APIchanges b/doc/APIchanges
index 2df65a521d..17aff90af7 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -14,6 +14,9 @@ libavutil: 2021-04-27
API changes, most recent first:
+2022-08-xx - xxxxxxxxxx - lavu 57.34.100 - pixfmt.h
+ Add AV_PIX_FMT_RGBX64 and AV_PIX_FMT_BGRX64 pixel formats.
+
2022-08-19 - 352799dca8 - lavc 59.42.102 - codec_id.h
Deprecate AV_CODEC_ID_AYUV and ayuv decoder/encoder. The rawvideo codec
and vuya pixel format combination will be used instead from now on.
diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index f7558ff8b9..c0f0234cad 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -1156,6 +1156,30 @@ 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_RGBX64BE] = {
+ .name = "rgbx64be",
+ .nb_components = 3,
+ .log2_chroma_w = 0,
+ .log2_chroma_h = 0,
+ .comp = {
+ { 0, 8, 0, 0, 16 }, /* R */
+ { 0, 8, 2, 0, 16 }, /* G */
+ { 0, 8, 4, 0, 16 }, /* B */
+ },
+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
+ },
+ [AV_PIX_FMT_RGBX64LE] = {
+ .name = "rgbx64le",
+ .nb_components = 3,
+ .log2_chroma_w = 0,
+ .log2_chroma_h = 0,
+ .comp = {
+ { 0, 8, 0, 0, 16 }, /* R */
+ { 0, 8, 2, 0, 16 }, /* G */
+ { 0, 8, 4, 0, 16 }, /* B */
+ },
+ .flags = AV_PIX_FMT_FLAG_RGB,
+ },
[AV_PIX_FMT_RGB565BE] = {
.name = "rgb565be",
.nb_components = 3,
@@ -1278,6 +1302,30 @@ 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_BGRX64BE] = {
+ .name = "bgrx64be",
+ .nb_components = 3,
+ .log2_chroma_w = 0,
+ .log2_chroma_h = 0,
+ .comp = {
+ { 0, 8, 4, 0, 16 }, /* R */
+ { 0, 8, 2, 0, 16 }, /* G */
+ { 0, 8, 0, 0, 16 }, /* B */
+ },
+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
+ },
+ [AV_PIX_FMT_BGRX64LE] = {
+ .name = "bgrx64le",
+ .nb_components = 3,
+ .log2_chroma_w = 0,
+ .log2_chroma_h = 0,
+ .comp = {
+ { 0, 8, 4, 0, 16 }, /* R */
+ { 0, 8, 2, 0, 16 }, /* G */
+ { 0, 8, 0, 0, 16 }, /* B */
+ },
+ .flags = AV_PIX_FMT_FLAG_RGB,
+ },
[AV_PIX_FMT_BGR565BE] = {
.name = "bgr565be",
.nb_components = 3,
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index 86c9bdefeb..2b8c2ffdd4 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -372,6 +372,11 @@ enum AVPixelFormat {
AV_PIX_FMT_RGBAF16BE, ///< IEEE-754 half precision packed RGBA 16:16:16:16, 64bpp, RGBARGBA..., big-endian
AV_PIX_FMT_RGBAF16LE, ///< IEEE-754 half precision packed RGBA 16:16:16:16, 64bpp, RGBARGBA..., little-endian
+ AV_PIX_FMT_RGBX64BE, ///< packed RGB 16:16:16, 64bpp, 16R, 16G, 16B, 16X, the 2-byte value for each R/G/B component is stored as big-endian
+ AV_PIX_FMT_RGBX64LE, ///< packed RGB 16:16:16, 64bpp, 16R, 16G, 16B, 16X, the 2-byte value for each R/G/B component is stored as little-endian
+ AV_PIX_FMT_BGRX64BE, ///< packed RGB 16:16:16, 64bpp, 16B, 16G, 16R, 16X, the 2-byte value for each R/G/B component is stored as big-endian
+ AV_PIX_FMT_BGRX64LE, ///< packed RGB 16:16:16, 64bpp, 16B, 16G, 16R, 16X, the 2-byte value for each R/G/B component is stored as 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
};
@@ -399,11 +404,13 @@ enum AVPixelFormat {
#define AV_PIX_FMT_RGB555 AV_PIX_FMT_NE(RGB555BE, RGB555LE)
#define AV_PIX_FMT_RGB444 AV_PIX_FMT_NE(RGB444BE, RGB444LE)
#define AV_PIX_FMT_RGBA64 AV_PIX_FMT_NE(RGBA64BE, RGBA64LE)
+#define AV_PIX_FMT_RGBX64 AV_PIX_FMT_NE(RGBX64BE, RGBX64LE)
#define AV_PIX_FMT_BGR48 AV_PIX_FMT_NE(BGR48BE, BGR48LE)
#define AV_PIX_FMT_BGR565 AV_PIX_FMT_NE(BGR565BE, BGR565LE)
#define AV_PIX_FMT_BGR555 AV_PIX_FMT_NE(BGR555BE, BGR555LE)
#define AV_PIX_FMT_BGR444 AV_PIX_FMT_NE(BGR444BE, BGR444LE)
#define AV_PIX_FMT_BGRA64 AV_PIX_FMT_NE(BGRA64BE, BGRA64LE)
+#define AV_PIX_FMT_BGRX64 AV_PIX_FMT_NE(BGRX64BE, BGRX64LE)
#define AV_PIX_FMT_YUV420P9 AV_PIX_FMT_NE(YUV420P9BE , YUV420P9LE)
#define AV_PIX_FMT_YUV422P9 AV_PIX_FMT_NE(YUV422P9BE , YUV422P9LE)
diff --git a/libavutil/version.h b/libavutil/version.h
index 05661922b3..5d0df781cc 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -79,8 +79,8 @@
*/
#define LIBAVUTIL_VERSION_MAJOR 57
-#define LIBAVUTIL_VERSION_MINOR 33
-#define LIBAVUTIL_VERSION_MICRO 101
+#define LIBAVUTIL_VERSION_MINOR 34
+#define LIBAVUTIL_VERSION_MICRO 100
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
LIBAVUTIL_VERSION_MINOR, \
diff --git a/tests/ref/fate/imgutils b/tests/ref/fate/imgutils
index 01c9877de5..7661f2cdaa 100644
--- a/tests/ref/fate/imgutils
+++ b/tests/ref/fate/imgutils
@@ -249,3 +249,7 @@ p416le planes: 2, linesizes: 128 256 0 0, plane_sizes: 6144 12288
vuya planes: 1, linesizes: 256 0 0 0, plane_sizes: 12288 0 0 0, plane_offsets: 0 0 0, total_size: 12288
rgbaf16be planes: 1, linesizes: 512 0 0 0, plane_sizes: 24576 0 0 0, plane_offsets: 0 0 0, total_size: 24576
rgbaf16le planes: 1, linesizes: 512 0 0 0, plane_sizes: 24576 0 0 0, plane_offsets: 0 0 0, total_size: 24576
+rgbx64be planes: 1, linesizes: 512 0 0 0, plane_sizes: 24576 0 0 0, plane_offsets: 0 0 0, total_size: 24576
+rgbx64le planes: 1, linesizes: 512 0 0 0, plane_sizes: 24576 0 0 0, plane_offsets: 0 0 0, total_size: 24576
+bgrx64be planes: 1, linesizes: 512 0 0 0, plane_sizes: 24576 0 0 0, plane_offsets: 0 0 0, total_size: 24576
+bgrx64le planes: 1, linesizes: 512 0 0 0, plane_sizes: 24576 0 0 0, plane_offsets: 0 0 0, total_size: 24576
diff --git a/tests/ref/fate/sws-pixdesc-query b/tests/ref/fate/sws-pixdesc-query
index f79d99e513..02cc1bf916 100644
--- a/tests/ref/fate/sws-pixdesc-query
+++ b/tests/ref/fate/sws-pixdesc-query
@@ -5,6 +5,8 @@ is16BPS:
bgr48le
bgra64be
bgra64le
+ bgrx64be
+ bgrx64le
gbrap16be
gbrap16le
gbrp16be
@@ -23,6 +25,8 @@ is16BPS:
rgba64le
rgbaf16be
rgbaf16le
+ rgbx64be
+ rgbx64le
ya16be
ya16le
yuv420p16be
@@ -131,6 +135,7 @@ isBE:
bgr555be
bgr565be
bgra64be
+ bgrx64be
gbrap10be
gbrap12be
gbrap16be
@@ -160,6 +165,7 @@ isBE:
rgb565be
rgba64be
rgbaf16be
+ rgbx64be
x2bgr10be
x2rgb10be
xyz12be
@@ -443,6 +449,8 @@ isRGB:
bgr8
bgra64be
bgra64le
+ bgrx64be
+ bgrx64le
gbrap
gbrap10be
gbrap10le
@@ -484,6 +492,8 @@ isRGB:
rgba64le
rgbaf16be
rgbaf16le
+ rgbx64be
+ rgbx64le
x2bgr10be
x2bgr10le
x2rgb10be
@@ -593,6 +603,8 @@ AnyRGB:
bgr8
bgra64be
bgra64le
+ bgrx64be
+ bgrx64le
gbrap
gbrap10be
gbrap10le
@@ -636,6 +648,8 @@ AnyRGB:
rgba64le
rgbaf16be
rgbaf16le
+ rgbx64be
+ rgbx64le
x2bgr10be
x2bgr10le
x2rgb10be
@@ -728,6 +742,8 @@ Packed:
bgr8
bgra64be
bgra64le
+ bgrx64be
+ bgrx64le
monob
monow
pal8
@@ -750,6 +766,8 @@ Packed:
rgba64le
rgbaf16be
rgbaf16le
+ rgbx64be
+ rgbx64le
uyvy422
uyyvyy411
vuya
@@ -912,6 +930,8 @@ PackedRGB:
bgr8
bgra64be
bgra64le
+ bgrx64be
+ bgrx64le
rgb0
rgb24
rgb32
@@ -931,6 +951,8 @@ PackedRGB:
rgba64le
rgbaf16be
rgbaf16le
+ rgbx64be
+ rgbx64le
x2bgr10be
x2bgr10le
x2rgb10be
--
2.37.2
More information about the ffmpeg-devel
mailing list