libcamera: software_isp: Move Bayer parans init from DebayerCpu to Debayer

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>
This commit is contained in:
Bryan O'Donoghue 2025-04-29 12:49:49 +01:00
parent 831a7fefa9
commit 3c0a21fd30
3 changed files with 13 additions and 9 deletions

View file

@ -103,6 +103,17 @@ namespace libcamera {
LOG_DEFINE_CATEGORY(Debayer) 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() Debayer::~Debayer()
{ {
} }

View file

@ -32,6 +32,7 @@ LOG_DECLARE_CATEGORY(Debayer)
class Debayer : public Object class Debayer : public Object
{ {
public: public:
Debayer();
virtual ~Debayer() = 0; virtual ~Debayer() = 0;
virtual int configure(const StreamConfiguration &inputCfg, virtual int configure(const StreamConfiguration &inputCfg,

View file

@ -40,7 +40,7 @@ namespace libcamera {
* \param[in] stats Pointer to the stats object to use * \param[in] stats Pointer to the stats object to use
*/ */
DebayerCpu::DebayerCpu(std::unique_ptr<SwStatsCpu> stats) DebayerCpu::DebayerCpu(std::unique_ptr<SwStatsCpu> stats)
: stats_(std::move(stats)) : Debayer(), stats_(std::move(stats))
{ {
/* /*
* Reading from uncached buffers may be very slow. * Reading from uncached buffers may be very slow.
@ -51,14 +51,6 @@ DebayerCpu::DebayerCpu(std::unique_ptr<SwStatsCpu> stats)
* future. * future.
*/ */
enableInputMemcpy_ = true; 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; DebayerCpu::~DebayerCpu() = default;