[3/5] software_isp: debayer_cpu: Group innerloop variables together
diff mbox series

Message ID 20260216190204.106922-4-johannes.goede@oss.qualcomm.com
State New
Headers show
Series
  • software_isp: debayer_cpu: Add multi-threading support
Related show

Commit Message

Hans de Goede Feb. 16, 2026, 7:02 p.m. UTC
Group variables used every pixel together, followed by variables used
every lines and then lastly variables only used every frame.

The idea here is to have all the data used every pixel fit in as few
cachelines as possible.

Benchmarking does not show any differerence before after, possibly
because most of the per pixel lookup tables where already grouped
together.

Despite that this still seems like a good idea.

Signed-off-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
---
 src/libcamera/software_isp/debayer_cpu.h | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

Patch
diff mbox series

diff --git a/src/libcamera/software_isp/debayer_cpu.h b/src/libcamera/software_isp/debayer_cpu.h
index 800b018c..a54418dc 100644
--- a/src/libcamera/software_isp/debayer_cpu.h
+++ b/src/libcamera/software_isp/debayer_cpu.h
@@ -135,6 +135,7 @@  private:
 	};
 	using LookupTable = std::array<uint8_t, kRGBLookupSize>;
 	using CcmLookupTable = std::array<CcmColumn, kRGBLookupSize>;
+	/* Variables used every pixel */
 	LookupTable red_;
 	LookupTable green_;
 	LookupTable blue_;
@@ -143,24 +144,26 @@  private:
 	CcmLookupTable blueCcm_;
 	std::array<double, kGammaLookupSize> gammaTable_;
 	LookupTable gammaLut_;
-	bool ccmEnabled_;
-	DebayerParams params_;
-	SwIspStats statsBuffer_;
+	Rectangle window_;
 
+	/* Variables used every line */
+	SwIspStats statsBuffer_;
 	debayerFn debayer0_;
 	debayerFn debayer1_;
 	debayerFn debayer2_;
 	debayerFn debayer3_;
-	Rectangle window_;
 	std::unique_ptr<SwStatsCpu> stats_;
 	unsigned int lineBufferLength_;
 	unsigned int lineBufferPadding_;
 	unsigned int xShift_; /* Offset of 0/1 applied to window_.x */
 	bool enableInputMemcpy_;
-
 	static constexpr unsigned int kMaxThreads = 4;
 	struct DebayerCpuThreadData threadData_[kMaxThreads];
+
+	/* variables used every frame */
 	unsigned int threadCount_;
+	bool ccmEnabled_;
+	DebayerParams params_;
 };
 
 } /* namespace libcamera */