From patchwork Sun May 6 11:40:54 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: 8802 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:155:0:0:0:0:0 with SMTP id c82-v6csp1853814jad; Sun, 6 May 2018 04:41:37 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpcu6aUWYpsya+E0dGEaAKbdi7Gsrj4ogKMj/9vxQge8Weoju1i0LoOdqgzlMUQmJyEdlVu X-Received: by 2002:adf:8e44:: with SMTP id n62-v6mr26413739wrb.159.1525606897081; Sun, 06 May 2018 04:41:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525606897; cv=none; d=google.com; s=arc-20160816; b=oVqZa+69q4rGXBKUnptUsgiH72BWoGYtD81xBI9QLgeJvgzF1JIIX3ZU3MNVzHDmUz lbpJHeYpM57FgMRAK5MrnWj4/AanR31C9bXSZXAyAQNkTBwNDYNUIsf0lt9Up9y50JEr y04f0YLAobaFaccl8k4tPGSL8hPueQQlPNeqrYIDDjTwxCeuIZ+2C88t75Rr7cx0L5nf S0EkD18tvrglBfFGsil0cW3qN/ntRzQpgbR0qDskG6Q+fqCOwBW03ytvQ7wYfJlcIalK J+glX0ZfA8Y3FxWKu3oYtJg2hN6ISUtAueiPgv5kGi2JS9Lk4cAzFlxFdNcepvSCNNSY MUvA== 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=bMhH0U5GMEYPAe+2IMngCnhXrLRXiKK0VG2POUGJyyc=; b=d7oQFqeiJHUuvMg9e6+zSpY/7E3TkFsOBzmzPmGO9A0IKeZl+1V5q9ruPMcV4zineU 5gAclKU1WuiQl61ExIc3r9v0zjNg0diZzEl+QOSGwxPlnCcJEfsFVttv4BExh10Mz7h5 0V5gYOXSB4IPLd6PbjLxVwxK7rBK/TRIDiWkbft8h8ED9OOxQZE3+nwcYmyQtLImDzPD h/2AqwXBdOVxcs/rsLLiJzUnbh+9taLPw0h2iy8fvbNLWM2OqSDUTpNsO9zBODYkyU6s ZQmpt3xu4HEUBxekJjzFUPumt+bhwp/iA4GjgAeBEoypCJvPy9hhVGfhPfD/2X6lyOEx 5NOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@pkh.me header.s=selector1 header.b=OckyjJ9b; 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 q187si4006897wmd.49.2018.05.06.04.41.36; Sun, 06 May 2018 04:41: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=@pkh.me header.s=selector1 header.b=OckyjJ9b; 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 4B23868A613; Sun, 6 May 2018 14:40:45 +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 DEB6A68A609 for ; Sun, 6 May 2018 14:40:38 +0300 (EEST) Received: from golem.pkh.me (localhost.localdomain [127.0.0.1]) by golem.pkh.me (OpenSMTPD) with ESMTP id a2cf5753 for ; Sun, 6 May 2018 11:41:03 +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=YZN2IIB1NCggVTk4FWK6sMKvFXE=; b=OckyjJ9bj3VyD+gvAlSTeIRD5SPs YpU/CkWMRYND7AS1V71elmTaPI+lTBHgIbFH8ACMcXorya4UxgL8EuVDZKff2YTp zaMLiKJ0E/756A8u+u5F1wU0i59A4gn0vNEEvDfe/V8Yv587JTWnFW89BR+PhlYl 2NDAfF/rRGux37mcqtODLswV7RYj11w3vVEPZlogoHS/XKYo8gbcjQg8/Rnb4u1i a71ZtWofSbzdWM+uGPR6fmXeAbHtJd5fyBoUU97rlAbEP1cIdcS3fPw5/QX2uIAc 1j5670G8qCGEFeeQ41ZPPOfi2jrYFkf06wyadTS+LgMuPMJJLX6MrbHGeQ== 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 jMCDej/0cHeeaSrLAWXeRiRkpnoqZMrZDtIWlVU/F25zsTnSfi78B0R+xvHCDdc2 jR4KXIIrvgF2HGf0ibqQr3FkE511dnNFnGJFRpWmFKtmr41yCQXAdyAuD8TcwgJ5 XNpFQQFyfjBkIEaS9jHHuU4NqzlMTVrXowkcCFH2XHjTUr3BaxoGDcNS8XH5f4Q7 G/lyHXqIHWN56rmIvtpXJJpSM0kq8MPOtyY1765053cpdvrzkQXe9wVjv37KwSMG Pf6MYYt8ZddQ4Ua97v0DWBmQhLs+vfn/jhc34CJ6e2B6a12QiD5nAgjtmQvnKrCo dy6eenxksc15MuOym0r0A== Received: from localhost (golem.pkh.me [local]) by golem.pkh.me (OpenSMTPD) with ESMTPA id 3fdae298; Sun, 6 May 2018 11:41:03 +0000 (UTC) From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= To: ffmpeg-devel@ffmpeg.org Date: Sun, 6 May 2018 13:40:54 +0200 Message-Id: <20180506114100.4223-4-u@pkh.me> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180506114100.4223-1-u@pkh.me> References: <20180506114100.4223-1-u@pkh.me> Subject: [FFmpeg-devel] [PATCH 3/9] 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 21f981a605..4119fa3e01 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;