[FFmpeg-devel] [PATCH] Add YUV444 32bit floating point pixel format
Vittorio Giovara
vittorio.giovara at gmail.com
Thu Jul 20 18:46:59 EEST 2017
With and without alpha.
---
Updated with fate tests.
Vittorio
libavutil/pixdesc.c | 51 ++++++++++++++++++++++++++++++++++++++++
libavutil/pixdesc.h | 5 ++++
libavutil/pixfmt.h | 7 ++++++
libswscale/utils.c | 4 ++++
tests/ref/fate/sws-pixdesc-query | 16 +++++++++++++
5 files changed, 83 insertions(+)
diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index 1983ce9ef5..2175b9d799 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -2162,6 +2162,57 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
.name = "d3d11",
.flags = AV_PIX_FMT_FLAG_HWACCEL,
},
+ [AV_PIX_FMT_YUV444F32LE] = {
+ .name = "yuv444f32le",
+ .nb_components = 3,
+ .log2_chroma_w = 0,
+ .log2_chroma_h = 0,
+ .comp = {
+ { 0, 4, 0, 0, 32, 3, 31, 1 }, /* Y */
+ { 1, 4, 0, 0, 32, 3, 31, 1 }, /* U */
+ { 2, 4, 0, 0, 32, 3, 31, 1 }, /* V */
+ },
+ .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_FLOAT,
+ },
+ [AV_PIX_FMT_YUV444F32BE] = {
+ .name = "yuv444f32be",
+ .nb_components = 3,
+ .log2_chroma_w = 0,
+ .log2_chroma_h = 0,
+ .comp = {
+ { 0, 4, 0, 0, 32, 3, 31, 1 }, /* Y */
+ { 1, 4, 0, 0, 32, 3, 31, 1 }, /* U */
+ { 2, 4, 0, 0, 32, 3, 31, 1 }, /* V */
+ },
+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_FLOAT,
+ },
+ [AV_PIX_FMT_YUVA444F32LE] = {
+ .name = "yuva444f32le",
+ .nb_components = 4,
+ .log2_chroma_w = 0,
+ .log2_chroma_h = 0,
+ .comp = {
+ { 0, 4, 0, 0, 32, 3, 31, 1 }, /* Y */
+ { 1, 4, 0, 0, 32, 3, 31, 1 }, /* U */
+ { 2, 4, 0, 0, 32, 3, 31, 1 }, /* V */
+ { 3, 4, 0, 0, 32, 3, 31, 1 }, /* A */
+ },
+ .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_FLOAT | AV_PIX_FMT_FLAG_ALPHA,
+ },
+ [AV_PIX_FMT_YUVA444F32BE] = {
+ .name = "yuva444f32be",
+ .nb_components = 4,
+ .log2_chroma_w = 0,
+ .log2_chroma_h = 0,
+ .comp = {
+ { 0, 4, 0, 0, 32, 3, 31, 1 }, /* Y */
+ { 1, 4, 0, 0, 32, 3, 31, 1 }, /* U */
+ { 2, 4, 0, 0, 32, 3, 31, 1 }, /* V */
+ { 3, 4, 0, 0, 32, 3, 31, 1 }, /* A */
+ },
+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
+ AV_PIX_FMT_FLAG_FLOAT | AV_PIX_FMT_FLAG_ALPHA,
+ },
};
#if FF_API_PLUS1_MINUS1
FF_ENABLE_DEPRECATION_WARNINGS
diff --git a/libavutil/pixdesc.h b/libavutil/pixdesc.h
index c3a6f27f49..294555260a 100644
--- a/libavutil/pixdesc.h
+++ b/libavutil/pixdesc.h
@@ -178,6 +178,11 @@ typedef struct AVPixFmtDescriptor {
#define AV_PIX_FMT_FLAG_BAYER (1 << 8)
/**
+ * The pixel format contains IEEE-754 single precision floating point values.
+ */
+#define AV_PIX_FMT_FLAG_FLOAT (1 << 10)
+
+/**
* Return the number of bits per pixel used by the pixel format
* described by pixdesc. Note that this is not the same as the number
* of bits per sample.
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index e1e4074bee..d6a874da15 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -326,6 +326,11 @@ enum AVPixelFormat {
*/
AV_PIX_FMT_D3D11,
+ AV_PIX_FMT_YUV444F32LE, ///< IEEE-754 single precision planar YUV 4:4:4, 96bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
+ AV_PIX_FMT_YUV444F32BE, ///< IEEE-754 single precision planar YUV 4:4:4, 96bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
+ AV_PIX_FMT_YUVA444F32LE, ///< IEEE-754 single precision planar YUV 4:4:4, 128bpp, (1 Cr & Cb sample per 1x1 Y & A sample), little-endian
+ AV_PIX_FMT_YUVA444F32BE, ///< IEEE-754 single precision planar YUV 4:4:4, 128bpp, (1 Cr & Cb sample per 1x1 Y & A sample), big-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
};
@@ -389,6 +394,8 @@ enum AVPixelFormat {
#define AV_PIX_FMT_BAYER_GBRG16 AV_PIX_FMT_NE(BAYER_GBRG16BE, BAYER_GBRG16LE)
#define AV_PIX_FMT_BAYER_GRBG16 AV_PIX_FMT_NE(BAYER_GRBG16BE, BAYER_GRBG16LE)
+#define AV_PIX_FMT_YUV444F32 AV_PIX_FMT_NE(YUV444F32BE, YUV444F32LE)
+#define AV_PIX_FMT_YUVA444F32 AV_PIX_FMT_NE(YUVA444F32BE, YUVA444F32LE)
#define AV_PIX_FMT_YUVA420P9 AV_PIX_FMT_NE(YUVA420P9BE , YUVA420P9LE)
#define AV_PIX_FMT_YUVA422P9 AV_PIX_FMT_NE(YUVA422P9BE , YUVA422P9LE)
diff --git a/libswscale/utils.c b/libswscale/utils.c
index 17c996734a..892b219049 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -254,6 +254,10 @@ static const FormatEntry format_entries[AV_PIX_FMT_NB] = {
[AV_PIX_FMT_P010BE] = { 1, 1 },
[AV_PIX_FMT_P016LE] = { 1, 0 },
[AV_PIX_FMT_P016BE] = { 1, 0 },
+ [AV_PIX_FMT_YUV444F32LE] = { 0, 0 },
+ [AV_PIX_FMT_YUV444F32BE] = { 0, 0 },
+ [AV_PIX_FMT_YUVA444F32LE] = { 0, 0 },
+ [AV_PIX_FMT_YUVA444F32BE] = { 0, 0 },
};
int sws_isSupportedInput(enum AVPixelFormat pix_fmt)
diff --git a/tests/ref/fate/sws-pixdesc-query b/tests/ref/fate/sws-pixdesc-query
index e262a0cabf..7f2fc557d6 100644
--- a/tests/ref/fate/sws-pixdesc-query
+++ b/tests/ref/fate/sws-pixdesc-query
@@ -154,6 +154,8 @@ isBE:
gray12be
gray10be
p016be
+ yuv444f32be
+ yuva444f32be
isYUV:
yuv420p
@@ -242,6 +244,10 @@ isYUV:
p010be
p016le
p016be
+ yuv444f32le
+ yuv444f32be
+ yuva444f32le
+ yuva444f32be
isPlanarYUV:
yuv420p
@@ -319,6 +325,10 @@ isPlanarYUV:
p010be
p016le
p016be
+ yuv444f32le
+ yuv444f32be
+ yuva444f32le
+ yuva444f32be
isRGB:
rgb24
@@ -567,6 +577,8 @@ ALPHA:
gbrap12le
gbrap10be
gbrap10le
+ yuva444f32le
+ yuva444f32be
Packed:
yuyv422
@@ -726,6 +738,10 @@ Planar:
gbrap10le
p016le
p016be
+ yuv444f32le
+ yuv444f32be
+ yuva444f32le
+ yuva444f32be
PackedRGB:
rgb24
--
2.13.2
More information about the ffmpeg-devel
mailing list