ipa: raspberrypi: Generalise the autofocus algorithm

Remove any hard-coded assumptions about the target hardware platform
from the autofocus algorithm. Instead, use the "target" string provided
by the camera tuning config and generalised statistics structures to
determing parameters such as grid and region sizes.

Additionally, PDAF statistics are represented by a generalised region
statistics structure to be device agnostic.

These changes also require the autofocus algorithm to initialise
region weights on the first frame's prepare()/process() call rather
than during initialisation.

Signed-off-by: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Tested-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Nick Hollinghurst
2023-03-27 13:20:29 +01:00
committed by Kieran Bingham
parent e51a9f7b94
commit 43f57f26b4
4 changed files with 134 additions and 116 deletions
+12 -9
View File
@@ -2,20 +2,23 @@
/*
* Copyright (C) 2022, Raspberry Pi Ltd
*
* pdaf_data.h - PDAF Metadata; for now this is
* largely based on IMX708's PDAF "Type 1" output.
* pdaf_data.h - PDAF Metadata
*/
#pragma once
#include <stdint.h>
#define PDAF_DATA_ROWS 12
#define PDAF_DATA_COLS 16
#include "region_stats.h"
namespace RPiController {
struct PdafData {
/* Confidence values, in raster order, in arbitrary units */
uint16_t conf[PDAF_DATA_ROWS][PDAF_DATA_COLS];
/* Phase error, in raster order, in s11 Q4 format (S.6.4) */
int16_t phase[PDAF_DATA_ROWS][PDAF_DATA_COLS];
/* Confidence, in arbitrary units */
uint16_t conf;
/* Phase error, in s16 Q4 format (S.11.4) */
int16_t phase;
};
using PdafRegions = RegionStats<PdafData>;
} /* namespace RPiController */