ipa: rpi: pisp: Allow an initial decompand curve to be set on the FE

In the current code, decompand will only set a curve in the prepare
phase, which will only run after 1-2 frames pass through the FE. This
is fixed by adding an initialValues() member function to the decompand
algorithm, which will be called in the IPA before we start the hardware
streaming.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Tested-by: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Naushir Patuck
2025-10-08 11:36:40 +01:00
committed by Kieran Bingham
parent 413f03a738
commit b320b20db7
4 changed files with 26 additions and 0 deletions
@@ -19,6 +19,8 @@ public:
: Algorithm(controller)
{
}
/* A decompand algorithm must provide the following: */
virtual void initialValues(libcamera::ipa::Pwl &decompandCurve) = 0;
};
} /* namespace RPiController */
+8
View File
@@ -39,6 +39,14 @@ void Decompand::switchMode(CameraMode const &cameraMode,
mode_ = cameraMode;
}
void Decompand::initialValues(libcamera::ipa::Pwl &decompandCurve)
{
if (config_.bitdepth == 0 || mode_.bitdepth == config_.bitdepth) {
decompandCurve = config_.decompandCurve;
} else
decompandCurve = {};
}
void Decompand::prepare(Metadata *imageMetadata)
{
DecompandStatus decompandStatus;
+1
View File
@@ -20,6 +20,7 @@ public:
int read(const libcamera::YamlObject &params) override;
void initialise() override;
void switchMode(CameraMode const &cameraMode, Metadata *metadata) override;
void initialValues(libcamera::ipa::Pwl &decompandCurve) override;
void prepare(Metadata *imageMetadata) override;
private:
+15
View File
@@ -32,6 +32,7 @@
#include "controller/cac_status.h"
#include "controller/ccm_status.h"
#include "controller/contrast_status.h"
#include "controller/decompand_algorithm.h"
#include "controller/decompand_status.h"
#include "controller/denoise_algorithm.h"
#include "controller/denoise_status.h"
@@ -335,6 +336,20 @@ int32_t IpaPiSP::platformStart([[maybe_unused]] const ControlList &controls,
/* Cause the stitch block to be reset correctly. */
lastStitchHdrStatus_ = HdrStatus();
/* Setup a default decompand curve on startup if needed. */
RPiController::DecompandAlgorithm *decompand = dynamic_cast<RPiController::DecompandAlgorithm *>(
controller_.getAlgorithm("decompand"));
if (decompand) {
std::scoped_lock<FrontEnd> l(*fe_);
pisp_fe_global_config feGlobal;
DecompandStatus decompandStatus;
fe_->GetGlobal(feGlobal);
decompand->initialValues(decompandStatus.decompandCurve);
applyDecompand(&decompandStatus, feGlobal);
fe_->SetGlobal(feGlobal);
}
return 0;
}