PR #25883 opened by James Almer (jamrial)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25883
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25883.patch


>From 62de9256216027b3d6c8d5a58533e1b9593e52d6 Mon Sep 17 00:00:00 2001
From: James Almer <[email protected]>
Date: Sun, 8 Nov 2026 23:23:25 -0300
Subject: [PATCH 1/7] avfilter/vf_transpose: only check the available planes
 when setting transpose function pointers

And refuse unsupported values.

Signed-off-by: James Almer <[email protected]>
---
 libavfilter/vf_transpose.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavfilter/vf_transpose.c b/libavfilter/vf_transpose.c
index 62c222f3c22..b12e0bb53df 100644
--- a/libavfilter/vf_transpose.c
+++ b/libavfilter/vf_transpose.c
@@ -219,7 +219,7 @@ static int config_props_output(AVFilterLink *outlink)
     else
         outlink->sample_aspect_ratio = inlink->sample_aspect_ratio;
 
-    for (int i = 0; i < 4; i++) {
+    for (int i = 0; i < s->planes; i++) {
         TransVtable *v = &s->vtables[i];
         switch (s->pixsteps[i]) {
         case 1: v->transpose_block = transpose_block_8_c;
@@ -234,6 +234,8 @@ static int config_props_output(AVFilterLink *outlink)
                 v->transpose_8x8   = transpose_8x8_48_c; break;
         case 8: v->transpose_block = transpose_block_64_c;
                 v->transpose_8x8   = transpose_8x8_64_c; break;
+        default:
+            return AVERROR_BUG;
         }
     }
 
-- 
2.54.0


>From 5a8cc95a05c028c64db0fdfb2a92364cdbcf1705 Mon Sep 17 00:00:00 2001
From: James Almer <[email protected]>
Date: Sun, 8 Nov 2026 23:24:27 -0300
Subject: [PATCH 2/7] avfilter/vf_transpose: support packed formats with 96 and
 128 bytes per pixel

Will be needed by a following change.

Signed-off-by: James Almer <[email protected]>
---
 libavfilter/vf_transpose.c | 43 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/libavfilter/vf_transpose.c b/libavfilter/vf_transpose.c
index b12e0bb53df..8b858d0f45a 100644
--- a/libavfilter/vf_transpose.c
+++ b/libavfilter/vf_transpose.c
@@ -176,6 +176,45 @@ static void transpose_8x8_64_c(uint8_t *src, ptrdiff_t 
src_linesize,
     transpose_block_64_c(src, src_linesize, dst, dst_linesize, 8, 8);
 }
 
+static inline void transpose_block_96_c(uint8_t *src, ptrdiff_t src_linesize,
+                                        uint8_t *dst, ptrdiff_t dst_linesize,
+                                        int w, int h)
+{
+    int x, y;
+    for (y = 0; y < h; y++, dst += dst_linesize, src += 12) {
+        for (x = 0; x < w; x++) {
+            int64_t v1 = AV_RB48(src + x*src_linesize);
+            int64_t v2 = AV_RB48(src + 6 + x*src_linesize);
+            AV_WB48(dst + 12*x, v1);
+            AV_WB48(dst + 6 + 12*x, v2);
+        }
+    }
+}
+
+static void transpose_8x8_96_c(uint8_t *src, ptrdiff_t src_linesize,
+                               uint8_t *dst, ptrdiff_t dst_linesize)
+{
+    transpose_block_96_c(src, src_linesize, dst, dst_linesize, 8, 8);
+}
+
+static inline void transpose_block_128_c(uint8_t *src, ptrdiff_t src_linesize,
+                                         uint8_t *dst, ptrdiff_t dst_linesize,
+                                         int w, int h)
+{
+    int x, y;
+    for (y = 0; y < h; y++, dst += dst_linesize, src += 16) {
+        for (x = 0; x < w; x++) {
+            AV_COPY128U(dst + 16*x, src + x*src_linesize);
+        }
+    }
+}
+
+static void transpose_8x8_128_c(uint8_t *src, ptrdiff_t src_linesize,
+                                uint8_t *dst, ptrdiff_t dst_linesize)
+{
+    transpose_block_128_c(src, src_linesize, dst, dst_linesize, 8, 8);
+}
+
 static int config_props_output(AVFilterLink *outlink)
 {
     AVFilterContext *ctx = outlink->src;
@@ -234,6 +273,10 @@ static int config_props_output(AVFilterLink *outlink)
                 v->transpose_8x8   = transpose_8x8_48_c; break;
         case 8: v->transpose_block = transpose_block_64_c;
                 v->transpose_8x8   = transpose_8x8_64_c; break;
+        case 12: v->transpose_block = transpose_block_96_c;
+                 v->transpose_8x8   = transpose_8x8_96_c; break;
+        case 16: v->transpose_block = transpose_block_128_c;
+                 v->transpose_8x8   = transpose_8x8_128_c; break;
         default:
             return AVERROR_BUG;
         }
-- 
2.54.0


>From 11ba37a9eb0b3626f83d871355f43fad023961d6 Mon Sep 17 00:00:00 2001
From: James Almer <[email protected]>
Date: Sun, 8 Nov 2026 23:24:44 -0300
Subject: [PATCH 3/7] avfilter/vf_hflip_init: support packed formats with 96
 and 128 bytes per pixel

Will be needed by a following change.

Signed-off-by: James Almer <[email protected]>
---
 libavfilter/vf_hflip_init.h | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/libavfilter/vf_hflip_init.h b/libavfilter/vf_hflip_init.h
index 97cde15b2fc..9cf1388e63b 100644
--- a/libavfilter/vf_hflip_init.h
+++ b/libavfilter/vf_hflip_init.h
@@ -87,6 +87,30 @@ static void hflip_qword_c(const uint8_t *ssrc, uint8_t 
*ddst, int w)
         dst[j] = src[-j];
 }
 
+static void hflip_b96_c(const uint8_t *src, uint8_t *dst, int w)
+{
+    const uint8_t *in  = src;
+    uint8_t *out = dst;
+
+    for (int j = 0; j < w; j++, out += 12, in -= 12) {
+        int64_t v1 = AV_RB48(in);
+        int64_t v2 = AV_RB48(in+6);
+
+        AV_WB48(out, v1);
+        AV_WB48(out+6, v2);
+    }
+}
+
+static void hflip_dqword_c(const uint8_t *src, uint8_t *dst, int w)
+{
+    const uint8_t *in  = src;
+    uint8_t *out = dst;
+
+    for (int j = 0; j < w; j++, out += 16, in -= 16) {
+        AV_COPY128U(out, in);
+    }
+}
+
 av_unused static int ff_hflip_init(FlipContext *s, int step[4], int nb_planes)
 {
     for (int i = 0; i < nb_planes; i++) {
@@ -98,6 +122,8 @@ av_unused static int ff_hflip_init(FlipContext *s, int 
step[4], int nb_planes)
         case 4: s->flip_line[i] = hflip_dword_c; break;
         case 6: s->flip_line[i] = hflip_b48_c;   break;
         case 8: s->flip_line[i] = hflip_qword_c; break;
+        case 12: s->flip_line[i] = hflip_b96_c; break;
+        case 16: s->flip_line[i] = hflip_dqword_c; break;
         default:
             return AVERROR_BUG;
         }
-- 
2.54.0


>From 286ae0c03ab56d2418b529d50ac4a4e98c330d5c Mon Sep 17 00:00:00 2001
From: James Almer <[email protected]>
Date: Mon, 9 Nov 2026 10:08:27 -0300
Subject: [PATCH 4/7] swscale/input: add support for RGBAF32

Signed-off-by: James Almer <[email protected]>
---
 libswscale/format.c |   2 +
 libswscale/input.c  | 125 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 127 insertions(+)

diff --git a/libswscale/format.c b/libswscale/format.c
index f14737f649b..ffa9fda56e8 100644
--- a/libswscale/format.c
+++ b/libswscale/format.c
@@ -271,6 +271,8 @@ static const LegacyFormatEntry legacy_format_entries[] = {
     [AV_PIX_FMT_RGBF16LE]       = { 1, 0 },
     [AV_PIX_FMT_RGBF32BE]       = { 1, 0 },
     [AV_PIX_FMT_RGBF32LE]       = { 1, 0 },
+    [AV_PIX_FMT_RGBAF32BE]      = { 1, 0 },
+    [AV_PIX_FMT_RGBAF32LE]      = { 1, 0 },
     [AV_PIX_FMT_XV30LE]         = { 1, 1 },
     [AV_PIX_FMT_XV36LE]         = { 1, 1 },
     [AV_PIX_FMT_XV36BE]         = { 1, 1 },
diff --git a/libswscale/input.c b/libswscale/input.c
index 2e6dd6f413e..da7f24d274d 100644
--- a/libswscale/input.c
+++ b/libswscale/input.c
@@ -1396,6 +1396,79 @@ static av_always_inline void rgbf32_to_y_c(uint8_t 
*_dst, const uint8_t *_src,
     }
 }
 
+static av_always_inline void rgbaf32_to_uv_c(uint8_t *_dstU, uint8_t *_dstV, 
const uint8_t *unused1,
+                                             const uint8_t *_src, const 
uint8_t *unused2,
+                                             int width, int is_be, int32_t 
*rgb2yuv)
+{
+    int i;
+    const float *src = (const float *)_src;
+    uint16_t *dstU       = (uint16_t *)_dstU;
+    uint16_t *dstV       = (uint16_t *)_dstV;
+    int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
+    int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
+
+    for (i = 0; i < width; i++) {
+        int r = lrintf(av_clipf(65535.0f * rdpx(&src[4*i]), 0.0f, 65535.0f));
+        int g = lrintf(av_clipf(65535.0f * rdpx(&src[4*i + 1]), 0.0f, 
65535.0f));
+        int b = lrintf(av_clipf(65535.0f * rdpx(&src[4*i + 2]), 0.0f, 
65535.0f));
+
+        dstU[i] = (ru*r + gu*g + bu*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> 
RGB2YUV_SHIFT;
+        dstV[i] = (rv*r + gv*g + bv*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> 
RGB2YUV_SHIFT;
+    }
+}
+
+static av_always_inline void rgbaf32_to_uv_half_c(uint8_t *_dstU, uint8_t 
*_dstV, const uint8_t *unused1,
+                                                  const uint8_t *_src, const 
uint8_t *unused2,
+                                                  int width, int is_be, 
int32_t *rgb2yuv)
+{
+    const float *src = (const float *) _src;
+    uint16_t *dstU   = (uint16_t *) _dstU;
+    uint16_t *dstV   = (uint16_t *) _dstV;
+    int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
+    int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
+
+    for (int i = 0; i < width; i++) {
+        int r = (lrintf(av_clipf(65535.0f * rdpx(&src[8 * i + 0]), 0.0f, 
65535.0f)) +
+                 lrintf(av_clipf(65535.0f * rdpx(&src[8 * i + 4]), 0.0f, 
65535.0f))) >> 1;
+        int g = (lrintf(av_clipf(65535.0f * rdpx(&src[8 * i + 1]), 0.0f, 
65535.0f)) +
+                 lrintf(av_clipf(65535.0f * rdpx(&src[8 * i + 5]), 0.0f, 
65535.0f))) >> 1;
+        int b = (lrintf(av_clipf(65535.0f * rdpx(&src[8 * i + 2]), 0.0f, 
65535.0f)) +
+                 lrintf(av_clipf(65535.0f * rdpx(&src[8 * i + 6]), 0.0f, 
65535.0f))) >> 1;
+
+        dstU[i] = (ru*r + gu*g + bu*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> 
RGB2YUV_SHIFT;
+        dstV[i] = (rv*r + gv*g + bv*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> 
RGB2YUV_SHIFT;
+    }
+}
+
+static av_always_inline void rgbaf32_to_y_c(uint8_t *_dst, const uint8_t *_src,
+                                            const uint8_t *unused1, const 
uint8_t *unused2,
+                                            int width, int is_be, int32_t 
*rgb2yuv)
+{
+    int i;
+    const float *src = (const float *)_src;
+    uint16_t *dst    = (uint16_t *)_dst;
+
+    int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
+
+    for (i = 0; i < width; i++) {
+        int r = lrintf(av_clipf(65535.0f * rdpx(&src[4*i]), 0.0f, 65535.0f));
+        int g = lrintf(av_clipf(65535.0f * rdpx(&src[4*i + 1]), 0.0f, 
65535.0f));
+        int b = lrintf(av_clipf(65535.0f * rdpx(&src[4*i + 2]), 0.0f, 
65535.0f));
+
+        dst[i] = (ry*r + gy*g + by*b + (0x2001 << (RGB2YUV_SHIFT - 1))) >> 
RGB2YUV_SHIFT;
+    }
+}
+
+static av_always_inline void rgbaf32_to_a_c(uint8_t *_dst, const uint8_t 
*_src, int width, int is_be)
+{
+    const float *src = (const float *)_src;
+    uint16_t *dst        = (uint16_t *)_dst;
+
+    for (int i = 0; i < width; i++) {
+        dst[i] = lrintf(av_clipf(65535.0f * rdpx(&src[4*i + 3]), 0.0f, 
65535.0f));
+    }
+}
+
 static av_always_inline void grayf32ToY16_c(uint8_t *_dst, const uint8_t 
*_src, const uint8_t *unused1,
                                             const uint8_t *unused2, int width, 
int is_be, uint32_t *unused)
 {
@@ -1533,6 +1606,34 @@ static void rgbf32##endian_name##_to_uv_half_c(uint8_t 
*dstU, uint8_t *dstV,
 {                                                                              
                     \
     rgbf32_to_uv_half_c(dstU, dstV, unused1, src, unused2, w, endian, 
rgb2yuv);                     \
 }                                                                              
                     \
+static void rgbaf32##endian_name##_to_y_c(uint8_t *dst, const uint8_t *src,    
                     \
+                                         const uint8_t *unused1, const uint8_t 
*unused2,            \
+                                         int w, uint32_t *rgb2yuv, void *opq)  
                     \
+{                                                                              
                     \
+    rgbaf32_to_y_c(dst, src, unused1, unused2, w, endian, rgb2yuv);            
                     \
+}                                                                              
                     \
+static void rgbaf32##endian_name##_to_uv_c(uint8_t *dstU, uint8_t *dstV,       
                     \
+                                        const uint8_t *unused1,                
                     \
+                                        const uint8_t *src, const uint8_t 
*unused2,                 \
+                                        int w, uint32_t *rgb2yuv,              
                     \
+                                        void *opq)                             
                     \
+{                                                                              
                     \
+    rgbaf32_to_uv_c(dstU, dstV, unused1, src, unused2, w, endian, rgb2yuv);    
                     \
+}                                                                              
                     \
+static void rgbaf32##endian_name##_to_a_c(uint8_t *_dst, const uint8_t *_src,  
                     \
+                                          const uint8_t *unused1, const 
uint8_t *unused2,           \
+                                          int w, uint32_t *unused, void *opq)  
                     \
+{                                                                              
                     \
+    rgbaf32_to_a_c(_dst, _src, w, endian);                                     
                     \
+}                                                                              
                     \
+static void rgbaf32##endian_name##_to_uv_half_c(uint8_t *dstU, uint8_t *dstV,  
                     \
+                                               const uint8_t *unused1,         
                     \
+                                               const uint8_t *src, const 
uint8_t *unused2,          \
+                                               int w, uint32_t *rgb2yuv,       
                     \
+                                               void *opq)                      
                     \
+{                                                                              
                     \
+    rgbaf32_to_uv_half_c(dstU, dstV, unused1, src, unused2, w, endian, 
rgb2yuv);                    \
+}                                                                              
                     \
 static void grayf32##endian_name##ToY16_c(uint8_t *dst, const uint8_t *src,    
                     \
                                           const uint8_t *unused1, const 
uint8_t *unused2,           \
                                           int width, uint32_t *unused, void 
*opq)                   \
@@ -2121,6 +2222,12 @@ av_cold void ff_sws_init_input_funcs(SwsInternal *c,
     case AV_PIX_FMT_RGBF32BE:
         *chrToYV12 = rgbf32be_to_uv_c;
         break;
+    case AV_PIX_FMT_RGBAF32LE:
+        *chrToYV12 = rgbaf32le_to_uv_c;
+        break;
+    case AV_PIX_FMT_RGBAF32BE:
+        *chrToYV12 = rgbaf32be_to_uv_c;
+        break;
     }
     if (c->chrSrcHSubSample) {
         switch (srcFormat) {
@@ -2230,6 +2337,12 @@ av_cold void ff_sws_init_input_funcs(SwsInternal *c,
         case AV_PIX_FMT_RGBF32LE:
             *chrToYV12 = rgbf32le_to_uv_half_c;
             break;
+        case AV_PIX_FMT_RGBAF32BE:
+            *chrToYV12 = rgbaf32be_to_uv_half_c;
+            break;
+        case AV_PIX_FMT_RGBAF32LE:
+            *chrToYV12 = rgbaf32le_to_uv_half_c;
+            break;
         }
     } else {
         switch (srcFormat) {
@@ -2754,6 +2867,12 @@ av_cold void ff_sws_init_input_funcs(SwsInternal *c,
     case AV_PIX_FMT_RGBF32BE:
         *lumToYV12 = rgbf32be_to_y_c;
         break;
+    case AV_PIX_FMT_RGBAF32LE:
+        *lumToYV12 = rgbaf32le_to_y_c;
+        break;
+    case AV_PIX_FMT_RGBAF32BE:
+        *lumToYV12 = rgbaf32be_to_y_c;
+        break;
     }
     if (c->needAlpha) {
         if (is16BPS(srcFormat) || isNBPS(srcFormat)) {
@@ -2779,6 +2898,12 @@ av_cold void ff_sws_init_input_funcs(SwsInternal *c,
         case AV_PIX_FMT_RGBAF16LE:
             *alpToYV12 = rgbaf16leToA_c;
             break;
+        case AV_PIX_FMT_RGBAF32BE:
+            *alpToYV12 = rgbaf32be_to_a_c;
+            break;
+        case AV_PIX_FMT_RGBAF32LE:
+            *alpToYV12 = rgbaf32le_to_a_c;
+            break;
         case AV_PIX_FMT_YA8:
             *alpToYV12 = uyvyToY_c;
             break;
-- 
2.54.0


>From 9d9399e70f5872016d0816dcd2f7c6ceef7bc004 Mon Sep 17 00:00:00 2001
From: Ramiro Polla <[email protected]>
Date: Sun, 8 Nov 2026 23:44:35 -0300
Subject: [PATCH 5/7] swscale/output: reuse YA16 templates for YAF32

This gives the same precision as the existing GRAYF32 output and simplifies
code.

Signed-off-by: James Almer <[email protected]>
---
 libswscale/output.c                      | 88 ++++++++----------------
 tests/ref/fate/filter-pixdesc-yaf32be    |  2 +-
 tests/ref/fate/filter-pixdesc-yaf32le    |  2 +-
 tests/ref/fate/filter-pixfmts-copy       |  4 +-
 tests/ref/fate/filter-pixfmts-crop       |  4 +-
 tests/ref/fate/filter-pixfmts-field      |  4 +-
 tests/ref/fate/filter-pixfmts-fieldorder |  4 +-
 tests/ref/fate/filter-pixfmts-hflip      |  4 +-
 tests/ref/fate/filter-pixfmts-il         |  4 +-
 tests/ref/fate/filter-pixfmts-null       |  4 +-
 tests/ref/fate/filter-pixfmts-scale      |  4 +-
 tests/ref/fate/filter-pixfmts-transpose  |  4 +-
 tests/ref/fate/filter-pixfmts-vflip      |  4 +-
 13 files changed, 50 insertions(+), 82 deletions(-)

diff --git a/libswscale/output.c b/libswscale/output.c
index 55cba1ea5f1..97f8960938a 100644
--- a/libswscale/output.c
+++ b/libswscale/output.c
@@ -305,70 +305,16 @@ static void yuv2planeX_float ## BE_LE ## _c(const int16_t 
*filter, int filterSiz
     template(filter, filterSize, (const int32_t **)src, (dest_type *)dest, 
dstW, 1); \
 }
 
-#define yuv2yaf32_1(template, dest_type, BE_LE, is_be) \
-static void yuv2yaf32 ## BE_LE ## _1_c(SwsInternal *c, const int16_t *lumSrc, \
-                                       const int16_t *chrUSrc[2], \
-                                       const int16_t *chrVSrc[2], \
-                                       const int16_t *alpSrc, uint8_t *dest, \
-                                       int dstW, int uvalpha, int y) \
-{ \
-    dest_type *dst = (dest_type *) dest; \
-    template((const int32_t *)lumSrc, dst, dstW, 2); \
-    if (alpSrc) { \
-        template((const int32_t *)alpSrc, dst + 1, dstW, 2); \
-    } else { \
-        for (int i = 0; i < dstW; i++) { \
-            if (is_be) { \
-                AV_WB32(&dst[2 * i + 1], av_float2int(1.0f)); \
-            } else { \
-                AV_WL32(&dst[2 * i + 1], av_float2int(1.0f)); \
-            } \
-        } \
-    } \
-}
-
-#define yuv2yaf32_X(template, dest_type, BE_LE, is_be) \
-static void yuv2yaf32 ## BE_LE ## _X_c(SwsInternal *c, const int16_t 
*lumFilter, \
-                                       const int16_t **lumSrc, int 
lumFilterSize, \
-                                       const int16_t *chrFilter, \
-                                       const int16_t **chrUSrc, \
-                                       const int16_t **chrVSrc, int 
chrFilterSize, \
-                                       const int16_t **alpSrc, uint8_t *dest, \
-                                       int dstW, int y) \
-{ \
-    dest_type *dst = (dest_type *) dest; \
-    template(lumFilter, lumFilterSize, (const int32_t **) lumSrc, dst, dstW, 
2); \
-    if (alpSrc) { \
-        template(lumFilter, lumFilterSize, (const int32_t **) alpSrc, dst + 1, 
dstW, 2); \
-    } else { \
-        for (int i = 0; i < dstW; i++) { \
-            if (is_be) { \
-                AV_WB32(&dst[2 * i + 1], av_float2int(1.0f)); \
-            } else { \
-                AV_WL32(&dst[2 * i + 1], av_float2int(1.0f)); \
-            } \
-        } \
-    } \
-}
-
 #if HAVE_BIGENDIAN
 yuv2plane1_float(yuv2plane1_float_c_template,       float,    BE)
 yuv2plane1_float(yuv2plane1_float_bswap_c_template, uint32_t, LE)
 yuv2planeX_float(yuv2planeX_float_c_template,       float,    BE)
 yuv2planeX_float(yuv2planeX_float_bswap_c_template, uint32_t, LE)
-yuv2yaf32_1(yuv2plane1_float_c_template,            float,    be, 1)
-yuv2yaf32_1(yuv2plane1_float_bswap_c_template,      uint32_t, le, 0)
-yuv2yaf32_X(yuv2planeX_float_c_template,            float,    be, 1)
-yuv2yaf32_X(yuv2planeX_float_bswap_c_template,      uint32_t, le, 0)
 #else
 yuv2plane1_float(yuv2plane1_float_c_template,       float,    LE)
 yuv2plane1_float(yuv2plane1_float_bswap_c_template, uint32_t, BE)
 yuv2planeX_float(yuv2planeX_float_c_template,       float,    LE)
 yuv2planeX_float(yuv2planeX_float_bswap_c_template, uint32_t, BE)
-yuv2yaf32_1(yuv2plane1_float_c_template,            float,    le, 0)
-yuv2yaf32_1(yuv2plane1_float_bswap_c_template,      uint32_t, be, 1)
-yuv2yaf32_X(yuv2planeX_float_c_template,            float,    le, 0)
-yuv2yaf32_X(yuv2planeX_float_bswap_c_template,      uint32_t, be, 1)
 #endif
 
 #undef output_pixel
@@ -1071,6 +1017,26 @@ YUV2PACKEDWRAPPER(yuv2, 422, uyvy422, AV_PIX_FMT_UYVY422)
     } else { \
         AV_WL16(pos, val); \
     }
+#define output_pixel32(pos, val) \
+    if (is_be) { \
+        AV_WB32(pos, val); \
+    } else { \
+        AV_WL32(pos, val); \
+    }
+
+static av_always_inline void
+output_pixel_ya(uint16_t *dest, int i, int Y, int A,
+                enum AVPixelFormat target, int is_be)
+{
+    if (target == AV_PIX_FMT_YAF32LE || target == AV_PIX_FMT_YAF32BE) {
+        static const float float_mult = 1.0f / 65535.0f;
+        output_pixel32(&dest[4 * i    ], av_float2int(float_mult * Y));
+        output_pixel32(&dest[4 * i + 2], av_float2int(float_mult * A));
+    } else {
+        output_pixel(&dest[2 * i    ], Y);
+        output_pixel(&dest[2 * i + 1], A);
+    }
+}
 
 static av_always_inline void
 yuv2ya16_X_c_template(SwsInternal *c, const int16_t *lumFilter,
@@ -1106,8 +1072,7 @@ yuv2ya16_X_c_template(SwsInternal *c, const int16_t 
*lumFilter,
             A = av_clip_uint16(A);
         }
 
-        output_pixel(&dest[2 * i    ], Y);
-        output_pixel(&dest[2 * i + 1], A);
+        output_pixel_ya(dest, i, Y, A, target, is_be);
     }
 }
 
@@ -1140,8 +1105,7 @@ yuv2ya16_2_c_template(SwsInternal *c, const int32_t 
*buf[2],
             A = av_clip_uint16(A);
         }
 
-        output_pixel(&dest[2 * i    ], Y);
-        output_pixel(&dest[2 * i + 1], hasAlpha ? A : 65535);
+        output_pixel_ya(dest, i, Y, hasAlpha ? A : 65535, target, is_be);
     }
 }
 
