[v2,37/37] libcamera: software_isp: Reduce statistics image area
diff mbox series

Message ID 20250824-b4-v0-5-2-gpuisp-v2-a-v2-37-96f4576c814e@linaro.org
State New
Headers show
Series
  • Add GLES 2.0 GPUISP to libcamera
Related show

Commit Message

Bryan O'Donoghue Aug. 24, 2025, 12:48 a.m. UTC
From: Milan Zamazal <mzamazal@redhat.com>

The statistics in software ISP is computed basically over the whole
image area, although only on part of the pixels.  It is not necessary to
cover the whole image area, it's sufficient to compute the statistics
let's say over the central area of 2/3 of the image width and height,
which should be both sufficient and faster.  The speedup is not that
important with the CPU implementation but it may save CPU work
more noticeably with GPU debayering implementation.

Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
 src/libcamera/software_isp/debayer_cpu.cpp | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Patch
diff mbox series

diff --git a/src/libcamera/software_isp/debayer_cpu.cpp b/src/libcamera/software_isp/debayer_cpu.cpp
index 7bd1fc39266f651845cc7a87ac991aa67c36c094..b19d89c1cae04104d6d8377555b306128e700f62 100644
--- a/src/libcamera/software_isp/debayer_cpu.cpp
+++ b/src/libcamera/software_isp/debayer_cpu.cpp
@@ -526,8 +526,13 @@  int DebayerCpu::configure(const StreamConfiguration &inputCfg,
 	window_.width = outputCfg.size.width;
 	window_.height = outputCfg.size.height;
 
-	/* Don't pass x,y since process() already adjusts src before passing it */
-	stats_->setWindow(Rectangle(window_.size()));
+	/*
+	 * Don't pass x,y from window_ since process() already adjusts for it.
+	 * But crop the window to 2/3 of its width and height for speedup.
+	 * The speedup is more important with GPU than with CPU ISP; we want the
+	 * same implementation on both.
+	 */
+	stats_->setWindow((window_.size() * 2 / 3).centeredTo(window_.center()));
 
 	/* pad with patternSize.Width on both left and right side */
 	lineBufferPadding_ = inputConfig_.patternSize.width * inputConfig_.bpp / 8;