[libcamera-devel,v2,0/4] Move and improve AWB structures
mbox series

Message ID 20210902134353.80920-1-jeanmichel.hautbois@ideasonboard.com
Headers show
Series
  • Move and improve AWB structures
Related show

Message

Jean-Michel Hautbois Sept. 2, 2021, 1:43 p.m. UTC
Patch 1/4 moves the AWB structures to be able to use those from the
ipa::ipu3::algorithms namespace (by AGC at least).

Patch 2/4 renames the stats region structure to make it clear it is an
accumulator structure.

Patch 3/4 and 4/4 are improving the Accumulator structure to have the
same layout as the IPAFrameContext::awb structure. 

Jean-Michel Hautbois (4):
  ipa: ipu3: Move the AWB stats structures
  ipa: ipu3: Rename IspStatsRegion to Accumulator
  ipa: ipu3: Replace Accumulator::uncounted to Accumulator::total
  ipa: ipu3: Change Accumulator structure layout

 src/ipa/ipu3/algorithms/awb.cpp | 58 ++++++++++++++++++++-------------
 src/ipa/ipu3/algorithms/awb.h   | 41 ++++++++++++-----------
 2 files changed, 57 insertions(+), 42 deletions(-)

Comments

Kieran Bingham Sept. 2, 2021, 1:46 p.m. UTC | #1
On 02/09/2021 14:43, Jean-Michel Hautbois wrote:
> Replace uncounted by total as it is clearer on what it contains. It is
> always possible to know how many pixels are not relevant for the
> algorithm by calculating total-counted. The uncounted field was only
> declared and not used.

Why aren't we removing this entirely ?

> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
> ---
>  src/ipa/ipu3/algorithms/awb.cpp | 6 +++---
>  src/ipa/ipu3/algorithms/awb.h   | 2 +-
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/src/ipa/ipu3/algorithms/awb.cpp b/src/ipa/ipu3/algorithms/awb.cpp
> index c5c04a32..061b3610 100644
> --- a/src/ipa/ipu3/algorithms/awb.cpp
> +++ b/src/ipa/ipu3/algorithms/awb.cpp
> @@ -42,8 +42,8 @@ static constexpr uint32_t kMinGreenLevelInZone = 32;
>   * \var Accumulator::counted
>   * \brief Number of relevant regions used to calculate the sums
>   *
> - * \var Accumulator::uncounted
> - * \brief Remaining number of regions in the zone
> + * \var Accumulator::total
> + * \brief Total number of regions in the zone
>   *
>   * \var Accumulator::rSum
>   * \brief Sum of the red values in the zone
> @@ -227,7 +227,7 @@ void Awb::clearAwbStats()
>  		awbStats_[i].rSum = 0;
>  		awbStats_[i].gSum = 0;
>  		awbStats_[i].counted = 0;
> -		awbStats_[i].uncounted = 0;
> +		awbStats_[i].total = 0;
>  	}
>  }
>  
> diff --git a/src/ipa/ipu3/algorithms/awb.h b/src/ipa/ipu3/algorithms/awb.h
> index 6ae934fc..13490b07 100644
> --- a/src/ipa/ipu3/algorithms/awb.h
> +++ b/src/ipa/ipu3/algorithms/awb.h
> @@ -35,7 +35,7 @@ struct Ipu3AwbCell {
>  
>  struct Accumulator {
>  	unsigned int counted;
> -	unsigned int uncounted;
> +	unsigned int total;
>  	unsigned long long rSum;
>  	unsigned long long gSum;
>  	unsigned long long bSum;
>