libcamera: software_isp: Move param select code to Debayer base class

Move the parameter selection code into the Debayer base class in-order to
facilitate reuse of the lookup tables in the eGL shaders.

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Bryan O'Donoghue
2025-12-11 23:22:36 +00:00
committed by Kieran Bingham
parent cafb39b257
commit e3c74bbc89
3 changed files with 32 additions and 19 deletions

View File

@@ -336,4 +336,32 @@ Debayer::~Debayer()
* debayer processing.
*/
/**
* \fn void Debayer::setParams(DebayerParams &params)
* \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 &params)
{
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(greenCcm_[i].r, greenCcm_[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 */

View File

@@ -83,6 +83,9 @@ public:
private:
virtual Size patternSize(PixelFormat inputFormat) = 0;
protected:
void setParams(DebayerParams &params);
};
} /* namespace libcamera */

View File

@@ -758,25 +758,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(greenCcm_[i].r, greenCcm_[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();