[FFmpeg-devel] [PATCH 2/4] swscale/output: add support for XV36LE

Philip Langdale philipl at overt.org
Tue Sep 6 22:58:20 EEST 2022


Signed-off-by: Philip Langdale <philipl at overt.org>
---
 libswscale/output.c                      | 29 ++++++++++++++++++++++++
 libswscale/utils.c                       |  2 +-
 tests/ref/fate/filter-pixdesc-xv36le     |  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, 41 insertions(+), 1 deletion(-)
 create mode 100644 tests/ref/fate/filter-pixdesc-xv36le

diff --git a/libswscale/output.c b/libswscale/output.c
index 5cbc7ab748..ba7ecb52d7 100644
--- a/libswscale/output.c
+++ b/libswscale/output.c
@@ -2600,6 +2600,32 @@ yuv2ayuv64le_X_c(SwsContext *c, const int16_t *lumFilter,
     }
 }
 
+static void
+yuv2xv36le_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 << 14, U = 1 << 14, V = 1 << 14;
+        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];
+        }
+
+        AV_WL16(dest + 8 * i + 2, av_clip_uintp2(Y >> 15, 12) << 4);
+        AV_WL16(dest + 8 * i + 0, av_clip_uintp2(U >> 15, 12) << 4);
+        AV_WL16(dest + 8 * i + 4, av_clip_uintp2(V >> 15, 12) << 4);
+    }
+}
+
 static void
 yuv2vuyX_X_c(SwsContext *c, const int16_t *lumFilter,
              const int16_t **lumSrc, int lumFilterSize,
@@ -3192,5 +3218,8 @@ av_cold void ff_sws_init_output_funcs(SwsContext *c,
     case AV_PIX_FMT_VUYX:
         *yuv2packedX = yuv2vuyx_X_c;
         break;
+    case AV_PIX_FMT_XV36LE:
+        *yuv2packedX = yuv2xv36le_X_c;
+        break;
     }
 }
