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 E90084248A for ; Fri, 22 Apr 2022 08:05:05 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 67A5168B3D9; Fri, 22 Apr 2022 11:05:03 +0300 (EEST) Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B6B6968A61E for ; Fri, 22 Apr 2022 11:04:57 +0300 (EEST) Received: by mail-wr1-f54.google.com with SMTP id u3so9895900wrg.3 for ; Fri, 22 Apr 2022 01:04:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=4fwBxg1sC8lt7Gnyz3Mqa14cTD2Jptcu3zS/RoNKw68=; b=h9e+8PxTNLcNcWC4YfTO707M9E4yZKNFbwyYRDoeVe8O/8otezijGF7+sRyrtNew3g kon7AYxNMWPjyMFJBBDJXeaciULN1bmWy1ocgG8tcPGyvge/OAe49nHqjAogIDr5gNsX sAdemds+Nhu7X4RfkA0pkuwEtVBCGGWFatlIEBuwB/Cl+sdv6RpZag7jbRYS10siOK/x JvKxxAaLARM+/fuB+ciUKwhpPWGr9A4yJA3MTGABxVUlHSdR1WIlpnStuKiL9zQSfuqz vpy/qHqT2afX31Lxdt28VmdwNqtBDtQFj0ykYIUj8sIn99WjjqElBm67sdrUaq3BzeLp H9qA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=4fwBxg1sC8lt7Gnyz3Mqa14cTD2Jptcu3zS/RoNKw68=; b=Wxo2833YndnFcDyU8FJZK0qZx4NEwVi/rO0hmgRmbkYi0CSBIAY5bRfBhzp3/ALHL1 BBfqMaMQdC53BNvNqCGU5mX0krL5mhBlku2ZVO3krYxSsBLYosRRe3DvwnipK8ixtNsb 4CSJbvSFjq8YoS9WomKq5Ezn8oegkrtQy+zKGSVxlNB8D5gSX35ImCvwezKk077dzA/G SU6TJeSR61PYFEkJJo1ISXNJO26Z6e0BMmD97jH4Z7V8saR+2B7nyIzwkyryIMn4VyCX sRDIj2cbosKDZydszYSlj6TTjQxrhMYYxhpqt8QyE7frADIWwfKkB/reufgvuIsl/lNu wT7Q== X-Gm-Message-State: AOAM533/Ij3q//hyo+tpW9HdcnLE5SVOlelsiLMPA4KwJ41YqkjteD4f oFWdNXA5AmHwGc35Glqqpg9M7uoJ/dyAfE3iJDBYcO2jAqzUbg== X-Google-Smtp-Source: ABdhPJx+I6jjVxpo4s8bE7PFQHsZU7zk9vp5cUFFARKnuaO11wqebobQ9v3pVLBK4duv8266PULQ3PW00uT7MwkNe1c= X-Received: by 2002:adf:e410:0:b0:207:9a14:b76e with SMTP id g16-20020adfe410000000b002079a14b76emr2647269wrm.392.1650614696557; Fri, 22 Apr 2022 01:04:56 -0700 (PDT) MIME-Version: 1.0 References: <20220217100420.1113388-1-alankelly@google.com> In-Reply-To: <20220217100420.1113388-1-alankelly@google.com> From: Alan Kelly Date: Fri, 22 Apr 2022 10:04:45 +0200 Message-ID: To: ffmpeg-devel@ffmpeg.org X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: Re: [FFmpeg-devel] [PATCH v2 4/5] libswscale: Enable hscale_avx2 for all input sizes. 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 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: Ping! On Thu, Feb 17, 2022 at 11:04 AM Alan Kelly wrote: > ff_shuffle_filter_coefficients shuffles the tail as required. > --- > libswscale/utils.c | 19 ++++++++++++++++--- > libswscale/x86/swscale.c | 6 ++---- > 2 files changed, 18 insertions(+), 7 deletions(-) > > diff --git a/libswscale/utils.c b/libswscale/utils.c > index 7c8e1bbdde..d818c9ce55 100644 > --- a/libswscale/utils.c > +++ b/libswscale/utils.c > @@ -285,8 +285,7 @@ int ff_shuffle_filter_coefficients(SwsContext *c, int > *filterPos, > #if ARCH_X86_64 > int i, j, k; > int cpu_flags = av_get_cpu_flags(); > - // avx2 hscale filter processes 16 pixel blocks. > - if (!filter || dstW % 16 != 0) > + if (!filter) > return 0; > if (EXTERNAL_AVX2_FAST(cpu_flags) && !(cpu_flags & > AV_CPU_FLAG_SLOW_GATHER)) { > if ((c->srcBpc == 8) && (c->dstBpc <= 14)) { > @@ -298,9 +297,11 @@ int ff_shuffle_filter_coefficients(SwsContext *c, int > *filterPos, > } > // Do not swap filterPos for pixels which won't be processed by > // the main loop. > - for (i = 0; i + 8 <= dstW; i += 8) { > + for (i = 0; i + 16 <= dstW; i += 16) { > FFSWAP(int, filterPos[i + 2], filterPos[i + 4]); > FFSWAP(int, filterPos[i + 3], filterPos[i + 5]); > + FFSWAP(int, filterPos[i + 10], filterPos[i + 12]); > + FFSWAP(int, filterPos[i + 11], filterPos[i + 13]); > } > if (filterSize > 4) { > // 16 pixels are processed at a time. > @@ -314,6 +315,18 @@ int ff_shuffle_filter_coefficients(SwsContext *c, int > *filterPos, > } > } > } > + // 4 pixels are processed at a time in the tail. > + for (; i < dstW; i += 4) { > + // 4 filter coeffs are processed at a time. > + int rem = dstW - i >= 4 ? 4 : dstW - i; > + for (k = 0; k + 4 <= filterSize; k += 4) { > + for (j = 0; j < rem; ++j) { > + int from = (i + j) * filterSize + k; > + int to = i * filterSize + j * 4 + k * 4; > + memcpy(&filter[to], &filterCopy[from], 4 * > sizeof(int16_t)); > + } > + } > + } > } > av_free(filterCopy); > } > diff --git a/libswscale/x86/swscale.c b/libswscale/x86/swscale.c > index 73869355b8..76f5a70fc5 100644 > --- a/libswscale/x86/swscale.c > +++ b/libswscale/x86/swscale.c > @@ -691,10 +691,8 @@ switch(c->dstBpc){ \ > > if (EXTERNAL_AVX2_FAST(cpu_flags) && !(cpu_flags & > AV_CPU_FLAG_SLOW_GATHER)) { > if ((c->srcBpc == 8) && (c->dstBpc <= 14)) { > - if (c->chrDstW % 16 == 0) > - ASSIGN_AVX2_SCALE_FUNC(c->hcScale, c->hChrFilterSize); > - if (c->dstW % 16 == 0) > - ASSIGN_AVX2_SCALE_FUNC(c->hyScale, c->hLumFilterSize); > + ASSIGN_AVX2_SCALE_FUNC(c->hcScale, c->hChrFilterSize); > + ASSIGN_AVX2_SCALE_FUNC(c->hyScale, c->hLumFilterSize); > } > } > > -- > 2.35.1.265.g69c8d7142f-goog > > _______________________________________________ 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".