From patchwork Thu Oct 29 14:26:49 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ray Strode X-Patchwork-Id: 28702 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 3F5B2C3261 for ; Thu, 29 Oct 2026 14:27:07 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 086D5690AE; Thu, 29 Oct 2026 15:27:06 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="kBbUa5IU"; dkim-atps=neutral Received: from mail-vk1-xa29.google.com (mail-vk1-xa29.google.com [IPv6:2607:f8b0:4864:20::a29]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2A72C6909D for ; Thu, 29 Oct 2026 15:27:05 +0100 (CET) Received: by mail-vk1-xa29.google.com with SMTP id 71dfb90a1353d-5eb14d0837fso1490275e0c.3 for ; Thu, 29 Oct 2026 07:27:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1793284024; x=1793888824; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=tyjRjKn3T0kXnUpRTpVXSj5BWc520LjyBAWy057kmgA=; b=kBbUa5IUi5fwmHmzJn/iJ9Hbh0BC8bmmyEs6z8ckDj3inDkf/D514xusHhn//pAn0X qUFeCfuquTtvPVB5jPq0Y2ZNqDj3e/Zu1RDHZTXMmshbCRttg9DbWkxFpnHxUB16xmqt +Q88A/BmOK7FXsOd1zFalMQ3PIoWg+YP1OL1nlM/cLfHI0F37djnrPqs2YsNc/Pbo6vC lEOZP7mndN1h2BQ9JUjY1yzEe/AWFUCZpxzEn6MYRqpxeiEMu1x6UhAngKhdHxwMZ3EH Uks4POVS7rjdTo+nTW8IGirADV6YOawx7/cM2nFgZWURJGSJZSeXZCoIJOoxh3/pT7pg FeLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793284024; x=1793888824; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=tyjRjKn3T0kXnUpRTpVXSj5BWc520LjyBAWy057kmgA=; b=Cc/l7/AxDNFhje14Xg6ip+NTu7GTjl2OBt7Ooip5hBQtg2Q1DBaCGWtL+DamquQlFT p1nuBCFliThceiyLpA0xHbkgxGGJxMLtniEIJyKGHCzLRHMsfTvM9jXVBQfe6ymHS+jp AMARRssSDRT2K1ZdVVHDn3leff4ZySVG9nPX7lj7oeHj4r31Uqcnfsy1tJjsi4kaIagO UOR5vaHTZEKzK6YygKcM8+FA+0LVCH4tuB4Pn8QaAuGfk0EkUHphrhK+5CWIeOG8igwe +ioSBrt+0G13xKgAIuyuhyrBmSRM9Hi7GW+9Sgj9z/6LnRjaDc4vrBg04Ux385nkUdkV Y0Gg== X-Gm-Message-State: AFq9FYIERx/PEUZN/IF2q5A+n/VwoRqmDdqdEsYpr6200LF8xNekcHZ+ AcZ2dR9ZNN7IhwaC8KBtxPewCg4X1G6TkzNQG3xrZbFwZiBHEURuTASyZO8VeDqHqKY= X-Gm-Gg: AYBFou1LgyOY/WeroW0NcP52pTL0wQ8f1Th73exczvGwakfqHsI2KWC3WVqmCMvfhO8 iVQYH8JkSE/xDmif+2OD6CARHwm3B+XImbhOHWlWlPCCFSMe4vhn8RUWr5hHdTlJ5gF2rswZu3g 7uXztcDGdJAtJB1374tD2rU6LzpVOiyAS5O9rEYo5YJsHQLV5giYlGE8bkV5aOOhLi7FXQsLHRe MLPCx1lzm7o+JWVa5wXP0NL8s8fDV8Qij+iQi0a/P9T/TG24LtBaLladlRSw3M/N9nHf1Vr334Z jsjPMpk3F19jg0Ege+pko3ZBcwrcOQAMVAxH7x2/1giO/lMgo0UY1FEvONkM8iZZb9XyqStWU9v 0qyeUcbRVCnX+DykmjJOzOaf8KAe2YkaKkNf6d8+uyWkIk9vURSFh9Oghbn0PfkK+i4n5/S4fnt wQUnu4uI8EBxJArFdexSW9BGVQpW2ndSyuNKPvaWokN1IoFdmPpfrr9n0XgkGxoMunS/BUzLcNn T0SYN4jT4VUQiB1CshxwyO8Lh+u+7n7aUCkx9ohfjgHWam1WIn+0pslvsyfdAC6sHvdadPNZQ4X o5UP11FToqjCgJxyUI3y+tyqnJetbL/xsAe+oRaK6ohqDhcPysscii+U X-Received: by 2002:a05:6122:e20a:b0:5dc:d0cb:7d80 with SMTP id 71dfb90a1353d-5ec4cc84dd2mr2901038e0c.11.1793284023857; Thu, 29 Oct 2026 07:27:03 -0700 (PDT) Received: from localhost ([144.121.52.163]) by smtp.gmail.com with ESMTPSA id 71dfb90a1353d-5ec4f6ffccfsm5501982e0c.2.2026.10.29.07.27.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2026 07:27:03 -0700 (PDT) From: Ray Strode To: libcamera-devel@lists.libcamera.org Cc: Milan Zamazal , Kieran Bingham Subject: [PATCH] libcamera: software_isp: debayer_egl: Fix texture sampling steps Date: Thu, 29 Oct 2026 10:26:49 -0400 Message-ID: <20261029142649.388275-1-halfline@gmail.com> X-Mailer: git-send-email 2.56.0 MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" From: Ray Strode This commit removes thin horizontal color artifacts caused by the GPU debayer sampling the wrong Bayer rows. The shader samples neighboring Bayer pixels using offsets in normalized texture coordinates. The step denominators currently subtract one from the input byte stride and image height, making the offsets larger than one texel. Scaling can then place a lookup on the wrong side of a texel boundary. A uniform synthetic Bayer image reproduces the lines seen in live GPU captures. The offsets now match the reciprocal texture dimensions: bytes per pixel divided by byte stride horizontally, and one divided by image height vertically. Fixes: f520b29fe9e6 ("libcamera: software_isp: debayer_egl: Add an eGL Debayer class") Signed-off-by: Ray Strode --- src/libcamera/software_isp/debayer_egl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) base-commit: 5670220c89cf772e7302d4e0ef6c716c31c00b46 diff --git a/src/libcamera/software_isp/debayer_egl.cpp b/src/libcamera/software_isp/debayer_egl.cpp index 33933b11..e6df04da 100644 --- a/src/libcamera/software_isp/debayer_egl.cpp +++ b/src/libcamera/software_isp/debayer_egl.cpp @@ -394,8 +394,8 @@ void DebayerEGL::setShaderVariableValues(eGLImage &eglImageIn, const DebayerPara GLfloat firstRed[] = { firstRed_x_, firstRed_y_ }; GLfloat imgSize[] = { (GLfloat)width_, (GLfloat)height_ }; - GLfloat Step[] = { static_cast(bytesPerPixel_) / (inputConfig_.stride - 1), - 1.0f / (height_ - 1) }; + GLfloat Step[] = { static_cast(bytesPerPixel_) / inputConfig_.stride, + 1.0f / height_ }; GLfloat Stride = (GLfloat)width_ / (shaderStridePixels_ / bytesPerPixel_); /* * Scale the output size from the native size the algorithm produces for