From patchwork Fri Jul 14 10:08:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Kelly X-Patchwork-Id: 42669 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:6da1:b0:131:a7d0:bc6d with SMTP id gl33csp3549823pzb; Fri, 14 Jul 2023 03:08:38 -0700 (PDT) X-Google-Smtp-Source: APBJJlFna3T+ufTwPtrSoFsO3Q/3OMC3HysfIm8WcUpghx5aGgvji16UTzhijt74qRQ+5aT0ID4W X-Received: by 2002:a17:907:30cc:b0:994:577:f9dd with SMTP id vl12-20020a17090730cc00b009940577f9ddmr3498986ejb.9.1689329317917; Fri, 14 Jul 2023 03:08:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689329317; cv=none; d=google.com; s=arc-20160816; b=trDZRk3PqsAT6cFUbr5LazptVotAcru4LNlmzzIjVQfm9tBS5AZAXAhSCPwDcy3ZNm LlCUFt/TpNHbRSs5/xrg5VCF7SogSPdsLbZCqn0KLc9w0DP85YLmYLso7yzXZYbLlg2k gtMCOY28kDZcyOHweDdGL/WJeppYIIz1ZtfNsu5Qy4W63yr40H0b4UpjZ0A27vusNP0o bJZAsA0oL1AXAR/WKotuMEjIYZz5GEb0hljXpwJP+Jcs6pr7fnhyPzuHsaNqUP6sEVKR T3JxWZoSEEpw7vs+ecztkCm5NehS+RdD5yKBrO19VR3EBn1b7QAnz/XI7n5D9leKynB9 NOZA== 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:to:from:message-id:mime-version:date :dkim-signature:delivered-to; bh=9AIImOMW+4mV2ZUXVy9pOp8D+lP6wFRwNCOKZAFlLTE=; fh=/dichZGS11g2zj1pQZN5I1lofI3DSP0AKY/Bo6XKkZk=; b=SEr2hjGzz66rw37trzRD5E7XowSWIjCNmiQ53ZjjjbTbdidoXJpS4zfihvkQJfQhF8 icRkjXXTsaS+C73VmkPB7C8Si8NiOKiyCY7x/qtOvwz+0lGeyTrYPDEb4XDV1ms8yoZJ kdz5OxYisG5EMYHZlfa1gYR7/VPVwboQ24uLgVROIku4E1cPIPdxRFQJufHlRKQH8nFG XgG/t0CdaEoa9zR/GBn6hJPl0cPzSrJbEzqSGIfuBXvAf/VSWqvg/gogocRU/JiPZ3V/ WC1+TaaPhPs46ezlSwMmNsUqXLIP+KIdpvARDHa/COfmLPLJe7TXcq551gCS5YJ2coAb uKNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@google.com header.s=20221208 header.b=teDkV+fZ; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id gt23-20020a170906f21700b00993a68a3afcsi8841385ejb.489.2023.07.14.03.08.36; Fri, 14 Jul 2023 03:08:37 -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=@google.com header.s=20221208 header.b=teDkV+fZ; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id F295568C43E; Fri, 14 Jul 2023 13:08:32 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 73CB868C43E for ; Fri, 14 Jul 2023 13:08:26 +0300 (EEST) Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-c361777c7f7so4679832276.0 for ; Fri, 14 Jul 2023 03:08:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1689329305; x=1691921305; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=knz3OWa/iBItCh5FPXlFDRmRZB2pTzWpsHWcygSvSeA=; b=teDkV+fZTWrTi+yL7iRgUjJ/o7DC+Y+wwRFdU0LnE9XFnv7VYWxBpcEWlTuAT+P+17 0Z4umTf89gbnNGdQaPoWcPc1qdix1lx8xKZ/MNmMWEXxES8ovpZDffb0rNwhCOPlu7wL bXuU77eTv2ueWE7q+GYdflcu7XSYfo3DGLOvM87PkU5wDR1NaS9tFw9x1oSQTUts150u GwLp13iQvHPtl9KUlAbx2/qjucxG1VoxP66RClnYsFI95Po3UHU4w+NwkM2e7BSFXzlq GKwj0DKA1RGx1WcgDrdfwWRqqlw8OB20T1ZsAJjuM9lNn/skoWVUHP6Tia4dKh33EvS0 md1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689329305; x=1691921305; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=knz3OWa/iBItCh5FPXlFDRmRZB2pTzWpsHWcygSvSeA=; b=VsAmAc/CkbdNVylyoYkGs4qjatDWFIkUUHtAtCq0wSOhIUZzMW0LwQTDPtn7kfbf9B sitygLriZoddqTSIpb18Fv6nsJeg4rE6XVGt0uRpxL+6EE6HFbOZaL0wiljvIxOCFVQm N2XO3JTwMb8v5fbQKP2nr7yudqvI3qrwcT5Vj8SbbdVzETuSquUdSbuVhqNVudf0a20S vYzaIdTlHPS7xb8Iej9EhJ43bVNeVflA/Z1260Ob5rwT0zCWS+KsB6syn1LwF4Dbgh4G QqIYb1MrQvgkwb3JHBCzqErggFT6lm/XvrdQ8qifo+OZRTKDN9wabez15vJ9PQKvmRC+ PGFQ== X-Gm-Message-State: ABy/qLa1gAIarEhZzsofWKPt9QrBkCgTT2+hSXD8LG8hULseMLkeVLVm bdsd7loASt35VEB93b91Q8ffxy8KNP5dQtAPXi+PLv1M9asXROxlK6BLVa2mr5NJonPEQqgVNnc CXeDUPCoNK79TID8rUMDxzbMUz31A0bk+4NS/K/2qUL/8bucjvLypOOMIEV7zncfJzhrmBoQ= X-Received: from alankelly0.zrh.corp.google.com ([2a00:79e0:9e:2:4c42:89a0:4fe0:9543]) (user=alankelly job=sendgmr) by 2002:a25:d1cb:0:b0:bc4:a660:528f with SMTP id i194-20020a25d1cb000000b00bc4a660528fmr29020ybg.5.1689329304644; Fri, 14 Jul 2023 03:08:24 -0700 (PDT) Date: Fri, 14 Jul 2023 12:08:17 +0200 Mime-Version: 1.0 X-Mailer: git-send-email 2.41.0.255.g8b1d071c50-goog Message-ID: <20230714100821.473905-1-alankelly@google.com> From: Alan Kelly To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH 1/3] swscale/x86/swscale: Process yuv2yuvX tails using next largest register size 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: Alan Kelly Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: k4XfkAFjyi5D --- libswscale/x86/swscale.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libswscale/x86/swscale.c b/libswscale/x86/swscale.c index ff16398988..8c67bf4fab 100644 --- a/libswscale/x86/swscale.c +++ b/libswscale/x86/swscale.c @@ -194,7 +194,7 @@ static void yuv2yuvX_ ##opt(const int16_t *filter, int filterSize, \ return; \ } -#define YUV2YUVX_FUNC(opt, step) \ +#define YUV2YUVX_FUNC(opt, step, tail) \ void ff_yuv2yuvX_ ##opt(const int16_t *filter, int filterSize, int srcOffset, \ uint8_t *dest, int dstW, \ const uint8_t *dither, int offset); \ @@ -211,7 +211,7 @@ static void yuv2yuvX_ ##opt(const int16_t *filter, int filterSize, \ if(pixelsProcessed > 0) \ ff_yuv2yuvX_ ##opt(filter, filterSize - 1, 0, dest - offset, pixelsProcessed + offset, dither, offset); \ if(remainder > 0){ \ - ff_yuv2yuvX_mmxext(filter, filterSize - 1, pixelsProcessed, dest - offset, pixelsProcessed + remainder + offset, dither, offset); \ + yuv2yuvX_ ##tail(filter, filterSize, src, dest, dstW, dither, offset); \ } \ return; \ } @@ -220,10 +220,10 @@ static void yuv2yuvX_ ##opt(const int16_t *filter, int filterSize, \ YUV2YUVX_FUNC_MMX(mmxext, 16) #endif #if HAVE_SSE3_EXTERNAL -YUV2YUVX_FUNC(sse3, 32) +YUV2YUVX_FUNC(sse3, 32, mmxext) #endif #if HAVE_AVX2_EXTERNAL -YUV2YUVX_FUNC(avx2, 64) +YUV2YUVX_FUNC(avx2, 64, sse3) #endif #define SCALE_FUNC(filter_n, from_bpc, to_bpc, opt) \ From patchwork Fri Jul 14 10:08:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Kelly X-Patchwork-Id: 42670 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:6da1:b0:131:a7d0:bc6d with SMTP id gl33csp3549950pzb; Fri, 14 Jul 2023 03:08:51 -0700 (PDT) X-Google-Smtp-Source: APBJJlEE7iCYl0YldgTxlWgOMxg3WKwY6u9q3oFKzL6H6G9j5GQVGpc0+3m4LOLHtw13veKMVbyB X-Received: by 2002:aa7:c14e:0:b0:51d:a4b1:d430 with SMTP id r14-20020aa7c14e000000b0051da4b1d430mr4172573edp.3.1689329330961; Fri, 14 Jul 2023 03:08:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689329330; cv=none; d=google.com; s=arc-20160816; b=dzIYzdrfuVH6Q68/JIiJumoL3Svi1yBiogQL4J99zUftKGHgG2i/ASw0Ry1er4aknA 5ekOcmgi/Llr6ny3rUdh4Bq2gjGgze+lskrX3NrdDvVqjXUAt01KddlA2+i8HN8cc0rS xIVBxVQb6/Z7wQtaRxvQGS2S7xlIpT/7zpOwDWRqudttsoaPyY42s62Hm97oU/DbPK+H +zokGAXtqnLhFmNX3nZj2CPRtXW1dDLROVK1a8DSs+oe4iSC41lIG3nUCqfsjWhZ7TWg vDzV39BNHchRdHobOB7cPI7fihV2WEJXA4Y0VKAtDDEPqLc8Ot8F73L9x7Mau3wSocSy 9gBQ== 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:to:from:message-id:mime-version:date :dkim-signature:delivered-to; bh=BYweeqGWnEKt/atsT4uHqe+cBHpTHbQYtAaKYCyC3Uk=; fh=/dichZGS11g2zj1pQZN5I1lofI3DSP0AKY/Bo6XKkZk=; b=adCdxmsPQeLtshdFsjr0FuxIfeFTJqt/1fydyd6TMuDhuVVfmV+5XDNapu/Ptf/QE0 bP30e3fxWBIYhKv+0Y6w0mWAQ0PD4mMvttGdfxVYgfP99tkeBsKMYdp6v0TQarBdB7pM 0n5+fGy5Bhha8F00kjCeTnnhK94opXL5YmUUUu6t+4tx5dxbqqg7TxuAQ5yv5Sl8TYtm AAu7yMSsQxSIVavyJ2gyWSfWUI0ZTtSnj6C+5M7PkGE1hipbDN4/5EHwHke0OZ2zGV0S CqU+mNdrz7KcOH48Nk1cNoDRGtsNj4brSEdQQnbxuYjPKj1P2+lJzie0VM3cI6mVAPHO arHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@google.com header.s=20221208 header.b=xynIrao4; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id l10-20020a056402344a00b0051ff079876fsi3183476edc.621.2023.07.14.03.08.50; Fri, 14 Jul 2023 03:08: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=@google.com header.s=20221208 header.b=xynIrao4; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2D86068C63F; Fri, 14 Jul 2023 13:08:48 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ed1-f73.google.com (mail-ed1-f73.google.com [209.85.208.73]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 22CBA68C3A3 for ; Fri, 14 Jul 2023 13:08:41 +0300 (EEST) Received: by mail-ed1-f73.google.com with SMTP id 4fb4d7f45d1cf-50bf847b267so1169775a12.3 for ; Fri, 14 Jul 2023 03:08:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1689329320; x=1691921320; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=NI6aO9Mz5EmmiYEsYbma5t56XbRBKfNcsPBwDUBmIrI=; b=xynIrao4xVu5iTfmuThTLprCEehK+xei0wv/f084UfKsfVAr/ve9+fV5CrFRO5pVlX ilv4TEkXUkU7OoKVSjUsuMlz3tfUcu9Z7DGiMIK+YEdDrKPwy1uomVPSV/vKClpjsD4Q eUwiF4/kN9ENJG3FU5edriJzubyZ+5od9h4DMq2ZN2OBGvDxbq0t8dIVQJDkl6gR9wGI 8wkJHBHD26Uwss0U5QFcAGxshesuOIipNFTvv/PtyKcrGqpYPxllQ5wAADQR7EFNwxp7 puEvHWQKr301e/SYdWU/NnXYemotZHtldGSBYxO1z4koVl5xHR62snvcLAylLLDXkWpq xtVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689329320; x=1691921320; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=NI6aO9Mz5EmmiYEsYbma5t56XbRBKfNcsPBwDUBmIrI=; b=G6O0ATk32qillYmYohhdzSqwLyVMVtTK9yK5rtc6+mwpr8V5mFGBWk/brusAY9K4Zg B5kTu5t1ho79IDIf68rOCQ2lzT9PgeleoguFSoc/4xTXjnPnp6Stzdyg0VWwq8m6M0b/ xLZ8mdtfqioEhRYgyamttQ+j4ucXnueotUOunvPhIHIhMdpMKM2HIlgpP8B+Pmv4ZLvn pQWwBwK5bRu3ghD/HPKnAh5c++G1jPH4ZABe8xwpAt7BUsEv3rCVHyzl8VmstXKR6lVK z727UyLJ4rgmFNhhS0xg0Q5JHN+KTqEmVxWfOknTijO3D4bsZoKBkuYLZVnug0jRi+vm eK8Q== X-Gm-Message-State: ABy/qLY+SHLOw5E4SRuQQSubf6eX1rYRXBUcPs2JRqCfL3rWSzvpfBSD zsBZCWp+QZLl/Kr0JvWNSEGrm+aQBxAc0HGnyvbRDpbc+IrqM0CmFuBiouMFGKMUS3TXgYy7Tfs /Dp1fjrgfP3cARWd9unU0LzqeSXdOiV/KutH/5HdGSq1Ka1IUezbsncUnyBtSi9AS88Md8s0= X-Received: from alankelly0.zrh.corp.google.com ([2a00:79e0:9e:2:4c42:89a0:4fe0:9543]) (user=alankelly job=sendgmr) by 2002:a50:8ac3:0:b0:51e:51a6:29bc with SMTP id k3-20020a508ac3000000b0051e51a629bcmr17148edk.3.1689329320295; Fri, 14 Jul 2023 03:08:40 -0700 (PDT) Date: Fri, 14 Jul 2023 12:08:34 +0200 Mime-Version: 1.0 X-Mailer: git-send-email 2.41.0.255.g8b1d071c50-goog Message-ID: <20230714100836.474580-1-alankelly@google.com> From: Alan Kelly To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH 2/3] swscale/x86/yuv2yuvX: Add yuv2yuvX avx512 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: Alan Kelly Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 47rNSPkqsZn1 --- libswscale/x86/swscale.c | 7 +++++++ libswscale/x86/yuv2yuvX.asm | 19 ++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/libswscale/x86/swscale.c b/libswscale/x86/swscale.c index 8c67bf4fab..52423a1199 100644 --- a/libswscale/x86/swscale.c +++ b/libswscale/x86/swscale.c @@ -225,6 +225,9 @@ YUV2YUVX_FUNC(sse3, 32, mmxext) #if HAVE_AVX2_EXTERNAL YUV2YUVX_FUNC(avx2, 64, sse3) #endif +#if ARCH_X86_64 && HAVE_AVX512_EXTERNAL +YUV2YUVX_FUNC(avx512, 128, avx2) +#endif #define SCALE_FUNC(filter_n, from_bpc, to_bpc, opt) \ void ff_hscale ## from_bpc ## to ## to_bpc ## _ ## filter_n ## _ ## opt( \ @@ -467,6 +470,10 @@ av_cold void ff_sws_init_swscale_x86(SwsContext *c) #if HAVE_AVX2_EXTERNAL if (EXTERNAL_AVX2_FAST(cpu_flags)) c->yuv2planeX = yuv2yuvX_avx2; +#endif +#if ARCH_X86_64 && HAVE_AVX512_EXTERNAL + if (EXTERNAL_AVX512(cpu_flags)) + c->yuv2planeX = yuv2yuvX_avx512; #endif } #if ARCH_X86_32 && !HAVE_ALIGNED_STACK diff --git a/libswscale/x86/yuv2yuvX.asm b/libswscale/x86/yuv2yuvX.asm index 369c850674..57bfa09d66 100644 --- a/libswscale/x86/yuv2yuvX.asm +++ b/libswscale/x86/yuv2yuvX.asm @@ -22,6 +22,10 @@ %include "libavutil/x86/x86util.asm" +SECTION_RODATA 64 + +permutation: dq 0, 2, 4, 6, 1, 3, 5, 7 + SECTION .text ;----------------------------------------------------------------------------- @@ -50,6 +54,10 @@ cglobal yuv2yuvX, 7, 7, 8, filter, filterSize, src, dest, dstW, dither, offset %else movq xm3, [ditherq] %endif ; avx2 + +%if cpuflag(avx512) + mova m15, [permutation] +%endif cmp offsetd, 0 jz .offset @@ -109,7 +117,10 @@ cglobal yuv2yuvX, 7, 7, 8, filter, filterSize, src, dest, dstW, dither, offset packuswb m6, m6, m1 %endif mov srcq, [filterq] -%if cpuflag(avx2) +%if cpuflag(avx512) + vpermt2q m3, m15, m3 + vpermt2q m6, m15, m6 +%elif cpuflag(avx2) vpermq m3, m3, 216 vpermq m6, m6, 216 %endif @@ -131,4 +142,10 @@ YUV2YUVX_FUNC %if HAVE_AVX2_EXTERNAL INIT_YMM avx2 YUV2YUVX_FUNC +%if HAVE_AVX512_EXTERNAL +%if ARCH_X86_64 +INIT_ZMM avx512 +YUV2YUVX_FUNC +%endif +%endif %endif From patchwork Fri Jul 14 10:08:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Kelly X-Patchwork-Id: 42671 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:6da1:b0:131:a7d0:bc6d with SMTP id gl33csp3550074pzb; Fri, 14 Jul 2023 03:09:02 -0700 (PDT) X-Google-Smtp-Source: APBJJlEQvsEgxRHcsEgw/FY0tRWPmOzbQwt5Uey7g6jGyYWZnTZvHO04EobVcDkZ9F3zoUSOJvcg X-Received: by 2002:ac2:5f4d:0:b0:4fb:89f2:278e with SMTP id 13-20020ac25f4d000000b004fb89f2278emr3357409lfz.68.1689329342649; Fri, 14 Jul 2023 03:09:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689329342; cv=none; d=google.com; s=arc-20160816; b=w7SzZCfBu0ENBTCfjL4peDPov4SaMvjEIw9iMQ45jQfUnegy7/MPYHOStiVHJYfLwU yDq9EhCw/4no1Yu9q3BYbvQB8TvwgiVu9YiamUQUfL6BPS7j9rtHjKR2WiDL2Jvb4AFd JkymA+b+hHeNAqKSlOXzRAy5ee8/eLaQ3qYkuwa2idd6GPf9xdJuhdFnKwgqOc1LLXby f8fbpEDVjbwfD89VJhj3kc1l8+HtPt1VZvkui/biNLEcI1Pn6vq6NV8lTO5lnPXizfR9 Ul6vUBAyLpLtOJiRB4G9M5suonZoM8/7rwy2VDdqAsqhr4VdTm7KSxDKxtu9IyRNC5Nq XtEg== 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:to:from:message-id:mime-version:date :dkim-signature:delivered-to; bh=nFgrS3JePcWd/E8C/fr73YrPvlb5e/pm5t6bBVx4XVA=; fh=/dichZGS11g2zj1pQZN5I1lofI3DSP0AKY/Bo6XKkZk=; b=Q8mIXpQzo68GGZx1VODBHAg7nmb6AqtjpGFC+XcycselhiA7h6T5ltGb2gm0LOqtNn 7G4dmWgDzSs53/SugCR/0Gxqo+T0gqbC1c5q9gnvXL965M4dvFVHBTtF40iQsY3dOFZg QMYqFAyuBQR2VVXMsG6o3pvRaC8ef0Ik6OhxDp6NXtTgCma0p+xOLxeXLeSal+pxnzPk 7fnrblhoVXAFqiIp98DOBANfH86wMhFJq0ZHt/fQyRgygSCxX/LDfXkTbNWD7ofyFGHT kKDG90K6rro9nkbkJvJqmKZbhd3SuzrZ5hXEa2JQ0OF5ZOWUeP0SuFddGZmaw8NsbtJi K0gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@google.com header.s=20221208 header.b=MjyyKDU4; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id k26-20020a05640212da00b0051e0e87e913si8622496edx.63.2023.07.14.03.09.02; Fri, 14 Jul 2023 03:09:02 -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=@google.com header.s=20221208 header.b=MjyyKDU4; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5AAA768C646; Fri, 14 Jul 2023 13:08:59 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A7E6968C646 for ; Fri, 14 Jul 2023 13:08:52 +0300 (EEST) Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-5704970148dso14475407b3.3 for ; Fri, 14 Jul 2023 03:08:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1689329331; x=1691921331; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=n4hXeYWSNHyZPMxy/V15iPRIMp0isH3A7mDEQWu5dWc=; b=MjyyKDU4Vknu6wwj2zROTLnJP9pAkrnAKacnoxYvVD4BBX6D/UVLAErEiqLKh84u49 pwvM5ccQ06D0fvjTzae64jkhx5WpApvKM9bWb6z8EVxpa62ur9dquHTeXxqHV85RLB0J 2rNR3Nel3d/3lxFAveqhslT8nRHs59l8AIsbxpr1UX8/fcxAPgcG7S4F/PVGVLnRLyWj T+v8fQ7PSootbt542ccxb4MhPS0+RVk9d3r8TsxX//roGtPMRjgT6KL9mRJkYuA6UBRU 5kfdM31ROFRUz03E44ZsNIgexSWrtZ0nUUNXOpCPTq4tbZ1GpmDD+Ekv8jXWaMaDn1mp 6Djw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689329331; x=1691921331; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=n4hXeYWSNHyZPMxy/V15iPRIMp0isH3A7mDEQWu5dWc=; b=KRHsvQea2BrazzDMXj+MldjgErnAIGB3d4qhLODDURPjGjJ1R53Cmfzl2psWdkBNd/ rIipIJWmRGZn1mu2YvF9dfLxh6iB07i8CEKupkJdk2w1nxGCoj/uT7wTov50kWzCEnmZ TpANDEuD6lKYclEv5PvXVR/Tr013QP+WEPJ1+eWwfoF0JCVKo2NDVmXbMtEMrobUosE0 3zCWD1L9aAFjGMt5SKOsU8l/poTQ0a8Tq2/gPwP73LZUNVw1UmV3khg8HKmiBkCXyHwx MPbnijGLikjJC6vrADeIVFHQEKT1Erp/AhI3RLyGkDa1y18PlIs/m+8oq28VwercPLvb 5Y2w== X-Gm-Message-State: ABy/qLYt6nUWzVUqHWg+APPtDrBzBc6JJNCaewRVIFA+SW1I02c9M73+ m5DkP7WyP0sXZVH3PJMsjVMczWbT68J57ZEKfxT5M9SfnYfHEDAXQ3Jj3/AnA45hWy7R+zpv0Lq jHASR9IvWmrc1rt/ga94zqEUZgNL3lV/PgmrlpGqqq2zwUyoGSIYT1WZXlQdU4pjn8WPPSSM= X-Received: from alankelly0.zrh.corp.google.com ([2a00:79e0:9e:2:4c42:89a0:4fe0:9543]) (user=alankelly job=sendgmr) by 2002:a81:d84d:0:b0:56d:25f3:f940 with SMTP id n13-20020a81d84d000000b0056d25f3f940mr34973ywl.10.1689329330916; Fri, 14 Jul 2023 03:08:50 -0700 (PDT) Date: Fri, 14 Jul 2023 12:08:46 +0200 Mime-Version: 1.0 X-Mailer: git-send-email 2.41.0.255.g8b1d071c50-goog Message-ID: <20230714100847.475017-1-alankelly@google.com> From: Alan Kelly To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH 3/3] swscale/x86/yuv2yuvX: Process tails by jumping back into the main loop. 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: Alan Kelly Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: b5o0Q0e78/GW --- libswscale/x86/swscale.c | 11 ++++------- libswscale/x86/yuv2yuvX.asm | 12 ++++++++++-- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/libswscale/x86/swscale.c b/libswscale/x86/swscale.c index 52423a1199..71434f58d3 100644 --- a/libswscale/x86/swscale.c +++ b/libswscale/x86/swscale.c @@ -202,17 +202,14 @@ static void yuv2yuvX_ ##opt(const int16_t *filter, int filterSize, \ const int16_t **src, uint8_t *dest, int dstW, \ const uint8_t *dither, int offset) \ { \ - int remainder = (dstW % step); \ - int pixelsProcessed = dstW - remainder; \ if(((uintptr_t)dest) & 15){ \ yuv2yuvX_mmxext(filter, filterSize, src, dest, dstW, dither, offset); \ return; \ } \ - if(pixelsProcessed > 0) \ - ff_yuv2yuvX_ ##opt(filter, filterSize - 1, 0, dest - offset, pixelsProcessed + offset, dither, offset); \ - if(remainder > 0){ \ - yuv2yuvX_ ##tail(filter, filterSize, src, dest, dstW, dither, offset); \ - } \ + if (dstW >= step) \ + ff_yuv2yuvX_ ##opt(filter, filterSize - 1, 0, dest - offset, dstW + offset, dither, offset); \ + else \ + yuv2yuvX_ ##tail(filter, filterSize, src, dest, dstW, dither, offset); \ return; \ } diff --git a/libswscale/x86/yuv2yuvX.asm b/libswscale/x86/yuv2yuvX.asm index 57bfa09d66..ad0e8bd448 100644 --- a/libswscale/x86/yuv2yuvX.asm +++ b/libswscale/x86/yuv2yuvX.asm @@ -54,6 +54,8 @@ cglobal yuv2yuvX, 7, 7, 8, filter, filterSize, src, dest, dstW, dither, offset %else movq xm3, [ditherq] %endif ; avx2 + mov ditherq, dstWq + sub dstWq, mmsize * unroll %if cpuflag(avx512) mova m15, [permutation] @@ -131,8 +133,14 @@ cglobal yuv2yuvX, 7, 7, 8, filter, filterSize, src, dest, dstW, dither, offset add offsetq, mmsize * unroll mov filterSizeq, filterq cmp offsetq, dstWq - jb .outerloop - RET + jb .outerloop + + mov dstWq, offsetq + mov offsetq, ditherq + sub offsetq, mmsize * unroll + cmp dstWq, ditherq + jb .outerloop + REP_RET %endmacro INIT_MMX mmxext