libcamera: ipa: raspberrypi: Allow SwitchMode method to return camera settings

This commit adds a Metadata parameter to the SwitchMode method
enabling it to return camera and other settings to the caller
(usually the configure method, just after the camera mode has been
selected).

In future this will allow the Raspberry Pi IPAs to take those settings
(such as exposure and analogue gain) and program them directly into
the camera or ISP before the camera is even started.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
David Plowman 2020-06-18 12:12:35 +01:00 committed by Laurent Pinchart
parent 1023107b64
commit ff291b3c15
11 changed files with 20 additions and 12 deletions

View file

@ -173,8 +173,10 @@ void Alsc::Initialise()
lambda_r_[i] = lambda_b_[i] = 1.0;
}
void Alsc::SwitchMode(CameraMode const &camera_mode)
void Alsc::SwitchMode(CameraMode const &camera_mode, Metadata *metadata)
{
(void)metadata;
// There's a bit of a question what we should do if the "crop" of the
// camera mode has changed. Any calculation currently in flight would
// not be useful to the new mode, so arguably we should abort it, and

View file

@ -50,7 +50,7 @@ public:
~Alsc();
char const *Name() const override;
void Initialise() override;
void SwitchMode(CameraMode const &camera_mode) override;
void SwitchMode(CameraMode const &camera_mode, Metadata *metadata) override;
void Read(boost::property_tree::ptree const &params) override;
void Prepare(Metadata *image_metadata) override;
void Process(StatisticsPtr &stats, Metadata *image_metadata) override;

View file

@ -27,8 +27,10 @@ char const *Noise::Name() const
return NAME;
}
void Noise::SwitchMode(CameraMode const &camera_mode)
void Noise::SwitchMode(CameraMode const &camera_mode, Metadata *metadata)
{
(void)metadata;
// For example, we would expect a 2x2 binned mode to have a "noise
// factor" of sqrt(2x2) = 2. (can't be less than one, right?)
mode_factor_ = std::max(1.0, camera_mode.noise_factor);

View file

@ -18,7 +18,7 @@ class Noise : public Algorithm
public:
Noise(Controller *controller);
char const *Name() const override;
void SwitchMode(CameraMode const &camera_mode) override;
void SwitchMode(CameraMode const &camera_mode, Metadata *metadata) override;
void Read(boost::property_tree::ptree const &params) override;
void Prepare(Metadata *image_metadata) override;

View file

@ -26,8 +26,10 @@ char const *Sharpen::Name() const
return NAME;
}
void Sharpen::SwitchMode(CameraMode const &camera_mode)
void Sharpen::SwitchMode(CameraMode const &camera_mode, Metadata *metadata)
{
(void)metadata;
// can't be less than one, right?
mode_factor_ = std::max(1.0, camera_mode.noise_factor);
}

View file

@ -18,7 +18,7 @@ class Sharpen : public Algorithm
public:
Sharpen(Controller *controller);
char const *Name() const override;
void SwitchMode(CameraMode const &camera_mode) override;
void SwitchMode(CameraMode const &camera_mode, Metadata *metadata) override;
void Read(boost::property_tree::ptree const &params) override;
void Prepare(Metadata *image_metadata) override;