diff --git a/libswscale/utils.c b/libswscale/utils.c
index 599c326754..9166e80002 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -266,7 +266,7 @@ static const FormatEntry format_entries[] = {
     [AV_PIX_FMT_RGBAF16BE]   = { 1, 0 },
     [AV_PIX_FMT_RGBAF16LE]   = { 1, 0 },
     [AV_PIX_FMT_XV30LE]      = { 1, 0 },
-    [AV_PIX_FMT_XV36LE]      = { 1, 0 },
+    [AV_PIX_FMT_XV36LE]      = { 1, 1 },
 };
 
 int ff_shuffle_filter_coefficients(SwsContext *c, int *filterPos,
diff --git a/tests/ref/fate/filter-pixdesc-xv36le b/tests/ref/fate/filter-pixdesc-xv36le
new file mode 100644
index 0000000000..8ba8099423
--- /dev/null
+++ b/tests/ref/fate/filter-pixdesc-xv36le
@@ -0,0 +1 @@
+pixdesc-xv36le      9d00bb58092f8b6d5d6fd71a8aec719a
diff --git a/tests/ref/fate/filter-pixfmts-copy b/tests/ref/fate/filter-pixfmts-copy
index d92dd169dc..c88594f3aa 100644
--- a/tests/ref/fate/filter-pixfmts-copy
+++ b/tests/ref/fate/filter-pixfmts-copy
@@ -95,6 +95,7 @@ vuya                3d5e934651cae1ce334001cb1829ad22
 vuyx                3f68ea6ec492b30d867cb5401562264e
 x2bgr10le           550c0d190cf695afa4eaacb644db6b75
 x2rgb10le           c1e3ac21be04a16bb157b22784524520
+xv36le              3f8ced42a081639a39ec5929dd77b017
 xyz12be             a1ef56bf746d71f59669c28e48fc8450
 xyz12le             831ff03c1ba4ef19374686f16a064d8c
 ya16be              37c07787e544f900c87b853253bfc8dd
diff --git a/tests/ref/fate/filter-pixfmts-crop b/tests/ref/fate/filter-pixfmts-crop
index f7103a5906..bdad0d02cd 100644
--- a/tests/ref/fate/filter-pixfmts-crop
+++ b/tests/ref/fate/filter-pixfmts-crop
@@ -92,6 +92,7 @@ vuya                76578a705ff3a37559653c1289bd03dd
 vuyx                5d2bae51a2f4892bd5f177f190cc323b
 x2bgr10le           84de725b85662c362862820dc4a309aa
 x2rgb10le           f4265aca7a67dbfa9354370098ca6f33
+xv36le              90a187adf00a1b15c33d064ae2582804
 xyz12be             cb4571f9aaa7b59f999ef327276104b7
 xyz12le             cd6aae8d26b18bdb4b9d068586276d91
 ya16be              a3d18014454942a96f15a49947c0c55d
diff --git a/tests/ref/fate/filter-pixfmts-field b/tests/ref/fate/filter-pixfmts-field
index 910728e512..04c51dba45 100644
--- a/tests/ref/fate/filter-pixfmts-field
+++ b/tests/ref/fate/filter-pixfmts-field
@@ -95,6 +95,7 @@ vuya                f72bcf29d75cd143d0c565f7cc49119a
 vuyx                6257cd1ce11330660e9fa9c675acbdcc
 x2bgr10le           dbe21538d7cb1744914f6bd46ec09b55
 x2rgb10le           a18bc4ae5274e0a8cca9137ecd50c677
+xv36le              aa5a867879a70e1040dfafe3e03167d5
 xyz12be             d2fa69ec91d3ed862f2dac3f8e7a3437
 xyz12le             02bccd5e0b6824779a1f848b0ea3e3b5
 ya16be              40403b5277364777e0671da4d38e01ac
diff --git a/tests/ref/fate/filter-pixfmts-fieldorder b/tests/ref/fate/filter-pixfmts-fieldorder
index 258c8563f0..27d72b72aa 100644
--- a/tests/ref/fate/filter-pixfmts-fieldorder
+++ b/tests/ref/fate/filter-pixfmts-fieldorder
@@ -84,6 +84,7 @@ vuya                a3891d4168ff208948fd0b3ba0910495
 vuyx                d7a900e970c9a69ed41f8b220114b9fa
 x2bgr10le           86474d84f26c5c51d6f75bf7e1de8da8
 x2rgb10le           cdf6a9e8a8d081aa768c6ae2e6221676
+xv36le              1bde4bee8b938d7bf20e75bc848e4765
 xyz12be             15f5cda71de5fef9cec5e75e3833b6bc
 xyz12le             7be6c8781f38c21a6b8f602f62ca31e6
 ya16be              0f13e0f52586d172aaa07710fa3e8f31
diff --git a/tests/ref/fate/filter-pixfmts-hflip b/tests/ref/fate/filter-pixfmts-hflip
index 1e37027ec2..b949628061 100644
--- a/tests/ref/fate/filter-pixfmts-hflip
+++ b/tests/ref/fate/filter-pixfmts-hflip
@@ -92,6 +92,7 @@ vuya                7e530261e7ac4eae4fd616fd7572d0b8
 vuyx                3ce9890363cad3984521293be1eb679c
 x2bgr10le           827cc659f29378e00c5a7d2c0ada8f9a
 x2rgb10le           d4a8189b65395a88d0a38a7053f3359f
+xv36le              cc569285784e38a489f4a286598f05da
 xyz12be             25f90259ff8a226befdaec3dfe82996e
 xyz12le             926c0791d59aaff61b2778e8ada3316d
 ya16be              d5b342355bdd9e3197e01b13b7c6301e
diff --git a/tests/ref/fate/filter-pixfmts-il b/tests/ref/fate/filter-pixfmts-il
index 9efbf5d8e1..064f75b125 100644
--- a/tests/ref/fate/filter-pixfmts-il
+++ b/tests/ref/fate/filter-pixfmts-il
@@ -94,6 +94,7 @@ vuya                b9deab5ba249dd608b709c09255a4932
 vuyx                49cc92fcc002ec0f312017014dd68c0c
 x2bgr10le           135acaff8318cf9861bb0f7849a9e5e9
 x2rgb10le           517fb186f523dc7cdc5c5c6967cfbe94
+xv36le              066378fad80e34bc3edd22f657be6ff8
 xyz12be             7c7d54c55f136cbbc50b18029f3be0b3
 xyz12le             090ba6b1170baf2b1358b43b971d33b0
 ya16be              7bc720918bc0132e9717acbde89874e0
diff --git a/tests/ref/fate/filter-pixfmts-null b/tests/ref/fate/filter-pixfmts-null
index d92dd169dc..c88594f3aa 100644
--- a/tests/ref/fate/filter-pixfmts-null
+++ b/tests/ref/fate/filter-pixfmts-null
@@ -95,6 +95,7 @@ vuya                3d5e934651cae1ce334001cb1829ad22
 vuyx                3f68ea6ec492b30d867cb5401562264e
 x2bgr10le           550c0d190cf695afa4eaacb644db6b75
 x2rgb10le           c1e3ac21be04a16bb157b22784524520
+xv36le              3f8ced42a081639a39ec5929dd77b017
 xyz12be             a1ef56bf746d71f59669c28e48fc8450
 xyz12le             831ff03c1ba4ef19374686f16a064d8c
 ya16be              37c07787e544f900c87b853253bfc8dd
diff --git a/tests/ref/fate/filter-pixfmts-scale b/tests/ref/fate/filter-pixfmts-scale
index 017eeee84f..3381a118d6 100644
--- a/tests/ref/fate/filter-pixfmts-scale
+++ b/tests/ref/fate/filter-pixfmts-scale
@@ -95,6 +95,7 @@ vuya                ffa817e283bf6a0b6fba21b07523ccaa
 vuyx                ba182200e20e0c82765eba15217848d3
 x2bgr10le           d57b9a99033cc7b65ddd111578f2d385
 x2rgb10le           d56bdb23fa6a8e12a0b4394987f89935
+xv36le              eaf5fbd9d5ea04aeefb40f3d7c2ea289
 xyz12be             c7ba8345998c0141ddc079cdd29b1a40
 xyz12le             95f5d3a0de834cc495c9032a14987cde
 ya16be              20d4842899d61068f5fb6af478bf26a6
diff --git a/tests/ref/fate/filter-pixfmts-transpose b/tests/ref/fate/filter-pixfmts-transpose
index f1b16ca528..e270096a60 100644
--- a/tests/ref/fate/filter-pixfmts-transpose
+++ b/tests/ref/fate/filter-pixfmts-transpose
@@ -86,6 +86,7 @@ vuya                9ece18a345beb17cd19e09e443eca4bf
 vuyx                4c2929cd1c6e5512f62e802f482f0ef2
 x2bgr10le           4aa774b6d8f6d446a64f1f288e5c97eb
 x2rgb10le           09cb1d98fe17ad8a6d9d3bec97ddc845
+xv36le              f15a1d1af2a2967ec6a5efebc87e1ef1
 xyz12be             68e5cba640f6e4ef72dff950e88b5342
 xyz12le             8b6b6a6db4d7561e80db88ccaecce7a9
 ya16be              3e161cb5f225922a80fefdc9cc02a4f9
diff --git a/tests/ref/fate/filter-pixfmts-vflip b/tests/ref/fate/filter-pixfmts-vflip
index 814008cefd..73a7ba0ee8 100644
--- a/tests/ref/fate/filter-pixfmts-vflip
+++ b/tests/ref/fate/filter-pixfmts-vflip
@@ -95,6 +95,7 @@ vuya                fb849f76e56181e005c31fce75d7038c
 vuyx                7a8079a97610e2c1c97aa8832b58a102
 x2bgr10le           795b66a5fc83cd2cf300aae51c230f80
 x2rgb10le           262c502230cf3724f8e2cf4737f18a42
+xv36le              aad3c6b5799b4e46a9c9ac27ee7db9bd
 xyz12be             810644e008deb231850d779aaa27cc7e
 xyz12le             829701db461b43533cf9241e0743bc61
 ya16be              55b1dbbe4d56ed0d22461685ce85520d
-- 
2.34.1



More information about the ffmpeg-devel mailing list