ipa: rkisp1: agc: Add a histogram-based gain

As for the IPU3, we can estimate the histogram of the luminance. The
RkISP1 can estimate multiple ones, the R, G and B ones, the Y only one
and a combination of RGB. The one we are interested by in AGC is the Y
histogram.

Use the hardware revision to determine the number of bins of the
produced histogram.

Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Tested-by: Peter Griffin <peter.griffin@linaro.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
Jean-Michel Hautbois 2022-02-24 12:33:46 +01:00
parent 88c69f8808
commit 8917c9e7ba
4 changed files with 86 additions and 15 deletions

View file

@ -1,6 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2021, Ideas On Board
* Copyright (C) 2021-2022, Ideas On Board
*
* agc.h - RkISP1 AGC/AEC mean-based control algorithm
*/
@ -32,13 +32,15 @@ public:
void process(IPAContext &context, const rkisp1_stat_buffer *stats) override;
private:
void computeExposure(IPAContext &Context, double yGain);
void computeExposure(IPAContext &Context, double yGain, double iqMeanGain);
utils::Duration filterExposure(utils::Duration exposureValue);
double estimateLuminance(const rkisp1_cif_isp_ae_stat *ae, double gain);
double measureBrightness(const rkisp1_cif_isp_hist_stat *hist) const;
uint64_t frameCount_;
uint32_t numCells_;
uint32_t numHistBins_;
utils::Duration filteredExposure_;
};