[FFmpeg-devel] [UGLY] [PATCH] swscale: add float pixel format

Paul B Mahol onemda at gmail.com
Wed Oct 9 15:10:10 CEST 2013


Signed-off-by: Paul B Mahol <onemda at gmail.com>
---
 libavutil/pixdesc.c | 26 ++++++++++++++++++++++++++
 libavutil/pixdesc.h |  5 +++++
 libavutil/pixfmt.h  |  3 +++
 3 files changed, 34 insertions(+)

diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index 9a33000..3def37c 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -1842,6 +1842,32 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
         },
         .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE,
     },
+    [AV_PIX_FMT_FLOAT_RGBA32BE] = {
+        .name = "rgbaf32be",
+        .nb_components = 4,
+        .log2_chroma_w = 0,
+        .log2_chroma_h = 0,
+        .comp = {
+            { 0, 0, 1, 0, 31 },        /* R */
+            { 1, 1, 1, 0, 31 },        /* G */
+            { 2, 1, 1, 0, 31 },        /* B */
+            { 3, 1, 1, 0, 31 },        /* A */
+        },
+        .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_FLOAT, AV_PIX_FMT_FLAG_BE,
+    },
+    [AV_PIX_FMT_FLOAT_RGBA32LE] = {
+        .name = "rgbaf32le",
+        .nb_components = 4,
+        .log2_chroma_w = 0,
+        .log2_chroma_h = 0,
+        .comp = {
+            { 0, 0, 1, 0, 31 },        /* R */
+            { 1, 1, 1, 0, 31 },        /* G */
+            { 2, 1, 1, 0, 31 },        /* B */
+            { 3, 1, 1, 0, 31 },        /* A */
+        },
+        .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_FLOAT,
+    },
 };
 
 FF_DISABLE_DEPRECATION_WARNINGS
diff --git a/libavutil/pixdesc.h b/libavutil/pixdesc.h
index e88bf9b..75da779 100644
--- a/libavutil/pixdesc.h
+++ b/libavutil/pixdesc.h
@@ -123,6 +123,11 @@ typedef struct AVPixFmtDescriptor{
  */
 #define AV_PIX_FMT_FLAG_ALPHA        (1 << 7)
 
+/**
+ * The pixel format contains float data.
+ */
+#define AV_PIX_FMT_FLAG_FLOAT        (1 << 30)
+
 #if FF_API_PIX_FMT
 /**
  * @deprecated use the AV_PIX_FMT_FLAG_* flags
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index 1b9e142..ecef1c0 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -261,6 +261,9 @@ enum AVPixelFormat {
     AV_PIX_FMT_BAYER_GRBG16LE, ///< bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, little-endian */
     AV_PIX_FMT_BAYER_GRBG16BE, ///< bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, big-endian */
 
+    AV_PIX_FMT_FLOAT_RGBA32BE, ///< planar float RGBA 4:4:4:4 128bpp, 32-bit float, big-endian
+    AV_PIX_FMT_FLOAT_RGBA32LE, ///< planar float RGBA 4:4:4:4 128bpp, 32-bit float, 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
 
 #if FF_API_PIX_FMT
-- 
1.7.11.2



More information about the ffmpeg-devel mailing list