summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo@jmondi.org>2022-09-13 16:42:12 +0200
committerJacopo Mondi <jacopo.mondi@ideasonboard.com>2023-03-11 13:14:00 +0100
commite53dda8bb82b7fda38fd2d11afa10babe3c51a6b (patch)
treed0cb9886c7bb0f89652392e2416f1c50a3cde9f8
parent97da589e657467f1d1e5d48b7fb838e1ad9e988d (diff)
ipa: rkisp: Add support for ExposureValue
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
-rw-r--r--src/ipa/rkisp1/algorithms/agc.cpp11
-rw-r--r--src/ipa/rkisp1/ipa_context.h1
-rw-r--r--src/ipa/rkisp1/rkisp1.cpp1
3 files changed, 13 insertions, 0 deletions
diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp
index 4c702576..97a08c35 100644
--- a/src/ipa/rkisp1/algorithms/agc.cpp
+++ b/src/ipa/rkisp1/algorithms/agc.cpp
@@ -88,6 +88,7 @@ int Agc::configure(IPAContext &context, const IPACameraSensorInfo &configInfo)
context.activeState.agc.manual.gain = context.activeState.agc.automatic.gain;
context.activeState.agc.manual.exposure = context.activeState.agc.automatic.exposure;
context.activeState.agc.autoEnabled = !context.configuration.raw;
+ context.activeState.agc.exposureValue = 0.0;
/*
* According to the RkISP1 documentation:
@@ -129,6 +130,12 @@ void Agc::queueRequest(IPAContext &context,
{
auto &agc = context.activeState.agc;
+ const auto exposureValue = controls.get(controls::ExposureValue);
+ if (exposureValue) {
+ LOG(RkISP1Agc, Debug) << "Set ExposureValue to: " << *exposureValue;
+ agc.exposureValue = *exposureValue;
+ }
+
if (!context.configuration.raw) {
const auto &agcEnable = controls.get(controls::AeEnable);
if (agcEnable && *agcEnable != agc.autoEnabled) {
@@ -308,6 +315,10 @@ void Agc::computeExposure(IPAContext &context, IPAFrameContext &frameContext,
*/
exposureValue = filterExposure(exposureValue);
+ const auto &agc = context.activeState.agc;
+ double exposureAdj = std::pow(2 * 1.0, agc.exposureValue);
+ exposureValue *= exposureAdj;
+
/*
* Push the shutter time up to the maximum first, and only then
* increase the gain.
diff --git a/src/ipa/rkisp1/ipa_context.h b/src/ipa/rkisp1/ipa_context.h
index bb72f0a4..dbfbc096 100644
--- a/src/ipa/rkisp1/ipa_context.h
+++ b/src/ipa/rkisp1/ipa_context.h
@@ -60,6 +60,7 @@ struct IPAActiveState {
} automatic;
bool autoEnabled;
+ float exposureValue;
} agc;
struct {
diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp
index da931cf2..e8851926 100644
--- a/src/ipa/rkisp1/rkisp1.cpp
+++ b/src/ipa/rkisp1/rkisp1.cpp
@@ -104,6 +104,7 @@ const ControlInfoMap::Map rkisp1Controls{
{ &controls::Brightness, ControlInfo(-1.0f, 0.993f, 0.0f) },
{ &controls::Contrast, ControlInfo(0.0f, 1.993f, 1.0f) },
{ &controls::Saturation, ControlInfo(0.0f, 1.993f, 1.0f) },
+ { &controls::ExposureValue, ControlInfo(-2.0f, 2.0f, 0.0f) },
{ &controls::Sharpness, ControlInfo(0.0f, 10.0f, 1.0f) },
{ &controls::draft::NoiseReductionMode, ControlInfo(controls::draft::NoiseReductionModeValues) },
{ &controls::LensShadingEnable, ControlInfo(false, true) },