From patchwork Tue Sep 6 19:58:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip Langdale X-Patchwork-Id: 37730 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:139a:b0:8f:1db5:eae2 with SMTP id w26csp3476601pzh; Tue, 6 Sep 2022 12:58:50 -0700 (PDT) X-Google-Smtp-Source: AA6agR7IrWvQgrdotveZ5P9EfPMRrnipdgwTjecG0lBwjhiVJoZrN8LjDDFQFPphwQd9yeL7Ae6s X-Received: by 2002:aa7:dbc5:0:b0:440:b0d6:7586 with SMTP id v5-20020aa7dbc5000000b00440b0d67586mr200177edt.85.1662494330421; Tue, 06 Sep 2022 12:58:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662494330; cv=none; d=google.com; s=arc-20160816; b=QJdanTv2kASTPfqfm2OtWsevSMYn1jE2UXGOGCHop0n0GVmYn68/xvoai80DMOl6OE nTugZc+f1s4bLeU7aenQSIyY2Jy2SdCw0pevJJmaAl2OgeU3vgnXIIW5ZqPQv46nAqut lDfLCv7ymZeHg3KLdEG4m/WU0qR9TGb/WWGnYXo51yi2Ay9rZkv9+EC/bSPsHN1Y+Rv1 6pCfHHcOW/9ENDvV2NjnbGXET/2yjM7wat5LWXW/WJsCqghoVPW/V7jiMxrr7FR0n4EG qQMEfkMZv8cIybCJpJIHp3PS507d6k3iiTveXdGqt6ADmqcVUHR9c9I99jvTNRRB81d3 lN3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=BpzGG/KiPkA3i+tA9fBE7zZ8cDVhnvxiW+bQFHelZ+g=; b=tJET7Y+6DGjnDfpIOlr3aRxwB6lq/QaBPO22KpGH0oQev8il9toFtG9Gd57qJqRg/3 t7DaizUQfYo+bdYL8JyFyqRyn2R7qSsmYvE0aZvZkhta9m+EZN/AyYLHJyMn1snFwq0O KQbTfZB0wGbKMocbOFCIfPFx6sbibVPLCykFFGsZxuBrrmVeLz2rk+nSzLfCxS3dGwNy lAxzF8i2BYa+zfGraYrY/FWounwMkya5W+ybxxc+f4tfCufZtSL+egi7p3inOj4vdh8E Q+AxiHCUnpgPBkJXhNmXVCIlwpGtjhF8RjaKc7k1Z4/N9cJUcpCH5d+Fn12gbUfo6jtY dkdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@overt.org header.s=mail header.b="mB2B0A/F"; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=overt.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id i14-20020a50fc0e000000b0044eb38a5593si2990897edr.72.2022.09.06.12.58.50; Tue, 06 Sep 2022 12:58:50 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@overt.org header.s=mail header.b="mB2B0A/F"; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=overt.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8E26568BB37; Tue, 6 Sep 2022 22:58:39 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.overt.org (mail.overt.org [157.230.92.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8A6CF68B1D1 for ; Tue, 6 Sep 2022 22:58:32 +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 4BCFA3F3E3; Tue, 6 Sep 2022 14:58:31 -0500 (CDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=overt.org; s=mail; t=1662494311; bh=KivTgxKj7IXqrz7xAYpPX6oOxMzdUE6ohEJO1PxihAw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mB2B0A/FkPUIiH/giPvLlmIoDPRraY744o67wQ3aV1JFh6XJDqoBgcfyfXGGmxBem QkjlRX20N/8zIwq/SQTTnd+TmQo8z2hvGVlMiPZxrPykl60zVvkKfOJQwziVz+duaH V5UzvOREznG5AAk/LsZyzcKbqQwiqTWCey7EW+BTaTqyj1vFY9neA6QCNV6mh8oRM8 f7A6twLZoUvfxhdrdJshWu/chimaMo4SVuTm2JBVHbNofp4miJJD1msXD/cBZHYk3h GfTqC/MV0RTtU8lWXulowjDvgr5zveYtsYlk+xNjmIUdOr+irF92SxOgaLvZGtfKw+ uGRrZ31GbPbTw== From: Philip Langdale To: ffmpeg-devel@ffmpeg.org Date: Tue, 6 Sep 2022 12:58:19 -0700 Message-Id: <20220906195822.83664-2-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 1/4] swscale/output: add support for P012 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: j/F2ek0wNKiz This generalises the existing P010 support. Signed-off-by: Philip Langdale --- libswscale/output.c | 140 ++++++++++++++---------- libswscale/utils.c | 4 +- tests/ref/fate/filter-pixdesc-p012be | 1 + tests/ref/fate/filter-pixdesc-p012le | 1 + tests/ref/fate/filter-pixfmts-copy | 2 + tests/ref/fate/filter-pixfmts-crop | 2 + tests/ref/fate/filter-pixfmts-field | 2 + tests/ref/fate/filter-pixfmts-hflip | 2 + tests/ref/fate/filter-pixfmts-il | 2 + tests/ref/fate/filter-pixfmts-null | 2 + tests/ref/fate/filter-pixfmts-pad | 1 + tests/ref/fate/filter-pixfmts-scale | 2 + tests/ref/fate/filter-pixfmts-transpose | 2 + tests/ref/fate/filter-pixfmts-vflip | 2 + 14 files changed, 104 insertions(+), 61 deletions(-) create mode 100644 tests/ref/fate/filter-pixdesc-p012be create mode 100644 tests/ref/fate/filter-pixdesc-p012le diff --git a/libswscale/output.c b/libswscale/output.c index 40a4476c6d..5cbc7ab748 100644 --- a/libswscale/output.c +++ b/libswscale/output.c @@ -460,17 +460,18 @@ static void yuv2nv12cX_c(enum AVPixelFormat dstFormat, const uint8_t *chrDither, #define output_pixel(pos, val) \ if (big_endian) { \ - AV_WB16(pos, av_clip_uintp2(val >> shift, 10) << 6); \ + AV_WB16(pos, av_clip_uintp2(val >> shift, output_bits) << output_shift); \ } else { \ - AV_WL16(pos, av_clip_uintp2(val >> shift, 10) << 6); \ + AV_WL16(pos, av_clip_uintp2(val >> shift, output_bits) << output_shift); \ } -static void yuv2p010l1_c(const int16_t *src, +static void yuv2p01xl1_c(const int16_t *src, uint16_t *dest, int dstW, - int big_endian) + int big_endian, int output_bits) { int i; - int shift = 5; + int shift = 15 - output_bits; + int output_shift = 16 - output_bits; for (i = 0; i < dstW; i++) { int val = src[i] + (1 << (shift - 1)); @@ -478,12 +479,13 @@ static void yuv2p010l1_c(const int16_t *src, } } -static void yuv2p010lX_c(const int16_t *filter, int filterSize, +static void yuv2p01xlX_c(const int16_t *filter, int filterSize, const int16_t **src, uint16_t *dest, int dstW, - int big_endian) + int big_endian, int output_bits) { int i, j; - int shift = 17; + int shift = 11 + 16 - output_bits; + int output_shift = 16 - output_bits; for (i = 0; i < dstW; i++) { int val = 1 << (shift - 1); @@ -495,14 +497,15 @@ static void yuv2p010lX_c(const int16_t *filter, int filterSize, } } -static void yuv2p010cX_c(int big_endian, const uint8_t *chrDither, +static void yuv2p01xcX_c(int big_endian, const uint8_t *chrDither, const int16_t *chrFilter, int chrFilterSize, const int16_t **chrUSrc, const int16_t **chrVSrc, - uint8_t *dest8, int chrDstW) + uint8_t *dest8, int chrDstW, int output_bits) { uint16_t *dest = (uint16_t*)dest8; - int shift = 17; int i, j; + int shift = 11 + 16 - output_bits; + int output_shift = 16 - output_bits; for (i = 0; i < chrDstW; i++) { int u = 1 << (shift - 1); @@ -518,52 +521,65 @@ static void yuv2p010cX_c(int big_endian, const uint8_t *chrDither, } } -static void yuv2p010l1_LE_c(const int16_t *src, - uint8_t *dest, int dstW, - const uint8_t *dither, int offset) -{ - yuv2p010l1_c(src, (uint16_t*)dest, dstW, 0); -} - -static void yuv2p010l1_BE_c(const int16_t *src, - uint8_t *dest, int dstW, - const uint8_t *dither, int offset) -{ - yuv2p010l1_c(src, (uint16_t*)dest, dstW, 1); -} - -static void yuv2p010lX_LE_c(const int16_t *filter, int filterSize, - const int16_t **src, uint8_t *dest, int dstW, - const uint8_t *dither, int offset) -{ - yuv2p010lX_c(filter, filterSize, src, (uint16_t*)dest, dstW, 0); -} - -static void yuv2p010lX_BE_c(const int16_t *filter, int filterSize, - const int16_t **src, uint8_t *dest, int dstW, - const uint8_t *dither, int offset) -{ - yuv2p010lX_c(filter, filterSize, src, (uint16_t*)dest, dstW, 1); -} - -static void yuv2p010cX_LE_c(enum AVPixelFormat dstFormat, const uint8_t *chrDither, - const int16_t *chrFilter, int chrFilterSize, - const int16_t **chrUSrc, const int16_t **chrVSrc, - uint8_t *dest8, int chrDstW) -{ - yuv2p010cX_c(0, chrDither, chrFilter, chrFilterSize, chrUSrc, chrVSrc, dest8, chrDstW); -} - -static void yuv2p010cX_BE_c(enum AVPixelFormat dstFormat, const uint8_t *chrDither, - const int16_t *chrFilter, int chrFilterSize, - const int16_t **chrUSrc, const int16_t **chrVSrc, - uint8_t *dest8, int chrDstW) -{ - yuv2p010cX_c(1, chrDither, chrFilter, chrFilterSize, chrUSrc, chrVSrc, dest8, chrDstW); -} - #undef output_pixel +#define yuv2p01x_wrapper(bits) \ + static void yuv2p0 ## bits ## l1_LE_c(const int16_t *src, \ + uint8_t *dest, int dstW, \ + const uint8_t *dither, int offset) \ + { \ + yuv2p01xl1_c(src, (uint16_t*)dest, dstW, 0, bits); \ + } \ + \ + static void yuv2p0 ## bits ## l1_BE_c(const int16_t *src, \ + uint8_t *dest, int dstW, \ + const uint8_t *dither, int offset) \ + { \ + yuv2p01xl1_c(src, (uint16_t*)dest, dstW, 1, bits); \ + } \ + \ + static void yuv2p0 ## bits ## lX_LE_c(const int16_t *filter, \ + int filterSize, const int16_t **src, \ + uint8_t *dest, int dstW, \ + const uint8_t *dither, int offset) \ + { \ + yuv2p01xlX_c(filter, filterSize, src, (uint16_t*)dest, dstW, 0, bits); \ + } \ + \ + static void yuv2p0 ## bits ## lX_BE_c(const int16_t *filter, \ + int filterSize, const int16_t **src, \ + uint8_t *dest, int dstW, \ + const uint8_t *dither, int offset) \ + { \ + yuv2p01xlX_c(filter, filterSize, src, (uint16_t*)dest, dstW, 1, bits); \ + } \ + \ + static void yuv2p0 ## bits ## cX_LE_c(enum AVPixelFormat dstFormat, \ + const uint8_t *chrDither, \ + const int16_t *chrFilter, \ + int chrFilterSize, \ + const int16_t **chrUSrc, \ + const int16_t **chrVSrc, \ + uint8_t *dest8, int chrDstW) \ + { \ + yuv2p01xcX_c(0, chrDither, chrFilter, chrFilterSize, chrUSrc, chrVSrc, \ + dest8, chrDstW, bits); \ + } \ + \ + static void yuv2p0 ## bits ## cX_BE_c(enum AVPixelFormat dstFormat, \ + const uint8_t *chrDither, \ + const int16_t *chrFilter, \ + int chrFilterSize, \ + const int16_t **chrUSrc, \ + const int16_t **chrVSrc, \ + uint8_t *dest8, int chrDstW) \ + { \ + yuv2p01xcX_c(1, chrDither, chrFilter, chrFilterSize, chrUSrc, chrVSrc, \ + dest8, chrDstW, bits); \ + } + +yuv2p01x_wrapper(10); +yuv2p01x_wrapper(12); #define accumulate_bit(acc, val) \ acc <<= 1; \ @@ -2675,10 +2691,16 @@ av_cold void ff_sws_init_output_funcs(SwsContext *c, const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(dstFormat); if (isSemiPlanarYUV(dstFormat) && isDataInHighBits(dstFormat)) { - av_assert0(desc->comp[0].depth == 10); - *yuv2plane1 = isBE(dstFormat) ? yuv2p010l1_BE_c : yuv2p010l1_LE_c; - *yuv2planeX = isBE(dstFormat) ? yuv2p010lX_BE_c : yuv2p010lX_LE_c; - *yuv2nv12cX = isBE(dstFormat) ? yuv2p010cX_BE_c : yuv2p010cX_LE_c; + if (desc->comp[0].depth == 10) { + *yuv2plane1 = isBE(dstFormat) ? yuv2p010l1_BE_c : yuv2p010l1_LE_c; + *yuv2planeX = isBE(dstFormat) ? yuv2p010lX_BE_c : yuv2p010lX_LE_c; + *yuv2nv12cX = isBE(dstFormat) ? yuv2p010cX_BE_c : yuv2p010cX_LE_c; + } else if (desc->comp[0].depth == 12) { + *yuv2plane1 = isBE(dstFormat) ? yuv2p012l1_BE_c : yuv2p012l1_LE_c; + *yuv2planeX = isBE(dstFormat) ? yuv2p012lX_BE_c : yuv2p012lX_LE_c; + *yuv2nv12cX = isBE(dstFormat) ? yuv2p012cX_BE_c : yuv2p012cX_LE_c; + } else + av_assert0(0); } else if (is16BPS(dstFormat)) { *yuv2planeX = isBE(dstFormat) ? yuv2planeX_16BE_c : yuv2planeX_16LE_c; *yuv2plane1 = isBE(dstFormat) ? yuv2plane1_16BE_c : yuv2plane1_16LE_c; diff --git a/libswscale/utils.c b/libswscale/utils.c index a5a9bc589a..599c326754 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -236,8 +236,8 @@ static const FormatEntry format_entries[] = { [AV_PIX_FMT_AYUV64LE] = { 1, 1}, [AV_PIX_FMT_P010LE] = { 1, 1 }, [AV_PIX_FMT_P010BE] = { 1, 1 }, - [AV_PIX_FMT_P012LE] = { 1, 0 }, - [AV_PIX_FMT_P012BE] = { 1, 0 }, + [AV_PIX_FMT_P012LE] = { 1, 1 }, + [AV_PIX_FMT_P012BE] = { 1, 1 }, [AV_PIX_FMT_P016LE] = { 1, 1 }, [AV_PIX_FMT_P016BE] = { 1, 1 }, [AV_PIX_FMT_GRAYF32LE] = { 1, 1 }, diff --git a/tests/ref/fate/filter-pixdesc-p012be b/tests/ref/fate/filter-pixdesc-p012be new file mode 100644 index 0000000000..217ca49157 --- /dev/null +++ b/tests/ref/fate/filter-pixdesc-p012be @@ -0,0 +1 @@ +pixdesc-p012be 784a49bf554861da9d0809a615bcf813 diff --git a/tests/ref/fate/filter-pixdesc-p012le b/tests/ref/fate/filter-pixdesc-p012le new file mode 100644 index 0000000000..681cd48b4b --- /dev/null +++ b/tests/ref/fate/filter-pixdesc-p012le @@ -0,0 +1 @@ +pixdesc-p012le 0268fd44f63022e21ada69704534fc85 diff --git a/tests/ref/fate/filter-pixfmts-copy b/tests/ref/fate/filter-pixfmts-copy index 371b94c62e..d92dd169dc 100644 --- a/tests/ref/fate/filter-pixfmts-copy +++ b/tests/ref/fate/filter-pixfmts-copy @@ -62,6 +62,8 @@ nv24 f30fc8d0ac40af69e119ea919a314572 nv42 29a212f70f8780fe0eb99abcae81894d p010be 7f9842d6015026136bad60d03c035cc3 p010le c453421b9f726bdaf2bacf59a492c43b +p012be 7f9842d6015026136bad60d03c035cc3 +p012le 1929db89609c4b8c6d9c9030a9e7843d p016be 7f9842d6015026136bad60d03c035cc3 p016le c453421b9f726bdaf2bacf59a492c43b p210be 847e9c6e292b17349e69570829252b3e diff --git a/tests/ref/fate/filter-pixfmts-crop b/tests/ref/fate/filter-pixfmts-crop index 364e881aef..f7103a5906 100644 --- a/tests/ref/fate/filter-pixfmts-crop +++ b/tests/ref/fate/filter-pixfmts-crop @@ -60,6 +60,8 @@ nv24 514c8f12082f0737e558778cbe7de258 nv42 ece9baae1c5de579dac2c66a89e08ef3 p010be 8b2de2eb6b099bbf355bfc55a0694ddc p010le 373b50c766dfd0a8e79c9a73246d803a +p012be 8b2de2eb6b099bbf355bfc55a0694ddc +p012le a1e4f713e145dfc465bfe0cc77096a03 p016be 8b2de2eb6b099bbf355bfc55a0694ddc p016le 373b50c766dfd0a8e79c9a73246d803a p210be 2947f43774352ef61f9e83777548c7c5 diff --git a/tests/ref/fate/filter-pixfmts-field b/tests/ref/fate/filter-pixfmts-field index 768b3f474a..910728e512 100644 --- a/tests/ref/fate/filter-pixfmts-field +++ b/tests/ref/fate/filter-pixfmts-field @@ -62,6 +62,8 @@ nv24 3b100fb527b64ee2b2d7120da573faf5 nv42 1841ce853152d86b27c130f319ea0db2 p010be a0311a09bba7383553267d2b3b9c075e p010le ee09a18aefa3ebe97715b3a7312cb8ff +p012be a0311a09bba7383553267d2b3b9c075e +p012le f1cc90d292046109a626db2da9f0f9b6 p016be a0311a09bba7383553267d2b3b9c075e p016le ee09a18aefa3ebe97715b3a7312cb8ff p210be 58d46f566ab28e3bcfb715c7aa53cf58 diff --git a/tests/ref/fate/filter-pixfmts-hflip b/tests/ref/fate/filter-pixfmts-hflip index 6fbc472a4e..1e37027ec2 100644 --- a/tests/ref/fate/filter-pixfmts-hflip +++ b/tests/ref/fate/filter-pixfmts-hflip @@ -60,6 +60,8 @@ nv24 f0c5b2f42970f8d4003621d8857a872f nv42 4dcf9aec82b110712b396a8b365dcb13 p010be 744b13e44d39e1ff7588983fa03e0101 p010le a50b160346ab94f55a425065b57006f0 +p012be 744b13e44d39e1ff7588983fa03e0101 +p012le aeb31f50c66f376b0530c7bb6287212b p016be 744b13e44d39e1ff7588983fa03e0101 p016le a50b160346ab94f55a425065b57006f0 p210be 6f5a76d6467b86d55fe5589d3af8a7ea diff --git a/tests/ref/fate/filter-pixfmts-il b/tests/ref/fate/filter-pixfmts-il index 09748c2d08..9efbf5d8e1 100644 --- a/tests/ref/fate/filter-pixfmts-il +++ b/tests/ref/fate/filter-pixfmts-il @@ -62,6 +62,8 @@ nv24 554153c71d142e3fd8e40b7dcaaec229 nv42 d699724c8deaeb4f87faf2766512eec3 p010be 3df51286ef66b53e3e283dbbab582263 p010le eadcd8241e97e35b2b47d5eb2eaea6cd +p012be 3df51286ef66b53e3e283dbbab582263 +p012le 38945445b360fa737e9e37257393e823 p016be 3df51286ef66b53e3e283dbbab582263 p016le eadcd8241e97e35b2b47d5eb2eaea6cd p210be 29ec4e8912d456cd15203a96487c42e8 diff --git a/tests/ref/fate/filter-pixfmts-null b/tests/ref/fate/filter-pixfmts-null index 371b94c62e..d92dd169dc 100644 --- a/tests/ref/fate/filter-pixfmts-null +++ b/tests/ref/fate/filter-pixfmts-null @@ -62,6 +62,8 @@ nv24 f30fc8d0ac40af69e119ea919a314572 nv42 29a212f70f8780fe0eb99abcae81894d p010be 7f9842d6015026136bad60d03c035cc3 p010le c453421b9f726bdaf2bacf59a492c43b +p012be 7f9842d6015026136bad60d03c035cc3 +p012le 1929db89609c4b8c6d9c9030a9e7843d p016be 7f9842d6015026136bad60d03c035cc3 p016le c453421b9f726bdaf2bacf59a492c43b p210be 847e9c6e292b17349e69570829252b3e diff --git a/tests/ref/fate/filter-pixfmts-pad b/tests/ref/fate/filter-pixfmts-pad index 07aaea6b06..d659ef6121 100644 --- a/tests/ref/fate/filter-pixfmts-pad +++ b/tests/ref/fate/filter-pixfmts-pad @@ -27,6 +27,7 @@ nv21 0fdeb2cdd56cf5a7147dc273456fa217 nv24 193b9eadcc06ad5081609f76249b3e47 nv42 1738ad3c31c6c16e17679f5b09ce4677 p010le fbbc23cc1d764a5e6fb71883d985f3ed +p012le 3a92c1bd3e9de050bf6abcc3fd911ab7 p016le fbbc23cc1d764a5e6fb71883d985f3ed p210le 680912c059de39c3401cac856bd1b0c1 p216le 8718662e226a4581561e7bb532af2d83 diff --git a/tests/ref/fate/filter-pixfmts-scale b/tests/ref/fate/filter-pixfmts-scale index e1bbe961e1..017eeee84f 100644 --- a/tests/ref/fate/filter-pixfmts-scale +++ b/tests/ref/fate/filter-pixfmts-scale @@ -62,6 +62,8 @@ nv24 2aa6e805bf6d4179ed8d7dea37d75db3 nv42 80714d1eb2d8bcaeab3abc3124df1abd p010be 1d6726d94bf1385996a9a9840dd0e878 p010le 4b316f2b9e18972299beb73511278fa8 +p012be e4dc7ccd654c2d74fde9c7b2711d960b +p012le cd4b6bdcd8967fc0e869ce3b8a014133 p016be 31e204018cbb53f8988c4e1174ea8ce9 p016le d5afe557f492a09317e525d7cb782f5b p210be 2cc6dfcf5e006c8ed5238988a06fd45e diff --git a/tests/ref/fate/filter-pixfmts-transpose b/tests/ref/fate/filter-pixfmts-transpose index 0c2993d5b0..f1b16ca528 100644 --- a/tests/ref/fate/filter-pixfmts-transpose +++ b/tests/ref/fate/filter-pixfmts-transpose @@ -59,6 +59,8 @@ nv24 ea9de8b47faed722ee40182f89489beb nv42 636af6cd6a4f3ac5edc0fc3ce3c56d63 p010be ad0de2cc9bff81688b182a870fcf7000 p010le e7ff5143595021246733ce6bd0a769e8 +p012be ad0de2cc9bff81688b182a870fcf7000 +p012le 024ef1cf56a4872f202b96a6a4bbf10a p016be ad0de2cc9bff81688b182a870fcf7000 p016le e7ff5143595021246733ce6bd0a769e8 p410be 8b3e0ccb31b6a20ff00a29253fb2dec3 diff --git a/tests/ref/fate/filter-pixfmts-vflip b/tests/ref/fate/filter-pixfmts-vflip index 5cac61a9d2..814008cefd 100644 --- a/tests/ref/fate/filter-pixfmts-vflip +++ b/tests/ref/fate/filter-pixfmts-vflip @@ -62,6 +62,8 @@ nv24 334420b9d3df84499d2ca16bb66eed2b nv42 ba4063e2795c17fea3c8a646b01fd1f5 p010be 06e9354b6e0e38ba41736352cedc0bd5 p010le fd18d322bffbf5816902c13102872e22 +p012be 06e9354b6e0e38ba41736352cedc0bd5 +p012le cdf6a3c38d9d4e3f079fa369e1dda662 p016be 06e9354b6e0e38ba41736352cedc0bd5 p016le fd18d322bffbf5816902c13102872e22 p210be ca886ab2b3ea5c153f1954b3709f7249 From patchwork Tue Sep 6 19:58:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip Langdale X-Patchwork-Id: 37731 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:139a:b0:8f:1db5:eae2 with SMTP id w26csp3476654pzh; Tue, 6 Sep 2022 12:58:58 -0700 (PDT) X-Google-Smtp-Source: AA6agR4KJFF4uLVNfYqSiGJHGz/gZOPTIuefZNNKNRgvK3rtYMQzaMJbu4d1n9QGPUams6AB6+Uz X-Received: by 2002:a05:6402:5193:b0:43e:1d52:fd70 with SMTP id q19-20020a056402519300b0043e1d52fd70mr224617edd.150.1662494338351; Tue, 06 Sep 2022 12:58:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662494338; cv=none; d=google.com; s=arc-20160816; b=lU9Ugvhv9d0aoGYJkX2eH6AmoxBRbfLwislUGBi6HX8Rntof4UX3ofahIAqWqnlae6 dejKSkTNUxnvg2/A+EL4irobM1vULDiUbFE2ZeVSUB0AiXGdYWGKiZpHxQVFwWNDJBUZ R/1hAwTWOCnCgG/AYq8DxgUSUxdZGv6DyQsD9lsXNRx8UtzyeZTfoDrSZEqbSpSu/jwh NOgkGyiUcQ++LaEs5wOttlslhV8LtHvZ9RFZ1oXGOKUwqzfw/vqG9K6Rc8bGJyx+GAtg AMdWGCLqdI/4vma3sOGTWBm2AY83ckImfOQ11myxHE4pflsQO3ygnK3QgUqoYbH7iyWt DYKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=dDZBCshlxH6pU6rlWyrrJmN95mb/z7JHxEINTeZSvRw=; b=AnF8BUy8kF47/b8VHwatv9phu4S6XhUbTLwTd6M3qFysxbOwLs+BRCPlVynbtzaWrj WcwhM+LP/Jpx630J/UE/tPBayzhNnGatbERcrW/LRWpXhcUsWaYdTFVaCvfHhTqnOHa3 I5DrffeUROtz6ErmNtnOeoBZOk2/hcfkZ1ghm34lpBbGDc3sXOTjYkNQ7n/ENWdEj8X1 EqwQQg5ZLnBF4w5vNroGC7z3V8j4cI/2CXtnyWFdQnnVxveapc6vuCy88JTO80czhtd/ JM2QVaqoKc76yYt1WJUXZAi2L3P3u9R37Af4XgweZfH/YzuFvKwWxfTbvlKksM2V07Xo W6+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@overt.org header.s=mail header.b=uA0wDGVq; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=overt.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id hc32-20020a17090716a000b007417559b3f0si10591509ejc.40.2022.09.06.12.58.58; Tue, 06 Sep 2022 12:58:58 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@overt.org header.s=mail header.b=uA0wDGVq; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=overt.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9011D68BB55; Tue, 6 Sep 2022 22:58:40 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.overt.org (mail.overt.org [157.230.92.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2C7BE68B1D1 for ; Tue, 6 Sep 2022 22:58:33 +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 D2CC03F418; Tue, 6 Sep 2022 14:58:31 -0500 (CDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=overt.org; s=mail; t=1662494312; bh=A3tEpCh6+b60YW5tLwIwyaPhJPkWRC99YajKgAG1GvE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uA0wDGVq9z5rPYvPAH8gGRKdxiNmnklAGlBto2smh+Ju8f3DlhTxwAwH8h8C9L5cG wTDthd9/aRwqYm0HT84ODB8KvOXYQ+85aYZ7edB57qnlbkMjDNfK2X6irvUNaR9GZL yxHq30DREZSanCXXHAvSLqkOh0TFlWM42U29nCQkhmFdBTCvuCxg7Uarssmepib+Z6 tCA7bm4sdxT4SO07bZLP3Rm+XHgkh1aeQWqiu3+j+lkXmaWWtWSlw5SYiidwSElsww 6JwW3slwXgHzhzTTzJPWpsrkp0ZWPRlCj2hvwa+ifZreIw2LFU1M5gxfcj8QXCfwlI yv0ASBF85udPw== From: Philip Langdale To: ffmpeg-devel@ffmpeg.org Date: Tue, 6 Sep 2022 12:58:20 -0700 Message-Id: <20220906195822.83664-3-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 2/4] swscale/output: add support for XV36LE 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: SoMz/GUP8eei Signed-off-by: Philip Langdale --- 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 From patchwork Tue Sep 6 19:58:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip Langdale X-Patchwork-Id: 37732 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:139a:b0:8f:1db5:eae2 with SMTP id w26csp3476686pzh; Tue, 6 Sep 2022 12:59:06 -0700 (PDT) X-Google-Smtp-Source: AA6agR6aLRHJwVn3kIOtl4V6k8aMHtZcCC2MuRzKGadrHPh8gRXTXYJKqas5bTnv27r21Il71847 X-Received: by 2002:a17:907:629b:b0:74f:94f3:786 with SMTP id nd27-20020a170907629b00b0074f94f30786mr82827ejc.606.1662494346324; Tue, 06 Sep 2022 12:59:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662494346; cv=none; d=google.com; s=arc-20160816; b=KGbRD59ZgRL6e/wp+8PdjAHMt0VGV5EX0FNqd3VEPPeZyoig6njrJV+Fa56Gh+Dv2R qYiBChyzJnJtmcRJ5aUHwRq5myr/49L5yuSOT4Tns2GhK21dz8eiC/m1t2XKcqeRHKaW AKtpHYp4eMPZccVL/l1Yopa6FrGBjOsxADtIG2cjpXiTWk7OTKF89FmE3TBw6g1eherM wsNzDivJbSW89tNCzrWKg5jbnAK3Aay6oOECzqz+swhcGrrM+gaELASei1L692/T1YLF B1PE8+MU/rAaSDf6JrfMriwF5074uUDFWNrk+3cis7mLm1IEFUheHAcFGx8u9J1j+WX8 a/hQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=Yw5yE9IRCKlcj1s1qK864c+ElwsbUF2yPIYhhl+y95c=; b=nLMLnaN34GV0eeUtySRVO974ulhD1qgbDf85mi0kJ8eAaJPlFMbpCHCn4HRfDbeOJK Ph7C0rSHEDzCXGmS6XaddZfzAjSjpCCSprhgxCjDzG91OzhJnD6lVWR8wHUq3okUsSBQ ATwAA2+vDD+RKeSPVyBQuIMrSkPQnCDWpHKK+riHEbuFFf9ODTG9o6lQ5N5tfhFYF7P1 0pTlB96EdtTIYR3e0KuFSJeV7FED5uMxpxq+wGlSUw8aduZbsM4jm/fyFvAEiwF9aCyy pRL+XKTBKsiLZZViS9MPI06Ef0oD9ryarMx393+F8pICGkWbdBnsEcp2gCgU88W/lZgG uO0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@overt.org header.s=mail header.b=A0lATjhG; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=overt.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id dz11-20020a0564021d4b00b004483613511esi10472170edb.618.2022.09.06.12.59.06; Tue, 06 Sep 2022 12:59:06 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@overt.org header.s=mail header.b=A0lATjhG; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=overt.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4C8A468BB3F; Tue, 6 Sep 2022 22:58:41 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.overt.org (mail.overt.org [157.230.92.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A817368BB39 for ; Tue, 6 Sep 2022 22:58:33 +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 6037C3F41A; 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=1662494312; bh=b6FXNd5OydxOd3m3nFpL+p6TvsJs+Yld3LPSP46vHMU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A0lATjhGxyO6wS7BqOwx0vrfsy0D9ffu56KLj6YI+Cgn7bQ8mpY177wfsy5hB9dNz kJxx5Zpq/HK3Fs/moLTBKcGsQGkHPte8AR8Mj1OqGTy5ZVAxUhi4rMPDBunH4hF9yW P21SJfvIoSl/gTD1U5Eo7uiJcCLMyo9huN8qNGg0Zxmo10DENFs3WiChiKE15L9Ap5 cfDKOFkcHBaTv5kGa4kLQVeO6vIumusqlELjG4UIABUULLsUekSm50RT9WFVCN5oNt ZlUfZnWTAyEYDV+vSwLCV1A9mtJQccPuy2+mVMFHJkld0BG8rt2R9eqp1OCNdgzyVD o04bbo3DB8a1Q== From: Philip Langdale To: ffmpeg-devel@ffmpeg.org Date: Tue, 6 Sep 2022 12:58:21 -0700 Message-Id: <20220906195822.83664-4-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 3/4] swscale/output: add support for XV30LE 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 6FBXBhfnUsi9 Signed-off-by: Philip Langdale --- libswscale/output.c | 31 ++++++++++++++++++++++++ libswscale/utils.c | 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 + 13 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 tests/ref/fate/filter-pixdesc-xv30le diff --git a/libswscale/output.c b/libswscale/output.c index ba7ecb52d7..d8aa5f39db 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/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 From patchwork Tue Sep 6 19:58:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip Langdale X-Patchwork-Id: 37733 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:139a:b0:8f:1db5:eae2 with SMTP id w26csp3476733pzh; Tue, 6 Sep 2022 12:59:14 -0700 (PDT) X-Google-Smtp-Source: AA6agR5pbwCsqN/OroF0Dh54JW34a7/WOk8L710pb7FwSKPxUc/Q7Y+y1lA1i0A4U81reYesIGbo X-Received: by 2002:a17:907:7605:b0:73d:cdf7:d8e0 with SMTP id jx5-20020a170907760500b0073dcdf7d8e0mr86196ejc.430.1662494354701; Tue, 06 Sep 2022 12:59:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662494354; cv=none; d=google.com; s=arc-20160816; b=m8upf+78R0/Yfm4+lq/7qWY+Y+q3Cudm70MD4bv6EkceitO5EnlokC2JsGGMioP6wi EW6/EDY2HgFqwWQWxweVdoGa7k9G/nSxGfmTbO4ilzjvP9WSsSrMKIw6UUXaGLsyH38j DhVWfZhPFQecWcQUj79pyp9ScV4K4VhWpn7cvBeUtccFGnzDqUVxVsKKGhkNV72ztCg4 rkg/MpYty0buBV49bPb7xMl8v2jHMOvreYa+/giDgJJrRo7zfDIU8DMj1wqZR9W1895h o/XSheg0JkiftzZu33pzYxAPzCcG2FRxHmsgHcbP04RaPkdZM1ccA/rgQ9yDF30B9WtG LJlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=F11bsg0AZbKfEsdR2R1Bvu8zZnvyYYbbEdDMlEIZM8Q=; b=s4G+hdNmNsFrw7/7a3Nq+bBtfWYpl6nwMDJKY8VpoLrJW5nW37TkCwFeCjjV7Tu3x1 x40JWgIb7QdqLFB4ybuO46bRvsrYhc4eeDPJrvyBJsapipSHxYbKZPdxkzhPOL6oXjcC VaT864+AAd04pwvxlFpJS5eLa10x/KzabrCJLGHiUW7NvVnpYzUQqoiQEuukLJsUt8wc NyOmpB0dxXdMMCL3zYCyqxOs2wUwZYImPGYUbsJBI7fCd1lfAzTxBoZd5MCjSs185rxq uKyrSMy0lvT1xc0oviyJSTh1QmLBTeaXiKpxyr1G2PIbJKuYm5VUIQyfz9tX3+VqDbK/ eIYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@overt.org header.s=mail header.b=SUHjQJHQ; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=overt.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id t23-20020a056402241700b0044e725e6ac9si2071830eda.460.2022.09.06.12.59.14; Tue, 06 Sep 2022 12:59:14 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@overt.org header.s=mail header.b=SUHjQJHQ; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=overt.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3FA0168BB61; Tue, 6 Sep 2022 22:58:42 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: ZdbSlFeX6MBK 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