From 98d50c6ba12aab110fddb9bbcc97bc3d2d1dd34b Mon Sep 17 00:00:00 2001 From: Javier Ferrer Date: Tue, 17 Sep 2013 23:49:39 +0200 Subject: camera: add image-stabilization parameter Focal will find it and will enable it before taking shot, disabling it after the shot is taken. Change-Id: I476f2d13e6662f211d395d432c855d70ba53d61f --- camera/exynos_camera.c | 32 ++++++++++++++++++++++++++++++++ camera/exynos_camera.h | 4 ++++ 2 files changed, 36 insertions(+) (limited to 'camera') diff --git a/camera/exynos_camera.c b/camera/exynos_camera.c index a6c6d19..0c840dd 100644 --- a/camera/exynos_camera.c +++ b/camera/exynos_camera.c @@ -135,6 +135,9 @@ struct exynos_camera_preset exynos_camera_presets_smdk4x12[] = { .iso = "auto", .iso_values = "auto,ISO100,ISO200,ISO400,ISO800", + + .image_stabilization = "off", + .image_stabilization_values = "on,off", }, .mbus_resolutions = NULL, .mbus_resolutions_count = 0, @@ -210,6 +213,9 @@ struct exynos_camera_preset exynos_camera_presets_smdk4x12[] = { .iso = "auto", .iso_values = "auto", + + .image_stabilization = "off", + .image_stabilization_values = "off", }, .mbus_resolutions = (struct exynos_camera_mbus_resolution *) &exynos_camera_mbus_resolutions_s5k6a3_smdk4x12, .mbus_resolutions_count = 8, @@ -523,6 +529,13 @@ int exynos_camera_params_init(struct exynos_camera *exynos_camera, int id) exynos_param_string_set(exynos_camera, "iso-values", exynos_camera->config->presets[id].params.iso_values); + // Image stabilization (Anti-shake) + + exynos_param_string_set(exynos_camera, "image-stabilization", + exynos_camera->config->presets[id].params.image_stabilization); + exynos_param_string_set(exynos_camera, "image-stabilization-values", + exynos_camera->config->presets[id].params.image_stabilization_values); + // Camera exynos_param_float_set(exynos_camera, "focal-length", @@ -604,6 +617,9 @@ int exynos_camera_params_apply(struct exynos_camera *exynos_camera, int force) char *iso_string; int iso; + char *image_stabilization_string; + int image_stabilization; + int w, h; char *k; int rc; @@ -1072,6 +1088,22 @@ int exynos_camera_params_apply(struct exynos_camera *exynos_camera, int force) } } + // Image stabilization (Anti-shake) + + image_stabilization_string = exynos_param_string_get(exynos_camera, "image-stabilization"); + if (image_stabilization_string != NULL) { + if (strcmp(image_stabilization_string, "on") == 0) + image_stabilization = ANTI_SHAKE_STILL_ON; + else + image_stabilization = ANTI_SHAKE_OFF; + + if (image_stabilization != exynos_camera->image_stabilization || force) { + exynos_camera->image_stabilization = image_stabilization; + rc = exynos_v4l2_s_ctrl(exynos_camera, 0, V4L2_CID_CAMERA_ANTI_SHAKE, image_stabilization); + if (rc < 0) + ALOGE("%s: Unable to set image-stabilization", __func__); + } + } ALOGD("%s: Preview size: %dx%d, picture size: %dx%d, recording size: %dx%d", __func__, preview_width, preview_height, picture_width, picture_height, recording_width, recording_height); return 0; diff --git a/camera/exynos_camera.h b/camera/exynos_camera.h index 9db8dfb..547b90f 100644 --- a/camera/exynos_camera.h +++ b/camera/exynos_camera.h @@ -172,6 +172,9 @@ struct exynos_camera_params { char *iso; char *iso_values; + + char *image_stabilization; // Anti-shake + char *image_stabilization_values; }; struct exynos_camera_preset { @@ -417,6 +420,7 @@ struct exynos_camera { int effect; int iso; int metering; + int image_stabilization; }; struct exynos_camera_addrs { -- cgit v1.1