[libcamera-devel,07/11] ipu3: ipa: agc: Determine cell size from ipu3_uapi_awb_set_item
diff mbox series

Message ID 20210913145810.66515-8-jeanmichel.hautbois@ideasonboard.com
State Changes Requested
Headers show
Series
  • Document all the IPU3 IPA classes
Related show

Commit Message

Jean-Michel Hautbois Sept. 13, 2021, 2:58 p.m. UTC
The kCellSize was hardcoded from the size determined by examining the
statistics from the ImgU.  The cell definition is now described as a
struct. Utilise the struct size to express the cell size.

Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
---
 src/ipa/ipu3/algorithms/agc.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Laurent Pinchart Sept. 14, 2021, 4:08 a.m. UTC | #1
Hi Jean-Michel,

Thank you for the patch.

On Mon, Sep 13, 2021 at 04:58:06PM +0200, Jean-Michel Hautbois wrote:
> The kCellSize was hardcoded from the size determined by examining the
> statistics from the ImgU.  The cell definition is now described as a
> struct. Utilise the struct size to express the cell size.
> 
> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
> ---
>  src/ipa/ipu3/algorithms/agc.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/ipa/ipu3/algorithms/agc.cpp b/src/ipa/ipu3/algorithms/agc.cpp
> index 8740dcdf..e085599a 100644
> --- a/src/ipa/ipu3/algorithms/agc.cpp
> +++ b/src/ipa/ipu3/algorithms/agc.cpp
> @@ -48,7 +48,7 @@ static constexpr uint32_t knumHistogramBins = 256;
>  static constexpr double kEvGainTarget = 0.5;
>  
>  /* A cell is 8 bytes and contains averages for RGB values and saturation ratio */
> -static constexpr uint8_t kCellSize = 8;
> +static constexpr uint8_t kCellSize = sizeof(ipu3_uapi_awb_set_item);

And now I'm horrified that I've reviewed commit
4d57a806422a46038ee3d0896162d15f931ef109 without noticing how badly it
broke AGC :-(

>  
>  Agc::Agc()
>  	: frameCount_(0), lastFrame_(0), iqMean_(0.0), lineDuration_(0s),

Patch
diff mbox series

diff --git a/src/ipa/ipu3/algorithms/agc.cpp b/src/ipa/ipu3/algorithms/agc.cpp
index 8740dcdf..e085599a 100644
--- a/src/ipa/ipu3/algorithms/agc.cpp
+++ b/src/ipa/ipu3/algorithms/agc.cpp
@@ -48,7 +48,7 @@  static constexpr uint32_t knumHistogramBins = 256;
 static constexpr double kEvGainTarget = 0.5;
 
 /* A cell is 8 bytes and contains averages for RGB values and saturation ratio */
-static constexpr uint8_t kCellSize = 8;
+static constexpr uint8_t kCellSize = sizeof(ipu3_uapi_awb_set_item);
 
 Agc::Agc()
 	: frameCount_(0), lastFrame_(0), iqMean_(0.0), lineDuration_(0s),