summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2012-03-16 19:15:01 +0100
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2012-05-01 12:13:56 +0200
commit0e6faa79f6fae04321abfbb4be30df7d732d5d7f (patch)
treeb24f9dc70c46403de7e80d5e52e04a199aed9994
parentf030d07589524d07d5eaf7c2dfff607656889b8b (diff)
iq: Add statistics window size and position parameters
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r--iq.c51
-rw-r--r--iq.h8
-rw-r--r--live.c4
-rw-r--r--snapshot.c4
4 files changed, 48 insertions, 19 deletions
diff --git a/iq.c b/iq.c
index c407b6e..efc00c2 100644
--- a/iq.c
+++ b/iq.c
@@ -93,6 +93,10 @@ void iq_aewb_process(struct iq_tuning *iq,
*/
void iq_params_init(struct iq_params *params)
{
+ params->window.left = 0.0;
+ params->window.top = 0.0;
+ params->window.width = 1.0;
+ params->window.height = 1.0;
params->mean_level = 0.15;
params->exposure = 1000;
params->exposure_min = 10;
@@ -120,7 +124,8 @@ void iq_params_init(struct iq_params *params)
*/
int iq_params_parse(struct iq_params *params, const char *arg)
{
- unsigned int *val_uint;
+ unsigned int *val_uint = NULL;
+ float *val_float = NULL;
const char *value;
unsigned int size;
char *endp;
@@ -132,17 +137,6 @@ int iq_params_parse(struct iq_params *params, const char *arg)
size = value - arg;
value++;
- if (strncmp(arg, "mean-level", size) == 0) {
- params->mean_level = strtof(value, &endp);
- if (*endp != '\0')
- return -EINVAL;
-
- if (params->mean_level <= 0 || params-> mean_level >= 1)
- return -ERANGE;
-
- return 0;
- }
-
if (strncmp(arg, "exposure-def", size) == 0)
val_uint = &params->exposure;
else if (strncmp(arg, "exposure-min", size) == 0)
@@ -155,12 +149,31 @@ int iq_params_parse(struct iq_params *params, const char *arg)
val_uint = &params->gain_min;
else if (strncmp(arg, "gain-max", size) == 0)
val_uint = &params->gain_max;
+ else if (strncmp(arg, "mean-level", size) == 0)
+ val_float = &params->mean_level;
+ else if (strncmp(arg, "window-left", size) == 0)
+ val_float = &params->window.left;
+ else if (strncmp(arg, "window-top", size) == 0)
+ val_float = &params->window.top;
+ else if (strncmp(arg, "window-width", size) == 0)
+ val_float = &params->window.width;
+ else if (strncmp(arg, "window-height", size) == 0)
+ val_float = &params->window.height;
else
return -EINVAL;
- *val_uint = strtoul(value, &endp, 10);
- if (*endp != '\0')
- return -EINVAL;
+ if (val_uint != NULL) {
+ *val_uint = strtoul(value, &endp, 10);
+ if (*endp != '\0')
+ return -EINVAL;
+ } else {
+ *val_float = strtof(value, &endp);
+ if (*endp != '\0')
+ return -EINVAL;
+
+ if (*val_float < 0 || *val_float > 1)
+ return -ERANGE;
+ }
return 0;
}
@@ -187,10 +200,10 @@ struct iq_tuning *iq_init(struct omap3_isp_device *isp,
omap3_isp_ccdc_set_black_level(isp, iq->params.black_level);
omap3_isp_stats_get_format(isp, &format);
- window.left = 0;
- window.top = 0;
- window.width = format.width;
- window.height = format.height;
+ window.left = params->window.left * format.width;
+ window.top = params->window.top * format.height;
+ window.width = params->window.width * format.width;
+ window.height = params->window.height * format.height;
omap3_isp_aewb_configure(isp, &window, iq->pix_max - iq->params.black_level - 1);
omap3_isp_stats_enable(isp, true);
diff --git a/iq.h b/iq.h
index 2b043a8..a5c5028 100644
--- a/iq.h
+++ b/iq.h
@@ -29,6 +29,7 @@ struct omap3_isp_aewb_stats;
/**
* struct iq_params - Image quality tuning parameters
+ * @window: Statistics computation window (fraction of the image size)
* @mean_level: Target mean luminance level (fraction of the maximum)
* @exposure: Initial exposure value (sensor-specific units)
* @exposure_min: Minimum exposure value
@@ -39,6 +40,13 @@ struct omap3_isp_aewb_stats;
* @black_level: Black level offset
*/
struct iq_params {
+ struct {
+ float left;
+ float top;
+ float width;
+ float height;
+ } window;
+
float mean_level;
unsigned int exposure;
diff --git a/live.c b/live.c
index 68b9b42..cc7d02d 100644
--- a/live.c
+++ b/live.c
@@ -334,6 +334,10 @@ static void usage(const char *argv0)
printf("- gain-min Sensor gain minimum value\n");
printf("- gain-max Sensor gain maximum value\n");
printf("- mean-level Mean luminance target level (float [0-1])\n");
+ printf("- window-left Statistics window left (float [0-1])\n");
+ printf("- window-top Statistics window top (float [0-1])\n");
+ printf("- window-width Statistics window width (float [0-1])\n");
+ printf("- window-height Statistics window height (float [0-1])\n");
}
#define OPT_AEWB_PARAM 256
diff --git a/snapshot.c b/snapshot.c
index 6b5d84e..76df91a 100644
--- a/snapshot.c
+++ b/snapshot.c
@@ -409,6 +409,10 @@ static void usage(const char *argv0)
printf("- gain-min Sensor gain minimum value\n");
printf("- gain-max Sensor gain maximum value\n");
printf("- mean-level Mean luminance target level (float [0-1])\n");
+ printf("- window-left Statistics window left (float [0-1])\n");
+ printf("- window-top Statistics window top (float [0-1])\n");
+ printf("- window-width Statistics window width (float [0-1])\n");
+ printf("- window-height Statistics window height (float [0-1])\n");
}
#define OPT_AEWB_PARAM 256