From patchwork Thu Apr 29 16:24:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 27484 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a11:4023:0:0:0:0 with SMTP id ky35csp1651361pxb; Thu, 29 Apr 2021 09:25:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+7hAJ/fB0gj+xJVLWu0xrHAXODueCi+iM2UZ9eThF4TWxSHMTAF2zHFTo07sPOM538GDf X-Received: by 2002:a05:6402:110b:: with SMTP id u11mr485366edv.356.1619713521863; Thu, 29 Apr 2021 09:25:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619713521; cv=none; d=google.com; s=arc-20160816; b=ysI5Q60xna50nwljob4Zo0NH3UdQhSzpzNIYv9MDT8dyAjJLZKNPDuYIBaX6M3dkKc B77fmB9btE53u/jx7GdFN4lHLbNBy7O72vfED/pmzArsSomFcJGoQgcHYQFtsqf2mG1Z ZZlQpvFwFn8WLDeyxsgYZHA5GqDX+mLRJZLHFqSIazzcTh0/esHf1GR2E3LIiuo/x2Y+ yyffsyJih5SRI9IYptq06QpIQ0HyLaxeEF3g9o1QVj0FipfJQ9fS62YQ05nRPlsJ3gvv nbgc8e1bJVX2tz3fLfs+ZwxJIoz3JKGOq2kjiePrwrjPOF34hb3kyqisf/bsgQ9+4wsq iCrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=6GzzNSLBpVm3MtBt8RNRxoWX5d5UAayAKUspz6FLW2w=; b=SGbSZrY51C+JdaztvsdtvPyy2vzhE7n3Run+po372o57ihWs13Van79tbne96dnGx3 aGPaxB29UXW3a3QI/JBaEBG81XkqvAv0PscOFZeviFvZljr5Gm7yv4Mopu3wwn1/yyor QfJZUsM5uvjl5Odew5CnnJPHV8NVFoq1O/4Oc9xOGYs9dVi+TVHtkqOy/+xH2qRWBr57 +z47mWzt8NAX5JCP9DoK6hki5tQZ5Ph1QMDT612xIkZWMCjHZRg2F67R0alShUq8Lafg bts+o/yjIE6hWnuOLC+w7rVstoUjPo/bZkwtgO7PAqyA8DDeKjv/X26vSfqS7O6hTYeu 2kVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=syQw9vA8; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id q17si464711ejj.672.2021.04.29.09.25.20; Thu, 29 Apr 2021 09:25:21 -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=@gmail.com header.s=20161025 header.b=syQw9vA8; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A6ED4689F86; Thu, 29 Apr 2021 19:25:17 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qv1-f48.google.com (mail-qv1-f48.google.com [209.85.219.48]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4DCCF68812C for ; Thu, 29 Apr 2021 19:25:10 +0300 (EEST) Received: by mail-qv1-f48.google.com with SMTP id t14so2778903qvl.10 for ; Thu, 29 Apr 2021 09:25:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=cJTKEUKv8S+71pxgeQneZqZlv4fZn1ze0lrKEFX+R5Y=; b=syQw9vA80lK3oh/Spy8c7vDuWUWrVn9rhxK6Q3XoGPvL2Fpnp3ok5EG2I3zrCRAIGT J95XWWLZ6QFSwJ6V3c/4n57Bu41ToFjrg2Y/s3t3cO3EwgSspsrd1OXKv6XOFCTUlkBw njITD9IsTjdUTG3FVLaRUn8hZLz2pkRSzbwLLIsAueDfewuvhU7rGaWTNNsgqAVPT5dd H+mg0WFm9vimpOBB4opi/kbJFrM0H7N+cpnSYo5xy2F4KKsvEz5dxWo8atJs+oQfZz+R 8Fmk3pl2ujYijoqhjvuA0Q50ZXwcGIR93VP0hSdZve6SIK6IOpBXhD7snwXh8E1sxEbP YPKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=cJTKEUKv8S+71pxgeQneZqZlv4fZn1ze0lrKEFX+R5Y=; b=Jepo9viTn1lb7lgq+Bq5uot2h3dGp6ZXY2KvDR7vQS6GQSNqAbl+tejcJqVwb1tbue xwUnb20zL/ulu82e2N/LDmZnfHXGmIZR1XtJryKRIqxTbD08F1widBZRRi/zeMDcnBvE tD8y3D8IWEtvkMjNqQmhP/H6K4bgDdwhiXKcQOReFq+URlwdtAZBcZJ8NiQoANKEXVu2 VxHbXd0avGuQOIzt8wMwf03GhqYcURC9KK4nl/YLYXtdOHC6W3594XWpvdTR76YTUOMd tq5x8YOexkd3bBGowpb6gRPGuU4erwiWgQ7PnkbEFhJBV6hCQgffpl5N9nIbIWM6byAI +B8A== X-Gm-Message-State: AOAM533o690Ci5lH1NfmE8euhumjs4clKqGoP1cmumZlGukGOwzZcj6R 8IrUmKEf2Yp1/MvOIhIQDw6t+VBI9L4= X-Received: by 2002:ad4:52c2:: with SMTP id p2mr487067qvs.45.1619713508557; Thu, 29 Apr 2021 09:25:08 -0700 (PDT) Received: from localhost.localdomain ([191.83.208.172]) by smtp.gmail.com with ESMTPSA id m22sm269884qtg.67.2021.04.29.09.25.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Apr 2021 09:25:08 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Thu, 29 Apr 2021 13:24:53 -0300 Message-Id: <20210429162453.58605-1-jamrial@gmail.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avfilter/vf_scale: store pointer offsets in a local variable before adding them 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: ftALj94vks1H Fixes -Wint-in-bool-context warnings. Signed-off-by: James Almer --- libavfilter/vf_scale.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c index d95a8ad48a..759499395f 100644 --- a/libavfilter/vf_scale.c +++ b/libavfilter/vf_scale.c @@ -632,10 +632,12 @@ static int scale_slice(AVFilterLink *link, AVFrame *out_buf, AVFrame *cur_pic, s for (i=0; i<4; i++) { int vsub= ((i+1)&2) ? scale->vsub : 0; + ptrdiff_t in_offset = ((y>>vsub)+field) * cur_pic->linesize[i]; + ptrdiff_t out_offset = field * out_buf->linesize[i]; in_stride[i] = cur_pic->linesize[i] * mul; out_stride[i] = out_buf->linesize[i] * mul; - in[i] = FF_PTR_ADD(cur_pic->data[i], ((y>>vsub)+field) * cur_pic->linesize[i]); - out[i] = FF_PTR_ADD(out_buf->data[i], field * out_buf->linesize[i]); + in[i] = FF_PTR_ADD(cur_pic->data[i], in_offset); + out[i] = FF_PTR_ADD(out_buf->data[i], out_offset); } if (scale->input_is_pal) in[1] = cur_pic->data[1];