3
0

galaxys2-common: camera: exynos_exif.c: fix values of some wrong EXIF tags

* adapt the code to the changes made in Exif.h
 * calculate ExposureTime from the ShutterSpeedValue: the exposure time
   read from the camera doesn't seem to work

Together with changes in Exif.h, this commit fixes ExposureTime, FNumber,
ShutterSpeedValue, ApertureValue, BrightnessValue and MaxApertureValue.

The values now match what was generated by the closed camera driver.

Credits to tryptophane for ExposureTime and ShutterSpeedValue. Thanks to
opaco23 and stone_ship who provided samples.

This commit requires http://review.cyanogenmod.org/37370

Change-Id: I16b606e65e895b98f9679ffb6172869c2cbe741c
This commit is contained in:
ghepeu 2013-05-10 14:33:08 +02:00
parent bcbeb5ebef
commit 5477489722

View File

@ -81,9 +81,9 @@ int exynos_exif_attributes_create_static(struct exynos_camera *exynos_camera,
av = APEX_FNUM_TO_APERTURE((double) exif_attributes->fnumber.num /
exif_attributes->fnumber.den);
exif_attributes->aperture.num = av * EXIF_DEF_APEX_DEN;
exif_attributes->aperture.num = av;
exif_attributes->aperture.den = EXIF_DEF_APEX_DEN;
exif_attributes->max_aperture.num = av * EXIF_DEF_APEX_DEN;
exif_attributes->max_aperture.num = av;
exif_attributes->max_aperture.den = EXIF_DEF_APEX_DEN;
strcpy((char *) exif_attributes->user_comment, EXIF_DEF_USERCOMMENTS);
@ -256,17 +256,20 @@ int exynos_exif_attributes_create_params(struct exynos_camera *exynos_camera,
if (rc < 0)
ALOGE("%s: g ctrl failed!", __func__);
exif_attributes->shutter_speed.num = 1;
exif_attributes->shutter_speed.den = shutter_speed;
exif_attributes->shutter_speed.num = shutter_speed;
exif_attributes->shutter_speed.den = 100;
exposure_time = shutter_speed;
rc = exynos_v4l2_g_ctrl(exynos_camera, 0, V4L2_CID_CAMERA_EXIF_EXPTIME,
&exposure_time);
if (rc < 0)
ALOGE("%s: g ctrl failed!", __func__);
/* the exposure_time value read from the camera doesn't work
* exposure_time = shutter_speed;
* rc = exynos_v4l2_g_ctrl(exynos_camera, 0, V4L2_CID_CAMERA_EXIF_EXPTIME,
* &exposure_time);
* if (rc < 0)
* ALOGE("%s: g ctrl failed!", __func__);
*/
// calculate exposure time from the shutter speed value instead
exif_attributes->exposure_time.num = 1;
exif_attributes->exposure_time.den = exposure_time;
exif_attributes->exposure_time.den = APEX_SHUTTER_TO_EXPOSURE(shutter_speed);
rc = exynos_v4l2_g_ctrl(exynos_camera, 0, V4L2_CID_CAMERA_EXIF_ISO,
&iso_speed);
@ -312,7 +315,7 @@ bv_static:
ev = exposure - EV_DEFAULT;
bv_ioctl:
exif_attributes->brightness.num = bv * EXIF_DEF_APEX_DEN;
exif_attributes->brightness.num = bv;
exif_attributes->brightness.den = EXIF_DEF_APEX_DEN;
if (exynos_camera->scene_mode == SCENE_MODE_BEACH_SNOW) {
@ -572,7 +575,7 @@ int exynos_exif_create(struct exynos_camera *exynos_camera,
pointer += count;
count = exynos_exif_write_data(pointer, EXIF_TAG_APERTURE,
EXIF_TYPE_RATIONAL, 1, &offset, exif_ifd_start, &exif_attributes->aperture, sizeof(exif_attributes->shutter_speed));
EXIF_TYPE_RATIONAL, 1, &offset, exif_ifd_start, &exif_attributes->aperture, sizeof(exif_attributes->aperture));
pointer += count;
count = exynos_exif_write_data(pointer, EXIF_TAG_BRIGHTNESS,