@@ -1167,8 +1131,7 @@ yuv2ya16_1_c_template(SwsInternal *c, const int32_t *buf0,
                 A = av_clip_uint16(A);
         }
 
-        output_pixel(&dest[2 * i    ], Y);
-        output_pixel(&dest[2 * i + 1], hasAlpha ? A : 65535);
+        output_pixel_ya(dest, i, Y, hasAlpha ? A : 65535, target, is_be);
     }
 }
 
@@ -1632,6 +1595,7 @@ yuv2rgba64_full_1_c_template(SwsInternal *c, const 
int32_t *buf0,
 }
 
 #undef output_pixel
+#undef output_pixel32
 #undef r_b
 #undef b_r
 
@@ -1697,6 +1661,8 @@ YUV2PACKED16WRAPPER(yuv2, rgba64, bgrx64be, 
AV_PIX_FMT_BGRA64, BE, 0, 1)
 YUV2PACKED16WRAPPER(yuv2, rgba64, bgrx64le, AV_PIX_FMT_BGRA64, LE, 0, 1)
 YUV2PACKED16WRAPPER(yuv2, ya16, ya16be, AV_PIX_FMT_YA16, BE, 1, 0)
 YUV2PACKED16WRAPPER(yuv2, ya16, ya16le, AV_PIX_FMT_YA16, LE, 1, 0)
