[RFC,v2,24/26] libcamera: software_isp: gpu_pipeline_shader_pass_blc_normalise: Fix texture sampling steps
diff mbox series

Message ID 20261118095735.170587-25-bryan.odonoghue@linaro.org
State New
Headers show
Series
  • gpuisp multipass + fixes
Related show

Commit Message

Bryan O'Donoghue Nov. 18, 2026, 9:57 a.m. UTC
From: Ray Strode <halfline@gmail.com>

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 <rstrode@redhat.com>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 .../software_isp/gpu_pipeline_shader_pass_blc_normalise.cpp   | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch
diff mbox series

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<float>(bytesPerPixel_) / (passInputCfg_.stride - 1),
-			   1.0f / (passInputCfg_.size.height - 1) };
+	GLfloat Step[] = { static_cast<float>(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