From 89f7abd7495cdc50283f50984a635dc917a6ff57 Mon Sep 17 00:00:00 2001 From: Martijn Braam Date: Mon, 27 Jun 2022 16:49:58 +0200 Subject: [PATCH] Capture at least 2 frames Current post processing scripts assume at least 2 frames are captured. With the rear pinephone camera the automatic gain control will always raise the gain high enough that the frame count will be 2 or higher. For the front camera the gain might be zero causing the burst to be 1 frame long. --- src/io_pipeline.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/io_pipeline.c b/src/io_pipeline.c index 4f8790e..1e46f97 100644 --- a/src/io_pipeline.c +++ b/src/io_pipeline.c @@ -388,7 +388,7 @@ capture(MPPipeline *pipeline, const void *data) // for manual gain you can go up to 11 frames gain = mp_camera_control_get_int32(info->camera, V4L2_CID_GAIN); gain_norm = (float)gain / (float)info->gain_max; - burst_length = (int)(sqrt(gain_norm) * 10) + 1; + burst_length = (int)fmax(sqrt(gain_norm) * 10, 1) + 1; captures_remaining = burst_length; // Change camera mode for capturing