2 * Copyright Samsung Electronics Co.,LTD.
3 * Copyright (C) 2015 The Android Open Source Project
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 // To prevent build conflict with the previous libhwjpeg
19 #ifdef USES_UNIVERSAL_LIBHWJPEG
21 #ifndef __HARDWARE_EXYNOS_EXYNOS_EXIF_H__
22 #define __HARDWARE_EXYNOS_EXYNOS_EXIF_H__
26 #include <sys/types.h>
28 #define EXIF_LOG2(x) (log((double)(x)) / log(2.0))
29 #define APEX_FNUM_TO_APERTURE(x) ((EXIF_LOG2((double)(x))) * 2.0)
30 #define APEX_EXPOSURE_TO_SHUTTER(x) ((x) >= 1 ? \
31 (int)(-(EXIF_LOG2((double)(x)) + 0.5)) : \
32 (int)(-(EXIF_LOG2((double)(x)) - 0.5)))
33 #define APEX_ISO_TO_FILMSENSITIVITY(x) ((int)(EXIF_LOG2((x) / 3.125) + 0.5))
38 #define EXIF_INFO_LIMIT_SIZE 12288
40 #define NUM_0TH_IFD_TIFF 10
41 #define NUM_0TH_IFD_EXIF 29
42 #define NUM_0TH_IFD_INTEROPERABILITY (2)
43 #define NUM_0TH_IFD_GPS 10
44 #define NUM_1TH_IFD_TIFF 9
47 #define EXIF_TYPE_BYTE 1
48 #define EXIF_TYPE_ASCII 2
49 #define EXIF_TYPE_SHORT 3
50 #define EXIF_TYPE_LONG 4
51 #define EXIF_TYPE_RATIONAL 5
52 #define EXIF_TYPE_UNDEFINED 7
53 #define EXIF_TYPE_SLONG 9
54 #define EXIF_TYPE_SRATIONAL 10
56 #define EXIF_FILE_SIZE 28800
58 /* 0th IFD TIFF Tags */
59 #define EXIF_TAG_IMAGE_WIDTH 0x0100
60 #define EXIF_TAG_IMAGE_HEIGHT 0x0101
61 #define EXIF_TAG_MAKE 0x010f
62 #define EXIF_TAG_MODEL 0x0110
63 #define EXIF_TAG_ORIENTATION 0x0112
64 #define EXIF_TAG_SOFTWARE 0x0131
65 #define EXIF_TAG_DATE_TIME 0x0132
66 #define EXIF_TAG_YCBCR_POSITIONING 0x0213
67 #define EXIF_TAG_EXIF_IFD_POINTER 0x8769
68 #define EXIF_TAG_GPS_IFD_POINTER 0x8825
70 /* 0th IFD Exif Private Tags */
71 #define EXIF_TAG_EXPOSURE_TIME 0x829A
72 #define EXIF_TAG_FNUMBER 0x829D
73 #define EXIF_TAG_EXPOSURE_PROGRAM 0x8822
74 #define EXIF_TAG_ISO_SPEED_RATING 0x8827
75 #define EXIF_TAG_EXIF_VERSION 0x9000
76 #define EXIF_TAG_DATE_TIME_ORG 0x9003
77 #define EXIF_TAG_DATE_TIME_DIGITIZE 0x9004
78 #define EXIF_TAG_SHUTTER_SPEED 0x9201
79 #define EXIF_TAG_APERTURE 0x9202
80 #define EXIF_TAG_BRIGHTNESS 0x9203
81 #define EXIF_TAG_EXPOSURE_BIAS 0x9204
82 #define EXIF_TAG_MAX_APERTURE 0x9205
83 #define EXIF_TAG_METERING_MODE 0x9207
84 #define EXIF_TAG_FLASH 0x9209
85 #define EXIF_TAG_FOCAL_LENGTH 0x920A
86 #define EXIF_TAG_MAKER_NOTE 0x927C
87 #define EXIF_TAG_USER_COMMENT 0x9286
88 #define EXIF_TAG_SUBSEC_TIME 0x9290
89 #define EXIF_TAG_SUBSEC_TIME_ORIG 0x9291
90 #define EXIF_TAG_SUBSEC_TIME_DIG 0x9292
91 #define EXIF_TAG_COLOR_SPACE 0xA001
92 #define EXIF_TAG_PIXEL_X_DIMENSION 0xA002
93 #define EXIF_TAG_PIXEL_Y_DIMENSION 0xA003
94 #define EXIF_TAG_RELATED_SOUND_FILE 0xA004
95 #define EXIF_TAG_INTEROPERABILITY 0xA005
96 #define EXIF_TAG_EXPOSURE_MODE 0xA402
97 #define EXIF_TAG_WHITE_BALANCE 0xA403
98 #define EXIF_TAG_FOCA_LENGTH_IN_35MM_FILM 0xA405
99 #define EXIF_TAG_SCENCE_CAPTURE_TYPE 0xA406
100 #define EXIF_TAG_IMAGE_UNIQUE_ID 0xA420
102 /* 0th IFD Interoperability Info Tags */
103 #define EXIF_TAG_INTEROPERABILITY_INDEX 0x0001
104 #define EXIF_TAG_INTEROPERABILITY_VERSION 0x0002
106 /* 0th IFD GPS Info Tags */
107 #define EXIF_TAG_GPS_VERSION_ID 0x0000
108 #define EXIF_TAG_GPS_LATITUDE_REF 0x0001
109 #define EXIF_TAG_GPS_LATITUDE 0x0002
110 #define EXIF_TAG_GPS_LONGITUDE_REF 0x0003
111 #define EXIF_TAG_GPS_LONGITUDE 0x0004
112 #define EXIF_TAG_GPS_ALTITUDE_REF 0x0005
113 #define EXIF_TAG_GPS_ALTITUDE 0x0006
114 #define EXIF_TAG_GPS_TIMESTAMP 0x0007
115 #define EXIF_TAG_GPS_PROCESSING_METHOD 0x001B
116 #define EXIF_TAG_GPS_DATESTAMP 0x001D
118 /* 1th IFD TIFF Tags */
119 #define EXIF_TAG_COMPRESSION_SCHEME 0x0103
120 #define EXIF_TAG_X_RESOLUTION 0x011A
121 #define EXIF_TAG_Y_RESOLUTION 0x011B
122 #define EXIF_TAG_RESOLUTION_UNIT 0x0128
123 #define EXIF_TAG_JPEG_INTERCHANGE_FORMAT 0x0201
124 #define EXIF_TAG_JPEG_INTERCHANGE_FORMAT_LEN 0x0202
127 EXIF_ORIENTATION_UP
= 1,
128 EXIF_ORIENTATION_90
= 6,
129 EXIF_ORIENTATION_180
= 3,
130 EXIF_ORIENTATION_270
= 8,
131 } ExifOrientationType
;
135 EXIF_SCENE_LANDSCAPE
,
138 } CamExifSceneCaptureType
;
141 EXIF_METERING_UNKNOWN
,
142 EXIF_METERING_AVERAGE
,
143 EXIF_METERING_CENTER
,
145 EXIF_METERING_MULTISPOT
,
146 EXIF_METERING_PATTERN
,
147 EXIF_METERING_PARTIAL
,
148 EXIF_METERING_OTHER
= 255,
149 } CamExifMeteringModeType
;
153 EXIF_EXPOSURE_MANUAL
,
154 EXIF_EXPOSURE_AUTO_BRACKET
,
155 } CamExifExposureModeType
;
160 EXIF_WB_INCANDESCENT
,
164 } CamExifWhiteBalanceType
;
167 #define EXIF_DEF_MAKER "Samsung Electronics Co., Ltd." /* testJpegExif on the CTS test. This should match Build.MANUFACTURER */
168 #define EXIF_DEF_MODEL "SAMSUNG"
169 #define EXIF_DEF_SOFTWARE "SAMSUNG"
170 #define EXIF_DEF_EXIF_VERSION "0220"
171 #define EXIF_DEF_USERCOMMENTS "User comments"
173 #define EXIF_DEF_YCBCR_POSITIONING 1 /* centered */
174 #define EXIF_DEF_EXPOSURE_MANUAL 1 /* manual program */
175 #define EXIF_DEF_EXPOSURE_PROGRAM 2 /* normal program */
176 #define EXIF_DEF_FLASH 0 /* O: off, 1: on*/
177 #define EXIF_DEF_COLOR_SPACE 1
178 #define EXIF_DEF_INTEROPERABILITY (0)
179 #define EXIF_DEF_EXPOSURE_MODE EXIF_EXPOSURE_AUTO
180 #define EXIF_DEF_APEX_DEN (100)
182 #define EXIF_DEF_COMPRESSION 6
183 #define EXIF_DEF_RESOLUTION_NUM 72
184 #define EXIF_DEF_RESOLUTION_DEN 1
185 #define EXIF_DEF_RESOLUTION_UNIT 2 /* inches */
187 #define APP_MARKER_4 4
188 #define APP_MARKER_5 5
207 char exif_version
[4];
210 unsigned int maker_note_size
;
211 unsigned char *maker_note
;
212 unsigned int user_comment_size
;
213 unsigned char *user_comment
;
218 uint32_t heightThumb
;
220 uint16_t orientation
;
221 uint16_t ycbcr_positioning
;
222 uint16_t exposure_program
;
223 uint16_t iso_speed_rating
;
224 uint16_t metering_mode
;
226 uint16_t color_space
;
227 uint16_t interoperability_index
;
229 uint16_t exposure_mode
;
230 uint16_t white_balance
;
231 uint16_t focal_length_in_35mm_length
;
232 uint16_t scene_capture_type
;
235 rational_t exposure_time
;
238 rational_t max_aperture
;
239 rational_t focal_length
;
241 srational_t shutter_speed
;
242 srational_t brightness
;
243 srational_t exposure_bias
;
245 char gps_latitude_ref
[2];
246 char gps_longitude_ref
[2];
248 uint8_t gps_version_id
[4];
249 uint8_t gps_altitude_ref
;
251 rational_t gps_latitude
[3];
252 rational_t gps_longitude
[3];
253 rational_t gps_altitude
;
254 rational_t gps_timestamp
[3];
255 char gps_datestamp
[11];
256 char gps_processing_method
[100];
258 rational_t x_resolution
;
259 rational_t y_resolution
;
260 uint16_t resolution_unit
;
261 uint16_t compression_scheme
;
265 int num_of_appmarker
; /* number of app marker */
266 int idx
[15][1]; /* idx[number_of_appmarker][appmarker_number] */
267 char *debugData
[15]; /* 0-base */
268 unsigned int debugSize
[15];
271 bool UpdateDebugData(char *jpeg
, size_t jpeglen
, debug_attribute_t
*debug
);
272 bool UpdateExif(char *jpeg
, size_t jpeglen
, exif_attribute_t
*exif
);
274 #endif /* __HARDWARE_EXYNOS_EXYNOS_EXIF_H__ */
276 #endif //USES_UNIVERSAL_LIBHWJPEG