[libcamera-devel,2/2] ipa: rpi: awb: Add an initialValues method
diff mbox series

Message ID 20231206103839.16607-3-david.plowman@raspberrypi.com
State Accepted
Commit cfb4bee74b6dce3e9c44d3b8dedcd3ffcc11b32b
Headers show
Series
  • IPA initial values for Raspberry Pi
Related show

Commit Message

David Plowman Dec. 6, 2023, 10:38 a.m. UTC
This allows the IPA to get reasonable default colour gains before AWB
has run. This is particularly important on the PiSP platform where
these numbers are helpful in programming the Front End statistics
block in advance.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
---
 src/ipa/rpi/controller/awb_algorithm.h | 1 +
 src/ipa/rpi/controller/rpi/awb.cpp     | 6 ++++++
 src/ipa/rpi/controller/rpi/awb.h       | 1 +
 3 files changed, 8 insertions(+)

Comments

Naushir Patuck Dec. 7, 2023, 10:45 a.m. UTC | #1
Hi David,

Thank you for this work.

On Wed, 6 Dec 2023 at 10:38, David Plowman via libcamera-devel
<libcamera-devel@lists.libcamera.org> wrote:
>
> This allows the IPA to get reasonable default colour gains before AWB
> has run. This is particularly important on the PiSP platform where
> these numbers are helpful in programming the Front End statistics
> block in advance.
>
> Signed-off-by: David Plowman <david.plowman@raspberrypi.com>

Reviewed-by: Naushir Patuck <naush@raspberrypi.com>

> ---
>  src/ipa/rpi/controller/awb_algorithm.h | 1 +
>  src/ipa/rpi/controller/rpi/awb.cpp     | 6 ++++++
>  src/ipa/rpi/controller/rpi/awb.h       | 1 +
>  3 files changed, 8 insertions(+)
>
> diff --git a/src/ipa/rpi/controller/awb_algorithm.h b/src/ipa/rpi/controller/awb_algorithm.h
> index 8462c4db..6009bdac 100644
> --- a/src/ipa/rpi/controller/awb_algorithm.h
> +++ b/src/ipa/rpi/controller/awb_algorithm.h
> @@ -16,6 +16,7 @@ public:
>         AwbAlgorithm(Controller *controller) : Algorithm(controller) {}
>         /* An AWB algorithm must provide the following: */
>         virtual unsigned int getConvergenceFrames() const = 0;
> +       virtual void initialValues(double &gainR, double &gainB) = 0;
>         virtual void setMode(std::string const &modeName) = 0;
>         virtual void setManualGains(double manualR, double manualB) = 0;
>         virtual void enableAuto() = 0;
> diff --git a/src/ipa/rpi/controller/rpi/awb.cpp b/src/ipa/rpi/controller/rpi/awb.cpp
> index 5ae0c2fa..dde5785a 100644
> --- a/src/ipa/rpi/controller/rpi/awb.cpp
> +++ b/src/ipa/rpi/controller/rpi/awb.cpp
> @@ -220,6 +220,12 @@ void Awb::initialise()
>         asyncResults_ = syncResults_;
>  }
>
> +void Awb::initialValues(double &gainR, double &gainB)
> +{
> +       gainR = syncResults_.gainR;
> +       gainB = syncResults_.gainB;
> +}
> +
>  void Awb::disableAuto()
>  {
>         /* Freeze the most recent values, and treat them as manual gains */
> diff --git a/src/ipa/rpi/controller/rpi/awb.h b/src/ipa/rpi/controller/rpi/awb.h
> index e7d49cd8..cde6a62f 100644
> --- a/src/ipa/rpi/controller/rpi/awb.h
> +++ b/src/ipa/rpi/controller/rpi/awb.h
> @@ -95,6 +95,7 @@ public:
>         void initialise() override;
>         int read(const libcamera::YamlObject &params) override;
>         unsigned int getConvergenceFrames() const override;
> +       void initialValues(double &gainR, double &gainB) override;
>         void setMode(std::string const &name) override;
>         void setManualGains(double manualR, double manualB) override;
>         void enableAuto() override;
> --
> 2.39.2
>

Patch
diff mbox series

diff --git a/src/ipa/rpi/controller/awb_algorithm.h b/src/ipa/rpi/controller/awb_algorithm.h
index 8462c4db..6009bdac 100644
--- a/src/ipa/rpi/controller/awb_algorithm.h
+++ b/src/ipa/rpi/controller/awb_algorithm.h
@@ -16,6 +16,7 @@  public:
 	AwbAlgorithm(Controller *controller) : Algorithm(controller) {}
 	/* An AWB algorithm must provide the following: */
 	virtual unsigned int getConvergenceFrames() const = 0;
+	virtual void initialValues(double &gainR, double &gainB) = 0;
 	virtual void setMode(std::string const &modeName) = 0;
 	virtual void setManualGains(double manualR, double manualB) = 0;
 	virtual void enableAuto() = 0;
diff --git a/src/ipa/rpi/controller/rpi/awb.cpp b/src/ipa/rpi/controller/rpi/awb.cpp
index 5ae0c2fa..dde5785a 100644
--- a/src/ipa/rpi/controller/rpi/awb.cpp
+++ b/src/ipa/rpi/controller/rpi/awb.cpp
@@ -220,6 +220,12 @@  void Awb::initialise()
 	asyncResults_ = syncResults_;
 }
 
+void Awb::initialValues(double &gainR, double &gainB)
+{
+	gainR = syncResults_.gainR;
+	gainB = syncResults_.gainB;
+}
+
 void Awb::disableAuto()
 {
 	/* Freeze the most recent values, and treat them as manual gains */
diff --git a/src/ipa/rpi/controller/rpi/awb.h b/src/ipa/rpi/controller/rpi/awb.h
index e7d49cd8..cde6a62f 100644
--- a/src/ipa/rpi/controller/rpi/awb.h
+++ b/src/ipa/rpi/controller/rpi/awb.h
@@ -95,6 +95,7 @@  public:
 	void initialise() override;
 	int read(const libcamera::YamlObject &params) override;
 	unsigned int getConvergenceFrames() const override;
+	void initialValues(double &gainR, double &gainB) override;
 	void setMode(std::string const &name) override;
 	void setManualGains(double manualR, double manualB) override;
 	void enableAuto() override;