exposure
authorPaul Kocialkowski <contact@paulk.fr>
Sat, 2 Feb 2013 22:22:16 +0000 (23:22 +0100)
committerPaul Kocialkowski <contact@paulk.fr>
Sat, 2 Feb 2013 22:22:16 +0000 (23:22 +0100)
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
exynos_camera.c
exynos_camera.h

index 0204611..04fef78 100644 (file)
@@ -94,6 +94,11 @@ struct exynos_camera_preset exynos_camera_presets_galaxys2[] = {
 
                        .flash_mode = "off",
                        .flash_mode_values = "off,auto,on,torch",
+
+                       .exposure_compensation = 0,
+                       .exposure_compensation_step = 0.5,
+                       .min_exposure_compensation = -4,
+                       .max_exposure_compensation = 4,
                },
        },
        {
@@ -139,6 +144,11 @@ struct exynos_camera_preset exynos_camera_presets_galaxys2[] = {
 
                        .zoom_supported = 0,
                        .flash_mode = NULL,
+
+                       .exposure_compensation = 0,
+                       .exposure_compensation_step = 0.5,
+                       .min_exposure_compensation = -4,
+                       .max_exposure_compensation = 4,
                },
        },
 };
@@ -371,6 +381,16 @@ int exynos_camera_params_init(struct exynos_camera *exynos_camera, int id)
        exynos_param_string_set(exynos_camera, "flash-mode-values",
                exynos_camera->config->presets[id].params.flash_mode_values);
 
+       // Exposure
+       exynos_param_int_set(exynos_camera, "exposure-compensation",
+               exynos_camera->config->presets[id].params.exposure_compensation);
+       exynos_param_float_set(exynos_camera, "exposure-compensation-step",
+               exynos_camera->config->presets[id].params.exposure_compensation_step);
+       exynos_param_int_set(exynos_camera, "min-exposure-compensation",
+               exynos_camera->config->presets[id].params.min_exposure_compensation);
+       exynos_param_int_set(exynos_camera, "max-exposure-compensation",
+               exynos_camera->config->presets[id].params.max_exposure_compensation);
+
        // Camera
        exynos_param_float_set(exynos_camera, "focal-length",
                exynos_camera->config->presets[id].focal_length);
@@ -433,6 +453,10 @@ int exynos_camera_params_apply(struct exynos_camera *exynos_camera)
        char *flash_mode_string;
        int flash_mode;
 
+       int exposure_compensation;
+       int min_exposure_compensation;
+       int max_exposure_compensation;
+
        char *metering_string;
        int metering;
 
@@ -716,6 +740,19 @@ int exynos_camera_params_apply(struct exynos_camera *exynos_camera)
                }
        }
 
+       // Exposure
+       exposure_compensation = exynos_param_int_get(exynos_camera, "exposure-compensation");
+       min_exposure_compensation = exynos_param_int_get(exynos_camera, "min-exposure-compensation");
+       max_exposure_compensation = exynos_param_int_get(exynos_camera, "max-exposure-compensation");
+
+       if (exposure_compensation <= max_exposure_compensation && exposure_compensation >= min_exposure_compensation &&
+               (exposure_compensation != exynos_camera->exposure_compensation || force)) {
+               exynos_camera->exposure_compensation = exposure_compensation;
+               rc = exynos_v4l2_s_ctrl(exynos_camera, 0, V4L2_CID_CAMERA_BRIGHTNESS, exposure_compensation);
+               if (rc < 0)
+                       LOGE("%s: s ctrl failed!", __func__);
+       }
+
        // Metering
        metering_string = exynos_param_string_get(exynos_camera, "metering");
        if (metering_string != NULL) {
index e985880..c713561 100644 (file)
@@ -108,6 +108,11 @@ struct exynos_camera_params {
 
        char *flash_mode;
        char *flash_mode_values;
+
+       int exposure_compensation;
+       float exposure_compensation_step;
+       int min_exposure_compensation;
+       int max_exposure_compensation;
 };
 
 struct exynos_camera_preset {
@@ -225,6 +230,7 @@ struct exynos_camera {
        int focus_y;
        int zoom;
        int flash_mode;
+       int exposure_compensation;
        int metering;
 };