summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorghepeu <ghepeu@gmail.com>2013-05-10 14:19:23 +0200
committerghepeu <ghepeu@gmail.com>2013-05-10 14:27:52 +0200
commitcfaad78bbb6b4cb19eaff2782a82a22131fba823 (patch)
tree43f18d56ef08adea85aeb378b47fca9fb8a88f17
parent2b8a73fc5c090e5d1c418f902fd27d0398ef7921 (diff)
downloadandroid_hardware_samsung-cfaad78bbb6b4cb19eaff2782a82a22131fba823.tar.gz
android_hardware_samsung-cfaad78bbb6b4cb19eaff2782a82a22131fba823.tar.bz2
android_hardware_samsung-cfaad78bbb6b4cb19eaff2782a82a22131fba823.zip
exynos4: hal: include: Exif.h: always keep two decimal places in macros
The APEX macros always rounded to int, losing too much precision. Ensure that we always keep at least two decimal digits. The more precise F-number comes from the value recorded by the camera closed source driver. Added a new macro APEX_SHUTTER_TO_EXPOSURE(x) (credit to tryptophane). Change-Id: Ief43c15c6517d8dc48d4d4bc9e93df9eb01e6b91
-rw-r--r--exynos4/hal/include/Exif.h15
1 files changed, 8 insertions, 7 deletions
diff --git a/exynos4/hal/include/Exif.h b/exynos4/hal/include/Exif.h
index 71e2241..6bf3730 100644
--- a/exynos4/hal/include/Exif.h
+++ b/exynos4/hal/include/Exif.h
@@ -20,11 +20,12 @@
#include <math.h>
#define EXIF_LOG2(x) (log((double)(x)) / log(2.0))
-#define APEX_FNUM_TO_APERTURE(x) ((int)(EXIF_LOG2((double)(x)) * 2 + 0.5))
+#define APEX_FNUM_TO_APERTURE(x) ((int)(EXIF_LOG2((double)(x)) * 200.0 + 0.5))
#define APEX_EXPOSURE_TO_SHUTTER(x) ((x) >= 1 ? \
- (int)(-(EXIF_LOG2((double)(x)) + 0.5)) : \
- (int)(-(EXIF_LOG2((double)(x)) - 0.5)))
-#define APEX_ISO_TO_FILMSENSITIVITY(x) ((int)(EXIF_LOG2((x) / 3.125) + 0.5))
+ (int)(-(EXIF_LOG2((double)(x)) * 100.0 + 0.5)) : \
+ (int)(-(EXIF_LOG2((double)(x)) * 100.0 - 0.5)))
+#define APEX_ISO_TO_FILMSENSITIVITY(x) ((int)(EXIF_LOG2((x) / 3.125) * 100.0 + 0.5))
+#define APEX_SHUTTER_TO_EXPOSURE(x) ((int)((pow(2.0, (double)(x) / 100.0)) + 0.5))
#define NUM_SIZE 2
#define IFD_SIZE 12
@@ -147,15 +148,15 @@ typedef enum {
#define EXIF_DEF_USERCOMMENTS "User comments"
#define EXIF_DEF_YCBCR_POSITIONING 1 /* centered */
-#define EXIF_DEF_FNUMBER_NUM 26 /* 2.6 */
-#define EXIF_DEF_FNUMBER_DEN 10
+#define EXIF_DEF_FNUMBER_NUM 265 /* 2.65 */
+#define EXIF_DEF_FNUMBER_DEN 100
#define EXIF_DEF_EXPOSURE_PROGRAM 3 /* aperture priority */
#define EXIF_DEF_FOCAL_LEN_NUM 278 /* 2.78mm */
#define EXIF_DEF_FOCAL_LEN_DEN 100
#define EXIF_DEF_FLASH 0 /* O: off, 1: on*/
#define EXIF_DEF_COLOR_SPACE 1
#define EXIF_DEF_EXPOSURE_MODE EXIF_EXPOSURE_AUTO
-#define EXIF_DEF_APEX_DEN 10
+#define EXIF_DEF_APEX_DEN 100
#define EXIF_DEF_COMPRESSION 6
#define EXIF_DEF_RESOLUTION_NUM 72