From e53dda8bb82b7fda38fd2d11afa10babe3c51a6b Mon Sep 17 00:00:00 2001 From: Jacopo Mondi Date: Tue, 13 Sep 2022 16:42:12 +0200 Subject: ipa: rkisp: Add support for ExposureValue Signed-off-by: Jacopo Mondi --- src/ipa/rkisp1/algorithms/agc.cpp | 11 +++++++++++ src/ipa/rkisp1/ipa_context.h | 1 + src/ipa/rkisp1/rkisp1.cpp | 1 + 3 files changed, 13 insertions(+) (limited to 'src') 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) }, -- cgit v1.2.1