[FFmpeg-devel] [PATCH 1/7] lavu/pixfmt: add AV_PIX_FMT_RGBA32
Lynne
dev at lynne.ee
Thu Oct 10 08:32:45 EEST 2024
This format is useful for doing certain lossless transforms on images,
RCT in particular, which require you to escalate the size from 16 to
32 bits to avoid overflows.
APIchanges will be done alongside when comitting.
---
libavutil/pixdesc.c | 27 +++++++++++++++++++++++++++
libavutil/pixfmt.h | 4 ++++
2 files changed, 31 insertions(+)
diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index f8d6055084..7174989072 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -2803,6 +2803,33 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
.flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_FLOAT |
AV_PIX_FMT_FLAG_ALPHA,
},
+ [AV_PIX_FMT_RGBA32BE] = {
+ .name = "rgba32be",
+ .nb_components = 4,
+ .log2_chroma_w = 0,
+ .log2_chroma_h = 0,
+ .comp = {
+ { 0, 16, 0, 0, 32 }, /* R */
+ { 0, 16, 4, 0, 32 }, /* G */
+ { 0, 16, 8, 0, 32 }, /* B */
+ { 0, 16, 12, 0, 32 }, /* A */
+ },
+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB |
+ AV_PIX_FMT_FLAG_ALPHA,
+ },
+ [AV_PIX_FMT_RGBA32LE] = {
+ .name = "rgba32le",
+ .nb_components = 4,
+ .log2_chroma_w = 0,
+ .log2_chroma_h = 0,
+ .comp = {
+ { 0, 16, 0, 0, 32 }, /* R */
+ { 0, 16, 4, 0, 32 }, /* G */
+ { 0, 16, 8, 0, 32 }, /* B */
+ { 0, 16, 12, 0, 32 }, /* A */
+ },
+ .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
+ },
[AV_PIX_FMT_P212BE] = {
.name = "p212be",
.nb_components = 3,
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index 3caa183ba0..af06d8dcac 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_RGBA32BE, ///< packed RGBA 32:32:32:32, 128bpp, RGBARGBA..., big-endian
+ AV_PIX_FMT_RGBA32LE, ///< packed RGBA 32:32:32:32, 128bpp, RGBARGBA..., 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
};
@@ -557,6 +560,7 @@ enum AVPixelFormat {
#define AV_PIX_FMT_RGBF32 AV_PIX_FMT_NE(RGBF32BE, RGBF32LE)
#define AV_PIX_FMT_RGBAF32 AV_PIX_FMT_NE(RGBAF32BE, RGBAF32LE)
+#define AV_PIX_FMT_RGBA32 AV_PIX_FMT_NE(RGBA32BE, RGBA32LE)
/**
* Chromaticity coordinates of the source primaries.
--
2.45.2.753.g447d99e1c3b
More information about the ffmpeg-devel
mailing list