[PATCH v1] ipa: rpi: Apply default ControlInfo values for sensor controls
Kieran Bingham
kieran.bingham at ideasonboard.com
Tue Feb 4 19:39:45 CET 2025
Quoting David Plowman (2025-02-04 16:05:06)
> Hi Naush
>
> Thanks for the patch.
>
> On Tue, 4 Feb 2025 at 15:09, Naushir Patuck <naush at raspberrypi.com> wrote:
> >
> > The existing IPA initialisation code did not set default values for
> > some sensor related controls. This caused a crash using libcamerify
> > when the it was trying to access the default value for
> > controls::FrameDurationLimits as part of a recent change.
> >
> > Ensure controls::FrameDurationLimits, controls::AnalogueGain and
> > controls::ExposureTime advertise default values along with the existing
> > min/max values. The default is set to the min value.
> >
> > Bug: https://bugs.libcamera.org/show_bug.cgi?id=253
> > Signed-off-by: Naushir Patuck <naush at raspberrypi.com>
>
> I suppose there is a bit of a question as to what these defaults mean,
> if anything. And if they don't mean much, then why do we need them.
> But this is obviously better than crashing, so:
>
> Reviewed-by: David Plowman <david.plowman at raspberrypi.com>
Yup, I agree, it's hard to know what the 'right' default should be in
all of these cases, and I think that's why defaults are not enforced on
the Control constructors, because sometimes I'm sure in some controls
it's really not possible to have a default.
But as this is better than crashing I think it's fine to merge this
patch - and we should try to determine which controls /require/ a
default value - and find a way to specify (and validate) such things.
Reviewed-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
>
> Though it also feels like we need some better automated testing!! :)
>
> David
>
> > ---
> > src/ipa/rpi/common/ipa_base.cpp | 9 ++++++---
> > 1 file changed, 6 insertions(+), 3 deletions(-)
> >
> > diff --git a/src/ipa/rpi/common/ipa_base.cpp b/src/ipa/rpi/common/ipa_base.cpp
> > index bd3c22000df5..5924df4c1125 100644
> > --- a/src/ipa/rpi/common/ipa_base.cpp
> > +++ b/src/ipa/rpi/common/ipa_base.cpp
> > @@ -259,15 +259,18 @@ int32_t IpaBase::configure(const IPACameraSensorInfo &sensorInfo, const ConfigPa
> > ControlInfoMap::Map ctrlMap = ipaControls;
> > ctrlMap[&controls::FrameDurationLimits] =
> > ControlInfo(static_cast<int64_t>(mode_.minFrameDuration.get<std::micro>()),
> > - static_cast<int64_t>(mode_.maxFrameDuration.get<std::micro>()));
> > + static_cast<int64_t>(mode_.maxFrameDuration.get<std::micro>()),
> > + static_cast<int64_t>(mode_.minFrameDuration.get<std::micro>()));
> >
> > ctrlMap[&controls::AnalogueGain] =
> > ControlInfo(static_cast<float>(mode_.minAnalogueGain),
> > - static_cast<float>(mode_.maxAnalogueGain));
> > + static_cast<float>(mode_.maxAnalogueGain),
> > + static_cast<float>(mode_.minAnalogueGain));
> >
> > ctrlMap[&controls::ExposureTime] =
> > ControlInfo(static_cast<int32_t>(mode_.minExposureTime.get<std::micro>()),
> > - static_cast<int32_t>(mode_.maxExposureTime.get<std::micro>()));
> > + static_cast<int32_t>(mode_.maxExposureTime.get<std::micro>()),
> > + static_cast<int32_t>(mode_.minExposureTime.get<std::micro>()));
> >
> > /* Declare colour processing related controls for non-mono sensors. */
> > if (!monoSensor_)
> > --
> > 2.43.0
> >
More information about the libcamera-devel
mailing list