libcamera: software_isp: Add brightness control
Signed-off-by: Vasiliy Doylov <nekocwd@mainlining.org>
This commit is contained in:
parent
e0c8eb0913
commit
9613459d30
3 changed files with 38 additions and 0 deletions
|
@ -41,6 +41,33 @@ Agc::Agc()
|
|||
{
|
||||
}
|
||||
|
||||
int Agc::init(IPAContext &context,
|
||||
[[maybe_unused]] const YamlObject &tuningData)
|
||||
{
|
||||
context.ctrlMap[&controls::Brightness] = ControlInfo(0.0f, 2.0f, 1.0f);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Agc::configure(IPAContext &context,
|
||||
[[maybe_unused]] const IPAConfigInfo &configInfo)
|
||||
{
|
||||
context.activeState.knobs.brightness = std::optional<double>();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Agc::queueRequest(typename Module::Context &context,
|
||||
[[maybe_unused]] const uint32_t frame,
|
||||
[[maybe_unused]] typename Module::FrameContext &frameContext,
|
||||
const ControlList &controls)
|
||||
{
|
||||
const auto &brightness = controls.get(controls::Brightness);
|
||||
if (brightness.has_value()) {
|
||||
context.activeState.knobs.brightness = brightness;
|
||||
LOG(IPASoftExposure, Debug) << "Setting brightness to " << brightness.value();
|
||||
}
|
||||
}
|
||||
|
||||
void Agc::updateExposure(IPAContext &context, IPAFrameContext &frameContext, double exposureMSV)
|
||||
{
|
||||
/*
|
||||
|
@ -54,6 +81,8 @@ void Agc::updateExposure(IPAContext &context, IPAFrameContext &frameContext, dou
|
|||
double next;
|
||||
int32_t &exposure = frameContext.sensor.exposure;
|
||||
double &again = frameContext.sensor.gain;
|
||||
const auto brightness = context.activeState.knobs.brightness.value_or(1.0);
|
||||
exposureMSV /= brightness;
|
||||
|
||||
if (exposureMSV < kExposureOptimal - kExposureSatisfactory) {
|
||||
next = exposure * kExpNumeratorUp / kExpDenominator;
|
||||
|
|
|
@ -19,6 +19,13 @@ public:
|
|||
Agc();
|
||||
~Agc() = default;
|
||||
|
||||
int init(IPAContext &context, const YamlObject &tuningData) override;
|
||||
int configure(IPAContext &context, const IPAConfigInfo &configInfo) override;
|
||||
void queueRequest(typename Module::Context &context,
|
||||
const uint32_t frame,
|
||||
typename Module::FrameContext &frameContext,
|
||||
const ControlList &controls)
|
||||
override;
|
||||
void process(IPAContext &context, const uint32_t frame,
|
||||
IPAFrameContext &frameContext,
|
||||
const SwIspStats *stats,
|
||||
|
|
|
@ -64,6 +64,8 @@ struct IPAActiveState {
|
|||
/* 0..2 range, 1.0 = normal */
|
||||
std::optional<double> contrast;
|
||||
std::optional<float> saturation;
|
||||
/* 0..2 range, 1.0 = normal */
|
||||
std::optional<double> brightness;
|
||||
} knobs;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue