[FFmpeg-devel] [PATCH 23/26] swscale/output: add V30X output support

James Almer jamrial at gmail.com
Tue Oct 8 05:54:01 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 6716cfad34..dba1a41277 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++) {
+        unsigned 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 | V << 22);
+    }
+}
+
 static void
 yuv2xv30le_X_c(SwsContext *c, const int16_t *lumFilter,
                const int16_t **lumSrc, int lumFilterSize,
@@ -3523,6 +3551,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..7544dba962
--- /dev/null
+++ b/tests/ref/fate/filter-pixdesc-v30xle
@@ -0,0 +1 @@
+pixdesc-v30xle      11ef5c41cd1b0b1be40685e08d806400
diff --git a/tests/ref/fate/filter-pixfmts-copy b/tests/ref/fate/filter-pixfmts-copy
index c585b3cbd1..b3f9a192f4 100644
--- a/tests/ref/fate/filter-pixfmts-copy
+++ b/tests/ref/fate/filter-pixfmts-copy
@@ -99,6 +99,7 @@ rgba64be            ae2ae04b5efedca3505f47c4dd6ea6ea
 rgba64le            b91e1d77f799eb92241a2d2d28437b15
 uyva                8896d7525f12de08818a01a5d5cf84f1
 uyvy422             3bcf3c80047592f2211fae3260b1b65d
+v30xle              1e8a98ac92e19c9ae66b5c52502802aa
 vuya                3d5e934651cae1ce334001cb1829ad22
 vuyx                0af13a42f9d0932c5a9bb6a8a5d1c5ee
 vyu444              93912234400a4373b1a6b5c4e4b1a4ef
diff --git a/tests/ref/fate/filter-pixfmts-crop b/tests/ref/fate/filter-pixfmts-crop
index 4d3b042aa3..03e3d6fa09 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                03f362ac6a39f25286bc6616111b0752
+v30xle              fa8904232b248b08b912a3e427d55052
 vuya                76578a705ff3a37559653c1289bd03dd
 vuyx                615241c5406eb556fca0ad8606c23a02
 vyu444              5d976b25782ff69e4b3b18453fa1447b
diff --git a/tests/ref/fate/filter-pixfmts-field b/tests/ref/fate/filter-pixfmts-field
index 8dd6e6149f..7a24cbc8f5 100644
--- a/tests/ref/fate/filter-pixfmts-field
+++ b/tests/ref/fate/filter-pixfmts-field
@@ -99,6 +99,7 @@ rgba64be            23c8c0edaabe3eaec89ce69633fb0048
 rgba64le            dfdba4de4a7cac9abf08852666c341d3
 uyva                147398d2e8d310f915c95863ad192c5e
 uyvy422             1c49e44ab3f060e85fc4a3a9464f045e
+v30xle              265a463ad722cfaede2fa6cb5e9bf34e
 vuya                f72bcf29d75cd143d0c565f7cc49119a
 vuyx                3d02eeab336d0a8106f6fdd91be61073
 vyu444              b139fb4ddaef12a7542a68277211efa7
diff --git a/tests/ref/fate/filter-pixfmts-fieldorder b/tests/ref/fate/filter-pixfmts-fieldorder
index 41c6607ec7..fe4a98530f 100644
--- a/tests/ref/fate/filter-pixfmts-fieldorder
+++ b/tests/ref/fate/filter-pixfmts-fieldorder
@@ -88,6 +88,7 @@ rgba64be            5598f44514d122b9a57c5c92c20bbc61
 rgba64le            b34e6e30621ae579519a2d91a96a0acf
 uyva                ccf5dfd33765dda88c4b4afa2ea31305
 uyvy422             75de70e31c435dde878002d3f22b238a
+v30xle              f256208aff137eac50bcd0bae62f613d
 vuya                a3891d4168ff208948fd0b3ba0910495
 vuyx                9e4480c5fcb7c091ec3e517420764ef3
 vyu444              3ddab207d561a3ee5efae09e504207f2
diff --git a/tests/ref/fate/filter-pixfmts-hflip b/tests/ref/fate/filter-pixfmts-hflip
index 9fe32c8ea4..26cb3db3fa 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                a8391c24037e2a670196b47bf6a2ca57
+v30xle              f445e24215e3d46df60d21b9d3dac486
 vuya                7e530261e7ac4eae4fd616fd7572d0b8
 vuyx                f1d087284fb1556d76e6def5f94bf273
 vyu444              7b72337f92a7223fd115265e2f769276
diff --git a/tests/ref/fate/filter-pixfmts-il b/tests/ref/fate/filter-pixfmts-il
index b14571ef09..6dca4c478f 100644
--- a/tests/ref/fate/filter-pixfmts-il
+++ b/tests/ref/fate/filter-pixfmts-il
@@ -98,6 +98,7 @@ rgba64be            db70d33aa6c06f3e0a1c77bd11284261
 rgba64le            a8a2daae04374a27219bc1c890204007
 uyva                d2655e1a1c56bcb48f7c7a6a6270dd93
 uyvy422             d6ee3ca43356d08c392382b24b22cda5
+v30xle              10b00eba766e2fa87d9dbd05780cfc23
 vuya                b9deab5ba249dd608b709c09255a4932
 vuyx                4251d94ee49e6a3cc1c10c09cd331308
 vyu444              50e9e24a38afc81541a536d06aab5ebe
diff --git a/tests/ref/fate/filter-pixfmts-null b/tests/ref/fate/filter-pixfmts-null
index c585b3cbd1..b3f9a192f4 100644
--- a/tests/ref/fate/filter-pixfmts-null
+++ b/tests/ref/fate/filter-pixfmts-null
@@ -99,6 +99,7 @@ rgba64be            ae2ae04b5efedca3505f47c4dd6ea6ea
 rgba64le            b91e1d77f799eb92241a2d2d28437b15
 uyva                8896d7525f12de08818a01a5d5cf84f1
 uyvy422             3bcf3c80047592f2211fae3260b1b65d
+v30xle              1e8a98ac92e19c9ae66b5c52502802aa
 vuya                3d5e934651cae1ce334001cb1829ad22
 vuyx                0af13a42f9d0932c5a9bb6a8a5d1c5ee
 vyu444              93912234400a4373b1a6b5c4e4b1a4ef
diff --git a/tests/ref/fate/filter-pixfmts-scale b/tests/ref/fate/filter-pixfmts-scale
index 6f26936fbf..34e24e106a 100644
--- a/tests/ref/fate/filter-pixfmts-scale
+++ b/tests/ref/fate/filter-pixfmts-scale
@@ -99,6 +99,7 @@ rgba64be            ee73e57923af984b31cc7795d13929da
 rgba64le            783d2779adfafe3548bdb671ec0de69e
 uyva                2358038be6dac002a6c736e798a3d91c
 uyvy422             aeb4ba4f9f003ae21f6d18089198244f
+v30xle              f99ff8b463ddcc3178ede41e6a5fb858
 vuya                ffa817e283bf6a0b6fba21b07523ccaa
 vuyx                a6ff68f46c6b4b7595ec91b2a497df8e
 vyu444              d663334119da56e36aca1e8e4eb29a39
diff --git a/tests/ref/fate/filter-pixfmts-transpose b/tests/ref/fate/filter-pixfmts-transpose
index 2e78517079..4ed7aa5c2c 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                cb773ee5a9f8964b9c826d55f9f425a3
+v30xle              f098d09a47561381f2567c2c76288f8a
 vuya                9ece18a345beb17cd19e09e443eca4bf
 vuyx                46b5b821d7ee6ddedb3ddafd1e5b007c
 vyu444              e70a294738165223928fddc9970b8381
diff --git a/tests/ref/fate/filter-pixfmts-vflip b/tests/ref/fate/filter-pixfmts-vflip
index d2e134e974..2f2fd0295f 100644
--- a/tests/ref/fate/filter-pixfmts-vflip
+++ b/tests/ref/fate/filter-pixfmts-vflip
@@ -99,6 +99,7 @@ rgba64be            17e6273323b5779b5f3f775f150c1011
 rgba64le            48f45b10503b7dd140329c3dd0d54c98
 uyva                d43e89ba3d5c9274e1948eac8630fcc6
 uyvy422             3a237e8376264e0cfa78f8a3fdadec8a
+v30xle              74918a72f86dc3a7c45d5cd528d0d03a
 vuya                fb849f76e56181e005c31fce75d7038c
 vuyx                ed7de87da324b39090a8961dfd56ca5a
 vyu444              815de7c57dc8afafb3de908a4a280582
-- 
2.46.2



More information about the ffmpeg-devel mailing list