From patchwork Mon May 7 17:24:15 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: 8838 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:155:0:0:0:0:0 with SMTP id c82-v6csp3102841jad; Mon, 7 May 2018 10:25:00 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpx8cTZPp/Xd9UA9Oixbr15E9DfIqlBt0C62FFpBTt/yJ2zPAZNSyO/DiDwSH8SksUO3AA2 X-Received: by 2002:adf:b807:: with SMTP id h7-v6mr29609169wrf.113.1525713900328; Mon, 07 May 2018 10:25:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525713900; cv=none; d=google.com; s=arc-20160816; b=gda5RuY2j+9P4eepgD0OhPtN0rAsdAftn8UPxrtEbHoiariJb3W6bB2XQrJiq9mrlj SVqkbsUSGzP++kFEACvK8W3s/AmNMUa3L2IaGrBhyulxBsoLGf0PH8sq5f9ElL4JqUmc OLwk4JLl1Reabfcd23dHmod6M+OevYlq+yOsoqnOPg8OCftFQE+ZCxO4TUH/zUSgXmin OqXneTGURXYvB/QcStKk0syP1rTcFB1DKtEiC7fTRoSspP2eWdLeEoVC3f/uri8GgeOJ Y5H2m60gCteb26PDkw/e46xF4+PVvIIneduFlg2KjOZ3biwcLJcH01N8/URXXpYt2EIQ N8KA== 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=nWMGEjlt8EtORzSldy6BosxZ+DxrnCHdL4xMR5DsU0A=; b=NrOmguLmbPy8yHdFsxx0MK7stw6fEIPH17W+eIiHAHAV86f0E7dLLrEXZF6NOB0KNE WncwE0OWI6TFcLG/3+bL/agDI24/jwW9QxicbTJLw/RGxrmIO53Z5qveykC8Rr5OoGTE AOzJT48bmkQKaIKoaiDhpcgVxRPIuRsAPWXKcD93D8vqIU2KRt3hflzYy8kumXtTFLC0 fZiT3Xpa8zMsDJYNp/oIbo/BbF4CMZVI0hB51MV32/wMjVuBL4Cqi1cxLnwZlMqqNOMo xtD1GiyzPgJMfm1ijDQMxsuU73mKgxLElWVezJEm4udTGMyvIUP+wgDxfl0ZTwo+OOn+ kW+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@pkh.me header.s=selector1 header.b=RGysd0p5; 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 27-v6si15298415wrz.15.2018.05.07.10.24.59; Mon, 07 May 2018 10:25:00 -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=RGysd0p5; 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 9FE5C680439; Mon, 7 May 2018 20:24:05 +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 AEB40680439 for ; Mon, 7 May 2018 20:23:59 +0300 (EEST) Received: from golem.pkh.me (localhost.localdomain [127.0.0.1]) by golem.pkh.me (OpenSMTPD) with ESMTP id 4366835c for ; Mon, 7 May 2018 17:24:25 +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=QL37LpmxwGqtHeV00WTft3HfOdo=; b=RGysd0p5zDt3KztwuNnBImvUTNrI GHOqlKlXG19YagiuiEQjISslBNmWo0Buhd5h+BWMQgq652u16/ph1U89DnXVqdQI JSlx8vWhVucdycS8nW6F1AsGu4/zm5IPL3G/3SHeM1+h+F7ZqIB53i5hdvhy17uI hfRrJY3BSVQYxpLTo6Zwnj3mopRqzkGolyCz/mhAEKp6cXBD+Kl/UrJv6kMTTc3m w+RepwiyCysprNVvvSPA5kfZUf0A8nwVB2erNEHCkIQOMtJP+EQ6k09osLA97KBr P3yi4Q9DZP4SGWQ9i/Hd0Y83YIlS7mqQyDmjKWlCwD1hFitkRCo/S7lunw== 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=B qIWrxuoUNdQbIwuvd5S14JBU3Qfax60m8jtTZLFaJmTJHSqCD3YoKGcKWsDo95Wp niGqkSGhCvosftnfTqk3F5KYJuxFSqAO7noov9O2c96eF2SWPNDwL2yvQY0Z8duc qEH+rpiZtbyGDWP7vks+7AKDGK+8IMQCuB52/++YuCJTVGR+OC/H2I8Eok9PRlqy MK7e6aOxJzM0CnlIl3rQvnjyr6m2McTGSCRhyEdDNO0Txe7fl4Qd2QtSwp6dkHLs wxLiixuSA/OnOt37Lg4+Ju+BrXM68qoHQhLYZf2oR7d6tHcMpvRzhxfXvVp1E7S6 s6GKcKAGWrkkK1A2p1H5w== Received: from localhost (golem.pkh.me [local]) by golem.pkh.me (OpenSMTPD) with ESMTPA id 80b9206e; 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:15 +0200 Message-Id: <20180507172422.11003-4-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 03/10] lavfi/nlmeans: use ptrdiff_t for linesizes 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" Similarly to previous commit, this will help writing SIMD code by not having manual zero-extension in SIMD code --- libavfilter/vf_nlmeans.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/libavfilter/vf_nlmeans.c b/libavfilter/vf_nlmeans.c index 3f0a43ee72..b081a4e5af 100644 --- a/libavfilter/vf_nlmeans.c +++ b/libavfilter/vf_nlmeans.c @@ -60,9 +60,9 @@ typedef struct NLMeansContext { uint32_t *ii_orig; // integral image uint32_t *ii; // integral image starting after the 0-line and 0-column int ii_w, ii_h; // width and height of the integral image - int ii_lz_32; // linesize in 32-bit units of the integral image + ptrdiff_t ii_lz_32; // linesize in 32-bit units of the integral image struct weighted_avg *wa; // weighted average of every pixel - int wa_linesize; // linesize for wa in struct size unit + ptrdiff_t wa_linesize; // linesize for wa in struct size unit double weight_lut[WEIGHT_LUT_SIZE]; // lookup table mapping (scaled) patch differences to their associated weights double pdiff_lut_scale; // scale factor for patch differences before looking into the LUT int max_meaningful_diff; // maximum difference considered (if the patch difference is too high we ignore the pixel) @@ -150,9 +150,9 @@ static inline int get_integral_patch_value(const uint32_t *ii, int ii_lz_32, int * while for SIMD implementation it is likely more interesting to use the * two-loops algorithm variant. */ -static void compute_safe_ssd_integral_image_c(uint32_t *dst, int dst_linesize_32, - const uint8_t *s1, int linesize1, - const uint8_t *s2, int linesize2, +static void compute_safe_ssd_integral_image_c(uint32_t *dst, ptrdiff_t dst_linesize_32, + const uint8_t *s1, ptrdiff_t linesize1, + const uint8_t *s2, ptrdiff_t linesize2, int w, int h) { int x, y; @@ -198,9 +198,9 @@ static void compute_safe_ssd_integral_image_c(uint32_t *dst, int dst_linesize_32 * @param w width to compute * @param h height to compute */ -static inline void compute_unsafe_ssd_integral_image(uint32_t *dst, int dst_linesize_32, +static inline void compute_unsafe_ssd_integral_image(uint32_t *dst, ptrdiff_t dst_linesize_32, int startx, int starty, - const uint8_t *src, int linesize, + const uint8_t *src, ptrdiff_t linesize, int offx, int offy, int r, int sw, int sh, int w, int h) { @@ -240,8 +240,8 @@ static inline void compute_unsafe_ssd_integral_image(uint32_t *dst, int dst_line * @param h source height * @param e research padding edge */ -static void compute_ssd_integral_image(uint32_t *ii, int ii_linesize_32, - const uint8_t *src, int linesize, int offx, int offy, +static void compute_ssd_integral_image(uint32_t *ii, ptrdiff_t ii_linesize_32, + const uint8_t *src, ptrdiff_t linesize, int offx, int offy, int e, int w, int h) { // ii has a surrounding padding of thickness "e" @@ -367,7 +367,7 @@ static int config_input(AVFilterLink *inlink) struct thread_data { const uint8_t *src; - int src_linesize; + ptrdiff_t src_linesize; int startx, starty; int endx, endy; const uint32_t *ii_start; @@ -379,7 +379,7 @@ 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 int src_linesize = td->src_linesize; + const ptrdiff_t src_linesize = td->src_linesize; const int process_h = td->endy - td->starty; const int slice_start = (process_h * jobnr ) / nb_jobs; const int slice_end = (process_h * (jobnr+1)) / nb_jobs; @@ -403,8 +403,8 @@ static int nlmeans_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs } static int nlmeans_plane(AVFilterContext *ctx, int w, int h, int p, int r, - uint8_t *dst, int dst_linesize, - const uint8_t *src, int src_linesize) + uint8_t *dst, ptrdiff_t dst_linesize, + const uint8_t *src, ptrdiff_t src_linesize) { int x, y; int offx, offy;