From 09a221eb47128146c5f7f88ff3f71cb8bcfe3228 Mon Sep 17 00:00:00 2001 From: Jean-Michel Hautbois Date: Wed, 22 Sep 2021 23:29:42 +0200 Subject: ipa: ipu3: Replace ipa::ipu3::algorithms::Ipu3AwbCell The intel-ipu3.h public interface from the kernel does not define how to parse the statistics for a cell. This had to be identified by a process of reverse engineering, and later identifying the structures from [0] leading to our custom definition of struct Ipu3AwbCell. [0] https://chromium.googlesource.com/chromiumos/platform/arc-camera/+/refs/heads/master/hal/intel/include/ia_imaging/awb_public.h To improve the kernel interface, a proposal has been made to the linux-kernel [1] to incorporate the memory layout for each cell into the intel-ipu3 header directly. [1] https://lore.kernel.org/linux-media/20211005202019.253353-1-jeanmichel.hautbois@ideasonboard.com/ Update our local copy of the intel-ipu3.h to match the proposal and change the AGC and AWB algorithms to reference that structure directly, allowing us to remove the deprecated custom Ipu3AwbCell definition. Signed-off-by: Jean-Michel Hautbois Reviewed-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- src/ipa/ipu3/algorithms/agc.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src/ipa/ipu3/algorithms/agc.cpp') diff --git a/src/ipa/ipu3/algorithms/agc.cpp b/src/ipa/ipu3/algorithms/agc.cpp index 4f0d16c6..5eafe82c 100644 --- a/src/ipa/ipu3/algorithms/agc.cpp +++ b/src/ipa/ipu3/algorithms/agc.cpp @@ -6,7 +6,6 @@ */ #include "agc.h" -#include "awb.h" #include #include @@ -73,17 +72,16 @@ void Agc::processBrightness(const ipu3_uapi_stats_3a *stats, for (unsigned int cellY = 0; cellY < grid.height; cellY++) { for (unsigned int cellX = 0; cellX < grid.width; cellX++) { - uint32_t cellPosition = (cellY * stride_ + cellX) - * sizeof(Ipu3AwbCell); + uint32_t cellPosition = cellY * stride_ + cellX; - const Ipu3AwbCell *cell = - reinterpret_cast( + const ipu3_uapi_awb_set_item *cell = + reinterpret_cast( &stats->awb_raw_buffer.meta_data[cellPosition] ); - if (cell->satRatio == 0) { - uint8_t gr = cell->greenRedAvg; - uint8_t gb = cell->greenBlueAvg; + if (cell->sat_ratio == 0) { + uint8_t gr = cell->Gr_avg; + uint8_t gb = cell->Gb_avg; hist[(gr + gb) / 2]++; } } -- cgit v1.2.1