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

index 72236dd..99b0b4b 100644 (file)
@@ -105,6 +105,9 @@ struct exynos_camera_preset exynos_camera_presets_galaxys2[] = {
 
                        .scene_mode = "auto",
                        .scene_mode_values = "auto,portrait,landscape,night,beach,snow,sunset,fireworks,sports,party,candlelight,dusk-dawn,fall-color,back-light,text",
+
+                       .effect = "none",
+                       .effect_values = "none,mono,negative,sepia,aqua",
                },
        },
        {
@@ -163,6 +166,9 @@ struct exynos_camera_preset exynos_camera_presets_galaxys2[] = {
 
                        .scene_mode = NULL,
                        .scene_mode_values = NULL,
+
+                       .effect = NULL,
+                       .effect_values = NULL,
                },
        },
 };
@@ -417,6 +423,12 @@ int exynos_camera_params_init(struct exynos_camera *exynos_camera, int id)
        exynos_param_string_set(exynos_camera, "scene-mode-values",
                exynos_camera->config->presets[id].params.scene_mode_values);
 
+       // Effect
+       exynos_param_string_set(exynos_camera, "effect",
+               exynos_camera->config->presets[id].params.effect);
+       exynos_param_string_set(exynos_camera, "effect-values",
+               exynos_camera->config->presets[id].params.effect_values);
+
        // Camera
        exynos_param_float_set(exynos_camera, "focal-length",
                exynos_camera->config->presets[id].focal_length);
@@ -489,6 +501,9 @@ int exynos_camera_params_apply(struct exynos_camera *exynos_camera)
        char *scene_mode_string;
        int scene_mode;
 
+       char *effect_string;
+       int effect;
+
        char *metering_string;
        int metering;
 
@@ -853,6 +868,30 @@ int exynos_camera_params_apply(struct exynos_camera *exynos_camera)
                }
        }
 
+       // Effect
+       effect_string = exynos_param_string_get(exynos_camera, "effect");
+       if (effect_string != NULL) {
+               if (strcmp(effect_string, "auto") == 0)
+                       effect = IMAGE_EFFECT_NONE;
+               else if (strcmp(effect_string, "mono") == 0)
+                       effect = IMAGE_EFFECT_BNW;
+               else if (strcmp(effect_string, "negative") == 0)
+                       effect = IMAGE_EFFECT_NEGATIVE;
+               else if (strcmp(effect_string, "sepia") == 0)
+                       effect = IMAGE_EFFECT_SEPIA;
+               else if (strcmp(effect_string, "aqua") == 0)
+                       effect = IMAGE_EFFECT_AQUA;
+               else
+                       effect = IMAGE_EFFECT_NONE;
+
+               if (effect != exynos_camera->effect || force) {
+                       exynos_camera->effect = effect;
+                       rc = exynos_v4l2_s_ctrl(exynos_camera, 0, V4L2_CID_CAMERA_EFFECT, effect);
+                       if (rc < 0)
+                               LOGE("%s: s ctrl failed!", __func__);
+               }
+       }
+
        // Metering
        metering_string = exynos_param_string_get(exynos_camera, "metering");
        if (metering_string != NULL) {
index 932d756..f7bfc5f 100644 (file)
@@ -119,6 +119,9 @@ struct exynos_camera_params {
 
        char *scene_mode;
        char *scene_mode_values;
+
+       char *effect;
+       char *effect_values;
 };
 
 struct exynos_camera_preset {
@@ -239,6 +242,7 @@ struct exynos_camera {
        int exposure_compensation;
        int whitebalance;
        int scene_mode;
+       int effect;
        int metering;
 };