summaryrefslogtreecommitdiff
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
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>
-rw-r--r--iq.c21
-rw-r--r--iq.h5
-rw-r--r--live.c2
-rw-r--r--snapshot.c2
4 files changed, 27 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;
diff --git a/iq.h b/iq.h
index a5c5028..74be0a2 100644
--- a/iq.h
+++ b/iq.h
@@ -30,6 +30,8 @@ struct omap3_isp_aewb_stats;
/**
* struct iq_params - Image quality tuning parameters
* @window: Statistics computation window (fraction of the image size)
+ * @ae_delay: Number of frames to skip at stream start before enabling AE
+ * @ae_interval: Number of frames between AE algorithm runs
* @mean_level: Target mean luminance level (fraction of the maximum)
* @exposure: Initial exposure value (sensor-specific units)
* @exposure_min: Minimum exposure value
@@ -47,6 +49,9 @@ struct iq_params {
float height;
} window;
+ unsigned int ae_delay;
+ unsigned int ae_interval;
+
float mean_level;
unsigned int exposure;
diff --git a/live.c b/live.c
index cc7d02d..75f62ba 100644
--- a/live.c
+++ b/live.c
@@ -327,6 +327,8 @@ static void usage(const char *argv0)
printf("-s, --skip n Skip display of n frames out of n+1\n");
printf(" --aewb param=value Set AEWB algorithm parameter 'param' to 'value'\n");
printf("\nSupported AEWB parameters are:\n");
+ printf("- ae-delay Number of frames to skip at stream start before enabling AE\n");
+ printf("- ae-interval Number of frames between AE algorithm runs (>= 1)\n");
printf("- exposure-def Exposure time default value\n");
printf("- exposure-min Exposure time minimum value\n");
printf("- exposure-max Exposure time maximum value\n");
diff --git a/snapshot.c b/snapshot.c
index 76df91a..958307e 100644
--- a/snapshot.c
+++ b/snapshot.c
@@ -402,6 +402,8 @@ static void usage(const char *argv0)
printf("-v, --view Enable viewfinder\n");
printf(" --aewb param=value Set AEWB algorithm parameter 'param' to 'value'\n");
printf("\nSupported AEWB parameters are:\n");
+ printf("- ae-delay Number of frames to skip at stream start before enabling AE\n");
+ printf("- ae-interval Number of frames between AE algorithm runs (>= 1)\n");
printf("- exposure-def Exposure time default value\n");
printf("- exposure-min Exposure time minimum value\n");
printf("- exposure-max Exposure time maximum value\n");