mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-13 23:39:44 +03:00
ipa: rpi: agc: Fetch AWB status in the prepare method
AWB writes this out during prepare, so we may as well read it in AGC prepare as well. Reading it in process is wrong on the PiSP platform because process runs before prepare, so the AWB status won't be there (on vc4 it made no difference). Signed-off-by: David Plowman <david.plowman@raspberrypi.com> Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
parent
4e7c26b197
commit
78a2d00c79
1 changed files with 8 additions and 7 deletions
|
@ -270,7 +270,11 @@ AgcChannel::AgcChannel()
|
||||||
lastTargetExposure_(0s), ev_(1.0), flickerPeriod_(0s),
|
lastTargetExposure_(0s), ev_(1.0), flickerPeriod_(0s),
|
||||||
maxShutter_(0s), fixedShutter_(0s), fixedAnalogueGain_(0.0)
|
maxShutter_(0s), fixedShutter_(0s), fixedAnalogueGain_(0.0)
|
||||||
{
|
{
|
||||||
memset(&awb_, 0, sizeof(awb_));
|
/* Set AWB default values in case early frames have no updates in metadata. */
|
||||||
|
awb_.gainR = 1.0;
|
||||||
|
awb_.gainG = 1.0;
|
||||||
|
awb_.gainB = 1.0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Setting status_.totalExposureValue_ to zero initially tells us
|
* Setting status_.totalExposureValue_ to zero initially tells us
|
||||||
* it's not been calculated yet (i.e. Process hasn't yet run).
|
* it's not been calculated yet (i.e. Process hasn't yet run).
|
||||||
|
@ -409,7 +413,6 @@ void AgcChannel::switchMode(CameraMode const &cameraMode,
|
||||||
Duration fixedShutter = limitShutter(fixedShutter_);
|
Duration fixedShutter = limitShutter(fixedShutter_);
|
||||||
if (fixedShutter && fixedAnalogueGain_) {
|
if (fixedShutter && fixedAnalogueGain_) {
|
||||||
/* We're going to reset the algorithm here with these fixed values. */
|
/* We're going to reset the algorithm here with these fixed values. */
|
||||||
|
|
||||||
fetchAwbStatus(metadata);
|
fetchAwbStatus(metadata);
|
||||||
double minColourGain = std::min({ awb_.gainR, awb_.gainG, awb_.gainB, 1.0 });
|
double minColourGain = std::min({ awb_.gainR, awb_.gainG, awb_.gainB, 1.0 });
|
||||||
ASSERT(minColourGain != 0.0);
|
ASSERT(minColourGain != 0.0);
|
||||||
|
@ -464,6 +467,9 @@ void AgcChannel::prepare(Metadata *imageMetadata)
|
||||||
AgcStatus delayedStatus;
|
AgcStatus delayedStatus;
|
||||||
AgcPrepareStatus prepareStatus;
|
AgcPrepareStatus prepareStatus;
|
||||||
|
|
||||||
|
/* Fetch the AWB status now because AWB also sets it in the prepare method. */
|
||||||
|
fetchAwbStatus(imageMetadata);
|
||||||
|
|
||||||
if (!imageMetadata->get("agc.delayed_status", delayedStatus))
|
if (!imageMetadata->get("agc.delayed_status", delayedStatus))
|
||||||
totalExposureValue = delayedStatus.totalExposureValue;
|
totalExposureValue = delayedStatus.totalExposureValue;
|
||||||
|
|
||||||
|
@ -507,8 +513,6 @@ void AgcChannel::process(StatisticsPtr &stats, DeviceStatus const &deviceStatus,
|
||||||
* configuration, that kind of thing.
|
* configuration, that kind of thing.
|
||||||
*/
|
*/
|
||||||
housekeepConfig();
|
housekeepConfig();
|
||||||
/* Fetch the AWB status immediately, so that we can assume it's there. */
|
|
||||||
fetchAwbStatus(imageMetadata);
|
|
||||||
/* Get the current exposure values for the frame that's just arrived. */
|
/* Get the current exposure values for the frame that's just arrived. */
|
||||||
fetchCurrentExposure(deviceStatus);
|
fetchCurrentExposure(deviceStatus);
|
||||||
/* Compute the total gain we require relative to the current exposure. */
|
/* Compute the total gain we require relative to the current exposure. */
|
||||||
|
@ -637,9 +641,6 @@ void AgcChannel::fetchCurrentExposure(DeviceStatus const &deviceStatus)
|
||||||
|
|
||||||
void AgcChannel::fetchAwbStatus(Metadata *imageMetadata)
|
void AgcChannel::fetchAwbStatus(Metadata *imageMetadata)
|
||||||
{
|
{
|
||||||
awb_.gainR = 1.0; /* in case not found in metadata */
|
|
||||||
awb_.gainG = 1.0;
|
|
||||||
awb_.gainB = 1.0;
|
|
||||||
if (imageMetadata->get("awb.status", awb_) != 0)
|
if (imageMetadata->get("awb.status", awb_) != 0)
|
||||||
LOG(RPiAgc, Debug) << "No AWB status found";
|
LOG(RPiAgc, Debug) << "No AWB status found";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue