exif.h
12.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
/*****************************************************************************
* Copyright Statement:
* --------------------
* This software is protected by Copyright and the information contained
* herein is confidential. The software may not be copied and the information
* contained herein may not be used or disclosed except with the written
* permission of MediaTek Inc. (C) 2005
*
* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
* AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
* NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
* SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
*
* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
*
* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
* LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
* RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
* THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
*
*****************************************************************************/
/*****************************************************************************
*
* Filename:
* ---------
* exif.h
*
* Project:
* --------
* MT6226,MT6227,MT6228,MT6229
*
* Description:
* ------------
* This file is intends for Exif encoder.
*
* Author:
* -------
* -------
*
*============================================================================
* HISTORY
* Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*------------------------------------------------------------------------------
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*------------------------------------------------------------------------------
* Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*============================================================================
****************************************************************************/
#ifndef _EXIF_H
#define _EXIF_H
#include "kal_general_types.h"
#if (1) ///(defined(EXIF_SUPPORT))
/* Exif specifiec data types */
typedef kal_uint8 exif_BYTE;
typedef kal_char exif_ASCII;
typedef kal_uint16 exif_SHORT;
typedef kal_uint32 exif_LONG;
typedef exif_LONG exif_RATIONAL[2];
typedef kal_char exif_UNDEFINED;
typedef kal_int32 exif_SLONG;
typedef exif_SLONG exif_SRATIONAL[2];
/* Supported 0th IFD tags */
#define exif_tag_Compression 0x0103
#define exif_tag_ImageDescription 0x010e /* A, Image title */
#define exif_tag_Make 0x010f /* A, Manufacturer of image input equipment */
#define exif_tag_Model 0x0110 /* A, Model of image input equipment */
#define exif_tag_Orientation 0x0112 /* S, Image rotation */
#define exif_tag_XResolution 0x011a /* R, Image resolution in width direction */
#define exif_tag_YResolution 0x011b /* R, Image resolution in height direction */
#define exif_tag_ResolutionUnit 0x0128 /* S, Unit of X and Y resolution */
#define exif_tag_Software 0x0131 /* A, Software used */
#define exif_tag_DateTime 0x0132 /* A, The date and time of image creation */
#define exif_tag_JPEGInterchangeFormat 0x0201
#define exif_tag_JPEGInterchangeFormatLength 0x0202
#define exif_tag_YCbCrPositioning 0x0213 /* S, Y and C positioning */
#define exif_tag_ExifIFD 0x8769 /* L, Exif IFD Pointer */
/* Supported Exif IFD tags */
#define exif_tag_ExposureTime 0x829a /* R, Exposure time */
#define exif_tag_FNumber 0x829d /* R, F number */
#define exif_tag_ExposureProgram 0x8822 /* S, Exposure Program */
#define exif_tag_ISOSpeedRatings 0x8827 /* S, ISO speed ratings */
#define exif_tag_ExifVersion 0x9000 /* U, Exif Version */
#define exif_tag_DateTimeOriginal 0x9003 /* A, Date and time original image was generated */
#define exif_tag_DateTimeDigitized 0x9004 /* A, Date and time image was made digital data */
#define exif_tag_ComponentsConfig 0x9101 /* U, Meaning of each component */
#define exif_tag_ExposureBiasValue 0x9204 /* SR, Exposure bias */
#define exif_tag_MeteringMode 0x9207 /* S, Metering mode */
#define exif_tag_LightSource 0x9208 /* S, Light source */
#define exif_tag_Flash 0x9209 /* S, Flash */
#define exif_tag_MakerNote 0x927c /* U, Manufacturer notes */
#define exif_tag_UserComment 0x9286 /* U, User comments */
#define exif_tag_FlashpixVersion 0xa000 /* U, Supported Flashpix version */
#define exif_tag_ColorSpace 0xa001 /* S, Color space information */
#define exif_tag_PixelXDimension 0xa002 /* L, Valid image width */
#define exif_tag_PixelYDimension 0xa003 /* L, Valid image height */
#define exif_tag_ExposureMode 0xa402 /* S, Exposure mode */
#define exif_tag_DigitalZoomRatio 0xa404 /* R, Digital zoom ratio */
#define exif_tag_SceneCaptureType 0xa406 /* S, Scene capture type */
/* Supported IFD Interoperability tags */
#define exif_tag_InteroperabilityIFDPointer 0xa005
#define exif_tag_InteroperabilityIndex 0x0001
#define exif_tag_MAXIMUM 65535
#define EXIF_HEADER_SIZE 10
#define TIFF_HEADER_SIZE 8
#define EXIF_MAXIMUM_NUMBER_OF_EXIFD_ENTRIES 32
#define EXIF_MAXIMUM_SIZE 60*1024
/* MTK specific tags, version: 0.1 */
#define exif_MTK_specific_ver_main 0
#define exif_MTK_specific_ver_fraction 1
/******** Exif Parser ********/
#define EXIF_BIG_ENDIAN 0x4d4d
#define EXIF_LITTLE_ENDIAN 0x4949
#define EXIF_PARSER_BUFFER_SIZE 256
#define EXIF_RATIONAL_PRECISION "%1.2f"
/* Show Length of each type of tag, '\0' included */
#define EXIF_BYTE_SHOW_LEN 4
#define EXIF_ASCII_SHOW_LEN 35
#define EXIF_UNDEFINED_SHOW_LEN 20
#define EXIF_SHORT_SHOW_LEN 8
#define EXIF_LONG_SHOW_LEN 14
#define EXIF_SLONG_SHOW_LEN 14
#define EXIF_RATIONAL_SHOW_LEN 24
#define EXIF_SRATIONAL_SHOW_LEN 24
#define EXIF_DEC_Orientation_MAX_LEN 11
#define EXIF_DEC_ResolutionUnit_MAX_LEN 12
#define EXIF_DEC_YCbCrPositioning_MAX_LEN 9
#define EXIF_DEC_ExposureProgram_MAX_LEN 18
#define EXIF_DEC_ComponentsConfig_MAX_LEN 6
#define EXIF_DEC_MeteringMode_MAX_LEN 24
#define EXIF_DEC_LightSource_MAX_LEN 17
#define EXIF_DEC_Flash_MAX_LEN 80
#define EXIF_DEC_ColorSpace_MAX_LEN 13
#define EXIF_DEC_ExposureMode_MAX_LEN 16
#define EXIF_DEC_SceneCaptureType_MAX_LEN 12
#define EXIF_MAXIMUM_SHOW_LEN EXIF_ASCII_SHOW_LEN
enum exif_data_type
{
EXIF_BYTE=1,
EXIF_ASCII,
EXIF_SHORT,
EXIF_LONG,
EXIF_RATIONAL,
EXIF_UNDEFINED=7,
EXIF_SLONG=9,
EXIF_SRATIONAL,
/* Used only in tag <UserComment> */
EXIF_JIS,
EXIF_UNICODE
};
enum exif_IFD_type
{
EXIF_IFD0,
EXIF_EXIFIFD,
EXIF_EXIFD,
EXIF_NO_IFD_DEFINE
};
enum exif_IFD_entry_switch
{
EXIF_SWITCH_ON,
EXIF_SWITCH_OFF
};
enum exif_IFD0_Entry
{
EXIF_ORIENTATION,
EXIF_X_RESOLUTION,
EXIF_Y_RESOLUTION,
EXIF_RESOLUTION_UNIT,
EXIF_SOFTWARE,
EXIF_DATETIME,
EXIF_IMAGE_DESCRIPTION,
EXIF_YCBCR_POSITIONING,
EXIF_EXIF_IFD,
IFD0_Number_of_Entry
};
enum exif_EXIFIFD_Entry
{
EXIF_EXPOSURE_TIME,
EXIF_FNUMBER,
EXIF_EXPOSURE_PROGRAM,
EXIF_ISO_SPEED_RATINGS,
EXIF_EXIF_VERSION,
EXIF_DATE_TIME_ORIGINAL,
EXIF_DATE_TIME_DIGITIZED,
EXIF_COMPONENTS_CONFIG,
EXIF_EXPOSURE_BIAS_VALUE,
EXIF_METERING_MODE,
EXIF_LIGHT_SOURCE,
EXIF_FLASH,
EXIF_MAKER_NOTE,
EXIF_FLASHPIX_VERSION,
EXIF_COLOR_SPACE,
EXIF_PIXEL_X_DIMENSION,
EXIF_PIXEL_y_DIMENSION,
EXIF_INTEROPERABILITYIFDPOINTER,
EXIF_EXPOSURE_MODE,
EXIF_DIGITAL_ZOOM_RATIO,
EXIF_SCENE_CAPTURE_TYPE,
ExifIFD_Number_of_Entry
};
enum exif_IFD1_Entry
{
EXIF_IFD1_COMPRESSION,
EXIF_IFD1_X_RESOLUTION,
EXIF_IFD1_Y_RESOLUTION,
EXIF_IFD1_RESOLUTION_UNIT,
EXIF_IFD1_JPEGINTERCHANGEFORMAT,
EXIF_IFD1_JPEGINTERCHANGEFORMATLENGTH,
EXIF_IFD1_YCBCR_POSITIONING,
IFD1_Number_of_Entry
};
enum exif_InteroperabilityIFD_Entry
{
EXIF_INTEROPERABILITYINDEX,
InteroperabilityIFD_Number_of_Entry
};
typedef enum
{
EXIF_DEC_IDLE_STATE,
EXIF_DEC_PREPROCESS_DONE_STATE,
EXIF_DEC_PARSE_DONE_STATE
} EXIF_DEC_STATE;
typedef enum
{
EXIF_DEC_DONE,
EXIF_DEC_BUFFER_OVERFLOW,
EXIF_DEC_FILE_READ_ERROR,
EXIF_FILE_NOT_OPEN
} EXIF_DEC_RESULT;
typedef struct
{
exif_SHORT Compression;
exif_SHORT Orientation;
exif_RATIONAL XResolution;
exif_RATIONAL YResolution;
exif_SHORT ResolutionUnit;
exif_LONG JPEGInterchangeFormat;
exif_LONG JPEGInterchangeFormatLength;
} exif_thumbnail_para_struct;
typedef struct
{
exif_ASCII* InteroperabilityIndex;
} exif_interoperability_para_struct;
typedef struct
{
//exif_ASCII* Make;
//exif_ASCII* Model;
exif_SHORT Orientation;
exif_RATIONAL XResolution;
exif_RATIONAL YResolution;
exif_SHORT ResolutionUnit; /* 2:inches, 3:centermeters */
exif_ASCII* Software;
exif_ASCII* DateTime; /* yyyy:mm:dd hh:mm:ss */
exif_ASCII* ImageDescription;
exif_SHORT YCbCrPositioning; /* 1:centered, 2:co-siteded*/
//exif_LONG ExifIFD;
/* Supported Exif IFD tags */
exif_RATIONAL ExposureTime;
exif_RATIONAL FNumber;
exif_SHORT ExposureProgram;
exif_SHORT ISOSpeedRatings;
exif_UNDEFINED ExifVersion[4];
exif_ASCII* DateTimeOriginal;
exif_ASCII* DateTimeDigitized;
exif_UNDEFINED ComponentsConfig[4]; /* 1230=YCbCr, 4560=RGB */
exif_SRATIONAL ExposureBiasValue;
exif_SHORT MeteringMode;
exif_SHORT LightSource;
exif_SHORT Flash;
exif_UNDEFINED FlashpixVersion[4];
exif_SHORT ColorSpace;
exif_LONG PixelXDimension;
exif_LONG PixelYDimension;
exif_LONG InteroperabilityIFDPointer;
exif_SHORT ExposureMode;
exif_RATIONAL DigitalZoomRatio;
exif_SHORT SceneCaptureType;
} exif_cam_para_struct;
typedef struct
{
kal_char title[10];
kal_uint8 version[2];
kal_uint32 mtk_para[300];
} exif_MTK_para_struct;
typedef struct
{
kal_uint16 tag;
kal_uint16 type;
kal_uint32 count;
void* value;
} exif_entry_struct;
typedef struct
{
kal_uint8 exif_IFD_type;
exif_entry_struct entry;
} exif_extend_entry_struct;
typedef struct
{
kal_uint16 tag;
kal_uint16 type;
kal_uint32 count;
kal_uint32 value;
} exif_dec_entry_struct;
/* Set IFD0, ExifIFD to default values */
exif_cam_para_struct* exif_get_cam_para_struct(void);
exif_MTK_para_struct* exif_get_MTK_para_struct(void);
kal_uint32 eixf_burst_mode_fill_header(kal_uint8* Buffer);
exif_extend_entry_struct* exif_get_custom_specific_IFD(kal_uint8* Number_OF_Entry);
kal_uint32 exif_open_jpeg_file(void* file_name_p);
EXIF_DEC_RESULT exif_parse_jpeg_file(kal_uint8* const Buffer,kal_uint32 BufferSize);
kal_char* exif_get_tag_value(kal_uint16 tag);
void exif_close_jpeg_file(void);
#endif
#if (defined(PICTBRIDGE_SUPPORT))
#define EXIF_JPEG_PARSER_BUFFER_SIZE 32
typedef struct
{
kal_bool progressive;
kal_uint16 image_width;
kal_uint16 image_height;
} exif_header_info_struct;
kal_bool exif_parse_jpeg_header(void* file_name_p,exif_header_info_struct* info);
#endif
#if 0
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
#endif
#endif /* _EXIF_H */