+YUV2PACKED16WRAPPER(yuv2, ya16, yaf32be, AV_PIX_FMT_YAF32, BE, 1, 0)
+YUV2PACKED16WRAPPER(yuv2, ya16, yaf32le, AV_PIX_FMT_YAF32, LE, 1, 0)
 
 YUV2PACKED16WRAPPER(yuv2, rgba64_full, rgb48be_full, AV_PIX_FMT_RGB48, BE, 0, 
0)
 YUV2PACKED16WRAPPER(yuv2, rgba64_full, rgb48le_full, AV_PIX_FMT_RGB48, LE, 0, 
0)
@@ -3894,10 +3860,12 @@ av_cold void ff_sws_init_output_funcs(SwsInternal *c,
         break;
     case AV_PIX_FMT_YAF32LE:
         *yuv2packed1 = yuv2yaf32le_1_c;
+        *yuv2packed2 = yuv2yaf32le_2_c;
         *yuv2packedX = yuv2yaf32le_X_c;
         break;
     case AV_PIX_FMT_YAF32BE:
         *yuv2packed1 = yuv2yaf32be_1_c;
+        *yuv2packed2 = yuv2yaf32be_2_c;
         *yuv2packedX = yuv2yaf32be_X_c;
         break;
     case AV_PIX_FMT_V30XLE:
diff --git a/tests/ref/fate/filter-pixdesc-yaf32be 
b/tests/ref/fate/filter-pixdesc-yaf32be
index 310f352e98f..31cfa195c8d 100644
--- a/tests/ref/fate/filter-pixdesc-yaf32be
+++ b/tests/ref/fate/filter-pixdesc-yaf32be
@@ -1 +1 @@
-pixdesc-yaf32be     52967c7979f408430ea08da36adf51e9
+pixdesc-yaf32be     11ca5e3f990380a7d84bf505bee7cd60
diff --git a/tests/ref/fate/filter-pixdesc-yaf32le 
b/tests/ref/fate/filter-pixdesc-yaf32le
index 731f569e2bb..1551983ae42 100644
--- a/tests/ref/fate/filter-pixdesc-yaf32le
+++ b/tests/ref/fate/filter-pixdesc-yaf32le
@@ -1 +1 @@
-pixdesc-yaf32le     afe5b813bca1972266f6f3023b71f892
+pixdesc-yaf32le     8a084fad1b4d5d74a1f4b4e4b7998387
diff --git a/tests/ref/fate/filter-pixfmts-copy 
b/tests/ref/fate/filter-pixfmts-copy
index 28e1102c946..5c02a638974 100644
--- a/tests/ref/fate/filter-pixfmts-copy
+++ b/tests/ref/fate/filter-pixfmts-copy
@@ -125,8 +125,8 @@ y216le              0e99aeddfee304e72d525d72998d9e9b
 ya16be              c7a868787e0f3d487dbc8af804d15d81
 ya16le              a5299b6c9cb1b5b1f5fb62546b9c6c4e
 ya8                 dbb99fbcdc204aaa1a7397ff561f1a67
-yaf32be             0d7f48b22abca63936637d8e22985299
-yaf32le             decb6e2e85575573608c503af244df57
+yaf32be             0f4f26673a6fe8ba9b74ad45611c8488
+yaf32le             eacd43d54c8127ee1b9f88d79545933f
 yuv410p             5d4d992a7728431aa4e0700f87fb7fd8
 yuv411p             7e1300e89f5bc07939e2c4a6acbdf267
 yuv420p             a014c7eb7a8385d1dd092b7a583f1bff
diff --git a/tests/ref/fate/filter-pixfmts-crop 
b/tests/ref/fate/filter-pixfmts-crop
index 55c6dbf185d..261336f7cff 100644
--- a/tests/ref/fate/filter-pixfmts-crop
+++ b/tests/ref/fate/filter-pixfmts-crop
@@ -119,8 +119,8 @@ xyz12le             122fb7eea3575b4edbbd83219bc7af91
 ya16be              e2b490dc18f6ca3814fe9d68193ba263
 ya16le              33b0e26f3c2e89c651345970474f6703
 ya8                 51a8dd297e35d40b06d3ebe8f4717895
-yaf32be             9294ff8cc89b6dda482b931286fb7c05
-yaf32le             6ebf9e1338a6de1d9a553c38a85da251
+yaf32be             6524649877583eac52f8076be68d1cf9
+yaf32le             0df188030b0d07a2c909103f95e12267
 yuv410p             3bb6c7b64f2c46bc5e8b77198ce4ea58
 yuv411p             693e4afe96998e6dd91734037d75d887
 yuv420p             510d36163e4d3710988c23c2240ca6dc
diff --git a/tests/ref/fate/filter-pixfmts-field 
b/tests/ref/fate/filter-pixfmts-field
index f783d04ef57..1e137f4b479 100644
--- a/tests/ref/fate/filter-pixfmts-field
+++ b/tests/ref/fate/filter-pixfmts-field
@@ -125,8 +125,8 @@ y216le              e65b5bfae1b40edbbed2012e9cd45e31
 ya16be              466e6864b69dc93be890d32e021f4ab1
 ya16le              bd151aacfa82c803983e5c7bdc23b58b
 ya8                 28cea4f98ed452bd3da9c752e5e3399c
-yaf32be             3e440e683f461143e924b666d86f3d1c
-yaf32le             6d69152d5a1dd44f7943e0126e08b85a
+yaf32be             af630161f967366e657afb6d6a514caa
+yaf32le             2d8e57abc7ec69c4d5b12e4559336c66
 yuv410p             a85920d6bd26f51306e2ecbe71d1c554
 yuv411p             9106e283d5dbcfba01c611886d58871a
 yuv420p             9ea8ed3c22c31c0354b7face540bb280
diff --git a/tests/ref/fate/filter-pixfmts-fieldorder 
b/tests/ref/fate/filter-pixfmts-fieldorder
index 68c230eb436..93bea75fbbf 100644
--- a/tests/ref/fate/filter-pixfmts-fieldorder
+++ b/tests/ref/fate/filter-pixfmts-fieldorder
@@ -114,8 +114,8 @@ y216le              360cb98ac80b13d3a8ec61c9f1ff3bac
 ya16be              9462d3dded4802b9d9f96e8a40709067
 ya16le              f7eefa08ae0bfa77baf48c7064f59c13
 ya8                 055ac5ab5ff8533dd319edc17a398af1
-yaf32be             64c009faa0df2a44a5db191a1c5ae2b9
-yaf32le             55adc32f0c975d444c508a3b7ffbf179
+yaf32be             2f615d187b0ecf4cf383b72c3920f0e4
+yaf32le             7e0c94a67b37ce9fb102fc7e6aca01f6
 yuv411p             e4a040e0e786c4dae07d9d3f90a54905
 yuv422p             16ce67249c6ce7ef57a433646ad6dfc1
 yuv422p10be         62ae323dcc41aabf8ff6ecc53b119ce8
diff --git a/tests/ref/fate/filter-pixfmts-hflip 
b/tests/ref/fate/filter-pixfmts-hflip
index 76b21757e26..05fc467a9df 100644
--- a/tests/ref/fate/filter-pixfmts-hflip
+++ b/tests/ref/fate/filter-pixfmts-hflip
@@ -119,8 +119,8 @@ xyz12le             a8273fe17f2a738f3fd7f457de5c1df4
 ya16be              e7665e62e476df4eb143420e57cc9ec2
 ya16le              3a23b71db418b74e1cc304d7cd3e1989
 ya8                 4ad5920716de3d2fbbc49f95adb60345
-yaf32be             a0fd0741821b0734a6ecbcc989127e40
-yaf32le             3832240b5772affc0c04189200c35dd4
+yaf32be             a167b4fa890b06259d7a15296822b87e
+yaf32le             920d0367d5292dacadaf451221b5874d
 yuv410p             c49fd0c55c41185b1580aac77211992b
 yuv411p             c416371077dce13d31bf1dc706111ae7
 yuv420p             eb8d9f02db98e10400781428c43e9438
diff --git a/tests/ref/fate/filter-pixfmts-il b/tests/ref/fate/filter-pixfmts-il
index b3824c3ac13..b790105e364 100644
--- a/tests/ref/fate/filter-pixfmts-il
+++ b/tests/ref/fate/filter-pixfmts-il
@@ -124,8 +124,8 @@ y216le              9e44c6d76b09bcbe71738423b4b3d67a
 ya16be              d08393d66f14fb1e31a9e9cbcb3df664
 ya16le              372426fb917ea93365d775c3d1ef491a
 ya8                 a38d6e288f582f1a04310232ed764afc
-yaf32be             011351dda00897c16b407c96a1007f30
-yaf32le             47e7b8e817394855721e2397c9967c8c
+yaf32be             b761a322922f30c5b1d14e428b267a76
+yaf32le             986cbcc484546eda7fcf57da21eb1224
 yuv410p             dea1ab8843465adf5b8240b2d98fd85b
 yuv411p             8bf73777a5ff43c126be274245aceff1
 yuv420p             f1f4e7e94a76d5320049464bdeac24ed
diff --git a/tests/ref/fate/filter-pixfmts-null 
b/tests/ref/fate/filter-pixfmts-null
index 28e1102c946..5c02a638974 100644
--- a/tests/ref/fate/filter-pixfmts-null
+++ b/tests/ref/fate/filter-pixfmts-null
@@ -125,8 +125,8 @@ y216le              0e99aeddfee304e72d525d72998d9e9b
 ya16be              c7a868787e0f3d487dbc8af804d15d81
 ya16le              a5299b6c9cb1b5b1f5fb62546b9c6c4e
 ya8                 dbb99fbcdc204aaa1a7397ff561f1a67
-yaf32be             0d7f48b22abca63936637d8e22985299
-yaf32le             decb6e2e85575573608c503af244df57
+yaf32be             0f4f26673a6fe8ba9b74ad45611c8488
+yaf32le             eacd43d54c8127ee1b9f88d79545933f
 yuv410p             5d4d992a7728431aa4e0700f87fb7fd8
 yuv411p             7e1300e89f5bc07939e2c4a6acbdf267
 yuv420p             a014c7eb7a8385d1dd092b7a583f1bff
diff --git a/tests/ref/fate/filter-pixfmts-scale 
b/tests/ref/fate/filter-pixfmts-scale
index c8a3cff5782..54f0db1a76a 100644
--- a/tests/ref/fate/filter-pixfmts-scale
+++ b/tests/ref/fate/filter-pixfmts-scale
@@ -125,8 +125,8 @@ y216le              17be2999e97d36b8ed903f07ef428c09
 ya16be              2c473f0f4c9330c1ed61bcc80ee11022
 ya16le              76d4ff84d1014db24397f936dad9d0fa
 ya8                 0a9db5bb4b009de9197eede5e9d19e16
-yaf32be             e3aad2e56b46ac9ecb7cdb76de8bd954
-yaf32le             7ece90b90ad6e132421a9feea6273a3e
+yaf32be             485ab8e871268a1e1a441055fe07be8c
+yaf32le             075edf21cc05db2c98db56af25dd0b15
 yuv410p             e8f49b5fb9335b62c074f7f8bb0234fc
 yuv411p             5af32557c93beb482e26e7af693104c6
 yuv420p             5d3ac239c3712143560b1dfbd48a7ddd
diff --git a/tests/ref/fate/filter-pixfmts-transpose 
b/tests/ref/fate/filter-pixfmts-transpose
index f492c2c3bab..4b07f1bd79b 100644
--- a/tests/ref/fate/filter-pixfmts-transpose
+++ b/tests/ref/fate/filter-pixfmts-transpose
@@ -109,8 +109,8 @@ xyz12le             77912a89e6525f6809d8c31fed87a439
 ya16be              9bb39f9567d807be0fb8631dcfa8d5f8
 ya16le              b13453818b83c8dc2610975095393ac1
 ya8                 d4b7a62f80681fa44c977ff3a64f4ce4
-yaf32be             b8e5b5fdfc7cbc60f47d93a34d4277b0
-yaf32le             c1905efebcef8574bdf883bceb158434
+yaf32be             a117a36318e1bba2b5265d153fb0f045
+yaf32le             ba12f8a6a60b8d367ce73dabaa790164
 yuv410p             4c0143429edd30aa01493447c90132ea
 yuv420p             2fa5b2201c75034206cc20e2c6134aed
 yuv420p10be         0931660f930d9be8aea9d0c76b406055
diff --git a/tests/ref/fate/filter-pixfmts-vflip 
b/tests/ref/fate/filter-pixfmts-vflip
index d5ca454c854..7f08bc9254d 100644
--- a/tests/ref/fate/filter-pixfmts-vflip
+++ b/tests/ref/fate/filter-pixfmts-vflip
@@ -125,8 +125,8 @@ y216le              985db498aedf3fb1c547ad07442b7258
 ya16be              633230e223ca00e8398e46514d35422d
 ya16le              9bee2882baafbfeba9adb8787c61f2f4
 ya8                 4299c6ca3b470a7d8a420e26eb485b1d
-yaf32be             24987299dc2a16dd391d7d48b94c3d64
-yaf32le             09b87da5eeaeabc36bdbcd49955cc05f
+yaf32be             782a52cad5a7ded8ca0b3e3069f50517
+yaf32le             5cdc04f5ab16d9780ac0e92857f72718
 yuv410p             c7adfe96c8e043a6cb9290c39bf8063c
 yuv411p             3fce29db403a25f81be39e01aaf6ff3a
 yuv420p             d64fae96fac22aefa8fbcf45a09f37c1
-- 
2.54.0


>From f37d998035200d2ef1b85830946599bdfd303964 Mon Sep 17 00:00:00 2001
From: James Almer <[email protected]>
Date: Sun, 8 Nov 2026 23:25:48 -0300
Subject: [PATCH 6/7] swscale/output: add support for RGBF32

Signed-off-by: James Almer <[email protected]>
---
 libswscale/format.c                      |   4 +-
 libswscale/output.c                      | 280 ++++++++++++++++-------
 libswscale/utils.c                       |   2 +
 libswscale/yuv2rgb.c                     |   2 +-
 tests/ref/fate/filter-pixdesc-rgbf32be   |   1 +
 tests/ref/fate/filter-pixdesc-rgbf32le   |   1 +
 tests/ref/fate/filter-pixfmts-copy       |   2 +
 tests/ref/fate/filter-pixfmts-crop       |   2 +
 tests/ref/fate/filter-pixfmts-field      |   2 +
 tests/ref/fate/filter-pixfmts-fieldorder |   2 +
 tests/ref/fate/filter-pixfmts-hflip      |   2 +
 tests/ref/fate/filter-pixfmts-il         |   2 +
 tests/ref/fate/filter-pixfmts-null       |   2 +
 tests/ref/fate/filter-pixfmts-scale      |   2 +
 tests/ref/fate/filter-pixfmts-transpose  |   2 +
 tests/ref/fate/filter-pixfmts-vflip      |   2 +
 16 files changed, 219 insertions(+), 91 deletions(-)
 create mode 100644 tests/ref/fate/filter-pixdesc-rgbf32be
 create mode 100644 tests/ref/fate/filter-pixdesc-rgbf32le

diff --git a/libswscale/format.c b/libswscale/format.c
index ffa9fda56e8..5482982c0db 100644
--- a/libswscale/format.c
+++ b/libswscale/format.c
@@ -269,8 +269,8 @@ static const LegacyFormatEntry legacy_format_entries[] = {
     [AV_PIX_FMT_RGBAF16LE]      = { 1, 0 },
     [AV_PIX_FMT_RGBF16BE]       = { 1, 0 },
     [AV_PIX_FMT_RGBF16LE]       = { 1, 0 },
-    [AV_PIX_FMT_RGBF32BE]       = { 1, 0 },
-    [AV_PIX_FMT_RGBF32LE]       = { 1, 0 },
+    [AV_PIX_FMT_RGBF32BE]       = { 1, 1 },
+    [AV_PIX_FMT_RGBF32LE]       = { 1, 1 },
     [AV_PIX_FMT_RGBAF32BE]      = { 1, 0 },
     [AV_PIX_FMT_RGBAF32LE]      = { 1, 0 },
     [AV_PIX_FMT_XV30LE]         = { 1, 1 },
diff --git a/libswscale/output.c b/libswscale/output.c
index 97f8960938a..28c3c3fcc4e 100644
--- a/libswscale/output.c
+++ b/libswscale/output.c
@@ -1009,8 +1009,8 @@ YUV2PACKEDWRAPPER(yuv2, 422, yuyv422, AV_PIX_FMT_YUYV422)
 YUV2PACKEDWRAPPER(yuv2, 422, yvyu422, AV_PIX_FMT_YVYU422)
 YUV2PACKEDWRAPPER(yuv2, 422, uyvy422, AV_PIX_FMT_UYVY422)
 
-#define R_B ((target == AV_PIX_FMT_RGB48LE || target == AV_PIX_FMT_RGB48BE || 
target == AV_PIX_FMT_RGBA64LE || target == AV_PIX_FMT_RGBA64BE) ? R : B)
-#define B_R ((target == AV_PIX_FMT_RGB48LE || target == AV_PIX_FMT_RGB48BE || 
target == AV_PIX_FMT_RGBA64LE || target == AV_PIX_FMT_RGBA64BE) ? B : R)
+#define R_B ((target == AV_PIX_FMT_RGB48LE || target == AV_PIX_FMT_RGB48BE || 
target == AV_PIX_FMT_RGBA64LE || target == AV_PIX_FMT_RGBA64BE || target == 
AV_PIX_FMT_RGBF32LE || target == AV_PIX_FMT_RGBF32BE) ? R : B)
+#define B_R ((target == AV_PIX_FMT_RGB48LE || target == AV_PIX_FMT_RGB48BE || 
target == AV_PIX_FMT_RGBA64LE || target == AV_PIX_FMT_RGBA64BE || target == 
AV_PIX_FMT_RGBF32LE || target == AV_PIX_FMT_RGBF32BE) ? B : R)
 #define output_pixel(pos, val) \
     if (is_be) { \
         AV_WB16(pos, val); \
@@ -1144,6 +1144,8 @@ yuv2rgba64_X_c_template(SwsInternal *c, const int16_t 
*lumFilter,
                        int y, enum AVPixelFormat target, int hasAlpha, int 
eightbytes,
                        int is_be)
 {
+    static const float float_mult = 1.0f / 65535.0f;
+    uint32_t *float_dest = (uint32_t *)dest;
     int i;
     int A1 = 0xffff<<14, A2 = 0xffff<<14;
 
@@ -1198,22 +1200,32 @@ yuv2rgba64_X_c_template(SwsInternal *c, const int16_t 
*lumFilter,
         G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff;
         B =                            U * c->yuv2rgb_u2b_coeff;
 
-        // 8 bits: 30 - 22 = 8 bits, 16 bits: 30 bits - 14 = 16 bits
-        output_pixel(&dest[0], av_clip_uintp2(((int)(R_B + Y1) >> 14) + 
(1<<15), 16));
-        output_pixel(&dest[1], av_clip_uintp2(((int)(  G + Y1) >> 14) + 
(1<<15), 16));
-        output_pixel(&dest[2], av_clip_uintp2(((int)(B_R + Y1) >> 14) + 
(1<<15), 16));
-        if (eightbytes) {
-            output_pixel(&dest[3], av_clip_uintp2(A1      , 30) >> 14);
-            output_pixel(&dest[4], av_clip_uintp2(((int)(R_B + Y2) >> 14) + 
(1<<15), 16));
-            output_pixel(&dest[5], av_clip_uintp2(((int)(  G + Y2) >> 14) + 
(1<<15), 16));
-            output_pixel(&dest[6], av_clip_uintp2(((int)(B_R + Y2) >> 14) + 
(1<<15), 16));
-            output_pixel(&dest[7], av_clip_uintp2(A2      , 30) >> 14);
-            dest += 8;
+        if (target == AV_PIX_FMT_RGBF32LE || target == AV_PIX_FMT_RGBF32BE) {
+            output_pixel32(&float_dest[0], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(R_B + Y1) >> 14) + (1<<15), 16)));
+            output_pixel32(&float_dest[1], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(  G + Y1) >> 14) + (1<<15), 16)));
+            output_pixel32(&float_dest[2], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(B_R + Y1) >> 14) + (1<<15), 16)));
+            output_pixel32(&float_dest[3], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(R_B + Y2) >> 14) + (1<<15), 16)));
+            output_pixel32(&float_dest[4], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(  G + Y2) >> 14) + (1<<15), 16)));
+            output_pixel32(&float_dest[5], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(B_R + Y2) >> 14) + (1<<15), 16)));
+            float_dest += 6;
         } else {
-            output_pixel(&dest[3], av_clip_uintp2(((int)(R_B + Y2) >> 14) + 
(1<<15), 16));
-            output_pixel(&dest[4], av_clip_uintp2(((int)(  G + Y2) >> 14) + 
(1<<15), 16));
-            output_pixel(&dest[5], av_clip_uintp2(((int)(B_R + Y2) >> 14) + 
(1<<15), 16));
-            dest += 6;
+            // 8 bits: 30 - 22 = 8 bits, 16 bits: 30 bits - 14 = 16 bits
+            output_pixel(&dest[0], av_clip_uintp2(((int)(R_B + Y1) >> 14) + 
(1<<15), 16));
+            output_pixel(&dest[1], av_clip_uintp2(((int)(  G + Y1) >> 14) + 
(1<<15), 16));
+            output_pixel(&dest[2], av_clip_uintp2(((int)(B_R + Y1) >> 14) + 
(1<<15), 16));
+            if (eightbytes) {
+                output_pixel(&dest[3], av_clip_uintp2(A1      , 30) >> 14);
+                output_pixel(&dest[4], av_clip_uintp2(((int)(R_B + Y2) >> 14) 
+ (1<<15), 16));
+                output_pixel(&dest[5], av_clip_uintp2(((int)(  G + Y2) >> 14) 
+ (1<<15), 16));
+                output_pixel(&dest[6], av_clip_uintp2(((int)(B_R + Y2) >> 14) 
+ (1<<15), 16));
+                output_pixel(&dest[7], av_clip_uintp2(A2      , 30) >> 14);
+                dest += 8;
+            } else {
+                output_pixel(&dest[3], av_clip_uintp2(((int)(R_B + Y2) >> 14) 
+ (1<<15), 16));
+                output_pixel(&dest[4], av_clip_uintp2(((int)(  G + Y2) >> 14) 
+ (1<<15), 16));
+                output_pixel(&dest[5], av_clip_uintp2(((int)(B_R + Y2) >> 14) 
+ (1<<15), 16));
+                dest += 6;
+            }
         }
     }
 }
