[FFmpeg-devel] [PATCH 09/21] swscale/output: add V30X output support

James Almer jamrial at gmail.com
Wed Oct 9 01:50:14 EEST 2024


Signed-off-by: James Almer <jamrial at gmail.com>
---
 libswscale/output.c                      | 31 ++++++++++++++++++++++++
 libswscale/utils.c                       |  2 +-
 tests/ref/fate/filter-pixdesc-v30xle     |  1 +
 tests/ref/fate/filter-pixfmts-copy       |  1 +
 tests/ref/fate/filter-pixfmts-crop       |  1 +
 tests/ref/fate/filter-pixfmts-field      |  1 +
 tests/ref/fate/filter-pixfmts-fieldorder |  1 +
 tests/ref/fate/filter-pixfmts-hflip      |  1 +
 tests/ref/fate/filter-pixfmts-il         |  1 +
 tests/ref/fate/filter-pixfmts-null       |  1 +
 tests/ref/fate/filter-pixfmts-scale      |  1 +
 tests/ref/fate/filter-pixfmts-transpose  |  1 +
 tests/ref/fate/filter-pixfmts-vflip      |  1 +
 13 files changed, 43 insertions(+), 1 deletion(-)
 create mode 100644 tests/ref/fate/filter-pixdesc-v30xle

diff --git a/libswscale/output.c b/libswscale/output.c
index f94c0bcfee..ece41a1806 100644
--- a/libswscale/output.c
+++ b/libswscale/output.c
@@ -2613,6 +2613,34 @@ yuv2ayuv64le_X_c(SwsContext *c, const int16_t *lumFilter,
     }
 }
 
