From patchwork Wed Nov 18 09:57:31 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 28986 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 1AF1EBDE17 for ; Wed, 18 Nov 2026 09:58:35 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 73ACE6A908; Wed, 18 Nov 2026 10:58:34 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="HwW/D11m"; dkim-atps=neutral Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1B8C96A8C1 for ; Wed, 18 Nov 2026 10:58:14 +0100 (CET) Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-4a68190a2a7so535933f8f.1 for ; Wed, 18 Nov 2026 01:58:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1794995894; x=1795600694; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=n8hJeCScvg+HimevVdFSpwGk3mxw5pJ2z+g/K2h5wo8=; b=HwW/D11mpi7ZlErC0Gc2cAGeCznwpPKVX2T9CBscwJKAGFZ86sx+gRu5tcjvHsIdG+ ZDduo7Vn352zn0zTpbU3/eOI73JyziDdSjWK0QDkeIv+L3eRQgoUI6S91J8HTilxxjkE o+AKnLxk079IzMpgsTiR/ewIpn4SRMudbDvudcQ7L46ricyrBW67dm32EfaFFVV48JmR pOAB92Z5gpHFTMfc2uMx0IWdZiyMwxNHiypbuNPWn2gZl3NqICCVLd3WvEHOV0k5mOA6 HMILraSoFQBQojJ7jSAa5/52nEaKM/rOsc5DKwFSwoSy0ofFOD2zy6kkYs7o6s9URtx0 MmTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794995894; x=1795600694; h=content-transfer-encoding:mime-version:references:in-reply-to :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=n8hJeCScvg+HimevVdFSpwGk3mxw5pJ2z+g/K2h5wo8=; b=zJb9Ffv7rgdwI82dlRdwjR/CJKt4Q1d0xq5H9IB+rSx18T4xQ4Ylmx9zUlce6CgRVe 2iJXG8nryc3VsxevaSGFvXzego1aAQlXsTJJN8QkX3krf6piI0+cgFrVL2ONyyPQDtab P4sbspKIo1w1HTaRow1Mj3dsB1Ri1lmNkcCrAvlq+WBRBP+qBzU7641RDdPH9JX4Y8M0 RP/XFGB0qjziLuuEPDcWeIQ+xH7iRfR+PAipfzKu/K2jLAPPY0YuoFGq5OrFPO0Hdp86 49YxUrmZpYOcnPqVsyj/SPhrFJHzS+6MfmKaI/orbywsefEiN7w7jJZzonjDFeyheEE+ n+8w== X-Gm-Message-State: APuU4Z/fRBAnb+mSogxaZBZ8s0S60q7ohjgLZ6+N5o/E8fzwcvcyPw3J v/whCVC6+41vsTBYXlocY6i19284aGC1IjkCcnIeH98Q1rh2bAFUWOuZ2+jstbji4xbk2FxHQoj QZY3bdOc= X-Gm-Gg: AZFdTZec6XtnyoqRChAvYKTSJNWexVNNfE9WLGt+/Z2CAVw7nD+BNyYMS9ZMrX2D9T8 c/6U+9j186KaGsoyQ6pvm/jNBCN4TuCFGQ7EuJXudRhQfzoUaKmlao8jtHpKZtUoe7JTe6FTxNU Gl1ntaBxLAt2C04LRmzPOyORak0j3HFwinnmX/jkb4j+LeZG3lLRyKYHhMg31WSa6NkDFuEYvYr zi9RB9tosW1ILvsBlywPWeOw7a752aTFtiMkaSIxERuYOCS6hVL5cG0i1nz5oVdhj+Its/kmVCC h9wmU3jQ1A6QYiGxPEUJrf0RbEWPmDDHyasJ83/5YznNnTio0uXsr15ovwawtZnOZk/THOjSrOU P8rBWjgJMjUkCVJVgss3kEZgfMrLHLYi2tmQzQm+WM78QImbu1PMZjwpTrU1yEueFvexyOhH+Oo V/4VD37W8zDKggIlJAMkNIL0H72DqHNMzc2pv4/FywTetb6yq6iD3XCqkp197ZzkF0Iy2a3wT6i 9GmOepW6iObndQszESlVO/BwRiM0tuhbm6G/7mUtm8b/EgAXHCn8PPw0LGevO9+uSHY6IddE233 MnQ1NDQFZChB/u0gRVVdUBDuYwRA/UB9yZwVCGlwnCRCmg== X-Received: by 2002:a05:6000:4616:b0:491:8286:5f0e with SMTP id ffacd0b85a97d-4a63db6f472mr4003095f8f.55.1794995893606; Wed, 18 Nov 2026 01:58:13 -0800 (PST) Received: from inspiron14p-linux ([109.76.187.112]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4a655f9f4a7sm3940871f8f.34.2026.11.18.01.58.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Nov 2026 01:58:13 -0800 (PST) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: rstrode@redhat.com, robert.mader@collabora.com, barnabas.pocze@ideasonboard.com, Ray Strode , Bryan O'Donoghue Subject: [RFC PATCH v2 24/26] libcamera: software_isp: gpu_pipeline_shader_pass_blc_normalise: Fix texture sampling steps Date: Wed, 18 Nov 2026 10:57:31 +0100 Message-ID: <20261118095735.170587-25-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20261118095735.170587-1-bryan.odonoghue@linaro.org> References: <20261118095735.170587-1-bryan.odonoghue@linaro.org> 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 Signed-off-by: Bryan O'Donoghue --- .../software_isp/gpu_pipeline_shader_pass_blc_normalise.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libcamera/software_isp/gpu_pipeline_shader_pass_blc_normalise.cpp b/src/libcamera/software_isp/gpu_pipeline_shader_pass_blc_normalise.cpp index c5c19f85d..cc9969beb 100644 --- a/src/libcamera/software_isp/gpu_pipeline_shader_pass_blc_normalise.cpp +++ b/src/libcamera/software_isp/gpu_pipeline_shader_pass_blc_normalise.cpp @@ -121,8 +121,8 @@ void GpuIspShaderPassBlcNormalise::setShaderVariableValues(eGLImage &eglImageIn, GLfloat firstRed[] = { firstRed_x_, firstRed_y_ }; GLfloat imgSize[] = { (GLfloat)passInputCfg_.size.width, (GLfloat)passInputCfg_.size.height }; - GLfloat Step[] = { static_cast(bytesPerPixel_) / (passInputCfg_.stride - 1), - 1.0f / (passInputCfg_.size.height - 1) }; + GLfloat Step[] = { static_cast(bytesPerPixel_) / (passInputCfg_.stride), + 1.0f / (passInputCfg_.size.height) }; GLfloat Stride = (GLfloat)passInputCfg_.size.width / (shaderStridePixels_ / bytesPerPixel_); /* * Scale input to output size, keeping the aspect ratio and preferring