[v2,08/37] libcamera: software_isp: Move Bayer params init from DebayerCpu to Debayer
diff mbox series

Message ID 20250824-b4-v0-5-2-gpuisp-v2-a-v2-8-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
Move the initialisation of Bayer params and CCM to a new constructor in the
Debayer class.

Ensure we call the base class constructor from DebayerCpu's constructor in
the expected constructor order Debayer then DebayerCpu.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 src/libcamera/software_isp/debayer.cpp     | 11 +++++++++++
 src/libcamera/software_isp/debayer.h       |  1 +
 src/libcamera/software_isp/debayer_cpu.cpp |  8 --------
 3 files changed, 12 insertions(+), 8 deletions(-)

Patch
diff mbox series

diff --git a/src/libcamera/software_isp/debayer.cpp b/src/libcamera/software_isp/debayer.cpp
index e9e18c488489c776ee93886184113406f39e6685..29fdcbbfd4eba4a23c520b22784bf003f22a93f4 100644
--- a/src/libcamera/software_isp/debayer.cpp
+++ b/src/libcamera/software_isp/debayer.cpp
@@ -103,6 +103,17 @@  namespace libcamera {
 
 LOG_DEFINE_CATEGORY(Debayer)
 
+Debayer::Debayer()
+{
+	/* Initialize color lookup tables */
+	for (unsigned int i = 0; i < DebayerParams::kRGBLookupSize; i++) {
+		red_[i] = green_[i] = blue_[i] = i;
+		redCcm_[i] = { static_cast<int16_t>(i), 0, 0 };
+		greenCcm_[i] = { 0, static_cast<int16_t>(i), 0 };
+		blueCcm_[i] = { 0, 0, static_cast<int16_t>(i) };
+	}
+}
+
 Debayer::~Debayer()
 {
 }
diff --git a/src/libcamera/software_isp/debayer.h b/src/libcamera/software_isp/debayer.h
index 45da822a2173070fd1b99bbfed4c0fdeaa1a88c6..01b6e916f2a7199c592abd8a57ef549eaf388a8b 100644
--- a/src/libcamera/software_isp/debayer.h
+++ b/src/libcamera/software_isp/debayer.h
@@ -32,6 +32,7 @@  LOG_DECLARE_CATEGORY(Debayer)
 class Debayer : public Object
 {
 public:
+	Debayer();
 	virtual ~Debayer() = 0;
 
 	virtual int configure(const StreamConfiguration &inputCfg,
diff --git a/src/libcamera/software_isp/debayer_cpu.cpp b/src/libcamera/software_isp/debayer_cpu.cpp
index 8d30bf4a2115137939f01378e8af594170d4d459..408ce2baa5e8a23902cbf0ca2b9ea87e73b4e882 100644
--- a/src/libcamera/software_isp/debayer_cpu.cpp
+++ b/src/libcamera/software_isp/debayer_cpu.cpp
@@ -51,14 +51,6 @@  DebayerCpu::DebayerCpu(std::unique_ptr<SwStatsCpu> stats)
 	 * future.
 	 */
 	enableInputMemcpy_ = true;
-
-	/* Initialize color lookup tables */
-	for (unsigned int i = 0; i < DebayerParams::kRGBLookupSize; i++) {
-		red_[i] = green_[i] = blue_[i] = i;
-		redCcm_[i] = { static_cast<int16_t>(i), 0, 0 };
-		greenCcm_[i] = { 0, static_cast<int16_t>(i), 0 };
-		blueCcm_[i] = { 0, 0, static_cast<int16_t>(i) };
-	}
 }
 
 DebayerCpu::~DebayerCpu() = default;