summaryrefslogtreecommitdiff
path: root/iq.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2012-03-19 14:50:14 +0100
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2012-05-01 12:13:56 +0200
commitcecf2f690a16ad8a99d739f42b3bdb6745fafc07 (patch)
tree7c17c0346c8a6649197a53120362eeefe5cac76e /iq.c
parent0e6faa79f6fae04321abfbb4be30df7d732d5d7f (diff)
iq: Add ae-delay and ae-interval parameters
The ae-delay parameter selects the number of frames to skip at stream startup before running the auto exposure algorithm. The ae-interval selects the number of frames between AE runs. This can be used to delay AE when the sensor needs one or more frames to apply exposure and/or gain values. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'iq.c')
-rw-r--r--iq.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/iq.c b/iq.c
index efc00c2..8230d09 100644
--- a/iq.c
+++ b/iq.c
@@ -61,8 +61,17 @@ void iq_aewb_process(struct iq_tuning *iq,
omap3_isp_preview_set_white_balance(iq->isp, gains);
- /* Automatic Exposure */
- if ((iq->frame_count++ % 2) == 0)
+ /* Automatic Exposure
+ *
+ * Skip ae_delay frames at stream startup, and only run AE every
+ * ae_interval frames to take sensor exposure internal delays into
+ * account.
+ */
+ iq->frame_count++;
+ if (iq->frame_count <= iqp->ae_delay)
+ return;
+
+ if ((iq->frame_count - iqp->ae_delay - 1) % iqp->ae_interval)
return;
mean = stats->accum[0] + stats->accum[1]
@@ -97,6 +106,8 @@ void iq_params_init(struct iq_params *params)
params->window.top = 0.0;
params->window.width = 1.0;
params->window.height = 1.0;
+ params->ae_delay = 1;
+ params->ae_interval = 2;
params->mean_level = 0.15;
params->exposure = 1000;
params->exposure_min = 10;
@@ -137,7 +148,11 @@ int iq_params_parse(struct iq_params *params, const char *arg)
size = value - arg;
value++;
- if (strncmp(arg, "exposure-def", size) == 0)
+ if (strncmp(arg, "ae-delay", size) == 0)
+ val_uint = &params->ae_delay;
+ else if (strncmp(arg, "ae-interval", size) == 0)
+ val_uint = &params->ae_interval;
+ else if (strncmp(arg, "exposure-def", size) == 0)
val_uint = &params->exposure;
else if (strncmp(arg, "exposure-min", size) == 0)
val_uint = &params->exposure_min;