diff --git a/libswscale/output.c b/libswscale/output.c index c46ac51099..6d61e886ee 100644 --- a/libswscale/output.c +++ b/libswscale/output.c @@ -2564,12 +2564,19 @@ yuv2ya8_X_c(SwsContext *c, const int16_t *lumFilter, } } -static void -yuv2ayuv64le_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) +#define output_pixels(pos, val) \ + if (is_be) { \ + AV_WB16(pos, val); \ + } else { \ + AV_WL16(pos, val); \ + } + +static av_always_inline void +yuv2ayuv64_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 is_be) { const int32_t **lumSrc = (const int32_t **) _lumSrc, **chrUSrc = (const int32_t **) _chrUSrc, @@ -2606,13 +2613,30 @@ yuv2ayuv64le_X_c(SwsContext *c, const int16_t *lumFilter, V = 0x8000 + av_clip_int16(V >> 15); A = 0x8000 + av_clip_int16(A >> 15); - AV_WL16(dest + 8 * i, hasAlpha ? A : 65535); - AV_WL16(dest + 8 * i + 2, Y); - AV_WL16(dest + 8 * i + 4, U); - AV_WL16(dest + 8 * i + 6, V); + output_pixels(dest + 8 * i, hasAlpha ? A : 65535); + output_pixels(dest + 8 * i + 2, Y); + output_pixels(dest + 8 * i + 4, U); + output_pixels(dest + 8 * i + 6, V); } } +#undef output_pixels + +#define YUV2AYUV64(BE_LE, is_be) \ +static void \ +yuv2ayuv64 ## BE_LE ##_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) \ +{ \ + yuv2ayuv64_X_c(c, lumFilter, lumSrc, lumFilterSize, \ + chrFilter, chrUSrc, chrVSrc, chrFilterSize, \ + alpSrc, dest, dstW, y, is_be); \ +} + +YUV2AYUV64(le, 0) +YUV2AYUV64(be, 1) static av_always_inline void yuv2v30_X_c_template(SwsContext *c, const int16_t *lumFilter, @@ -3597,6 +3621,9 @@ av_cold void ff_sws_init_output_funcs(SwsContext *c, case AV_PIX_FMT_AYUV64LE: *yuv2packedX = yuv2ayuv64le_X_c; break; + case AV_PIX_FMT_AYUV64BE: + *yuv2packedX = yuv2ayuv64be_X_c; + break; case AV_PIX_FMT_AYUV: *yuv2packed1 = yuv2ayuv_1_c; *yuv2packed2 = yuv2ayuv_2_c; diff --git a/libswscale/utils.c b/libswscale/utils.c index 09d96b2292..9b23df4dbb 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -231,7 +231,7 @@ static const FormatEntry format_entries[] = { [AV_PIX_FMT_XYZ12BE] = { 1, 1, 1 }, [AV_PIX_FMT_XYZ12LE] = { 1, 1, 1 }, [AV_PIX_FMT_AYUV64LE] = { 1, 1}, - [AV_PIX_FMT_AYUV64BE] = { 1, 0}, + [AV_PIX_FMT_AYUV64BE] = { 1, 1 }, [AV_PIX_FMT_P010LE] = { 1, 1 }, [AV_PIX_FMT_P010BE] = { 1, 1 }, [AV_PIX_FMT_P012LE] = { 1, 1 }, diff --git a/tests/ref/fate/filter-pixdesc-ayuv64be b/tests/ref/fate/filter-pixdesc-ayuv64be new file mode 100644 index 0000000000..2af583d670 --- /dev/null +++ b/tests/ref/fate/filter-pixdesc-ayuv64be @@ -0,0 +1 @@ +pixdesc-ayuv64be a4311bdc59c9b7a48d911647845d8214 diff --git a/tests/ref/fate/filter-pixfmts-copy b/tests/ref/fate/filter-pixfmts-copy index 7e1259d182..c12dcd814e 100644 --- a/tests/ref/fate/filter-pixfmts-copy +++ b/tests/ref/fate/filter-pixfmts-copy @@ -3,6 +3,7 @@ abgr 023ecf6396d324edb113e4a483b79ba2 argb f003b555ef429222005d33844cca9325 ayuv 631859cdc018cd9671482e435a87becc +ayuv64be 553477ffeeaf59d54fa12012ff13c783 ayuv64le 07b9c969dfbe4add4c0626773b151d4f bgr0 6fcd67c8e6cec723dab21c70cf53dc16 bgr24 4cff3814819f02ecf5824edfd768d2b1 diff --git a/tests/ref/fate/filter-pixfmts-crop b/tests/ref/fate/filter-pixfmts-crop index 77cf1cf482..3e8355605e 100644 --- a/tests/ref/fate/filter-pixfmts-crop +++ b/tests/ref/fate/filter-pixfmts-crop @@ -3,6 +3,7 @@ abgr 1d21f5b8a20186ac9dd54459c986a2a7 argb 8b822972049a1e207000763f2564d6e0 ayuv fb7bdb9f775c47099892c0588f5be426 +ayuv64be aec88528e34e99fb8baa22ad58c97210 ayuv64le ab2f7bc8f150af47c42c778e3ea28bce bgr0 38a84849a9198667c348c686802e3b52 bgr24 1dacd8e04bf0eff163e82250d01a9cc7 diff --git a/tests/ref/fate/filter-pixfmts-field b/tests/ref/fate/filter-pixfmts-field index 0b62b37f4d..25539c7bb6 100644 --- a/tests/ref/fate/filter-pixfmts-field +++ b/tests/ref/fate/filter-pixfmts-field @@ -3,6 +3,7 @@ abgr c0eb95959edf5d40ff8af315e62d0f8a argb 6dca4f2987b49b7d63f702d17bace630 ayuv 25f429cbd3c1ac60851d69c262601415 +ayuv64be 04b79237163bca61e040b5324552a4d3 ayuv64le d9836decca6323ba88b3b3d02257c0b6 bgr0 1da3fdbac616b3b410d081e39ed7a1f6 bgr24 573c76d77b1cbe6534ea7c0267dc1b13 diff --git a/tests/ref/fate/filter-pixfmts-fieldorder b/tests/ref/fate/filter-pixfmts-fieldorder index 497b3299b5..d87a9d8c5e 100644 --- a/tests/ref/fate/filter-pixfmts-fieldorder +++ b/tests/ref/fate/filter-pixfmts-fieldorder @@ -3,6 +3,7 @@ abgr 832924b5351361db68dbdbb96c60ae55 argb 80d08e68cb91bc8f2f817516e65f0bd0 ayuv 7fd34c9bd28c8ac7979eaa41c1a8ab9f +ayuv64be beb82e063e760c916ee5dbc054a9a32a ayuv64le 84ef6260fe02427da946d4a2207fb54c bgr0 d2c676224ea80ac3ce01afde325ea1a0 bgr24 b7fdbcd10f20e6ea2d40aae0f329f80d diff --git a/tests/ref/fate/filter-pixfmts-hflip b/tests/ref/fate/filter-pixfmts-hflip index a27d241d60..682176e68e 100644 --- a/tests/ref/fate/filter-pixfmts-hflip +++ b/tests/ref/fate/filter-pixfmts-hflip @@ -3,6 +3,7 @@ abgr d2da6c3ee72e4a89a7cd011dd08566b2 argb 36cf791c52c5463bfc52a070de54337e ayuv ae787b7ee2a8b1f4af2335ddca56ff58 +ayuv64be 9d613f9046e20009f5c4be3f4bd7c3cc ayuv64le 4cedbc38b3d4dcb26cdab170ce6d667b bgr0 66e9fda4e658d73bfe4fc9d792542271 bgr24 db074979bd684ca4547e28681ad3f6ab diff --git a/tests/ref/fate/filter-pixfmts-il b/tests/ref/fate/filter-pixfmts-il index c58560d521..917515d68f 100644 --- a/tests/ref/fate/filter-pixfmts-il +++ b/tests/ref/fate/filter-pixfmts-il @@ -3,6 +3,7 @@ abgr 97603869e6248a8e5d8501563a11b114 argb 9e50e6ef02c83f28e97865a1f46ddfcd ayuv 6e65a0b3bb18e89997dd558a7331df17 +ayuv64be a9bec32e276bfb03b5673279beee5381 ayuv64le 6f45f683e99ddf4180c7c7f47719efcc bgr0 590dcd1297d1dd4541eea217381db604 bgr24 73afe7b447b083a7c2d682abe8dd451a diff --git a/tests/ref/fate/filter-pixfmts-null b/tests/ref/fate/filter-pixfmts-null index 7e1259d182..c12dcd814e 100644 --- a/tests/ref/fate/filter-pixfmts-null +++ b/tests/ref/fate/filter-pixfmts-null @@ -3,6 +3,7 @@ abgr 023ecf6396d324edb113e4a483b79ba2 argb f003b555ef429222005d33844cca9325 ayuv 631859cdc018cd9671482e435a87becc +ayuv64be 553477ffeeaf59d54fa12012ff13c783 ayuv64le 07b9c969dfbe4add4c0626773b151d4f bgr0 6fcd67c8e6cec723dab21c70cf53dc16 bgr24 4cff3814819f02ecf5824edfd768d2b1 diff --git a/tests/ref/fate/filter-pixfmts-scale b/tests/ref/fate/filter-pixfmts-scale index 6ec7e7901e..5f264040f0 100644 --- a/tests/ref/fate/filter-pixfmts-scale +++ b/tests/ref/fate/filter-pixfmts-scale @@ -3,6 +3,7 @@ abgr 63f2eaa8712ea6108985f4a0b83587c9 argb f0e17c71a40643c33a5bcfb481f6d8f8 ayuv f20a5cc54f6459aad6b5f36ae092da5d +ayuv64be 8cfd8a03f74829efa5ff1c1acd6aa5fd ayuv64le 59fb016f9874062d0be77cb3920ffed2 bgr0 243d58ca64f97b2f415b4c63cb79f0e1 bgr24 18744aaab4b8bce065a7144dc0ccf921 diff --git a/tests/ref/fate/filter-pixfmts-transpose b/tests/ref/fate/filter-pixfmts-transpose index c240bb4d5e..fa567bbe05 100644 --- a/tests/ref/fate/filter-pixfmts-transpose +++ b/tests/ref/fate/filter-pixfmts-transpose @@ -3,6 +3,7 @@ abgr 6d6f896f853a6c6f93ee70dba9af3d17 argb 87bbd23debb94d486ac3a6b6c0b005f9 ayuv ba6a6588737f8ddffd2018d9c667e559 +ayuv64be 07bcc9d722b57b60de56ab44a88cd07e ayuv64le e4c07e0d5b333b3bc9eb4f3ce6af3a2c bgr0 df3a6eedd4939ce09a357b655ac2962a bgr24 f9a08135e5d58c0b2a5509c369a88414 diff --git a/tests/ref/fate/filter-pixfmts-vflip b/tests/ref/fate/filter-pixfmts-vflip index b401da4a25..2851d2b4d1 100644 --- a/tests/ref/fate/filter-pixfmts-vflip +++ b/tests/ref/fate/filter-pixfmts-vflip @@ -3,6 +3,7 @@ abgr 8b94f489e68802d76f1e2844688a4911 argb 3fd6af7ef2364d8aa845d45db289a04a ayuv c3bc52cd5ae5094c85bd465a259e2870 +ayuv64be 2263f36f970c2a3d79d4971b56d107cf ayuv64le 558671dd31d0754cfa6344eaf441df78 bgr0 7117438cf000254610f23625265769b5 bgr24 52b2c21cbc166978a38a646c354b6858