ipa: raspberrypi: Use the generic statistics structure in the algorithms

Repurpose the StatisticsPtr type from being a shared_ptr<bcm2835_isp_stats> to
shared_ptr<RPiController::Statistics>. This removes any hardware specific header
files and structures from the algorithms source code.

Add a new function in the Raspberry Pi IPA to populate the generic statistics
structure from the values provided by the hardware in the bcm2835_isp_stats
structure.

Update the Lux, AWB, AGC, ALSC, Contrast, and Focus algorithms to use the
generic statistics structure appropriately in their calculations. Additionally,
remove references to any hardware specific headers and defines in these source
files.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Tested-by: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Naushir Patuck 2023-02-09 12:47:35 +00:00 committed by Kieran Bingham
parent e8dd0fdc83
commit 6d60f264d1
15 changed files with 121 additions and 87 deletions

View file

@ -31,10 +31,9 @@ char const *Focus::name() const
void Focus::process(StatisticsPtr &stats, Metadata *imageMetadata)
{
FocusStatus status;
unsigned int i;
for (i = 0; i < FOCUS_REGIONS; i++)
status.focusMeasures[i] = stats->focus_stats[i].contrast_val[1][1] / 1000;
status.num = i;
for (unsigned int i = 0; i < stats->focusRegions.numRegions(); i++)
status.focusMeasures[i] = stats->focusRegions.get(i).val;
status.num = stats->focusRegions.numRegions();
imageMetadata->set("focus.status", status);
LOG(RPiFocus, Debug)