Image/ExifTool/CanonCustom.pm

filter: Statementstmt 82.0% 137 / 167 Branchbran 55.1% 43 / 78 Conditioncond 31.2% 10 / 32 MC/DCmcdc 0.0% 0 / 18 Subroutinesub 91.6% 11 / 12 Podpod 0.0% 0 / 7 totaltotal 64.0% 201 / 314 CC 51 SCAR 34.6
CC
51
Cov
69%
ProcessCanonCustom2
54.4
WriteCanonCustom
28.1
ConvertPfn
12.0
CRAP 31.8
« Image/ExifTool/GeoTiff.pm ↑ Summary Image/ExifTool/FLIF.pm »
1 #------------------------------------------------------------------------------
2 # File: CanonCustom.pm
3 #
4 # Description: Read and write Canon Custom functions
5 #
6 # Revisions: 11/25/2003 - P. Harvey Created
7 #
8 # References: 1) http://park2.wakwak.com/~tsuruzoh/Computer/Digicams/exif-e.html
9 # 2) Christian Koller private communication (20D)
10 # 3) Rainer Honle private communication (5D)
11 # 4) David Pitcher private communication (1DmkIII firmware upgrade)
12 #------------------------------------------------------------------------------
13  
14 package Image::ExifTool::CanonCustom;
15  
16 7 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 7 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
18 7 ▶use Image::ExifTool qw(:DataAccess);
Subroutine BEGIN: called CC=1 SCAR=0.0
19 7 ▶use Image::ExifTool::Canon;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 7 ▶use Image::ExifTool::Exif;
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 7 $VERSION = '1.58';
23  
24 sub ProcessCanonCustom($$$);
25 sub ProcessCanonCustom2($$$);
26 sub WriteCanonCustom($$$);
27 sub WriteCanonCustom2($$$);
28 sub CheckCanonCustom($$$);
29 sub ConvertPFn($);
30 sub ConvertPFnInv($);
31  
32 7 my %onOff = ( 0 => 'On', 1 => 'Off' );
33 7 my %offOn = ( 0 => 'Off', 1 => 'On' );
34 7 my %disableEnable = ( 0 => 'Disable', 1 => 'Enable' );
35 7 my %enableDisable = ( 0 => 'Enable', 1 => 'Disable' );
36 7 my %convPFn = ( PrintConv => \&ConvertPfn, PrintConvInv => \&ConvertPfnInv );
37  
38 #------------------------------------------------------------------------------
39 # Custom functions for the 1D
40 # CanonCustom (keys are custom function number)
41 7 %Image::ExifTool::CanonCustom::Functions1D = (
42 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
43 PROCESS_PROC => \&ProcessCanonCustom,
44 WRITE_PROC => \&WriteCanonCustom,
45 CHECK_PROC => \&CheckCanonCustom,
46 WRITABLE => 'int8u',
47 NOTES => q{
48 These custom functions are used by all 1D models up to but not including the
49 Mark III.
50 },
51 0 => {
52 Name => 'FocusingScreen',
53 PrintConv => {
54 0 => 'Ec-N, R',
55 1 => 'Ec-A,B,C,CII,CIII,D,H,I,L',
56 },
57 },
58 1 => {
59 Name => 'FinderDisplayDuringExposure',
60 PrintConv => \%offOn,
61 },
62 2 => {
63 Name => 'ShutterReleaseNoCFCard',
64 Description => 'Shutter Release W/O CF Card',
65 PrintConv => {
66 0 => 'Yes',
67 1 => 'No',
68 },
69 },
70 3 => {
71 Name => 'ISOSpeedExpansion',
72 Description => 'ISO Speed Expansion',
73 PrintConv => {
74 0 => 'No',
75 1 => 'Yes',
76 },
77 },
78 4 => {
79 Name => 'ShutterAELButton',
80 Description => 'Shutter Button/AEL Button',
81 PrintConv => {
82 0 => 'AF/AE lock stop',
83 1 => 'AE lock/AF',
84 2 => 'AF/AF lock, No AE lock',
85 3 => 'AE/AF, No AE lock',
86 },
87 },
88 5 => {
89 Name => 'ManualTv',
90 Description => 'Manual Tv/Av For M',
91 PrintConv => {
92 0 => 'Tv=Main/Av=Control',
93 1 => 'Tv=Control/Av=Main',
94 2 => 'Tv=Main/Av=Main w/o lens',
95 3 => 'Tv=Control/Av=Main w/o lens',
96 },
97 },
98 6 => {
99 Name => 'ExposureLevelIncrements',
100 PrintConv => {
101 0 => '1/3-stop set, 1/3-stop comp.',
102 1 => '1-stop set, 1/3-stop comp.',
103 2 => '1/2-stop set, 1/2-stop comp.',
104 },
105 },
106 7 => {
107 Name => 'USMLensElectronicMF',
108 PrintConv => {
109 0 => 'Turns on after one-shot AF',
110 1 => 'Turns off after one-shot AF',
111 2 => 'Always turned off',
112 },
113 },
114 8 => {
115 Name => 'LCDPanels',
116 Description => 'Top/Back LCD Panels',
117 PrintConv => {
118 0 => 'Remain. shots/File no.',
119 1 => 'ISO/Remain. shots',
120 2 => 'ISO/File no.',
121 3 => 'Shots in folder/Remain. shots',
122 },
123 },
124 9 => {
125 Name => 'AEBSequenceAutoCancel',
126 Description => 'AEB Sequence/Auto Cancel',
127 PrintConv => {
128 0 => '0,-,+/Enabled',
129 1 => '0,-,+/Disabled',
130 2 => '-,0,+/Enabled',
131 3 => '-,0,+/Disabled',
132 },
133 },
134 10 => {
135 Name => 'AFPointIllumination',
136 PrintConv => {
137 0 => 'On',
138 1 => 'Off',
139 2 => 'On without dimming',
140 3 => 'Brighter',
141 },
142 },
143 11 => {
144 Name => 'AFPointSelection',
145 PrintConv => {
146 0 => 'H=AF+Main/V=AF+Command',
147 1 => 'H=Comp+Main/V=Comp+Command',
148 2 => 'H=Command only/V=Assist+Main',
149 3 => 'H=FEL+Main/V=FEL+Command',
150 },
151 },
152 12 => {
153 Name => 'MirrorLockup',
154 PrintConv => \%disableEnable,
155 },
156 13 => {
157 Name => 'AFPointSpotMetering',
158 Description => 'No. AF Points/Spot Metering',
159 PrintConv => {
160 0 => '45/Center AF point',
161 1 => '11/Active AF point',
162 2 => '11/Center AF point',
163 3 => '9/Active AF point',
164 },
165 },
166 14 => {
167 Name => 'FillFlashAutoReduction',
168 PrintConv => \%enableDisable,
169 },
170 15 => {
171 Name => 'ShutterCurtainSync',
172 PrintConv => {
173 0 => '1st-curtain sync',
174 1 => '2nd-curtain sync',
175 },
176 },
177 16 => {
178 Name => 'SafetyShiftInAvOrTv',
179 PrintConv => \%disableEnable,
180 },
181 17 => {
182 Name => 'AFPointActivationArea',
183 PrintConv => {
184 0 => 'Single AF point',
185 1 => 'Expanded (TTL. of 7 AF points)',
186 2 => 'Automatic expanded (max. 13)',
187 },
188 },
189 18 => {
190 Name => 'SwitchToRegisteredAFPoint',
191 PrintConv => {
192 0 => 'Assist + AF',
193 1 => 'Assist',
194 2 => 'Only while pressing assist',
195 },
196 },
197 19 => {
198 Name => 'LensAFStopButton',
199 PrintConv => {
200 0 => 'AF stop',
201 1 => 'AF start',
202 2 => 'AE lock while metering',
203 3 => 'AF point: M -> Auto / Auto -> Ctr.',
204 4 => 'AF mode: ONE SHOT <-> AI SERVO',
205 5 => 'IS start',
206 },
207 },
208 20 => {
209 Name => 'AIServoTrackingSensitivity',
210 PrintConv => {
211 0 => 'Standard',
212 1 => 'Slow',
213 2 => 'Moderately slow',
214 3 => 'Moderately fast',
215 4 => 'Fast',
216 },
217 },
218 21 => {
219 Name => 'AIServoContinuousShooting',
220 PrintConv => {
221 0 => 'Shooting not possible without focus',
222 1 => 'Shooting possible without focus',
223 },
224 },
225 );
226  
227 # Custom functions for the 5D (ref 3)
228 7 %Image::ExifTool::CanonCustom::Functions5D = (
229 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
230 PROCESS_PROC => \&ProcessCanonCustom,
231 WRITE_PROC => \&WriteCanonCustom,
232 CHECK_PROC => \&CheckCanonCustom,
233 WRITABLE => 'int8u',
234 0 => {
235 Name => 'FocusingScreen',
236 PrintConv => {
237 0 => 'Ee-A',
238 1 => 'Ee-D',
239 2 => 'Ee-S',
240 },
241 },
242 1 => {
243 Name => 'SetFunctionWhenShooting',
244 PrintConv => {
245 0 => 'Default (no function)',
246 1 => 'Change quality',
247 2 => 'Change Parameters',
248 3 => 'Menu display',
249 4 => 'Image replay',
250 },
251 },
252 2 => {
253 Name => 'LongExposureNoiseReduction',
254 PrintConv => {
255 0 => 'Off',
256 1 => 'Auto',
257 2 => 'On',
258 },
259 },
260 3 => {
261 Name => 'FlashSyncSpeedAv',
262 PrintConv => {
263 0 => 'Auto',
264 1 => '1/200 Fixed',
265 },
266 },
267 4 => {
268 Name => 'Shutter-AELock',
269 PrintConv => {
270 0 => 'AF/AE lock',
271 1 => 'AE lock/AF',
272 2 => 'AF/AF lock, No AE lock',
273 3 => 'AE/AF, No AE lock',
274 },
275 },
276 5 => {
277 Name => 'AFAssistBeam',
278 PrintConv => {
279 0 => 'Emits',
280 1 => 'Does not emit',
281 },
282 },
283 6 => {
284 Name => 'ExposureLevelIncrements',
285 PrintConv => {
286 0 => '1/3 Stop',
287 1 => '1/2 Stop',
288 },
289 },
290 7 => {
291 Name => 'FlashFiring',
292 PrintConv => {
293 0 => 'Fires',
294 1 => 'Does not fire',
295 },
296 },
297 8 => {
298 Name => 'ISOExpansion',
299 PrintConv => \%offOn,
300 },
301 9 => {
302 Name => 'AEBSequenceAutoCancel',
303 Description => 'AEB Sequence/Auto Cancel',
304 PrintConv => {
305 0 => '0,-,+/Enabled',
306 1 => '0,-,+/Disabled',
307 2 => '-,0,+/Enabled',
308 3 => '-,0,+/Disabled',
309 },
310 },
311 10 => {
312 Name => 'SuperimposedDisplay',
313 PrintConv => \%onOff,
314 },
315 11 => {
316 Name => 'MenuButtonDisplayPosition',
317 PrintConv => {
318 0 => 'Previous (top if power off)',
319 1 => 'Previous',
320 2 => 'Top',
321 },
322 },
323 12 => {
324 Name => 'MirrorLockup',
325 PrintConv => \%disableEnable,
326 },
327 13 => {
328 Name => 'AFPointSelectionMethod',
329 PrintConv => {
330 0 => 'Normal',
331 1 => 'Multi-controller direct',
332 2 => 'Quick Control Dial direct',
333 },
334 },
335 14 => {
336 Name => 'ETTLII',
337 Description => 'E-TTL II',
338 PrintConv => {
339 0 => 'Evaluative',
340 1 => 'Average',
341 },
342 },
343 15 => {
344 Name => 'ShutterCurtainSync',
345 PrintConv => {
346 0 => '1st-curtain sync',
347 1 => '2nd-curtain sync',
348 },
349 },
350 16 => {
351 Name => 'SafetyShiftInAvOrTv',
352 PrintConv => \%disableEnable,
353 },
354 17 => {
355 Name => 'AFPointActivationArea',
356 PrintConv => {
357 0 => 'Standard',
358 1 => 'Expanded',
359 },
360 },
361 18 => {
362 Name => 'LCDDisplayReturnToShoot',
363 PrintConv => {
364 0 => 'With Shutter Button only',
365 1 => 'Also with * etc.',
366 },
367 },
368 19 => {
369 Name => 'LensAFStopButton',
370 PrintConv => {
371 0 => 'AF stop',
372 1 => 'AF start',
373 2 => 'AE lock while metering',
374 3 => 'AF point: M -> Auto / Auto -> Ctr.',
375 4 => 'ONE SHOT <-> AI SERVO',
376 5 => 'IS start',
377 },
378 },
379 20 => {
380 Name => 'AddOriginalDecisionData',
381 PrintConv => \%offOn,
382 },
383 );
384  
385 # Custom functions for 10D
386 7 %Image::ExifTool::CanonCustom::Functions10D = (
387 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
388 PROCESS_PROC => \&ProcessCanonCustom,
389 WRITE_PROC => \&WriteCanonCustom,
390 CHECK_PROC => \&CheckCanonCustom,
391 WRITABLE => 'int8u',
392 1 => {
393 Name => 'SetButtonWhenShooting',
394 PrintConv => {
395 0 => 'Normal (disabled)',
396 1 => 'Image quality',
397 2 => 'Change parameters',
398 3 => 'Menu display',
399 4 => 'Image playback',
400 },
401 },
402 2 => {
403 Name => 'ShutterReleaseNoCFCard',
404 Description => 'Shutter Release W/O CF Card',
405 PrintConv => {
406 0 => 'Yes',
407 1 => 'No',
408 },
409 },
410 3 => {
411 Name => 'FlashSyncSpeedAv',
412 PrintConv => {
413 0 => 'Auto',
414 1 => '1/200 Fixed',
415 },
416 },
417 4 => {
418 Name => 'Shutter-AELock',
419 PrintConv => {
420 0 => 'AF/AE lock',
421 1 => 'AE lock/AF',
422 2 => 'AF/AF lock, No AE lock',
423 3 => 'AE/AF, No AE lock',
424 },
425 },
426 5 => {
427 Name => 'AFAssist',
428 Description => 'AF Assist/Flash Firing',
429 PrintConv => {
430 0 => 'Emits/Fires',
431 1 => 'Does not emit/Fires',
432 2 => 'Only ext. flash emits/Fires',
433 3 => 'Emits/Does not fire',
434 },
435 },
436 6 => {
437 Name => 'ExposureLevelIncrements',
438 PrintConv => {
439 0 => '1/2 Stop',
440 1 => '1/3 Stop',
441 },
442 },
443 7 => {
444 Name => 'AFPointRegistration',
445 PrintConv => {
446 0 => 'Center',
447 1 => 'Bottom',
448 2 => 'Right',
449 3 => 'Extreme Right',
450 4 => 'Automatic',
451 5 => 'Extreme Left',
452 6 => 'Left',
453 7 => 'Top',
454 },
455 },
456 8 => {
457 Name => 'RawAndJpgRecording',
458 PrintConv => {
459 0 => 'RAW+Small/Normal',
460 1 => 'RAW+Small/Fine',
461 2 => 'RAW+Medium/Normal',
462 3 => 'RAW+Medium/Fine',
463 4 => 'RAW+Large/Normal',
464 5 => 'RAW+Large/Fine',
465 },
466 },
467 9 => {
468 Name => 'AEBSequenceAutoCancel',
469 Description => 'AEB Sequence/Auto Cancel',
470 PrintConv => {
471 0 => '0,-,+/Enabled',
472 1 => '0,-,+/Disabled',
473 2 => '-,0,+/Enabled',
474 3 => '-,0,+/Disabled',
475 },
476 },
477 10 => {
478 Name => 'SuperimposedDisplay',
479 PrintConv => \%onOff,
480 },
481 11 => {
482 Name => 'MenuButtonDisplayPosition',
483 PrintConv => {
484 0 => 'Previous (top if power off)',
485 1 => 'Previous',
486 2 => 'Top',
487 },
488 },
489 12 => {
490 Name => 'MirrorLockup',
491 PrintConv => \%disableEnable,
492 },
493 13 => {
494 Name => 'AssistButtonFunction',
495 PrintConv => {
496 0 => 'Normal',
497 1 => 'Select Home Position',
498 2 => 'Select HP (while pressing)',
499 3 => 'Av+/- (AF point by QCD)',
500 4 => 'FE lock',
501 },
502 },
503 14 => {
504 Name => 'FillFlashAutoReduction',
505 PrintConv => \%enableDisable,
506 },
507 15 => {
508 Name => 'ShutterCurtainSync',
509 PrintConv => {
510 0 => '1st-curtain sync',
511 1 => '2nd-curtain sync',
512 },
513 },
514 16 => {
515 Name => 'SafetyShiftInAvOrTv',
516 PrintConv => \%disableEnable,
517 },
518 17 => {
519 Name => 'LensAFStopButton',
520 PrintConv => {
521 0 => 'AF stop',
522 1 => 'AF start',
523 2 => 'AE lock while metering',
524 3 => 'AF point: M->Auto/Auto->ctr',
525 4 => 'One Shot <-> AI servo',
526 5 => 'IS start',
527 },
528 },
529 );
530  
531 # Custom functions for the 20D (ref 2)
532 7 %Image::ExifTool::CanonCustom::Functions20D = (
533 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
534 PROCESS_PROC => \&ProcessCanonCustom,
535 WRITE_PROC => \&WriteCanonCustom,
536 CHECK_PROC => \&CheckCanonCustom,
537 WRITABLE => 'int8u',
538 0 => {
539 Name => 'SetFunctionWhenShooting',
540 PrintConv => {
541 0 => 'Default (no function)',
542 1 => 'Change quality',
543 2 => 'Change Parameters',
544 3 => 'Menu display',
545 4 => 'Image replay',
546 },
547 },
548 1 => {
549 Name => 'LongExposureNoiseReduction',
550 PrintConv => \%offOn,
551 },
552 2 => {
553 Name => 'FlashSyncSpeedAv',
554 PrintConv => {
555 0 => 'Auto',
556 1 => '1/250 Fixed',
557 },
558 },
559 3 => {
560 Name => 'Shutter-AELock',
561 PrintConv => {
562 0 => 'AF/AE lock',
563 1 => 'AE lock/AF',
564 2 => 'AF/AF lock, No AE lock',
565 3 => 'AE/AF, No AE lock',
566 },
567 },
568 4 => {
569 Name => 'AFAssistBeam',
570 PrintConv => {
571 0 => 'Emits',
572 1 => 'Does not emit',
573 2 => 'Only ext. flash emits',
574 },
575 },
576 5 => {
577 Name => 'ExposureLevelIncrements',
578 PrintConv => {
579 0 => '1/3 Stop',
580 1 => '1/2 Stop',
581 },
582 },
583 6 => {
584 Name => 'FlashFiring',
585 PrintConv => {
586 0 => 'Fires',
587 1 => 'Does not fire',
588 },
589 },
590 7 => {
591 Name => 'ISOExpansion',
592 PrintConv => \%offOn,
593 },
594 8 => {
595 Name => 'AEBSequenceAutoCancel',
596 Description => 'AEB Sequence/Auto Cancel',
597 PrintConv => {
598 0 => '0,-,+/Enabled',
599 1 => '0,-,+/Disabled',
600 2 => '-,0,+/Enabled',
601 3 => '-,0,+/Disabled',
602 },
603 },
604 9 => {
605 Name => 'SuperimposedDisplay',
606 PrintConv => \%onOff,
607 },
608 10 => {
609 Name => 'MenuButtonDisplayPosition',
610 PrintConv => {
611 0 => 'Previous (top if power off)',
612 1 => 'Previous',
613 2 => 'Top',
614 },
615 },
616 11 => {
617 Name => 'MirrorLockup',
618 PrintConv => \%disableEnable,
619 },
620 12 => {
621 Name => 'AFPointSelectionMethod',
622 PrintConv => {
623 0 => 'Normal',
624 1 => 'Multi-controller direct',
625 2 => 'Quick Control Dial direct',
626 },
627 },
628 13 => {
629 Name => 'ETTLII',
630 Description => 'E-TTL II',
631 PrintConv => {
632 0 => 'Evaluative',
633 1 => 'Average',
634 },
635 },
636 14 => {
637 Name => 'ShutterCurtainSync',
638 PrintConv => {
639 0 => '1st-curtain sync',
640 1 => '2nd-curtain sync',
641 },
642 },
643 15 => {
644 Name => 'SafetyShiftInAvOrTv',
645 PrintConv => \%disableEnable,
646 },
647 16 => {
648 Name => 'LensAFStopButton',
649 PrintConv => {
650 0 => 'AF stop',
651 1 => 'AF start',
652 2 => 'AE lock while metering',
653 3 => 'AF point: M -> Auto / Auto -> Ctr.',
654 4 => 'ONE SHOT <-> AI SERVO',
655 5 => 'IS start',
656 },
657 },
658 17 => {
659 Name => 'AddOriginalDecisionData',
660 PrintConv => \%offOn,
661 },
662 );
663  
664 # Custom functions for the 30D (PH)
665 7 %Image::ExifTool::CanonCustom::Functions30D = (
666 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
667 PROCESS_PROC => \&ProcessCanonCustom,
668 WRITE_PROC => \&WriteCanonCustom,
669 CHECK_PROC => \&CheckCanonCustom,
670 WRITABLE => 'int8u',
671 1 => {
672 Name => 'SetFunctionWhenShooting',
673 PrintConv => {
674 0 => 'Default (no function)',
675 1 => 'Change quality',
676 2 => 'Change Picture Style',
677 3 => 'Menu display',
678 4 => 'Image replay',
679 },
680 },
681 2 => {
682 Name => 'LongExposureNoiseReduction',
683 PrintConv => {
684 0 => 'Off',
685 1 => 'Auto',
686 2 => 'On',
687 },
688 },
689 3 => {
690 Name => 'FlashSyncSpeedAv',
691 PrintConv => {
692 0 => 'Auto',
693 1 => '1/250 Fixed',
694 },
695 },
696 4 => {
697 Name => 'Shutter-AELock',
698 PrintConv => {
699 0 => 'AF/AE lock',
700 1 => 'AE lock/AF',
701 2 => 'AF/AF lock, No AE lock',
702 3 => 'AE/AF, No AE lock',
703 },
704 },
705 5 => {
706 Name => 'AFAssistBeam',
707 PrintConv => {
708 0 => 'Emits',
709 1 => 'Does not emit',
710 2 => 'Only ext. flash emits',
711 },
712 },
713 6 => {
714 Name => 'ExposureLevelIncrements',
715 PrintConv => {
716 0 => '1/3 Stop',
717 1 => '1/2 Stop',
718 },
719 },
720 7 => {
721 Name => 'FlashFiring',
722 PrintConv => {
723 0 => 'Fires',
724 1 => 'Does not fire',
725 },
726 },
727 8 => {
728 Name => 'ISOExpansion',
729 PrintConv => \%offOn,
730 },
731 9 => {
732 Name => 'AEBSequenceAutoCancel',
733 Description => 'AEB Sequence/Auto Cancel',
734 PrintConv => {
735 0 => '0,-,+/Enabled',
736 1 => '0,-,+/Disabled',
737 2 => '-,0,+/Enabled',
738 3 => '-,0,+/Disabled',
739 },
740 },
741 10 => {
742 Name => 'SuperimposedDisplay',
743 PrintConv => \%onOff,
744 },
745 11 => {
746 Name => 'MenuButtonDisplayPosition',
747 PrintConv => {
748 0 => 'Previous (top if power off)',
749 1 => 'Previous',
750 2 => 'Top',
751 },
752 },
753 12 => {
754 Name => 'MirrorLockup',
755 PrintConv => \%disableEnable,
756 },
757 13 => {
758 Name => 'AFPointSelectionMethod',
759 PrintConv => {
760 0 => 'Normal',
761 1 => 'Multi-controller direct',
762 2 => 'Quick Control Dial direct',
763 },
764 },
765 14 => {
766 Name => 'ETTLII',
767 Description => 'E-TTL II',
768 PrintConv => {
769 0 => 'Evaluative',
770 1 => 'Average',
771 },
772 },
773 15 => {
774 Name => 'ShutterCurtainSync',
775 PrintConv => {
776 0 => '1st-curtain sync',
777 1 => '2nd-curtain sync',
778 },
779 },
780 16 => {
781 Name => 'SafetyShiftInAvOrTv',
782 PrintConv => \%disableEnable,
783 },
784 17 => {
785 Name => 'MagnifiedView',
786 PrintConv => {
787 0 => 'Image playback only',
788 1 => 'Image review and playback',
789 },
790 },
791 18 => {
792 Name => 'LensAFStopButton',
793 PrintConv => {
794 0 => 'AF stop',
795 1 => 'AF start',
796 2 => 'AE lock while metering',
797 3 => 'AF point: M -> Auto / Auto -> Ctr.',
798 4 => 'ONE SHOT <-> AI SERVO',
799 5 => 'IS start',
800 },
801 },
802 19 => {
803 Name => 'AddOriginalDecisionData',
804 PrintConv => \%offOn,
805 },
806 );
807  
808 # Custom functions for the 350D (PH)
809 7 %Image::ExifTool::CanonCustom::Functions350D = (
810 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
811 PROCESS_PROC => \&ProcessCanonCustom,
812 WRITE_PROC => \&WriteCanonCustom,
813 CHECK_PROC => \&CheckCanonCustom,
814 WRITABLE => 'int8u',
815 0 => {
816 Name => 'SetButtonCrossKeysFunc',
817 PrintConv => {
818 0 => 'Normal',
819 1 => 'Set: Quality',
820 2 => 'Set: Parameter',
821 3 => 'Set: Playback',
822 4 => 'Cross keys: AF point select',
823 },
824 },
825 1 => {
826 Name => 'LongExposureNoiseReduction',
827 PrintConv => \%offOn,
828 },
829 2 => {
830 Name => 'FlashSyncSpeedAv',
831 PrintConv => {
832 0 => 'Auto',
833 1 => '1/200 Fixed',
834 },
835 },
836 3 => {
837 Name => 'Shutter-AELock',
838 PrintConv => {
839 0 => 'AF/AE lock',
840 1 => 'AE lock/AF',
841 2 => 'AF/AF lock, No AE lock',
842 3 => 'AE/AF, No AE lock',
843 },
844 },
845 4 => {
846 Name => 'AFAssistBeam',
847 PrintConv => {
848 0 => 'Emits',
849 1 => 'Does not emit',
850 2 => 'Only ext. flash emits',
851 },
852 },
853 5 => {
854 Name => 'ExposureLevelIncrements',
855 PrintConv => {
856 0 => '1/3 Stop',
857 1 => '1/2 Stop',
858 },
859 },
860 6 => {
861 Name => 'MirrorLockup',
862 PrintConv => \%disableEnable,
863 },
864 7 => {
865 Name => 'ETTLII',
866 Description => 'E-TTL II',
867 PrintConv => {
868 0 => 'Evaluative',
869 1 => 'Average',
870 },
871 },
872 8 => {
873 Name => 'ShutterCurtainSync',
874 PrintConv => {
875 0 => '1st-curtain sync',
876 1 => '2nd-curtain sync',
877 },
878 },
879 );
880  
881 # Custom functions for the 400D (PH)
882 7 %Image::ExifTool::CanonCustom::Functions400D = (
883 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
884 PROCESS_PROC => \&ProcessCanonCustom,
885 WRITE_PROC => \&WriteCanonCustom,
886 CHECK_PROC => \&CheckCanonCustom,
887 WRITABLE => 'int8u',
888 0 => {
889 Name => 'SetButtonCrossKeysFunc',
890 PrintConv => {
891 0 => 'Set: Picture Style',
892 1 => 'Set: Quality',
893 2 => 'Set: Flash Exposure Comp',
894 3 => 'Set: Playback',
895 4 => 'Cross keys: AF point select',
896 },
897 },
898 1 => {
899 Name => 'LongExposureNoiseReduction',
900 PrintConv => {
901 0 => 'Off',
902 1 => 'Auto',
903 2 => 'On',
904 },
905 },
906 2 => {
907 Name => 'FlashSyncSpeedAv',
908 PrintConv => {
909 0 => 'Auto',
910 1 => '1/200 Fixed',
911 },
912 },
913 3 => {
914 Name => 'Shutter-AELock',
915 PrintConv => {
916 0 => 'AF/AE lock',
917 1 => 'AE lock/AF',
918 2 => 'AF/AF lock, No AE lock',
919 3 => 'AE/AF, No AE lock',
920 },
921 },
922 4 => {
923 Name => 'AFAssistBeam',
924 PrintConv => {
925 0 => 'Emits',
926 1 => 'Does not emit',
927 2 => 'Only ext. flash emits',
928 },
929 },
930 5 => {
931 Name => 'ExposureLevelIncrements',
932 PrintConv => {
933 0 => '1/3 Stop',
934 1 => '1/2 Stop',
935 },
936 },
937 6 => {
938 Name => 'MirrorLockup',
939 PrintConv => \%disableEnable,
940 },
941 7 => {
942 Name => 'ETTLII',
943 Description => 'E-TTL II',
944 PrintConv => {
945 0 => 'Evaluative',
946 1 => 'Average',
947 },
948 },
949 8 => {
950 Name => 'ShutterCurtainSync',
951 PrintConv => {
952 0 => '1st-curtain sync',
953 1 => '2nd-curtain sync',
954 },
955 },
956 9 => {
957 Name => 'MagnifiedView',
958 PrintConv => {
959 0 => 'Image playback only',
960 1 => 'Image review and playback',
961 },
962 },
963 10 => {
964 Name => 'LCDDisplayAtPowerOn',
965 PrintConv => {
966 0 => 'Display',
967 1 => 'Retain power off status',
968 },
969 },
970 );
971  
972 # Custom functions for the D30/D60
973 7 %Image::ExifTool::CanonCustom::FunctionsD30 = (
974 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
975 PROCESS_PROC => \&ProcessCanonCustom,
976 WRITE_PROC => \&WriteCanonCustom,
977 CHECK_PROC => \&CheckCanonCustom,
978 NOTES => 'Custom functions for the EOS D30 and D60.',
979 WRITABLE => 'int8u',
980 1 => {
981 Name => 'LongExposureNoiseReduction',
982 PrintConv => \%offOn,
983 },
984 2 => {
985 Name => 'Shutter-AELock',
986 PrintConv => {
987 0 => 'AF/AE lock',
988 1 => 'AE lock/AF',
989 2 => 'AF/AF lock',
990 3 => 'AE+release/AE+AF',
991 },
992 },
993 3 => {
994 Name => 'MirrorLockup',
995 PrintConv => \%disableEnable,
996 },
997 4 => {
998 Name => 'ExposureLevelIncrements',
999 PrintConv => {
1000 0 => '1/2 Stop',
1001 1 => '1/3 Stop',
1002 },
1003 },
1004 5 => {
1005 Name => 'AFAssist',
1006 PrintConv => {
1007 0 => 'Emits/Fires',
1008 1 => 'Does not emit/Fires',
1009 2 => 'Only ext. flash emits/Fires',
1010 3 => 'Emits/Does not fire',
1011 },
1012 },
1013 6 => {
1014 Name => 'FlashSyncSpeedAv',
1015 PrintConv => {
1016 0 => 'Auto',
1017 1 => '1/200 Fixed',
1018 },
1019 },
1020 7 => {
1021 Name => 'AEBSequenceAutoCancel',
1022 Description => 'AEB Sequence/Auto Cancel',
1023 PrintConv => {
1024 0 => '0,-,+/Enabled',
1025 1 => '0,-,+/Disabled',
1026 2 => '-,0,+/Enabled',
1027 3 => '-,0,+/Disabled',
1028 },
1029 },
1030 8 => {
1031 Name => 'ShutterCurtainSync',
1032 PrintConv => {
1033 0 => '1st-curtain sync',
1034 1 => '2nd-curtain sync',
1035 },
1036 },
1037 9 => {
1038 Name => 'LensAFStopButton',
1039 PrintConv => {
1040 0 => 'AF Stop',
1041 1 => 'Operate AF',
1042 2 => 'Lock AE and start timer',
1043 },
1044 },
1045 10 => {
1046 Name => 'FillFlashAutoReduction',
1047 PrintConv => \%enableDisable,
1048 },
1049 11 => {
1050 Name => 'MenuButtonReturn',
1051 PrintConv => {
1052 0 => 'Top',
1053 1 => 'Previous (volatile)',
1054 2 => 'Previous',
1055 },
1056 },
1057 12 => {
1058 Name => 'SetButtonWhenShooting',
1059 PrintConv => {
1060 0 => 'Default (no function)',
1061 1 => 'Image quality',
1062 2 => 'Change ISO speed',
1063 3 => 'Change parameters',
1064 },
1065 },
1066 13 => {
1067 Name => 'SensorCleaning',
1068 PrintConv => \%disableEnable,
1069 },
1070 14 => {
1071 Name => 'SuperimposedDisplay',
1072 PrintConv => \%onOff,
1073 },
1074 15 => {
1075 Name => 'ShutterReleaseNoCFCard',
1076 Description => 'Shutter Release W/O CF Card',
1077 PrintConv => {
1078 0 => 'Yes',
1079 1 => 'No',
1080 },
1081 },
1082 );
1083  
1084 # Custom functions for unknown cameras
1085 7 %Image::ExifTool::CanonCustom::FuncsUnknown = (
1086 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
1087 PROCESS_PROC => \&ProcessCanonCustom,
1088 );
1089  
1090 # 1D personal function settings (ref PH)
1091 7 %Image::ExifTool::CanonCustom::PersonalFuncs = (
1092 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
1093 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
1094 WRITE_PROC => \&Image::ExifTool::WriteBinaryData,
1095 CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
1096 WRITABLE => 1,
1097 NOTES => 'Personal function settings for the EOS-1D.',
1098 FORMAT => 'int16u',
1099 FIRST_ENTRY => 1,
1100 1 => { Name => 'PF0CustomFuncRegistration', %convPFn },
1101 2 => { Name => 'PF1DisableShootingModes', %convPFn },
1102 3 => { Name => 'PF2DisableMeteringModes', %convPFn },
1103 4 => { Name => 'PF3ManualExposureMetering', %convPFn },
1104 5 => { Name => 'PF4ExposureTimeLimits', %convPFn },
1105 6 => { Name => 'PF5ApertureLimits', %convPFn },
1106 7 => { Name => 'PF6PresetShootingModes', %convPFn },
1107 8 => { Name => 'PF7BracketContinuousShoot', %convPFn },
1108 9 => { Name => 'PF8SetBracketShots', %convPFn },
1109 10 => { Name => 'PF9ChangeBracketSequence', %convPFn },
1110 11 => { Name => 'PF10RetainProgramShift', %convPFn },
1111 #12 => { Name => 'PF11Unused', %convPFn },
1112 #13 => { Name => 'PF12Unused', %convPFn },
1113 14 => { Name => 'PF13DrivePriority', %convPFn },
1114 15 => { Name => 'PF14DisableFocusSearch', %convPFn },
1115 16 => { Name => 'PF15DisableAFAssistBeam', %convPFn },
1116 17 => { Name => 'PF16AutoFocusPointShoot', %convPFn },
1117 18 => { Name => 'PF17DisableAFPointSel', %convPFn },
1118 19 => { Name => 'PF18EnableAutoAFPointSel', %convPFn },
1119 20 => { Name => 'PF19ContinuousShootSpeed', %convPFn },
1120 21 => { Name => 'PF20LimitContinousShots', %convPFn },
1121 22 => { Name => 'PF21EnableQuietOperation', %convPFn },
1122 #23 => { Name => 'PF22Unused', %convPFn },
1123 24 => { Name => 'PF23SetTimerLengths', %convPFn },
1124 25 => { Name => 'PF24LightLCDDuringBulb', %convPFn },
1125 26 => { Name => 'PF25DefaultClearSettings', %convPFn },
1126 27 => { Name => 'PF26ShortenReleaseLag', %convPFn },
1127 28 => { Name => 'PF27ReverseDialRotation', %convPFn },
1128 29 => { Name => 'PF28NoQuickDialExpComp', %convPFn },
1129 30 => { Name => 'PF29QuickDialSwitchOff', %convPFn },
1130 31 => { Name => 'PF30EnlargementMode', %convPFn },
1131 32 => { Name => 'PF31OriginalDecisionData', %convPFn },
1132 );
1133  
1134 # 1D personal function values (ref PH)
1135 7 %Image::ExifTool::CanonCustom::PersonalFuncValues = (
1136 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
1137 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
1138 WRITE_PROC => \&Image::ExifTool::WriteBinaryData,
1139 CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
1140 WRITABLE => 1,
1141 FORMAT => 'int16u',
1142 FIRST_ENTRY => 1,
1143 1 => 'PF1Value',
1144 2 => 'PF2Value',
1145 3 => 'PF3Value',
1146 4 => {
1147 Name => 'PF4ExposureTimeMin',
1148 RawConv => '$val > 0 ? $val : 0',
1149 ValueConv => 'exp(-Image::ExifTool::Canon::CanonEv($val*4)*log(2))*1000/8',
1150 ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv(-log($val*8/1000)/log(2))/4',
1151 PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
1152 PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
1153 },
1154 5 => {
1155 Name => 'PF4ExposureTimeMax',
1156 RawConv => '$val > 0 ? $val : 0',
1157 ValueConv => 'exp(-Image::ExifTool::Canon::CanonEv($val*4)*log(2))*1000/8',
1158 ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv(-log($val*8/1000)/log(2))/4',
1159 PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
1160 PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
1161 },
1162 6 => {
1163 Name => 'PF5ApertureMin',
1164 RawConv => '$val > 0 ? $val : 0',
1165 ValueConv => 'exp(Image::ExifTool::Canon::CanonEv($val*4-32)*log(2)/2)',
1166 ValueConvInv => '(Image::ExifTool::Canon::CanonEvInv(log($val)*2/log(2))+32)/4',
1167 PrintConv => 'sprintf("%.2g",$val)',
1168 PrintConvInv => '$val',
1169 },
1170 7 => {
1171 Name => 'PF5ApertureMax',
1172 RawConv => '$val > 0 ? $val : 0',
1173 ValueConv => 'exp(Image::ExifTool::Canon::CanonEv($val*4-32)*log(2)/2)',
1174 ValueConvInv => '(Image::ExifTool::Canon::CanonEvInv(log($val)*2/log(2))+32)/4',
1175 PrintConv => 'sprintf("%.2g",$val)',
1176 PrintConvInv => '$val',
1177 },
1178 8 => 'PF8BracketShots',
1179 9 => 'PF19ShootingSpeedLow',
1180 10 => 'PF19ShootingSpeedHigh',
1181 11 => 'PF20MaxContinousShots',
1182 12 => 'PF23ShutterButtonTime',
1183 13 => 'PF23FELockTime',
1184 14 => 'PF23PostReleaseTime',
1185 15 => 'PF25AEMode',
1186 16 => 'PF25MeteringMode',
1187 17 => 'PF25DriveMode',
1188 18 => 'PF25AFMode',
1189 19 => 'PF25AFPointSel',
1190 20 => 'PF25ImageSize',
1191 21 => 'PF25WBMode',
1192 22 => 'PF25Parameters',
1193 23 => 'PF25ColorMatrix',
1194 24 => 'PF27Value',
1195 );
1196  
1197 # Custom functions used by the 1D Mark III and later models (ref PH)
1198 7 %Image::ExifTool::CanonCustom::Functions2 = (
1199 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
1200 PROCESS_PROC => \&ProcessCanonCustom2,
1201 CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
1202 WRITE_PROC => \&WriteCanonCustom2,
1203 WRITABLE => 'int32s',
1204 NOTES => q{
1205 Beginning with the EOS 1D Mark III, Canon finally created a set of custom
1206 function tags which are (reasonably) consistent across models. The EOS 1D
1207 Mark III has 57 custom function tags divided into four main groups: 1.
1208 Exposure (0x0101-0x010f), 2. Image (0x0201-0x0203), Flash Exposure
1209 (0x0304-0x0306) and Display (0x0407-0x0409), 3. Auto Focus (0x0501-0x050e)
1210 and Drive (0x060f-0x0611), and 4. Operation (0x0701-0x070a) and Others
1211 (0x080b-0x0810). The table below lists tags used by the EOS 1D Mark III, as
1212 well as newer tags and values added by later models.
1213 },
1214 # grouped in 4 groups:
1215 # 1) Exposure
1216 0x0101 => [
1217 {
1218 Name => 'ExposureLevelIncrements',
1219 Condition => '$$self{Model} =~ /\b1Ds?\b/',
1220 Notes => '1DmkIII and 1DmkIV',
1221 PrintConv => {
1222 0 => '1/3-stop set, 1/3-stop comp.',
1223 1 => '1-stop set, 1/3-stop comp.',
1224 2 => '1/2-stop set, 1/2-stop comp.',
1225 },
1226 },
1227 {
1228 Name => 'ExposureLevelIncrements',
1229 Notes => 'other models',
1230 PrintConv => {
1231 0 => '1/3 Stop',
1232 1 => '1/2 Stop',
1233 },
1234 },
1235 ],
1236 0x0102 => {
1237 Name => 'ISOSpeedIncrements',
1238 PrintConv => {
1239 0 => '1/3 Stop',
1240 1 => '1 Stop',
1241 },
1242 },
1243 0x0103 => [
1244 {
1245 Name => 'ISOSpeedRange',
1246 Condition => '$$self{Model} =~ /\b1D/',
1247 Notes => '1DmkIII and 1DmkIV',
1248 Count => 3,
1249 # (this decoding may not be valid for CR2 images?)
1250 ValueConv => [
1251 undef,
1252 # this may also be set to "H" (Hi6400) -- is this the -1 value I see? - PH
1253 '$val < 2 ? $val : ($val < 1000 ? exp(($val/8-9)*log(2))*100 : 0)', # (educated guess)
1254 # this may also be set to "L" (Lo50) -- is this the 1 value I see? - PH
1255 '$val < 2 ? $val : ($val < 1000 ? exp(($val/8-9)*log(2))*100 : 0)', # (educated guess)
1256 ],
1257 ValueConvInv => [
1258 undef,
1259 '$val < 2 ? $val : int(8*(log($val/100)/log(2)+9) + 0.5)',
1260 '$val < 2 ? $val : int(8*(log($val/100)/log(2)+9) + 0.5)',
1261 ],
1262 PrintConv => [
1263 \%disableEnable,
1264 'sprintf("Max %.0f",$val)',
1265 'sprintf("Min %.0f",$val)',
1266 ],
1267 PrintConvInv => [
1268 undef,
1269 '$val=~/(-?[\d.]+)/ ? $1 : 0',
1270 '$val=~/(-?[\d.]+)/ ? $1 : 0',
1271 ],
1272 },
1273 {
1274 Name => 'ISOExpansion',
1275 Notes => 'other models',
1276 PrintConv => \%offOn,
1277 },
1278 ],
1279 0x0104 => {
1280 Name => 'AEBAutoCancel',
1281 PrintConv => \%onOff,
1282 },
1283 0x0105 => {
1284 Name => 'AEBSequence',
1285 Notes => 'value of 2 not used by 40D, 50D, 60D, 5DmkII and 7D',
1286 PrintConv => {
1287 0 => '0,-,+',
1288 1 => '-,0,+',
1289 2 => '+,0,-',
1290 },
1291 },
1292 0x0106 => [{
1293 Name => 'AEBShotCount',
1294 Condition => '$$self{Model} =~ /\b90D\b/',
1295 Notes => 'EOS 90D', # (and who knows what others?)
1296 PrintConv => {
1297 2 => '2 shots',
1298 3 => '3 shots',
1299 5 => '5 shots',
1300 7 => '7 shots',
1301 },
1302 },{
1303 Name => 'AEBShotCount',
1304 Condition => '$count == 1',
1305 Notes => 'other models storing a single value',
1306 PrintConv => {
1307 0 => '3 shots',
1308 1 => '2 shots',
1309 2 => '5 shots',
1310 3 => '7 shots',
1311 },
1312 },{
1313 Name => 'AEBShotCount',
1314 Count => 2,
1315 Notes => 'models storing two values',
1316 PrintConv => {
1317 '3 0' => '3 shots',
1318 '2 1' => '2 shots',
1319 '5 2' => '5 shots',
1320 '7 3' => '7 shots',
1321 },
1322 }],
1323 0x0107 => {
1324 Name => 'SpotMeterLinkToAFPoint',
1325 PrintConv => {
1326 0 => 'Disable (use center AF point)',
1327 1 => 'Enable (use active AF point)',
1328 },
1329 },
1330 0x0108 => {
1331 Name => 'SafetyShift',
1332 Notes => 'value of 2 not used by some models', # eg. 40D, 50D, 60D, 5DmkII, 7D, 250D
1333 PrintConv => {
1334 0 => 'Disable',
1335 1 => 'Enable (Tv/Av)',
1336 2 => 'Enable (ISO speed)',
1337 },
1338 },
1339 0x0109 => [{ # (1DXmkIII)
1340 Name => 'UsableShootingModes',
1341 Condition => '$count == 1',
1342 Count => 1,
1343 PrintConv => 'sprintf("Flags 0x%x",$val)',
1344 PrintConvInv => '$val=~/0x([\dA-F]+)/i ? hex($1) : undef',
1345 },{
1346 Name => 'UsableShootingModes',
1347 Count => 2,
1348 PrintConv => [
1349 \%disableEnable,
1350 'sprintf("Flags 0x%x",$val)', # (M, Tv, Av, P, Bulb)
1351 ],
1352 PrintConvInv => [
1353 undef,
1354 '$val=~/0x([\dA-F]+)/i ? hex($1) : undef',
1355 ],
1356 }],
1357 0x010a => [{ # (1DXmkIII)
1358 Name => 'UsableMeteringModes',
1359 Condition => '$count == 1',
1360 Count => 1,
1361 PrintConv => 'sprintf("Flags 0x%x",$val)',
1362 PrintConvInv => '$val=~/0x([\dA-F]+)/i ? hex($1) : undef',
1363 },{
1364 Name => 'UsableMeteringModes',
1365 Count => 2,
1366 PrintConv => [
1367 \%disableEnable,
1368 'sprintf("Flags 0x%x",$val)', # (evaluative,partial,spot,center-weighted average)
1369 ],
1370 PrintConvInv => [
1371 undef,
1372 '$val=~/0x([\dA-F]+)/i ? hex($1) : undef',
1373 ],
1374 }],
1375 0x010b => {
1376 Name => 'ExposureModeInManual',
1377 PrintConv => {
1378 0 => 'Specified metering mode',
1379 1 => 'Evaluative metering',
1380 2 => 'Partial metering',
1381 3 => 'Spot metering',
1382 4 => 'Center-weighted average',
1383 },
1384 },
1385 0x010c => [{
1386 Name => 'ShutterSpeedRange',
1387 Condition => '$count == 3',
1388 Count => 3,
1389 ValueConv => [
1390 undef,
1391 'exp(-($val/8-7)*log(2))',
1392 'exp(-($val/8-7)*log(2))',
1393 ],
1394 ValueConvInv => [
1395 undef,
1396 'int(-8*(log($val)/log(2)-7) + 0.5)',
1397 'int(-8*(log($val)/log(2)-7) + 0.5)',
1398 ],
1399 PrintConv => [
1400 \%disableEnable,
1401 '"Hi " . Image::ExifTool::Exif::PrintExposureTime($val)',
1402 '"Lo " . Image::ExifTool::Exif::PrintExposureTime($val)',
1403 ],
1404 PrintConvInv => [
1405 undef,
1406 '$val=~m{([\d./]+)} ? eval $1 : 0',
1407 '$val=~m{([\d./]+)} ? eval $1 : 0',
1408 ],
1409 },{ # (EOS R)
1410 Name => 'ShutterSpeedRange',
1411 Condition => '$count == 4',
1412 Count => 4,
1413 ValueConv => [ # (NC)
1414 'exp(-$val/(1600*log(2)))',
1415 'exp(-$val/(1600*log(2)))',
1416 'exp(-$val/(1600*log(2)))',
1417 'exp(-$val/(1600*log(2)))',
1418 ],
1419 ValueConvInv => [
1420 'int(-log($val)*1600*log(2) + 0.5)',
1421 'int(-log($val)*1600*log(2) + 0.5)',
1422 'int(-log($val)*1600*log(2) + 0.5)',
1423 'int(-log($val)*1600*log(2) + 0.5)',
1424 ],
1425 PrintConv => [ # (NC)
1426 '"Manual: Hi " . Image::ExifTool::Exif::PrintExposureTime($val)',
1427 '"Lo " . Image::ExifTool::Exif::PrintExposureTime($val)',
1428 '"Auto: Hi " . Image::ExifTool::Exif::PrintExposureTime($val)',
1429 '"Lo " . Image::ExifTool::Exif::PrintExposureTime($val)',
1430 ],
1431 PrintConvInv => [
1432 '$val=~m{([\d./]+)} ? eval $1 : 0',
1433 '$val=~m{([\d./]+)} ? eval $1 : 0',
1434 '$val=~m{([\d./]+)} ? eval $1 : 0',
1435 '$val=~m{([\d./]+)} ? eval $1 : 0',
1436 ],
1437 }],
1438 0x010d => [{
1439 Name => 'ApertureRange',
1440 Condition => '$count == 3',
1441 Count => 3,
1442 ValueConv => [
1443 undef,
1444 'exp(($val/8-1)*log(2)/2)',
1445 'exp(($val/8-1)*log(2)/2)',
1446 ],
1447 ValueConvInv => [
1448 undef,
1449 'int(8*(log($val)*2/log(2)+1) + 0.5)',
1450 'int(8*(log($val)*2/log(2)+1) + 0.5)',
1451 ],
1452 PrintConv => [
1453 \%disableEnable,
1454 'sprintf("Closed %.2g",$val)',
1455 'sprintf("Open %.2g",$val)',
1456 ],
1457 PrintConvInv => [
1458 undef,
1459 '$val=~/([\d.]+)/ ? $1 : 0',
1460 '$val=~/([\d.]+)/ ? $1 : 0',
1461 ],
1462 },{ # (EOS R)
1463 Name => 'ApertureRange',
1464 Condition => '$count == 4',
1465 Count => 4,
1466 ValueConv => [ # (NC)
1467 'exp($val/2400)',
1468 'exp($val/2400)',
1469 'exp($val/2400)',
1470 'exp($val/2400)',
1471 ],
1472 ValueConvInv => [
1473 'int(log($val)*2400) + 0.5)',
1474 'int(log($val)*2400) + 0.5)',
1475 'int(log($val)*2400) + 0.5)',
1476 'int(log($val)*2400) + 0.5)',
1477 ],
1478 PrintConv => [ # (NC)
1479 'sprintf("Manual: Closed %.2g",$val)',
1480 'sprintf("Open %.2g",$val)',
1481 'sprintf("Auto: Closed %.2g",$val)',
1482 'sprintf("Open %.2g",$val)',
1483 ],
1484 PrintConvInv => [
1485 '$val=~/([\d.]+)/ ? $1 : 0',
1486 '$val=~/([\d.]+)/ ? $1 : 0',
1487 '$val=~/([\d.]+)/ ? $1 : 0',
1488 '$val=~/([\d.]+)/ ? $1 : 0',
1489 ],
1490 }],
1491 0x010e => {
1492 Name => 'ApplyShootingMeteringMode',
1493 Count => 8,
1494 PrintConv => [ \%disableEnable ],
1495 },
1496 0x010f => [
1497 {
1498 Name => 'FlashSyncSpeedAv',
1499 Condition => '$$self{Model} =~ /\b(40D|1Ds Mark III)\b/',
1500 Notes => '40D and 1Ds Mark III',
1501 PrintConv => {
1502 0 => 'Auto',
1503 1 => '1/250 Fixed',
1504 },
1505 },
1506 {
1507 Name => 'FlashSyncSpeedAv',
1508 Condition => '$$self{Model} =~ /\b(50D|60D|7D)\b/',
1509 Notes => '50D, 60D and 7D',
1510 PrintConv => {
1511 0 => 'Auto',
1512 1 => '1/250-1/60 Auto',
1513 2 => '1/250 Fixed',
1514 },
1515 },
1516 {
1517 Name => 'FlashSyncSpeedAv',
1518 Condition => '$$self{Model} =~ /\b(450D|XSi|Kiss X2|1000D|XS|Kiss F)\b/',
1519 Notes => '450D and 1000D',
1520 PrintConv => {
1521 0 => 'Auto',
1522 1 => '1/200 Fixed',
1523 },
1524 },
1525 {
1526 Name => 'FlashSyncSpeedAv',
1527 Condition => '$$self{Model} =~ /\bEOS-1Ds? Mark III\b/',
1528 Notes => '1D Mark III and 1Ds Mark III',
1529 PrintConv => {
1530 0 => 'Auto',
1531 1 => '1/300 Fixed',
1532 },
1533 },
1534 {
1535 Name => 'FlashSyncSpeedAv',
1536 Condition => '$$self{Model} =~ /\bEOS-1D Mark IV\b/',
1537 Notes => '1D Mark IV',
1538 PrintConv => {
1539 0 => 'Auto',
1540 1 => '1/300-1/60 Auto',
1541 2 => '1/300 Fixed',
1542 },
1543 },
1544 {
1545 Name => 'FlashSyncSpeedAv',
1546 Notes => '5D Mark II, 5D Mark III, 500D, 550D, 600D and 1100D',
1547 PrintConv => {
1548 0 => 'Auto',
1549 1 => '1/200-1/60 Auto',
1550 2 => '1/200 Fixed',
1551 },
1552 },
1553 ],
1554 0x0110 => { # new for 1DmkIV
1555 Name => 'AEMicroadjustment',
1556 Count => 3,
1557 PrintConv => [ \%disableEnable ],
1558 },
1559 0x0111 => { # new for 1DmkIV
1560 Name => 'FEMicroadjustment',
1561 Count => 3,
1562 PrintConv => [ \%disableEnable ],
1563 },
1564 0x0112 => [{ # (5DS)
1565 Name => 'SameExposureForNewAperture',
1566 PrintConv => {
1567 0 => 'Disable',
1568 1 => 'ISO Speed',
1569 2 => 'Shutter Speed',
1570 },
1571 },{ # (EOS R)
1572 Name => 'SameExposureForNewAperture',
1573 Notes => 'EOS R',
1574 PrintConv => {
1575 0 => 'Disable',
1576 1 => 'ISO Speed',
1577 2 => 'ISO Speed/Shutter Speed',
1578 3 => 'Shutter Speed',
1579 },
1580 }],
1581 0x0113 => { # (200D)
1582 Name => 'ExposureCompAutoCancel',
1583 PrintConv => \%enableDisable,
1584 },
1585 0x0114 => { # (R)
1586 Name => 'AELockMeterModeAfterFocus',
1587 # metering modes where AE lock after focus applies:
1588 PrintConv => { BITMASK => { # (NC)
1589 0 => 'Evaluative',
1590 1 => 'Partial',
1591 2 => 'Spot',
1592 3 => 'Center-weighted',
1593 }},
1594 },
1595 #### 2a) Image
1596 0x0201 => {
1597 Name => 'LongExposureNoiseReduction',
1598 PrintConv => {
1599 0 => 'Off',
1600 1 => 'Auto',
1601 2 => 'On',
1602 },
1603 },
1604 0x0202 => [
1605 {
1606 Name => 'HighISONoiseReduction',
1607 Condition => q{
1608 $$self{Model} =~ /\b(50D|60D|5D Mark II|7D|500D|T1i|Kiss X3|550D|T2i|Kiss X4)\b/ or
1609 $$self{Model} =~ /\b(600D|T3i|Kiss X5|1100D|T3|Kiss X50)\b/
1610 },
1611 Notes => '50D, 60D, 500D, 550D, 600D, 1100D, 5DmkII and 7D',
1612 PrintConv => {
1613 0 => 'Standard',
1614 1 => 'Low',
1615 2 => 'Strong',
1616 3 => 'Off',
1617 },
1618 },
1619 {
1620 Name => 'HighISONoiseReduction',
1621 Notes => 'other models',
1622 PrintConv => \%offOn,
1623 },
1624 ],
1625 0x0203 => {
1626 Name => 'HighlightTonePriority',
1627 PrintConv => \%disableEnable
1628 },
1629 0x0204 => [
1630 {
1631 Name => 'AutoLightingOptimizer',
1632 Condition => '$$self{Model} =~ /\b(50D|5D Mark II|500D|T1i|Kiss X3|1D Mark IV)\b/',
1633 Notes => '50D, 500D, 5DmkII and 1DmkIV',
1634 PrintConv => {
1635 0 => 'Standard',
1636 1 => 'Low',
1637 2 => 'Strong',
1638 3 => 'Disable',
1639 },
1640 },
1641 {
1642 Name => 'AutoLightingOptimizer',
1643 Notes => 'other models',
1644 PrintConv => \%enableDisable,
1645 },
1646 ],
1647 # 0x0205 - Added in 5DmkII firmware update
1648 #### 2b) Flash exposure
1649 0x0304 => {
1650 Name => 'ETTLII',
1651 Description => 'E-TTL II',
1652 PrintConv => {
1653 0 => 'Evaluative',
1654 1 => 'Average',
1655 },
1656 },
1657 0x0305 => {
1658 Name => 'ShutterCurtainSync',
1659 PrintConv => {
1660 0 => '1st-curtain sync',
1661 1 => '2nd-curtain sync',
1662 },
1663 },
1664 0x0306 => {
1665 Name => 'FlashFiring',
1666 PrintConv => {
1667 0 => 'Fires',
1668 1 => 'Does not fire',
1669 },
1670 },
1671 #### 2c) Display
1672 0x0407 => {
1673 Name => 'ViewInfoDuringExposure',
1674 PrintConv => \%disableEnable,
1675 },
1676 0x0408 => {
1677 Name => 'LCDIlluminationDuringBulb',
1678 PrintConv => \%offOn,
1679 },
1680 0x0409 => [
1681 {
1682 Name => 'InfoButtonWhenShooting',
1683 Condition => '$$self{Model} =~ /\b1Ds? Mark III\b/',
1684 Notes => '1D Mark III',
1685 PrintConv => {
1686 0 => 'Displays camera settings',
1687 1 => 'Displays shooting functions',
1688 },
1689 },
1690 {
1691 Name => 'InfoButtonWhenShooting',
1692 Notes => '1D Mark IV',
1693 PrintConv => {
1694 # reversed from earlier models. grr...
1695 0 => 'Displays shooting functions',
1696 1 => 'Displays camera settings',
1697 },
1698 },
1699 ],
1700 0x040a => { # new for 5DmkIII
1701 Name => 'ViewfinderWarnings',
1702 PrintConv => { BITMASK => { #(NC)
1703 0 => 'Monochrome', # (have seen for: 5DmkII, 6D, 250D, 90D)
1704 1 => 'WB corrected', # (have seen for: 5DmkII, 6D, 90D)
1705 2 => 'One-touch image quality', # (have seen for: 5DmkII; doesn't exist for 6D)
1706 3 => 'ISO expansion', # (have seen for: 5DmkII)
1707 4 => 'Spot metering', # (have seen for: 5DmkII, 6D)
1708 6 => 'Noise reduction', # (have seen for: 250D, 90D)
1709 7 => 'HDR', # (have seen for: 90D)
1710 }},
1711 },
1712 0x040b => { # new for 5DmkIII
1713 Name => 'LVShootingAreaDisplay',
1714 PrintConv => {
1715 0 => 'Masked',
1716 1 => 'Outlined',
1717 },
1718 },
1719 0x040c => { # (7DmkII)
1720 Name => 'LVShootingAreaDisplay',
1721 PrintConv => {
1722 0 => 'Masked',
1723 1 => 'Outlined',
1724 },
1725 },
1726 #### 3a) Auto focus
1727 0x0501 => {
1728 Name => 'USMLensElectronicMF',
1729 PrintConv => {
1730 0 => 'Enable after one-shot AF',
1731 1 => 'Disable after one-shot AF',
1732 2 => 'Disable in AF mode',
1733 },
1734 },
1735 0x0502 => {
1736 Name => 'AIServoTrackingSensitivity',
1737 PrintConv => {
1738 -2 => 'Slow', # (Locked on -2 for 6D)
1739 -1 => 'Medium Slow', # (Locked on -1 for 6D)
1740 0 => 'Standard',
1741 1 => 'Medium Fast', # (Responsive +1 for 6D)
1742 2 => 'Fast', # (Responsive +2 for 6D)
1743 },
1744 },
1745 0x0503 => {
1746 Name => 'AIServoImagePriority',
1747 PrintConv => {
1748 0 => '1: AF, 2: Tracking',
1749 1 => '1: AF, 2: Drive speed',
1750 2 => '1: Release, 2: Drive speed',
1751 3 => '1: Release, 2: Tracking', # 7D/1DmkIV
1752 },
1753 },
1754 0x0504 => {
1755 Name => 'AIServoTrackingMethod',
1756 PrintConv => {
1757 0 => 'Main focus point priority',
1758 1 => 'Continuous AF track priority',
1759 },
1760 },
1761 0x0505 => {
1762 Name => 'LensDriveNoAF',
1763 PrintConv => {
1764 0 => 'Focus search on',
1765 1 => 'Focus search off',
1766 },
1767 },
1768 0x0506 => {
1769 Name => 'LensAFStopButton',
1770 Notes => 'value of 6 not used by 40D, 50D and 5DmkII',
1771 PrintConv => {
1772 0 => 'AF stop',
1773 1 => 'AF start',
1774 2 => 'AE lock',
1775 3 => 'AF point: M->Auto/Auto->ctr',
1776 4 => 'One Shot <-> AI servo',
1777 5 => 'IS start',
1778 6 => 'Switch to registered AF point',
1779 7 => 'Spot AF', # 1DmkIV
1780 },
1781 },
1782 0x0507 => {
1783 Name => 'AFMicroadjustment',
1784 Count => 5,
1785 PrintConv => [
1786 {
1787 0 => 'Disable',
1788 1 => 'Adjust all by same amount',
1789 2 => 'Adjust by lens',
1790 },
1791 # DECODE OTHER VALUES
1792 ],
1793 },
1794 0x0508 => [
1795 {
1796 Name => 'AFPointAreaExpansion',
1797 Condition => '$$self{Model} =~ /\b5D Mark II\b/',
1798 Notes => '5D Mark II',
1799 PrintConv => {
1800 0 => 'Disable',
1801 1 => 'Enable',
1802 },
1803 },
1804 {
1805 Name => 'AFPointAreaExpansion',
1806 Condition => '$$self{Model} =~ /\b1Ds Mark III\b/',
1807 Notes => '1Ds Mark III',
1808 PrintConv => {
1809 0 => 'Disable',
1810 1 => 'Enable (left/right Assist AF points)',
1811 2 => 'Enable (surrounding Assist AF points)',
1812 },
1813 },
1814 {
1815 Name => 'AFPointAreaExpansion',
1816 Notes => 'other models',
1817 PrintConv => {
1818 0 => 'Disable',
1819 1 => 'Left/right AF points',
1820 2 => 'Surrounding AF points',
1821 3 => 'All 45 points area', # 1DmkIV
1822 },
1823 },
1824 ],
1825 0x0509 => [
1826 {
1827 Name => 'SelectableAFPoint',
1828 Condition => '$$self{Model} =~ /\b1D Mark IV\b/',
1829 Notes => '1D Mark IV',
1830 PrintConv => {
1831 0 => '45 points',
1832 1 => '19 points',
1833 2 => '11 points',
1834 3 => 'Inner 9 points',
1835 4 => 'Outer 9 points',
1836 },
1837 },
1838 {
1839 Name => 'SelectableAFPoint',
1840 Notes => 'other models',
1841 PrintConv => {
1842 0 => '19 points',
1843 1 => 'Inner 9 points',
1844 2 => 'Outer 9 points',
1845 3 => '19 Points, Multi-controller selectable', #4
1846 4 => 'Inner 9 Points, Multi-controller selectable', #4
1847 5 => 'Outer 9 Points, Multi-controller selectable', #4
1848 },
1849 },
1850 ],
1851 0x050a => [
1852 {
1853 Name => 'SwitchToRegisteredAFPoint',
1854 Condition => '$$self{Model} =~ /\b1D Mark IV\b/',
1855 Notes => '1D Mark IV',
1856 PrintConv => {
1857 0 => 'Disable',
1858 1 => 'Switch with multi-controller',
1859 2 => 'Only while AEL is pressed',
1860 },
1861 },
1862 {
1863 Name => 'SwitchToRegisteredAFPoint',
1864 Notes => 'other models',
1865 PrintConv => \%disableEnable,
1866 },
1867 ],
1868 0x050b => {
1869 Name => 'AFPointAutoSelection',
1870 PrintConv => {
1871 0 => 'Control-direct:disable/Main:enable',
1872 1 => 'Control-direct:disable/Main:disable',
1873 2 => 'Control-direct:enable/Main:enable',
1874 },
1875 },
1876 0x050c => [
1877 {
1878 Name => 'AFPointDisplayDuringFocus',
1879 Condition => '$$self{Model} =~ /\b1D\b/',
1880 Notes => '1D models',
1881 PrintConv => {
1882 0 => 'On',
1883 1 => 'Off',
1884 2 => 'On (when focus achieved)',
1885 },
1886 },
1887 {
1888 Name => 'AFPointDisplayDuringFocus',
1889 Notes => 'other models', # (7D, 70D, 750D, 760D)
1890 PrintConv => {
1891 0 => 'Selected (constant)',
1892 1 => 'All (constant)',
1893 2 => 'Selected (pre-AF, focused)',
1894 3 => 'Selected (focused)',
1895 4 => 'Disable display',
1896 },
1897 },
1898 ],
1899 0x050d => {
1900 Name => 'AFPointBrightness',
1901 PrintConv => {
1902 0 => 'Normal',
1903 1 => 'Brighter',
1904 },
1905 },
1906 0x050e => [
1907 {
1908 Name => 'AFAssistBeam',
1909 Condition => '$$self{Model} =~ /\b(1D Mark IV|6D)\b/',
1910 Notes => '1D Mark IV and 6D',
1911 PrintConv => {
1912 0 => 'Emits',
1913 1 => 'Does not emit',
1914 2 => 'IR AF assist beam only',
1915 },
1916 },
1917 {
1918 Name => 'AFAssistBeam',
1919 Notes => 'other models; values 2-3 not used by 1DmkIII or 5DmkII, value 3 new for 7D',
1920 PrintConv => {
1921 0 => 'Emits',
1922 1 => 'Does not emit',
1923 2 => 'Only ext. flash emits',
1924 3 => 'IR AF assist beam only', # new for 7D
1925 },
1926 },
1927 ],
1928 0x050f => [ # new for 40D
1929 {
1930 Name => 'AFPointSelectionMethod',
1931 Condition => '$$self{Model} !~ /\b60D\b/',
1932 Notes => '40D, 50D and 5DmkII',
1933 PrintConv => {
1934 0 => 'Normal',
1935 1 => 'Multi-controller direct',
1936 2 => 'Quick Control Dial direct',
1937 },
1938 },
1939 {
1940 Name => 'AFPointSelectionMethod',
1941 Notes => '60D',
1942 PrintConv => {
1943 0 => 'AF point button: Activate AF Sel; Rear dial: Select AF points',
1944 1 => 'AF point button: Auto selection; Rear dial: Manual selection',
1945 },
1946 },
1947 # (this is 2 values for 90D,M6mkII, seen: "1046 1046")
1948 ],
1949 0x0510 => [ # new for 40D
1950 {
1951 Name => 'VFDisplayIllumination', # (7D quirk, or decoded incorrectly?)
1952 Condition => '$$self{Model} =~ /\b7D\b/',
1953 Notes => '7D',
1954 PrintConv => {
1955 0 => 'Auto',
1956 1 => 'Enable',
1957 2 => 'Disable',
1958 },
1959 },
1960 {
1961 Name => 'SuperimposedDisplay',
1962 Notes => 'other models',
1963 PrintConv => \%onOff,
1964 },
1965 ],
1966 0x0511 => [ # new for 40D
1967 {
1968 Name => 'AFDuringLiveView',
1969 Condition => '$$self{Model} =~ /\b40D\b/',
1970 Notes => '40D',
1971 PrintConv => \%disableEnable,
1972 },
1973 {
1974 Name => 'AFDuringLiveView',
1975 Notes => '450D and 1000D',
1976 PrintConv => {
1977 0 => 'Disable',
1978 1 => 'Quick mode',
1979 2 => 'Live mode',
1980 },
1981 },
1982 ],
1983 0x0512 => { # new for 7D
1984 Name => 'SelectAFAreaSelectMode',
1985 PrintConv => [
1986 {
1987 0 => 'Disable',
1988 1 => 'Enable',
1989 2 => 'Register',
1990 3 => 'Select AF-modes',
1991 # also seen: 87 (90D), 1142 (RP)
1992 },
1993 'sprintf("Flags 0x%x",$val)', # (70D=Manual 1pt,Manual zone,Auto 19pt)
1994 ],
1995 PrintConvInv => [
1996 undef,
1997 '$val=~/0x([\dA-F]+)/i ? hex($1) : undef',
1998 ],
1999 },
2000 0x0513 => { # new for 7D
2001 Name => 'ManualAFPointSelectPattern',
2002 PrintConv => {
2003 0 => 'Stops at AF area edges',
2004 1 => 'Continuous',
2005 },
2006 },
2007 0x0514 => { # new for 7D
2008 Name => 'DisplayAllAFPoints',
2009 PrintConv => \%enableDisable,
2010 },
2011 0x0515 => { # new for 7D
2012 Name => 'FocusDisplayAIServoAndMF',
2013 PrintConv => \%enableDisable,
2014 },
2015 0x0516 => { # new for 7D and 1DmkIV
2016 Name => 'OrientationLinkedAFPoint',
2017 PrintConv => {
2018 0 => 'Same for vertical and horizontal',
2019 1 => 'Select different AF points',
2020 },
2021 },
2022 0x0517 => { # new for 1DmkIV
2023 Name => 'MultiControllerWhileMetering',
2024 PrintConv => {
2025 0 => 'Off',
2026 1 => 'AF point selection',
2027 },
2028 },
2029 0x0518 => { # new for 6D
2030 Name => 'AccelerationTracking',
2031 },
2032 0x0519 => { # new for 6D
2033 Name => 'AIServoFirstImagePriority',
2034 PrintConv => { #(NC)
2035 -1 => 'Release priority',
2036 0 => 'Equal priority',
2037 1 => 'Focus priority',
2038 },
2039 },
2040 0x051a => { # new for 6D
2041 Name => 'AIServoSecondImagePriority',
2042 PrintConv => { #(NC)
2043 -1 => 'Shooting speed priority',
2044 0 => 'Equal priority',
2045 1 => 'Focus priority',
2046 },
2047 },
2048 0x051b => { # (70D)
2049 Name => 'AFAreaSelectMethod',
2050 PrintConv => {
2051 0 => 'AF area selection button',
2052 1 => 'Main dial',
2053 },
2054 },
2055 0x051c => { # (750D)
2056 Name => 'AutoAFPointColorTracking',
2057 PrintConv => {
2058 0 => 'On-Shot AF only',
2059 1 => 'Disable',
2060 },
2061 },
2062 0x051d => { # (750D/760D)
2063 Name => 'VFDisplayIllumination',
2064 PrintConv => [{
2065 0 => 'Auto',
2066 1 => 'Enable',
2067 2 => 'Disable',
2068 },{
2069 0 => 'Non-illuminated', #(NC)
2070 1 => 'Illuminated', #(NC)
2071 }],
2072 },
2073 0x051e => { # (80D)
2074 Name => 'InitialAFPointAIServoAF',
2075 PrintConv => {
2076 0 => 'Auto',
2077 1 => 'Initial AF point selected',
2078 2 => 'Manual AF point',
2079 },
2080 },
2081 #### 3b) Drive
2082 0x060f => {
2083 Name => 'MirrorLockup',
2084 Notes => 'value of 2 not used by some models',
2085 PrintConv => {
2086 0 => 'Disable',
2087 1 => 'Enable',
2088 2 => 'Enable: Down with Set',
2089 },
2090 },
2091 0x0610 => [{ # (1DXmkIII)
2092 Name => 'ContinuousShootingSpeed',
2093 Condition => '$count == 6',
2094 Count => 6,
2095 PrintConv => [
2096 \%disableEnable,
2097 '"Hi $val"',
2098 '"Cont $val"',
2099 '"Lo $val"',
2100 '"Soft $val"',
2101 '"Soft LS $val"',
2102 ],
2103 PrintConvInv => [
2104 undef,
2105 '$val=~/(\d+)/ ? $1 : 0',
2106 '$val=~/(\d+)/ ? $1 : 0',
2107 '$val=~/(\d+)/ ? $1 : 0',
2108 '$val=~/(\d+)/ ? $1 : 0',
2109 '$val=~/(\d+)/ ? $1 : 0',
2110 ],
2111 },{ # (1DXmkIII firmware 1.3)
2112 Name => 'ContinuousShootingSpeed',
2113 Condition => '$count == 5',
2114 Count => 5,
2115 PrintConv => [
2116 '"Hi $val"',
2117 '"Cont $val"',
2118 '"Lo $val"',
2119 '"Soft $val"',
2120 '"Soft LS $val"',
2121 ],
2122 PrintConvInv => [
2123 '$val=~/(\d+)/ ? $1 : 0',
2124 '$val=~/(\d+)/ ? $1 : 0',
2125 '$val=~/(\d+)/ ? $1 : 0',
2126 '$val=~/(\d+)/ ? $1 : 0',
2127 '$val=~/(\d+)/ ? $1 : 0',
2128 ],
2129 },{ # others
2130 Name => 'ContinuousShootingSpeed',
2131 Count => 3,
2132 PrintConv => [
2133 \%disableEnable,
2134 '"Hi $val"',
2135 '"Lo $val"',
2136 ],
2137 PrintConvInv => [
2138 undef,
2139 '$val=~/(\d+)/ ? $1 : 0',
2140 '$val=~/(\d+)/ ? $1 : 0',
2141 ],
2142 }],
2143 0x0611 => {
2144 Name => 'ContinuousShotLimit',
2145 Count => 2,
2146 PrintConv => [
2147 \%disableEnable,
2148 '"$val shots"',
2149 ],
2150 PrintConvInv => [
2151 undef,
2152 '$val=~/(\d+)/ ? $1 : 0',
2153 ],
2154 },
2155 0x0612 => [{ # (1DXmkIII)
2156 Name => 'RestrictDriveModes',
2157 Condition => '$count == 1',
2158 Count => 1,
2159 PrintConv => 'sprintf("Flags 0x%x",$val)',
2160 PrintConvInv => '$val=~/0x([\dA-F]+)/i ? hex($1) : undef',
2161 },{ # (1DX)
2162 Name => 'RestrictDriveModes',
2163 Count => 2,
2164 PrintConv => [
2165 \%disableEnable,
2166 'sprintf("Flags 0x%x",$val)', # (Single,Cont Hi,Cont Lo,Timer 10,Timer 2,Silent,Super Hi)
2167 ],
2168 PrintConvInv => [
2169 undef,
2170 '$val=~/0x([\dA-F]+)/i ? hex($1) : undef',
2171 ],
2172 }],
2173 #### 4a) Operation
2174 0x0701 => [
2175 {
2176 Name => 'Shutter-AELock',
2177 Condition => q{
2178 $$self{Model} =~ /\b(1000D|XS|Kiss F|500D|T1i|Kiss X3|550D|T2i|Kiss X4)\b/ or
2179 $$self{Model} =~ /\b(600D|T3i|Kiss X5|1100D|T3|Kiss X50)\b/
2180 },
2181 Notes => '500D, 550D, 600D, 1000D and 1100D',
2182 PrintConv => {
2183 0 => 'AF/AE lock',
2184 1 => 'AE lock/AF',
2185 2 => 'AF/AF lock, No AE lock',
2186 3 => 'AE/AF, No AE lock',
2187 },
2188 },
2189 {
2190 Name => 'Shutter-AELock',
2191 Condition => '$count == 2',
2192 Notes => '250D',
2193 PrintConv => {
2194 '0 0' => 'AF/AE lock',
2195 '1 0' => 'AE lock/AF',
2196 '2 0' => 'AF/AF lock, No AE lock',
2197 '3 0' => 'AE/AF, No AE lock',
2198 },
2199 },
2200 {
2201 Name => 'AFAndMeteringButtons',
2202 Condition => '$$self{Model} =~ /\b60D\b/',
2203 Notes => '60D',
2204 PrintConv => {
2205 0 => 'Metering start',
2206 1 => 'Metering + AF start',
2207 2 => 'AE lock',
2208 3 => 'AF stop',
2209 4 => 'No function',
2210 },
2211 },
2212 {
2213 Name => 'ShutterButtonAFOnButton',
2214 Notes => 'other models',
2215 PrintConv => {
2216 0 => 'Metering + AF start',
2217 1 => 'Metering + AF start/AF stop',
2218 2 => 'Metering start/Meter + AF start',
2219 3 => 'AE lock/Metering + AF start',
2220 4 => 'Metering + AF start/disable',
2221 },
2222 },
2223 ],
2224 0x0702 => {
2225 Name => 'AFOnAELockButtonSwitch',
2226 PrintConv => \%disableEnable,
2227 },
2228 0x0703 => {
2229 Name => 'QuickControlDialInMeter',
2230 PrintConv => {
2231 0 => 'Exposure comp/Aperture',
2232 1 => 'AF point selection',
2233 2 => 'ISO speed',
2234 3 => 'AF point selection swapped with Exposure comp', #4
2235 4 => 'ISO speed swapped with Exposure comp', #4
2236 },
2237 },
2238 0x0704 => [
2239 {
2240 Name => 'SetButtonWhenShooting',
2241 Condition => '$$self{Model} =~ /\b(40D|50D|5D Mark II)\b/',
2242 Notes => '40D, 50D and 5DmkII; value of 5 is new for 50D, and 6 is new for 5DmkII',
2243 PrintConv => {
2244 0 => 'Normal (disabled)',
2245 1 => 'Image quality',
2246 2 => 'Picture style',
2247 3 => 'Menu display',
2248 4 => 'Image playback',
2249 5 => 'Quick control screen', #50D
2250 6 => 'Record movie (Live View)', #5DmkII
2251 },
2252 },
2253 {
2254 Name => 'SetButtonWhenShooting',
2255 Condition => '$$self{Model} =~ /\b60D\b/',
2256 Notes => '60D',
2257 PrintConv => {
2258 0 => 'Normal (disabled)',
2259 1 => 'Image quality',
2260 2 => 'Picture style',
2261 3 => 'White balance',
2262 4 => 'Flash exposure compensation',
2263 5 => 'Viewfinder leveling gauge',
2264 },
2265 },
2266 {
2267 Name => 'SetButtonWhenShooting',
2268 Condition => '$$self{Model} =~ /\b(450D|XSi|Kiss X2|550D|T2i|Kiss X4|600D|T3i|Kiss X5)\b/',
2269 Notes => '450D, 550D and 600D; value of 5 is new for 550D',
2270 PrintConv => {
2271 0 => 'Normal (disabled)',
2272 1 => 'Image quality',
2273 2 => 'Flash exposure compensation',
2274 3 => 'LCD monitor On/Off',
2275 4 => 'Menu display',
2276 5 => 'ISO speed',
2277 },
2278 },
2279 {
2280 Name => 'SetButtonWhenShooting',
2281 Condition => '$$self{Model} =~ /\b(1100D|T3|Kiss X50)\b/',
2282 Notes => '1100D',
2283 PrintConv => {
2284 0 => 'Normal (disabled)',
2285 1 => 'Image quality',
2286 2 => 'Flash exposure compensation',
2287 3 => 'LCD monitor On/Off',
2288 4 => 'Menu display',
2289 5 => 'Depth-of-field preview',
2290 },
2291 },
2292 {
2293 Name => 'SetButtonWhenShooting',
2294 Condition => '$$self{Model} =~ /\b(1000D|XS|Kiss F)\b/',
2295 Notes => '1000D',
2296 PrintConv => {
2297 0 => 'LCD monitor On/Off',
2298 1 => 'Image quality',
2299 2 => 'Flash exposure compensation',
2300 3 => 'Menu display',
2301 4 => 'Disabled',
2302 },
2303 },
2304 {
2305 Name => 'SetButtonWhenShooting',
2306 Condition => '$$self{Model} =~ /\b(500D|T1i|Kiss X3)\b/',
2307 Notes => '500D',
2308 PrintConv => {
2309 0 => 'Quick control screen',
2310 1 => 'Image quality',
2311 2 => 'Flash exposure compensation',
2312 3 => 'LCD monitor On/Off',
2313 4 => 'Menu display',
2314 5 => 'Disabled',
2315 },
2316 },
2317 {
2318 Name => 'SetButtonWhenShooting',
2319 Notes => '250D',
2320 Condition => '$count == 2',
2321 # (not sure how to decode this. seen: "37 0")
2322 PrintConv => { },
2323 },
2324 {
2325 Name => 'SetButtonWhenShooting',
2326 Notes => '1DmkIII and 1DmkIV',
2327 PrintConv => {
2328 0 => 'Normal (disabled)',
2329 1 => 'White balance',
2330 2 => 'Image size',
2331 3 => 'ISO speed',
2332 4 => 'Picture style',
2333 5 => 'Record func. + media/folder',
2334 6 => 'Menu display',
2335 7 => 'Image playback',
2336 },
2337 },
2338 ],
2339 0x0705 => {
2340 Name => 'ManualTv',
2341 Description => 'Manual Tv/Av For M',
2342 PrintConv => {
2343 0 => 'Tv=Main/Av=Control',
2344 1 => 'Tv=Control/Av=Main',
2345 },
2346 },
2347 0x0706 => {
2348 Name => 'DialDirectionTvAv',
2349 PrintConv => {
2350 0 => 'Normal',
2351 1 => 'Reversed',
2352 },
2353 },
2354 0x0707 => {
2355 Name => 'AvSettingWithoutLens',
2356 PrintConv => \%disableEnable,
2357 },
2358 0x0708 => {
2359 Name => 'WBMediaImageSizeSetting',
2360 PrintConv => {
2361 0 => 'Rear LCD panel',
2362 1 => 'LCD monitor',
2363 2 => 'Off (disable button)', # (1DX)
2364 },
2365 },
2366 0x0709 => {
2367 Name => 'LockMicrophoneButton',
2368 PrintConv => [{
2369 # called "sound" in 1DmkIII manual, and "memo" in 1DmkIV manual
2370 0 => 'Protect (hold:record memo)',
2371 1 => 'Record memo (protect:disable)',
2372 2 => 'Play memo (hold:record memo)', # new with 1DmkIV
2373 3 => 'Rating (protect/memo:disable)', # new with 1DX
2374 }],
2375 # (not sure what the 2nd number is -- new for 1DX. Seen a value of 31.
2376 # Memo quality may be set to 48kHz or 8kHz through another option that
2377 # doesn't seem to be stored separately -- is this it?)
2378 },
2379 0x070a => {
2380 Name => 'ButtonFunctionControlOff',
2381 PrintConv => {
2382 0 => 'Normal (enable)',
2383 1 => 'Disable main, Control, Multi-control',
2384 },
2385 },
2386 0x070b => { # 50D (also, 5DmkII writes this but it isn't in user guide)
2387 Name => 'AssignFuncButton',
2388 PrintConv => {
2389 0 => 'LCD brightness',
2390 1 => 'Image quality',
2391 2 => 'Exposure comp./AEB setting',
2392 3 => 'Image jump with main dial',
2393 4 => 'Live view function settings',
2394 },
2395 },
2396 0x070c => { # new for 7D
2397 Name => 'CustomControls',
2398 # (too much stuff to decode)
2399 },
2400 0x070d => { # new for 1DmkIV
2401 Name => 'StartMovieShooting',
2402 PrintConv => {
2403 0 => 'Default (from LV)',
2404 1 => 'Quick start (FEL button)',
2405 },
2406 },
2407 0x070e => { # new for 1100D
2408 Name => 'FlashButtonFunction',
2409 PrintConv => {
2410 0 => 'Raise built-in flash',
2411 1 => 'ISO speed',
2412 },
2413 },
2414 0x070f => { # new for 5DmkIII
2415 Name => 'MultiFunctionLock',
2416 PrintConv => [
2417 { #(NC)
2418 0 => 'Off',
2419 1 => 'On', # "On (main dial)" for 750D/760D?
2420 2 => 'On (quick control dial)', #(NC)
2421 3 => 'On (main dial and quick control dial)', #(NC)
2422 },
2423 { BITMASK => { #(NC)
2424 0 => 'Main dial',
2425 1 => 'Quick control dial',
2426 2 => 'Multi-controller',
2427 }},
2428 ],
2429 },
2430 0x0710 => { # (M)
2431 Name => 'TrashButtonFunction',
2432 PrintConv => {
2433 0 => 'Normal (set center AF point)',
2434 1 => 'Depth-of-field preview',
2435 },
2436 },
2437 0x0711 => { # (M)
2438 Name => 'ShutterReleaseWithoutLens',
2439 PrintConv => \%disableEnable,
2440 },
2441 0x0712 => { # (R)
2442 Name => 'ControlRingRotation',
2443 PrintConv => {
2444 0 => 'Normal',
2445 1 => 'Reversed',
2446 },
2447 },
2448 0x0713 => { # (R)
2449 Name => 'FocusRingRotation',
2450 PrintConv => {
2451 0 => 'Normal',
2452 1 => 'Reversed',
2453 },
2454 },
2455 0x0714 => { # (R)
2456 Name => 'RFLensMFFocusRingSensitivity',
2457 PrintConv => {
2458 0 => 'Varies With Rotation Speed',
2459 1 => 'Linked To Rotation Angle',
2460 },
2461 },
2462 0x0715 => { # (R)
2463 Name => 'CustomizeDials', # (NC, may be CustomizeM-FnBar)
2464 # (too much stuff to decode)
2465 },
2466 #### 4b) Others
2467 0x080b => [
2468 {
2469 Name => 'FocusingScreen',
2470 Condition => '$$self{Model} =~ /\b(40D|50D|60D)\b/',
2471 Notes => '40D, 50D and 60D',
2472 PrintConv => {
2473 0 => 'Ef-A',
2474 1 => 'Ef-D',
2475 2 => 'Ef-S',
2476 },
2477 },
2478 {
2479 Name => 'FocusingScreen',
2480 Condition => '$$self{Model} =~ /\b5D Mark II\b/',
2481 Notes => '5D Mark II',
2482 PrintConv => {
2483 0 => 'Eg-A',
2484 1 => 'Eg-D',
2485 2 => 'Eg-S',
2486 },
2487 },
2488 {
2489 Name => 'FocusingScreen',
2490 Condition => '$$self{Model} =~ /\b6D\b/',
2491 Notes => '6D',
2492 PrintConv => {
2493 0 => 'Eg-A II',
2494 1 => 'Eg-D',
2495 2 => 'Eg-S',
2496 },
2497 },
2498 {
2499 Name => 'FocusingScreen',
2500 Condition => '$$self{Model} =~ /\b7D Mark II\b/',
2501 Notes => '7D Mark II',
2502 PrintConv => {
2503 0 => 'Eh-A',
2504 1 => 'Eh-S',
2505 },
2506 },
2507 {
2508 Name => 'FocusingScreen',
2509 Condition => '$$self{Model} =~ /\b1D X\b/',
2510 Notes => '1DX',
2511 PrintConv => {
2512 0 => 'Ec-CV',
2513 1 => 'Ec-A,B,D,H,I,L',
2514 },
2515 },
2516 {
2517 Name => 'FocusingScreen',
2518 Notes => '1DmkIII, 1DSmkIII and 1DmkIV',
2519 PrintConv => {
2520 0 => 'Ec-CIV',
2521 1 => 'Ec-A,B,C,CII,CIII,D,H,I,L',
2522 2 => 'Ec-S',
2523 3 => 'Ec-N,R',
2524 },
2525 },
2526 ],
2527 0x080c => [{ # (1DXmkIII)
2528 Name => 'TimerLength',
2529 Condition => '$count == 3',
2530 Count => 3,
2531 PrintConv => [
2532 '"6 s: $val"',
2533 '"16 s: $val"',
2534 '"After release: $val"',
2535 ],
2536 PrintConvInv => [
2537 '$val=~/(\d+)$/ ? $1 : 0',
2538 '$val=~/(\d+)$/ ? $1 : 0',
2539 '$val=~/(\d+)$/ ? $1 : 0',
2540 ],
2541 },{
2542 Name => 'TimerLength',
2543 Count => 4,
2544 PrintConv => [
2545 \%disableEnable,
2546 '"6 s: $val"',
2547 '"16 s: $val"',
2548 '"After release: $val"',
2549 ],
2550 PrintConvInv => [
2551 undef,
2552 '$val=~/(\d+)$/ ? $1 : 0',
2553 '$val=~/(\d+)$/ ? $1 : 0',
2554 '$val=~/(\d+)$/ ? $1 : 0',
2555 ],
2556 }],
2557 0x080d => {
2558 Name => 'ShortReleaseTimeLag',
2559 PrintConv => \%disableEnable,
2560 },
2561 0x080e => {
2562 Name => 'AddAspectRatioInfo',
2563 PrintConv => {
2564 0 => 'Off',
2565 1 => '6:6',
2566 2 => '3:4',
2567 3 => '4:5',
2568 4 => '6:7',
2569 5 => '10:12',
2570 6 => '5:7',
2571 },
2572 },
2573 0x080f => {
2574 Name => 'AddOriginalDecisionData', # called ("image verification" in 1DmkIV manual)
2575 PrintConv => \%offOn,
2576 },
2577 0x0810 => {
2578 Name => 'LiveViewExposureSimulation',
2579 PrintConv => {
2580 0 => 'Disable (LCD auto adjust)',
2581 1 => 'Enable (simulates exposure)',
2582 },
2583 },
2584 0x0811 => {
2585 Name => 'LCDDisplayAtPowerOn',
2586 PrintConv => {
2587 0 => 'Display',
2588 1 => 'Retain power off status',
2589 },
2590 },
2591 0x0812 => { # (1DX)
2592 Name => 'MemoAudioQuality',
2593 PrintConv => {
2594 0 => 'High (48 kHz)',
2595 1 => 'Low (8 kHz)',
2596 },
2597 },
2598 0x0813 => { # (5DmkIII)
2599 Name => 'DefaultEraseOption',
2600 PrintConv => {
2601 0 => 'Cancel selected',
2602 1 => 'Erase selected',
2603 2 => 'Erase RAW selected', # (1DXmkIII)
2604 3 => 'Erase non-RAW selected', # (1DXmkIII)
2605 },
2606 },
2607 0x0814 => { # (5DS)
2608 Name => 'RetractLensOnPowerOff',
2609 PrintConv => \%enableDisable,
2610 },
2611 0x0815 => { # (R)
2612 Name => 'AddIPTCInformation',
2613 PrintConv => \%disableEnable,
2614 },
2615 0x0816 => { # (90D,RP)
2616 Name => 'AudioCompression',
2617 PrintConv => \%enableDisable,
2618 }
2619 );
2620  
2621 #------------------------------------------------------------------------------
2622 # Conversion routines
2623 # Inputs: 0) value to convert
2624 sub ConvertPfn($)
2625 0 ▶{
Subroutine ConvertPfn: not called CC=3 SCAR=24.8
Pod undocumented
2626 0 my $val = shift;
2627 0 ▶ return $val ? ($val==1 ? 'On' : "On ($val)") : "Off";
Branch: 2 branches
BranchTrueFalseTotal
$val ? : 0 0 0
$val == 1 ? : 0 0 0
2628 }
2629 sub ConvertPfnInv($)
2630 29 ▶{
Subroutine ConvertPfnInv: called CC=4 SCAR=14.6
Pod undocumented
2631 29 my $val = shift;
2632 29 ▶ return $1 if $val =~ /(\d+)/;
Branch: 1 branch
BranchTrueFalseTotal
if $val =~ /(\d+)/ 0 29 29
2633 29 ▶ return 1 if $val =~ /on/i;
Branch: 1 branch
BranchTrueFalseTotal
if $val =~ /on/i 0 29 29
2634 29 ▶ return 0 if $val =~ /off/i;
Branch: 1 branch
BranchTrueFalseTotal
if $val =~ /off/i 0 29 29
2635 29 return undef;
2636 }
2637  
2638 #------------------------------------------------------------------------------
2639 # Read/Write Canon custom 2 directory (new for 1D Mark III)
2640 # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
2641 # Returns: 1 on success
2642 sub ProcessCanonCustom2($$$)
2643 10 ▶{
Subroutine ProcessCanonCustom2: called CC=28 SCAR=40.0
Pod undocumented
2644 10 my ($et, $dirInfo, $tagTablePtr) = @_;
2645 10 my $dataPt = $$dirInfo{DataPt};
2646 10 my $offset = $$dirInfo{DirStart};
2647 10 my $size = $$dirInfo{DirLen};
2648 10 my $write = $$dirInfo{Write};
2649 10 my $verbose = $et->Options('Verbose');
2650 10 my $newTags;
2651  
2652 10 ▶ return 0 if $size < 2;
Branch: 1 branch
BranchTrueFalseTotal
if $size < 2 0 10 10
2653 # first entry in array must be the size
2654 10 my $len = Get16u($dataPt, $offset);
2655 10 ▶ unless ($len == $size and $len >= 8) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($len == $size and $len >= 8) 0 10 10
Condition33%1/3
$len == $size and $len >= 8
!ll&&!rl&&r
0010
MC/DC0%0/2
$len == $size and $len >= 8
$len == $size $len >= 8
Truth table33%1/3
A and B
A= $len == $sizeB= $len >= 8
ABresult
0X0
100
111
2656 0 $et->Warn('Invalid CanonCustom2 data');
2657 0 return 0;
2658 }
2659 # get group count
2660 10 my $count = Get32u($dataPt, $offset + 4);
2661 10 ▶ if ($write) {
Branch: 2 branches
BranchTrueFalseTotal
if ($write) { } 4 6 10
elsif ($verbose) { } 0 6 6
2662 4 $newTags = $et->GetNewTagInfoHash($tagTablePtr);
2663 4 $et->VPrint(0, " Rewriting CanonCustom2\n");
2664 } elsif ($verbose) {
2665 0 $et->VerboseDir('CanonCustom2', $count, $len);
2666 }
2667 10 my $pos = $offset + 8;
2668 10 my $end = $offset + $size;
2669 # loop through group records
2670 10 ▶ for (; $pos<$end; ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pos < $end) 26 10 36
2671 26 ▶ last if $pos + 12 > $end;
Branch: 1 branch
BranchTrueFalseTotal
if $pos + 12 > $end 0 26 26
2672 26 my $recNum = Get32u($dataPt, $pos);
2673 26 my $recLen = Get32u($dataPt, $pos + 4);
2674 26 my $recCount = Get32u($dataPt, $pos + 8);
2675 26 ▶ last if $recLen < 8; # must be at least 8 bytes for recNum and recLen
Branch: 1 branch
BranchTrueFalseTotal
if $recLen < 8 0 26 26
2676 26 $pos += 12;
2677 26 my $recPos = $pos;
2678 26 my $recEnd = $pos + $recLen - 8;
2679 26 ▶ if ($recEnd > $end) {
Branch: 1 branch
BranchTrueFalseTotal
if ($recEnd > $end) 0 26 26
2680 0 $et->Warn("Corrupted CanonCustom2 group $recNum");
2681 0 return 0;
2682 }
2683 26 ▶ if ($verbose and not $write) {
Branch: 1 branch
BranchTrueFalseTotal
if ($verbose and not $write) 0 26 26
Condition33%1/3
$verbose and not $write
!ll&&!rl&&r
2600
MC/DC0%0/2
$verbose and not $write
$verbose not $write
Truth table33%1/3
A and not(B)
A= $verboseB= not $write
ABresult
0X0
100
111
2684 0 $et->VerboseDir("CanonCustom2 group $recNum", $recCount, $recLen);
2685 }
2686 26 my ($i, $num, $tag);
2687 26 ▶ for ($i=0; $recPos + 8 < $recEnd; ++$i, $recPos+=4*$num) {
Branch: 1 branch
BranchTrueFalseTotal
if ($recPos + 8 < $recEnd) 206 26 232
2688 206 $tag = Get32u($dataPt, $recPos);
2689 206 $num = Get32u($dataPt, $recPos + 4);
2690 206 my $nextRec = $recPos + 8 + $num * 4;
2691 206 ▶ last if $nextRec > $recEnd;
Branch: 1 branch
BranchTrueFalseTotal
if $nextRec > $recEnd 0 206 206
2692 # patch for EOS-1DXmkIII firmware 1.0.0 bug:
2693 206 ▶ if ($tag == 0x70c and $num == 0x66 and $nextRec + 8 < $recEnd) {
Branch: 1 branch
BranchTrueFalseTotal
if ($tag == 1804 and $num == 102 and $nextRec + 8 < $recEnd) 0 206 206
Condition50%3/6
$tag == 1804 and $num == 102 and $nextRec + 8 < $recEnd
!ll&&!rl&&r
20600
$tag == 1804 and $num == 102
!ll&&!rl&&r
19970
MC/DC0%0/3
$tag == 1804 and $num == 102 and $nextRec + 8 < $recEnd
$tag == 1804 $num == 102 $nextRec + 8 < $recEnd
Truth table50%2/4
A and B and C
A= $tag == 1804B= $num == 102C= $nextRec + 8 < $recEnd
ABCresult
0XX0
10X0
1100
1111
2694 0 my $tmp = Get32u($dataPt, $nextRec + 4);
2695 0 ▶ if ($tmp == 0x70f) {
Branch: 1 branch
BranchTrueFalseTotal
if ($tmp == 1807) 0 0 0
2696 0 $et->Warn('Fixed incorrect CanonCustom tag 0x70c size', 1);
2697 0 ++$num; # (count should be one greater)
2698 }
2699 }
2700 206 $recPos += 8;
2701 206 my $val = ReadValue($dataPt, $recPos, 'int32s', $num, $num * 4);
2702 206 ▶ if ($write) {
Branch: 1 branch
BranchTrueFalseTotal
if ($write) { } 72 134 206
2703 # write new value
2704 72 my $tagInfo = $$newTags{$tag};
2705 72 ▶ next unless $$newTags{$tag};
Branch: 1 branch
BranchTrueFalseTotal
unless $newTags->{$tag} 70 2 72
2706 2 ▶ $tagInfo = $et->GetTagInfo($tagTablePtr, $tag, \$val, undef, $num) or next;
Branch: 1 branch
BranchTrueFalseTotal
$tagInfo = $et->GetTagInfo($tagTablePtr, $tag, \$val, undef, $num) or next 2 0 2
2707 2 ▶ my $nvHash = $et->GetNewValueHash($tagInfo) or next;
Branch: 1 branch
BranchTrueFalseTotal
my $nvHash = $et->GetNewValueHash($tagInfo) or next 2 0 2
2708 2 ▶ next unless $et->IsOverwriting($nvHash, $val);
Branch: 1 branch
BranchTrueFalseTotal
unless $et->IsOverwriting($nvHash, $val) 0 2 2
2709 2 my $newVal = $et->GetNewValue($nvHash);
2710 2 ▶ next unless defined $newVal; # can't delete from a custom table
Branch: 1 branch
BranchTrueFalseTotal
unless defined $newVal 0 2 2
2711 2 WriteValue($newVal, 'int32s', $num, $dataPt, $recPos);
2712 2 $et->VerboseValue("- CanonCustom:$$tagInfo{Name}", $val);
2713 2 $et->VerboseValue("+ CanonCustom:$$tagInfo{Name}", $newVal);
2714 2 ++$$et{CHANGED};
2715 } else {
2716 # save extracted tag
2717 134 my $oldInfo = $$tagTablePtr{$tag};
2718 134 $et->HandleTag($tagTablePtr, $tag, $val,
2719 Index => $i,
2720 Format => 'int32u',
2721 Count => $num,
2722 Size => $num * 4,
2723 );
2724 134 my $tagInfo = $$tagTablePtr{$tag};
2725 # generate properly formatted description if we just added the tag
2726 134 ▶ if ($tagInfo and not $oldInfo) {
Branch: 1 branch
BranchTrueFalseTotal
if ($tagInfo and not $oldInfo) 0 134 134
Condition33%1/3
$tagInfo and not $oldInfo
!ll&&!rl&&r
01340
MC/DC0%0/2
$tagInfo and not $oldInfo
$tagInfo not $oldInfo
Truth table33%1/3
A and not(B)
A= $tagInfoB= not $oldInfo
ABresult
0X0
100
111
2727 0 ($$tagInfo{Description} = $$tagInfo{Name}) =~ tr/_/ /;
2728 0 $$tagInfo{Description} =~ s/CanonCustom Functions/Canon Custom Functions /;
2729 }
2730 }
2731 }
2732 26 ▶ if ($i != $recCount) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i != $recCount) 0 26 26
2733 0 $et->Warn('Missing '.($recCount-$i)." entries in CanonCustom2 group $recNum directory", 1);
2734 }
2735 26 $pos = $recEnd;
2736 }
2737 10 ▶ if ($pos != $end) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pos != $end) 0 10 10
2738 # Note: a firmware bug in the EOS M5 and M6 stores an incorrect
2739 # size for the 2nd CanonCustom2 record, so this message is expected
2740 # for these models...
2741 0 $et->Warn('Possibly corrupted CanonCustom2 data');
2742 0 return 0;
2743 }
2744 10 return 1;
2745 }
2746  
2747 #------------------------------------------------------------------------------
2748 # Write Canon custom 2 data
2749 # Inputs: 0) ExifTool object reference, 1) dirInfo hash ref, 2) tag table ref
2750 # Returns: New custom data block or undefined on error
2751 sub WriteCanonCustom2($$$)
2752 120 ▶{
Subroutine WriteCanonCustom2: called CC=3 SCAR=11.0
Pod undocumented
2753 120 my ($et, $dirInfo, $tagTablePtr) = @_;
2754 120 ▶ $et or return 1; # allow dummy access to autoload this package
Branch: 1 branch
BranchTrueFalseTotal
$et or return 1 4 116 120
2755 4 my $dataPt = $$dirInfo{DataPt};
2756 # edit a copy of the custom function 2 data
2757 4 my $buff = substr($$dataPt, $$dirInfo{DirStart}, $$dirInfo{DirLen});
2758 my %dirInfo = (
2759 DataPt => \$buff,
2760 DirStart => 0,
2761 DirLen => $$dirInfo{DirLen},
2762 4 Write => 1,
2763 );
2764 4 ▶ ProcessCanonCustom2($et, \%dirInfo, $tagTablePtr) or return undef;
Branch: 1 branch
BranchTrueFalseTotal
&ProcessCanonCustom2($et, \%dirInfo, $tagTablePtr) or return undef 4 0 4
2765 4 return $buff;
2766 }
2767  
2768 #------------------------------------------------------------------------------
2769 # Process Canon custom directory
2770 # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
2771 # Returns: 1 on success
2772 sub ProcessCanonCustom($$$)
2773 9 ▶{
Subroutine ProcessCanonCustom: called CC=6 SCAR=19.6
Pod undocumented
2774 9 my ($et, $dirInfo, $tagTablePtr) = @_;
2775 9 my $dataPt = $$dirInfo{DataPt};
2776 9 my $offset = $$dirInfo{DirStart};
2777 9 my $size = $$dirInfo{DirLen};
2778 9 my $verbose = $et->Options('Verbose');
2779  
2780 # first entry in array must be the size
2781 9 my $len = Get16u($dataPt,$offset);
2782 9 ▶ unless ($len == $size or ($$et{Model}=~/\bD60\b/ and $len+2 == $size)) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($len == $size or $et->{"Model"} =~ /\bD60\b/ and $len + 2 == $size) 0 9 9
Condition16%1/6
$len == $size or $et->{"Model"} =~ /\bD60\b/ and $len + 2 == $size
l!l&&r!l&&!r
900
$et->{"Model"} =~ /\bD60\b/ and $len + 2 == $size
!ll&&!rl&&r
000
MC/DC0%0/3
$len == $size or $et->{"Model"} =~ /\bD60\b/ and $len + 2 == $size
$len == $size $et->{"Model"} =~ /\bD60\b/ $len + 2 == $size
Truth table25%1/4
A or B and C
A= $len == $sizeB= $et->{"Model"} =~ /\bD60\b/C= $len + 2 == $size
ABCresult
1XX1
0111
00X0
0100
2783 0 $et->Warn("Invalid CanonCustom data");
2784 0 return 0;
2785 }
2786 9 ▶ $verbose and $et->VerboseDir('CanonCustom', $size/2-1);
Branch: 1 branch
BranchTrueFalseTotal
$verbose and $et->VerboseDir("CanonCustom", $size / 2 - 1) 0 9 9
2787 9 my $pos;
2788 9 ▶ for ($pos=2; $pos<$size; $pos+=2) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pos < $size) 81 9 90
2789 # ($pos is position within custom directory)
2790 81 my $val = Get16u($dataPt,$offset+$pos);
2791 81 my $tag = ($val >> 8);
2792 81 $val = ($val & 0xff);
2793 81 $et->HandleTag($tagTablePtr, $tag, $val,
2794 Index => $pos/2-1,
2795 Format => 'int8u',
2796 Count => 1,
2797 Size => 1,
2798 );
2799 }
2800 9 return 1;
2801 }
2802  
2803 #------------------------------------------------------------------------------
2804 # Check new value for Canon custom data block
2805 # Inputs: 0) ExifTool object reference, 1) tagInfo hash ref, 2) raw value ref
2806 # Returns: error string or undef (and may modify value) on success
2807 sub CheckCanonCustom($$$)
2808 55 ▶{
Subroutine CheckCanonCustom: called CC=1 SCAR=0.0
Pod undocumented
2809 55 my ($et, $tagInfo, $valPtr) = @_;
2810 55 return Image::ExifTool::CheckValue($valPtr, 'int8u');
2811 }
2812  
2813 #------------------------------------------------------------------------------
2814 # Write Canon custom data
2815 # Inputs: 0) ExifTool object reference, 1) dirInfo hash ref, 2) tag table ref
2816 # Returns: New custom data block or undefined on error
2817 sub WriteCanonCustom($$$)
2818 223 ▶{
Subroutine WriteCanonCustom: called CC=12 SCAR=33.3
Pod undocumented
2819 223 my ($et, $dirInfo, $tagTablePtr) = @_;
2820 223 ▶ $et or return 1; # allow dummy access to autoload this package
Branch: 1 branch
BranchTrueFalseTotal
$et or return 1 6 217 223
2821 6 my $dataPt = $$dirInfo{DataPt};
2822 6 ▶ my $dirStart = $$dirInfo{DirStart} || 0;
Condition50%1/2
$dirInfo->{'DirStart'} || 0
l!l
60
MC/DC0%0/1
$dirInfo->{'DirStart'} || 0
$dirInfo->{'DirStart'}
Truth table50%1/2
A
A= $dirInfo->{'DirStart'}
Aresult
11
00
2823 6 ▶ my $dirLen = $$dirInfo{DirLen} || length($$dataPt) - $dirStart;
Condition33%1/3
$dirInfo->{'DirLen'} || length($$dataPt) - $dirStart
l!l&&r!l&&!r
600
MC/DC0%0/2
$dirInfo->{'DirLen'} || length($$dataPt) - $dirStart
$dirInfo->{'DirLen'} length($$dataPt) - $dirStart
Truth table33%1/3
A || B
A= $dirInfo->{'DirLen'}B= length($$dataPt) - $dirStart
ABresult
1X1
011
000
2824 6 my $dirName = $$dirInfo{DirName};
2825 6 ▶ my $newData = substr($$dataPt, $dirStart, $dirLen) or return undef;
Branch: 1 branch
BranchTrueFalseTotal
my $newData = substr($$dataPt, $dirStart, $dirLen) or return undef 6 0 6
2826 6 $dataPt = \$newData;
2827  
2828 # first entry in array must be the size
2829 6 my $len = Get16u($dataPt, 0);
2830 6 ▶ unless ($len == $dirLen or ($$et{Model}=~/\bD60\b/ and $len+2 == $dirLen)) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($len == $dirLen or $et->{"Model"} =~ /\bD60\b/ and $len + 2 == $dirLen) 0 6 6
Condition16%1/6
$len == $dirLen or $et->{"Model"} =~ /\bD60\b/ and $len + 2 == $dirLen
l!l&&r!l&&!r
600
$et->{"Model"} =~ /\bD60\b/ and $len + 2 == $dirLen
!ll&&!rl&&r
000
MC/DC0%0/3
$len == $dirLen or $et->{"Model"} =~ /\bD60\b/ and $len + 2 == $dirLen
$len == $dirLen $et->{"Model"} =~ /\bD60\b/ $len + 2 == $dirLen
Truth table25%1/4
A or B and C
A= $len == $dirLenB= $et->{"Model"} =~ /\bD60\b/C= $len + 2 == $dirLen
ABCresult
1XX1
0111
00X0
0100
2831 0 $et->Warn("Invalid CanonCustom data");
2832 0 return undef;
2833 }
2834 6 my $newTags = $et->GetNewTagInfoHash($tagTablePtr);
2835 6 my $pos;
2836 6 ▶ for ($pos=2; $pos<$dirLen; $pos+=2) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pos < $dirLen) 54 6 60
2837 54 my $val = Get16u($dataPt, $pos);
2838 54 my $tag = ($val >> 8);
2839 54 my $tagInfo = $$newTags{$tag};
2840 54 ▶ next unless $tagInfo;
Branch: 1 branch
BranchTrueFalseTotal
unless $tagInfo 54 0 54
2841 0 my $nvHash = $et->GetNewValueHash($tagInfo);
2842 0 $val = ($val & 0xff);
2843 0 ▶ next unless $et->IsOverwriting($nvHash, $val);
Branch: 1 branch
BranchTrueFalseTotal
unless $et->IsOverwriting($nvHash, $val) 0 0 0
2844 0 my $newVal = $et->GetNewValue($nvHash);
2845 0 ▶ next unless defined $newVal; # can't delete from a custom table
Branch: 1 branch
BranchTrueFalseTotal
unless defined $newVal 0 0 0
2846 0 Set16u(($newVal & 0xff) + ($tag << 8), $dataPt, $pos);
2847 0 $et->VerboseValue("- $dirName:$$tagInfo{Name}", $val);
2848 0 $et->VerboseValue("+ $dirName:$$tagInfo{Name}", $newVal);
2849 0 ++$$et{CHANGED};
2850 }
2851 6 return $newData;
2852 }
2853  
2854  
2855 7 1; # end
2856  
2857 __END__
« Image/ExifTool/GeoTiff.pm ↑ Summary Image/ExifTool/FLIF.pm »