From 68181623e984b249402ac6fd0849c032b05ae143 Mon Sep 17 00:00:00 2001 From: Philip Langdale Date: Mon, 5 Sep 2022 20:00:59 -0700 Subject: [PATCH] swscale/output: add support for XV30LE --- libswscale/output.c | 31 ++++++++++++++++++++++++ libswscale/utils.c | 2 +- libswscale/version.h | 2 +- tests/ref/fate/filter-pixdesc-xv30le | 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 + 14 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 tests/ref/fate/filter-pixdesc-xv30le diff --git a/libswscale/output.c b/libswscale/output.c index 228dab462e..39e2a04609 100644 --- a/libswscale/output.c +++ b/libswscale/output.c @@ -2600,6 +2600,34 @@ yuv2ayuv64le_X_c(SwsContext *c, const int16_t *lumFilter, } } +static void +yuv2xv30le_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 | Y << 10 | V << 20); + } +} + static void yuv2xv36le_X_c(SwsContext *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, @@ -3218,6 +3246,9 @@ av_cold void ff_sws_init_output_funcs(SwsContext *c, case AV_PIX_FMT_VUYX: *yuv2packedX = yuv2vuyx_X_c; break; + case AV_PIX_FMT_XV30LE: + *yuv2packedX = yuv2xv30le_X_c; + break; case AV_PIX_FMT_XV36LE: *yuv2packedX = yuv2xv36le_X_c; break; diff --git a/libswscale/utils.c b/libswscale/utils.c index 9166e80002..ec67020cc9 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -265,7 +265,7 @@ static const FormatEntry format_entries[] = { [AV_PIX_FMT_VUYX] = { 1, 1 }, [AV_PIX_FMT_RGBAF16BE] = { 1, 0 }, [AV_PIX_FMT_RGBAF16LE] = { 1, 0 }, - [AV_PIX_FMT_XV30LE] = { 1, 0 }, + [AV_PIX_FMT_XV30LE] = { 1, 1 }, [AV_PIX_FMT_XV36LE] = { 1, 1 }, }; diff --git a/libswscale/version.h b/libswscale/version.h index c35e51138d..e8f1dadb8b 100644 --- a/libswscale/version.h +++ b/libswscale/version.h @@ -29,7 +29,7 @@ #include "version_major.h" #define LIBSWSCALE_VERSION_MINOR 8 -#define LIBSWSCALE_VERSION_MICRO 110 +#define LIBSWSCALE_VERSION_MICRO 111 #define LIBSWSCALE_VERSION_INT AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \ LIBSWSCALE_VERSION_MINOR, \ diff --git a/tests/ref/fate/filter-pixdesc-xv30le b/tests/ref/fate/filter-pixdesc-xv30le new file mode 100644 index 0000000000..9b5ad5417e --- /dev/null +++ b/tests/ref/fate/filter-pixdesc-xv30le @@ -0,0 +1 @@ +pixdesc-xv30le fb76a14d6d5cf3a0b48f30b2fb59becd diff --git a/tests/ref/fate/filter-pixfmts-copy b/tests/ref/fate/filter-pixfmts-copy index c88594f3aa..67383c43f8 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 +xv30le c14b5a953bf3be56346f66ca174a5b1b xv36le 3f8ced42a081639a39ec5929dd77b017 xyz12be a1ef56bf746d71f59669c28e48fc8450 xyz12le 831ff03c1ba4ef19374686f16a064d8c diff --git a/tests/ref/fate/filter-pixfmts-crop b/tests/ref/fate/filter-pixfmts-crop index bdad0d02cd..bdb2536f7d 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 +xv30le a9edb820819b900a4a897fee4562a4fb xv36le 90a187adf00a1b15c33d064ae2582804 xyz12be cb4571f9aaa7b59f999ef327276104b7 xyz12le cd6aae8d26b18bdb4b9d068586276d91 diff --git a/tests/ref/fate/filter-pixfmts-field b/tests/ref/fate/filter-pixfmts-field index 04c51dba45..853e1b064c 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 +xv30le e940366c78efc9e292e9de28cf04dba9 xv36le aa5a867879a70e1040dfafe3e03167d5 xyz12be d2fa69ec91d3ed862f2dac3f8e7a3437 xyz12le 02bccd5e0b6824779a1f848b0ea3e3b5 diff --git a/tests/ref/fate/filter-pixfmts-fieldorder b/tests/ref/fate/filter-pixfmts-fieldorder index 27d72b72aa..3e190c2d43 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 +xv30le 25aac48128d94010a3660839500caee5 xv36le 1bde4bee8b938d7bf20e75bc848e4765 xyz12be 15f5cda71de5fef9cec5e75e3833b6bc xyz12le 7be6c8781f38c21a6b8f602f62ca31e6 diff --git a/tests/ref/fate/filter-pixfmts-hflip b/tests/ref/fate/filter-pixfmts-hflip index b949628061..fd5e9723fd 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 +xv30le 072aa2b61ce1e764f9d1957e8abee9a9 xv36le cc569285784e38a489f4a286598f05da xyz12be 25f90259ff8a226befdaec3dfe82996e xyz12le 926c0791d59aaff61b2778e8ada3316d diff --git a/tests/ref/fate/filter-pixfmts-il b/tests/ref/fate/filter-pixfmts-il index 064f75b125..d82f08d637 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 +xv30le 7f6414a3fc700380025c29812e8376a9 xv36le 066378fad80e34bc3edd22f657be6ff8 xyz12be 7c7d54c55f136cbbc50b18029f3be0b3 xyz12le 090ba6b1170baf2b1358b43b971d33b0 diff --git a/tests/ref/fate/filter-pixfmts-null b/tests/ref/fate/filter-pixfmts-null index c88594f3aa..67383c43f8 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 +xv30le c14b5a953bf3be56346f66ca174a5b1b xv36le 3f8ced42a081639a39ec5929dd77b017 xyz12be a1ef56bf746d71f59669c28e48fc8450 xyz12le 831ff03c1ba4ef19374686f16a064d8c diff --git a/tests/ref/fate/filter-pixfmts-scale b/tests/ref/fate/filter-pixfmts-scale index 3381a118d6..10b94ac516 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 +xv30le afe68d8a47e8460e0164970b1da0c5be xv36le eaf5fbd9d5ea04aeefb40f3d7c2ea289 xyz12be c7ba8345998c0141ddc079cdd29b1a40 xyz12le 95f5d3a0de834cc495c9032a14987cde diff --git a/tests/ref/fate/filter-pixfmts-transpose b/tests/ref/fate/filter-pixfmts-transpose index e270096a60..24f4249639 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 +xv30le b1ac5a12f46d32c70acb63f89838ab76 xv36le f15a1d1af2a2967ec6a5efebc87e1ef1 xyz12be 68e5cba640f6e4ef72dff950e88b5342 xyz12le 8b6b6a6db4d7561e80db88ccaecce7a9 diff --git a/tests/ref/fate/filter-pixfmts-vflip b/tests/ref/fate/filter-pixfmts-vflip index 73a7ba0ee8..4fff17e7ab 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 +xv30le 7e29ee107a1fabf3c7251f337d4b9fe5 xv36le aad3c6b5799b4e46a9c9ac27ee7db9bd xyz12be 810644e008deb231850d779aaa27cc7e xyz12le 829701db461b43533cf9241e0743bc61