mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-12 23:09:45 +03:00
ipa: rpi: Replace dropFrameCount in the IPA -> PH interface
Replace the dropFrameCount parameter returned from ipa::start() to the pipeline handler by startupFrameCount and invalidFrameCount. The former counts the number of frames required for AWB/AGC to converge, and the latter counts the number of invalid frames produced by the sensor when starting up. In the pipeline handler, use the sum of these 2 values to replicate the existing dropFrameCount behaviour. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
parent
c50eb1f04a
commit
b114c155a7
3 changed files with 12 additions and 9 deletions
|
@ -52,7 +52,8 @@ struct ConfigResult {
|
||||||
|
|
||||||
struct StartResult {
|
struct StartResult {
|
||||||
libcamera.ControlList controls;
|
libcamera.ControlList controls;
|
||||||
int32 dropFrameCount;
|
int32 startupFrameCount;
|
||||||
|
int32 invalidFrameCount;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PrepareParams {
|
struct PrepareParams {
|
||||||
|
|
|
@ -324,6 +324,7 @@ void IpaBase::start(const ControlList &controls, StartResult *result)
|
||||||
* "mistrusted", which depends on whether this is a startup from cold,
|
* "mistrusted", which depends on whether this is a startup from cold,
|
||||||
* or merely a mode switch in a running system.
|
* or merely a mode switch in a running system.
|
||||||
*/
|
*/
|
||||||
|
unsigned int agcConvergenceFrames = 0, awbConvergenceFrames = 0;
|
||||||
frameCount_ = 0;
|
frameCount_ = 0;
|
||||||
if (firstStart_) {
|
if (firstStart_) {
|
||||||
dropFrameCount_ = helper_->hideFramesStartup();
|
dropFrameCount_ = helper_->hideFramesStartup();
|
||||||
|
@ -336,7 +337,6 @@ void IpaBase::start(const ControlList &controls, StartResult *result)
|
||||||
* (mistrustCount_) that they won't see. But if zero (i.e.
|
* (mistrustCount_) that they won't see. But if zero (i.e.
|
||||||
* no convergence necessary), no frames need to be dropped.
|
* no convergence necessary), no frames need to be dropped.
|
||||||
*/
|
*/
|
||||||
unsigned int agcConvergenceFrames = 0;
|
|
||||||
RPiController::AgcAlgorithm *agc = dynamic_cast<RPiController::AgcAlgorithm *>(
|
RPiController::AgcAlgorithm *agc = dynamic_cast<RPiController::AgcAlgorithm *>(
|
||||||
controller_.getAlgorithm("agc"));
|
controller_.getAlgorithm("agc"));
|
||||||
if (agc) {
|
if (agc) {
|
||||||
|
@ -345,7 +345,6 @@ void IpaBase::start(const ControlList &controls, StartResult *result)
|
||||||
agcConvergenceFrames += mistrustCount_;
|
agcConvergenceFrames += mistrustCount_;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int awbConvergenceFrames = 0;
|
|
||||||
RPiController::AwbAlgorithm *awb = dynamic_cast<RPiController::AwbAlgorithm *>(
|
RPiController::AwbAlgorithm *awb = dynamic_cast<RPiController::AwbAlgorithm *>(
|
||||||
controller_.getAlgorithm("awb"));
|
controller_.getAlgorithm("awb"));
|
||||||
if (awb) {
|
if (awb) {
|
||||||
|
@ -353,15 +352,18 @@ void IpaBase::start(const ControlList &controls, StartResult *result)
|
||||||
if (awbConvergenceFrames)
|
if (awbConvergenceFrames)
|
||||||
awbConvergenceFrames += mistrustCount_;
|
awbConvergenceFrames += mistrustCount_;
|
||||||
}
|
}
|
||||||
|
|
||||||
dropFrameCount_ = std::max({ dropFrameCount_, agcConvergenceFrames, awbConvergenceFrames });
|
|
||||||
LOG(IPARPI, Debug) << "Drop " << dropFrameCount_ << " frames on startup";
|
|
||||||
} else {
|
} else {
|
||||||
dropFrameCount_ = helper_->hideFramesModeSwitch();
|
dropFrameCount_ = helper_->hideFramesModeSwitch();
|
||||||
mistrustCount_ = helper_->mistrustFramesModeSwitch();
|
mistrustCount_ = helper_->mistrustFramesModeSwitch();
|
||||||
}
|
}
|
||||||
|
|
||||||
result->dropFrameCount = dropFrameCount_;
|
result->startupFrameCount = std::max({ agcConvergenceFrames, awbConvergenceFrames });
|
||||||
|
result->invalidFrameCount = dropFrameCount_;
|
||||||
|
|
||||||
|
dropFrameCount_ = std::max({ dropFrameCount_, agcConvergenceFrames, awbConvergenceFrames });
|
||||||
|
|
||||||
|
LOG(IPARPI, Debug) << "Startup frames: " << result->startupFrameCount
|
||||||
|
<< " Invalid frames: " << result->invalidFrameCount;
|
||||||
|
|
||||||
firstStart_ = false;
|
firstStart_ = false;
|
||||||
lastRunTimestamp_ = 0;
|
lastRunTimestamp_ = 0;
|
||||||
|
|
|
@ -660,8 +660,8 @@ int PipelineHandlerBase::start(Camera *camera, const ControlList *controls)
|
||||||
data->setSensorControls(result.controls);
|
data->setSensorControls(result.controls);
|
||||||
|
|
||||||
/* Configure the number of dropped frames required on startup. */
|
/* Configure the number of dropped frames required on startup. */
|
||||||
data->dropFrameCount_ = data->config_.disableStartupFrameDrops
|
data->dropFrameCount_ = data->config_.disableStartupFrameDrops ?
|
||||||
? 0 : result.dropFrameCount;
|
0 : result.startupFrameCount + result.invalidFrameCount;
|
||||||
|
|
||||||
for (auto const stream : data->streams_)
|
for (auto const stream : data->streams_)
|
||||||
stream->resetBuffers();
|
stream->resetBuffers();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue