libcamera: rpi: Make the controller min frame duration configurable

The controller min frame duration is used to rate limit how often we
run IPAs. Historically this has been set to 33333us, meaning that the
algorithms effectively skip frames when the camera is running faster
than 30fps.

This patch adds a small amount of plumbing that allows this value to
be set in the Raspberry Pi configuration file. Some applications or
platforms (such as Pi 5) are easily capable of running these more
often, should there be a need to do so.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
David Plowman
2026-01-07 18:14:26 +00:00
committed by Kieran Bingham
parent 71c5c08fcf
commit cc74afcdbd
7 changed files with 47 additions and 15 deletions
+9 -9
View File
@@ -46,14 +46,6 @@ constexpr Duration defaultExposureTime = 20.0ms;
constexpr Duration defaultMinFrameDuration = 1.0s / 30.0;
constexpr Duration defaultMaxFrameDuration = 250.0s;
/*
* Determine the minimum allowable inter-frame duration to run the controller
* algorithms. If the pipeline handler provider frames at a rate higher than this,
* we rate-limit the controller Prepare() and Process() calls to lower than or
* equal to this rate.
*/
constexpr Duration controllerMinFrameDuration = 1.0s / 30.0;
/* List of controls handled by the Raspberry Pi IPA */
const ControlInfoMap::Map ipaControls{
/* \todo Move this to the Camera class */
@@ -186,6 +178,14 @@ int32_t IpaBase::init(const IPASettings &settings, const InitParams &params, Ini
result->controlInfo = ControlInfoMap(std::move(ctrlMap), controls::controls);
/*
* This determines the minimum allowable inter-frame duration to run the
* controller algorithms. If the pipeline handler provider frames at a
* rate higher than this, we rate-limit the controller Prepare() and
* Process() calls to lower than or equal to this rate.
*/
controllerMinFrameDuration_ = params.controllerMinFrameDurationUs * 1us;
return platformInit(params, result);
}
@@ -467,7 +467,7 @@ void IpaBase::prepareIsp(const PrepareParams &params)
/* Allow a 10% margin on the comparison below. */
Duration delta = (frameTimestamp - lastRunTimestamp_) * 1.0ns;
if (lastRunTimestamp_ && frameCount_ > invalidCount_ &&
delta < controllerMinFrameDuration * 0.9 && !hdrChange) {
delta < controllerMinFrameDuration_ * 0.9 && !hdrChange) {
/*
* Ensure we merge the previous frame's metadata with the current
* frame. This will not overwrite exposure/gain values for the
+2
View File
@@ -142,6 +142,8 @@ private:
} flickerState_;
bool awbEnabled_;
utils::Duration controllerMinFrameDuration_;
};
} /* namespace ipa::RPi */