ipa: raspberrypi: Switch AgcAlgorithm API to use utils::Duration
Switch the AgcAlgorithm API functions to use utils::Duration for all time based variables. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
parent
caa753179c
commit
2db8a767ca
4 changed files with 17 additions and 15 deletions
|
@ -6,6 +6,7 @@
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "libcamera/internal/utils.h"
|
||||||
#include "algorithm.hpp"
|
#include "algorithm.hpp"
|
||||||
|
|
||||||
namespace RPiController {
|
namespace RPiController {
|
||||||
|
@ -17,9 +18,9 @@ public:
|
||||||
// An AGC algorithm must provide the following:
|
// An AGC algorithm must provide the following:
|
||||||
virtual unsigned int GetConvergenceFrames() const = 0;
|
virtual unsigned int GetConvergenceFrames() const = 0;
|
||||||
virtual void SetEv(double ev) = 0;
|
virtual void SetEv(double ev) = 0;
|
||||||
virtual void SetFlickerPeriod(double flicker_period) = 0;
|
virtual void SetFlickerPeriod(libcamera::utils::Duration flicker_period) = 0;
|
||||||
virtual void SetFixedShutter(double fixed_shutter) = 0; // microseconds
|
virtual void SetFixedShutter(libcamera::utils::Duration fixed_shutter) = 0;
|
||||||
virtual void SetMaxShutter(double max_shutter) = 0; // microseconds
|
virtual void SetMaxShutter(libcamera::utils::Duration max_shutter) = 0;
|
||||||
virtual void SetFixedAnalogueGain(double fixed_analogue_gain) = 0;
|
virtual void SetFixedAnalogueGain(double fixed_analogue_gain) = 0;
|
||||||
virtual void SetMeteringMode(std::string const &metering_mode_name) = 0;
|
virtual void SetMeteringMode(std::string const &metering_mode_name) = 0;
|
||||||
virtual void SetExposureMode(std::string const &exposure_mode_name) = 0;
|
virtual void SetExposureMode(std::string const &exposure_mode_name) = 0;
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
using namespace RPiController;
|
using namespace RPiController;
|
||||||
using namespace libcamera;
|
using namespace libcamera;
|
||||||
|
using libcamera::utils::Duration;
|
||||||
|
|
||||||
LOG_DEFINE_CATEGORY(RPiAgc)
|
LOG_DEFINE_CATEGORY(RPiAgc)
|
||||||
|
|
||||||
|
@ -222,19 +223,19 @@ void Agc::SetEv(double ev)
|
||||||
ev_ = ev;
|
ev_ = ev;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Agc::SetFlickerPeriod(double flicker_period)
|
void Agc::SetFlickerPeriod(Duration flicker_period)
|
||||||
{
|
{
|
||||||
flicker_period_ = flicker_period;
|
flicker_period_ = flicker_period.get<std::micro>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Agc::SetMaxShutter(double max_shutter)
|
void Agc::SetMaxShutter(Duration max_shutter)
|
||||||
{
|
{
|
||||||
max_shutter_ = max_shutter;
|
max_shutter_ = max_shutter.get<std::micro>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Agc::SetFixedShutter(double fixed_shutter)
|
void Agc::SetFixedShutter(Duration fixed_shutter)
|
||||||
{
|
{
|
||||||
fixed_shutter_ = fixed_shutter;
|
fixed_shutter_ = fixed_shutter.get<std::micro>();
|
||||||
// Set this in case someone calls Pause() straight after.
|
// Set this in case someone calls Pause() straight after.
|
||||||
status_.shutter_time = clipShutter(fixed_shutter_);
|
status_.shutter_time = clipShutter(fixed_shutter_);
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,9 +77,9 @@ public:
|
||||||
void Resume() override;
|
void Resume() override;
|
||||||
unsigned int GetConvergenceFrames() const override;
|
unsigned int GetConvergenceFrames() const override;
|
||||||
void SetEv(double ev) override;
|
void SetEv(double ev) override;
|
||||||
void SetFlickerPeriod(double flicker_period) override;
|
void SetFlickerPeriod(libcamera::utils::Duration flicker_period) override;
|
||||||
void SetMaxShutter(double max_shutter) override; // microseconds
|
void SetMaxShutter(libcamera::utils::Duration max_shutter) override;
|
||||||
void SetFixedShutter(double fixed_shutter) override; // microseconds
|
void SetFixedShutter(libcamera::utils::Duration fixed_shutter) override;
|
||||||
void SetFixedAnalogueGain(double fixed_analogue_gain) override;
|
void SetFixedAnalogueGain(double fixed_analogue_gain) override;
|
||||||
void SetMeteringMode(std::string const &metering_mode_name) override;
|
void SetMeteringMode(std::string const &metering_mode_name) override;
|
||||||
void SetExposureMode(std::string const &exposure_mode_name) override;
|
void SetExposureMode(std::string const &exposure_mode_name) override;
|
||||||
|
|
|
@ -638,8 +638,8 @@ void IPARPi::queueRequest(const ControlList &controls)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This expects units of micro-seconds. */
|
/* The control provides units of microseconds. */
|
||||||
agc->SetFixedShutter(ctrl.second.get<int32_t>());
|
agc->SetFixedShutter(ctrl.second.get<int32_t>() * 1.0us);
|
||||||
|
|
||||||
libcameraMetadata_.set(controls::ExposureTime, ctrl.second.get<int32_t>());
|
libcameraMetadata_.set(controls::ExposureTime, ctrl.second.get<int32_t>());
|
||||||
break;
|
break;
|
||||||
|
@ -1091,7 +1091,7 @@ void IPARPi::applyFrameDurations(Duration minFrameDuration, Duration maxFrameDur
|
||||||
|
|
||||||
RPiController::AgcAlgorithm *agc = dynamic_cast<RPiController::AgcAlgorithm *>(
|
RPiController::AgcAlgorithm *agc = dynamic_cast<RPiController::AgcAlgorithm *>(
|
||||||
controller_.GetAlgorithm("agc"));
|
controller_.GetAlgorithm("agc"));
|
||||||
agc->SetMaxShutter(maxShutter.get<std::micro>());
|
agc->SetMaxShutter(maxShutter);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IPARPi::applyAGC(const struct AgcStatus *agcStatus, ControlList &ctrls)
|
void IPARPi::applyAGC(const struct AgcStatus *agcStatus, ControlList &ctrls)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue