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