| Message ID | 20260723154327.1357866-13-barnabas.pocze@ideasonboard.com |
|---|---|
| State | Superseded |
| Headers | show |
| Series |
|
| Related | show |
Hi Barnabás On Thu, Jul 23, 2026 at 05:42:55PM +0200, Barnabás Pőcze wrote: > The `ExposureModeHelper` object can be directly in the map, so do that. > > Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> Indeed Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> > --- > src/ipa/libipa/agc_mean_luminance.cpp | 23 ++++++++--------------- > src/ipa/libipa/agc_mean_luminance.h | 4 ++-- > 2 files changed, 10 insertions(+), 17 deletions(-) > > diff --git a/src/ipa/libipa/agc_mean_luminance.cpp b/src/ipa/libipa/agc_mean_luminance.cpp > index 8284c15ce2..faa8a41fd7 100644 > --- a/src/ipa/libipa/agc_mean_luminance.cpp > +++ b/src/ipa/libipa/agc_mean_luminance.cpp > @@ -332,10 +332,7 @@ int AgcMeanLuminance::parseExposureModes(const ValueNode &tuningData) > }); > } > > - std::shared_ptr<ExposureModeHelper> helper = > - std::make_shared<ExposureModeHelper>(stages); > - > - exposureModeHelpers_.try_emplace(it->second, std::move(helper)); > + exposureModeHelpers_.try_emplace(it->second, stages); > availableExposureModes.push_back(it->second); > } > } > @@ -347,12 +344,8 @@ int AgcMeanLuminance::parseExposureModes(const ValueNode &tuningData) > * possible before touching gain. > */ > if (availableExposureModes.empty()) { > - std::vector<std::pair<utils::Duration, double>> stages = { }; > - > - std::shared_ptr<ExposureModeHelper> helper = > - std::make_shared<ExposureModeHelper>(stages); > - > - exposureModeHelpers_.try_emplace(controls::ExposureNormal, std::move(helper)); > + exposureModeHelpers_.try_emplace(controls::ExposureNormal, > + Span<std::pair<utils::Duration, double>>{}); > availableExposureModes.push_back(controls::ExposureNormal); > } > > @@ -373,7 +366,7 @@ void AgcMeanLuminance::configure(utils::Duration lineDuration, > const CameraSensorHelper *sensorHelper) > { > for (auto &[id, helper] : exposureModeHelpers_) > - helper->configure(lineDuration, sensorHelper); > + helper.configure(lineDuration, sensorHelper); > > luxWarningEnabled_ = true; > } > @@ -484,7 +477,7 @@ void AgcMeanLuminance::setLimits(utils::Duration minExposureTime, > std::vector<AgcMeanLuminance::AgcConstraint> constraints) > { > for (auto &[id, helper] : exposureModeHelpers_) > - helper->setLimits(minExposureTime, maxExposureTime, minGain, maxGain); > + helper.setLimits(minExposureTime, maxExposureTime, minGain, maxGain); > > additionalConstraints_ = std::move(constraints); > } > @@ -684,7 +677,7 @@ AgcMeanLuminance::calculateNewEv(uint32_t constraintModeIndex, > * The pipeline handler should validate that we have received an allowed > * value for AeExposureMode. > */ > - std::shared_ptr<ExposureModeHelper> exposureModeHelper = > + ExposureModeHelper &exposureModeHelper = > exposureModeHelpers_.at(exposureModeIndex); > > if (effectiveExposureValue == 0s) { > @@ -696,7 +689,7 @@ AgcMeanLuminance::calculateNewEv(uint32_t constraintModeIndex, > * doesn't get stuck with 0 in case the sensor driver allows a > * min exposure of 0. > */ > - return exposureModeHelper->splitExposure(10ms); > + return exposureModeHelper.splitExposure(10ms); > } > > double gain = estimateInitialGain(traits); > @@ -718,7 +711,7 @@ AgcMeanLuminance::calculateNewEv(uint32_t constraintModeIndex, > newExposureValue = filterExposure(newExposureValue); > > frameCount_++; > - return exposureModeHelper->splitExposure(newExposureValue); > + return exposureModeHelper.splitExposure(newExposureValue); > } > > /** > diff --git a/src/ipa/libipa/agc_mean_luminance.h b/src/ipa/libipa/agc_mean_luminance.h > index f4e1680ab5..d5425cd20b 100644 > --- a/src/ipa/libipa/agc_mean_luminance.h > +++ b/src/ipa/libipa/agc_mean_luminance.h > @@ -69,7 +69,7 @@ public: > return constraintModes_; > } > > - const std::map<int32_t, std::shared_ptr<ExposureModeHelper>> &exposureModeHelpers() const > + const std::map<int32_t, ExposureModeHelper> &exposureModeHelpers() const > { > return exposureModeHelpers_; > } > @@ -111,7 +111,7 @@ private: > > std::vector<AgcConstraint> additionalConstraints_; > std::map<int32_t, std::vector<AgcConstraint>> constraintModes_; > - std::map<int32_t, std::shared_ptr<ExposureModeHelper>> exposureModeHelpers_; > + std::map<int32_t, ExposureModeHelper> exposureModeHelpers_; > ControlInfoMap::Map controls_; > }; > > -- > 2.55.0 >
diff --git a/src/ipa/libipa/agc_mean_luminance.cpp b/src/ipa/libipa/agc_mean_luminance.cpp index 8284c15ce2..faa8a41fd7 100644 --- a/src/ipa/libipa/agc_mean_luminance.cpp +++ b/src/ipa/libipa/agc_mean_luminance.cpp @@ -332,10 +332,7 @@ int AgcMeanLuminance::parseExposureModes(const ValueNode &tuningData) }); } - std::shared_ptr<ExposureModeHelper> helper = - std::make_shared<ExposureModeHelper>(stages); - - exposureModeHelpers_.try_emplace(it->second, std::move(helper)); + exposureModeHelpers_.try_emplace(it->second, stages); availableExposureModes.push_back(it->second); } } @@ -347,12 +344,8 @@ int AgcMeanLuminance::parseExposureModes(const ValueNode &tuningData) * possible before touching gain. */ if (availableExposureModes.empty()) { - std::vector<std::pair<utils::Duration, double>> stages = { }; - - std::shared_ptr<ExposureModeHelper> helper = - std::make_shared<ExposureModeHelper>(stages); - - exposureModeHelpers_.try_emplace(controls::ExposureNormal, std::move(helper)); + exposureModeHelpers_.try_emplace(controls::ExposureNormal, + Span<std::pair<utils::Duration, double>>{}); availableExposureModes.push_back(controls::ExposureNormal); } @@ -373,7 +366,7 @@ void AgcMeanLuminance::configure(utils::Duration lineDuration, const CameraSensorHelper *sensorHelper) { for (auto &[id, helper] : exposureModeHelpers_) - helper->configure(lineDuration, sensorHelper); + helper.configure(lineDuration, sensorHelper); luxWarningEnabled_ = true; } @@ -484,7 +477,7 @@ void AgcMeanLuminance::setLimits(utils::Duration minExposureTime, std::vector<AgcMeanLuminance::AgcConstraint> constraints) { for (auto &[id, helper] : exposureModeHelpers_) - helper->setLimits(minExposureTime, maxExposureTime, minGain, maxGain); + helper.setLimits(minExposureTime, maxExposureTime, minGain, maxGain); additionalConstraints_ = std::move(constraints); } @@ -684,7 +677,7 @@ AgcMeanLuminance::calculateNewEv(uint32_t constraintModeIndex, * The pipeline handler should validate that we have received an allowed * value for AeExposureMode. */ - std::shared_ptr<ExposureModeHelper> exposureModeHelper = + ExposureModeHelper &exposureModeHelper = exposureModeHelpers_.at(exposureModeIndex); if (effectiveExposureValue == 0s) { @@ -696,7 +689,7 @@ AgcMeanLuminance::calculateNewEv(uint32_t constraintModeIndex, * doesn't get stuck with 0 in case the sensor driver allows a * min exposure of 0. */ - return exposureModeHelper->splitExposure(10ms); + return exposureModeHelper.splitExposure(10ms); } double gain = estimateInitialGain(traits); @@ -718,7 +711,7 @@ AgcMeanLuminance::calculateNewEv(uint32_t constraintModeIndex, newExposureValue = filterExposure(newExposureValue); frameCount_++; - return exposureModeHelper->splitExposure(newExposureValue); + return exposureModeHelper.splitExposure(newExposureValue); } /** diff --git a/src/ipa/libipa/agc_mean_luminance.h b/src/ipa/libipa/agc_mean_luminance.h index f4e1680ab5..d5425cd20b 100644 --- a/src/ipa/libipa/agc_mean_luminance.h +++ b/src/ipa/libipa/agc_mean_luminance.h @@ -69,7 +69,7 @@ public: return constraintModes_; } - const std::map<int32_t, std::shared_ptr<ExposureModeHelper>> &exposureModeHelpers() const + const std::map<int32_t, ExposureModeHelper> &exposureModeHelpers() const { return exposureModeHelpers_; } @@ -111,7 +111,7 @@ private: std::vector<AgcConstraint> additionalConstraints_; std::map<int32_t, std::vector<AgcConstraint>> constraintModes_; - std::map<int32_t, std::shared_ptr<ExposureModeHelper>> exposureModeHelpers_; + std::map<int32_t, ExposureModeHelper> exposureModeHelpers_; ControlInfoMap::Map controls_; };
The `ExposureModeHelper` object can be directly in the map, so do that. Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> --- src/ipa/libipa/agc_mean_luminance.cpp | 23 ++++++++--------------- src/ipa/libipa/agc_mean_luminance.h | 4 ++-- 2 files changed, 10 insertions(+), 17 deletions(-)