source: josm/trunk/src/com/drew/metadata/exif/makernotes/CanonMakernoteDirectory.java@ 13722

Last change on this file since 13722 was 13061, checked in by Don-vip, 7 years ago

fix #15505 - update to metadata-extractor 2.10.1

File size: 38.3 KB
Line 
1/*
2 * Copyright 2002-2017 Drew Noakes
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 * More information about this project is available at:
17 *
18 * https://drewnoakes.com/code/exif/
19 * https://github.com/drewnoakes/metadata-extractor
20 */
21package com.drew.metadata.exif.makernotes;
22
23import com.drew.lang.annotations.NotNull;
24import com.drew.metadata.Directory;
25
26import java.util.HashMap;
27
28/**
29 * Describes tags specific to Canon cameras.
30 *
31 * Thanks to Bill Richards for his contribution to this makernote directory.
32 *
33 * Many tag definitions explained here: http://www.ozhiker.com/electronics/pjmt/jpeg_info/canon_mn.html
34 *
35 * @author Drew Noakes https://drewnoakes.com
36 */
37@SuppressWarnings("WeakerAccess")
38public class CanonMakernoteDirectory extends Directory
39{
40 // These TAG_*_ARRAY Exif tags map to arrays of int16 values which are split out into separate 'fake' tags.
41 // When an attempt is made to set one of these on the directory, it is split and the corresponding offset added to the tagType.
42 // So the resulting tag is the offset + the index into the array.
43
44 private static final int TAG_CAMERA_SETTINGS_ARRAY = 0x0001;
45 private static final int TAG_FOCAL_LENGTH_ARRAY = 0x0002;
46// private static final int TAG_FLASH_INFO = 0x0003;
47 private static final int TAG_SHOT_INFO_ARRAY = 0x0004;
48 private static final int TAG_PANORAMA_ARRAY = 0x0005;
49
50 public static final int TAG_CANON_IMAGE_TYPE = 0x0006;
51 public static final int TAG_CANON_FIRMWARE_VERSION = 0x0007;
52 public static final int TAG_CANON_IMAGE_NUMBER = 0x0008;
53 public static final int TAG_CANON_OWNER_NAME = 0x0009;
54 public static final int TAG_CANON_SERIAL_NUMBER = 0x000C;
55 public static final int TAG_CAMERA_INFO_ARRAY = 0x000D; // depends upon model, so leave for now
56 public static final int TAG_CANON_FILE_LENGTH = 0x000E;
57 public static final int TAG_CANON_CUSTOM_FUNCTIONS_ARRAY = 0x000F; // depends upon model, so leave for now
58 public static final int TAG_MODEL_ID = 0x0010;
59 public static final int TAG_MOVIE_INFO_ARRAY = 0x0011; // not currently decoded as not sure we see it in still images
60 private static final int TAG_AF_INFO_ARRAY = 0x0012; // not currently decoded
61 public static final int TAG_THUMBNAIL_IMAGE_VALID_AREA = 0x0013;
62 public static final int TAG_SERIAL_NUMBER_FORMAT = 0x0015;
63 public static final int TAG_SUPER_MACRO = 0x001A;
64 public static final int TAG_DATE_STAMP_MODE = 0x001C;
65 public static final int TAG_MY_COLORS = 0x001D;
66 public static final int TAG_FIRMWARE_REVISION = 0x001E;
67 public static final int TAG_CATEGORIES = 0x0023;
68 public static final int TAG_FACE_DETECT_ARRAY_1 = 0x0024;
69 public static final int TAG_FACE_DETECT_ARRAY_2 = 0x0025;
70 public static final int TAG_AF_INFO_ARRAY_2 = 0x0026;
71 public static final int TAG_IMAGE_UNIQUE_ID = 0x0028;
72
73 public static final int TAG_RAW_DATA_OFFSET = 0x0081;
74 public static final int TAG_ORIGINAL_DECISION_DATA_OFFSET = 0x0083;
75
76 public static final int TAG_CUSTOM_FUNCTIONS_1D_ARRAY = 0x0090; // not currently decoded
77 public static final int TAG_PERSONAL_FUNCTIONS_ARRAY = 0x0091; // not currently decoded
78 public static final int TAG_PERSONAL_FUNCTION_VALUES_ARRAY = 0x0092; // not currently decoded
79 public static final int TAG_FILE_INFO_ARRAY = 0x0093; // not currently decoded
80 public static final int TAG_AF_POINTS_IN_FOCUS_1D = 0x0094;
81 public static final int TAG_LENS_MODEL = 0x0095;
82 public static final int TAG_SERIAL_INFO_ARRAY = 0x0096; // not currently decoded
83 public static final int TAG_DUST_REMOVAL_DATA = 0x0097;
84 public static final int TAG_CROP_INFO = 0x0098; // not currently decoded
85 public static final int TAG_CUSTOM_FUNCTIONS_ARRAY_2 = 0x0099; // not currently decoded
86 public static final int TAG_ASPECT_INFO_ARRAY = 0x009A; // not currently decoded
87 public static final int TAG_PROCESSING_INFO_ARRAY = 0x00A0; // not currently decoded
88 public static final int TAG_TONE_CURVE_TABLE = 0x00A1;
89 public static final int TAG_SHARPNESS_TABLE = 0x00A2;
90 public static final int TAG_SHARPNESS_FREQ_TABLE = 0x00A3;
91 public static final int TAG_WHITE_BALANCE_TABLE = 0x00A4;
92 public static final int TAG_COLOR_BALANCE_ARRAY = 0x00A9; // not currently decoded
93 public static final int TAG_MEASURED_COLOR_ARRAY = 0x00AA; // not currently decoded
94 public static final int TAG_COLOR_TEMPERATURE = 0x00AE;
95 public static final int TAG_CANON_FLAGS_ARRAY = 0x00B0; // not currently decoded
96 public static final int TAG_MODIFIED_INFO_ARRAY = 0x00B1; // not currently decoded
97 public static final int TAG_TONE_CURVE_MATCHING = 0x00B2;
98 public static final int TAG_WHITE_BALANCE_MATCHING = 0x00B3;
99 public static final int TAG_COLOR_SPACE = 0x00B4;
100 public static final int TAG_PREVIEW_IMAGE_INFO_ARRAY = 0x00B6; // not currently decoded
101 public static final int TAG_VRD_OFFSET = 0x00D0;
102 public static final int TAG_SENSOR_INFO_ARRAY = 0x00E0; // not currently decoded
103
104 public static final int TAG_COLOR_DATA_ARRAY_2 = 0x4001; // depends upon camera model, not currently decoded
105 public static final int TAG_CRW_PARAM = 0x4002; // depends upon camera model, not currently decoded
106 public static final int TAG_COLOR_INFO_ARRAY_2 = 0x4003; // not currently decoded
107 public static final int TAG_BLACK_LEVEL = 0x4008; // not currently decoded
108 public static final int TAG_CUSTOM_PICTURE_STYLE_FILE_NAME = 0x4010;
109 public static final int TAG_COLOR_INFO_ARRAY = 0x4013; // not currently decoded
110 public static final int TAG_VIGNETTING_CORRECTION_ARRAY_1 = 0x4015; // not currently decoded
111 public static final int TAG_VIGNETTING_CORRECTION_ARRAY_2 = 0x4016; // not currently decoded
112 public static final int TAG_LIGHTING_OPTIMIZER_ARRAY = 0x4018; // not currently decoded
113 public static final int TAG_LENS_INFO_ARRAY = 0x4019; // not currently decoded
114 public static final int TAG_AMBIANCE_INFO_ARRAY = 0x4020; // not currently decoded
115 public static final int TAG_FILTER_INFO_ARRAY = 0x4024; // not currently decoded
116
117 public final static class CameraSettings
118 {
119 // These 'sub'-tag values have been created for consistency -- they don't exist within the exif segment
120 private static final int OFFSET = 0xC100;
121
122 /**
123 * 1 = Macro
124 * 2 = Normal
125 */
126 public static final int TAG_MACRO_MODE = OFFSET + 0x01;
127 public static final int TAG_SELF_TIMER_DELAY = OFFSET + 0x02;
128 /**
129 * 2 = Normal
130 * 3 = Fine
131 * 5 = Superfine
132 */
133 public static final int TAG_QUALITY = OFFSET + 0x03;
134 /**
135 * 0 = Flash Not Fired
136 * 1 = Auto
137 * 2 = On
138 * 3 = Red Eye Reduction
139 * 4 = Slow Synchro
140 * 5 = Auto + Red Eye Reduction
141 * 6 = On + Red Eye Reduction
142 * 16 = External Flash
143 */
144 public static final int TAG_FLASH_MODE = OFFSET + 0x04;
145 /**
146 * 0 = Single Frame or Timer Mode
147 * 1 = Continuous
148 */
149 public static final int TAG_CONTINUOUS_DRIVE_MODE = OFFSET + 0x05;
150 public static final int TAG_UNKNOWN_2 = OFFSET + 0x06;
151 /**
152 * 0 = One-Shot
153 * 1 = AI Servo
154 * 2 = AI Focus
155 * 3 = Manual Focus
156 * 4 = Single
157 * 5 = Continuous
158 * 6 = Manual Focus
159 */
160 public static final int TAG_FOCUS_MODE_1 = OFFSET + 0x07;
161 public static final int TAG_UNKNOWN_3 = OFFSET + 0x08;
162 public static final int TAG_RECORD_MODE = OFFSET + 0x09;
163 /**
164 * 0 = Large
165 * 1 = Medium
166 * 2 = Small
167 */
168 public static final int TAG_IMAGE_SIZE = OFFSET + 0x0A;
169 /**
170 * 0 = Full Auto
171 * 1 = Manual
172 * 2 = Landscape
173 * 3 = Fast Shutter
174 * 4 = Slow Shutter
175 * 5 = Night
176 * 6 = Black & White
177 * 7 = Sepia
178 * 8 = Portrait
179 * 9 = Sports
180 * 10 = Macro / Close-Up
181 * 11 = Pan Focus
182 */
183 public static final int TAG_EASY_SHOOTING_MODE = OFFSET + 0x0B;
184 /**
185 * 0 = No Digital Zoom
186 * 1 = 2x
187 * 2 = 4x
188 */
189 public static final int TAG_DIGITAL_ZOOM = OFFSET + 0x0C;
190 /**
191 * 0 = Normal
192 * 1 = High
193 * 65535 = Low
194 */
195 public static final int TAG_CONTRAST = OFFSET + 0x0D;
196 /**
197 * 0 = Normal
198 * 1 = High
199 * 65535 = Low
200 */
201 public static final int TAG_SATURATION = OFFSET + 0x0E;
202 /**
203 * 0 = Normal
204 * 1 = High
205 * 65535 = Low
206 */
207 public static final int TAG_SHARPNESS = OFFSET + 0x0F;
208 /**
209 * 0 = Check ISOSpeedRatings EXIF tag for ISO Speed
210 * 15 = Auto ISO
211 * 16 = ISO 50
212 * 17 = ISO 100
213 * 18 = ISO 200
214 * 19 = ISO 400
215 */
216 public static final int TAG_ISO = OFFSET + 0x10;
217 /**
218 * 3 = Evaluative
219 * 4 = Partial
220 * 5 = Centre Weighted
221 */
222 public static final int TAG_METERING_MODE = OFFSET + 0x11;
223 /**
224 * 0 = Manual
225 * 1 = Auto
226 * 3 = Close-up (Macro)
227 * 8 = Locked (Pan Mode)
228 */
229 public static final int TAG_FOCUS_TYPE = OFFSET + 0x12;
230 /**
231 * 12288 = None (Manual Focus)
232 * 12289 = Auto Selected
233 * 12290 = Right
234 * 12291 = Centre
235 * 12292 = Left
236 */
237 public static final int TAG_AF_POINT_SELECTED = OFFSET + 0x13;
238 /**
239 * 0 = Easy Shooting (See Easy Shooting Mode)
240 * 1 = Program
241 * 2 = Tv-Priority
242 * 3 = Av-Priority
243 * 4 = Manual
244 * 5 = A-DEP
245 */
246 public static final int TAG_EXPOSURE_MODE = OFFSET + 0x14;
247 public static final int TAG_UNKNOWN_7 = OFFSET + 0x15;
248 public static final int TAG_LENS_TYPE = OFFSET + 0x16;
249 public static final int TAG_LONG_FOCAL_LENGTH = OFFSET + 0x17;
250 public static final int TAG_SHORT_FOCAL_LENGTH = OFFSET + 0x18;
251 public static final int TAG_FOCAL_UNITS_PER_MM = OFFSET + 0x19;
252 public static final int TAG_MAX_APERTURE = OFFSET + 0x1A;
253 public static final int TAG_MIN_APERTURE = OFFSET + 0x1B;
254 /**
255 * 0 = Flash Did Not Fire
256 * 1 = Flash Fired
257 */
258 public static final int TAG_FLASH_ACTIVITY = OFFSET + 0x1C;
259 public static final int TAG_FLASH_DETAILS = OFFSET + 0x1D;
260 public static final int TAG_FOCUS_CONTINUOUS = OFFSET + 0x1E;
261 public static final int TAG_AE_SETTING = OFFSET + 0x1F;
262 /**
263 * 0 = Focus Mode: Single
264 * 1 = Focus Mode: Continuous
265 */
266 public static final int TAG_FOCUS_MODE_2 = OFFSET + 0x20;
267
268 public static final int TAG_DISPLAY_APERTURE = OFFSET + 0x21;
269 public static final int TAG_ZOOM_SOURCE_WIDTH = OFFSET + 0x22;
270 public static final int TAG_ZOOM_TARGET_WIDTH = OFFSET + 0x23;
271
272 public static final int TAG_SPOT_METERING_MODE = OFFSET + 0x25;
273 public static final int TAG_PHOTO_EFFECT = OFFSET + 0x26;
274 public static final int TAG_MANUAL_FLASH_OUTPUT = OFFSET + 0x27;
275
276 public static final int TAG_COLOR_TONE = OFFSET + 0x29;
277 public static final int TAG_SRAW_QUALITY = OFFSET + 0x2D;
278 }
279
280 public final static class FocalLength
281 {
282 // These 'sub'-tag values have been created for consistency -- they don't exist within the exif segment
283
284 private static final int OFFSET = 0xC200;
285
286 /**
287 * 0 = Auto
288 * 1 = Sunny
289 * 2 = Cloudy
290 * 3 = Tungsten
291 * 4 = Florescent
292 * 5 = Flash
293 * 6 = Custom
294 */
295 public static final int TAG_WHITE_BALANCE = OFFSET + 0x07;
296 public static final int TAG_SEQUENCE_NUMBER = OFFSET + 0x09;
297 public static final int TAG_AF_POINT_USED = OFFSET + 0x0E;
298 /**
299 * The value of this tag may be translated into a flash bias value, in EV.
300 *
301 * 0xffc0 = -2 EV
302 * 0xffcc = -1.67 EV
303 * 0xffd0 = -1.5 EV
304 * 0xffd4 = -1.33 EV
305 * 0xffe0 = -1 EV
306 * 0xffec = -0.67 EV
307 * 0xfff0 = -0.5 EV
308 * 0xfff4 = -0.33 EV
309 * 0x0000 = 0 EV
310 * 0x000c = 0.33 EV
311 * 0x0010 = 0.5 EV
312 * 0x0014 = 0.67 EV
313 * 0x0020 = 1 EV
314 * 0x002c = 1.33 EV
315 * 0x0030 = 1.5 EV
316 * 0x0034 = 1.67 EV
317 * 0x0040 = 2 EV
318 */
319 public static final int TAG_FLASH_BIAS = OFFSET + 0x0F;
320 public static final int TAG_AUTO_EXPOSURE_BRACKETING = OFFSET + 0x10;
321 public static final int TAG_AEB_BRACKET_VALUE = OFFSET + 0x11;
322 public static final int TAG_SUBJECT_DISTANCE = OFFSET + 0x13;
323 }
324
325 public final static class ShotInfo
326 {
327 // These 'sub'-tag values have been created for consistency -- they don't exist within the exif segment
328
329 private static final int OFFSET = 0xC400;
330
331 public static final int TAG_AUTO_ISO = OFFSET + 1;
332 public static final int TAG_BASE_ISO = OFFSET + 2;
333 public static final int TAG_MEASURED_EV = OFFSET + 3;
334 public static final int TAG_TARGET_APERTURE = OFFSET + 4;
335 public static final int TAG_TARGET_EXPOSURE_TIME = OFFSET + 5;
336 public static final int TAG_EXPOSURE_COMPENSATION = OFFSET + 6;
337 public static final int TAG_WHITE_BALANCE = OFFSET + 7;
338 public static final int TAG_SLOW_SHUTTER = OFFSET + 8;
339 public static final int TAG_SEQUENCE_NUMBER = OFFSET + 9;
340 public static final int TAG_OPTICAL_ZOOM_CODE = OFFSET + 10;
341 public static final int TAG_CAMERA_TEMPERATURE = OFFSET + 12;
342 public static final int TAG_FLASH_GUIDE_NUMBER = OFFSET + 13;
343 public static final int TAG_AF_POINTS_IN_FOCUS = OFFSET + 14;
344 public static final int TAG_FLASH_EXPOSURE_BRACKETING = OFFSET + 15;
345 public static final int TAG_AUTO_EXPOSURE_BRACKETING = OFFSET + 16;
346 public static final int TAG_AEB_BRACKET_VALUE = OFFSET + 17;
347 public static final int TAG_CONTROL_MODE = OFFSET + 18;
348 public static final int TAG_FOCUS_DISTANCE_UPPER = OFFSET + 19;
349 public static final int TAG_FOCUS_DISTANCE_LOWER = OFFSET + 20;
350 public static final int TAG_F_NUMBER = OFFSET + 21;
351 public static final int TAG_EXPOSURE_TIME = OFFSET + 22;
352 public static final int TAG_MEASURED_EV_2 = OFFSET + 23;
353 public static final int TAG_BULB_DURATION = OFFSET + 24;
354 public static final int TAG_CAMERA_TYPE = OFFSET + 26;
355 public static final int TAG_AUTO_ROTATE = OFFSET + 27;
356 public static final int TAG_ND_FILTER = OFFSET + 28;
357 public static final int TAG_SELF_TIMER_2 = OFFSET + 29;
358 public static final int TAG_FLASH_OUTPUT = OFFSET + 33;
359 }
360
361 public final static class Panorama
362 {
363 // These 'sub'-tag values have been created for consistency -- they don't exist within the exif segment
364
365 private static final int OFFSET = 0xC500;
366
367 public static final int TAG_PANORAMA_FRAME_NUMBER = OFFSET + 2;
368 public static final int TAG_PANORAMA_DIRECTION = OFFSET + 5;
369 }
370
371 public final static class AFInfo
372 {
373 // These 'sub'-tag values have been created for consistency -- they don't exist within the exif segment
374
375 private static final int OFFSET = 0xD200;
376
377 public static final int TAG_NUM_AF_POINTS = OFFSET;
378 public static final int TAG_VALID_AF_POINTS = OFFSET + 1;
379 public static final int TAG_IMAGE_WIDTH = OFFSET + 2;
380 public static final int TAG_IMAGE_HEIGHT = OFFSET + 3;
381 public static final int TAG_AF_IMAGE_WIDTH = OFFSET + 4;
382 public static final int TAG_AF_IMAGE_HEIGHT = OFFSET + 5;
383 public static final int TAG_AF_AREA_WIDTH = OFFSET + 6;
384 public static final int TAG_AF_AREA_HEIGHT = OFFSET + 7;
385 public static final int TAG_AF_AREA_X_POSITIONS = OFFSET + 8;
386 public static final int TAG_AF_AREA_Y_POSITIONS = OFFSET + 9;
387 public static final int TAG_AF_POINTS_IN_FOCUS = OFFSET + 10;
388 public static final int TAG_PRIMARY_AF_POINT_1 = OFFSET + 11;
389 public static final int TAG_PRIMARY_AF_POINT_2 = OFFSET + 12; // not sure why there are two of these
390 }
391
392// /**
393// * Long Exposure Noise Reduction
394// * 0 = Off
395// * 1 = On
396// */
397// public static final int TAG_CANON_CUSTOM_FUNCTION_LONG_EXPOSURE_NOISE_REDUCTION = 0xC301;
398//
399// /**
400// * Shutter/Auto Exposure-lock buttons
401// * 0 = AF/AE lock
402// * 1 = AE lock/AF
403// * 2 = AF/AF lock
404// * 3 = AE+release/AE+AF
405// */
406// public static final int TAG_CANON_CUSTOM_FUNCTION_SHUTTER_AUTO_EXPOSURE_LOCK_BUTTONS = 0xC302;
407//
408// /**
409// * Mirror lockup
410// * 0 = Disable
411// * 1 = Enable
412// */
413// public static final int TAG_CANON_CUSTOM_FUNCTION_MIRROR_LOCKUP = 0xC303;
414//
415// /**
416// * Tv/Av and exposure level
417// * 0 = 1/2 stop
418// * 1 = 1/3 stop
419// */
420// public static final int TAG_CANON_CUSTOM_FUNCTION_TV_AV_AND_EXPOSURE_LEVEL = 0xC304;
421//
422// /**
423// * AF-assist light
424// * 0 = On (Auto)
425// * 1 = Off
426// */
427// public static final int TAG_CANON_CUSTOM_FUNCTION_AF_ASSIST_LIGHT = 0xC305;
428//
429// /**
430// * Shutter speed in Av mode
431// * 0 = Automatic
432// * 1 = 1/200 (fixed)
433// */
434// public static final int TAG_CANON_CUSTOM_FUNCTION_SHUTTER_SPEED_IN_AV_MODE = 0xC306;
435//
436// /**
437// * Auto-Exposure Bracketing sequence/auto cancellation
438// * 0 = 0,-,+ / Enabled
439// * 1 = 0,-,+ / Disabled
440// * 2 = -,0,+ / Enabled
441// * 3 = -,0,+ / Disabled
442// */
443// public static final int TAG_CANON_CUSTOM_FUNCTION_BRACKETING = 0xC307;
444//
445// /**
446// * Shutter Curtain Sync
447// * 0 = 1st Curtain Sync
448// * 1 = 2nd Curtain Sync
449// */
450// public static final int TAG_CANON_CUSTOM_FUNCTION_SHUTTER_CURTAIN_SYNC = 0xC308;
451//
452// /**
453// * Lens Auto-Focus stop button Function Switch
454// * 0 = AF stop
455// * 1 = Operate AF
456// * 2 = Lock AE and start timer
457// */
458// public static final int TAG_CANON_CUSTOM_FUNCTION_AF_STOP = 0xC309;
459//
460// /**
461// * Auto reduction of fill flash
462// * 0 = Enable
463// * 1 = Disable
464// */
465// public static final int TAG_CANON_CUSTOM_FUNCTION_FILL_FLASH_REDUCTION = 0xC30A;
466//
467// /**
468// * Menu button return position
469// * 0 = Top
470// * 1 = Previous (volatile)
471// * 2 = Previous
472// */
473// public static final int TAG_CANON_CUSTOM_FUNCTION_MENU_BUTTON_RETURN = 0xC30B;
474//
475// /**
476// * SET button function when shooting
477// * 0 = Not Assigned
478// * 1 = Change Quality
479// * 2 = Change ISO Speed
480// * 3 = Select Parameters
481// */
482// public static final int TAG_CANON_CUSTOM_FUNCTION_SET_BUTTON_FUNCTION = 0xC30C;
483//
484// /**
485// * Sensor cleaning
486// * 0 = Disable
487// * 1 = Enable
488// */
489// public static final int TAG_CANON_CUSTOM_FUNCTION_SENSOR_CLEANING = 0xC30D;
490
491 @NotNull
492 protected static final HashMap<Integer, String> _tagNameMap = new HashMap<Integer, String>();
493
494 static
495 {
496 _tagNameMap.put(TAG_CANON_FIRMWARE_VERSION, "Firmware Version");
497 _tagNameMap.put(TAG_CANON_IMAGE_NUMBER, "Image Number");
498 _tagNameMap.put(TAG_CANON_IMAGE_TYPE, "Image Type");
499 _tagNameMap.put(TAG_CANON_OWNER_NAME, "Owner Name");
500 _tagNameMap.put(TAG_CANON_SERIAL_NUMBER, "Camera Serial Number");
501 _tagNameMap.put(TAG_CAMERA_INFO_ARRAY, "Camera Info Array");
502 _tagNameMap.put(TAG_CANON_FILE_LENGTH, "File Length");
503 _tagNameMap.put(TAG_CANON_CUSTOM_FUNCTIONS_ARRAY, "Custom Functions");
504 _tagNameMap.put(TAG_MODEL_ID, "Canon Model ID");
505 _tagNameMap.put(TAG_MOVIE_INFO_ARRAY, "Movie Info Array");
506
507 _tagNameMap.put(CameraSettings.TAG_AF_POINT_SELECTED, "AF Point Selected");
508 _tagNameMap.put(CameraSettings.TAG_CONTINUOUS_DRIVE_MODE, "Continuous Drive Mode");
509 _tagNameMap.put(CameraSettings.TAG_CONTRAST, "Contrast");
510 _tagNameMap.put(CameraSettings.TAG_EASY_SHOOTING_MODE, "Easy Shooting Mode");
511 _tagNameMap.put(CameraSettings.TAG_EXPOSURE_MODE, "Exposure Mode");
512 _tagNameMap.put(CameraSettings.TAG_FLASH_DETAILS, "Flash Details");
513 _tagNameMap.put(CameraSettings.TAG_FLASH_MODE, "Flash Mode");
514 _tagNameMap.put(CameraSettings.TAG_FOCAL_UNITS_PER_MM, "Focal Units per mm");
515 _tagNameMap.put(CameraSettings.TAG_FOCUS_MODE_1, "Focus Mode");
516 _tagNameMap.put(CameraSettings.TAG_FOCUS_MODE_2, "Focus Mode");
517 _tagNameMap.put(CameraSettings.TAG_IMAGE_SIZE, "Image Size");
518 _tagNameMap.put(CameraSettings.TAG_ISO, "Iso");
519 _tagNameMap.put(CameraSettings.TAG_LONG_FOCAL_LENGTH, "Long Focal Length");
520 _tagNameMap.put(CameraSettings.TAG_MACRO_MODE, "Macro Mode");
521 _tagNameMap.put(CameraSettings.TAG_METERING_MODE, "Metering Mode");
522 _tagNameMap.put(CameraSettings.TAG_SATURATION, "Saturation");
523 _tagNameMap.put(CameraSettings.TAG_SELF_TIMER_DELAY, "Self Timer Delay");
524 _tagNameMap.put(CameraSettings.TAG_SHARPNESS, "Sharpness");
525 _tagNameMap.put(CameraSettings.TAG_SHORT_FOCAL_LENGTH, "Short Focal Length");
526 _tagNameMap.put(CameraSettings.TAG_QUALITY, "Quality");
527 _tagNameMap.put(CameraSettings.TAG_UNKNOWN_2, "Unknown Camera Setting 2");
528 _tagNameMap.put(CameraSettings.TAG_UNKNOWN_3, "Unknown Camera Setting 3");
529 _tagNameMap.put(CameraSettings.TAG_RECORD_MODE, "Record Mode");
530 _tagNameMap.put(CameraSettings.TAG_DIGITAL_ZOOM, "Digital Zoom");
531 _tagNameMap.put(CameraSettings.TAG_FOCUS_TYPE, "Focus Type");
532 _tagNameMap.put(CameraSettings.TAG_UNKNOWN_7, "Unknown Camera Setting 7");
533 _tagNameMap.put(CameraSettings.TAG_LENS_TYPE, "Lens Type");
534 _tagNameMap.put(CameraSettings.TAG_MAX_APERTURE, "Max Aperture");
535 _tagNameMap.put(CameraSettings.TAG_MIN_APERTURE, "Min Aperture");
536 _tagNameMap.put(CameraSettings.TAG_FLASH_ACTIVITY, "Flash Activity");
537 _tagNameMap.put(CameraSettings.TAG_FOCUS_CONTINUOUS, "Focus Continuous");
538 _tagNameMap.put(CameraSettings.TAG_AE_SETTING, "AE Setting");
539 _tagNameMap.put(CameraSettings.TAG_DISPLAY_APERTURE, "Display Aperture");
540 _tagNameMap.put(CameraSettings.TAG_ZOOM_SOURCE_WIDTH, "Zoom Source Width");
541 _tagNameMap.put(CameraSettings.TAG_ZOOM_TARGET_WIDTH, "Zoom Target Width");
542 _tagNameMap.put(CameraSettings.TAG_SPOT_METERING_MODE, "Spot Metering Mode");
543 _tagNameMap.put(CameraSettings.TAG_PHOTO_EFFECT, "Photo Effect");
544 _tagNameMap.put(CameraSettings.TAG_MANUAL_FLASH_OUTPUT, "Manual Flash Output");
545 _tagNameMap.put(CameraSettings.TAG_COLOR_TONE, "Color Tone");
546 _tagNameMap.put(CameraSettings.TAG_SRAW_QUALITY, "SRAW Quality");
547
548 _tagNameMap.put(FocalLength.TAG_WHITE_BALANCE, "White Balance");
549 _tagNameMap.put(FocalLength.TAG_SEQUENCE_NUMBER, "Sequence Number");
550 _tagNameMap.put(FocalLength.TAG_AF_POINT_USED, "AF Point Used");
551 _tagNameMap.put(FocalLength.TAG_FLASH_BIAS, "Flash Bias");
552 _tagNameMap.put(FocalLength.TAG_AUTO_EXPOSURE_BRACKETING, "Auto Exposure Bracketing");
553 _tagNameMap.put(FocalLength.TAG_AEB_BRACKET_VALUE, "AEB Bracket Value");
554 _tagNameMap.put(FocalLength.TAG_SUBJECT_DISTANCE, "Subject Distance");
555
556 _tagNameMap.put(ShotInfo.TAG_AUTO_ISO, "Auto ISO");
557 _tagNameMap.put(ShotInfo.TAG_BASE_ISO, "Base ISO");
558 _tagNameMap.put(ShotInfo.TAG_MEASURED_EV, "Measured EV");
559 _tagNameMap.put(ShotInfo.TAG_TARGET_APERTURE, "Target Aperture");
560 _tagNameMap.put(ShotInfo.TAG_TARGET_EXPOSURE_TIME, "Target Exposure Time");
561 _tagNameMap.put(ShotInfo.TAG_EXPOSURE_COMPENSATION, "Exposure Compensation");
562 _tagNameMap.put(ShotInfo.TAG_WHITE_BALANCE, "White Balance");
563 _tagNameMap.put(ShotInfo.TAG_SLOW_SHUTTER, "Slow Shutter");
564 _tagNameMap.put(ShotInfo.TAG_SEQUENCE_NUMBER, "Sequence Number");
565 _tagNameMap.put(ShotInfo.TAG_OPTICAL_ZOOM_CODE, "Optical Zoom Code");
566 _tagNameMap.put(ShotInfo.TAG_CAMERA_TEMPERATURE, "Camera Temperature");
567 _tagNameMap.put(ShotInfo.TAG_FLASH_GUIDE_NUMBER, "Flash Guide Number");
568 _tagNameMap.put(ShotInfo.TAG_AF_POINTS_IN_FOCUS, "AF Points in Focus");
569 _tagNameMap.put(ShotInfo.TAG_FLASH_EXPOSURE_BRACKETING, "Flash Exposure Compensation");
570 _tagNameMap.put(ShotInfo.TAG_AUTO_EXPOSURE_BRACKETING, "Auto Exposure Bracketing");
571 _tagNameMap.put(ShotInfo.TAG_AEB_BRACKET_VALUE, "AEB Bracket Value");
572 _tagNameMap.put(ShotInfo.TAG_CONTROL_MODE, "Control Mode");
573 _tagNameMap.put(ShotInfo.TAG_FOCUS_DISTANCE_UPPER, "Focus Distance Upper");
574 _tagNameMap.put(ShotInfo.TAG_FOCUS_DISTANCE_LOWER, "Focus Distance Lower");
575 _tagNameMap.put(ShotInfo.TAG_F_NUMBER, "F Number");
576 _tagNameMap.put(ShotInfo.TAG_EXPOSURE_TIME, "Exposure Time");
577 _tagNameMap.put(ShotInfo.TAG_MEASURED_EV_2, "Measured EV 2");
578 _tagNameMap.put(ShotInfo.TAG_BULB_DURATION, "Bulb Duration");
579 _tagNameMap.put(ShotInfo.TAG_CAMERA_TYPE, "Camera Type");
580 _tagNameMap.put(ShotInfo.TAG_AUTO_ROTATE, "Auto Rotate");
581 _tagNameMap.put(ShotInfo.TAG_ND_FILTER, "ND Filter");
582 _tagNameMap.put(ShotInfo.TAG_SELF_TIMER_2, "Self Timer 2");
583 _tagNameMap.put(ShotInfo.TAG_FLASH_OUTPUT, "Flash Output");
584
585 _tagNameMap.put(Panorama.TAG_PANORAMA_FRAME_NUMBER, "Panorama Frame Number");
586 _tagNameMap.put(Panorama.TAG_PANORAMA_DIRECTION, "Panorama Direction");
587
588 _tagNameMap.put(AFInfo.TAG_NUM_AF_POINTS, "AF Point Count");
589 _tagNameMap.put(AFInfo.TAG_VALID_AF_POINTS, "Valid AF Point Count");
590 _tagNameMap.put(AFInfo.TAG_IMAGE_WIDTH, "Image Width");
591 _tagNameMap.put(AFInfo.TAG_IMAGE_HEIGHT, "Image Height");
592 _tagNameMap.put(AFInfo.TAG_AF_IMAGE_WIDTH, "AF Image Width");
593 _tagNameMap.put(AFInfo.TAG_AF_IMAGE_HEIGHT, "AF Image Height");
594 _tagNameMap.put(AFInfo.TAG_AF_AREA_WIDTH, "AF Area Width");
595 _tagNameMap.put(AFInfo.TAG_AF_AREA_HEIGHT, "AF Area Height");
596 _tagNameMap.put(AFInfo.TAG_AF_AREA_X_POSITIONS, "AF Area X Positions");
597 _tagNameMap.put(AFInfo.TAG_AF_AREA_Y_POSITIONS, "AF Area Y Positions");
598 _tagNameMap.put(AFInfo.TAG_AF_POINTS_IN_FOCUS, "AF Points in Focus");
599 _tagNameMap.put(AFInfo.TAG_PRIMARY_AF_POINT_1, "Primary AF Point 1");
600 _tagNameMap.put(AFInfo.TAG_PRIMARY_AF_POINT_2, "Primary AF Point 2");
601
602// _tagNameMap.put(TAG_CANON_CUSTOM_FUNCTION_LONG_EXPOSURE_NOISE_REDUCTION, "Long Exposure Noise Reduction");
603// _tagNameMap.put(TAG_CANON_CUSTOM_FUNCTION_SHUTTER_AUTO_EXPOSURE_LOCK_BUTTONS, "Shutter/Auto Exposure-lock Buttons");
604// _tagNameMap.put(TAG_CANON_CUSTOM_FUNCTION_MIRROR_LOCKUP, "Mirror Lockup");
605// _tagNameMap.put(TAG_CANON_CUSTOM_FUNCTION_TV_AV_AND_EXPOSURE_LEVEL, "Tv/Av And Exposure Level");
606// _tagNameMap.put(TAG_CANON_CUSTOM_FUNCTION_AF_ASSIST_LIGHT, "AF-Assist Light");
607// _tagNameMap.put(TAG_CANON_CUSTOM_FUNCTION_SHUTTER_SPEED_IN_AV_MODE, "Shutter Speed in Av Mode");
608// _tagNameMap.put(TAG_CANON_CUSTOM_FUNCTION_BRACKETING, "Auto-Exposure Bracketing Sequence/Auto Cancellation");
609// _tagNameMap.put(TAG_CANON_CUSTOM_FUNCTION_SHUTTER_CURTAIN_SYNC, "Shutter Curtain Sync");
610// _tagNameMap.put(TAG_CANON_CUSTOM_FUNCTION_AF_STOP, "Lens Auto-Focus Stop Button Function Switch");
611// _tagNameMap.put(TAG_CANON_CUSTOM_FUNCTION_FILL_FLASH_REDUCTION, "Auto Reduction of Fill Flash");
612// _tagNameMap.put(TAG_CANON_CUSTOM_FUNCTION_MENU_BUTTON_RETURN, "Menu Button Return Position");
613// _tagNameMap.put(TAG_CANON_CUSTOM_FUNCTION_SET_BUTTON_FUNCTION, "SET Button Function When Shooting");
614// _tagNameMap.put(TAG_CANON_CUSTOM_FUNCTION_SENSOR_CLEANING, "Sensor Cleaning");
615
616 _tagNameMap.put(TAG_THUMBNAIL_IMAGE_VALID_AREA, "Thumbnail Image Valid Area");
617 _tagNameMap.put(TAG_SERIAL_NUMBER_FORMAT, "Serial Number Format");
618 _tagNameMap.put(TAG_SUPER_MACRO, "Super Macro");
619 _tagNameMap.put(TAG_DATE_STAMP_MODE, "Date Stamp Mode");
620 _tagNameMap.put(TAG_MY_COLORS, "My Colors");
621 _tagNameMap.put(TAG_FIRMWARE_REVISION, "Firmware Revision");
622 _tagNameMap.put(TAG_CATEGORIES, "Categories");
623 _tagNameMap.put(TAG_FACE_DETECT_ARRAY_1, "Face Detect Array 1");
624 _tagNameMap.put(TAG_FACE_DETECT_ARRAY_2, "Face Detect Array 2");
625 _tagNameMap.put(TAG_AF_INFO_ARRAY_2, "AF Info Array 2");
626 _tagNameMap.put(TAG_IMAGE_UNIQUE_ID, "Image Unique ID");
627 _tagNameMap.put(TAG_RAW_DATA_OFFSET, "Raw Data Offset");
628 _tagNameMap.put(TAG_ORIGINAL_DECISION_DATA_OFFSET, "Original Decision Data Offset");
629 _tagNameMap.put(TAG_CUSTOM_FUNCTIONS_1D_ARRAY, "Custom Functions (1D) Array");
630 _tagNameMap.put(TAG_PERSONAL_FUNCTIONS_ARRAY, "Personal Functions Array");
631 _tagNameMap.put(TAG_PERSONAL_FUNCTION_VALUES_ARRAY, "Personal Function Values Array");
632 _tagNameMap.put(TAG_FILE_INFO_ARRAY, "File Info Array");
633 _tagNameMap.put(TAG_AF_POINTS_IN_FOCUS_1D, "AF Points in Focus (1D)");
634 _tagNameMap.put(TAG_LENS_MODEL, "Lens Model");
635 _tagNameMap.put(TAG_SERIAL_INFO_ARRAY, "Serial Info Array");
636 _tagNameMap.put(TAG_DUST_REMOVAL_DATA, "Dust Removal Data");
637 _tagNameMap.put(TAG_CROP_INFO, "Crop Info");
638 _tagNameMap.put(TAG_CUSTOM_FUNCTIONS_ARRAY_2, "Custom Functions Array 2");
639 _tagNameMap.put(TAG_ASPECT_INFO_ARRAY, "Aspect Information Array");
640 _tagNameMap.put(TAG_PROCESSING_INFO_ARRAY, "Processing Information Array");
641 _tagNameMap.put(TAG_TONE_CURVE_TABLE, "Tone Curve Table");
642 _tagNameMap.put(TAG_SHARPNESS_TABLE, "Sharpness Table");
643 _tagNameMap.put(TAG_SHARPNESS_FREQ_TABLE, "Sharpness Frequency Table");
644 _tagNameMap.put(TAG_WHITE_BALANCE_TABLE, "White Balance Table");
645 _tagNameMap.put(TAG_COLOR_BALANCE_ARRAY, "Color Balance Array");
646 _tagNameMap.put(TAG_MEASURED_COLOR_ARRAY, "Measured Color Array");
647 _tagNameMap.put(TAG_COLOR_TEMPERATURE, "Color Temperature");
648 _tagNameMap.put(TAG_CANON_FLAGS_ARRAY, "Canon Flags Array");
649 _tagNameMap.put(TAG_MODIFIED_INFO_ARRAY, "Modified Information Array");
650 _tagNameMap.put(TAG_TONE_CURVE_MATCHING, "Tone Curve Matching");
651 _tagNameMap.put(TAG_WHITE_BALANCE_MATCHING, "White Balance Matching");
652 _tagNameMap.put(TAG_COLOR_SPACE, "Color Space");
653 _tagNameMap.put(TAG_PREVIEW_IMAGE_INFO_ARRAY, "Preview Image Info Array");
654 _tagNameMap.put(TAG_VRD_OFFSET, "VRD Offset");
655 _tagNameMap.put(TAG_SENSOR_INFO_ARRAY, "Sensor Information Array");
656 _tagNameMap.put(TAG_COLOR_DATA_ARRAY_2, "Color Data Array 1");
657 _tagNameMap.put(TAG_CRW_PARAM, "CRW Parameters");
658 _tagNameMap.put(TAG_COLOR_INFO_ARRAY_2, "Color Data Array 2");
659 _tagNameMap.put(TAG_BLACK_LEVEL, "Black Level");
660 _tagNameMap.put(TAG_CUSTOM_PICTURE_STYLE_FILE_NAME, "Custom Picture Style File Name");
661 _tagNameMap.put(TAG_COLOR_INFO_ARRAY, "Color Info Array");
662 _tagNameMap.put(TAG_VIGNETTING_CORRECTION_ARRAY_1, "Vignetting Correction Array 1");
663 _tagNameMap.put(TAG_VIGNETTING_CORRECTION_ARRAY_2, "Vignetting Correction Array 2");
664 _tagNameMap.put(TAG_LIGHTING_OPTIMIZER_ARRAY, "Lighting Optimizer Array");
665 _tagNameMap.put(TAG_LENS_INFO_ARRAY, "Lens Info Array");
666 _tagNameMap.put(TAG_AMBIANCE_INFO_ARRAY, "Ambiance Info Array");
667 _tagNameMap.put(TAG_FILTER_INFO_ARRAY, "Filter Info Array");
668 }
669
670 public CanonMakernoteDirectory()
671 {
672 this.setDescriptor(new CanonMakernoteDescriptor(this));
673 }
674
675 @Override
676 @NotNull
677 public String getName()
678 {
679 return "Canon Makernote";
680 }
681
682 @Override
683 @NotNull
684 protected HashMap<Integer, String> getTagNameMap()
685 {
686 return _tagNameMap;
687 }
688
689 @Override
690 public void setObjectArray(int tagType, @NotNull Object array)
691 {
692 // TODO is there some way to drop out 'null' or 'zero' values that are present in the array to reduce the noise?
693
694 if (!(array instanceof int[])) {
695 // no special handling...
696 super.setObjectArray(tagType, array);
697 return;
698 }
699
700 // Certain Canon tags contain arrays of values that we split into 'fake' tags as each
701 // index in the array has its own meaning and decoding.
702 // Pick those tags out here and throw away the original array.
703 // Otherwise just add as usual.
704 switch (tagType) {
705 case TAG_CAMERA_SETTINGS_ARRAY: {
706 int[] ints = (int[])array;
707 for (int i = 0; i < ints.length; i++)
708 setInt(CameraSettings.OFFSET + i, ints[i]);
709 break;
710 }
711 case TAG_FOCAL_LENGTH_ARRAY: {
712 int[] ints = (int[])array;
713 for (int i = 0; i < ints.length; i++)
714 setInt(FocalLength.OFFSET + i, ints[i]);
715 break;
716 }
717 case TAG_SHOT_INFO_ARRAY: {
718 int[] ints = (int[])array;
719 for (int i = 0; i < ints.length; i++)
720 setInt(ShotInfo.OFFSET + i, ints[i]);
721 break;
722 }
723 case TAG_PANORAMA_ARRAY: {
724 int[] ints = (int[])array;
725 for (int i = 0; i < ints.length; i++)
726 setInt(Panorama.OFFSET + i, ints[i]);
727 break;
728 }
729 // TODO the interpretation of the custom functions tag depends upon the camera model
730// case TAG_CANON_CUSTOM_FUNCTIONS_ARRAY:
731// int subTagTypeBase = 0xC300;
732// // we intentionally skip the first array member
733// for (int i = 1; i < ints.length; i++)
734// setInt(subTagTypeBase + i + 1, ints[i] & 0x0F);
735// break;
736 case TAG_AF_INFO_ARRAY: {
737 // Notes from Exiftool 10.10 by Phil Harvey, lib\Image\Exiftool\Canon.pm:
738 // Auto-focus information used by many older Canon models. The values in this
739 // record are sequential, and some have variable sizes based on the value of
740 // numafpoints (which may be 1,5,7,9,15,45, or 53). The AFArea coordinates are
741 // given in a system where the image has dimensions given by AFImageWidth and
742 // AFImageHeight, and 0,0 is the image center. The direction of the Y axis
743 // depends on the camera model, with positive Y upwards for EOS models, but
744 // apparently downwards for PowerShot models.
745
746 // AFInfo is another array with 'fake' tags. The first int of the array contains
747 // the number of AF points. Iterate through the array one byte at a time, generally
748 // assuming one byte corresponds to one tag UNLESS certain tag numbers are encountered.
749 // For these, read specific subsequent bytes from the array based on the tag type. The
750 // number of bytes read can vary.
751
752 int[] values = (int[])array;
753 int numafpoints = values[0];
754 int tagnumber = 0;
755 for (int i = 0; i < values.length; i++)
756 {
757 // These two tags store 'numafpoints' bytes of data in the array
758 if (AFInfo.OFFSET + tagnumber == AFInfo.TAG_AF_AREA_X_POSITIONS ||
759 AFInfo.OFFSET + tagnumber == AFInfo.TAG_AF_AREA_Y_POSITIONS)
760 {
761 // There could be incorrect data in the array, so boundary check
762 if (values.length - 1 >= (i + numafpoints))
763 {
764 short[] areaPositions = new short[numafpoints];
765 for (int j = 0; j < areaPositions.length; j++)
766 areaPositions[j] = (short)values[i + j];
767
768 super.setObjectArray(AFInfo.OFFSET + tagnumber, areaPositions);
769 }
770 i += numafpoints - 1; // assume these bytes are processed and skip
771 }
772 else if (AFInfo.OFFSET + tagnumber == AFInfo.TAG_AF_POINTS_IN_FOCUS)
773 {
774 short[] pointsInFocus = new short[((numafpoints + 15) / 16)];
775
776 // There could be incorrect data in the array, so boundary check
777 if (values.length - 1 >= (i + pointsInFocus.length))
778 {
779 for (int j = 0; j < pointsInFocus.length; j++)
780 pointsInFocus[j] = (short)values[i + j];
781
782 super.setObjectArray(AFInfo.OFFSET + tagnumber, pointsInFocus);
783 }
784 i += pointsInFocus.length - 1; // assume these bytes are processed and skip
785 }
786 else
787 super.setObjectArray(AFInfo.OFFSET + tagnumber, values[i]);
788 tagnumber++;
789 }
790 break;
791 }
792 default: {
793 // no special handling...
794 super.setObjectArray(tagType, array);
795 break;
796 }
797 }
798 }
799}
Note: See TracBrowser for help on using the repository browser.