From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 10CA243CEA for ; Tue, 6 Sep 2022 19:59:12 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 099C768BB60; Tue, 6 Sep 2022 22:58:42 +0300 (EEST) Received: from mail.overt.org (mail.overt.org [157.230.92.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 33E6E68BB10 for ; Tue, 6 Sep 2022 22:58:34 +0300 (EEST) Received: from authenticated-user (mail.overt.org [157.230.92.47]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by mail.overt.org (Postfix) with ESMTPSA id E1D243F594; Tue, 6 Sep 2022 14:58:32 -0500 (CDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=overt.org; s=mail; t=1662494313; bh=cWFe+pOo1/d1CZ/cHzzZFcqK/4XicRxvBp7SW0MlpaI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SUHjQJHQi1DLzRVWnrSqL3cDKRHPZjwXF3UlWKu+pqiJE9ZlfglyCY42JhESqpPy0 exH6HzIEZbAKrppNPLzcJMkV1D1t7oTZHRo/nyyDw1gASHldDZIeTUMLvMhCIcW81X or9hYSwFvbmsOjB006Eo0HsSuv6VqjFt3hsivPQUZHIIg9If1fibx+PpOcXd2gMh04 OOnzNjcCzxFZJRv0Li0x5gfWr9Cxp2etxmt2w6HvitB2NYqf1M5nB98TLM/hDs4i9O cmSPKmSLLqT03JUOmuTSoGD3peK5R7PVJ4U4JTCvU1hwhzYSXuOP/rTdbO5ouuwr8h 399mgcxFvNzHQ== From: Philip Langdale To: ffmpeg-devel@ffmpeg.org Date: Tue, 6 Sep 2022 12:58:22 -0700 Message-Id: <20220906195822.83664-5-philipl@overt.org> In-Reply-To: <20220906195822.83664-1-philipl@overt.org> References: <20220906195822.83664-1-philipl@overt.org> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 4/4] swscale/output: add support for Y210LE and Y212LE X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Philip Langdale Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Signed-off-by: Philip Langdale --- libswscale/output.c | 48 ++++++++++++++++++++++++ libswscale/utils.c | 4 +- tests/ref/fate/filter-pixdesc-y210le | 1 + tests/ref/fate/filter-pixdesc-y212le | 1 + tests/ref/fate/filter-pixfmts-copy | 2 + tests/ref/fate/filter-pixfmts-field | 2 + tests/ref/fate/filter-pixfmts-fieldorder | 2 + tests/ref/fate/filter-pixfmts-il | 2 + tests/ref/fate/filter-pixfmts-null | 2 + tests/ref/fate/filter-pixfmts-scale | 2 + tests/ref/fate/filter-pixfmts-vflip | 2 + 11 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 tests/ref/fate/filter-pixdesc-y210le create mode 100644 tests/ref/fate/filter-pixdesc-y212le diff --git a/libswscale/output.c b/libswscale/output.c index d8aa5f39db..496b3caeb8 100644 --- a/libswscale/output.c +++ b/libswscale/output.c @@ -2732,6 +2732,48 @@ yuv2vuyx_X_c(SwsContext *c, const int16_t *lumFilter, chrUSrc, chrVSrc, chrFilterSize, alpSrc, dest, dstW, y, 0); } +#define output_pixel(pos, val, bits) \ + AV_WL16(pos, av_clip_uintp2(val >> shift, bits) << output_shift); + +#define yuv2y2xx_wrapper(bits) \ + static void \ + yuv2y2 ## bits ## 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) \ + { \ + int i, j; \ + int shift = 11 + 16 - bits; \ + int output_shift = 16 - bits; \ + for (i = 0; i < ((dstW + 1) >> 1); i++) { \ + int Y1 = 1 << (shift - 1), Y2 = 1 << (shift - 1); \ + int U = 1 << (shift - 1), V = 1 << (shift - 1); \ + \ + for (j = 0; j < lumFilterSize; j++) { \ + Y1 += lumSrc[j][i * 2] * lumFilter[j]; \ + Y2 += lumSrc[j][i * 2 + 1] * lumFilter[j]; \ + } \ + \ + for (j = 0; j < chrFilterSize; j++) { \ + U += chrUSrc[j][i] * chrFilter[j]; \ + V += chrVSrc[j][i] * chrFilter[j]; \ + } \ + \ + output_pixel(dest + 8 * i + 0, Y1, bits); \ + output_pixel(dest + 8 * i + 2, U, bits); \ + output_pixel(dest + 8 * i + 4, Y2, bits); \ + output_pixel(dest + 8 * i + 6, V, bits); \ + } \ + } + +yuv2y2xx_wrapper(10); +yuv2y2xx_wrapper(12); + +#undef output_pixel + av_cold void ff_sws_init_output_funcs(SwsContext *c, yuv2planar1_fn *yuv2plane1, yuv2planarX_fn *yuv2planeX, @@ -3252,5 +3294,11 @@ av_cold void ff_sws_init_output_funcs(SwsContext *c, case AV_PIX_FMT_XV36LE: *yuv2packedX = yuv2xv36le_X_c; break; + case AV_PIX_FMT_Y210LE: + *yuv2packedX = yuv2y210le_X_c; + break; + case AV_PIX_FMT_Y212LE: + *yuv2packedX = yuv2y212le_X_c; + break; } } diff --git a/libswscale/utils.c b/libswscale/utils.c index ec67020cc9..14e2700733 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -248,8 +248,8 @@ static const FormatEntry format_entries[] = { [AV_PIX_FMT_YUVA444P12LE] = { 1, 1 }, [AV_PIX_FMT_NV24] = { 1, 1 }, [AV_PIX_FMT_NV42] = { 1, 1 }, - [AV_PIX_FMT_Y210LE] = { 1, 0 }, - [AV_PIX_FMT_Y212LE] = { 1, 0 }, + [AV_PIX_FMT_Y210LE] = { 1, 1 }, + [AV_PIX_FMT_Y212LE] = { 1, 1 }, [AV_PIX_FMT_X2RGB10LE] = { 1, 1 }, [AV_PIX_FMT_X2BGR10LE] = { 1, 1 }, [AV_PIX_FMT_P210BE] = { 1, 1 }, diff --git a/tests/ref/fate/filter-pixdesc-y210le b/tests/ref/fate/filter-pixdesc-y210le new file mode 100644 index 0000000000..c6dc202948 --- /dev/null +++ b/tests/ref/fate/filter-pixdesc-y210le @@ -0,0 +1 @@ +pixdesc-y210le 7b0ba4b531e7dccca7f2a49102b23991 diff --git a/tests/ref/fate/filter-pixdesc-y212le b/tests/ref/fate/filter-pixdesc-y212le new file mode 100644 index 0000000000..5dd6357bf3 --- /dev/null +++ b/tests/ref/fate/filter-pixdesc-y212le @@ -0,0 +1 @@ +pixdesc-y212le d481592126b10ef2d5f71a2ccac0ebe5 diff --git a/tests/ref/fate/filter-pixfmts-copy b/tests/ref/fate/filter-pixfmts-copy index 67383c43f8..b28a114c7b 100644 --- a/tests/ref/fate/filter-pixfmts-copy +++ b/tests/ref/fate/filter-pixfmts-copy @@ -99,6 +99,8 @@ xv30le c14b5a953bf3be56346f66ca174a5b1b xv36le 3f8ced42a081639a39ec5929dd77b017 xyz12be a1ef56bf746d71f59669c28e48fc8450 xyz12le 831ff03c1ba4ef19374686f16a064d8c +y210le 0736b017e0814daf38d3350c42796f7a +y212le 825768be8fe92708ae80be84855066ed ya16be 37c07787e544f900c87b853253bfc8dd ya16le e8cab8fad88cba6d285b224d8bf0d4df ya8 dbb99fbcdc204aaa1a7397ff561f1a67 diff --git a/tests/ref/fate/filter-pixfmts-field b/tests/ref/fate/filter-pixfmts-field index 853e1b064c..4e5a798471 100644 --- a/tests/ref/fate/filter-pixfmts-field +++ b/tests/ref/fate/filter-pixfmts-field @@ -99,6 +99,8 @@ xv30le e940366c78efc9e292e9de28cf04dba9 xv36le aa5a867879a70e1040dfafe3e03167d5 xyz12be d2fa69ec91d3ed862f2dac3f8e7a3437 xyz12le 02bccd5e0b6824779a1f848b0ea3e3b5 +y210le 025beb25f047a762e3788dbea4b60864 +y212le ac2a47c45187dd54d0f55293cbffd954 ya16be 40403b5277364777e0671da4d38e01ac ya16le 54f3295f5326a13d456ac53e973ba398 ya8 28cea4f98ed452bd3da9c752e5e3399c diff --git a/tests/ref/fate/filter-pixfmts-fieldorder b/tests/ref/fate/filter-pixfmts-fieldorder index 3e190c2d43..bebaf07371 100644 --- a/tests/ref/fate/filter-pixfmts-fieldorder +++ b/tests/ref/fate/filter-pixfmts-fieldorder @@ -88,6 +88,8 @@ xv30le 25aac48128d94010a3660839500caee5 xv36le 1bde4bee8b938d7bf20e75bc848e4765 xyz12be 15f5cda71de5fef9cec5e75e3833b6bc xyz12le 7be6c8781f38c21a6b8f602f62ca31e6 +y210le ee45acfb1386288af98af5313162ff3e +y212le 2f08fb195b948056c844acb1eee8d649 ya16be 0f13e0f52586d172aaa07710fa3e8f31 ya16le d481d93ea1a1a04d759d9994958983de ya8 055ac5ab5ff8533dd319edc17a398af1 diff --git a/tests/ref/fate/filter-pixfmts-il b/tests/ref/fate/filter-pixfmts-il index d82f08d637..ec9d809721 100644 --- a/tests/ref/fate/filter-pixfmts-il +++ b/tests/ref/fate/filter-pixfmts-il @@ -98,6 +98,8 @@ xv30le 7f6414a3fc700380025c29812e8376a9 xv36le 066378fad80e34bc3edd22f657be6ff8 xyz12be 7c7d54c55f136cbbc50b18029f3be0b3 xyz12le 090ba6b1170baf2b1358b43b971d33b0 +y210le 306ec4238b49dbc8625a97b678ea1c5f +y212le d5a2b4677ddb4a3bc3e5cd5cbb20f426 ya16be 7bc720918bc0132e9717acbde89874e0 ya16le 61203295a8d39601b841de90f2c9797b ya8 a38d6e288f582f1a04310232ed764afc diff --git a/tests/ref/fate/filter-pixfmts-null b/tests/ref/fate/filter-pixfmts-null index 67383c43f8..b28a114c7b 100644 --- a/tests/ref/fate/filter-pixfmts-null +++ b/tests/ref/fate/filter-pixfmts-null @@ -99,6 +99,8 @@ xv30le c14b5a953bf3be56346f66ca174a5b1b xv36le 3f8ced42a081639a39ec5929dd77b017 xyz12be a1ef56bf746d71f59669c28e48fc8450 xyz12le 831ff03c1ba4ef19374686f16a064d8c +y210le 0736b017e0814daf38d3350c42796f7a +y212le 825768be8fe92708ae80be84855066ed ya16be 37c07787e544f900c87b853253bfc8dd ya16le e8cab8fad88cba6d285b224d8bf0d4df ya8 dbb99fbcdc204aaa1a7397ff561f1a67 diff --git a/tests/ref/fate/filter-pixfmts-scale b/tests/ref/fate/filter-pixfmts-scale index 10b94ac516..525306ec12 100644 --- a/tests/ref/fate/filter-pixfmts-scale +++ b/tests/ref/fate/filter-pixfmts-scale @@ -99,6 +99,8 @@ xv30le afe68d8a47e8460e0164970b1da0c5be xv36le eaf5fbd9d5ea04aeefb40f3d7c2ea289 xyz12be c7ba8345998c0141ddc079cdd29b1a40 xyz12le 95f5d3a0de834cc495c9032a14987cde +y210le 1c2708a520477f955d1fedf6ca7a41bd +y212le 39a3c0c843041ad4501b3107dd91ef17 ya16be 20d4842899d61068f5fb6af478bf26a6 ya16le 6a05895adce85143ae1c1b3470cb4070 ya8 0a9db5bb4b009de9197eede5e9d19e16 diff --git a/tests/ref/fate/filter-pixfmts-vflip b/tests/ref/fate/filter-pixfmts-vflip index 4fff17e7ab..b7b0526588 100644 --- a/tests/ref/fate/filter-pixfmts-vflip +++ b/tests/ref/fate/filter-pixfmts-vflip @@ -99,6 +99,8 @@ xv30le 7e29ee107a1fabf3c7251f337d4b9fe5 xv36le aad3c6b5799b4e46a9c9ac27ee7db9bd xyz12be 810644e008deb231850d779aaa27cc7e xyz12le 829701db461b43533cf9241e0743bc61 +y210le 9544c81f8e1fc95e9fa4009dbecfea25 +y212le c801725ae31e3b8f5be269359d49f191 ya16be 55b1dbbe4d56ed0d22461685ce85520d ya16le d5bf02471823a16dc523a46cace0101a ya8 4299c6ca3b470a7d8a420e26eb485b1d -- 2.34.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".