[libcamera-devel,19/22] ipa: ipu3: awb: Add support for color temperature
diff mbox series

Message ID 20211108131350.130665-20-jeanmichel.hautbois@ideasonboard.com
State Superseded
Headers show
Series
  • IPA: IPU3: Introduce per-frame controls
Related show

Commit Message

Jean-Michel Hautbois Nov. 8, 2021, 1:13 p.m. UTC
The AWB estimates the color temperature, but it is not used at all. It
can be useful for debug purpose at least, but also for lux estimation
later, to be able to know the temperature estimated for a given frame.

Add a new member to the IPAFrameContext::awb for this purpose, and
update the value in AWB.

Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
---
 src/ipa/ipu3/algorithms/awb.cpp | 1 +
 src/ipa/ipu3/ipa_context.cpp    | 3 +++
 src/ipa/ipu3/ipa_context.h      | 2 ++
 3 files changed, 6 insertions(+)

Comments

Kieran Bingham Nov. 8, 2021, 2:28 p.m. UTC | #1
Quoting Jean-Michel Hautbois (2021-11-08 13:13:47)
> The AWB estimates the color temperature, but it is not used at all. It
> can be useful for debug purpose at least, but also for lux estimation
> later, to be able to know the temperature estimated for a given frame.
> 
> Add a new member to the IPAFrameContext::awb for this purpose, and
> update the value in AWB.
> 
> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
> ---
>  src/ipa/ipu3/algorithms/awb.cpp | 1 +
>  src/ipa/ipu3/ipa_context.cpp    | 3 +++
>  src/ipa/ipu3/ipa_context.h      | 2 ++
>  3 files changed, 6 insertions(+)
> 
> diff --git a/src/ipa/ipu3/algorithms/awb.cpp b/src/ipa/ipu3/algorithms/awb.cpp
> index bd55d377..a3a5ac66 100644
> --- a/src/ipa/ipu3/algorithms/awb.cpp
> +++ b/src/ipa/ipu3/algorithms/awb.cpp
> @@ -385,6 +385,7 @@ void Awb::process(IPAContext &context, const ipu3_uapi_stats_3a *stats)
>         context.frameContext->awb.gains.blue = asyncResults_.blueGain;
>         context.frameContext->awb.gains.green = asyncResults_.greenGain;
>         context.frameContext->awb.gains.red = asyncResults_.redGain;
> +       context.frameContext->awb.temperatureK = asyncResults_.temperatureK;
>  }
>  
>  constexpr uint16_t Awb::threshold(float value)
> diff --git a/src/ipa/ipu3/ipa_context.cpp b/src/ipa/ipu3/ipa_context.cpp
> index ea92be77..9c0407df 100644
> --- a/src/ipa/ipu3/ipa_context.cpp
> +++ b/src/ipa/ipu3/ipa_context.cpp
> @@ -117,6 +117,9 @@ namespace libcamera::ipa::ipu3 {
>   *
>   * \var IPAFrameContext::awb.gains.blue
>   * \brief White balance gain for B channel
> + *
> + * \var IPAFrameContext::awb.temperatureK
> + * \brief Color temperature estimated

I'd write this as:

 \brief Estimated color temperature

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

>   */
>  
>  /**
> diff --git a/src/ipa/ipu3/ipa_context.h b/src/ipa/ipu3/ipa_context.h
> index 69780915..3566dea1 100644
> --- a/src/ipa/ipu3/ipa_context.h
> +++ b/src/ipa/ipu3/ipa_context.h
> @@ -45,6 +45,8 @@ struct IPAFrameContext {
>                         double green;
>                         double blue;
>                 } gains;
> +
> +               double temperatureK;
>         } awb;
>  
>         struct {
> -- 
> 2.32.0
>

Patch
diff mbox series

diff --git a/src/ipa/ipu3/algorithms/awb.cpp b/src/ipa/ipu3/algorithms/awb.cpp
index bd55d377..a3a5ac66 100644
--- a/src/ipa/ipu3/algorithms/awb.cpp
+++ b/src/ipa/ipu3/algorithms/awb.cpp
@@ -385,6 +385,7 @@  void Awb::process(IPAContext &context, const ipu3_uapi_stats_3a *stats)
 	context.frameContext->awb.gains.blue = asyncResults_.blueGain;
 	context.frameContext->awb.gains.green = asyncResults_.greenGain;
 	context.frameContext->awb.gains.red = asyncResults_.redGain;
+	context.frameContext->awb.temperatureK = asyncResults_.temperatureK;
 }
 
 constexpr uint16_t Awb::threshold(float value)
diff --git a/src/ipa/ipu3/ipa_context.cpp b/src/ipa/ipu3/ipa_context.cpp
index ea92be77..9c0407df 100644
--- a/src/ipa/ipu3/ipa_context.cpp
+++ b/src/ipa/ipu3/ipa_context.cpp
@@ -117,6 +117,9 @@  namespace libcamera::ipa::ipu3 {
  *
  * \var IPAFrameContext::awb.gains.blue
  * \brief White balance gain for B channel
+ *
+ * \var IPAFrameContext::awb.temperatureK
+ * \brief Color temperature estimated
  */
 
 /**
diff --git a/src/ipa/ipu3/ipa_context.h b/src/ipa/ipu3/ipa_context.h
index 69780915..3566dea1 100644
--- a/src/ipa/ipu3/ipa_context.h
+++ b/src/ipa/ipu3/ipa_context.h
@@ -45,6 +45,8 @@  struct IPAFrameContext {
 			double green;
 			double blue;
 		} gains;
+
+		double temperatureK;
 	} awb;
 
 	struct {