[PATCH 16/27] libcamera: software_isp: Move param select code to Debayer base class
Bryan O'Donoghue
bryan.odonoghue at linaro.org
Tue Apr 22 23:59:09 CEST 2025
Move the parameter selection code into the Debayer base class in-order to
facilitate reuse of the lookup tables in the eGL shaders.
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue at linaro.org>
---
src/libcamera/software_isp/debayer.cpp | 27 ++++++++++++++++++++++
src/libcamera/software_isp/debayer.h | 5 ++++
src/libcamera/software_isp/debayer_cpu.cpp | 19 +--------------
3 files changed, 33 insertions(+), 18 deletions(-)
diff --git a/src/libcamera/software_isp/debayer.cpp b/src/libcamera/software_isp/debayer.cpp
index e9e18c48..3d883b28 100644
--- a/src/libcamera/software_isp/debayer.cpp
+++ b/src/libcamera/software_isp/debayer.cpp
@@ -176,4 +176,31 @@ Debayer::~Debayer()
* \brief Signals when the output buffer is ready
*/
+/**
+ * \fn void Debayer::setParams(DebayerParams ¶ms)
+ * \brief Select the bayer params to use for the next frame debayer
+ * \param[in] params The parameters to be used in debayering
+ */
+void Debayer::setParams(DebayerParams ¶ms)
+{
+ green_ = params.green;
+ greenCcm_ = params.greenCcm;
+ if (swapRedBlueGains_) {
+ red_ = params.blue;
+ blue_ = params.red;
+ redCcm_ = params.blueCcm;
+ blueCcm_ = params.redCcm;
+ for (unsigned int i = 0; i < 256; i++) {
+ std::swap(redCcm_[i].r, redCcm_[i].b);
+ std::swap(blueCcm_[i].r, blueCcm_[i].b);
+ }
+ } else {
+ red_ = params.red;
+ blue_ = params.blue;
+ redCcm_ = params.redCcm;
+ blueCcm_ = params.blueCcm;
+ }
+ gammaLut_ = params.gammaLut;
+}
+
} /* namespace libcamera */
diff --git a/src/libcamera/software_isp/debayer.h b/src/libcamera/software_isp/debayer.h
index dd26b9d8..9cebcbe8 100644
--- a/src/libcamera/software_isp/debayer.h
+++ b/src/libcamera/software_isp/debayer.h
@@ -82,6 +82,11 @@ public:
private:
virtual Size patternSize(PixelFormat inputFormat) = 0;
+
+protected:
+
+ void setParams(DebayerParams ¶ms);
+
};
} /* namespace libcamera */
diff --git a/src/libcamera/software_isp/debayer_cpu.cpp b/src/libcamera/software_isp/debayer_cpu.cpp
index 8d30bf4a..baec4799 100644
--- a/src/libcamera/software_isp/debayer_cpu.cpp
+++ b/src/libcamera/software_isp/debayer_cpu.cpp
@@ -754,24 +754,7 @@ void DebayerCpu::process(uint32_t frame, FrameBuffer *input, FrameBuffer *output
for (const FrameBuffer::Plane &plane : output->planes())
dmaSyncers.emplace_back(plane.fd, DmaSyncer::SyncType::Write);
- green_ = params.green;
- greenCcm_ = params.greenCcm;
- if (swapRedBlueGains_) {
- red_ = params.blue;
- blue_ = params.red;
- redCcm_ = params.blueCcm;
- blueCcm_ = params.redCcm;
- for (unsigned int i = 0; i < 256; i++) {
- std::swap(redCcm_[i].r, redCcm_[i].b);
- std::swap(blueCcm_[i].r, blueCcm_[i].b);
- }
- } else {
- red_ = params.red;
- blue_ = params.blue;
- redCcm_ = params.redCcm;
- blueCcm_ = params.blueCcm;
- }
- gammaLut_ = params.gammaLut;
+ setParams(params);
/* Copy metadata from the input buffer */
FrameMetadata &metadata = output->_d()->metadata();
--
2.49.0
More information about the libcamera-devel
mailing list