ipa: ipu3: agc: Rename exposure values properly
The exposure value is filtered in filterExposure() using the currentExposure_ and setting a prevExposure_ variable. This is misnamed as it is not the previous exposure, but a filtered value. Rename it accordingly. Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
parent
fac6734a4f
commit
02686a052a
2 changed files with 16 additions and 16 deletions
|
@ -49,7 +49,7 @@ static constexpr double kEvGainTarget = 0.5;
|
||||||
|
|
||||||
Agc::Agc()
|
Agc::Agc()
|
||||||
: frameCount_(0), lastFrame_(0), iqMean_(0.0), lineDuration_(0s),
|
: frameCount_(0), lastFrame_(0), iqMean_(0.0), lineDuration_(0s),
|
||||||
maxExposureTime_(0s), prevExposure_(0s), prevExposureNoDg_(0s),
|
maxExposureTime_(0s), filteredExposure_(0s), filteredExposureNoDg_(0s),
|
||||||
currentExposure_(0s), currentExposureNoDg_(0s)
|
currentExposure_(0s), currentExposureNoDg_(0s)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -100,24 +100,24 @@ void Agc::processBrightness(const ipu3_uapi_stats_3a *stats,
|
||||||
void Agc::filterExposure()
|
void Agc::filterExposure()
|
||||||
{
|
{
|
||||||
double speed = 0.2;
|
double speed = 0.2;
|
||||||
if (prevExposure_ == 0s) {
|
if (filteredExposure_ == 0s) {
|
||||||
/* DG stands for digital gain.*/
|
/* DG stands for digital gain.*/
|
||||||
prevExposure_ = currentExposure_;
|
filteredExposure_ = currentExposure_;
|
||||||
prevExposureNoDg_ = currentExposureNoDg_;
|
filteredExposureNoDg_ = currentExposureNoDg_;
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* If we are close to the desired result, go faster to avoid making
|
* If we are close to the desired result, go faster to avoid making
|
||||||
* multiple micro-adjustments.
|
* multiple micro-adjustments.
|
||||||
* \ todo: Make this customisable?
|
* \ todo: Make this customisable?
|
||||||
*/
|
*/
|
||||||
if (prevExposure_ < 1.2 * currentExposure_ &&
|
if (filteredExposure_ < 1.2 * currentExposure_ &&
|
||||||
prevExposure_ > 0.8 * currentExposure_)
|
filteredExposure_ > 0.8 * currentExposure_)
|
||||||
speed = sqrt(speed);
|
speed = sqrt(speed);
|
||||||
|
|
||||||
prevExposure_ = speed * currentExposure_ +
|
filteredExposure_ = speed * currentExposure_ +
|
||||||
prevExposure_ * (1.0 - speed);
|
filteredExposure_ * (1.0 - speed);
|
||||||
prevExposureNoDg_ = speed * currentExposureNoDg_ +
|
filteredExposureNoDg_ = speed * currentExposureNoDg_ +
|
||||||
prevExposureNoDg_ * (1.0 - speed);
|
filteredExposureNoDg_ * (1.0 - speed);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* We can't let the no_dg exposure deviate too far below the
|
* We can't let the no_dg exposure deviate too far below the
|
||||||
|
@ -125,10 +125,10 @@ void Agc::filterExposure()
|
||||||
* in the ISP to hide it (which will cause nasty oscillation).
|
* in the ISP to hide it (which will cause nasty oscillation).
|
||||||
*/
|
*/
|
||||||
double fastReduceThreshold = 0.4;
|
double fastReduceThreshold = 0.4;
|
||||||
if (prevExposureNoDg_ <
|
if (filteredExposureNoDg_ <
|
||||||
prevExposure_ * fastReduceThreshold)
|
filteredExposure_ * fastReduceThreshold)
|
||||||
prevExposureNoDg_ = prevExposure_ * fastReduceThreshold;
|
filteredExposureNoDg_ = filteredExposure_ * fastReduceThreshold;
|
||||||
LOG(IPU3Agc, Debug) << "After filtering, total_exposure " << prevExposure_;
|
LOG(IPU3Agc, Debug) << "After filtering, total_exposure " << filteredExposure_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Agc::lockExposureGain(uint32_t &exposure, double &gain)
|
void Agc::lockExposureGain(uint32_t &exposure, double &gain)
|
||||||
|
|
|
@ -44,8 +44,8 @@ private:
|
||||||
utils::Duration lineDuration_;
|
utils::Duration lineDuration_;
|
||||||
utils::Duration maxExposureTime_;
|
utils::Duration maxExposureTime_;
|
||||||
|
|
||||||
utils::Duration prevExposure_;
|
utils::Duration filteredExposure_;
|
||||||
utils::Duration prevExposureNoDg_;
|
utils::Duration filteredExposureNoDg_;
|
||||||
utils::Duration currentExposure_;
|
utils::Duration currentExposure_;
|
||||||
utils::Duration currentExposureNoDg_;
|
utils::Duration currentExposureNoDg_;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue