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 307BC480BC for ; Thu, 9 May 2024 06:50:02 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 08FCC68D74F; Thu, 9 May 2024 09:49:40 +0300 (EEST) Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E68E568D72B for ; Thu, 9 May 2024 09:49:32 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id B3025EA66E; Thu, 9 May 2024 08:49:32 +0200 (CEST) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pIXwXocwjTuJ; Thu, 9 May 2024 08:49:31 +0200 (CEST) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 3FF18EA668; Thu, 9 May 2024 08:49:31 +0200 (CEST) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Thu, 9 May 2024 08:49:18 +0200 Message-Id: <20240509064918.6654-4-cus@passwd.hu> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240509064918.6654-1-cus@passwd.hu> References: <20240509064918.6654-1-cus@passwd.hu> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 4/4] avfilter/vf_geq: fix interpolation with 1 pixel width/height 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 Cc: Marton Balint 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: Fixes ticket #9740. Signed-off-by: Marton Balint --- libavfilter/vf_geq.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/libavfilter/vf_geq.c b/libavfilter/vf_geq.c index dbe50e5250..12604d44a2 100644 --- a/libavfilter/vf_geq.c +++ b/libavfilter/vf_geq.c @@ -112,8 +112,12 @@ static inline double getpix(void *priv, double x, double y, int plane) return 0; if (geq->interpolation == INTERP_BILINEAR) { - xi = x = av_clipd(x, 0, w - 2); - yi = y = av_clipd(y, 0, h - 2); + int xn, yn; + + xi = x = av_clipd(x, 0, w - 1); + yi = y = av_clipd(y, 0, h - 1); + xn = av_clip(xi + 1, 0, w - 1); + yn = av_clip(yi + 1, 0, h - 1); x -= xi; y -= yi; @@ -122,17 +126,17 @@ static inline double getpix(void *priv, double x, double y, int plane) const uint16_t *src16 = (const uint16_t*)src; linesize /= 2; - return (1-y)*((1-x)*src16[xi + yi * linesize] + x*src16[xi + 1 + yi * linesize]) - + y *((1-x)*src16[xi + (yi+1) * linesize] + x*src16[xi + 1 + (yi+1) * linesize]); + return (1-y)*((1-x)*src16[xi + yi * linesize] + x*src16[xn + yi * linesize]) + + y *((1-x)*src16[xi + yn * linesize] + x*src16[xn + yn * linesize]); } else if (geq->bps == 32) { const float *src32 = (const float*)src; linesize /= 4; - return (1-y)*((1-x)*src32[xi + yi * linesize] + x*src32[xi + 1 + yi * linesize]) - + y *((1-x)*src32[xi + (yi+1) * linesize] + x*src32[xi + 1 + (yi+1) * linesize]); + return (1-y)*((1-x)*src32[xi + yi * linesize] + x*src32[xn + yi * linesize]) + + y *((1-x)*src32[xi + yn * linesize] + x*src32[xn + yn * linesize]); } else if (geq->bps == 8) { - return (1-y)*((1-x)*src[xi + yi * linesize] + x*src[xi + 1 + yi * linesize]) - + y *((1-x)*src[xi + (yi+1) * linesize] + x*src[xi + 1 + (yi+1) * linesize]); + return (1-y)*((1-x)*src[xi + yi * linesize] + x*src[xn + yi * linesize]) + + y *((1-x)*src[xi + yn * linesize] + x*src[xn + yn * linesize]); } } else { xi = av_clipd(x, 0, w - 1); -- 2.35.3 _______________________________________________ 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".