@@ -1228,6 +1240,8 @@ yuv2rgba64_2_c_template(SwsInternal *c, const int32_t 
*buf[2],
 {
     unsigned  yalpha =  yalpha_param;
     unsigned uvalpha = uvalpha_param;
+    static const float float_mult = 1.0f / 65535.0f;
+    uint32_t *float_dest = (uint32_t *)dest;
     const int32_t *buf0  = buf[0],  *buf1  = buf[1],
                   *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
                   *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
@@ -1267,21 +1281,31 @@ yuv2rgba64_2_c_template(SwsInternal *c, const int32_t 
*buf[2],
             A2 += 1 << 13;
         }
 
-        output_pixel(&dest[0], av_clip_uintp2(((int)(R_B + Y1) >> 14) + 
(1<<15), 16));
-        output_pixel(&dest[1], av_clip_uintp2(((int)(  G + Y1) >> 14) + 
(1<<15), 16));
-        output_pixel(&dest[2], av_clip_uintp2(((int)(B_R + Y1) >> 14) + 
(1<<15), 16));
-        if (eightbytes) {
-            output_pixel(&dest[3], av_clip_uintp2(A1      , 30) >> 14);
-            output_pixel(&dest[4], av_clip_uintp2(((int)(R_B + Y2) >> 14) + 
(1<<15), 16));
-            output_pixel(&dest[5], av_clip_uintp2(((int)(  G + Y2) >> 14) + 
(1<<15), 16));
-            output_pixel(&dest[6], av_clip_uintp2(((int)(B_R + Y2) >> 14) + 
(1<<15), 16));
-            output_pixel(&dest[7], av_clip_uintp2(A2      , 30) >> 14);
-            dest += 8;
+        if (target == AV_PIX_FMT_RGBF32LE || target == AV_PIX_FMT_RGBF32BE) {
+            output_pixel32(&float_dest[0], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(R_B + Y1) >> 14) + (1<<15), 16)));
+            output_pixel32(&float_dest[1], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(  G + Y1) >> 14) + (1<<15), 16)));
+            output_pixel32(&float_dest[2], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(B_R + Y1) >> 14) + (1<<15), 16)));
+            output_pixel32(&float_dest[3], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(R_B + Y2) >> 14) + (1<<15), 16)));
+            output_pixel32(&float_dest[4], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(  G + Y2) >> 14) + (1<<15), 16)));
+            output_pixel32(&float_dest[5], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(B_R + Y2) >> 14) + (1<<15), 16)));
+            float_dest += 6;
         } else {
-            output_pixel(&dest[3], av_clip_uintp2(((int)(R_B + Y2) >> 14) + 
(1<<15), 16));
-            output_pixel(&dest[4], av_clip_uintp2(((int)(  G + Y2) >> 14) + 
(1<<15), 16));
-            output_pixel(&dest[5], av_clip_uintp2(((int)(B_R + Y2) >> 14) + 
(1<<15), 16));
-            dest += 6;
+            output_pixel(&dest[0], av_clip_uintp2(((int)(R_B + Y1) >> 14) + 
(1<<15), 16));
+            output_pixel(&dest[1], av_clip_uintp2(((int)(  G + Y1) >> 14) + 
(1<<15), 16));
+            output_pixel(&dest[2], av_clip_uintp2(((int)(B_R + Y1) >> 14) + 
(1<<15), 16));
+            if (eightbytes) {
+                output_pixel(&dest[3], av_clip_uintp2(A1      , 30) >> 14);
+                output_pixel(&dest[4], av_clip_uintp2(((int)(R_B + Y2) >> 14) 
+ (1<<15), 16));
+                output_pixel(&dest[5], av_clip_uintp2(((int)(  G + Y2) >> 14) 
+ (1<<15), 16));
+                output_pixel(&dest[6], av_clip_uintp2(((int)(B_R + Y2) >> 14) 
+ (1<<15), 16));
+                output_pixel(&dest[7], av_clip_uintp2(A2      , 30) >> 14);
+                dest += 8;
+            } else {
+                output_pixel(&dest[3], av_clip_uintp2(((int)(R_B + Y2) >> 14) 
+ (1<<15), 16));
+                output_pixel(&dest[4], av_clip_uintp2(((int)(  G + Y2) >> 14) 
+ (1<<15), 16));
+                output_pixel(&dest[5], av_clip_uintp2(((int)(B_R + Y2) >> 14) 
+ (1<<15), 16));
+                dest += 6;
+            }
         }
     }
 }
@@ -1294,6 +1318,8 @@ yuv2rgba64_1_c_template(SwsInternal *c, const int32_t 
*buf0,
                        int hasAlpha, int eightbytes, int is_be)
 {
     const int32_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
+    static const float float_mult = 1.0f / 65535.0f;
+    uint32_t *float_dest = (uint32_t *)dest;
     int i;
     SUINT A1 = 0xffff<<14, A2= 0xffff<<14;
 
@@ -1324,21 +1350,31 @@ yuv2rgba64_1_c_template(SwsInternal *c, const int32_t 
*buf0,
             G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff;
             B =                            U * c->yuv2rgb_u2b_coeff;
 
-            output_pixel(&dest[0], av_clip_uintp2(((int)(R_B + Y1) >> 14) + 
(1<<15), 16));
-            output_pixel(&dest[1], av_clip_uintp2(((int)(  G + Y1) >> 14) + 
(1<<15), 16));
-            output_pixel(&dest[2], av_clip_uintp2(((int)(B_R + Y1) >> 14) + 
(1<<15), 16));
-            if (eightbytes) {
-                output_pixel(&dest[3], av_clip_uintp2(A1      , 30) >> 14);
-                output_pixel(&dest[4], av_clip_uintp2(((int)(R_B + Y2) >> 14) 
+ (1<<15), 16));
-                output_pixel(&dest[5], av_clip_uintp2(((int)(  G + Y2) >> 14) 
+ (1<<15), 16));
-                output_pixel(&dest[6], av_clip_uintp2(((int)(B_R + Y2) >> 14) 
+ (1<<15), 16));
-                output_pixel(&dest[7], av_clip_uintp2(A2      , 30) >> 14);
-                dest += 8;
+            if (target == AV_PIX_FMT_RGBF32LE || target == 
AV_PIX_FMT_RGBF32BE) {
+                output_pixel32(&float_dest[0], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(R_B + Y1) >> 14) + (1<<15), 16)));
+                output_pixel32(&float_dest[1], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(  G + Y1) >> 14) + (1<<15), 16)));
+                output_pixel32(&float_dest[2], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(B_R + Y1) >> 14) + (1<<15), 16)));
+                output_pixel32(&float_dest[3], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(R_B + Y2) >> 14) + (1<<15), 16)));
+                output_pixel32(&float_dest[4], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(  G + Y2) >> 14) + (1<<15), 16)));
+                output_pixel32(&float_dest[5], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(B_R + Y2) >> 14) + (1<<15), 16)));
+                float_dest += 6;
             } else {
-                output_pixel(&dest[3], av_clip_uintp2(((int)(R_B + Y2) >> 14) 
+ (1<<15), 16));
-                output_pixel(&dest[4], av_clip_uintp2(((int)(  G + Y2) >> 14) 
+ (1<<15), 16));
-                output_pixel(&dest[5], av_clip_uintp2(((int)(B_R + Y2) >> 14) 
+ (1<<15), 16));
-                dest += 6;
+                output_pixel(&dest[0], av_clip_uintp2(((int)(R_B + Y1) >> 14) 
+ (1<<15), 16));
+                output_pixel(&dest[1], av_clip_uintp2(((int)(  G + Y1) >> 14) 
+ (1<<15), 16));
+                output_pixel(&dest[2], av_clip_uintp2(((int)(B_R + Y1) >> 14) 
+ (1<<15), 16));
+                if (eightbytes) {
+                    output_pixel(&dest[3], av_clip_uintp2(A1      , 30) >> 14);
+                    output_pixel(&dest[4], av_clip_uintp2(((int)(R_B + Y2) >> 
14) + (1<<15), 16));
+                    output_pixel(&dest[5], av_clip_uintp2(((int)(  G + Y2) >> 
14) + (1<<15), 16));
+                    output_pixel(&dest[6], av_clip_uintp2(((int)(B_R + Y2) >> 
14) + (1<<15), 16));
+                    output_pixel(&dest[7], av_clip_uintp2(A2      , 30) >> 14);
+                    dest += 8;
+                } else {
+                    output_pixel(&dest[3], av_clip_uintp2(((int)(R_B + Y2) >> 
14) + (1<<15), 16));
+                    output_pixel(&dest[4], av_clip_uintp2(((int)(  G + Y2) >> 
14) + (1<<15), 16));
+                    output_pixel(&dest[5], av_clip_uintp2(((int)(B_R + Y2) >> 
14) + (1<<15), 16));
+                    dest += 6;
+                }
             }
         }
     } else {
@@ -1373,21 +1409,31 @@ yuv2rgba64_1_c_template(SwsInternal *c, const int32_t 
*buf0,
             G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff;
             B =                            U * c->yuv2rgb_u2b_coeff;
 
-            output_pixel(&dest[0], av_clip_uintp2(((int)(R_B + Y1) >> 14) + 
(1<<15), 16));
-            output_pixel(&dest[1], av_clip_uintp2(((int)(  G + Y1) >> 14) + 
(1<<15), 16));
-            output_pixel(&dest[2], av_clip_uintp2(((int)(B_R + Y1) >> 14) + 
(1<<15), 16));
-            if (eightbytes) {
-                output_pixel(&dest[3], av_clip_uintp2(A1      , 30) >> 14);
-                output_pixel(&dest[4], av_clip_uintp2(((int)(R_B + Y2) >> 14) 
+ (1<<15), 16));
-                output_pixel(&dest[5], av_clip_uintp2(((int)(  G + Y2) >> 14) 
+ (1<<15), 16));
-                output_pixel(&dest[6], av_clip_uintp2(((int)(B_R + Y2) >> 14) 
+ (1<<15), 16));
-                output_pixel(&dest[7], av_clip_uintp2(A2      , 30) >> 14);
-                dest += 8;
+            if (target == AV_PIX_FMT_RGBF32LE || target == 
AV_PIX_FMT_RGBF32BE) {
+                output_pixel32(&float_dest[0], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(R_B + Y1) >> 14) + (1<<15), 16)));
+                output_pixel32(&float_dest[1], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(  G + Y1) >> 14) + (1<<15), 16)));
+                output_pixel32(&float_dest[2], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(B_R + Y1) >> 14) + (1<<15), 16)));
+                output_pixel32(&float_dest[3], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(R_B + Y2) >> 14) + (1<<15), 16)));
+                output_pixel32(&float_dest[4], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(  G + Y2) >> 14) + (1<<15), 16)));
+                output_pixel32(&float_dest[5], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(B_R + Y2) >> 14) + (1<<15), 16)));
+                float_dest += 6;
             } else {
-                output_pixel(&dest[3], av_clip_uintp2(((int)(R_B + Y2) >> 14) 
+ (1<<15), 16));
-                output_pixel(&dest[4], av_clip_uintp2(((int)(  G + Y2) >> 14) 
+ (1<<15), 16));
-                output_pixel(&dest[5], av_clip_uintp2(((int)(B_R + Y2) >> 14) 
+ (1<<15), 16));
-                dest += 6;
+                output_pixel(&dest[0], av_clip_uintp2(((int)(R_B + Y1) >> 14) 
+ (1<<15), 16));
+                output_pixel(&dest[1], av_clip_uintp2(((int)(  G + Y1) >> 14) 
+ (1<<15), 16));
+                output_pixel(&dest[2], av_clip_uintp2(((int)(B_R + Y1) >> 14) 
+ (1<<15), 16));
+                if (eightbytes) {
+                    output_pixel(&dest[3], av_clip_uintp2(A1      , 30) >> 14);
+                    output_pixel(&dest[4], av_clip_uintp2(((int)(R_B + Y2) >> 
14) + (1<<15), 16));
+                    output_pixel(&dest[5], av_clip_uintp2(((int)(  G + Y2) >> 
14) + (1<<15), 16));
+                    output_pixel(&dest[6], av_clip_uintp2(((int)(B_R + Y2) >> 
14) + (1<<15), 16));
+                    output_pixel(&dest[7], av_clip_uintp2(A2      , 30) >> 14);
+                    dest += 8;
+                } else {
+                    output_pixel(&dest[3], av_clip_uintp2(((int)(R_B + Y2) >> 
14) + (1<<15), 16));
+                    output_pixel(&dest[4], av_clip_uintp2(((int)(  G + Y2) >> 
14) + (1<<15), 16));
+                    output_pixel(&dest[5], av_clip_uintp2(((int)(B_R + Y2) >> 
14) + (1<<15), 16));
+                    dest += 6;
+                }
             }
         }
     }
@@ -1402,6 +1448,8 @@ yuv2rgba64_full_X_c_template(SwsInternal *c, const 
int16_t *lumFilter,
                        int y, enum AVPixelFormat target, int hasAlpha,
                        int eightbytes, int is_be)
 {
+    static const float float_mult = 1.0f / 65535.0f;
+    uint32_t *float_dest = (uint32_t *)dest;
     int i;
     int A = 0xffff<<14;
 
@@ -1445,15 +1493,22 @@ yuv2rgba64_full_X_c_template(SwsInternal *c, const 
int16_t *lumFilter,
         G = (unsigned)V * c->yuv2rgb_v2g_coeff + (unsigned)U * 
c->yuv2rgb_u2g_coeff;
         B =                                      (unsigned)U * 
c->yuv2rgb_u2b_coeff;
 
-        // 8bit: 30 - 22 = 8bit, 16bit: 30bit - 14 = 16bit
-        output_pixel(&dest[0], av_clip_uintp2(((int)(R_B + (unsigned)Y)>>14) + 
(1<<15), 16));
-        output_pixel(&dest[1], av_clip_uintp2(((int)(  G + (unsigned)Y)>>14) + 
(1<<15), 16));
-        output_pixel(&dest[2], av_clip_uintp2(((int)(B_R + (unsigned)Y)>>14) + 
(1<<15), 16));
-        if (eightbytes) {
-            output_pixel(&dest[3], av_clip_uintp2(A, 30) >> 14);
-            dest += 4;
+        if (target == AV_PIX_FMT_RGBF32LE || target == AV_PIX_FMT_RGBF32BE) {
+            output_pixel32(&float_dest[0], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(R_B + Y) >> 14) + (1<<15), 16)));
+            output_pixel32(&float_dest[1], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(  G + Y) >> 14) + (1<<15), 16)));
+            output_pixel32(&float_dest[2], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(B_R + Y) >> 14) + (1<<15), 16)));
+            float_dest += 3;
         } else {
-            dest += 3;
+            // 8bit: 30 - 22 = 8bit, 16bit: 30bit - 14 = 16bit
+            output_pixel(&dest[0], av_clip_uintp2(((int)(R_B + 
(unsigned)Y)>>14) + (1<<15), 16));
+            output_pixel(&dest[1], av_clip_uintp2(((int)(  G + 
(unsigned)Y)>>14) + (1<<15), 16));
+            output_pixel(&dest[2], av_clip_uintp2(((int)(B_R + 
(unsigned)Y)>>14) + (1<<15), 16));
+            if (eightbytes) {
+                output_pixel(&dest[3], av_clip_uintp2(A, 30) >> 14);
+                dest += 4;
+            } else {
+                dest += 3;
+            }
         }
     }
 }
