controls: Split FrameDurations into FrameDuration and FrameDurationLimits

We need a separate control to report the nominal frame duration, but
it's also useful to report the min/max frame duration values that will
be used. Split the FrameDurations control into FrameDuration and
FrameDurationLimits respectively to support both of these.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
Paul Elder 2021-05-24 18:37:14 +09:00
parent c0a9768a9b
commit 19772ffe10
5 changed files with 16 additions and 8 deletions

View file

@ -44,7 +44,7 @@ static const ControlInfoMap Controls = {
{ &controls::Sharpness, ControlInfo(0.0f, 16.0f, 1.0f) }, { &controls::Sharpness, ControlInfo(0.0f, 16.0f, 1.0f) },
{ &controls::ColourCorrectionMatrix, ControlInfo(-16.0f, 16.0f) }, { &controls::ColourCorrectionMatrix, ControlInfo(-16.0f, 16.0f) },
{ &controls::ScalerCrop, ControlInfo(Rectangle{}, Rectangle(65535, 65535, 65535, 65535), Rectangle{}) }, { &controls::ScalerCrop, ControlInfo(Rectangle{}, Rectangle(65535, 65535, 65535, 65535), Rectangle{}) },
{ &controls::FrameDurations, ControlInfo(INT64_C(1000), INT64_C(1000000000)) }, { &controls::FrameDurationLimits, ControlInfo(INT64_C(1000), INT64_C(1000000000)) },
{ &controls::draft::NoiseReductionMode, ControlInfo(controls::draft::NoiseReductionModeValues) }, { &controls::draft::NoiseReductionMode, ControlInfo(controls::draft::NoiseReductionModeValues) },
}; };

View file

@ -864,7 +864,7 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()
int64_t minFrameDurationNsec = -1; int64_t minFrameDurationNsec = -1;
int64_t maxFrameDurationNsec = -1; int64_t maxFrameDurationNsec = -1;
const auto frameDurationsInfo = controlsInfo.find(&controls::FrameDurations); const auto frameDurationsInfo = controlsInfo.find(&controls::FrameDurationLimits);
if (frameDurationsInfo != controlsInfo.end()) { if (frameDurationsInfo != controlsInfo.end()) {
minFrameDurationNsec = frameDurationsInfo->second.min().get<int64_t>() * 1000; minFrameDurationNsec = frameDurationsInfo->second.min().get<int64_t>() * 1000;
maxFrameDurationNsec = frameDurationsInfo->second.max().get<int64_t>() * 1000; maxFrameDurationNsec = frameDurationsInfo->second.max().get<int64_t>() * 1000;

View file

@ -859,7 +859,7 @@ void IPARPi::queueRequest(const ControlList &controls)
break; break;
} }
case controls::FRAME_DURATIONS: { case controls::FRAME_DURATION_LIMITS: {
auto frameDurations = ctrl.second.get<Span<const int64_t>>(); auto frameDurations = ctrl.second.get<Span<const int64_t>>();
applyFrameDurations(frameDurations[0], frameDurations[1]); applyFrameDurations(frameDurations[0], frameDurations[1]);
break; break;
@ -1074,7 +1074,7 @@ void IPARPi::applyFrameDurations(double minFrameDuration, double maxFrameDuratio
maxFrameDuration_ = std::max(maxFrameDuration_, minFrameDuration_); maxFrameDuration_ = std::max(maxFrameDuration_, minFrameDuration_);
/* Return the validated limits via metadata. */ /* Return the validated limits via metadata. */
libcameraMetadata_.set(controls::FrameDurations, libcameraMetadata_.set(controls::FrameDurationLimits,
{ static_cast<int64_t>(minFrameDuration_), { static_cast<int64_t>(minFrameDuration_),
static_cast<int64_t>(maxFrameDuration_) }); static_cast<int64_t>(maxFrameDuration_) });

View file

@ -323,7 +323,14 @@ controls:
step to respect the received gain factor and shall report step to respect the received gain factor and shall report
their total value in the request metadata. their total value in the request metadata.
- FrameDurations: - FrameDuration:
type: int64_t
description: |
The instantaneous frame duration from start of frame exposure to start
of next exposure, expressed in microseconds. This control is meant to
be returned in metadata.
- FrameDurationLimits:
type: int64_t type: int64_t
description: | description: |
The minimum and maximum (in that order) frame duration, The minimum and maximum (in that order) frame duration,

View file

@ -983,9 +983,10 @@ int PipelineHandlerIPU3::initControls(IPU3CameraData *data)
frameDurations[i] = frameSize / (sensorInfo.pixelRate / 1000000U); frameDurations[i] = frameSize / (sensorInfo.pixelRate / 1000000U);
} }
controls[&controls::FrameDurations] = ControlInfo(frameDurations[0], controls[&controls::FrameDurationLimits] =
frameDurations[1], ControlInfo(frameDurations[0],
frameDurations[2]); frameDurations[1],
frameDurations[2]);
/* /*
* Compute the scaler crop limits. * Compute the scaler crop limits.