From patchwork Mon May 7 17:24:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgQsWTc2No?= X-Patchwork-Id: 8840 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:155:0:0:0:0:0 with SMTP id c82-v6csp3102518jad; Mon, 7 May 2018 10:24:41 -0700 (PDT) X-Google-Smtp-Source: AB8JxZr0l8GuvOaD3f6l6WZa5C3pqzwbDw1m0W732FROisSjvZqh9yvi/bMtGA7DtUOIIPi/VwOm X-Received: by 10.28.183.215 with SMTP id h206mr1425298wmf.2.1525713881199; Mon, 07 May 2018 10:24:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525713881; cv=none; d=google.com; s=arc-20160816; b=KsLBCRnApk1y4jG1GTEQahyboj1XOhcaDf2tX+SSjtr12/LRnygSr7XhglADclvuXy zOJattHmVRhXf6pezS6tHQjTYMykfg2IRaaJJrFp1XomsfDkqR4TrFL5x6clCPpfEwxa 1K2TSiu11PBHzE+6exGmSsWRNP6fjpwFPR00iJpIPWUZY9amlpQpyVsPqORIrDimbT5e wvU7G8/n6qeG/w+YXAp1JAOM3SaV7/g2hlowbtIZiAyRP21VLnLzSK0I38yw+ea0Qudu rKZpeCGPRIzqEmqdqciw/ag16MfnV0ibwuChljDB9Ivqq6ads9aDITt/3BtYFfAPkKRK +GPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:domainkey-signature:dkim-signature:delivered-to :arc-authentication-results; bh=xi9BnKPywk/H9iRn959lVajVIk6DOoMbv8dUnfoyNGg=; b=Mc2jA2XLOKB3KvPuLm8Ug7airWx2YEvpkxyzl5x0mb0+icNfUO5er2efULlGEaXnKc v3zn7NizsHG0VetzZygQAHUlJ4OZfPGnvPBUTwEpHt8Jw3RB9Fg3KJB3ZB5eefKmwHRY vA31yfOnwWuTeIi+gXxZIu5MBBOyqL7C7b2LlEeZaSWFHEBrdihIzazA+YFSukfym+xi HUsHTdWE23MfNoHMc14Glp6fsSGdoQJyRysYXR4PfOR7UX6sMYIZxDSa7euOyzSLZmoO 6QA0vY+JSH6e89beI6+8ZDC78SptwC2P+DHB82Zg76RQ/35O5TJrErHcFkCszSjYkZl6 QRKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@pkh.me header.s=selector1 header.b=AabKZXJD; 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 t187si5253582wmf.100.2018.05.07.10.24.40; Mon, 07 May 2018 10:24:41 -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=@pkh.me header.s=selector1 header.b=AabKZXJD; 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 7CCE468A623; Mon, 7 May 2018 20:24:00 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from golem.pkh.me (LStLambert-657-1-117-164.w92-154.abo.wanadoo.fr [92.154.28.164]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id ADB0A68A63D for ; Mon, 7 May 2018 20:23:54 +0300 (EEST) Received: from golem.pkh.me (localhost.localdomain [127.0.0.1]) by golem.pkh.me (OpenSMTPD) with ESMTP id b91b3a3d for ; Mon, 7 May 2018 17:24:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pkh.me; h=from:to:cc :subject:date:message-id:in-reply-to:references; s=selector1; bh=2yDn4QyIQiV/G5Cz1H4yFPVwJak=; b=AabKZXJD5noxacCMH2dOlehuzHkl czjM/hGoF3GuiLrg9/Mt1ZEgwg/aNEDAHvoCGr7cfZqV+ow/jfCQAsPDSWspOj0T GZmwdFhYdBsHsHABi+XVWtZKcyVgPPRu9dFd1rCy1g0dMLK9yorZsveIthdjirbh UYSYi2as1Dh2MOyFC1H8Q70AUCypYCoMIompZwKcgqN9nDNwootaflwCY4V0+/0T UNwmD9nb45CMXdeDgwg1eCM48Wzp8EZLe1d2cNQccXCVOxVBrJRgUQHTxNI1Aorz 1zi14jA+tIbtRRWzgUd9xzOrJV6WoZhZfimgaGgqU4ovH1wPIdwSooFMUQ== DomainKey-Signature: a=rsa-sha1; c=nofws; d=pkh.me; h=from:to:cc:subject :date:message-id:in-reply-to:references; q=dns; s=selector1; b=f RC5cmcd0pnR7z6nTqlh6RaFWqznI4saEiTf6F0zaUdXzFi/lzedv8oLyK1xZbHgq 5tFeqhbw+t3kADUtB2EnfuDsptVdFeFOgPLC6U4EpoWr/wAao6cTbBq0FH1ZNNul qxzylcg3HNxTelxCOkAvu2XvH3QXSrMjfxbx1Op6PI9zrO0GnHnk1c/deoIO/z1/ 3zoM7XUPrGm3eXzBLWmRAtyoJh+FnCHP/1sn1rAmFHWQDDpEMGORNU/wEJIUzK+z I92Jqj1uNyS6E4ISDIkpkuu0dnACSrPW3DIH8AJxKopPD6hPNOfd7fUtr3QK/LhY 5VhXy/03rAjMObmdeEgUA== Received: from localhost (golem.pkh.me [local]) by golem.pkh.me (OpenSMTPD) with ESMTPA id 47443e21; Mon, 7 May 2018 17:24:24 +0000 (UTC) From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= To: ffmpeg-devel@ffmpeg.org Date: Mon, 7 May 2018 19:24:13 +0200 Message-Id: <20180507172422.11003-2-u@pkh.me> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180507172422.11003-1-u@pkh.me> References: <20180507172422.11003-1-u@pkh.me> Subject: [FFmpeg-devel] [PATCH v2 01/10] lavfi/nlmeans: random code shuffling to help compiler X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" This makes nlmeans_slice() slightly faster at least on GCC 7.3. --- libavfilter/vf_nlmeans.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavfilter/vf_nlmeans.c b/libavfilter/vf_nlmeans.c index e4952e187e..d222d3913e 100644 --- a/libavfilter/vf_nlmeans.c +++ b/libavfilter/vf_nlmeans.c @@ -368,7 +368,6 @@ static int nlmeans_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs int x, y; NLMeansContext *s = ctx->priv; const struct thread_data *td = arg; - const uint8_t *src = td->src; const int src_linesize = td->src_linesize; const int process_h = td->endy - td->starty; const int slice_start = (process_h * jobnr ) / nb_jobs; @@ -377,14 +376,15 @@ static int nlmeans_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs const int endy = td->starty + slice_end; for (y = starty; y < endy; y++) { + const uint8_t *src = td->src + y*src_linesize; + struct weighted_avg *wa = s->wa + y*s->wa_linesize; for (x = td->startx; x < td->endx; x++) { const int patch_diff_sq = get_integral_patch_value(td->ii_start, s->ii_lz_32, x, y, td->p); if (patch_diff_sq < s->max_meaningful_diff) { - struct weighted_avg *wa = &s->wa[y*s->wa_linesize + x]; const int weight_lut_idx = patch_diff_sq * s->pdiff_lut_scale; const double weight = s->weight_lut[weight_lut_idx]; // exp(-patch_diff_sq * s->pdiff_scale) - wa->total_weight += weight; - wa->sum += weight * src[y*src_linesize + x]; + wa[x].total_weight += weight; + wa[x].sum += weight * src[x]; } } }