@@ -1468,6 +1523,8 @@ yuv2rgba64_full_2_c_template(SwsInternal *c, const 
int32_t *buf[2],
 {
     unsigned  yalpha =  yalpha_param;
     unsigned uvalpha = uvalpha_param;
+    static const float float_mult = 1.0f / 65535.0f;
+    uint32_t *float_dest = (uint32_t *)dest;
     const int32_t *buf0  = buf[0],  *buf1  = buf[1],
                   *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
                   *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
@@ -1501,14 +1558,21 @@ yuv2rgba64_full_2_c_template(SwsInternal *c, const 
int32_t *buf[2],
             A += 1 << 13;
         }
 
-        output_pixel(&dest[0], av_clip_uintp2(((int)(R_B + Y) >> 14) + 
(1<<15), 16));
-        output_pixel(&dest[1], av_clip_uintp2(((int)(  G + Y) >> 14) + 
(1<<15), 16));
-        output_pixel(&dest[2], av_clip_uintp2(((int)(B_R + Y) >> 14) + 
(1<<15), 16));
-        if (eightbytes) {
-            output_pixel(&dest[3], av_clip_uintp2(A, 30) >> 14);
-            dest += 4;
+        if (target == AV_PIX_FMT_RGBF32LE || target == AV_PIX_FMT_RGBF32BE) {
+            output_pixel32(&float_dest[0], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(R_B + Y) >> 14) + (1<<15), 16)));
+            output_pixel32(&float_dest[1], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(  G + Y) >> 14) + (1<<15), 16)));
+            output_pixel32(&float_dest[2], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(B_R + Y) >> 14) + (1<<15), 16)));
+            float_dest += 3;
         } else {
-            dest += 3;
+            output_pixel(&dest[0], av_clip_uintp2(((int)(R_B + Y) >> 14) + 
(1<<15), 16));
+            output_pixel(&dest[1], av_clip_uintp2(((int)(  G + Y) >> 14) + 
(1<<15), 16));
+            output_pixel(&dest[2], av_clip_uintp2(((int)(B_R + Y) >> 14) + 
(1<<15), 16));
+            if (eightbytes) {
+                output_pixel(&dest[3], av_clip_uintp2(A, 30) >> 14);
+                dest += 4;
+            } else {
+                dest += 3;
+            }
         }
     }
 }
@@ -1521,6 +1585,8 @@ yuv2rgba64_full_1_c_template(SwsInternal *c, const 
int32_t *buf0,
                        int hasAlpha, int eightbytes, int is_be)
 {
     const int32_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
+    static const float float_mult = 1.0f / 65535.0f;
+    uint32_t *float_dest = (uint32_t *)dest;
     int i;
     SUINT A = 0xffff<<14;
 
@@ -1545,14 +1611,21 @@ yuv2rgba64_full_1_c_template(SwsInternal *c, const 
int32_t *buf0,
             G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff;
             B =                            U * c->yuv2rgb_u2b_coeff;
 
-            output_pixel(&dest[0], av_clip_uintp2(((int)(R_B + Y) >> 14) + 
(1<<15), 16));
-            output_pixel(&dest[1], av_clip_uintp2(((int)(  G + Y) >> 14) + 
(1<<15), 16));
-            output_pixel(&dest[2], av_clip_uintp2(((int)(B_R + Y) >> 14) + 
(1<<15), 16));
-            if (eightbytes) {
-                output_pixel(&dest[3], av_clip_uintp2(A, 30) >> 14);
-                dest += 4;
+            if (target == AV_PIX_FMT_RGBF32LE || target == 
AV_PIX_FMT_RGBF32BE) {
+                output_pixel32(&float_dest[0], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(R_B + Y) >> 14) + (1<<15), 16)));
+                output_pixel32(&float_dest[1], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(  G + Y) >> 14) + (1<<15), 16)));
+                output_pixel32(&float_dest[2], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(B_R + Y) >> 14) + (1<<15), 16)));
+                float_dest += 3;
             } else {
-                dest += 3;
+                output_pixel(&dest[0], av_clip_uintp2(((int)(R_B + Y) >> 14) + 
(1<<15), 16));
+                output_pixel(&dest[1], av_clip_uintp2(((int)(  G + Y) >> 14) + 
(1<<15), 16));
+                output_pixel(&dest[2], av_clip_uintp2(((int)(B_R + Y) >> 14) + 
(1<<15), 16));
+                if (eightbytes) {
+                    output_pixel(&dest[3], av_clip_uintp2(A, 30) >> 14);
+                    dest += 4;
+                } else {
+                    dest += 3;
+                }
             }
         }
     } else {
@@ -1581,14 +1654,21 @@ yuv2rgba64_full_1_c_template(SwsInternal *c, const 
int32_t *buf0,
             G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff;
             B =                            U * c->yuv2rgb_u2b_coeff;
 
-            output_pixel(&dest[0], av_clip_uintp2(((int)(R_B + Y) >> 14) + 
(1<<15), 16));
-            output_pixel(&dest[1], av_clip_uintp2(((int)(  G + Y) >> 14) + 
(1<<15), 16));
-            output_pixel(&dest[2], av_clip_uintp2(((int)(B_R + Y) >> 14) + 
(1<<15), 16));
-            if (eightbytes) {
-                output_pixel(&dest[3], av_clip_uintp2(A, 30) >> 14);
-                dest += 4;
+            if (target == AV_PIX_FMT_RGBF32LE || target == 
AV_PIX_FMT_RGBF32BE) {
+                output_pixel32(&float_dest[0], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(R_B + Y) >> 14) + (1<<15), 16)));
+                output_pixel32(&float_dest[1], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(  G + Y) >> 14) + (1<<15), 16)));
+                output_pixel32(&float_dest[2], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(B_R + Y) >> 14) + (1<<15), 16)));
+                float_dest += 3;
             } else {
-                dest += 3;
+                output_pixel(&dest[0], av_clip_uintp2(((int)(R_B + Y) >> 14) + 
(1<<15), 16));
+                output_pixel(&dest[1], av_clip_uintp2(((int)(  G + Y) >> 14) + 
(1<<15), 16));
+                output_pixel(&dest[2], av_clip_uintp2(((int)(B_R + Y) >> 14) + 
(1<<15), 16));
+                if (eightbytes) {
+                    output_pixel(&dest[3], av_clip_uintp2(A, 30) >> 14);
+                    dest += 4;
+                } else {
+                    dest += 3;
+                }
             }
         }
     }
@@ -1659,6 +1739,8 @@ YUV2PACKED16WRAPPER(yuv2, rgba64, bgra64be, 
AV_PIX_FMT_BGRA64, BE, 1, 1)
 YUV2PACKED16WRAPPER(yuv2, rgba64, bgra64le, AV_PIX_FMT_BGRA64, LE, 1, 1)
 YUV2PACKED16WRAPPER(yuv2, rgba64, bgrx64be, AV_PIX_FMT_BGRA64, BE, 0, 1)
 YUV2PACKED16WRAPPER(yuv2, rgba64, bgrx64le, AV_PIX_FMT_BGRA64, LE, 0, 1)
+YUV2PACKED16WRAPPER(yuv2, rgba64, rgbf32be, AV_PIX_FMT_RGBF32, BE, 0, 0)
+YUV2PACKED16WRAPPER(yuv2, rgba64, rgbf32le, AV_PIX_FMT_RGBF32, LE, 0, 0)
 YUV2PACKED16WRAPPER(yuv2, ya16, ya16be, AV_PIX_FMT_YA16, BE, 1, 0)
 YUV2PACKED16WRAPPER(yuv2, ya16, ya16le, AV_PIX_FMT_YA16, LE, 1, 0)
 YUV2PACKED16WRAPPER(yuv2, ya16, yaf32be, AV_PIX_FMT_YAF32, BE, 1, 0)
