summaryrefslogtreecommitdiff
path: root/src/ipa/raspberrypi/controller/rpi/contrast.cpp
diff options
context:
space:
mode:
authorNaushir Patuck <naush@raspberrypi.com>2023-02-09 12:47:35 +0000
committerKieran Bingham <kieran.bingham@ideasonboard.com>2023-02-09 13:11:30 +0000
commit6d60f264d1e05bd19640b66bc72bda9f303bf72d (patch)
tree18d98783e0346b315dbeb61ba04af6f12377cb61 /src/ipa/raspberrypi/controller/rpi/contrast.cpp
parente8dd0fdc8321dce4c15b55b895e9efb5181ddb4c (diff)
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>
Diffstat (limited to 'src/ipa/raspberrypi/controller/rpi/contrast.cpp')
-rw-r--r--src/ipa/raspberrypi/controller/rpi/contrast.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/ipa/raspberrypi/controller/rpi/contrast.cpp b/src/ipa/raspberrypi/controller/rpi/contrast.cpp
index 5b37edcb..a4f8c4f0 100644
--- a/src/ipa/raspberrypi/controller/rpi/contrast.cpp
+++ b/src/ipa/raspberrypi/controller/rpi/contrast.cpp
@@ -106,7 +106,7 @@ Pwl computeStretchCurve(Histogram const &histogram,
* bit.
*/
double histLo = histogram.quantile(config.loHistogram) *
- (65536 / NUM_HISTOGRAM_BINS);
+ (65536 / histogram.bins());
double levelLo = config.loLevel * 65536;
LOG(RPiContrast, Debug)
<< "Move histogram point " << histLo << " to " << levelLo;
@@ -119,7 +119,7 @@ Pwl computeStretchCurve(Histogram const &histogram,
* Keep the mid-point (median) in the same place, though, to limit the
* apparent amount of global brightness shift.
*/
- double mid = histogram.quantile(0.5) * (65536 / NUM_HISTOGRAM_BINS);
+ double mid = histogram.quantile(0.5) * (65536 / histogram.bins());
enhance.append(mid, mid);
/*
@@ -127,7 +127,7 @@ Pwl computeStretchCurve(Histogram const &histogram,
* there up.
*/
double histHi = histogram.quantile(config.hiHistogram) *
- (65536 / NUM_HISTOGRAM_BINS);
+ (65536 / histogram.bins());
double levelHi = config.hiLevel * 65536;
LOG(RPiContrast, Debug)
<< "Move histogram point " << histHi << " to " << levelHi;
@@ -158,7 +158,7 @@ Pwl applyManualContrast(Pwl const &gammaCurve, double brightness,
void Contrast::process(StatisticsPtr &stats,
[[maybe_unused]] Metadata *imageMetadata)
{
- Histogram histogram(stats->hist[0].g_hist, NUM_HISTOGRAM_BINS);
+ Histogram &histogram = stats->yHist;
/*
* We look at the histogram and adjust the gamma curve in the following
* ways: 1. Adjust the gamma curve so as to pull the start of the