summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ipa/raspberrypi/controller/rpi/agc.cpp35
-rw-r--r--src/ipa/raspberrypi/controller/rpi/agc.hpp5
2 files changed, 21 insertions, 19 deletions
diff --git a/src/ipa/raspberrypi/controller/rpi/agc.cpp b/src/ipa/raspberrypi/controller/rpi/agc.cpp
index f0c70a0a..4cf98e66 100644
--- a/src/ipa/raspberrypi/controller/rpi/agc.cpp
+++ b/src/ipa/raspberrypi/controller/rpi/agc.cpp
@@ -235,6 +235,8 @@ void Agc::Prepare(Metadata *image_metadata)
int lock_count = lock_count_;
lock_count_ = 0;
status_.digital_gain = 1.0;
+ fetchAwbStatus(image_metadata); // always fetch it so that Process knows it's been done
+
if (status_.total_exposure_value) {
// Process has run, so we have meaningful values.
DeviceStatus/* SPDX-License-Identifier: LGPL-2.1-or-later */ /* * Copyright (C) 2019, Google Inc. * * camera_controls.cpp - Camera controls */ #include "camera_controls.h" #include <libcamera/camera.h> #include <libcamera/controls.h> /** * \file camera_controls.h * \brief Controls for Camera instances */ namespace libcamera { /** * \class CameraControlValidator * \brief A control validator for Camera instances * * This ControlValidator specialisation validates that controls exist in the * Camera associated with the validator. */ /** * \brief Construst a CameraControlValidator for the \a camera * \param[in] camera The camera */ CameraControlValidator::CameraControlValidator(Camera *camera) : camera_(camera) { } const std::string &CameraControlValidator::name() const { return camera_->name(); } /** * \brief Validate a control * \param[in] id The control ID * \return True if the control is valid, false otherwise */ bool CameraControlValidator::validate(unsigned int id) const { const ControlInfoMap &controls = camera_->controls(); return controls.find(id) != controls.end(); } } /* namespace libcamera */
min_colour_gain != 0.0);
+ double dg = 1.0 / min_colour_gain;
// I think this pipeline subtracts black level and rescales before we
// get the stats, so no need to worry about it.
- struct AwbStatus awb;
- if (image_metadata->Get("awb.status", awb) == 0) {
- double min_gain = std::min(awb.gain_r,
- std::min(awb.gain_g, awb.gain_b));
- dg *= std::max(1.0, 1.0 / min_gain);
- } else
- LOG(RPiAgc, Warning) << "Agc: no AWB status found";
LOG(RPiAgc, Debug) << "after AWB, target dg " << dg << " gain " << gain
<< " target_Y " << target_Y;
// Finally, if we're trying to reduce exposure but the target_Y is
diff --git a/src/ipa/raspberrypi/controller/rpi/agc.hpp b/src/ipa/raspberrypi/controller/rpi/agc.hpp
index 2442fc03..e7ac480f 100644
--- a/src/ipa/raspberrypi/controller/rpi/agc.hpp
+++ b/src/ipa/raspberrypi/controller/rpi/agc.hpp
@@ -83,11 +83,11 @@ private:
AgcConfig config_;
void housekeepConfig();
void fetchCurrentExposure(Metadata *image_metadata);
+ void fetchAwbStatus(Metadata *image_metadata);
void computeGain(bcm2835_isp_stats *statistics, Metadata *image_metadata,
double &gain, double &target_Y);
void computeTargetExposure(double gain);
- bool applyDigitalGain(Metadata *image_metadata, double gain,
- double target_Y);
+ bool applyDigitalGain(double gain, double target_Y);
void filterExposure(bool desaturate);
void divideUpExposure();
void writeAndFinish(Metadata *image_metadata, bool desaturate);
@@ -95,6 +95,7 @@ private:
AgcExposureMode *exposure_mode_;
AgcConstraintMode *constraint_mode_;
uint64_t frame_count_;
+ AwbStatus awb_;
struct ExposureValues {
ExposureValues() : shutter(0), analogue_gain(0),
total_exposure(0), total_exposure_no_dg(0) {}