@@ -1676,6 +1758,8 @@ YUV2PACKED16WRAPPER(yuv2, rgba64_full, bgra64be_full, 
AV_PIX_FMT_BGRA64, BE, 1,
 YUV2PACKED16WRAPPER(yuv2, rgba64_full, bgra64le_full, AV_PIX_FMT_BGRA64, LE, 
1, 1)
 YUV2PACKED16WRAPPER(yuv2, rgba64_full, bgrx64be_full, AV_PIX_FMT_BGRA64, BE, 
0, 1)
 YUV2PACKED16WRAPPER(yuv2, rgba64_full, bgrx64le_full, AV_PIX_FMT_BGRA64, LE, 
0, 1)
+YUV2PACKED16WRAPPER(yuv2, rgba64_full, rgbf32be_full, AV_PIX_FMT_RGBF32, BE, 
0, 0)
+YUV2PACKED16WRAPPER(yuv2, rgba64_full, rgbf32le_full, AV_PIX_FMT_RGBF32, LE, 
0, 0)
 
 /*
  * Write out 2 RGB pixels in the target pixel format. This function takes a
@@ -3586,6 +3670,16 @@ av_cold void ff_sws_init_output_funcs(SwsInternal *c,
             *yuv2packed2 = yuv2x2bgr10_full_2_c;
             *yuv2packed1 = yuv2x2bgr10_full_1_c;
             break;
+        case AV_PIX_FMT_RGBF32LE:
+            *yuv2packedX = yuv2rgbf32le_full_X_c;
+            *yuv2packed2 = yuv2rgbf32le_full_2_c;
+            *yuv2packed1 = yuv2rgbf32le_full_1_c;
+            break;
+        case AV_PIX_FMT_RGBF32BE:
+            *yuv2packedX = yuv2rgbf32be_full_X_c;
+            *yuv2packed2 = yuv2rgbf32be_full_2_c;
+            *yuv2packed1 = yuv2rgbf32be_full_1_c;
+            break;
         case AV_PIX_FMT_GBRP:
         case AV_PIX_FMT_GBRP9BE:
         case AV_PIX_FMT_GBRP9LE:
@@ -3810,6 +3904,16 @@ av_cold void ff_sws_init_output_funcs(SwsInternal *c,
             *yuv2packed2 = yuv2x2bgr10_2_c;
             *yuv2packedX = yuv2x2bgr10_X_c;
             break;
+        case AV_PIX_FMT_RGBF32LE:
+            *yuv2packedX = yuv2rgbf32le_X_c;
+            *yuv2packed2 = yuv2rgbf32le_2_c;
+            *yuv2packed1 = yuv2rgbf32le_1_c;
+            break;
+        case AV_PIX_FMT_RGBF32BE:
+            *yuv2packedX = yuv2rgbf32be_X_c;
+            *yuv2packed2 = yuv2rgbf32be_2_c;
+            *yuv2packed1 = yuv2rgbf32be_1_c;
+            break;
         }
     }
     switch (dstFormat) {
diff --git a/libswscale/utils.c b/libswscale/utils.c
index 6aabce39aba..37a9cb94b50 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -1396,6 +1396,8 @@ av_cold int ff_sws_init_single_context(SwsContext *sws, 
SwsFilter *srcFilter,
         dstFormat != AV_PIX_FMT_RGB48BE &&
         dstFormat != AV_PIX_FMT_BGR48LE &&
         dstFormat != AV_PIX_FMT_BGR48BE &&
+        dstFormat != AV_PIX_FMT_RGBF32LE &&
+        dstFormat != AV_PIX_FMT_RGBF32BE &&
         dstFormat != AV_PIX_FMT_RGBA  &&
         dstFormat != AV_PIX_FMT_ARGB  &&
         dstFormat != AV_PIX_FMT_BGRA  &&
diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c
index a430a110db7..bb15ab1f77f 100644
--- a/libswscale/yuv2rgb.c
+++ b/libswscale/yuv2rgb.c
@@ -965,7 +965,7 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsInternal *c, const 
int inv_table[4],
         fill_gv_table(c->table_gV, 4, cgv);
         break;
     default:
-        if(!isPlanar(c->opts.dst_format) || bpp <= 24)
+        if ((!isPlanar(c->opts.dst_format) && !isFloat(c->opts.dst_format)) || 
bpp <= 24)
             av_log(c, AV_LOG_ERROR, "%ibpp not supported by yuv2rgb\n", bpp);
         return AVERROR(EINVAL);
     }
diff --git a/tests/ref/fate/filter-pixdesc-rgbf32be 
b/tests/ref/fate/filter-pixdesc-rgbf32be
new file mode 100644
index 00000000000..87913a59f1b
--- /dev/null
+++ b/tests/ref/fate/filter-pixdesc-rgbf32be
@@ -0,0 +1 @@
+pixdesc-rgbf32be    9513ca81f85fe60c48b5bb6160b98180
diff --git a/tests/ref/fate/filter-pixdesc-rgbf32le 
b/tests/ref/fate/filter-pixdesc-rgbf32le
new file mode 100644
index 00000000000..7b362bbb98e
--- /dev/null
+++ b/tests/ref/fate/filter-pixdesc-rgbf32le
@@ -0,0 +1 @@
+pixdesc-rgbf32le    440a6f384268d355816b02e7c3c368ce
diff --git a/tests/ref/fate/filter-pixfmts-copy 
b/tests/ref/fate/filter-pixfmts-copy
index 5c02a638974..cd68289f119 100644
--- a/tests/ref/fate/filter-pixfmts-copy
+++ b/tests/ref/fate/filter-pixfmts-copy
@@ -104,6 +104,8 @@ rgb8                7ac6008c84d622c2fc50581706e17576
 rgba                b6e1b441c365e03b5ffdf9b7b68d9a0c
 rgba64be            ae2ae04b5efedca3505f47c4dd6ea6ea
 rgba64le            b91e1d77f799eb92241a2d2d28437b15
+rgbf32be            eb8610acb97af6adb59d8a192204bf26
+rgbf32le            134ac0933d1f2bef30d11fd113ab2ecc
 uyva                8896d7525f12de08818a01a5d5cf84f1
 uyvy422             3bcf3c80047592f2211fae3260b1b65d
 v30xle              44503e6d78bc474c1b72c5ceb1779539
diff --git a/tests/ref/fate/filter-pixfmts-crop 
b/tests/ref/fate/filter-pixfmts-crop
index 261336f7cff..c845bd580e5 100644
--- a/tests/ref/fate/filter-pixfmts-crop
+++ b/tests/ref/fate/filter-pixfmts-crop
@@ -102,6 +102,8 @@ rgb8                9b364a8f112ad9459fec47a51cc03b30
 rgba                9488ac85abceaf99a9309eac5a87697e
 rgba64be            89910046972ab3c68e2a348302cc8ca9
 rgba64le            fea8ebfc869b52adf353778f29eac7a7
+rgbf32be            d6f8c49ef3def3c11a06dd70ebc057d4
+rgbf32le            7a5e25cd4812e34103751b61c894b27d
 uyva                03f362ac6a39f25286bc6616111b0752
 v30xle              ee090c91c28e70b126f6c76a64c39f60
 vuya                76578a705ff3a37559653c1289bd03dd
diff --git a/tests/ref/fate/filter-pixfmts-field 
b/tests/ref/fate/filter-pixfmts-field
index 1e137f4b479..9f807433c9e 100644
--- a/tests/ref/fate/filter-pixfmts-field
+++ b/tests/ref/fate/filter-pixfmts-field
@@ -104,6 +104,8 @@ rgb8                62c3b9e2a171de3d894a8eeb271c85e8
 rgba                ee616262ca6d67b7ecfba4b36c602ce3
 rgba64be            23c8c0edaabe3eaec89ce69633fb0048
 rgba64le            dfdba4de4a7cac9abf08852666c341d3
+rgbf32be            919ea3ceab0fbb77e4a53548cb7191a3
+rgbf32le            c6dc8ae2b4dfd4c1c0f6b3af950dbeef
 uyva                147398d2e8d310f915c95863ad192c5e
 uyvy422             1c49e44ab3f060e85fc4a3a9464f045e
 v30xle              394101c7c80b12e34f4352156a3a74b3
diff --git a/tests/ref/fate/filter-pixfmts-fieldorder 
b/tests/ref/fate/filter-pixfmts-fieldorder
index 93bea75fbbf..0b5c4342fb6 100644
--- a/tests/ref/fate/filter-pixfmts-fieldorder
+++ b/tests/ref/fate/filter-pixfmts-fieldorder
@@ -93,6 +93,8 @@ rgb8                6deae05ccac5c50bd0d9c9fe8e124557
 rgba                1fdf872a087a32cd35b80cc7be399578
 rgba64be            5598f44514d122b9a57c5c92c20bbc61
 rgba64le            b34e6e30621ae579519a2d91a96a0acf
+rgbf32be            f92c90bf08d70e854e4f8179de0eaf30
+rgbf32le            6202cc01added07819b74bb062ceef17
 uyva                ccf5dfd33765dda88c4b4afa2ea31305
 uyvy422             75de70e31c435dde878002d3f22b238a
 v30xle              e453b8f0ad09e64e3a0173a4e3c2930d
diff --git a/tests/ref/fate/filter-pixfmts-hflip 
b/tests/ref/fate/filter-pixfmts-hflip
index 05fc467a9df..c071cf64240 100644
--- a/tests/ref/fate/filter-pixfmts-hflip
+++ b/tests/ref/fate/filter-pixfmts-hflip
@@ -102,6 +102,8 @@ rgb8                68a3a575badadd9e4f90226209f11699
 rgba                51961c723ea6707e0a410cd3f21f15d3
 rgba64be            c910444019f4cfbf4d995227af55da8d
 rgba64le            0c810d8b3a6bca10321788e1cb145340
+rgbf32be            82ca0560630c21b141098adbf5a2e65e
+rgbf32le            46e3d448f093bb386ba93885bd99861c
 uyva                a8391c24037e2a670196b47bf6a2ca57
 v30xle              ea5575ee99f826d7447bcc47fdb6639f
 vuya                7e530261e7ac4eae4fd616fd7572d0b8
diff --git a/tests/ref/fate/filter-pixfmts-il b/tests/ref/fate/filter-pixfmts-il
index b790105e364..e3e72f715c8 100644
--- a/tests/ref/fate/filter-pixfmts-il
+++ b/tests/ref/fate/filter-pixfmts-il
@@ -103,6 +103,8 @@ rgb8                93f9fa5ecf522abe13ed34f21831fdfe
 rgba                625d8f4bd39c4bdbf61eb5e4713aecc9
 rgba64be            db70d33aa6c06f3e0a1c77bd11284261
 rgba64le            a8a2daae04374a27219bc1c890204007
+rgbf32be            9dc7a55820a278c5f5c7eba50f5e9564
+rgbf32le            2c71576443b61ac5222c1a33564a10e3
 uyva                d2655e1a1c56bcb48f7c7a6a6270dd93
 uyvy422             d6ee3ca43356d08c392382b24b22cda5
 v30xle              40776197aa84a4784d195692fe890c88
diff --git a/tests/ref/fate/filter-pixfmts-null 
b/tests/ref/fate/filter-pixfmts-null
index 5c02a638974..cd68289f119 100644
--- a/tests/ref/fate/filter-pixfmts-null
+++ b/tests/ref/fate/filter-pixfmts-null
@@ -104,6 +104,8 @@ rgb8                7ac6008c84d622c2fc50581706e17576
 rgba                b6e1b441c365e03b5ffdf9b7b68d9a0c
 rgba64be            ae2ae04b5efedca3505f47c4dd6ea6ea
 rgba64le            b91e1d77f799eb92241a2d2d28437b15
+rgbf32be            eb8610acb97af6adb59d8a192204bf26
+rgbf32le            134ac0933d1f2bef30d11fd113ab2ecc
 uyva                8896d7525f12de08818a01a5d5cf84f1
 uyvy422             3bcf3c80047592f2211fae3260b1b65d
 v30xle              44503e6d78bc474c1b72c5ceb1779539
diff --git a/tests/ref/fate/filter-pixfmts-scale 
b/tests/ref/fate/filter-pixfmts-scale
index 54f0db1a76a..5478a2be98b 100644
--- a/tests/ref/fate/filter-pixfmts-scale
+++ b/tests/ref/fate/filter-pixfmts-scale
@@ -104,6 +104,8 @@ rgb8                bcdc033b4ef0979d060dbc8893d4db58
 rgba                85bb5d03cea1c6e8002ced3373904336
 rgba64be            ee73e57923af984b31cc7795d13929da
 rgba64le            783d2779adfafe3548bdb671ec0de69e
+rgbf32be            8491b339d91c40ad4d96d5b68aefd046
+rgbf32le            0262f60b0a8f1a05b24f3959d8122857
 uyva                2358038be6dac002a6c736e798a3d91c
 uyvy422             aeb4ba4f9f003ae21f6d18089198244f
 v30xle              8cba1fdc0ba2c39eb6fb5885dcf628a7
diff --git a/tests/ref/fate/filter-pixfmts-transpose 
b/tests/ref/fate/filter-pixfmts-transpose
index 4b07f1bd79b..91d61f8e2e7 100644
--- a/tests/ref/fate/filter-pixfmts-transpose
+++ b/tests/ref/fate/filter-pixfmts-transpose
@@ -92,6 +92,8 @@ rgb8                c90feb30c3c9391ef5f470209d7b7a15
 rgba                4d76a9542143752a4ac30f82f88f68f1
 rgba64be            a60041217f4c0cd796d19d3940a12a41
 rgba64le            ad47197774858858ae7b0c177dffa459
+rgbf32be            a89fa50c9e278ad1e2bc44a9435c48fd
+rgbf32le            883cc75a2f3f00090b719d99e4c2b1da
 uyva                cb773ee5a9f8964b9c826d55f9f425a3
 v30xle              55147546a787bc72fcb0ca28b1456344
 vuya                9ece18a345beb17cd19e09e443eca4bf
diff --git a/tests/ref/fate/filter-pixfmts-vflip 
b/tests/ref/fate/filter-pixfmts-vflip
index 7f08bc9254d..3fe598f2098 100644
--- a/tests/ref/fate/filter-pixfmts-vflip
+++ b/tests/ref/fate/filter-pixfmts-vflip
@@ -104,6 +104,8 @@ rgb8                7df049b6094f8a5e084d74462f6d6cde
 rgba                c1a5908572737f2ae1e5d8218af65f4b
 rgba64be            17e6273323b5779b5f3f775f150c1011
 rgba64le            48f45b10503b7dd140329c3dd0d54c98
+rgbf32be            3fccaf8e4c5a55cb4cca6df18b702525
+rgbf32le            cd0b091dfe143cec2bc9af0cd6af073a
 uyva                d43e89ba3d5c9274e1948eac8630fcc6
 uyvy422             3a237e8376264e0cfa78f8a3fdadec8a
 v30xle              15de0d677d900991e41671a57c431ba5
-- 
2.54.0


>From 1a6601b2cc4a1ab9703b2b1b166fe9d3c6c426ea Mon Sep 17 00:00:00 2001
From: James Almer <[email protected]>
Date: Mon, 9 Nov 2026 10:08:55 -0300
Subject: [PATCH 7/7] swscale/output: add support for RGBAF32

Signed-off-by: James Almer <[email protected]>
---
 libswscale/format.c                      |   4 +-
 libswscale/output.c                      | 194 +++++++++++++++++++----
 libswscale/utils.c                       |   2 +
 tests/ref/fate/filter-pixdesc-rgbaf32be  |   1 +
 tests/ref/fate/filter-pixdesc-rgbaf32le  |   1 +
 tests/ref/fate/filter-pixfmts-copy       |   2 +
 tests/ref/fate/filter-pixfmts-crop       |   2 +
 tests/ref/fate/filter-pixfmts-field      |   2 +
 tests/ref/fate/filter-pixfmts-fieldorder |   2 +
 tests/ref/fate/filter-pixfmts-hflip      |   2 +
 tests/ref/fate/filter-pixfmts-il         |   2 +
 tests/ref/fate/filter-pixfmts-null       |   2 +
 tests/ref/fate/filter-pixfmts-scale      |   2 +
 tests/ref/fate/filter-pixfmts-transpose  |   2 +
 tests/ref/fate/filter-pixfmts-vflip      |   2 +
 15 files changed, 190 insertions(+), 32 deletions(-)
 create mode 100644 tests/ref/fate/filter-pixdesc-rgbaf32be
 create mode 100644 tests/ref/fate/filter-pixdesc-rgbaf32le

diff --git a/libswscale/format.c b/libswscale/format.c
index 5482982c0db..fd0c83a34c8 100644
--- a/libswscale/format.c
+++ b/libswscale/format.c
@@ -271,8 +271,8 @@ static const LegacyFormatEntry legacy_format_entries[] = {
     [AV_PIX_FMT_RGBF16LE]       = { 1, 0 },
     [AV_PIX_FMT_RGBF32BE]       = { 1, 1 },
     [AV_PIX_FMT_RGBF32LE]       = { 1, 1 },
-    [AV_PIX_FMT_RGBAF32BE]      = { 1, 0 },
-    [AV_PIX_FMT_RGBAF32LE]      = { 1, 0 },
+    [AV_PIX_FMT_RGBAF32BE]      = { 1, 1 },
+    [AV_PIX_FMT_RGBAF32LE]      = { 1, 1 },
     [AV_PIX_FMT_XV30LE]         = { 1, 1 },
     [AV_PIX_FMT_XV36LE]         = { 1, 1 },
     [AV_PIX_FMT_XV36BE]         = { 1, 1 },
diff --git a/libswscale/output.c b/libswscale/output.c
index 28c3c3fcc4e..0fcd92bef5d 100644
--- a/libswscale/output.c
+++ b/libswscale/output.c
@@ -1009,8 +1009,10 @@ YUV2PACKEDWRAPPER(yuv2, 422, yuyv422, AV_PIX_FMT_YUYV422)
 YUV2PACKEDWRAPPER(yuv2, 422, yvyu422, AV_PIX_FMT_YVYU422)
 YUV2PACKEDWRAPPER(yuv2, 422, uyvy422, AV_PIX_FMT_UYVY422)
 
-#define R_B ((target == AV_PIX_FMT_RGB48LE || target == AV_PIX_FMT_RGB48BE || 
target == AV_PIX_FMT_RGBA64LE || target == AV_PIX_FMT_RGBA64BE || target == 
AV_PIX_FMT_RGBF32LE || target == AV_PIX_FMT_RGBF32BE) ? R : B)
-#define B_R ((target == AV_PIX_FMT_RGB48LE || target == AV_PIX_FMT_RGB48BE || 
target == AV_PIX_FMT_RGBA64LE || target == AV_PIX_FMT_RGBA64BE || target == 
AV_PIX_FMT_RGBF32LE || target == AV_PIX_FMT_RGBF32BE) ? B : R)
+#define R_B ((target == AV_PIX_FMT_RGB48LE  || target == AV_PIX_FMT_RGB48BE  
|| target == AV_PIX_FMT_RGBA64LE || target == AV_PIX_FMT_RGBA64BE || \
+              target == AV_PIX_FMT_RGBF32LE || target == AV_PIX_FMT_RGBF32BE 
|| target == AV_PIX_FMT_RGBAF32LE || target == AV_PIX_FMT_RGBAF32BE) ? R : B)
+#define B_R ((target == AV_PIX_FMT_RGB48LE  || target == AV_PIX_FMT_RGB48BE  
|| target == AV_PIX_FMT_RGBA64LE || target == AV_PIX_FMT_RGBA64BE || \
+              target == AV_PIX_FMT_RGBF32LE || target == AV_PIX_FMT_RGBF32BE 
|| target == AV_PIX_FMT_RGBAF32LE || target == AV_PIX_FMT_RGBAF32BE) ? B : R)
 #define output_pixel(pos, val) \
     if (is_be) { \
         AV_WB16(pos, val); \
@@ -1146,6 +1148,8 @@ yuv2rgba64_X_c_template(SwsInternal *c, const int16_t 
*lumFilter,
 {
     static const float float_mult = 1.0f / 65535.0f;
     uint32_t *float_dest = (uint32_t *)dest;
+    int is_float = target == AV_PIX_FMT_RGBF32LE || target == 
AV_PIX_FMT_RGBF32BE ||
+                   target == AV_PIX_FMT_RGBAF32LE || target == 
AV_PIX_FMT_RGBAF32BE;
     int i;
     int A1 = 0xffff<<14, A2 = 0xffff<<14;
 
@@ -1200,14 +1204,23 @@ yuv2rgba64_X_c_template(SwsInternal *c, const int16_t 
*lumFilter,
         G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff;
         B =                            U * c->yuv2rgb_u2b_coeff;
 
-        if (target == AV_PIX_FMT_RGBF32LE || target == AV_PIX_FMT_RGBF32BE) {
+        if (is_float) {
             output_pixel32(&float_dest[0], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(R_B + Y1) >> 14) + (1<<15), 16)));
             output_pixel32(&float_dest[1], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(  G + Y1) >> 14) + (1<<15), 16)));
             output_pixel32(&float_dest[2], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(B_R + Y1) >> 14) + (1<<15), 16)));
-            output_pixel32(&float_dest[3], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(R_B + Y2) >> 14) + (1<<15), 16)));
-            output_pixel32(&float_dest[4], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(  G + Y2) >> 14) + (1<<15), 16)));
-            output_pixel32(&float_dest[5], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(B_R + Y2) >> 14) + (1<<15), 16)));
-            float_dest += 6;
+            if (eightbytes) {
+                output_pixel32(&float_dest[3], av_float2int(float_mult * 
(float)(av_clip_uintp2(A1      , 30) >> 14)));
+                output_pixel32(&float_dest[4], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(R_B + Y2) >> 14) + (1<<15), 16)));
+                output_pixel32(&float_dest[5], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(  G + Y2) >> 14) + (1<<15), 16)));
+                output_pixel32(&float_dest[6], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(B_R + Y2) >> 14) + (1<<15), 16)));
+                output_pixel32(&float_dest[7], av_float2int(float_mult * 
(float)(av_clip_uintp2(A2      , 30) >> 14)));
+                float_dest += 8;
+            } else {
+                output_pixel32(&float_dest[3], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(R_B + Y2) >> 14) + (1<<15), 16)));
+                output_pixel32(&float_dest[4], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(  G + Y2) >> 14) + (1<<15), 16)));
+                output_pixel32(&float_dest[5], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(B_R + Y2) >> 14) + (1<<15), 16)));
+                float_dest += 6;
+            }
         } else {
             // 8 bits: 30 - 22 = 8 bits, 16 bits: 30 bits - 14 = 16 bits
             output_pixel(&dest[0], av_clip_uintp2(((int)(R_B + Y1) >> 14) + 
(1<<15), 16));
@@ -1242,6 +1255,8 @@ yuv2rgba64_2_c_template(SwsInternal *c, const int32_t 
*buf[2],
     unsigned uvalpha = uvalpha_param;
     static const float float_mult = 1.0f / 65535.0f;
     uint32_t *float_dest = (uint32_t *)dest;
+    int is_float = target == AV_PIX_FMT_RGBF32LE || target == 
AV_PIX_FMT_RGBF32BE ||
+                   target == AV_PIX_FMT_RGBAF32LE || target == 
AV_PIX_FMT_RGBAF32BE;
     const int32_t *buf0  = buf[0],  *buf1  = buf[1],
                   *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
                   *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
@@ -1281,14 +1296,23 @@ yuv2rgba64_2_c_template(SwsInternal *c, const int32_t 
*buf[2],
             A2 += 1 << 13;
         }
 
-        if (target == AV_PIX_FMT_RGBF32LE || target == AV_PIX_FMT_RGBF32BE) {
+        if (is_float) {
             output_pixel32(&float_dest[0], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(R_B + Y1) >> 14) + (1<<15), 16)));
             output_pixel32(&float_dest[1], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(  G + Y1) >> 14) + (1<<15), 16)));
             output_pixel32(&float_dest[2], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(B_R + Y1) >> 14) + (1<<15), 16)));
-            output_pixel32(&float_dest[3], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(R_B + Y2) >> 14) + (1<<15), 16)));
-            output_pixel32(&float_dest[4], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(  G + Y2) >> 14) + (1<<15), 16)));
-            output_pixel32(&float_dest[5], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(B_R + Y2) >> 14) + (1<<15), 16)));
-            float_dest += 6;
+            if (eightbytes) {
+                output_pixel32(&float_dest[3], av_float2int(float_mult * 
(float)(av_clip_uintp2(A1      , 30) >> 14)));
+                output_pixel32(&float_dest[4], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(R_B + Y2) >> 14) + (1<<15), 16)));
+                output_pixel32(&float_dest[5], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(  G + Y2) >> 14) + (1<<15), 16)));
+                output_pixel32(&float_dest[6], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(B_R + Y2) >> 14) + (1<<15), 16)));
+                output_pixel32(&float_dest[7], av_float2int(float_mult * 
(float)(av_clip_uintp2(A2      , 30) >> 14)));
+                float_dest += 8;
+            } else {
+                output_pixel32(&float_dest[3], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(R_B + Y2) >> 14) + (1<<15), 16)));
+                output_pixel32(&float_dest[4], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(  G + Y2) >> 14) + (1<<15), 16)));
+                output_pixel32(&float_dest[5], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(B_R + Y2) >> 14) + (1<<15), 16)));
+                float_dest += 6;
+            }
         } else {
             output_pixel(&dest[0], av_clip_uintp2(((int)(R_B + Y1) >> 14) + 
(1<<15), 16));
             output_pixel(&dest[1], av_clip_uintp2(((int)(  G + Y1) >> 14) + 
(1<<15), 16));
@@ -1320,6 +1344,8 @@ yuv2rgba64_1_c_template(SwsInternal *c, const int32_t 
*buf0,
     const int32_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
     static const float float_mult = 1.0f / 65535.0f;
     uint32_t *float_dest = (uint32_t *)dest;
+    int is_float = target == AV_PIX_FMT_RGBF32LE || target == 
AV_PIX_FMT_RGBF32BE ||
+                   target == AV_PIX_FMT_RGBAF32LE || target == 
AV_PIX_FMT_RGBAF32BE;
     int i;
     SUINT A1 = 0xffff<<14, A2= 0xffff<<14;
 
@@ -1350,14 +1376,23 @@ yuv2rgba64_1_c_template(SwsInternal *c, const int32_t 
*buf0,
             G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff;
             B =                            U * c->yuv2rgb_u2b_coeff;
 
-            if (target == AV_PIX_FMT_RGBF32LE || target == 
AV_PIX_FMT_RGBF32BE) {
+            if (is_float) {
                 output_pixel32(&float_dest[0], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(R_B + Y1) >> 14) + (1<<15), 16)));
                 output_pixel32(&float_dest[1], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(  G + Y1) >> 14) + (1<<15), 16)));
                 output_pixel32(&float_dest[2], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(B_R + Y1) >> 14) + (1<<15), 16)));
-                output_pixel32(&float_dest[3], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(R_B + Y2) >> 14) + (1<<15), 16)));
-                output_pixel32(&float_dest[4], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(  G + Y2) >> 14) + (1<<15), 16)));
-                output_pixel32(&float_dest[5], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(B_R + Y2) >> 14) + (1<<15), 16)));
-                float_dest += 6;
+                if (eightbytes) {
+                    output_pixel32(&float_dest[3], av_float2int(float_mult * 
(float)(av_clip_uintp2(A1      , 30) >> 14)));
+                    output_pixel32(&float_dest[4], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(R_B + Y2) >> 14) + (1<<15), 16)));
+                    output_pixel32(&float_dest[5], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(  G + Y2) >> 14) + (1<<15), 16)));
+                    output_pixel32(&float_dest[6], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(B_R + Y2) >> 14) + (1<<15), 16)));
+                    output_pixel32(&float_dest[7], av_float2int(float_mult * 
(float)(av_clip_uintp2(A2      , 30) >> 14)));
+                    float_dest += 8;
+                } else {
+                    output_pixel32(&float_dest[3], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(R_B + Y2) >> 14) + (1<<15), 16)));
+                    output_pixel32(&float_dest[4], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(  G + Y2) >> 14) + (1<<15), 16)));
+                    output_pixel32(&float_dest[5], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(B_R + Y2) >> 14) + (1<<15), 16)));
+                    float_dest += 6;
+                }
             } else {
                 output_pixel(&dest[0], av_clip_uintp2(((int)(R_B + Y1) >> 14) 
+ (1<<15), 16));
                 output_pixel(&dest[1], av_clip_uintp2(((int)(  G + Y1) >> 14) 
+ (1<<15), 16));
@@ -1409,14 +1444,23 @@ yuv2rgba64_1_c_template(SwsInternal *c, const int32_t 
*buf0,
             G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff;
             B =                            U * c->yuv2rgb_u2b_coeff;
 
-            if (target == AV_PIX_FMT_RGBF32LE || target == 
AV_PIX_FMT_RGBF32BE) {
+            if (is_float) {
                 output_pixel32(&float_dest[0], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(R_B + Y1) >> 14) + (1<<15), 16)));
                 output_pixel32(&float_dest[1], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(  G + Y1) >> 14) + (1<<15), 16)));
                 output_pixel32(&float_dest[2], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(B_R + Y1) >> 14) + (1<<15), 16)));
-                output_pixel32(&float_dest[3], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(R_B + Y2) >> 14) + (1<<15), 16)));
-                output_pixel32(&float_dest[4], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(  G + Y2) >> 14) + (1<<15), 16)));
-                output_pixel32(&float_dest[5], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(B_R + Y2) >> 14) + (1<<15), 16)));
-                float_dest += 6;
+                if (eightbytes) {
+                    output_pixel32(&float_dest[3], av_float2int(float_mult * 
(float)(av_clip_uintp2(A1      , 30) >> 14)));
+                    output_pixel32(&float_dest[4], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(R_B + Y2) >> 14) + (1<<15), 16)));
+                    output_pixel32(&float_dest[5], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(  G + Y2) >> 14) + (1<<15), 16)));
+                    output_pixel32(&float_dest[6], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(B_R + Y2) >> 14) + (1<<15), 16)));
+                    output_pixel32(&float_dest[7], av_float2int(float_mult * 
(float)(av_clip_uintp2(A2      , 30) >> 14)));
+                    float_dest += 8;
+                } else {
+                    output_pixel32(&float_dest[3], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(R_B + Y2) >> 14) + (1<<15), 16)));
+                    output_pixel32(&float_dest[4], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(  G + Y2) >> 14) + (1<<15), 16)));
+                    output_pixel32(&float_dest[5], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(B_R + Y2) >> 14) + (1<<15), 16)));
+                    float_dest += 6;
+                }
             } else {
                 output_pixel(&dest[0], av_clip_uintp2(((int)(R_B + Y1) >> 14) 
+ (1<<15), 16));
                 output_pixel(&dest[1], av_clip_uintp2(((int)(  G + Y1) >> 14) 
+ (1<<15), 16));
@@ -1450,6 +1494,8 @@ yuv2rgba64_full_X_c_template(SwsInternal *c, const 
int16_t *lumFilter,
 {
     static const float float_mult = 1.0f / 65535.0f;
     uint32_t *float_dest = (uint32_t *)dest;
+    int is_float = target == AV_PIX_FMT_RGBF32LE || target == 
AV_PIX_FMT_RGBF32BE ||
+                   target == AV_PIX_FMT_RGBAF32LE || target == 
AV_PIX_FMT_RGBAF32BE;
     int i;
     int A = 0xffff<<14;
 
@@ -1493,11 +1539,16 @@ yuv2rgba64_full_X_c_template(SwsInternal *c, const 
int16_t *lumFilter,
         G = (unsigned)V * c->yuv2rgb_v2g_coeff + (unsigned)U * 
c->yuv2rgb_u2g_coeff;
         B =                                      (unsigned)U * 
c->yuv2rgb_u2b_coeff;
 
-        if (target == AV_PIX_FMT_RGBF32LE || target == AV_PIX_FMT_RGBF32BE) {
+        if (is_float) {
             output_pixel32(&float_dest[0], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(R_B + Y) >> 14) + (1<<15), 16)));
             output_pixel32(&float_dest[1], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(  G + Y) >> 14) + (1<<15), 16)));
             output_pixel32(&float_dest[2], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(B_R + Y) >> 14) + (1<<15), 16)));
-            float_dest += 3;
+            if (eightbytes) {
+                output_pixel32(&float_dest[3], av_float2int(float_mult * 
(float)(av_clip_uintp2(A, 30) >> 14)));
+                float_dest += 4;
+            } else {
+                float_dest += 3;
+            }
         } else {
             // 8bit: 30 - 22 = 8bit, 16bit: 30bit - 14 = 16bit
             output_pixel(&dest[0], av_clip_uintp2(((int)(R_B + 
(unsigned)Y)>>14) + (1<<15), 16));
@@ -1525,6 +1576,8 @@ yuv2rgba64_full_2_c_template(SwsInternal *c, const 
int32_t *buf[2],
     unsigned uvalpha = uvalpha_param;
     static const float float_mult = 1.0f / 65535.0f;
     uint32_t *float_dest = (uint32_t *)dest;
+    int is_float = target == AV_PIX_FMT_RGBF32LE || target == 
AV_PIX_FMT_RGBF32BE ||
+                   target == AV_PIX_FMT_RGBAF32LE || target == 
AV_PIX_FMT_RGBAF32BE;
     const int32_t *buf0  = buf[0],  *buf1  = buf[1],
                   *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
                   *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
@@ -1558,11 +1611,16 @@ yuv2rgba64_full_2_c_template(SwsInternal *c, const 
int32_t *buf[2],
             A += 1 << 13;
         }
 
-        if (target == AV_PIX_FMT_RGBF32LE || target == AV_PIX_FMT_RGBF32BE) {
+        if (is_float) {
             output_pixel32(&float_dest[0], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(R_B + Y) >> 14) + (1<<15), 16)));
             output_pixel32(&float_dest[1], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(  G + Y) >> 14) + (1<<15), 16)));
             output_pixel32(&float_dest[2], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(B_R + Y) >> 14) + (1<<15), 16)));
-            float_dest += 3;
+            if (eightbytes) {
+                output_pixel32(&float_dest[3], av_float2int(float_mult * 
(float)(av_clip_uintp2(A, 30) >> 14)));
+                float_dest += 4;
+            } else {
+                float_dest += 3;
+            }
         } else {
             output_pixel(&dest[0], av_clip_uintp2(((int)(R_B + Y) >> 14) + 
(1<<15), 16));
             output_pixel(&dest[1], av_clip_uintp2(((int)(  G + Y) >> 14) + 
(1<<15), 16));
@@ -1587,6 +1645,8 @@ yuv2rgba64_full_1_c_template(SwsInternal *c, const 
int32_t *buf0,
     const int32_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
     static const float float_mult = 1.0f / 65535.0f;
     uint32_t *float_dest = (uint32_t *)dest;
+    int is_float = target == AV_PIX_FMT_RGBF32LE || target == 
AV_PIX_FMT_RGBF32BE ||
+                   target == AV_PIX_FMT_RGBAF32LE || target == 
AV_PIX_FMT_RGBAF32BE;
     int i;
     SUINT A = 0xffff<<14;
 
@@ -1611,11 +1671,16 @@ yuv2rgba64_full_1_c_template(SwsInternal *c, const 
int32_t *buf0,
             G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff;
             B =                            U * c->yuv2rgb_u2b_coeff;
 
-            if (target == AV_PIX_FMT_RGBF32LE || target == 
AV_PIX_FMT_RGBF32BE) {
+            if (is_float) {
                 output_pixel32(&float_dest[0], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(R_B + Y) >> 14) + (1<<15), 16)));
                 output_pixel32(&float_dest[1], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(  G + Y) >> 14) + (1<<15), 16)));
                 output_pixel32(&float_dest[2], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(B_R + Y) >> 14) + (1<<15), 16)));
-                float_dest += 3;
+                if (eightbytes) {
+                    output_pixel32(&float_dest[3], av_float2int(float_mult * 
(float)(av_clip_uintp2(A, 30) >> 14)));
+                    float_dest += 4;
+                } else {
+                    float_dest += 3;
+                }
             } else {
                 output_pixel(&dest[0], av_clip_uintp2(((int)(R_B + Y) >> 14) + 
(1<<15), 16));
                 output_pixel(&dest[1], av_clip_uintp2(((int)(  G + Y) >> 14) + 
(1<<15), 16));
@@ -1654,11 +1719,16 @@ yuv2rgba64_full_1_c_template(SwsInternal *c, const 
int32_t *buf0,
             G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff;
             B =                            U * c->yuv2rgb_u2b_coeff;
 
-            if (target == AV_PIX_FMT_RGBF32LE || target == 
AV_PIX_FMT_RGBF32BE) {
+            if (is_float) {
                 output_pixel32(&float_dest[0], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(R_B + Y) >> 14) + (1<<15), 16)));
                 output_pixel32(&float_dest[1], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(  G + Y) >> 14) + (1<<15), 16)));
                 output_pixel32(&float_dest[2], av_float2int(float_mult * 
(float)av_clip_uintp2(((int)(B_R + Y) >> 14) + (1<<15), 16)));
-                float_dest += 3;
+                if (eightbytes) {
+                    output_pixel32(&float_dest[3], av_float2int(float_mult * 
(float)(av_clip_uintp2(A, 30) >> 14)));
+                    float_dest += 4;
+                } else {
+                    float_dest += 3;
+                }
             } else {
                 output_pixel(&dest[0], av_clip_uintp2(((int)(R_B + Y) >> 14) + 
(1<<15), 16));
                 output_pixel(&dest[1], av_clip_uintp2(((int)(  G + Y) >> 14) + 
(1<<15), 16));
@@ -1741,6 +1811,10 @@ YUV2PACKED16WRAPPER(yuv2, rgba64, bgrx64be, 
AV_PIX_FMT_BGRA64, BE, 0, 1)
 YUV2PACKED16WRAPPER(yuv2, rgba64, bgrx64le, AV_PIX_FMT_BGRA64, LE, 0, 1)
 YUV2PACKED16WRAPPER(yuv2, rgba64, rgbf32be, AV_PIX_FMT_RGBF32, BE, 0, 0)
 YUV2PACKED16WRAPPER(yuv2, rgba64, rgbf32le, AV_PIX_FMT_RGBF32, LE, 0, 0)
+YUV2PACKED16WRAPPER(yuv2, rgba64, rgbaf32be, AV_PIX_FMT_RGBAF32, BE, 1, 1)
+YUV2PACKED16WRAPPER(yuv2, rgba64, rgbaf32le, AV_PIX_FMT_RGBAF32, LE, 1, 1)
+YUV2PACKED16WRAPPER(yuv2, rgba64, rgbxf32be, AV_PIX_FMT_RGBAF32, BE, 0, 1)
+YUV2PACKED16WRAPPER(yuv2, rgba64, rgbxf32le, AV_PIX_FMT_RGBAF32, LE, 0, 1)
 YUV2PACKED16WRAPPER(yuv2, ya16, ya16be, AV_PIX_FMT_YA16, BE, 1, 0)
 YUV2PACKED16WRAPPER(yuv2, ya16, ya16le, AV_PIX_FMT_YA16, LE, 1, 0)
 YUV2PACKED16WRAPPER(yuv2, ya16, yaf32be, AV_PIX_FMT_YAF32, BE, 1, 0)
@@ -1760,6 +1834,10 @@ YUV2PACKED16WRAPPER(yuv2, rgba64_full, bgrx64be_full, 
AV_PIX_FMT_BGRA64, BE, 0,
 YUV2PACKED16WRAPPER(yuv2, rgba64_full, bgrx64le_full, AV_PIX_FMT_BGRA64, LE, 
0, 1)
 YUV2PACKED16WRAPPER(yuv2, rgba64_full, rgbf32be_full, AV_PIX_FMT_RGBF32, BE, 
0, 0)
 YUV2PACKED16WRAPPER(yuv2, rgba64_full, rgbf32le_full, AV_PIX_FMT_RGBF32, LE, 
0, 0)
+YUV2PACKED16WRAPPER(yuv2, rgba64_full, rgbaf32be_full, AV_PIX_FMT_RGBAF32, BE, 
1, 1)
+YUV2PACKED16WRAPPER(yuv2, rgba64_full, rgbaf32le_full, AV_PIX_FMT_RGBAF32, LE, 
1, 1)
+YUV2PACKED16WRAPPER(yuv2, rgba64_full, rgbxf32be_full, AV_PIX_FMT_RGBAF32, BE, 
0, 1)
+YUV2PACKED16WRAPPER(yuv2, rgba64_full, rgbxf32le_full, AV_PIX_FMT_RGBAF32, LE, 
0, 1)
 
 /*
  * Write out 2 RGB pixels in the target pixel format. This function takes a
@@ -3609,6 +3687,34 @@ av_cold void ff_sws_init_output_funcs(SwsInternal *c,
                 *yuv2packed1 = yuv2bgrx64be_full_1_c;
             }
             break;
+        case AV_PIX_FMT_RGBAF32LE:
+#if CONFIG_SWSCALE_ALPHA
+            if (c->needAlpha) {
+                *yuv2packedX = yuv2rgbaf32le_full_X_c;
+                *yuv2packed2 = yuv2rgbaf32le_full_2_c;
+                *yuv2packed1 = yuv2rgbaf32le_full_1_c;
+            } else
+#endif /* CONFIG_SWSCALE_ALPHA */
+            {
+                *yuv2packedX = yuv2rgbxf32le_full_X_c;
+                *yuv2packed2 = yuv2rgbxf32le_full_2_c;
+                *yuv2packed1 = yuv2rgbxf32le_full_1_c;
+            }
+            break;
+        case AV_PIX_FMT_RGBAF32BE:
+#if CONFIG_SWSCALE_ALPHA
+            if (c->needAlpha) {
+                *yuv2packedX = yuv2rgbaf32be_full_X_c;
+                *yuv2packed2 = yuv2rgbaf32be_full_2_c;
+                *yuv2packed1 = yuv2rgbaf32be_full_1_c;
+            } else
+#endif /* CONFIG_SWSCALE_ALPHA */
+            {
+                *yuv2packedX = yuv2rgbxf32be_full_X_c;
+                *yuv2packed2 = yuv2rgbxf32be_full_2_c;
+                *yuv2packed1 = yuv2rgbxf32be_full_1_c;
+            }
+            break;
 
         case AV_PIX_FMT_RGB24:
             *yuv2packedX = yuv2rgb24_full_X_c;
@@ -3778,6 +3884,34 @@ av_cold void ff_sws_init_output_funcs(SwsInternal *c,
                 *yuv2packedX = yuv2bgrx64be_X_c;
             }
             break;
+        case AV_PIX_FMT_RGBAF32LE:
+#if CONFIG_SWSCALE_ALPHA
+            if (c->needAlpha) {
+                *yuv2packed1 = yuv2rgbaf32le_1_c;
+                *yuv2packed2 = yuv2rgbaf32le_2_c;
+                *yuv2packedX = yuv2rgbaf32le_X_c;
+            } else
+#endif /* CONFIG_SWSCALE_ALPHA */
+            {
+                *yuv2packed1 = yuv2rgbxf32le_1_c;
+                *yuv2packed2 = yuv2rgbxf32le_2_c;
+                *yuv2packedX = yuv2rgbxf32le_X_c;
+            }
+            break;
+        case AV_PIX_FMT_RGBAF32BE:
+#if CONFIG_SWSCALE_ALPHA
+            if (c->needAlpha) {
+                *yuv2packed1 = yuv2rgbaf32be_1_c;
+                *yuv2packed2 = yuv2rgbaf32be_2_c;
+                *yuv2packedX = yuv2rgbaf32be_X_c;
+            } else
+#endif /* CONFIG_SWSCALE_ALPHA */
+            {
+                *yuv2packed1 = yuv2rgbxf32be_1_c;
+                *yuv2packed2 = yuv2rgbxf32be_2_c;
+                *yuv2packedX = yuv2rgbxf32be_X_c;
+            }
+            break;
         case AV_PIX_FMT_RGB48LE:
             *yuv2packed1 = yuv2rgb48le_1_c;
             *yuv2packed2 = yuv2rgb48le_2_c;
diff --git a/libswscale/utils.c b/libswscale/utils.c
index 37a9cb94b50..678e53f4053 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -1398,6 +1398,8 @@ av_cold int ff_sws_init_single_context(SwsContext *sws, 
SwsFilter *srcFilter,
         dstFormat != AV_PIX_FMT_BGR48BE &&
         dstFormat != AV_PIX_FMT_RGBF32LE &&
         dstFormat != AV_PIX_FMT_RGBF32BE &&
+        dstFormat != AV_PIX_FMT_RGBAF32LE &&
+        dstFormat != AV_PIX_FMT_RGBAF32BE &&
         dstFormat != AV_PIX_FMT_RGBA  &&
         dstFormat != AV_PIX_FMT_ARGB  &&
         dstFormat != AV_PIX_FMT_BGRA  &&
diff --git a/tests/ref/fate/filter-pixdesc-rgbaf32be 
b/tests/ref/fate/filter-pixdesc-rgbaf32be
new file mode 100644
index 00000000000..d554cd8b924
--- /dev/null
+++ b/tests/ref/fate/filter-pixdesc-rgbaf32be
@@ -0,0 +1 @@
+pixdesc-rgbaf32be   65e62b53e01bb74df32d20e8c772d626
diff --git a/tests/ref/fate/filter-pixdesc-rgbaf32le 
b/tests/ref/fate/filter-pixdesc-rgbaf32le
new file mode 100644
index 00000000000..b7f428872cd
--- /dev/null
+++ b/tests/ref/fate/filter-pixdesc-rgbaf32le
@@ -0,0 +1 @@
+pixdesc-rgbaf32le   c2731630d0318bc2ab8cb831c6070dc7
diff --git a/tests/ref/fate/filter-pixfmts-copy 
b/tests/ref/fate/filter-pixfmts-copy
index cd68289f119..8c7150f055c 100644
--- a/tests/ref/fate/filter-pixfmts-copy
+++ b/tests/ref/fate/filter-pixfmts-copy
@@ -104,6 +104,8 @@ rgb8                7ac6008c84d622c2fc50581706e17576
 rgba                b6e1b441c365e03b5ffdf9b7b68d9a0c
 rgba64be            ae2ae04b5efedca3505f47c4dd6ea6ea
 rgba64le            b91e1d77f799eb92241a2d2d28437b15
+rgbaf32be           88b8a7f74d7291e71f3c0203dbcb67ea
+rgbaf32le           5aca3c54ec5b50ba4341243f3bfabff6
 rgbf32be            eb8610acb97af6adb59d8a192204bf26
 rgbf32le            134ac0933d1f2bef30d11fd113ab2ecc
 uyva                8896d7525f12de08818a01a5d5cf84f1
diff --git a/tests/ref/fate/filter-pixfmts-crop 
b/tests/ref/fate/filter-pixfmts-crop
index c845bd580e5..14d648ce7fb 100644
--- a/tests/ref/fate/filter-pixfmts-crop
+++ b/tests/ref/fate/filter-pixfmts-crop
@@ -102,6 +102,8 @@ rgb8                9b364a8f112ad9459fec47a51cc03b30
 rgba                9488ac85abceaf99a9309eac5a87697e
 rgba64be            89910046972ab3c68e2a348302cc8ca9
 rgba64le            fea8ebfc869b52adf353778f29eac7a7
+rgbaf32be           58d6cd5efe844aa96570d52bb8c065df
+rgbaf32le           6c0c9887515581ffa3570a35fcadd3af
 rgbf32be            d6f8c49ef3def3c11a06dd70ebc057d4
 rgbf32le            7a5e25cd4812e34103751b61c894b27d
 uyva                03f362ac6a39f25286bc6616111b0752
diff --git a/tests/ref/fate/filter-pixfmts-field 
b/tests/ref/fate/filter-pixfmts-field
index 9f807433c9e..d8213094909 100644
--- a/tests/ref/fate/filter-pixfmts-field
+++ b/tests/ref/fate/filter-pixfmts-field
@@ -104,6 +104,8 @@ rgb8                62c3b9e2a171de3d894a8eeb271c85e8
 rgba                ee616262ca6d67b7ecfba4b36c602ce3
 rgba64be            23c8c0edaabe3eaec89ce69633fb0048
 rgba64le            dfdba4de4a7cac9abf08852666c341d3
+rgbaf32be           8236aa8aad8022f0bc64201a40538e42
+rgbaf32le           54e5f6afcd03ad920020109e13252a42
 rgbf32be            919ea3ceab0fbb77e4a53548cb7191a3
 rgbf32le            c6dc8ae2b4dfd4c1c0f6b3af950dbeef
 uyva                147398d2e8d310f915c95863ad192c5e
diff --git a/tests/ref/fate/filter-pixfmts-fieldorder 
b/tests/ref/fate/filter-pixfmts-fieldorder
index 0b5c4342fb6..08cb5dbfd7f 100644
--- a/tests/ref/fate/filter-pixfmts-fieldorder
+++ b/tests/ref/fate/filter-pixfmts-fieldorder
@@ -93,6 +93,8 @@ rgb8                6deae05ccac5c50bd0d9c9fe8e124557
 rgba                1fdf872a087a32cd35b80cc7be399578
 rgba64be            5598f44514d122b9a57c5c92c20bbc61
 rgba64le            b34e6e30621ae579519a2d91a96a0acf
+rgbaf32be           82452d5cb168b1815089829bea421325
+rgbaf32le           0140452646596fdec9010cdfa4a4d40c
 rgbf32be            f92c90bf08d70e854e4f8179de0eaf30
 rgbf32le            6202cc01added07819b74bb062ceef17
 uyva                ccf5dfd33765dda88c4b4afa2ea31305
diff --git a/tests/ref/fate/filter-pixfmts-hflip 
b/tests/ref/fate/filter-pixfmts-hflip
index c071cf64240..54121b896ea 100644
--- a/tests/ref/fate/filter-pixfmts-hflip
+++ b/tests/ref/fate/filter-pixfmts-hflip
@@ -102,6 +102,8 @@ rgb8                68a3a575badadd9e4f90226209f11699
 rgba                51961c723ea6707e0a410cd3f21f15d3
 rgba64be            c910444019f4cfbf4d995227af55da8d
 rgba64le            0c810d8b3a6bca10321788e1cb145340
+rgbaf32be           cc7d6d2c37b7cb633ca83bbea42fd602
+rgbaf32le           411faef5b5c3d24eec92fa42915abf39
 rgbf32be            82ca0560630c21b141098adbf5a2e65e
 rgbf32le            46e3d448f093bb386ba93885bd99861c
 uyva                a8391c24037e2a670196b47bf6a2ca57
diff --git a/tests/ref/fate/filter-pixfmts-il b/tests/ref/fate/filter-pixfmts-il
index e3e72f715c8..844368951a0 100644
--- a/tests/ref/fate/filter-pixfmts-il
+++ b/tests/ref/fate/filter-pixfmts-il
@@ -103,6 +103,8 @@ rgb8                93f9fa5ecf522abe13ed34f21831fdfe
 rgba                625d8f4bd39c4bdbf61eb5e4713aecc9
 rgba64be            db70d33aa6c06f3e0a1c77bd11284261
 rgba64le            a8a2daae04374a27219bc1c890204007
+rgbaf32be           99244d67ba5ca6df5026b03bbf9350fb
+rgbaf32le           d2030e5b795ad37384a947c3261e3265
 rgbf32be            9dc7a55820a278c5f5c7eba50f5e9564
 rgbf32le            2c71576443b61ac5222c1a33564a10e3
 uyva                d2655e1a1c56bcb48f7c7a6a6270dd93
diff --git a/tests/ref/fate/filter-pixfmts-null 
b/tests/ref/fate/filter-pixfmts-null
index cd68289f119..8c7150f055c 100644
--- a/tests/ref/fate/filter-pixfmts-null
+++ b/tests/ref/fate/filter-pixfmts-null
@@ -104,6 +104,8 @@ rgb8                7ac6008c84d622c2fc50581706e17576
 rgba                b6e1b441c365e03b5ffdf9b7b68d9a0c
 rgba64be            ae2ae04b5efedca3505f47c4dd6ea6ea
 rgba64le            b91e1d77f799eb92241a2d2d28437b15
+rgbaf32be           88b8a7f74d7291e71f3c0203dbcb67ea
+rgbaf32le           5aca3c54ec5b50ba4341243f3bfabff6
 rgbf32be            eb8610acb97af6adb59d8a192204bf26
 rgbf32le            134ac0933d1f2bef30d11fd113ab2ecc
 uyva                8896d7525f12de08818a01a5d5cf84f1
diff --git a/tests/ref/fate/filter-pixfmts-scale 
b/tests/ref/fate/filter-pixfmts-scale
index 5478a2be98b..96f118b6b3c 100644
--- a/tests/ref/fate/filter-pixfmts-scale
+++ b/tests/ref/fate/filter-pixfmts-scale
@@ -104,6 +104,8 @@ rgb8                bcdc033b4ef0979d060dbc8893d4db58
 rgba                85bb5d03cea1c6e8002ced3373904336
 rgba64be            ee73e57923af984b31cc7795d13929da
 rgba64le            783d2779adfafe3548bdb671ec0de69e
+rgbaf32be           67fe9802ad94adfa4b290e7ef731ffea
+rgbaf32le           9415cec74d7c019b4357c9c9487b2345
 rgbf32be            8491b339d91c40ad4d96d5b68aefd046
 rgbf32le            0262f60b0a8f1a05b24f3959d8122857
 uyva                2358038be6dac002a6c736e798a3d91c
diff --git a/tests/ref/fate/filter-pixfmts-transpose 
b/tests/ref/fate/filter-pixfmts-transpose
index 91d61f8e2e7..476a85e3a5c 100644
--- a/tests/ref/fate/filter-pixfmts-transpose
+++ b/tests/ref/fate/filter-pixfmts-transpose
@@ -92,6 +92,8 @@ rgb8                c90feb30c3c9391ef5f470209d7b7a15
 rgba                4d76a9542143752a4ac30f82f88f68f1
 rgba64be            a60041217f4c0cd796d19d3940a12a41
 rgba64le            ad47197774858858ae7b0c177dffa459
+rgbaf32be           30255224cbe16c571e04bbcb74f220a6
+rgbaf32le           73f6a194cae097cea6448c1facb2d7cf
 rgbf32be            a89fa50c9e278ad1e2bc44a9435c48fd
 rgbf32le            883cc75a2f3f00090b719d99e4c2b1da
 uyva                cb773ee5a9f8964b9c826d55f9f425a3
diff --git a/tests/ref/fate/filter-pixfmts-vflip 
b/tests/ref/fate/filter-pixfmts-vflip
index 3fe598f2098..f9369dec6aa 100644
--- a/tests/ref/fate/filter-pixfmts-vflip
+++ b/tests/ref/fate/filter-pixfmts-vflip
@@ -104,6 +104,8 @@ rgb8                7df049b6094f8a5e084d74462f6d6cde
 rgba                c1a5908572737f2ae1e5d8218af65f4b
 rgba64be            17e6273323b5779b5f3f775f150c1011
 rgba64le            48f45b10503b7dd140329c3dd0d54c98
+rgbaf32be           60b4cdf7f6352ca73cb72b50bdd1f7cf
+rgbaf32le           1185e02516f5415b3c3f0cfbe41cc688
 rgbf32be            3fccaf8e4c5a55cb4cca6df18b702525
 rgbf32le            cd0b091dfe143cec2bc9af0cd6af073a
 uyva                d43e89ba3d5c9274e1948eac8630fcc6
-- 
2.54.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to