[FFmpeg-devel] [PATCH v4 2/3] avutil: add RGBF16 pix_fmt
Martin Schitter
ms+git at mur.at
Mon Oct 14 11:33:11 EEST 2024
---
libavutil/pixdesc.c | 25 +++++++++++++++++++++++++
libavutil/pixfmt.h | 4 ++++
libavutil/version.h | 2 +-
tests/ref/fate/imgutils | 4 ++++
tests/ref/fate/sws-pixdesc-query | 11 +++++++++++
5 files changed, 45 insertions(+), 1 deletion(-)
diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index 43b9c08..e73600f 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -2630,6 +2630,31 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 0, 4, 0, 0, 8 }, /* V */
},
},
+ [AV_PIX_FMT_RGBF16BE] = {
+ .name = "rgbf16be",
+ .nb_components = 3,
+ .log2_chroma_w = 0,
+ .log2_chroma_h = 0,
+ .comp = {
+ { 0, 6, 0, 0, 16 }, /* R */
+ { 0, 6, 2, 0, 16 }, /* G */
+ { 0, 6, 4, 0, 16 }, /* B */
+ },
+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB |
+ AV_PIX_FMT_FLAG_FLOAT,
+ },
+ [AV_PIX_FMT_RGBF16LE] = {
+ .name = "rgbf16le",
+ .nb_components = 3,
+ .log2_chroma_w = 0,
+ .log2_chroma_h = 0,
+ .comp = {
+ { 0, 6, 0, 0, 16 }, /* R */
+ { 0, 6, 2, 0, 16 }, /* G */
+ { 0, 6, 4, 0, 16 }, /* B */
+ },
+ .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_FLOAT
+ },
[AV_PIX_FMT_RGBAF16BE] = {
.name = "rgbaf16be",
.nb_components = 4,
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index 3caa183..21564b9 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -448,6 +448,9 @@ enum AVPixelFormat {
AV_PIX_FMT_V30XBE, ///< packed VYUX 4:4:4 like XV30, 32bpp, (msb)10V 10Y 10U 2X(lsb), big-endian
AV_PIX_FMT_V30XLE, ///< packed VYUX 4:4:4 like XV30, 32bpp, (msb)10V 10Y 10U 2X(lsb), little-endian
+ AV_PIX_FMT_RGBF16BE, ///< IEEE-754 half precision packed RGB 16:16:16, 48bpp, RGBRGB..., big-endian
+ AV_PIX_FMT_RGBF16LE, ///< IEEE-754 half precision packed RGB 16:16:16, 48bpp, RGBRGB..., 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
};
@@ -553,6 +556,7 @@ enum AVPixelFormat {
#define AV_PIX_FMT_P216 AV_PIX_FMT_NE(P216BE, P216LE)
#define AV_PIX_FMT_P416 AV_PIX_FMT_NE(P416BE, P416LE)
+#define AV_PIX_FMT_RGBF16 AV_PIX_FMT_NE(RGBF16BE, RGBF16LE)
#define AV_PIX_FMT_RGBAF16 AV_PIX_FMT_NE(RGBAF16BE, RGBAF16LE)
#define AV_PIX_FMT_RGBF32 AV_PIX_FMT_NE(RGBF32BE, RGBF32LE)
diff --git a/libavutil/version.h b/libavutil/version.h
index 7eca46c..772addf 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -79,7 +79,7 @@
*/
#define LIBAVUTIL_VERSION_MAJOR 59
-#define LIBAVUTIL_VERSION_MINOR 42
+#define LIBAVUTIL_VERSION_MINOR 43
#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 fd5a510..4c91358 100644
--- a/tests/ref/fate/imgutils
+++ b/tests/ref/fate/imgutils
@@ -274,6 +274,8 @@ uyva planes: 1, linesizes: 256 0 0 0, plane_sizes: 12288 0
vyu444 planes: 1, linesizes: 192 0 0 0, plane_sizes: 9216 0 0 0, plane_offsets: 0 0 0, total_size: 9216
v30xbe planes: 1, linesizes: 256 0 0 0, plane_sizes: 12288 0 0 0, plane_offsets: 0 0 0, total_size: 12288
v30xle planes: 1, linesizes: 256 0 0 0, plane_sizes: 12288 0 0 0, plane_offsets: 0 0 0, total_size: 12288
+rgbf16be planes: 1, linesizes: 384 0 0 0, plane_sizes: 18432 0 0 0, plane_offsets: 0 0 0, total_size: 18432
+rgbf16le planes: 1, linesizes: 384 0 0 0, plane_sizes: 18432 0 0 0, plane_offsets: 0 0 0, total_size: 18432
image_fill_black tests
yuv420p total_size: 4608, black_unknown_crc: 0xd00f6cc6, black_tv_crc: 0xd00f6cc6, black_pc_crc: 0x234969af
@@ -495,3 +497,5 @@ uyva total_size: 12288, black_unknown_crc: 0xdd657297, black_tv_cr
vyu444 total_size: 9216, black_unknown_crc: 0x575e6fb1, black_tv_crc: 0x575e6fb1, black_pc_crc: 0x16564599
v30xbe total_size: 12288, black_unknown_crc: 0x7108457c, black_tv_crc: 0x7108457c, black_pc_crc: 0xdefcbbe0
v30xle total_size: 12288, black_unknown_crc: 0xf5b3c795, black_tv_crc: 0xf5b3c795, black_pc_crc: 0x0b56173c
+rgbf16be total_size: 18432, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000
+rgbf16le total_size: 18432, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000
diff --git a/tests/ref/fate/sws-pixdesc-query b/tests/ref/fate/sws-pixdesc-query
index f153ed3..ae206ce 100644
--- a/tests/ref/fate/sws-pixdesc-query
+++ b/tests/ref/fate/sws-pixdesc-query
@@ -23,6 +23,8 @@ is16BPS:
rgba64le
rgbaf16be
rgbaf16le
+ rgbf16be
+ rgbf16le
ya16be
ya16le
yuv420p16be
@@ -181,6 +183,7 @@ isBE:
rgba64be
rgbaf16be
rgbaf32be
+ rgbf16be
rgbf32be
v30xbe
x2bgr10be
@@ -544,6 +547,8 @@ isRGB:
rgbaf16le
rgbaf32be
rgbaf32le
+ rgbf16be
+ rgbf16le
rgbf32be
rgbf32le
x2bgr10be
@@ -702,6 +707,8 @@ AnyRGB:
rgbaf16le
rgbaf32be
rgbaf32le
+ rgbf16be
+ rgbf16le
rgbf32be
rgbf32le
x2bgr10be
@@ -827,6 +834,8 @@ Packed:
rgbaf16le
rgbaf32be
rgbaf32le
+ rgbf16be
+ rgbf16le
rgbf32be
rgbf32le
uyva
@@ -1031,6 +1040,8 @@ PackedRGB:
rgbaf16le
rgbaf32be
rgbaf32le
+ rgbf16be
+ rgbf16le
rgbf32be
rgbf32le
x2bgr10be
--
2.45.2
More information about the ffmpeg-devel
mailing list