-
Notifications
You must be signed in to change notification settings - Fork 1
/
canon.c
1445 lines (1232 loc) · 37.2 KB
/
canon.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Copyright (c) 2001-2007, Eric M. Johnston <[email protected]>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Eric M. Johnston.
* 4. Neither the name of the author nor the names of any co-contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: canon.c,v 1.54 2007/12/16 03:06:13 ejohnst Exp $
*/
/*
* Exif tag definitions for Canon maker notes.
* Developed from http://www.burren.cx/david/canon.html.
* EOS 1D and 1Ds contributions from Stan Jirman <[email protected]>.
* EOS 10D contributions from Jason Montojo <[email protected]>.
* EOS 20D contributions from Per Kristian Hove <[email protected]>.
* EOS 5D contributions from Albert Max Lai <[email protected]>.
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "makers.h"
/*
* Calculate and format an exposure value ("-n.nn EV").
*/
static float
calcev(char *c, int l, int16_t v)
{
#if 0 /* Adjustment seems silly. If someone complains, I'll reconsider. */
int16_t n;
/*
* XXX 1/3 and 2/3 values seem to be a bit off. This makes a
* slight adjustment; may want to revisit.
*/
n = (abs(v) - 32) * (v & 0x8000 ? -1 : 1);
if (n == 20 || n == -12) v++;
else if (n == -20 || n == 12) v--;
#endif
if (c) snprintf(c, l, "%.2f EV", (float)v / 32);
return ((float)v / 32);
}
/* Macro mode. */
static struct descrip canon_macro[] = {
{ 1, "Macro" },
{ 2, "Normal" },
{ -1, "Unknown" },
};
/* Focus type. */
static struct descrip canon_focustype[] = {
{ 0, "Manual" },
{ 1, "Auto" },
{ 2, "Auto" },
{ 3, "Close-Up (Macro Mode)" },
{ 7, "Infinity Mode" },
{ 8, "Locked (Pan Mode)" },
{ -1, "Unknown" },
};
/* Quality. */
static struct descrip canon_quality[] = {
{ 2, "Normal" },
{ 3, "Fine" },
{ 5, "Superfine" },
{ -1, "Unknown" },
};
/* Flash mode. */
static struct descrip canon_flash[] = {
{ 0, "Off" },
{ 1, "Auto" },
{ 2, "On" },
{ 3, "Red-Eye Reduction" },
{ 4, "Slow-Synchro" },
{ 5, "Red-Eye Reduction (Auto)" },
{ 6, "Red-Eye Reduction (On)" },
{ 16, "External Flash" },
{ -1, "Unknown" },
};
/* Drive mode. */
static struct descrip canon_drive[] = {
{ 0, "Single" }, /* "Timed" when field 2 is > 0. */
{ 1, "Continuous" },
{ -1, "Unknown" },
};
/* Focus mode. */
static struct descrip canon_focus1[] = {
{ 0, "One-Shot" },
{ 1, "AI Servo" },
{ 2, "AI Focus" },
{ 3, "Manual" },
{ 4, "Single" },
{ 5, "Continuous" },
{ 6, "Manual" },
{ -1, "Unknown" },
};
/* Image size. */
static struct descrip canon_imagesz[] = {
{ 0, "Large" },
{ 1, "Medium" },
{ 2, "Small" },
{ -1, "Unknown" },
};
/* Shooting mode. */
static struct descrip canon_shoot[] = {
{ 0, "Full Auto" },
{ 1, "Manual" },
{ 2, "Landscape" },
{ 3, "Fast Shutter" },
{ 4, "Slow Shutter" },
{ 5, "Night" },
{ 6, "Black & White" },
{ 7, "Sepia" },
{ 8, "Portrait" },
{ 9, "Sports" },
{ 10, "Macro/Close-Up" },
{ 11, "Pan Focus" },
{ 19, "Indoor" },
{ 22, "Underwater" },
{ 24, "Kids & Pets" },
{ 25, "Night Snapshot" },
{ -1, "Unknown" },
};
/* Digital zoom. */
static struct descrip canon_dzoom[] = {
{ 0, "None" },
{ 1, "x2" },
{ 2, "x4" },
{ -1, "Unknown" },
};
/* Contrast, saturation, & sharpness. */
static struct descrip canon_range[] = {
{ 0, "Normal" },
{ 1, "High" },
{ 0xffff, "Low" },
{ -1, "Unknown" },
};
/* ISO speed rating. */
static struct descrip canon_iso[] = {
{ 15, "Auto" },
{ 16, "50" },
{ 17, "100" },
{ 18, "200" },
{ 19, "400" },
{ -1, "Unknown" },
};
/* Metering mode. */
static struct descrip canon_meter[] = {
{ 0, "Default" },
{ 1, "Spot" },
{ 3, "Evaluative" },
{ 4, "Partial" },
{ 5, "Center-Weighted" },
{ -1, "Unknown" },
};
/* Exposure mode. */
static struct descrip canon_expmode[] = {
{ 0, "Easy Shooting" },
{ 1, "Program" },
{ 2, "Tv-Priority" },
{ 3, "Av-Priority" },
{ 4, "Manual" },
{ 5, "A-DEP" },
{ 6, "DEP" },
{ -1, "Unknown" },
};
/* White balance. */
static struct descrip canon_whitebal[] = {
{ 0, "Auto" },
{ 1, "Daylight" },
{ 2, "Cloudy" },
{ 3, "Tungsten" },
{ 4, "Fluorescent" },
{ 5, "Flash" },
{ 6, "Custom" },
{ 7, "Black & White" },
{ 8, "Shade" },
{ 9, "Manual Temperature" },
{ 14, "Daylight Fluorescent" },
{ 15, "Custom 1" },
{ 16, "Custom 2" },
{ 17, "Underwater" },
{ -1, "Unknown" },
};
/* Maker note IFD tags. */
static struct exiftag canon_tags[] = {
{ 0x0001, TIFF_SHORT, 0, ED_UNK, "Canon1Tag",
"Canon Tag1 Offset", NULL },
{ 0x0004, TIFF_SHORT, 0, ED_UNK, "Canon4Tag",
"Canon Tag4 Offset", NULL },
{ 0x0006, TIFF_ASCII, 32, ED_VRB, "ImageType",
"Image Type", NULL },
{ 0x0007, TIFF_ASCII, 24, ED_CAM, "FirmwareVer",
"Firmware Version", NULL },
{ 0x0008, TIFF_LONG, 1, ED_IMG, "ImgNum",
"Image Number", NULL },
{ 0x0009, TIFF_ASCII, 32, ED_CAM, "OwnerName",
"Owner Name", NULL },
{ 0x000c, TIFF_LONG, 1, ED_CAM, "Serial",
"Serial Number", NULL },
{ 0x000f, TIFF_SHORT, 0, ED_UNK, "CustomFunc",
"Custom Function", NULL },
{ 0x0090, TIFF_SHORT, 0, ED_UNK, "CustomFunc",
"Custom Function", NULL },
{ 0x0093, TIFF_SHORT, 0, ED_UNK, "Canon93Tag",
"Canon Tag93 Offset", NULL },
{ 0x0095, TIFF_ASCII, 64, ED_PAS, "LensName",
"Lens Name", NULL },
{ 0x00a0, TIFF_SHORT, 0, ED_UNK, "CanonA0Tag",
"Canon TagA0 Offset", NULL },
{ 0xffff, TIFF_UNKN, 0, ED_UNK, "CanonUnknown",
"Canon Unknown", NULL },
};
/* Fields under tag 0x0001 (camera settings). */
static struct exiftag canon_tags01[] = {
{ 0, TIFF_SHORT, 0, ED_VRB, "Canon1Len",
"Canon Tag1 Length", NULL },
{ 1, TIFF_SHORT, 0, ED_IMG, "CanonMacroMode",
"Macro Mode", canon_macro },
{ 2, TIFF_SHORT, 0, ED_VRB, "CanonTimerLen",
"Self-Timer Length", NULL },
{ 3, TIFF_SHORT, 0, ED_IMG, "CanonQuality",
"Compression Setting", canon_quality },
{ 4, TIFF_SHORT, 0, ED_IMG, "CanonFlashMode",
"Flash Mode", canon_flash },
{ 5, TIFF_SHORT, 0, ED_IMG, "CanonDriveMode",
"Drive Mode", canon_drive },
{ 7, TIFF_SHORT, 0, ED_IMG, "CanonFocusMode",
"Focus Mode", canon_focus1 },
{ 10, TIFF_SHORT, 0, ED_IMG, "CanonImageSize",
"Image Size", canon_imagesz },
{ 11, TIFF_SHORT, 0, ED_IMG, "CanonShootMode",
"Shooting Mode", canon_shoot },
{ 12, TIFF_SHORT, 0, ED_VRB, "CanonDigiZoom",
"Digital Zoom", NULL },
{ 13, TIFF_SHORT, 0, ED_IMG, "CanonContrast",
"Contrast", canon_range },
{ 14, TIFF_SHORT, 0, ED_IMG, "CanonSaturate",
"Saturation", canon_range },
{ 15, TIFF_SHORT, 0, ED_IMG, "CanonSharpness",
"Sharpness", canon_range },
{ 16, TIFF_SHORT, 0, ED_IMG, "CanonISO",
"ISO Speed Rating", canon_iso },
{ 17, TIFF_SHORT, 0, ED_IMG, "CanonMeterMode",
"Metering Mode", canon_meter },
{ 18, TIFF_SHORT, 0, ED_IMG, "CanonFocusType",
"Focus Type", canon_focustype },
{ 19, TIFF_SHORT, 0, ED_UNK, "CanonAFPoint",
"Autofocus Point", NULL },
{ 20, TIFF_SHORT, 0, ED_IMG, "CanonExpMode",
"Exposure Mode", canon_expmode },
{ 23, TIFF_SHORT, 0, ED_UNK, "CanonMaxFocal",
"Max Focal Length", NULL },
{ 24, TIFF_SHORT, 0, ED_UNK, "CanonMinFocal",
"Min Focal Length", NULL },
{ 25, TIFF_SHORT, 0, ED_UNK, "CanonFocalUnits",
"Focal Units/mm", NULL },
{ 28, TIFF_SHORT, 0, ED_UNK, "CanonFlashAct",
"Flash Activity", NULL },
{ 29, TIFF_SHORT, 0, ED_UNK, "CanonFlashDet",
"Flash Details", NULL },
{ 36, TIFF_SHORT, 0, ED_VRB, "CanonDZoomRes",
"Zoomed Resolution", NULL },
{ 37, TIFF_SHORT, 0, ED_VRB, "CanonBZoomRes",
"Base Zoom Resolution", NULL },
{ 0xffff, TIFF_SHORT, 0, ED_UNK, "Canon01Unknown",
"Canon Tag1 Unknown", NULL },
};
/* Fields under tag 0x0004 (shot info). */
static struct exiftag canon_tags04[] = {
{ 0, TIFF_SHORT, 0, ED_VRB, "Canon4Len",
"Canon Tag4 Length", NULL },
{ 2, TIFF_SHORT, 0, ED_IMG, "CanonSensorSpeed",
"Sensor ISO Speed", NULL },
{ 6, TIFF_SHORT, 0, ED_IMG, "CanonExpComp",
"Exposure Compensation", NULL },
{ 7, TIFF_SHORT, 0, ED_IMG, "CanonWhiteB",
"White Balance", canon_whitebal },
{ 9, TIFF_SHORT, 0, ED_IMG, "CanonSequence",
"Sequence Number", NULL },
{ 14, TIFF_SHORT, 0, ED_UNK, "CanonAFPoint2",
"Autofocus Point", NULL },
{ 15, TIFF_SHORT, 0, ED_IMG, "CanonFlashBias",
"Flash Bias", NULL },
{ 19, TIFF_SHORT, 0, ED_IMG, "CanonSubjDst",
"Subject Distance", NULL },
{ 0xffff, TIFF_SHORT, 0, ED_UNK, "Canon04Unknown",
"Canon Tag4 Unknown", NULL },
};
/* Fields under tag 0x00a0 (EOS 1D, 1Ds). */
static struct exiftag canon_tagsA0[] = {
{ 0, TIFF_SHORT, 0, ED_VRB, "CanonA0Len",
"Canon TagA0 Length", NULL },
{ 9, TIFF_SHORT, 0, ED_IMG, "CanonColorTemp",
"Color Temperature", NULL },
{ 10, TIFF_SHORT, 0, ED_IMG, "CanonColorMatrix",
"Color Matrix", NULL },
{ 0xffff, TIFF_SHORT, 0, ED_UNK, "CanonA0Unknown",
"Canon TagA0 Unknown", NULL },
};
/* Fields under tag 0x0093 (counter on EOS 1D, 1Ds). */
static struct exiftag canon_tags93[] = {
{ 0, TIFF_SHORT, 0, ED_VRB, "Canon93Len",
"Canon Tag93 Length", NULL },
{ 1, TIFF_SHORT, 0, ED_VRB, "CanonActuateMult",
"Actuation Multiplier", NULL },
{ 2, TIFF_SHORT, 0, ED_VRB, "CanonActuateCount",
"Actuation Counter", NULL },
{ 0xffff, TIFF_SHORT, 0, ED_UNK, "Canon93Unknown",
"Canon Tag93 Unknown", NULL },
};
/* Placeholder for unknown fields. */
static struct exiftag canon_tagsunk[] = {
{ 0xffff, TIFF_SHORT, 0, ED_UNK, "CanonUnknown",
"Canon Unknown", NULL },
};
/* Value descriptions for custom functions. */
static struct descrip ccstm_offon[] = {
{ 0, "Off" },
{ 1, "On" },
{ -1, "Unknown" },
};
static struct descrip ccstm_shutter[] = {
{ 0, "AF/AE Lock" },
{ 1, "AE Lock/AF" },
{ 2, "AF/AF Lock" },
{ 3, "AE+Release/AE+AF" },
{ -1, "Unknown" },
};
static struct descrip ccstm_disen[] = {
{ 0, "Disabled" },
{ 1, "Enabled" },
{ -1, "Unknown" },
};
static struct descrip ccstm_explvl[] = {
{ 0, "1/2 Stop" },
{ 1, "1/3 Stop" },
{ -1, "Unknown" },
};
static struct descrip ccstm_autooff[] = {
{ 0, "Auto" },
{ 1, "Off" },
{ -1, "Unknown" },
};
static struct descrip ccstm_shutspd[] = {
{ 0, "Auto" },
{ 1, "1/200 (Fixed)" },
{ -1, "Unknown" },
};
static struct descrip ccstm_aebseq[] = {
{ 0, "0,-,+/Enabled" },
{ 1, "0,-,+/Disabled" },
{ 2, "-,0,+/Enabled" },
{ 3, "-,0,+/Disabled" },
{ -1, "Unknown" },
};
static struct descrip ccstm_shutsync[] = {
{ 0, "1st-Curtain Sync" },
{ 1, "2nd-Curtain Sync" },
{ -1, "Unknown" },
};
static struct descrip ccstm_lensaf[] = {
{ 0, "AF Stop" },
{ 1, "Operate AF" },
{ 2, "Lock AE & Start Timer" },
{ -1, "Unknown" },
};
static struct descrip ccstm_endis[] = {
{ 0, "Enabled" },
{ 1, "Disabled" },
{ -1, "Unknown" },
};
static struct descrip ccstm_menubut[] = {
{ 0, "Top" },
{ 1, "Previous (Volatile)" },
{ 2, "Previous" },
{ -1, "Unknown" },
};
static struct descrip ccstm_setbut[] = {
{ 0, "Not Assigned" },
{ 1, "Change Quality" },
{ 2, "Change ISO Speed" },
{ 3, "Select Parameters" },
{ -1, "Unknown" },
};
static struct descrip ccstm_yesno[] = {
{ 0, "Yes" },
{ 1, "No" },
{ -1, "Unknown" },
};
static struct descrip ccstm_noyes[] = {
{ 0, "No" },
{ 1, "Yes" },
{ -1, "Unknown" },
};
static struct descrip ccstm_onoff[] = {
{ 0, "On" },
{ 1, "Off" },
{ -1, "Unknown" },
};
static struct descrip ccstm_afsel[] = {
{ 0, "H=AF+Main/V=AF+Command" },
{ 1, "H=Comp+Main/V=Comp+Command" },
{ 2, "H=Command Only/V=Assist+Main" },
{ 3, "H=FEL+Main/V=FEL+Command" },
{ -1, "Unknown" },
};
static struct descrip ccstm_afill[] = {
{ 0, "On" },
{ 1, "Off" },
{ 2, "On Without Dimming" },
{ 3, "Brighter" },
{ -1, "Unknown" },
};
static struct descrip ccstm_lcdpanels[] = {
{ 0, "Remain. Shots/File No." },
{ 1, "ISO/Remain. Shots" },
{ 2, "ISO/File No." },
{ 3, "Shots In Folder/Remain. Shots" },
{ -1, "Unknown" },
};
static struct descrip ccstm_usmmf[] = {
{ 0, "Turns On After One-Shot AF" },
{ 1, "Turns Off After One-Shot AF" },
{ 2, "Always Turned Off" },
{ -1, "Unknown" },
};
static struct descrip ccstm_explvlinc[] = {
{ 0, "1/3-Stop Set, 1/3-Stop Comp" },
{ 1, "1-Stop Set, 1/3-Stop Comp" },
{ 2, "1/2-Stop Set, 1/2-Stop Comp" },
{ -1, "Unknown" },
};
static struct descrip ccstm_tvavform[] = {
{ 0, "Tv=Main/Av=Control" },
{ 1, "Tv=Control/Av=Main" },
{ 2, "Tv=Main/Av=Main w/o Lens" },
{ 3, "Tv=Control/Av=Main w/o Lens" },
{ -1, "Unknown" },
};
static struct descrip ccstm_shutterael[] = {
{ 0, "AF/AE Lock Stop" },
{ 1, "AE Lock/AF" },
{ 2, "AF/AF Lock, No AE Lock" },
{ 3, "AE/AF, No AE Lock" },
{ -1, "Unknown" },
};
static struct descrip ccstm_afspot[] = {
{ 0, "45/Center AF Point" },
{ 1, "11/Active AF Point" },
{ 2, "11/Center AF Point" },
{ 3, "9/Active AF Point" },
{ -1, "Unknown" },
};
static struct descrip ccstm_afact[] = {
{ 0, "Single AF Point" },
{ 1, "Expanded (TTL. of 7 AF Points)" },
{ 2, "Automatic Expanded (Max. 13)" },
{ -1, "Unknown" },
};
static struct descrip ccstm_regaf[] = {
{ 0, "Assist + AF" },
{ 1, "Assist" },
{ 2, "Only While Pressing Assist" },
{ -1, "Unknown" },
};
static struct descrip ccstm_lensaf1[] = {
{ 0, "AF Stop" },
{ 1, "AF Start" },
{ 2, "AE Lock While Metering" },
{ 3, "AF Point: M->Auto/Auto->Ctr" },
{ 4, "AF Mode: ONESHOT<->SERVO" },
{ 5, "IS Start" },
{ -1, "Unknown" },
};
static struct descrip ccstm_aisens[] = {
{ 0, "Standard" },
{ 1, "Slow" },
{ 2, "Moderately Slow" },
{ 3, "Moderately Fast" },
{ 4, "Fast" },
{ -1, "Unknown" },
};
static struct descrip ccstm_fscr[] = {
{ 0, "Ec-N, R" },
{ 1, "Ec-A,B,C,CII,CIII,D,H,I,L" },
{ -1, "Unknown" },
};
static struct descrip ccstm_10dsetbut[] = {
{ 0, "Not Assigned" },
{ 1, "Change Quality" },
{ 2, "Change Parameters" },
{ 3, "Menu Display" },
{ 4, "Image Replay" },
{ -1, "Unknown" },
};
static struct descrip ccstm_10dshutter[] = {
{ 0, "AF/AE Lock" },
{ 1, "AE Lock/AF" },
{ 2, "AF/AF Lock, No AE Lock" },
{ 3, "AE/AF, No AE Lock" },
{ -1, "Unknown" },
};
static struct descrip ccstm_assistflash[] = {
{ 0, "Emits/Fires" },
{ 1, "Does Not Emit/Fires" },
{ 2, "Only Ext. Flash Emits/Fires" },
{ 3, "Emits/Does Not Fire" },
{ -1, "Unknown" },
};
static struct descrip ccstm_afptreg[] = {
{ 0, "Center" },
{ 1, "Bottom" },
{ 2, "Right" },
{ 3, "Extreme Right" },
{ 4, "Automatic" },
{ 5, "Extreme Left" },
{ 6, "Left" },
{ 7, "Top" },
{ -1, "Unknown" },
};
static struct descrip ccstm_rawjpeg[] = {
{ 0, "RAW+Small/Normal" },
{ 1, "RAW+Small/Fine" },
{ 2, "RAW+Medium/Normal" },
{ 3, "RAW+Medium/Fine" },
{ 4, "RAW+Large/Normal" },
{ 5, "RAW+Large/Fine" },
{ -1, "Unknown" },
};
static struct descrip ccstm_10dmenubut[] = {
{ 0, "Previous (Volatile)" },
{ 1, "Previous" },
{ 2, "Top" },
{ -1, "Unknown" },
};
static struct descrip ccstm_assistbut[] = {
{ 0, "Normal" },
{ 1, "Select Home Position" },
{ 2, "Select HP (while pressing)" },
{ 3, "Av+/- (AF point by QCD)" },
{ 4, "FE lock" },
{ -1, "Unknown" },
};
static struct descrip ccstm_20dexplvl[] = {
{ 0, "1/3 Stop" },
{ 1, "1/2 Stop" },
{ -1, "Unknown" },
};
static struct descrip ccstm_20dflashsync[] = {
{ 0, "Auto" },
{ 1, "1/250 (Fixed)" },
{ -1, "Unknown" },
};
static struct descrip ccstm_20dflash[] = {
{ 0, "Fires" },
{ 1, "Does Not Fire" },
{ -1, "Unknown" },
};
static struct descrip ccstm_20dafpsel[] = {
{ 0, "Normal" },
{ 1, "Multi-Controller Direct" },
{ 2, "Quick Control Dial Direct" },
{ -1, "Unknown" },
};
static struct descrip ccstm_20dettl[] = {
{ 0, "Evaluative" },
{ 1, "Average" },
{ -1, "Unknown" },
};
static struct descrip ccstm_5dflashsync[] = {
{ 0, "Auto" },
{ 1, "1/200 (Fixed)" },
{ -1, "Unknown" },
};
static struct descrip ccstm_5dfscr[] = {
{ 0, "Ee-A" },
{ 1, "Ee-D" },
{ 2, "Ee-S" },
{ -1, "Unknown" },
};
/* D30/D60 custom functions. */
static struct exiftag canon_d30custom[] = {
{ 1, TIFF_SHORT, 0, ED_VRB, "D30Custom",
"Long exposure noise reduction", ccstm_offon },
{ 2, TIFF_SHORT, 0, ED_VRB, "D30Custom",
"Shutter/AE lock buttons", ccstm_shutter },
{ 3, TIFF_SHORT, 0, ED_VRB, "D30Custom",
"Mirror lockup", ccstm_disen },
{ 4, TIFF_SHORT, 0, ED_VRB, "D30Custom",
"Tv/Av and exposure level", ccstm_explvl },
{ 5, TIFF_SHORT, 0, ED_VRB, "D30Custom",
"AF-assist light", ccstm_autooff },
{ 6, TIFF_SHORT, 0, ED_VRB, "D30Custom",
"Av mode shutter speed", ccstm_shutspd },
{ 7, TIFF_SHORT, 0, ED_VRB, "D30Custom",
"AEB sequence/auto cancellation", ccstm_aebseq },
{ 8, TIFF_SHORT, 0, ED_VRB, "D30Custom",
"Shutter curtain sync", ccstm_shutsync },
{ 9, TIFF_SHORT, 0, ED_VRB, "D30Custom",
"Lens AF stop button", ccstm_lensaf },
{ 10, TIFF_SHORT, 0, ED_VRB, "D30Custom",
"Fill flash auto reduction", ccstm_endis },
{ 11, TIFF_SHORT, 0, ED_VRB, "D30Custom",
"Menu button return position", ccstm_menubut },
{ 12, TIFF_SHORT, 0, ED_VRB, "D30Custom",
"Shooting Set button function", ccstm_setbut },
{ 13, TIFF_SHORT, 0, ED_VRB, "D30Custom",
"Sensor cleaning", ccstm_disen },
{ 14, TIFF_SHORT, 0, ED_VRB, "D30Custom",
"Superimposed display", ccstm_onoff },
{ 15, TIFF_SHORT, 0, ED_VRB, "D30Custom",
"Shutter release w/o CF card", ccstm_yesno },
{ 0xffff, TIFF_SHORT, 0, ED_UNK, "D30CustomUnknown",
"Canon D30/D60 Custom Unknown", NULL },
};
/* EOS-1D/1Ds custom functions. */
static struct exiftag canon_1dcustom[] = {
{ 0, TIFF_SHORT, 0, ED_VRB, "1DCustom",
"Focusing screen", ccstm_fscr },
{ 1, TIFF_SHORT, 0, ED_VRB, "1DCustom",
"Finder display during exposure", ccstm_offon },
{ 2, TIFF_SHORT, 0, ED_VRB, "1DCustom",
"Shutter release w/o CF card", ccstm_yesno },
{ 3, TIFF_SHORT, 0, ED_VRB, "1DCustom",
"ISO speed expansion", ccstm_noyes },
{ 4, TIFF_SHORT, 0, ED_VRB, "1DCustom",
"Shutter button/AEL button", ccstm_shutterael },
{ 5, TIFF_SHORT, 0, ED_VRB, "1DCustom",
"Manual Tv/Av for M", ccstm_tvavform },
{ 6, TIFF_SHORT, 0, ED_VRB, "1DCustom",
"Exposure level increments", ccstm_explvlinc },
{ 7, TIFF_SHORT, 0, ED_VRB, "1DCustom",
"USM lens electronic MF", ccstm_usmmf },
{ 8, TIFF_SHORT, 0, ED_VRB, "1DCustom",
"Top/back LCD panels", ccstm_lcdpanels },
{ 9, TIFF_SHORT, 0, ED_VRB, "1DCustom",
"AEB sequence/auto cancellation", ccstm_aebseq },
{ 10, TIFF_SHORT, 0, ED_VRB, "1DCustom",
"AF point illumination", ccstm_afill },
{ 11, TIFF_SHORT, 0, ED_VRB, "1DCustom",
"AF point selection", ccstm_afsel },
{ 12, TIFF_SHORT, 0, ED_VRB, "1DCustom",
"Mirror lockup", ccstm_disen },
{ 13, TIFF_SHORT, 0, ED_VRB, "1DCustom",
"# AF points/spot metering", ccstm_afspot },
{ 14, TIFF_SHORT, 0, ED_VRB, "1DCustom",
"Fill flash auto reduction", ccstm_endis },
{ 15, TIFF_SHORT, 0, ED_VRB, "1DCustom",
"Shutter curtain sync", ccstm_shutsync },
{ 16, TIFF_SHORT, 0, ED_VRB, "1DCustom",
"Safety shift in Av or Tv", ccstm_disen },
{ 17, TIFF_SHORT, 0, ED_VRB, "1DCustom",
"AF point activation area", ccstm_afact },
{ 18, TIFF_SHORT, 0, ED_VRB, "1DCustom",
"Switch to registered AF point", ccstm_regaf },
{ 19, TIFF_SHORT, 0, ED_VRB, "1DCustom",
"Lens AF stop button", ccstm_lensaf1 },
{ 20, TIFF_SHORT, 0, ED_VRB, "1DCustom",
"AI servo tracking sensitivity", ccstm_aisens },
{ 0xffff, TIFF_SHORT, 0, ED_UNK, "1DCustomUnknown",
"Canon 1D/1Ds Custom Unknown", NULL },
};
/* 5D custom functions. */
static struct exiftag canon_5dcustom[] = {
{ 0, TIFF_SHORT, 0, ED_VRB, "5DCustom",
"Focusing Screen", ccstm_5dfscr },
{ 1, TIFF_SHORT, 0, ED_VRB, "5DCustom",
"SET button function when shooting", ccstm_10dsetbut },
{ 2, TIFF_SHORT, 0, ED_VRB, "5DCustom",
"Long exposure noise reduction", ccstm_offon },
{ 3, TIFF_SHORT, 0, ED_VRB, "5DCustom",
"Flash sync speed in Av mode", ccstm_5dflashsync },
{ 4, TIFF_SHORT, 0, ED_VRB, "5DCustom",
"Shutter button/AE lock button", ccstm_10dshutter },
{ 5, TIFF_SHORT, 0, ED_VRB, "5DCustom",
"AF-assist beam", ccstm_assistflash },
{ 6, TIFF_SHORT, 0, ED_VRB, "5DCustom",
"Exposure level increments", ccstm_20dexplvl },
{ 7, TIFF_SHORT, 0, ED_VRB, "5DCustom",
"Flash firing", ccstm_20dflash },
{ 8, TIFF_SHORT, 0, ED_VRB, "5DCustom",
"ISO expansion", ccstm_offon },
{ 9, TIFF_SHORT, 0, ED_VRB, "5DCustom",
"AEB sequence/auto cancellation", ccstm_aebseq },
{ 10, TIFF_SHORT, 0, ED_VRB, "5DCustom",
"Superimposed display", ccstm_onoff },
{ 11, TIFF_SHORT, 0, ED_VRB, "5DCustom",
"Menu button display position", ccstm_10dmenubut },
{ 12, TIFF_SHORT, 0, ED_VRB, "5DCustom",
"Mirror lockup", ccstm_disen },
{ 13, TIFF_SHORT, 0, ED_VRB, "5DCustom",
"AF point selection method", ccstm_20dafpsel },
{ 14, TIFF_SHORT, 0, ED_VRB, "5DCustom",
"E-TTL II", ccstm_20dettl },
{ 15, TIFF_SHORT, 0, ED_VRB, "5DCustom",
"Shutter curtain sync", ccstm_shutsync },
{ 16, TIFF_SHORT, 0, ED_VRB, "5DCustom",
"Safety shift in Av or Tv", ccstm_disen },
{ 17, TIFF_SHORT, 0, ED_VRB, "5DCustom",
"Lens AF stop button", ccstm_lensaf1 },
{ 18, TIFF_SHORT, 0, ED_VRB, "5DCustom",
"Add original decision data", ccstm_offon },
{ 0xffff, TIFF_SHORT, 0, ED_UNK, "5DCustomUnknown",
"Canon 5D Custom Unknown", NULL },
};
/* 10D custom functions. */
static struct exiftag canon_10dcustom[] = {
{ 1, TIFF_SHORT, 0, ED_VRB, "10DCustom",
"SET button function when shooting", ccstm_10dsetbut },
{ 2, TIFF_SHORT, 0, ED_VRB, "10DCustom",
"Shutter release w/o CF card", ccstm_yesno },
{ 3, TIFF_SHORT, 0, ED_VRB, "10DCustom",
"Flash sync speed in Av mode", ccstm_shutspd },
{ 4, TIFF_SHORT, 0, ED_VRB, "10DCustom",
"Shutter button/AE lock button", ccstm_10dshutter },
{ 5, TIFF_SHORT, 0, ED_VRB, "10DCustom",
"AF-assist beam/Flash firing", ccstm_assistflash },
{ 6, TIFF_SHORT, 0, ED_VRB, "10DCustom",
"Exposure level increments", ccstm_explvl },
{ 7, TIFF_SHORT, 0, ED_VRB, "10DCustom",
"AF point registration", ccstm_afptreg },
{ 8, TIFF_SHORT, 0, ED_VRB, "10DCustom",
"RAW+JPEG recording", ccstm_rawjpeg },
{ 9, TIFF_SHORT, 0, ED_VRB, "10DCustom",
"AEB sequence/auto cancellation", ccstm_aebseq },
{ 10, TIFF_SHORT, 0, ED_VRB, "10DCustom",
"Superimposed display", ccstm_onoff },
{ 11, TIFF_SHORT, 0, ED_VRB, "10DCustom",
"Menu button display position", ccstm_10dmenubut },
{ 12, TIFF_SHORT, 0, ED_VRB, "10DCustom",
"Mirror lockup", ccstm_disen },
{ 13, TIFF_SHORT, 0, ED_VRB, "10DCustom",
"Assist button function", ccstm_assistbut },
{ 14, TIFF_SHORT, 0, ED_VRB, "10DCustom",
"Fill flash auto reduction", ccstm_endis },
{ 15, TIFF_SHORT, 0, ED_VRB, "10DCustom",
"Shutter curtain sync", ccstm_shutsync },
{ 16, TIFF_SHORT, 0, ED_VRB, "10DCustom",
"Safety shift in Av or Tv", ccstm_disen },
{ 17, TIFF_SHORT, 0, ED_VRB, "10DCustom",
"Lens AF stop button", ccstm_lensaf },
{ 0xffff, TIFF_SHORT, 0, ED_UNK, "10DCustomUnknown",
"Canon 10D Custom Unknown", NULL },
};
/* 20D custom functions. */
static struct exiftag canon_20dcustom[] = {
{ 0, TIFF_SHORT, 0, ED_VRB, "20DCustom",
"SET button function when shooting", ccstm_10dsetbut },
{ 1, TIFF_SHORT, 0, ED_VRB, "20DCustom",
"Long exposure noise reduction", ccstm_offon },
{ 2, TIFF_SHORT, 0, ED_VRB, "20DCustom",
"Flash sync speed in Av mode", ccstm_20dflashsync },
{ 3, TIFF_SHORT, 0, ED_VRB, "20DCustom",
"Shutter button/AE lock button", ccstm_10dshutter },
{ 4, TIFF_SHORT, 0, ED_VRB, "20DCustom",
"AF-assist beam", ccstm_assistflash },
{ 5, TIFF_SHORT, 0, ED_VRB, "20DCustom",
"Exposure level increments", ccstm_20dexplvl },
{ 6, TIFF_SHORT, 0, ED_VRB, "20DCustom",
"Flash firing", ccstm_20dflash },
{ 7, TIFF_SHORT, 0, ED_VRB, "20DCustom",
"ISO expansion", ccstm_offon },
{ 8, TIFF_SHORT, 0, ED_VRB, "20DCustom",
"AEB sequence/auto cancellation", ccstm_aebseq },
{ 9, TIFF_SHORT, 0, ED_VRB, "20DCustom",
"Superimposed display", ccstm_onoff },
{ 10, TIFF_SHORT, 0, ED_VRB, "20DCustom",
"Menu button display position", ccstm_10dmenubut },
{ 11, TIFF_SHORT, 0, ED_VRB, "20DCustom",
"Mirror lockup", ccstm_disen },
{ 12, TIFF_SHORT, 0, ED_VRB, "20DCustom",
"AF point selection method", ccstm_20dafpsel },
{ 13, TIFF_SHORT, 0, ED_VRB, "20DCustom",
"E-TTL II", ccstm_20dettl },
{ 14, TIFF_SHORT, 0, ED_VRB, "20DCustom",
"Shutter curtain sync", ccstm_shutsync },
{ 15, TIFF_SHORT, 0, ED_VRB, "20DCustom",
"Safety shift in Av or Tv", ccstm_disen },
{ 16, TIFF_SHORT, 0, ED_VRB, "20DCustom",
"Lens AF stop button", ccstm_lensaf1 },
{ 17, TIFF_SHORT, 0, ED_VRB, "20DCustom",
"Add original decision data", ccstm_offon },
{ 0xffff, TIFF_SHORT, 0, ED_UNK, "20DCustomUnknown",
"Canon 20D Custom Unknown", NULL },
};
/*
* Process maker note tag 0x0001 values.
*/
static int
canon_prop01(struct exifprop *aprop, struct exifprop *prop,
unsigned char *off, struct exiftags *t)
{
u_int16_t v = (u_int16_t)aprop->value;
switch (aprop->tag) {
case 2:
aprop->lvl = v ? ED_IMG : ED_VRB;
exifstralloc(&aprop->str, 32);
snprintf(aprop->str, 31, "%d sec", v / 10);
break;
case 5:
/* Change "Single" to "Timed" if #2 > 0. */
if (!v && exif2byte(off + 2 * 2, t->mkrmd.order))
strcpy(aprop->str, "Timed");
break;
case 12:
aprop->lvl = v ? ED_IMG : ED_VRB;
/*
* Looks like we can calculate zoom level when value
* is 3 (ref S110). Calculation is (2 * #37 / #36).
*/
if (v == 3 && prop->count >= 37) {
exifstralloc(&aprop->str, 32);
snprintf(aprop->str, 31, "x%.1f", 2 *
(float)exif2byte(off + 37 * 2, t->mkrmd.order) /
(float)exif2byte(off + 36 * 2, t->mkrmd.order));
} else
aprop->str = finddescr(canon_dzoom, v);
break;
case 16:
/* ISO overrides standard one if known. */
if (!strcmp(aprop->str, "Unknown")) {
aprop->lvl = ED_VRB;
break;
}
aprop->override = EXIF_T_ISOSPEED;
break;
case 17:
/* Maker meter mode overrides standard one if known. */
if (!strcmp(aprop->str, "Unknown")) {
aprop->lvl = ED_VRB;
break;
}
aprop->override = EXIF_T_METERMODE;
break;
case 20:
/* With "Easy Shooting", shooting mode is all that matters. */
aprop->lvl = v ? ED_IMG : ED_VRB;
break;
default:
return (FALSE);
}
return (TRUE);
}
/*
* Process maker note tag 0x0004 values.