[PATCH v2 3/8] ipa: libipa: Add ExposureModeHelper
Barnabás Pőcze
pobrn at protonmail.com
Tue Apr 23 17:01:34 CEST 2024
Hi
2024. április 23., kedd 16:41 keltezéssel, Dan Scally <dan.scally at ideasonboard.com> írta:
> [...]
> >> [...]
> >> +/**
> >> + * \brief Initialize an ExposureModeHelper instance
> >> + * \param[in] stages The vector of paired shutter time and gain limits
> >> + *
> >> + * This function is expected to be called a single time once the algorithm that
> >> + * is using these helpers has built the necessary list of shutter and gain pairs
> >> + * to use (archetypically by parsing them from a tuning file during the
> >> + * algorithm's .init() call).
> >> + *
> >> + * The input steps are shutter and _total_ gain pairs; the gain encompasses both
> >> + * analogue and digital gain.
> >> + *
> >> + * The vector of stages may be empty. In that case, the helper will simply use
> >> + * the runtime limits set through setShutterGainLimits() instead.
> >> + */
> >> +void ExposureModeHelper::init(const std::vector<std::pair<utils::Duration, double>> stages)
> > Any reason for not using span here?
>
>
> The shutter time and gain vectors are initially separate, and need combining like so:
>
>
> std::vector<std::pair<utils::Duration, double>> stages;
> for (unsigned int i = 0; i < shutters.size(); i++) {
> stages.push_back({
> std::chrono::microseconds(shutters[i]),
> gains[i]
> });
> }
>
> std::shared_ptr<ExposureModeHelper> helper =
> std::make_shared<ExposureModeHelper>();
> helper->init(stages);
>
> So given I have to build a new vector with the paired stages anyway I couldn't
> see value in then using a Span for the init() instead of just passing the vector...but quite
> possibly I am just not understanding why it's the better choice here.
Note that in the code above, there is a copy when calling init(), using a span avoids that.
> [...]
Regards,
Barnabás Pőcze
More information about the libcamera-devel
mailing list