+static void
+yuv2v30xle_X_c(SwsContext *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)
+{
+    int i;
+    for (i = 0; i < dstW; i++) {
+        int Y = 1 << 16, U = 1 << 16, V = 1 << 16;
+        int j;
+
+        for (j = 0; j < lumFilterSize; j++)
+            Y += lumSrc[j][i] * lumFilter[j];
+
+        for (j = 0; j < chrFilterSize; j++) {
+            U += chrUSrc[j][i] * chrFilter[j];
+            V += chrVSrc[j][i] * chrFilter[j];
+        }
+
+        Y = av_clip_uintp2(Y >> 17, 10);
+        U = av_clip_uintp2(U >> 17, 10);
+        V = av_clip_uintp2(V >> 17, 10);
+
+        AV_WL32(dest + 4 * i, U << 2 | Y << 12 | (unsigned)V << 22);
+    }
+}
+
 static void
 yuv2xv30le_X_c(SwsContext *c, const int16_t *lumFilter,
                const int16_t **lumSrc, int lumFilterSize,
@@ -3515,6 +3543,9 @@ av_cold void ff_sws_init_output_funcs(SwsContext *c,
         *yuv2packed2 = yuv2ya16be_2_c;
         *yuv2packedX = yuv2ya16be_X_c;
         break;
+    case AV_PIX_FMT_V30XLE:
+        *yuv2packedX = yuv2v30xle_X_c;
+        break;
     case AV_PIX_FMT_AYUV64LE:
         *yuv2packedX = yuv2ayuv64le_X_c;
         break;
diff --git a/libswscale/utils.c b/libswscale/utils.c
index 719619858f..c81e3b29b8 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -271,7 +271,7 @@ static const FormatEntry format_entries[] = {
     [AV_PIX_FMT_AYUV]        = { 1, 1 },
     [AV_PIX_FMT_UYVA]        = { 1, 1 },
     [AV_PIX_FMT_VYU444]      = { 1, 1 },
-    [AV_PIX_FMT_V30XLE]      = { 1, 0 },
+    [AV_PIX_FMT_V30XLE]      = { 1, 1 },
 };
 
 /**
diff --git a/tests/ref/fate/filter-pixdesc-v30xle b/tests/ref/fate/filter-pixdesc-v30xle
new file mode 100644
index 0000000000..b13f30d6b7
--- /dev/null
+++ b/tests/ref/fate/filter-pixdesc-v30xle
@@ -0,0 +1 @@
+pixdesc-v30xle      39705ee98e5f00ab0e388e25d7ce7419
diff --git a/tests/ref/fate/filter-pixfmts-copy b/tests/ref/fate/filter-pixfmts-copy
index e538466636..bf2eaaf23e 100644
--- a/tests/ref/fate/filter-pixfmts-copy
+++ b/tests/ref/fate/filter-pixfmts-copy
@@ -99,6 +99,7 @@ rgba64be            ae2ae04b5efedca3505f47c4dd6ea6ea
 rgba64le            b91e1d77f799eb92241a2d2d28437b15
 uyva                affad7282152bcce415bdf228df00ae4
 uyvy422             3bcf3c80047592f2211fae3260b1b65d
+v30xle              b5ec677137b6f1d9f14a2386a1a7a526
 vuya                3d5e934651cae1ce334001cb1829ad22
 vuyx                0af13a42f9d0932c5a9bb6a8a5d1c5ee
 vyu444              2b2e6df31f5895340f25d6f67572b113
diff --git a/tests/ref/fate/filter-pixfmts-crop b/tests/ref/fate/filter-pixfmts-crop
index 37b78ce5ae..f4aa40f1e4 100644
--- a/tests/ref/fate/filter-pixfmts-crop
+++ b/tests/ref/fate/filter-pixfmts-crop
@@ -96,6 +96,7 @@ rgba                9488ac85abceaf99a9309eac5a87697e
 rgba64be            89910046972ab3c68e2a348302cc8ca9
 rgba64le            fea8ebfc869b52adf353778f29eac7a7
 uyva                caa03b07812dbb6c48b5fb34edf73962
+v30xle              f92c959d672e17a3a27351e671757212
 vuya                76578a705ff3a37559653c1289bd03dd
 vuyx                615241c5406eb556fca0ad8606c23a02
 vyu444              a6067a24e63385242948dbc4c5a4ab5d
diff --git a/tests/ref/fate/filter-pixfmts-field b/tests/ref/fate/filter-pixfmts-field
index 0cf92f3c21..5466291c60 100644
--- a/tests/ref/fate/filter-pixfmts-field
+++ b/tests/ref/fate/filter-pixfmts-field
@@ -99,6 +99,7 @@ rgba64be            23c8c0edaabe3eaec89ce69633fb0048
 rgba64le            dfdba4de4a7cac9abf08852666c341d3
 uyva                c1c2953840061e3778842051b078a41e
 uyvy422             1c49e44ab3f060e85fc4a3a9464f045e
+v30xle              265a463ad722cfaede2fa6cb5e9bf34e
 vuya                f72bcf29d75cd143d0c565f7cc49119a
 vuyx                3d02eeab336d0a8106f6fdd91be61073
 vyu444              09fcf24f46ed72d51983d87ad3bed864
diff --git a/tests/ref/fate/filter-pixfmts-fieldorder b/tests/ref/fate/filter-pixfmts-fieldorder
index d902c9087d..871adcb4d1 100644
--- a/tests/ref/fate/filter-pixfmts-fieldorder
+++ b/tests/ref/fate/filter-pixfmts-fieldorder
@@ -88,6 +88,7 @@ rgba64be            5598f44514d122b9a57c5c92c20bbc61
 rgba64le            b34e6e30621ae579519a2d91a96a0acf
 uyva                fa5df2c0474b2a41dbe2210372b15fcc
 uyvy422             75de70e31c435dde878002d3f22b238a
+v30xle              1f04ac91824200d94d7841736c41f728
 vuya                a3891d4168ff208948fd0b3ba0910495
 vuyx                9e4480c5fcb7c091ec3e517420764ef3
 vyu444              e2e54e73f81389559a972f4049ab8606
diff --git a/tests/ref/fate/filter-pixfmts-hflip b/tests/ref/fate/filter-pixfmts-hflip
index 49e2b60d34..4d9cfdce31 100644
--- a/tests/ref/fate/filter-pixfmts-hflip
+++ b/tests/ref/fate/filter-pixfmts-hflip
@@ -96,6 +96,7 @@ rgba                51961c723ea6707e0a410cd3f21f15d3
 rgba64be            c910444019f4cfbf4d995227af55da8d
 rgba64le            0c810d8b3a6bca10321788e1cb145340
 uyva                9266fd7374abf86f7035e356574586f0
+v30xle              1c62803a7a7c0c89e5fda3d41cc0a376
 vuya                7e530261e7ac4eae4fd616fd7572d0b8
 vuyx                f1d087284fb1556d76e6def5f94bf273
 vyu444              a9377d852b8263e50987593be7b03c7a
diff --git a/tests/ref/fate/filter-pixfmts-il b/tests/ref/fate/filter-pixfmts-il
index 852c6e126a..5fbd162239 100644
--- a/tests/ref/fate/filter-pixfmts-il
+++ b/tests/ref/fate/filter-pixfmts-il
@@ -98,6 +98,7 @@ rgba64be            db70d33aa6c06f3e0a1c77bd11284261
 rgba64le            a8a2daae04374a27219bc1c890204007
 uyva                f16f848f8283bcd59da6a4d85bc5b0a0
 uyvy422             d6ee3ca43356d08c392382b24b22cda5
+v30xle              267a4c668b14157d35399302bb978ac1
 vuya                b9deab5ba249dd608b709c09255a4932
 vuyx                4251d94ee49e6a3cc1c10c09cd331308
 vyu444              cd6598487e9f9e2c7165b656c486eade
diff --git a/tests/ref/fate/filter-pixfmts-null b/tests/ref/fate/filter-pixfmts-null
index e538466636..bf2eaaf23e 100644
--- a/tests/ref/fate/filter-pixfmts-null
+++ b/tests/ref/fate/filter-pixfmts-null
@@ -99,6 +99,7 @@ rgba64be            ae2ae04b5efedca3505f47c4dd6ea6ea
 rgba64le            b91e1d77f799eb92241a2d2d28437b15
 uyva                affad7282152bcce415bdf228df00ae4
 uyvy422             3bcf3c80047592f2211fae3260b1b65d
+v30xle              b5ec677137b6f1d9f14a2386a1a7a526
 vuya                3d5e934651cae1ce334001cb1829ad22
 vuyx                0af13a42f9d0932c5a9bb6a8a5d1c5ee
 vyu444              2b2e6df31f5895340f25d6f67572b113
diff --git a/tests/ref/fate/filter-pixfmts-scale b/tests/ref/fate/filter-pixfmts-scale
index 67b1e4b075..dd6ba5ff66 100644
--- a/tests/ref/fate/filter-pixfmts-scale
+++ b/tests/ref/fate/filter-pixfmts-scale
@@ -99,6 +99,7 @@ rgba64be            ee73e57923af984b31cc7795d13929da
 rgba64le            783d2779adfafe3548bdb671ec0de69e
 uyva                ee83c7ba25cfc997de70a4e5b3eb398f
 uyvy422             aeb4ba4f9f003ae21f6d18089198244f
+v30xle              42be9fac7725274bf54012b073ee0e91
 vuya                ffa817e283bf6a0b6fba21b07523ccaa
 vuyx                a6ff68f46c6b4b7595ec91b2a497df8e
 vyu444              0e5edaa26029501f05c0693321d60ded
diff --git a/tests/ref/fate/filter-pixfmts-transpose b/tests/ref/fate/filter-pixfmts-transpose
index de7ef24ec8..450905ead6 100644
--- a/tests/ref/fate/filter-pixfmts-transpose
+++ b/tests/ref/fate/filter-pixfmts-transpose
@@ -88,6 +88,7 @@ rgba                4d76a9542143752a4ac30f82f88f68f1
 rgba64be            a60041217f4c0cd796d19d3940a12a41
 rgba64le            ad47197774858858ae7b0c177dffa459
 uyva                1500c3f52e32b2080be180d2e8196a7b
+v30xle              8a31095e6eb8e85ab6f030773fa20d03
 vuya                9ece18a345beb17cd19e09e443eca4bf
 vuyx                46b5b821d7ee6ddedb3ddafd1e5b007c
 vyu444              508978bb072eba1bc4636a4abd68dbe2
diff --git a/tests/ref/fate/filter-pixfmts-vflip b/tests/ref/fate/filter-pixfmts-vflip
index b55b6a94b6..a23da2c39e 100644
--- a/tests/ref/fate/filter-pixfmts-vflip
+++ b/tests/ref/fate/filter-pixfmts-vflip
@@ -99,6 +99,7 @@ rgba64be            17e6273323b5779b5f3f775f150c1011
 rgba64le            48f45b10503b7dd140329c3dd0d54c98
 uyva                0d2d0d286d841ea5b35cc06626dcafe4
 uyvy422             3a237e8376264e0cfa78f8a3fdadec8a
+v30xle              1b2e25e974fdcd53b396b577725d33cb
 vuya                fb849f76e56181e005c31fce75d7038c
 vuyx                ed7de87da324b39090a8961dfd56ca5a
 vyu444              5a98e2118b75a3804bb80003cf6fa731
-- 
2.46.2



More information about the ffmpeg-devel mailing list