1 /*
2  *  This file is part of RawTherapee.
3  *
4  *  Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
5  *
6  *  RawTherapee is free software: you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation, either version 3 of the License, or
9  *  (at your option) any later version.
10  *
11  *  RawTherapee is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with RawTherapee.  If not, see <https://www.gnu.org/licenses/>.
18  */
19 #ifndef _PENTAXATTRIBS_
20 #define _PENTAXATTRIBS_
21 
22 #include <cmath>
23 #include <cstdio>
24 #include <cstring> /* memcpy() */
25 #include <string>
26 #include <sstream>
27 
28 #include "rtexif.h"
29 
30 namespace rtexif
31 {
32 
33 
34 class PAQualityInterpreter : public ChoiceInterpreter<>
35 {
36 public:
PAQualityInterpreter()37     PAQualityInterpreter ()
38     {
39         choices[0] = "Good";
40         choices[1] = "Better";
41         choices[2] = "Best";
42         choices[3] = "TIFF";
43         choices[4] = "RAW";
44         choices[5] = "Premium";
45         choices[6] = "RAW (HDR enabled)";
46         choices[7] = "RAW (pixel shift enabled)";
47         choices[8] = "RAW (pixel shift handheld mode enabled)";
48         choices[65535] = "n/a";
49     }
50 };
51 PAQualityInterpreter paQualityInterpreter;
52 
53 class PAOnOffInterpreter : public ChoiceInterpreter<>
54 {
55 public:
PAOnOffInterpreter()56     PAOnOffInterpreter ()
57     {
58         choices[0]      = "Off";
59         choices[1]      = "On";
60     }
61 };
62 PAOnOffInterpreter paOnOffInterpreter;
63 
64 class PAShakeReductionInterpreter : public ChoiceInterpreter<>
65 {
66 public:
PAShakeReductionInterpreter()67     PAShakeReductionInterpreter ()
68     {
69         choices[  0] = "Off";
70         choices[  1] = "On";
71         choices[  4] = "On (4)";
72         choices[  5] = "On but Disabled";
73         choices[  6] = "On (Video)";
74         choices[  7] = "On (7)";
75         choices[ 15] = "On (15)";
76         choices[ 39] = "On (mode 2)";
77         choices[135] = "On (135)";
78         choices[167] = "On (mode 1)";
79     }
80 };
81 PAShakeReductionInterpreter paShakeReductionInterpreter;
82 
83 class PAShakeReduction2Interpreter : public ChoiceInterpreter<>
84 {
85 public:
86     // ShakeReduction
PAShakeReduction2Interpreter()87     PAShakeReduction2Interpreter ()
88     {
89         choices[ 0] = "Off";
90         choices[ 1] = "On";
91         choices[ 4] = "Off (AA simulation off)";
92         choices[ 5] = "On but Disabled";
93         choices[ 6] = "On (Video)";
94         choices[ 7] = "On (AA simulation off)";
95         choices[12] = "Off (AA simulation type 1)";
96         choices[15] = "On (AA simulation type 1)";
97         choices[20] = "Off (AA simulation type 2)";
98         choices[23] = "On (AA simulation type 2)";
99     }
100 };
101 PAShakeReduction2Interpreter paShakeReduction2Interpreter;
102 
103 class PAPictureModeInterpreter : public ChoiceInterpreter<>
104 {
105 public:
PAPictureModeInterpreter()106     PAPictureModeInterpreter ()
107     {
108         choices[0] = "Program";
109         choices[1] = "Shutter Speed Priority";
110         choices[2] = "Program AE";
111         choices[3] = "Manual";
112         choices[5] = "Portrait";
113         choices[6] = "Landscape";
114         choices[8] = "Sport";
115         choices[9] = "Night Scene";
116         choices[11] = "Soft";
117         choices[12] = "Surf & Snow";
118         choices[13] = "Candlelight";
119         choices[14] = "Autumn";
120         choices[15] = "Macro";
121         choices[17] = "Fireworks";
122         choices[18] = "Text";
123         choices[19] = "Panorama";
124         choices[20] = "3-D";
125         choices[21] = "Black & White";
126         choices[22] = "Sepia";
127         choices[23] = "Red";
128         choices[24] = "Pink";
129         choices[25] = "Purple";
130         choices[26] = "Blue";
131         choices[27] = "Green";
132         choices[28] = "Yellow";
133         choices[30] = "Self Portrait";
134         choices[31] = "Illustrations";
135         choices[33] = "Digital Filter";
136         choices[35] = "Night Scene Portrait";
137         choices[37] = "Museum";
138         choices[38] = "Food";
139         choices[39] = "Underwater";
140         choices[40] = "Green Mode";
141         choices[49] = "Light Pet";
142         choices[50] = "Dark Pet";
143         choices[51] = "Medium Pet";
144         choices[53] = "Underwater";
145         choices[54] = "Candlelight";
146         choices[55] = "Natural Skin Tone";
147         choices[56] = "Synchro Sound Record";
148         choices[58] = "Frame Composite";
149         choices[59] = "Report";
150         choices[60] = "Kids";
151         choices[61] = "Blur Reduction";
152         choices[63] = "Panorama 2";
153         choices[65] = "Half-length Portrait";
154         choices[66] = "Portrait 2";
155         choices[74] = "Digital Microscope";
156         choices[75] = "Blue Sky";
157         choices[80] = "Miniature";
158         choices[81] = "HDR";
159         choices[83] = "Fisheye";
160         choices[85] = "Digital Filter 4";
161         choices[221] = "P";
162         choices[255] = "PICT";
163     }
164 };
165 PAPictureModeInterpreter paPictureModeInterpreter;
166 
167 class PASceneModeInterpreter : public ChoiceInterpreter<>
168 {
169 public:
PASceneModeInterpreter()170     PASceneModeInterpreter ()
171     {
172         choices[0] = "Off";
173         choices[1] = "HDR";
174         choices[4] = "Auto PICT";
175         choices[5] = "Portrait";
176         choices[6] = "Landscape";
177         choices[7] = "Macro";
178         choices[8] = "Sport";
179         choices[9] = "Night Scene Portrait";
180         choices[10] = "No Flash";
181         choices[11] = "Night Scene";
182         choices[12] = "Surf & Snow";
183         choices[14] = "Sunset";
184         choices[15] = "Kids";
185         choices[16] = "Pet";
186         choices[17] = "Candlelight";
187         choices[18] = "Museum";
188         choices[20] = "Food";
189         choices[21] = "Stage Lighting";
190         choices[22] = "Night Snap";
191         choices[25] = "Night Scene HDR";
192         choices[26] = "Blue Sky";
193         choices[27] = "Forest";
194         choices[29] = "Backlight Silhouette";
195     }
196 };
197 PASceneModeInterpreter paSceneModeInterpreter;
198 
199 class PAAEProgramModeInterpreter : public ChoiceInterpreter<>
200 {
201 public:
PAAEProgramModeInterpreter()202     PAAEProgramModeInterpreter ()
203     {
204         choices[0] = "M, P or TAv";
205         choices[1] = "Av, B or X";
206         choices[2] = "Tv";
207         choices[3] = "Sv or Green Mode";
208         choices[8] = "Hi-speed Program";
209         choices[11] = "Hi-speed Program (P-Shift)";
210         choices[16] = "DOF Program";
211         choices[19] = "DOF Program (P-Shift)";
212         choices[24] = "MTF Program";
213         choices[27] = "MTF Program (P-Shift)";
214         choices[35] = "Standard";
215         choices[43] = "Portrait";
216         choices[51] = "Landscape";
217         choices[59] = "Macro";
218         choices[67] = "Sport";
219         choices[75] = "Night Scene Portrait";
220         choices[83] = "No Flash";
221         choices[91] = "Night Scene";
222         choices[99] = "Surf & Snow";
223         choices[104] = "Night Snap";
224         choices[107] = "Text";
225         choices[115] = "Sunset";
226         choices[123] = "Kids";
227         choices[131] = "Pet";
228         choices[139] = "Candlelight";
229         choices[144] = "SCN";
230         choices[147] = "Museum";
231         choices[160] = "Program";
232         choices[184] = "Shallow DOF Program";
233         choices[216] = "HDR";
234     }
235 };
236 PAAEProgramModeInterpreter paAEProgramModeInterpreter;
237 
238 class PAFlashModeInterpreter : public ChoiceInterpreter<>
239 {
240 public:
PAFlashModeInterpreter()241     PAFlashModeInterpreter ()
242     {
243         choices[0] = "Auto, Did not fire";
244         choices[1] = "Off, Did not fire";
245         choices[2] = "On, Did not fire";
246         choices[3] = "Auto, Did not fire, Red-eye reduction";
247         choices[5] = "On, Did not fire, Wireless (Master)";
248         choices[256] = "Auto, Fired";
249         choices[258] = "On, Fired";
250         choices[259] = "Auto, Fired, Red-eye reduction";
251         choices[260] = "On, Red-eye reduction";
252         choices[261] = "On, Wireless (Master)";
253         choices[262] = "On, Wireless (Control)";
254         choices[264] = "On, Soft";
255         choices[265] = "On, Slow-sync";
256         choices[266] = "On, Slow-sync, Red-eye reduction";
257         choices[267] = "On, Trailing-curtain Sync";
258     }
259 };
260 PAFlashModeInterpreter paFlashModeInterpreter;
261 
262 class PAFocusModeInterpreter : public ChoiceInterpreter<>
263 {
264 public:
PAFocusModeInterpreter()265     PAFocusModeInterpreter ()
266     {
267         choices[0] = "Normal";
268         choices[1] = "Macro";
269         choices[2] = "Infinity";
270         choices[3] = "Manual";
271         choices[4] = "Super Macro";
272         choices[5] = "Pan Focus";
273         choices[16] = "AF-S (Focus-priority)";
274         choices[17] = "AF-C (Focus-priority)";
275         choices[18] = "AF-A (Focus-priority)";
276         choices[32] = "Contrast-detect (Focus-priority)";
277         choices[33] = "Tracking Contrast-detect (Focus-priority)";
278         choices[272] = "AF-S (Release-priority)";
279         choices[273] = "AF-C (Release-priority)";
280         choices[274] = "AF-A (Release-priority)";
281         choices[288] = "Contrast-detect (Release-priority)";
282     }
283 };
284 PAFocusModeInterpreter paFocusModeInterpreter;
285 
286 class PAAFPointInterpreter : public ChoiceInterpreter<>
287 {
288 public:
289     // AFPointSelected
PAAFPointInterpreter()290     PAAFPointInterpreter        ()
291     {
292         choices[0] = "None";
293         choices[1] = "Upper-left";
294         choices[2] = "Top";
295         choices[3] = "Upper-right";
296         choices[4] = "Left";
297         choices[5] = "Mid-left";
298         choices[6] = "Center";
299         choices[7] = "Mid-right";
300         choices[8] = "Right";
301         choices[9] = "Lower-left";
302         choices[10] = "Bottom";
303         choices[11] = "Lower-right";
304         choices[65531] = "AF Select";
305         choices[65532] = "Face Detect AF";
306         choices[65533] = "Automatic Tracking AF";
307         choices[65534] = "Fixed Center";
308         choices[65535] = "Auto";
309     }
310 };
311 PAAFPointInterpreter paAFPointInterpreter;
312 
313 class PAAFFocusInterpreter : public ChoiceInterpreter<>
314 {
315 public:
316     // AFPointsInFocus
PAAFFocusInterpreter()317     PAAFFocusInterpreter        ()
318     {
319         choices[0] = "Fixed Center or Multiple";
320         choices[1] = "Top-left";
321         choices[2] = "Top-center";
322         choices[3] = "Top-right";
323         choices[4] = "Left";
324         choices[5] = "Center";
325         choices[6] = "Right";
326         choices[7] = "Bottom-left";
327         choices[8] = "Bottom-center";
328         choices[9] = "Bottom-right";
329         choices[65535] = "None";
330     }
331 };
332 PAAFFocusInterpreter paAFFocusInterpreter;
333 
334 class PAISOInterpreter : public ChoiceInterpreter<>
335 {
336 public:
PAISOInterpreter()337     PAISOInterpreter        ()
338     {
339         choices[3] = "50";
340         choices[4] = "64";
341         choices[5] = "80";
342         choices[6] = "100";
343         choices[7] = "125";
344         choices[8] = "160";
345         choices[9] = "200";
346         choices[10] = "250";
347         choices[11] = "320";
348         choices[12] = "400";
349         choices[13] = "500";
350         choices[14] = "640";
351         choices[15] = "800";
352         choices[16] = "1000";
353         choices[17] = "1250";
354         choices[18] = "1600";
355         choices[19] = "2000";
356         choices[20] = "2500";
357         choices[21] = "3200";
358         choices[22] = "4000";
359         choices[23] = "5000";
360         choices[24] = "6400";
361         choices[25] = "8000";
362         choices[26] = "10000";
363         choices[27] = "12800";
364         choices[28] = "16000";
365         choices[29] = "20000";
366         choices[30] = "25600";
367         choices[31] = "32000";
368         choices[32] = "40000";
369         choices[33] = "51200";
370         choices[34] = "64000";
371         choices[35] = "80000";
372         choices[36] = "102400";
373         choices[37] = "128000";
374         choices[38] = "160000";
375         choices[39] = "204800";
376         choices[40] = "256000";
377         choices[41] = "320000";
378         choices[42] = "409600";
379         choices[43] = "512000";
380         choices[44] = "640000";
381         choices[45] = "819200";
382         choices[50] = "50";
383         choices[100] = "100";
384         choices[200] = "200";
385         choices[258] = "50";
386         choices[259] = "70";
387         choices[260] = "100";
388         choices[261] = "140";
389         choices[262] = "200";
390         choices[263] = "280";
391         choices[264] = "400";
392         choices[265] = "560";
393         choices[266] = "800";
394         choices[267] = "1100";
395         choices[268] = "1600";
396         choices[269] = "2200";
397         choices[270] = "3200";
398         choices[271] = "4500";
399         choices[272] = "6400";
400         choices[273] = "9000";
401         choices[274] = "12800";
402         choices[275] = "18000";
403         choices[276] = "25600";
404         choices[277] = "36000";
405         choices[278] = "51200";
406         choices[400] = "400";
407         choices[800] = "800";
408         choices[1600] = "1600";
409         choices[3200] = "3200";
410     }
411 };
412 PAISOInterpreter paISOInterpreter;
413 
414 class PAFNumberInterpreter: public Interpreter
415 {
416 public:
PAFNumberInterpreter()417     PAFNumberInterpreter () {}
toString(const Tag * t) const418     std::string toString (const Tag* t) const override
419     {
420         char buffer[32];
421         double v = t->toDouble() / 10;
422 
423         if ( v < 0. || v > 1000. ) {
424             return "undef";
425         }
426 
427         sprintf (buffer, "%.1f", v );
428         return buffer;
429     }
430 };
431 PAFNumberInterpreter paFNumberInterpreter;
432 
433 class PAMeteringModeInterpreter : public ChoiceInterpreter<>
434 {
435 public:
PAMeteringModeInterpreter()436     PAMeteringModeInterpreter ()
437     {
438         choices[0] = "Multi-segment";
439         choices[1] = "Center-weighted average";
440         choices[2] = "Spot";
441     }
442 };
443 PAMeteringModeInterpreter paMeteringModeInterpreter;
444 
445 class PAWhiteBalanceInterpreter : public ChoiceInterpreter<>
446 {
447 public:
PAWhiteBalanceInterpreter()448     PAWhiteBalanceInterpreter ()
449     {
450         choices[0] = "Auto";
451         choices[1] = "Daylight";
452         choices[2] = "Shade";
453         choices[3] = "Fluorescent";
454         choices[4] = "Tungsten";
455         choices[5] = "Manual";
456         choices[6] = "Daylight Fluorescent";
457         choices[7] = "Day White Fluorescent";
458         choices[8] = "White Fluorescent";
459         choices[9] = "Flash";
460         choices[10] = "Cloudy";
461         choices[11] = "Warm White Fluorescent";
462         choices[14] = "Multi Auto";
463         choices[15] = "Color Temperature Enhancement";
464         choices[17] = "Kelvin";
465         choices[65534] = "Unknown";
466         choices[65535] = "User-Selected";
467     }
468 };
469 PAWhiteBalanceInterpreter paWhiteBalanceInterpreter;
470 
471 class PAWhiteBalanceModeInterpreter : public ChoiceInterpreter<>
472 {
473 public:
PAWhiteBalanceModeInterpreter()474     PAWhiteBalanceModeInterpreter ()
475     {
476         choices[1] = "Auto (Daylight)";
477         choices[2] = "Auto (Shade)";
478         choices[3] = "Auto (Flash)";
479         choices[4] = "Auto (Tungsten)";
480         choices[6] = "Auto (Daylight Fluorescent)";
481         choices[7] = "Auto (Day White Fluorescent)";
482         choices[8] = "Auto (White Fluorescent)";
483         choices[10] = "Auto (Cloudy)";
484         choices[65534] = "Unknown";
485         choices[65535] = "User-Selected";
486     }
487 };
488 PAWhiteBalanceModeInterpreter paWhiteBalanceModeInterpreter;
489 
490 class PASaturationInterpreter : public ChoiceInterpreter<>
491 {
492 public:
PASaturationInterpreter()493     PASaturationInterpreter ()
494     {
495         choices[0] = "-2 (low)";
496         choices[1] = "0 (normal)";
497         choices[2] = "+2 (high)";
498         choices[3] = "-1 (med low)";
499         choices[4] = "+1 (med high)";
500         choices[5] = "-3 (very low)";
501         choices[6] = "+3 (very high)";
502         choices[7] = "-4 (minimum)";
503         choices[8] = "+4 (maximum)";
504         choices[65535] = "None";
505     }
506 };
507 PASaturationInterpreter paSaturationInterpreter;
508 
509 class PAContrastInterpreter : public ChoiceInterpreter<>
510 {
511 public:
PAContrastInterpreter()512     PAContrastInterpreter ()
513     {
514         choices[0] = "-2 (low)";
515         choices[1] = "0 (normal)";
516         choices[2] = "+2 (high)";
517         choices[3] = "-1 (med low)";
518         choices[4] = "+1 (med high)";
519         choices[5] = "-3 (very low)";
520         choices[6] = "+3 (very high)";
521         choices[7] = "-4 (minimum)";
522         choices[8] = "+4 (maximum)";
523         choices[65535] = "n/a";
524     }
525 };
526 PAContrastInterpreter paContrastInterpreter;
527 
528 class PASharpnessInterpreter : public ChoiceInterpreter<>
529 {
530 public:
PASharpnessInterpreter()531     PASharpnessInterpreter ()
532     {
533         choices[0] = "-2 (soft)";
534         choices[1] = "0 (normal)";
535         choices[2] = "+2 (hard)";
536         choices[3] = "-1 (med soft)";
537         choices[4] = "+1 (med hard)";
538         choices[5] = "-3 (very soft)";
539         choices[6] = "+3 (very hard)";
540         choices[7] = "-4 (minimum)";
541         choices[8] = "+4 (maximum)";
542     }
543 };
544 PASharpnessInterpreter paSharpnessInterpreter;
545 
546 class PAPictureModeInterpreter2: public ChoiceInterpreter<>
547 {
548 public:
PAPictureModeInterpreter2()549     PAPictureModeInterpreter2()
550     {
551         choices[256 *   0 +   0] = "Program";
552         choices[256 *   0 +   1] = "Hi-speed Program";
553         choices[256 *   0 +   2] = "DOF Program";
554         choices[256 *   0 +   3] = "MTF Program";
555         choices[256 *   0 +   4] = "Standard";
556         choices[256 *   0 +   5] = "Portrait";
557         choices[256 *   0 +   6] = "Landscape";
558         choices[256 *   0 +   7] = "Macro";
559         choices[256 *   0 +   8] = "Sport";
560         choices[256 *   0 +   9] = "Night Scene Portrait";
561         choices[256 *   0 +  10] = "No Flash";
562         choices[256 *   0 +  11] = "Night Scene";
563         choices[256 *   0 +  12] = "Surf & Snow";
564         choices[256 *   0 +  13] = "Text";
565         choices[256 *   0 +  14] = "Sunset";
566         choices[256 *   0 +  15] = "Kids";
567         choices[256 *   0 +  16] = "Pet";
568         choices[256 *   0 +  17] = "Candlelight";
569         choices[256 *   0 +  18] = "Museum";
570         choices[256 *   0 +  19] = "Food";
571         choices[256 *   0 +  20] = "Stage Lighting";
572         choices[256 *   0 +  21] = "Night Snap";
573         choices[256 *   0 +  23] = "Blue Sky";
574         choices[256 *   0 +  24] = "Sunset";
575         choices[256 *   0 +  26] = "Night Scene HDR";
576         choices[256 *   0 +  27] = "HDR";
577         choices[256 *   0 +  28] = "Quick Macro";
578         choices[256 *   0 +  29] = "Forest";
579         choices[256 *   0 +  30] = "Backlight Silhouette";
580         choices[256 *   1 +   4] = "Auto PICT (Standard)";
581         choices[256 *   1 +   5] = "Auto PICT (Portrait)";
582         choices[256 *   1 +   6] = "Auto PICT (Landscape)";
583         choices[256 *   1 +   7] = "Auto PICT (Macro)";
584         choices[256 *   1 +   8] = "Auto PICT (Sport)";
585         choices[256 *   2 +   0] = "Program (HyP)";
586         choices[256 *   2 +   1] = "Hi-speed Program (HyP)";
587         choices[256 *   2 +   2] = "DOF Program (HyP)";
588         choices[256 *   2 +   3] = "MTF Program (HyP)";
589         choices[256 *   2 +  22] = "Shallow DOF (HyP)";
590         choices[256 *   3 +   0] = "Green Mode";
591         choices[256 *   4 +   0] = "Shutter Speed Priority";
592         choices[256 *   5 +   0] = "Aperture Priority";
593         choices[256 *   6 +   0] = "Program Tv Shift";
594         choices[256 *   7 +   0] = "Program Av Shift";
595         choices[256 *   8 +   0] = "Manual";
596         choices[256 *   9 +   0] = "Bulb";
597         choices[256 *  10 +   0] = "Aperture Priority, Off-Auto-Aperture";
598         choices[256 *  11 +   0] = "Manual, Off-Auto-Aperture";
599         choices[256 *  12 +   0] = "Bulb, Off-Auto-Aperture";
600         choices[256 *  13 +   0] = "Shutter & Aperture Priority AE";
601         choices[256 *  15 +   0] = "Sensitivity Priority AE";
602         choices[256 *  16 +   0] = "Flash X-Sync Speed AE";
603         choices[256 *  18 +   0] = "Auto Program (Normal)";
604         choices[256 *  18 +   1] = "Auto Program (Hi-speed)";
605         choices[256 *  18 +   2] = "Auto Program (DOF)";
606         choices[256 *  18 +   3] = "Auto Program (MTF)";
607         choices[256 *  18 +  22] = "Auto Program (Shallow DOF)";
608         choices[256 *  20 +  22] = "Blur Control";
609         choices[256 * 254 +   0] = "Video";
610         choices[256 * 255 +   0] = "Video (Auto Aperture)";
611         choices[256 * 255 +   4] = "Video (4)";
612     }
toString(const Tag * t) const613     std::string toString (const Tag* t) const override
614     {
615         int c = 256 * t->toInt (0, BYTE) + t->toInt (1, BYTE);
616         const ChoicesIterator r = choices.find (c);
617 
618         if (r != choices.end()) {
619             std::ostringstream s;
620             s << r->second;
621 
622             if ( t->toInt (1, BYTE) == 0 ) {
623                 s << "\n1/2 EV steps";
624             } else {
625                 s << "\n1/3 EV steps";
626             }
627 
628             return s.str();
629         } else {
630             char buffer[1024];
631             t->toString (buffer);
632             return std::string (buffer);
633         }
634     }
635 };
636 PAPictureModeInterpreter2 paPictureModeInterpreter2;
637 
638 class PADriveModeInterpreter : public ChoiceInterpreter<>
639 {
640     std::map<int, std::string> choices1;
641     std::map<int, std::string> choices2;
642     std::map<int, std::string> choices3;
643 public:
PADriveModeInterpreter()644     PADriveModeInterpreter()
645     {
646         choices[0]    = "Single-frame";
647         choices[1]    = "Continuous";
648         choices[2]    = "Continuous (Lo)";
649         choices[3]    = "Burst";
650         choices[4]    = "Continuous (Medium)";
651         choices[255]  = "Video";
652         choices1[0]   = "No Timer";
653         choices1[1]   = "Self-timer (12 s)";
654         choices1[2]   = "Self-timer (2 s)";
655         choices1[15]  = "Video";
656         choices1[16]  = "Mirror Lock-up";
657         choices1[255] = "n/a";
658         choices2[0]   = "Shutter Button";
659         choices2[1]   = "Remote Control (3 s delay)";
660         choices2[2]   = "Remote Control";
661         choices2[4]   = "Remote Continuous Shooting";
662         choices3[0]   = "Single Exposure";
663         choices3[1]   = "Multiple Exposure";
664         choices3[15]  = "Interval Movie";
665         choices3[16]  = "HDR";
666         choices3[32]  = "HDR Strong 1";
667         choices3[48]  = "HDR Strong 2";
668         choices3[64]  = "HDR Strong 3";
669         choices3[224] = "HDR Auto";
670         choices3[255] = "Video";
671     }
toString(const Tag * t) const672     std::string toString (const Tag* t) const override
673     {
674         const ChoicesIterator r  = choices.find (t->toInt (0, BYTE));
675         std::map<int, std::string>::const_iterator r1 = choices1.find (t->toInt (1, BYTE));
676         std::map<int, std::string>::const_iterator r2 = choices2.find (t->toInt (2, BYTE));
677         std::map<int, std::string>::const_iterator r3 = choices3.find (t->toInt (3, BYTE));
678         std::ostringstream s;
679         s << ((r != choices.end()) ? r->second : "");
680         s << ((r1 != choices1.end()) ? r1->second : "") << " ";
681         s << ((r2 != choices2.end()) ? r2->second : "") << " ";
682         s << ((r3 != choices3.end()) ? r3->second : "") << " ";
683         return s.str();
684     }
685 };
686 PADriveModeInterpreter paDriveModeInterpreter;
687 
688 class PAColorSpaceInterpreter: public ChoiceInterpreter<>
689 {
690 public:
PAColorSpaceInterpreter()691     PAColorSpaceInterpreter()
692     {
693         choices[0] = "sRGB";
694         choices[1] = "Adobe RGB";
695     }
696 };
697 PAColorSpaceInterpreter paColorSpaceInterpreter;
698 
699 class PALensTypeInterpreter : public IntLensInterpreter< int >
700 {
701 public:
PALensTypeInterpreter()702     PALensTypeInterpreter ()
703     {
704         choices.insert (p_t (256 * 0 + 0, "M-42 or No Lens"));
705         choices.insert (p_t (256 * 1 + 0, "K or M Lens"));
706         choices.insert (p_t (256 * 2 + 0, "A Series Lens"));
707         choices.insert (p_t (256 * 3 + 0, "Sigma"));
708         choices.insert (p_t (256 * 3 + 17, "smc PENTAX-FA SOFT 85mm f/2.8"));
709         choices.insert (p_t (256 * 3 + 18, "smc PENTAX-F 1.7X AF ADAPTER"));
710         choices.insert (p_t (256 * 3 + 19, "smc PENTAX-F 24-50mm f/4"));
711         choices.insert (p_t (256 * 3 + 20, "smc PENTAX-F 35-80mm f/4-5.6"));
712         choices.insert (p_t (256 * 3 + 21, "smc PENTAX-F 80-200mm f/4.7-5.6"));
713         choices.insert (p_t (256 * 3 + 22, "smc PENTAX-F FISH-EYE 17-28mm f/3.5-4.5"));
714         choices.insert (p_t (256 * 3 + 23, "smc PENTAX-F 100-300mm f/4.5-5.6 or Sigma Lens"));
715         choices.insert (p_t (256 * 3 + 23, "Sigma AF 28-300mm f/3.5-5.6 DL IF"));
716         choices.insert (p_t (256 * 3 + 23, "Sigma AF 28-300mm f/3.5-6.3 DG IF Macro"));
717         choices.insert (p_t (256 * 3 + 23, "Tokina 80-200mm f/2.8 ATX-Pro"));
718         choices.insert (p_t (256 * 3 + 24, "smc PENTAX-F 35-135mm f/3.5-4.5"));
719         choices.insert (p_t (256 * 3 + 25, "smc PENTAX-F 35-105mm f/4-5.6 or Sigma or Tokina Lens"));
720         choices.insert (p_t (256 * 3 + 25, "Sigma 55-200mm f/4-5.6 DC"));
721         choices.insert (p_t (256 * 3 + 25, "Sigma AF 28-300mm f/3.5-5.6 DL IF"));
722         choices.insert (p_t (256 * 3 + 25, "Sigma AF 28-300mm f/3.5-6.3 DL IF"));
723         choices.insert (p_t (256 * 3 + 25, "Sigma AF 28-300mm f/3.5-6.3 DG IF Macro"));
724         choices.insert (p_t (256 * 3 + 25, "Tokina 80-200mm f/2.8 ATX-Pro"));
725         choices.insert (p_t (256 * 3 + 26, "smc PENTAX-F* 250-600mm f/5.6 ED[IF]"));
726         choices.insert (p_t (256 * 3 + 27, "smc PENTAX-F 28-80mm f/3.5-4.5 or Tokina Lens"));
727         choices.insert (p_t (256 * 3 + 27, "Tokina AT-X Pro AF 28-70mm f/2.6-2.8"));
728         choices.insert (p_t (256 * 3 + 28, "smc PENTAX-F 35-70mm f/3.5-4.5 or Tokina Lens"));
729         choices.insert (p_t (256 * 3 + 28, "Tokina 19-35mm f/3.5-4.5 AF"));
730         choices.insert (p_t (256 * 3 + 28, "Tokina AT-X AF 400mm f/5.6"));
731         choices.insert (p_t (256 * 3 + 29, "PENTAX-F 28-80mm f/3.5-4.5 or Sigma or Tokina Lens"));
732         choices.insert (p_t (256 * 3 + 29, "Sigma AF 18-125mm f/3.5-5.6 DC"));
733         choices.insert (p_t (256 * 3 + 29, "Tokina AT-X PRO 28-70mm f/2.6-2.8"));
734         choices.insert (p_t (256 * 3 + 30, "PENTAX-F 70-200mm f/4-5.6"));
735         choices.insert (p_t (256 * 3 + 31, "smc PENTAX-F 70-210mm f/4-5.6 or Tokina or Takumar Lens"));
736         choices.insert (p_t (256 * 3 + 31, "Tokina AF 730 75-300mm f/4.5-5.6"));
737         choices.insert (p_t (256 * 3 + 31, "Takumar-F 70-210mm f/4-5.6"));
738         choices.insert (p_t (256 * 3 + 32, "smc PENTAX-F 50mm f/1.4"));
739         choices.insert (p_t (256 * 3 + 33, "smc PENTAX-F 50mm f/1.7"));
740         choices.insert (p_t (256 * 3 + 34, "smc PENTAX-F 135mm f/2.8 [IF]"));
741         choices.insert (p_t (256 * 3 + 35, "smc PENTAX-F 28mm f/2.8"));
742         choices.insert (p_t (256 * 3 + 36, "Sigma 20mm f/1.8 EX DG Aspherical RF"));
743         choices.insert (p_t (256 * 3 + 38, "smc PENTAX-F* 300mm f/4.5 ED[IF]"));
744         choices.insert (p_t (256 * 3 + 39, "smc PENTAX-F* 600mm f/4 ED[IF]"));
745         choices.insert (p_t (256 * 3 + 40, "smc PENTAX-F Macro 100mm f/2.8"));
746         choices.insert (p_t (256 * 3 + 41, "smc PENTAX-F Macro 50mm f/2.8 or Sigma Lens"));
747         choices.insert (p_t (256 * 3 + 41, "Sigma 50mm f/2.8 Macro"));
748         choices.insert (p_t (256 * 3 + 42, "Sigma 300mm f/2.8 EX DG APO IF"));
749         choices.insert (p_t (256 * 3 + 44, "Sigma or Tamron Lens (3 44)"));
750         choices.insert (p_t (256 * 3 + 44, "Sigma AF 10-20mm f/4-5.6 EX DC"));
751         choices.insert (p_t (256 * 3 + 44, "Sigma 12-24mm f/4.5-5.6 EX DG"));
752         choices.insert (p_t (256 * 3 + 44, "Sigma 17-70mm f/2.8-4.5 DC Macro"));
753         choices.insert (p_t (256 * 3 + 44, "Sigma 18-50mm f/3.5-5.6 DC"));
754         choices.insert (p_t (256 * 3 + 44, "Sigma 17-35mm f/2.8-4 EX DG"));
755         choices.insert (p_t (256 * 3 + 44, "Tamron 35-90mm f/4-5.6 AF"));
756         choices.insert (p_t (256 * 3 + 44, "Sigma AF 18-35mm f/3.5-4.5 Aspherical"));
757         choices.insert (p_t (256 * 3 + 46, "Sigma or Samsung Lens (3 46)"));
758         choices.insert (p_t (256 * 3 + 46, "Sigma APO 70-200mm f/2.8 EX"));
759         choices.insert (p_t (256 * 3 + 46, "Sigma EX APO 100-300mm f/4 IF"));
760         choices.insert (p_t (256 * 3 + 46, "Samsung/Schneider D-XENON 50-200mm f/4-5.6 ED"));
761         choices.insert (p_t (256 * 3 + 50, "smc PENTAX-FA 28-70mm f/4 AL"));
762         choices.insert (p_t (256 * 3 + 51, "Sigma 28mm f/1.8 EX DG Aspherical Macro"));
763         choices.insert (p_t (256 * 3 + 52, "smc PENTAX-FA 28-200mm f/3.8-5.6 AL[IF] or Tamron Lens"));
764         choices.insert (p_t (256 * 3 + 52, "Tamron AF LD 28-200mm f/3.8-5.6 [IF] Aspherical (171D)"));
765         choices.insert (p_t (256 * 3 + 53, "smc PENTAX-FA 28-80mm f/3.5-5.6 AL"));
766         choices.insert (p_t (256 * 3 + 247, "smc PENTAX-DA FISH-EYE 10-17mm f/3.5-4.5 ED[IF]"));
767         choices.insert (p_t (256 * 3 + 248, "smc PENTAX-DA 12-24mm f/4 ED AL[IF]"));
768         choices.insert (p_t (256 * 3 + 250, "smc PENTAX-DA 50-200mm f/4-5.6 ED"));
769         choices.insert (p_t (256 * 3 + 251, "smc PENTAX-DA 40mm f/2.8 Limited"));
770         choices.insert (p_t (256 * 3 + 252, "smc PENTAX-DA 18-55mm f/3.5-5.6 AL"));
771         choices.insert (p_t (256 * 3 + 253, "smc PENTAX-DA 14mm f/2.8 ED[IF]"));
772         choices.insert (p_t (256 * 3 + 254, "smc PENTAX-DA 16-45mm f/4 ED AL"));
773         choices.insert (p_t (256 * 3 + 255, "Sigma Lens (3 255)"));
774         choices.insert (p_t (256 * 3 + 255, "Sigma 18-200mm f/3.5-6.3 DC"));
775         choices.insert (p_t (256 * 3 + 255, "Sigma DL-II 35-80mm f/4-5.6"));
776         choices.insert (p_t (256 * 3 + 255, "Sigma DL Zoom 75-300mm f/4-5.6"));
777         choices.insert (p_t (256 * 3 + 255, "Sigma DF EX Aspherical 28-70mm f/2.8"));
778         choices.insert (p_t (256 * 3 + 255, "Sigma AF Tele 400mm f/5.6 Multi-coated"));
779         choices.insert (p_t (256 * 3 + 255, "Sigma 24-60mm f/2.8 EX DG"));
780         choices.insert (p_t (256 * 3 + 255, "Sigma 70-300mm f/4-5.6 Macro"));
781         choices.insert (p_t (256 * 3 + 255, "Sigma 55-200mm f/4-5.6 DC"));
782         choices.insert (p_t (256 * 3 + 255, "Sigma 18-50mm f/2.8 EX DC"));
783         choices.insert (p_t (256 * 4 + 1, "smc PENTAX-FA SOFT 28mm f/2.8"));
784         choices.insert (p_t (256 * 4 + 2, "smc PENTAX-FA 80-320mm f/4.5-5.6"));
785         choices.insert (p_t (256 * 4 + 3, "smc PENTAX-FA 43mm f/1.9 Limited"));
786         choices.insert (p_t (256 * 4 + 6, "smc PENTAX-FA 35-80mm f/4-5.6"));
787         choices.insert (p_t (256 * 4 + 9, "Irix 11mm f/4 Firefly"));
788         choices.insert (p_t (256 * 4 + 10, "Irix 15mm f/2.4"));
789         choices.insert (p_t (256 * 4 + 12, "smc PENTAX-FA 50mm f/1.4"));
790         choices.insert (p_t (256 * 4 + 15, "smc PENTAX-FA 28-105mm f/4-5.6 [IF]"));
791         choices.insert (p_t (256 * 4 + 16, "Tamron AF 80-210mm f/4-5.6 (178D)"));
792         choices.insert (p_t (256 * 4 + 19, "Tamron SP AF 90mm f/2.8 (172E)"));
793         choices.insert (p_t (256 * 4 + 20, "smc PENTAX-FA 28-80mm f/3.5-5.6"));
794         choices.insert (p_t (256 * 4 + 21, "Cosina AF 100-300mm f/5.6-6.7"));
795         choices.insert (p_t (256 * 4 + 22, "Tokina 28-80mm f/3.5-5.6"));
796         choices.insert (p_t (256 * 4 + 23, "smc PENTAX-FA 20-35mm f/4 AL"));
797         choices.insert (p_t (256 * 4 + 24, "smc PENTAX-FA 77mm f/1.8 Limited"));
798         choices.insert (p_t (256 * 4 + 25, "Tamron SP AF 14mm f/2.8"));
799         choices.insert (p_t (256 * 4 + 26, "smc PENTAX-FA Macro 100mm f/3.5 or Cosina Lens"));
800         choices.insert (p_t (256 * 4 + 26, "Cosina 100mm f/3.5 Macro"));
801         choices.insert (p_t (256 * 4 + 27, "Tamron AF 28-300mm f/3.5-6.3 LD Aspherical[IF] Macro (185D/285D)"));
802         choices.insert (p_t (256 * 4 + 28, "smc PENTAX-FA 35mm f/2 AL"));
803         choices.insert (p_t (256 * 4 + 29, "Tamron AF 28-200mm f/3.8-5.6 LD Super II Macro (371D)"));
804         choices.insert (p_t (256 * 4 + 34, "smc PENTAX-FA 24-90mm f/3.5-4.5 AL[IF]"));
805         choices.insert (p_t (256 * 4 + 35, "smc PENTAX-FA 100-300mm f/4.7-5.8"));
806         choices.insert (p_t (256 * 4 + 36, "Tamron AF 70-300mm f/4-5.6 LD Macro 1:2"));
807         choices.insert (p_t (256 * 4 + 37, "Tamron SP AF 24-135mm f/3.5-5.6 AD AL (190D)"));
808         choices.insert (p_t (256 * 4 + 38, "smc PENTAX-FA 28-105mm f/3.2-4.5 AL[IF]"));
809         choices.insert (p_t (256 * 4 + 39, "smc PENTAX-FA 31mm f/1.8 AL Limited"));
810         choices.insert (p_t (256 * 4 + 41, "Tamron AF 28-200mm Super Zoom f/3.8-5.6 Aspherical XR [IF] Macro (A03)"));
811         choices.insert (p_t (256 * 4 + 43, "smc PENTAX-FA 28-90mm f/3.5-5.6"));
812         choices.insert (p_t (256 * 4 + 44, "smc PENTAX-FA J 75-300mm f/4.5-5.8 AL"));
813         choices.insert (p_t (256 * 4 + 45, "Tamron Lens (4 45)"));
814         choices.insert (p_t (256 * 4 + 45, "Tamron 28-300mm f/3.5-6.3 Ultra zoom XR"));
815         choices.insert (p_t (256 * 4 + 45, "Tamron AF 28-300mm f/3.5-6.3 XR Di LD Aspherical [IF] Macro"));
816         choices.insert (p_t (256 * 4 + 46, "smc PENTAX-FA J 28-80mm f/3.5-5.6 AL"));
817         choices.insert (p_t (256 * 4 + 47, "smc PENTAX-FA J 18-35mm f/4-5.6 AL"));
818         choices.insert (p_t (256 * 4 + 49, "Tamron SP AF 28-75mm f/2.8 XR Di LD Aspherical [IF] Macro"));
819         choices.insert (p_t (256 * 4 + 51, "smc PENTAX-D FA 50mm f/2.8 Macro"));
820         choices.insert (p_t (256 * 4 + 52, "smc PENTAX-D FA 100mm f/2.8 Macro"));
821         choices.insert (p_t (256 * 4 + 55, "Samsung/Schneider D-XENOGON 35mm f/2"));
822         choices.insert (p_t (256 * 4 + 56, "Samsung/Schneider D-XENON 100mm f/2.8 Macro"));
823         choices.insert (p_t (256 * 4 + 75, "Tamron SP AF 70-200mm f/2.8 Di LD [IF] Macro (A001)"));
824         choices.insert (p_t (256 * 4 + 214, "smc PENTAX-DA 35mm f/2.4 AL"));
825         choices.insert (p_t (256 * 4 + 229, "smc PENTAX-DA 18-55mm f/3.5-5.6 AL II"));
826         choices.insert (p_t (256 * 4 + 230, "Tamron SP AF 17-50mm f/2.8 XR Di II"));
827         choices.insert (p_t (256 * 4 + 231, "smc PENTAX-DA 18-250mm f/3.5-6.3 ED AL [IF]"));
828         choices.insert (p_t (256 * 4 + 237, "Samsung/Schneider D-XENOGON 10-17mm f/3.5-4.5"));
829         choices.insert (p_t (256 * 4 + 239, "Samsung/Schneider D-XENON 12-24mm f/4 ED AL [IF]"));
830         choices.insert (p_t (256 * 4 + 242, "smc PENTAX-DA* 16-50mm f/2.8 ED AL [IF] SDM (SDM unused)"));
831         choices.insert (p_t (256 * 4 + 243, "smc PENTAX-DA 70mm f/2.4 Limited"));
832         choices.insert (p_t (256 * 4 + 244, "smc PENTAX-DA 21mm f/3.2 AL Limited"));
833         choices.insert (p_t (256 * 4 + 245, "Samsung/Schneider D-XENON 50-200mm f/4-5.6"));
834         choices.insert (p_t (256 * 4 + 246, "Samsung/Schneider D-XENON 18-55mm f/3.5-5.6"));
835         choices.insert (p_t (256 * 4 + 247, "smc PENTAX-DA FISH-EYE 10-17mm f/3.5-4.5 ED[IF]"));
836         choices.insert (p_t (256 * 4 + 248, "smc PENTAX-DA 12-24mm f/4 ED AL [IF]"));
837         choices.insert (p_t (256 * 4 + 249, "Tamron XR DiII 18-200mm f/3.5-6.3 (A14)"));
838         choices.insert (p_t (256 * 4 + 250, "smc PENTAX-DA 50-200mm f/4-5.6 ED"));
839         choices.insert (p_t (256 * 4 + 251, "smc PENTAX-DA 40mm f/2.8 Limited"));
840         choices.insert (p_t (256 * 4 + 252, "smc PENTAX-DA 18-55mm f/3.5-5.6 AL"));
841         choices.insert (p_t (256 * 4 + 253, "smc PENTAX-DA 14mm f/2.8 ED[IF]"));
842         choices.insert (p_t (256 * 4 + 254, "smc PENTAX-DA 16-45mm f/4 ED AL"));
843         choices.insert (p_t (256 * 5 + 1, "smc PENTAX-FA* 24mm f/2 AL[IF]"));
844         choices.insert (p_t (256 * 5 + 2, "smc PENTAX-FA 28mm f/2.8 AL"));
845         choices.insert (p_t (256 * 5 + 3, "smc PENTAX-FA 50mm f/1.7"));
846         choices.insert (p_t (256 * 5 + 4, "smc PENTAX-FA 50mm f/1.4"));
847         choices.insert (p_t (256 * 5 + 5, "smc PENTAX-FA* 600mm f/4 ED[IF]"));
848         choices.insert (p_t (256 * 5 + 6, "smc PENTAX-FA* 300mm f/4.5 ED[IF]"));
849         choices.insert (p_t (256 * 5 + 7, "smc PENTAX-FA 135mm f/2.8 [IF]"));
850         choices.insert (p_t (256 * 5 + 8, "smc PENTAX-FA Macro 50mm f/2.8"));
851         choices.insert (p_t (256 * 5 + 9, "smc PENTAX-FA Macro 100mm f/2.8"));
852         choices.insert (p_t (256 * 5 + 10, "smc PENTAX-FA* 85mm f/1.4 [IF]"));
853         choices.insert (p_t (256 * 5 + 11, "smc PENTAX-FA* 200mm f/2.8 ED[IF]"));
854         choices.insert (p_t (256 * 5 + 12, "smc PENTAX-FA 28-80mm f/3.5-4.7"));
855         choices.insert (p_t (256 * 5 + 13, "smc PENTAX-FA 70-200mm f/4-5.6"));
856         choices.insert (p_t (256 * 5 + 14, "smc PENTAX-FA* 250-600mm f/5.6 ED[IF]"));
857         choices.insert (p_t (256 * 5 + 15, "smc PENTAX-FA 28-105mm f/4-5.6"));
858         choices.insert (p_t (256 * 5 + 16, "smc PENTAX-FA 100-300mm f/4.5-5.6"));
859         choices.insert (p_t (256 * 5 + 98, "smc PENTAX-FA 100-300mm f/4.5-5.6"));
860         choices.insert (p_t (256 * 6 + 1, "smc PENTAX-FA* 85mm f/1.4 [IF]"));
861         choices.insert (p_t (256 * 6 + 2, "smc PENTAX-FA* 200mm f/2.8 ED[IF]"));
862         choices.insert (p_t (256 * 6 + 3, "smc PENTAX-FA* 300mm f/2.8 ED[IF]"));
863         choices.insert (p_t (256 * 6 + 4, "smc PENTAX-FA* 28-70mm f/2.8 AL"));
864         choices.insert (p_t (256 * 6 + 5, "smc PENTAX-FA* 80-200mm f/2.8 ED[IF]"));
865         choices.insert (p_t (256 * 6 + 6, "smc PENTAX-FA* 28-70mm f/2.8 AL"));
866         choices.insert (p_t (256 * 6 + 7, "smc PENTAX-FA* 80-200mm f/2.8 ED[IF]"));
867         choices.insert (p_t (256 * 6 + 8, "smc PENTAX-FA 28-70mm f/4AL"));
868         choices.insert (p_t (256 * 6 + 9, "smc PENTAX-FA 20mm f/2.8"));
869         choices.insert (p_t (256 * 6 + 10, "smc PENTAX-FA* 400mm f/5.6 ED[IF]"));
870         choices.insert (p_t (256 * 6 + 13, "smc PENTAX-FA* 400mm f/5.6 ED[IF]"));
871         choices.insert (p_t (256 * 6 + 14, "smc PENTAX-FA* Macro 200mm f/4 ED[IF]"));
872         choices.insert (p_t (256 * 7 + 0, "smc PENTAX-DA 21mm f/3.2 AL Limited"));
873         choices.insert (p_t (256 * 7 + 58, "smc PENTAX-D FA Macro 100mm f/2.8 WR"));
874         choices.insert (p_t (256 * 7 + 75, "Tamron SP AF 70-200mm f/2.8 Di LD [IF] Macro (A001)"));
875         choices.insert (p_t (256 * 7 + 201, "smc Pentax-DA L 50-200mm f/4-5.6 ED WR"));
876         choices.insert (p_t (256 * 7 + 202, "smc PENTAX-DA L 18-55mm f/3.5-5.6 AL WR"));
877         choices.insert (p_t (256 * 7 + 203, "HD PENTAX-DA 55-300mm f/4-5.8 ED WR"));
878         choices.insert (p_t (256 * 7 + 204, "HD PENTAX-DA 15mm f/4 ED AL Limited"));
879         choices.insert (p_t (256 * 7 + 205, "HD PENTAX-DA 35mm f/2.8 Macro Limited"));
880         choices.insert (p_t (256 * 7 + 206, "HD PENTAX-DA 70mm f/2.4 Limited"));
881         choices.insert (p_t (256 * 7 + 207, "HD PENTAX-DA 21mm f/3.2 ED AL Limited"));
882         choices.insert (p_t (256 * 7 + 208, "HD PENTAX-DA 40mm f/2.8 Limited"));
883         choices.insert (p_t (256 * 7 + 212, "smc PENTAX-DA 50mm f/1.8"));
884         choices.insert (p_t (256 * 7 + 213, "smc PENTAX-DA 40mm f/2.8 XS"));
885         choices.insert (p_t (256 * 7 + 214, "smc PENTAX-DA 35mm f/2.4 AL"));
886         choices.insert (p_t (256 * 7 + 216, "smc PENTAX-DA L 55-300mm f/4-5.8 ED"));
887         choices.insert (p_t (256 * 7 + 217, "smc PENTAX-DA 50-200mm f/4-5.6 ED WR"));
888         choices.insert (p_t (256 * 7 + 218, "smc PENTAX-DA 18-55mm f/3.5-5.6 AL WR"));
889         choices.insert (p_t (256 * 7 + 220, "Tamron SP AF 10-24mm f/3.5-4.5 Di II LD Aspherical [IF]"));
890         choices.insert (p_t (256 * 7 + 221, "smc PENTAX-DA L 50-200mm f/4-5.6 ED"));
891         choices.insert (p_t (256 * 7 + 222, "smc PENTAX-DA L 18-55mm f/3.5-5.6"));
892         choices.insert (p_t (256 * 7 + 223, "Samsung/Schneider D-XENON 18-55mm f/3.5-5.6 II"));
893         choices.insert (p_t (256 * 7 + 224, "smc PENTAX-DA 15mm f/4 ED AL Limited"));
894         choices.insert (p_t (256 * 7 + 225, "Samsung/Schneider D-XENON 18-250mm f/3.5-6.3"));
895         choices.insert (p_t (256 * 7 + 226, "smc PENTAX-DA* 55mm f/1.4 SDM (SDM unused)"));
896         choices.insert (p_t (256 * 7 + 227, "smc PENTAX-DA* 60-250mm f/4 [IF] SDM (SDM unused)"));
897         choices.insert (p_t (256 * 7 + 228, "Samsung 16-45mm f/4 ED"));
898         choices.insert (p_t (256 * 7 + 229, "smc PENTAX-DA 18-55mm f/3.5-5.6 AL II"));
899         choices.insert (p_t (256 * 7 + 230, "Tamron AF 17-50mm f/2.8 XR Di-II LD (Model A16)"));
900         choices.insert (p_t (256 * 7 + 231, "smc PENTAX-DA 18-250mm f/3.5-6.3 ED AL [IF]"));
901         choices.insert (p_t (256 * 7 + 233, "smc PENTAX-DA 35mm f/2.8 Macro Limited"));
902         choices.insert (p_t (256 * 7 + 234, "smc PENTAX-DA* 300mm f/4 ED [IF] SDM (SDM unused)"));
903         choices.insert (p_t (256 * 7 + 235, "smc PENTAX-DA* 200mm f/2.8 ED [IF] SDM (SDM unused)"));
904         choices.insert (p_t (256 * 7 + 236, "smc PENTAX-DA 55-300mm f/4-5.8 ED"));
905         choices.insert (p_t (256 * 7 + 238, "Tamron AF 18-250mm f/3.5-6.3 Di II LD Aspherical [IF] Macro"));
906         choices.insert (p_t (256 * 7 + 241, "smc PENTAX-DA* 50-135mm f/2.8 ED [IF] SDM (SDM unused)"));
907         choices.insert (p_t (256 * 7 + 242, "smc PENTAX-DA* 16-50mm f/2.8 ED AL [IF] SDM (SDM unused)"));
908         choices.insert (p_t (256 * 7 + 243, "smc PENTAX-DA 70mm f/2.4 Limited"));
909         choices.insert (p_t (256 * 7 + 244, "smc PENTAX-DA 21mm f/3.2 AL Limited"));
910         choices.insert (p_t (256 * 8 + 0, "Sigma 50-150mm f/2.8 II APO EX DC HSM"));
911         choices.insert (p_t (256 * 8 + 3, "Sigma 18-125mm f/3.8-5.6 DC HSM"));
912         choices.insert (p_t (256 * 8 + 4, "Sigma 50mm f/1.4 EX DG HSM"));
913         choices.insert (p_t (256 * 8 + 6, "Sigma 4.5mm f/2.8 EX DC Fisheye"));
914         choices.insert (p_t (256 * 8 + 7, "Sigma 24-70mm f/2.8 IF EX DG HSM"));
915         choices.insert (p_t (256 * 8 + 8, "Sigma 18-250mm f/3.5-6.3 DC OS HSM"));
916         choices.insert (p_t (256 * 8 + 11, "Sigma 10-20mm f/3.5 EX DC HSM"));
917         choices.insert (p_t (256 * 8 + 12, "Sigma 70-300mm f/4-5.6 DG OS"));
918         choices.insert (p_t (256 * 8 + 13, "Sigma 120-400mm f/4.5-5.6 APO DG OS HSM"));
919         choices.insert (p_t (256 * 8 + 14, "Sigma 17-70mm f/2.8-4.0 DC Macro OS HSM"));
920         choices.insert (p_t (256 * 8 + 15, "Sigma 150-500mm f/5-6.3 APO DG OS HSM"));
921         choices.insert (p_t (256 * 8 + 16, "Sigma 70-200mm f/2.8 EX DG Macro HSM II"));
922         choices.insert (p_t (256 * 8 + 17, "Sigma 50-500mm f/4.5-6.3 DG OS HSM"));
923         choices.insert (p_t (256 * 8 + 18, "Sigma 8-16mm f/4.5-5.6 DC HSM"));
924         choices.insert (p_t (256 * 8 + 20, "Sigma 18-50mm f/2.8-4.5 DC HSM"));
925         choices.insert (p_t (256 * 8 + 21, "Sigma 17-50mm f/2.8 EX DC OS HSM"));
926         choices.insert (p_t (256 * 8 + 22, "Sigma 85mm f/1.4 EX DG HSM"));
927         choices.insert (p_t (256 * 8 + 23, "Sigma 70-200mm f/2.8 APO EX DG OS HSM"));
928         choices.insert (p_t (256 * 8 + 25, "Sigma 17-50mm f/2.8 EX DC HSM"));
929         choices.insert (p_t (256 * 8 + 27, "Sigma 18-200mm f/3.5-6.3 II DC HSM"));
930         choices.insert (p_t (256 * 8 + 28, "Sigma 18-250mm f/3.5-6.3 DC Macro HSM"));
931         choices.insert (p_t (256 * 8 + 29, "Sigma 35mm f/1.4 DG HSM"));
932         choices.insert (p_t (256 * 8 + 30, "Sigma 17-70mm f/2.8-4 DC Macro HSM | C"));
933         choices.insert (p_t (256 * 8 + 31, "Sigma 18-35mm f/1.8 DC HSM"));
934         choices.insert (p_t (256 * 8 + 32, "Sigma 30mm f/1.4 DC HSM | A"));
935         choices.insert (p_t (256 * 8 + 33, "Sigma 18-200mm f/3.5-6.3 DC Macro HSM"));
936         choices.insert (p_t (256 * 8 + 34, "Sigma 18-300mm f/3.5-6.3 DC Macro HSM"));
937         choices.insert (p_t (256 * 8 + 59, "HD PENTAX-D FA 150-450mm f/4.5-5.6 ED DC AW"));
938         choices.insert (p_t (256 * 8 + 60, "HD PENTAX-D FA* 70-200mm f/2.8 ED DC AW"));
939         choices.insert (p_t (256 * 8 + 61, "HD PENTAX-D FA 28-105mm f/3.5-5.6 ED DC WR"));
940         choices.insert (p_t (256 * 8 + 62, "HD PENTAX-D FA 24-70mm f/2.8 ED SDM WR"));
941         choices.insert (p_t (256 * 8 + 63, "HD PENTAX-D FA 15-30mm f/2.8 ED SDM WR"));
942         choices.insert (p_t (256 * 8 + 64, "HD PENTAX-D FA* 50mm f/1.4 SDM AW"));
943         choices.insert (p_t (256 * 8 + 196, "HD PENTAX-DA* 11-18mm f/2.8 ED DC AW"));
944         choices.insert (p_t (256 * 8 + 197, "HD PENTAX-DA 55-300mm f/4.5-6.3 ED PLM WR RE"));
945         choices.insert (p_t (256 * 8 + 198, "smc PENTAX-DA L 18-50mm f/4-5.6 DC WR RE"));
946         choices.insert (p_t (256 * 8 + 199, "HD PENTAX-DA 18-50mm f/4-5.6 DC WR RE"));
947         choices.insert (p_t (256 * 8 + 200, "HD PENTAX-DA 16-85mm f/3.5-5.6 ED DC WR"));
948         choices.insert (p_t (256 * 8 + 209, "HD PENTAX-DA 20-40mm f/2.8-4 ED Limited DC WR"));
949         choices.insert (p_t (256 * 8 + 210, "smc PENTAX-DA 18-270mm f/3.5-6.3 ED SDM"));
950         choices.insert (p_t (256 * 8 + 211, "HD PENTAX-DA 560mm f/5.6 ED AW"));
951         choices.insert (p_t (256 * 8 + 215, "smc PENTAX-DA 18-135mm f/3.5-5.6 ED AL [IF] DC WR"));
952         choices.insert (p_t (256 * 8 + 226, "smc PENTAX-DA* 55mm f/1.4 SDM"));
953         choices.insert (p_t (256 * 8 + 227, "smc PENTAX-DA* 60-250mm f/4 [IF] SDM"));
954         choices.insert (p_t (256 * 8 + 232, "smc PENTAX-DA 17-70mm f/4 AL [IF] SDM"));
955         choices.insert (p_t (256 * 8 + 234, "smc PENTAX-DA* 300mm f/4 ED [IF] SDM"));
956         choices.insert (p_t (256 * 8 + 235, "smc PENTAX-DA* 200mm f/2.8 ED [IF] SDM"));
957         choices.insert (p_t (256 * 8 + 241, "smc PENTAX-DA* 50-135mm f/2.8 ED [IF] SDM"));
958         choices.insert (p_t (256 * 8 + 242, "smc PENTAX-DA* 16-50mm f/2.8 ED AL [IF] SDM"));
959         choices.insert (p_t (256 * 8 + 255, "Sigma Lens (8 255)"));
960         choices.insert (p_t (256 * 8 + 255, "Sigma 70-200mm f/2.8 EX DG Macro HSM II"));
961         choices.insert (p_t (256 * 8 + 255, "Sigma 150-500mm f/5-6.3 DG APO [OS] HSM"));
962         choices.insert (p_t (256 * 8 + 255, "Sigma 50-150mm f/2.8 II APO EX DC HSM"));
963         choices.insert (p_t (256 * 8 + 255, "Sigma 4.5mm f/2.8 EX DC HSM Circular Fisheye"));
964         choices.insert (p_t (256 * 8 + 255, "Sigma 50-200mm f/4-5.6 DC OS"));
965         choices.insert (p_t (256 * 8 + 255, "Sigma 24-70mm f/2.8 EX DG HSM"));
966         choices.insert (p_t (256 * 9 + 0, "645 Manual Lens"));
967         choices.insert (p_t (256 * 10 + 0, "645 A Series Lens"));
968         choices.insert (p_t (256 * 11 + 1, "smc PENTAX-FA 645 75mm f/2.8"));
969         choices.insert (p_t (256 * 11 + 2, "smc PENTAX-FA 645 45mm f/2.8"));
970         choices.insert (p_t (256 * 11 + 3, "smc PENTAX-FA* 645 300mm f/4 ED [IF]"));
971         choices.insert (p_t (256 * 11 + 4, "smc PENTAX-FA 645 45-85mm f/4.5"));
972         choices.insert (p_t (256 * 11 + 5, "smc PENTAX-FA 645 400mm f/5.6 ED [IF]"));
973         choices.insert (p_t (256 * 11 + 7, "smc PENTAX-FA 645 Macro 120mm f/4"));
974         choices.insert (p_t (256 * 11 + 8, "smc PENTAX-FA 645 80-160mm f/4.5"));
975         choices.insert (p_t (256 * 11 + 9, "smc PENTAX-FA 645 200mm f/4 [IF]"));
976         choices.insert (p_t (256 * 11 + 10, "smc PENTAX-FA 645 150mm f/2.8 [IF]"));
977         choices.insert (p_t (256 * 11 + 11, "smc PENTAX-FA 645 35mm f/3.5 AL [IF]"));
978         choices.insert (p_t (256 * 11 + 12, "smc PENTAX-FA 645 300mm f/5.6 ED [IF]"));
979         choices.insert (p_t (256 * 11 + 14, "smc PENTAX-FA 645 55-110mm f/5.6"));
980         choices.insert (p_t (256 * 11 + 16, "smc PENTAX-FA 645 33-55mm f/4.5 AL"));
981         choices.insert (p_t (256 * 11 + 17, "smc PENTAX-FA 645 150-300mm f/5.6 ED [IF]"));
982         choices.insert (p_t (256 * 11 + 21, "HD PENTAX-D FA 645 35mm f/3.5 AL [IF]"));
983         choices.insert (p_t (256 * 13 + 18, "smc PENTAX-D FA 645 55mm f/2.8 AL [IF] SDM AW"));
984         choices.insert (p_t (256 * 13 + 19, "smc PENTAX-D FA 645 25mm f/4 AL [IF] SDM AW"));
985         choices.insert (p_t (256 * 13 + 20, "HD PENTAX-D FA 645 90mm f/2.8 ED AW SR"));
986         choices.insert (p_t (256 * 13 + 253, "HD PENTAX-DA 645 28-45mm f/4.5 ED AW SR"));
987         choices.insert (p_t (256 * 13 + 254, "smc PENTAX-DA 645 25mm f/4 AL [IF] SDM AW"));
988         choices.insert (p_t (256 * 21 + 0, "Pentax Q Manual Lens"));
989         choices.insert (p_t (256 * 21 + 1, "01 Standard Prime 8.5mm f/1.9"));
990         choices.insert (p_t (256 * 21 + 2, "02 Standard Zoom 5-15mm f/2.8-4.5"));
991         choices.insert (p_t (256 * 21 + 6, "06 Telephoto Zoom 15-45mm f/2.8"));
992         choices.insert (p_t (256 * 21 + 7, "07 Mount Shield 11.5mm f/9"));
993         choices.insert (p_t (256 * 21 + 8, "08 Wide Zoom 3.8-5.9mm f/3.7-4"));
994         choices.insert (p_t (256 * 21 + 233, "Adapter Q for K-mount Lens"));
995         choices.insert (p_t (256 * 22 + 3, "03 Fish-eye 3.2mm f/5.6"));
996         choices.insert (p_t (256 * 22 + 4, "04 Toy Lens Wide 6.3mm f/7.1"));
997         choices.insert (p_t (256 * 22 + 5, "05 Toy Lens Telephoto 18mm f/8"));
998         choices.insert (p_t (256 * 31 + 1, "GR Lens"));
999     }
toString(const Tag * t) const1000     std::string toString (const Tag* t) const override
1001     {
1002         double *liArray = nullptr;
1003         double maxApertureAtFocal = 0.;
1004         double focalLength = 0.;
1005         int lensID = 256 * t->toInt (0, BYTE) + t->toInt (1, BYTE);
1006         TagDirectory *root = t->getParent()->getRoot();
1007 
1008         if (root) {
1009 
1010             Tag *t1;
1011             t1 = root->findTag ("FocalLength"); // Should get tag 0x920A (rational64u) from the standard Exif tag list
1012 
1013             if ( t1) {
1014                 focalLength = t1->toDouble();    // Focal Length
1015             }
1016 
1017             t1 = root->findTag ("MaxAperture");
1018 
1019             if (t1) {
1020                 double maxAperture = t1->toDouble(); // MaxApertureValue at focal Length
1021 
1022                 if (maxAperture != 0.) {
1023                     maxApertureAtFocal = maxAperture;
1024                 } else {
1025                     t1 = root->findTag ("NominalMaxAperture");
1026 
1027                     if (t1) {
1028                         maxApertureAtFocal = t1->toDouble();
1029                     }
1030                 }
1031             }
1032 
1033             t1 = root->getTagP ("LensInfo");
1034 
1035             if (t1) {
1036                 liArray = t1->toDoubleArray();
1037             }
1038 
1039             // Focal length below 10mm are set to 0 by the camera in the standard Exif tag, so we'll look into the makernotes
1040             // This value will have decimals, which reflects more precision... or imprecision, due to the packed form of this value, who knows?
1041             if (focalLength == 0.) {
1042                 rtexif::TagDirectory* mnote = root->findTag ("MakerNote")->getDirectory();
1043                 rtexif::Tag* flt = mnote->getTagP ("LensInfo/FocalLength");
1044 
1045                 if (flt) {
1046                     focalLength = flt->toDouble ();
1047                 } else if ((flt = mnote->getTagP ("FocalLength"))) {
1048                     focalLength = flt->toDouble();
1049                 }
1050             }
1051         }
1052 
1053         std::string retval = guess ( lensID, focalLength, maxApertureAtFocal, liArray);
1054 
1055         if (liArray) {
1056             delete [] liArray;
1057         }
1058 
1059         return retval;
1060     }
1061 };
1062 PALensTypeInterpreter paLensTypeInterpreter;
1063 
1064 class PASRResultInterpreter: public Interpreter
1065 {
1066 public:
PASRResultInterpreter()1067     PASRResultInterpreter() { }
toString(const Tag * t) const1068     std::string toString (const Tag* t) const override
1069     {
1070         std::ostringstream str;
1071         int b = t->toInt (0, BYTE);
1072 
1073         if (!b) {
1074             str << "Not stabilized";
1075         } else if (b & 1) {
1076             str << "Stabilized";
1077         } else if (b & 64) {
1078             str << "Not Ready";
1079         }
1080 
1081         return str.str();
1082     }
1083 };
1084 PASRResultInterpreter paSRResultInterpreter;
1085 
1086 class PAHighISONoiseInterpreter: public ChoiceInterpreter<>
1087 {
1088 public:
1089     // HighISONoiseReduction
PAHighISONoiseInterpreter()1090     PAHighISONoiseInterpreter()
1091     {
1092         choices[0] = "Off";
1093         choices[1] = "Weakest";
1094         choices[2] = "Weak";
1095         choices[3] = "Strong";
1096         choices[4] = "Medium";
1097         choices[255] = "Auto";
1098     }
1099 };
1100 PAHighISONoiseInterpreter paHighISONoiseInterpreter;
1101 
1102 class PAMonochromeFilterEffectInterpreter: public ChoiceInterpreter<>
1103 {
1104 public:
PAMonochromeFilterEffectInterpreter()1105     PAMonochromeFilterEffectInterpreter()
1106     {
1107         choices[1] = "Green";
1108         choices[2] = "Yellow";
1109         choices[3] = "Orange";
1110         choices[4] = "Red";
1111         choices[5] = "Magenta";
1112         choices[6] = "Blue";
1113         choices[7] = "Cyan";
1114         choices[8] = "Infrared";
1115         choices[65535] = "None";
1116     }
1117 };
1118 PAMonochromeFilterEffectInterpreter paMonochromeFilterEffectInterpreter;
1119 
1120 class PAMonochromeToningInterpreter: public ChoiceInterpreter<>
1121 {
1122 public:
PAMonochromeToningInterpreter()1123     PAMonochromeToningInterpreter()
1124     {
1125         choices[0] = "-4";
1126         choices[1] = "-3";
1127         choices[2] = "-2";
1128         choices[3] = "-1";
1129         choices[4] = "0";
1130         choices[5] = "1";
1131         choices[6] = "2";
1132         choices[7] = "3";
1133         choices[8] = "4";
1134         choices[65535] = "None";
1135     }
1136 };
1137 PAMonochromeToningInterpreter paMonochromeToningInterpreter;
1138 
1139 class PAShadowCorrectionInterpreter: public ChoiceInterpreter<>
1140 {
1141 public:
PAShadowCorrectionInterpreter()1142     PAShadowCorrectionInterpreter()
1143     {
1144         choices[        0 ] = "Off";
1145         choices[        1 ] = "On";
1146         choices[        2 ] = "Auto 2";
1147         choices[ 1 << 8 | 1 ] = "Weak";
1148         choices[ 1 << 8 | 2 ] = "Normal";
1149         choices[ 1 << 8 | 3 ] = "Strong";
1150         choices[ 2 << 8 | 4 ] = "Auto";
1151     }
1152 
toString(const Tag * t) const1153     std::string toString (const Tag* t) const override
1154     {
1155         int idx = 0;
1156 
1157         if (t->getCount() == 1) {
1158             idx = t->toInt (0, BYTE);
1159         } else if (t->getCount() == 2) {
1160             idx = t->toInt (0, BYTE) << 8 | t->toInt (1, BYTE);
1161         }
1162 
1163         const ChoicesIterator r  = choices.find (idx);
1164         std::ostringstream s;
1165         s << ((r != choices.end()) ? r->second : "n/a");
1166         return s.str();
1167     }
1168 };
1169 PAShadowCorrectionInterpreter paShadowCorrectionInterpreter;
1170 
1171 class PAISOAutoParametersInterpreter: public ChoiceInterpreter<>
1172 {
1173 public:
PAISOAutoParametersInterpreter()1174     PAISOAutoParametersInterpreter()
1175     {
1176         choices[1] = "Slow";
1177         choices[2] = "Standard";
1178         choices[3] = "Fast";
1179     }
toString(const Tag * t) const1180     std::string toString (const Tag* t) const override
1181     {
1182         const ChoicesIterator r  = choices.find (t->toInt (0, BYTE));
1183         std::ostringstream s;
1184         s << ((r != choices.end()) ? r->second : "n/a");
1185         return s.str();
1186     }
1187 };
1188 PAISOAutoParametersInterpreter paISOAutoParametersInterpreter;
1189 
1190 class PABleachBypassToningInterpreter: public ChoiceInterpreter<>
1191 {
1192 public:
PABleachBypassToningInterpreter()1193     PABleachBypassToningInterpreter()
1194     {
1195         choices[1] = "Green";
1196         choices[2] = "Yellow";
1197         choices[3] = "Orange";
1198         choices[4] = "Red";
1199         choices[5] = "Magenta";
1200         choices[6] = "Purple";
1201         choices[7] = "Blue";
1202         choices[8] = "Cyan";
1203         choices[65535] = "Off";
1204     }
1205 };
1206 PABleachBypassToningInterpreter paBleachBypassToningInterpreter;
1207 
1208 class PABlurControlInterpreter: public ChoiceInterpreter<>
1209 {
1210 public:
PABlurControlInterpreter()1211     PABlurControlInterpreter()
1212     {
1213         choices[0] = "Off";
1214         choices[1] = "Low";
1215         choices[2] = "Medium";
1216         choices[3] = "High";
1217     }
toString(const Tag * t) const1218     std::string toString (const Tag* t) const override
1219     {
1220         const ChoicesIterator r  = choices.find (t->toInt (0, BYTE));
1221         std::ostringstream s;
1222         s << ((r != choices.end()) ? r->second : "n/a");
1223         return s.str();
1224     }
1225 };
1226 PABlurControlInterpreter paBlurControlInterpreter;
1227 
1228 class PAHDRInterpreter: public ChoiceInterpreter<>
1229 {
1230     std::map<int, std::string> choices1;
1231     std::map<int, std::string> choices2;
1232 public:
PAHDRInterpreter()1233     PAHDRInterpreter()
1234     {
1235         choices[0]    = "Off";
1236         choices[1]    = "HDR Auto";
1237         choices[2]    = "HDR 1";
1238         choices[3]    = "HDR 2";
1239         choices[4]    = "HDR 3";
1240         choices[5]    = "Advanced";
1241 
1242         choices1[0]   = "Auto-align Off";
1243         choices1[1]   = "Auto-align On";
1244 
1245         choices2[0]   = "n/a";
1246         choices2[4]   = "1 EV";
1247         choices2[8]   = "2 EV";
1248         choices2[12]  = "3 EV";
1249     }
toString(const Tag * t) const1250     std::string toString (const Tag* t) const override
1251     {
1252         const ChoicesIterator r  = choices.find  (t->toInt (0, BYTE));
1253         std::map<int, std::string>::const_iterator r1 = choices1.find (t->toInt (1, BYTE));
1254         std::map<int, std::string>::const_iterator r2 = choices2.find (t->toInt (2, BYTE));
1255         std::ostringstream s;
1256         s << ((r != choices.end() ) ?  r->second : "") << std::endl;
1257         s << ((r1 != choices1.end()) ? r1->second : "") << std::endl;
1258         s << ((r2 != choices2.end()) ? r2->second : "");
1259         return s.str();
1260     }
1261 };
1262 PAHDRInterpreter paHDRInterpreter;
1263 
1264 class PACrossProcessInterpreter: public ChoiceInterpreter<>
1265 {
1266 public:
PACrossProcessInterpreter()1267     PACrossProcessInterpreter()
1268     {
1269         choices[ 0] = "Off";
1270         choices[ 1] = "Randow";
1271         choices[ 2] = "Preset 1";
1272         choices[ 3] = "Preset 2";
1273         choices[ 4] = "Preset 3";
1274         choices[33] = "Favorite 1";
1275         choices[34] = "Favorite 2";
1276         choices[35] = "Favorite 3";
1277     }
1278 };
1279 PACrossProcessInterpreter paCrossProcessInterpreter;
1280 
1281 class PAPowerSourceInterpreter: public ChoiceInterpreter<>
1282 {
1283 public:
PAPowerSourceInterpreter()1284     PAPowerSourceInterpreter()
1285     {
1286         choices[2] = "Body Battery";
1287         choices[3] = "Grip Battery ";
1288         choices[4] = "External Power Supply";
1289     }
1290 };
1291 PAPowerSourceInterpreter paPowerSourceInterpreter;
1292 
1293 class PALensModelQInterpreter: public Interpreter
1294 {
1295 public:
PALensModelQInterpreter()1296     PALensModelQInterpreter() {}
toString(const Tag * t) const1297     std::string toString (const Tag* t) const override
1298     {
1299         char buffer[31];
1300         buffer[0] = 0;  //
1301         return buffer;  // TODO: how to get the string content!?
1302 
1303 //        // normal path below (copy the content of the string), but has to be bug fixed
1304 //        memcpy (buffer, t->getValue(), 30);
1305 //        buffer[30] = 0;
1306 //        return buffer;
1307     }
1308 };
1309 PALensModelQInterpreter paLensModelQInterpreter;
1310 
1311 class PALensInfoQInterpreter: public Interpreter
1312 {
1313 public:
PALensInfoQInterpreter()1314     PALensInfoQInterpreter() {}
toString(const Tag * t) const1315     std::string toString (const Tag* t) const override
1316     {
1317         char buffer[21];
1318         buffer[0] = 0;
1319         return buffer;  // TODO: how to get the string content!?
1320 
1321 //        // normal path below (copy the content of the string), but has to be bug fixed
1322 //        memcpy (buffer, t->getValue(), 20);
1323 //        buffer[20] = 0;
1324 //        return buffer;
1325     }
1326 };
1327 PALensInfoQInterpreter paLensInfoQInterpreter;
1328 
1329 class PAFlashExposureCompInterpreter: public Interpreter
1330 {
1331 public:
PAFlashExposureCompInterpreter()1332     PAFlashExposureCompInterpreter() {}
toString(const Tag * t) const1333     std::string toString (const Tag* t) const override
1334     {
1335         int a;
1336 
1337         if (t->getCount() == 1) {
1338             a = t->toInt (0, SLONG) / 256;   // int32u
1339         } else {
1340             a = t->toInt (0, SBYTE) / 6;   // int8u[2]
1341         }
1342 
1343         char buffer[32];
1344         sprintf (buffer, "%d", a );
1345         return buffer;
1346     }
toDouble(const Tag * t,int ofs)1347     double toDouble (const Tag* t, int ofs) override
1348     {
1349         int a;
1350 
1351         if (t->getCount() == 1) {
1352             a = t->toInt (0, SLONG) / 256;   // int32u
1353         } else {
1354             a = t->toInt (0, SBYTE) / 6;   // int8u[2]
1355         }
1356 
1357         return double (a);
1358     }
1359 };
1360 PAFlashExposureCompInterpreter paFlashExposureCompInterpreter;
1361 
1362 class PAFocalLengthInterpreter: public Interpreter
1363 {
1364 public:
PAFocalLengthInterpreter()1365     PAFocalLengthInterpreter() {}
toString(const Tag * t) const1366     std::string toString (const Tag* t) const override
1367     {
1368         double a = double (t->toInt (0, LONG));
1369 
1370         if (a > 1.) {
1371             char buffer[32];
1372             sprintf (buffer, "%.2f", a / 100. );
1373             return buffer;
1374         } else {
1375             return "n/a";
1376         }
1377     }
toDouble(const Tag * t,int ofs)1378     double toDouble (const Tag* t, int ofs) override
1379     {
1380         double a = double (t->toInt (0, LONG));
1381 
1382         if (a > 1.) {
1383             return a / 100.;
1384         } else {
1385             return 0.;
1386         }
1387     }
1388 };
1389 PAFocalLengthInterpreter paFocalLengthInterpreter;
1390 
1391 class PALensDataFocalLengthInterpreter: public Interpreter
1392 {
1393 public:
PALensDataFocalLengthInterpreter()1394     PALensDataFocalLengthInterpreter() {}
toString(const Tag * t) const1395     std::string toString (const Tag* t) const override
1396     {
1397         int a = t->toInt (0, BYTE);
1398         float b = float (10 * int (a >> 2)) * pow (4.f, float (int (a & 0x03) - 2));
1399 
1400         if (b > 1.f) {
1401             char buffer[32];
1402             sprintf (buffer, "%.2f", b );
1403             return buffer;
1404         } else {
1405             return "n/a";
1406         }
1407     }
toDouble(const Tag * t,int ofs)1408     double toDouble (const Tag* t, int ofs) override
1409     {
1410         int a = t->toInt (ofs, BYTE);
1411         float b = float (10 * int (a >> 2)) * pow (4.f, float (int (a & 0x03) - 2));
1412 
1413         if (b > 1.f) {
1414             return b;
1415         } else {
1416             return 0.;
1417         }
1418     }
1419 };
1420 PALensDataFocalLengthInterpreter paLensDataFocalLengthInterpreter;
1421 
1422 class PAISOfInterpreter: public Interpreter
1423 {
1424 public:
PAISOfInterpreter()1425     PAISOfInterpreter() {}
toString(const Tag * t) const1426     std::string toString (const Tag* t) const override
1427     {
1428         int a = t->toInt (0, BYTE);
1429         char buffer[32];
1430         double v = 100.*exp (double (a - 32) * log (2.) / 8.);
1431         sprintf (buffer, "%.1f", v );
1432         return buffer;
1433     }
toDouble(const Tag * t,int ofs)1434     double toDouble (const Tag* t, int ofs) override
1435     {
1436         int a = t->toInt (0, BYTE);
1437         return 100.*exp (double (a - 32) * log (2.) / 8.);
1438     }
1439 };
1440 PAISOfInterpreter paISOfInterpreter;
1441 
1442 class PAMaxApertureInterpreter: public Interpreter
1443 {
1444 public:
PAMaxApertureInterpreter()1445     PAMaxApertureInterpreter() {}
toString(const Tag * t) const1446     std::string toString (const Tag* t) const override
1447     {
1448         int a = t->toInt (0, BYTE);
1449         a &= 0x7F;
1450 
1451         if (a > 1) {
1452             char buffer[32];
1453             double v = pow (2.0, (a - 1) / 32.0);
1454 
1455             if ( v < 0. || v > 1000. ) {
1456                 return "undef";
1457             }
1458 
1459             sprintf (buffer, "%.1f", v );
1460             return buffer;
1461         } else {
1462             return "n/a";
1463         }
1464     }
toDouble(const Tag * t,int ofs)1465     double toDouble (const Tag* t, int ofs) override
1466     {
1467         int a = t->toInt (0, BYTE);
1468         a &= 0x7F;
1469 
1470         if (a > 1) {
1471             return pow (2.0, double (a - 1) / 32.0);
1472         } else {
1473             return 0.;
1474         }
1475     }
1476 };
1477 PAMaxApertureInterpreter paMaxApertureInterpreter;
1478 
1479 class PAAEXvInterpreter: public Interpreter
1480 {
1481 public:
PAAEXvInterpreter()1482     PAAEXvInterpreter() {}
toString(const Tag * t) const1483     std::string toString (const Tag* t) const override
1484     {
1485         int a = t->toInt (0, BYTE);
1486         char buffer[32];
1487         double v = double (a - 64) / 8.;
1488         sprintf (buffer, "%.1f", v );
1489         return buffer;
1490     }
toDouble(const Tag * t,int ofs)1491     double toDouble (const Tag* t, int ofs) override
1492     {
1493         int a = t->toInt (0, BYTE);
1494         return double (a - 64) / 8.;
1495     }
1496 };
1497 PAAEXvInterpreter paAEXvInterpreter;
1498 
1499 class PAAEBXvInterpreter: public Interpreter
1500 {
1501 public:
PAAEBXvInterpreter()1502     PAAEBXvInterpreter() {}
toString(const Tag * t) const1503     std::string toString (const Tag* t) const override
1504     {
1505         int a = t->toInt (0, SBYTE);
1506         char buffer[32];
1507         double v = double (a) / 8.;
1508         sprintf (buffer, "%.1f", v );
1509         return buffer;
1510     }
toDouble(const Tag * t,int ofs)1511     double toDouble (const Tag* t, int ofs) override
1512     {
1513         int a = t->toInt (0, SBYTE);
1514         return double (a) / 8.;
1515     }
1516 };
1517 PAAEBXvInterpreter paAEBXvInterpreter;
1518 
1519 class PAApertureInterpreter: public Interpreter
1520 {
1521 public:
PAApertureInterpreter()1522     PAApertureInterpreter() {}
toString(const Tag * t) const1523     std::string toString (const Tag* t) const override
1524     {
1525         int a = t->toInt (0, BYTE);
1526         char buffer[32];
1527         double v = exp ((double (a) - 68.) * log (2.) / 16.);
1528         sprintf (buffer, "%.1f", v );
1529         return buffer;
1530     }
toDouble(const Tag * t,int ofs)1531     double toDouble (const Tag* t, int ofs) override
1532     {
1533         int a = t->toInt (0, BYTE);
1534         return exp ((double (a) - 68.) * log (2.) / 16.);
1535     }
1536 };
1537 PAApertureInterpreter paApertureInterpreter;
1538 
1539 class PAExposureTimeInterpreter: public Interpreter
1540 {
1541 public:
PAExposureTimeInterpreter()1542     PAExposureTimeInterpreter() {}
toString(const Tag * t) const1543     std::string toString (const Tag* t) const override
1544     {
1545         int a = t->toInt (0, BYTE);
1546         char buffer[32];
1547         double v = 24.*exp (- (double (a) - 32.) * log (2.) / 8.);
1548         sprintf (buffer, "%.6f", v );
1549         return buffer;
1550     }
toDouble(const Tag * t,int ofs)1551     double toDouble (const Tag* t, int ofs) override
1552     {
1553         int a = t->toInt (0, BYTE);
1554         return 24.*exp (- (double (a) - 32.) * log (2.) / 8.);
1555     }
1556 };
1557 PAExposureTimeInterpreter paExposureTimeInterpreter;
1558 
1559 class PANominalMinApertureInterpreter: public Interpreter
1560 {
1561 public:
PANominalMinApertureInterpreter()1562     PANominalMinApertureInterpreter() {}
toString(const Tag * t) const1563     std::string toString (const Tag* t) const override
1564     {
1565         char buffer[32];
1566         int a = t->toInt (0, BYTE);
1567         int mina = a & 0x0F;
1568         sprintf (buffer, "%.1f", double (int (pow (2.0, double (mina + 10) / 4.0) + 0.2)));
1569         return buffer;
1570     }
toDouble(const Tag * t,int ofs)1571     double toDouble (const Tag* t, int ofs) override
1572     {
1573         int a = t->toInt (0, BYTE) & 0x0F;
1574         return double (int (pow (2.0, double (a + 10) / 4.0) + 0.2));
1575     }
1576 };
1577 PANominalMinApertureInterpreter paNominalMinApertureInterpreter;
1578 
1579 class PANominalMaxApertureInterpreter: public Interpreter
1580 {
1581 public:
PANominalMaxApertureInterpreter()1582     PANominalMaxApertureInterpreter() {}
toString(const Tag * t) const1583     std::string toString (const Tag* t) const override
1584     {
1585         char buffer[32];
1586         int a = t->toInt (0, BYTE);
1587         int maxa = (a & 0xF0) >> 4;
1588         sprintf (buffer, "%.1f", double (int (pow (2.0, double (maxa) / 4.0) + 0.2)) );
1589         return buffer;
1590     }
toDouble(const Tag * t,int ofs)1591     double toDouble (const Tag* t, int ofs) override
1592     {
1593         int a = ( t->toInt (0, BYTE) & 0xF0) >> 4;
1594         return double (int (pow (2.0, double (a) / 4.0) + 0.2));
1595     }
1596 };
1597 PANominalMaxApertureInterpreter paNominalMaxApertureInterpreter;
1598 
1599 class PAFlashStatusInterpreter: public ChoiceInterpreter<>
1600 {
1601 public:
PAFlashStatusInterpreter()1602     PAFlashStatusInterpreter()
1603     {
1604         choices[0] = "Off";
1605         choices[1] = "Off (1)";
1606         choices[2] = "External, Did not fire";
1607         choices[6] = "External, Fired";
1608         choices[8] = "Internal, Did not fire (0x08)";
1609         choices[9] = "Internal, Did not fire";
1610         choices[13] = "Internal, Fired";
1611     }
1612 };
1613 PAFlashStatusInterpreter paFlashStatusInterpreter;
1614 
1615 class PAInternalFlashModeInterpreter: public ChoiceInterpreter<>
1616 {
1617 public:
PAInternalFlashModeInterpreter()1618     PAInternalFlashModeInterpreter()
1619     {
1620         choices[0] = "n/a - Off-Auto-Aperture";
1621         choices[134] = "Fired, Wireless (Control)";
1622         choices[149] = "Fired, Wireless (Master)";
1623         choices[192] = "Fired";
1624         choices[193] = "Fired, Red-eye reduction";
1625         choices[194] = "Fired, Auto";
1626         choices[195] = "Fired, Auto, Red-eye reduction";
1627         choices[198] = "Fired, Wireless (Control), Fired normally not as control";
1628         choices[200] = "Fired, Slow-sync";
1629         choices[201] = "Fired, Slow-sync, Red-eye reduction";
1630         choices[202] = "Fired, Trailing-curtain Sync";
1631         choices[240] = "Did not fire, Normal";
1632         choices[241] = "Did not fire, Red-eye reduction";
1633         choices[242] = "Did not fire, Auto";
1634         choices[243] = "Did not fire, Auto, Red-eye reduction";
1635         choices[244] = "Did not fire, (Unknown 0xf4)";
1636         choices[245] = "Did not fire, Wireless (Master)";
1637         choices[246] = "Did not fire, Wireless (Control)";
1638         choices[248] = "Did not fire, Slow-sync";
1639         choices[249] = "Did not fire, Slow-sync, Red-eye reduction";
1640         choices[250] = "Did not fire, Trailing-curtain Sync";
1641     }
1642 };
1643 PAInternalFlashModeInterpreter paInternalFlashModeInterpreter;
1644 
1645 class PAExternalFlashModeInterpreter: public ChoiceInterpreter<>
1646 {
1647 public:
PAExternalFlashModeInterpreter()1648     PAExternalFlashModeInterpreter()
1649     {
1650         choices[0] = "n/a - Off-Auto-Aperture";
1651         choices[63] = "Off";
1652         choices[64] = "On, Auto";
1653         choices[191] = "On, Flash Problem";
1654         choices[192] = "On, Manual";
1655         choices[196] = "On, P-TTL Auto";
1656         choices[197] = "On, Contrast-control Sync";
1657         choices[198] = "On, High-speed Sync";
1658         choices[204] = "On, Wireless";
1659         choices[205] = "On, Wireless, High-speed Sync";
1660         choices[240] = "Not Connected";
1661     }
1662 };
1663 PAExternalFlashModeInterpreter paExternalFlashModeInterpreter;
1664 
1665 class PAExternalFlashExposureCompInterpreter: public ChoiceInterpreter<>
1666 {
1667 public:
PAExternalFlashExposureCompInterpreter()1668     PAExternalFlashExposureCompInterpreter()
1669     {
1670         choices[0] = "n/a";
1671         choices[144] = "n/a (Manual Mode)";
1672         choices[164] = "-3.0";
1673         choices[167] = "-2.5";
1674         choices[168] = "-2.0";
1675         choices[171] = "-1.5";
1676         choices[172] = "-1.0";
1677         choices[175] = "-0.5";
1678         choices[176] = "0.0";
1679         choices[179] = "0.5";
1680         choices[180] = "1.0";
1681     }
1682 };
1683 PAExternalFlashExposureCompInterpreter paExternalFlashExposureCompInterpreter;
1684 
1685 class PAExternalFlashBounceInterpreter: public ChoiceInterpreter<>
1686 {
1687 public:
PAExternalFlashBounceInterpreter()1688     PAExternalFlashBounceInterpreter()
1689     {
1690         choices[0] = "n/a";
1691         choices[16] = "Direct";
1692         choices[48] = "Bonce";
1693     }
1694 };
1695 PAExternalFlashBounceInterpreter paExternalFlashBounceInterpreter;
1696 
1697 class PAExternalFlashGNInterpreter: public Interpreter
1698 {
1699 public:
PAExternalFlashGNInterpreter()1700     PAExternalFlashGNInterpreter() {}
toString(const Tag * t) const1701     std::string toString (const Tag* t) const override
1702     {
1703         char buffer[32];
1704         int b = t->toInt (0, BYTE) & 0x1F;
1705         sprintf (buffer, "%.0f", pow (2., b / 16. + 4) );
1706         return buffer;
1707     }
1708 };
1709 PAExternalFlashGNInterpreter paExternalFlashGNInterpreter;
1710 
1711 class PAEVStepsInterpreter: public Interpreter
1712 {
1713 public:
PAEVStepsInterpreter()1714     PAEVStepsInterpreter() {}
toString(const Tag * t) const1715     std::string toString (const Tag* t) const override
1716     {
1717         std::ostringstream str;
1718 
1719         if ( t->toInt (0, BYTE) & 0x20 ) {
1720             str << "1/3 EV steps";
1721         } else {
1722             str << "1/2 EV steps";
1723         }
1724 
1725         return str.str();
1726     }
1727 };
1728 PAEVStepsInterpreter paEVStepsInterpreter;
1729 
1730 class PAEDialinInterpreter: public Interpreter
1731 {
1732 public:
PAEDialinInterpreter()1733     PAEDialinInterpreter() {}
toString(const Tag * t) const1734     std::string toString (const Tag* t) const override
1735     {
1736         std::ostringstream str;
1737 
1738         if (  t->toInt (0, BYTE) & 0x40 ) {
1739             str << "P Shift";
1740         } else {
1741             str << "Tv or Av";
1742         }
1743 
1744         return str.str();
1745     }
1746 };
1747 PAEDialinInterpreter paEDialinInterpreter;
1748 
1749 class PAApertureRingUseInterpreter: public Interpreter
1750 {
1751 public:
PAApertureRingUseInterpreter()1752     PAApertureRingUseInterpreter() {}
toString(const Tag * t) const1753     std::string toString (const Tag* t) const override
1754     {
1755         std::ostringstream str;
1756 
1757         if (  t->toInt (0, BYTE) & 0x80 ) {
1758             str << "Permitted";
1759         } else {
1760             str << "Prohibited";
1761         }
1762 
1763         return str.str();
1764     }
1765 };
1766 PAApertureRingUseInterpreter paApertureRingUseInterpreter;
1767 
1768 class PAFlashOptionInterpreter: public ChoiceInterpreter<>
1769 {
1770 public:
PAFlashOptionInterpreter()1771     PAFlashOptionInterpreter()
1772     {
1773         choices[0] = "Normal";
1774         choices[1] = "Red-eye reduction";
1775         choices[2] = "Auto";
1776         choices[3] = "Auto, Red-eye reduction";
1777         choices[5] = "Wireless (Master)";
1778         choices[6] = "Wireless (Control)";
1779         choices[8] = "Slow-sync";
1780         choices[9] = "Slow-sync, Red-eye reduction";
1781         choices[10] = "Trailing-curtain Sync";
1782     }
toString(const Tag * t) const1783     std::string toString (const Tag* t) const override
1784     {
1785         const ChoicesIterator r = choices.find (t->toInt (0, BYTE) >> 4);
1786 
1787         if (r != choices.end()) {
1788             return r->second;
1789         } else {
1790             char buffer[1024];
1791             t->toString (buffer);
1792             return std::string (buffer);
1793         }
1794     }
1795 };
1796 PAFlashOptionInterpreter paFlashOptionInterpreter;
1797 
1798 class PAMeteringMode2Interpreter: public Interpreter
1799 {
1800 public:
PAMeteringMode2Interpreter()1801     PAMeteringMode2Interpreter() {}
toString(const Tag * t) const1802     std::string toString (const Tag* t) const override
1803     {
1804         std::ostringstream str;
1805         int v = (t->toInt (0, BYTE) & 0xF);
1806 
1807         if (!v) {
1808             str << "Multi-segment";
1809         } else if (v & 1) {
1810             str << "Center-weighted average";
1811         } else if (v & 2) {
1812             str << "Spot";
1813         }
1814 
1815         return str.str();
1816     }
1817 };
1818 PAMeteringMode2Interpreter paMeteringMode2Interpreter;
1819 
1820 class PAExposureBracketStepSizeInterpreter: public ChoiceInterpreter<>
1821 {
1822 public:
PAExposureBracketStepSizeInterpreter()1823     PAExposureBracketStepSizeInterpreter()
1824     {
1825         choices[3] = "0.3";
1826         choices[4] = "0.5";
1827         choices[5] = "0.7";
1828         choices[8] = "1.0";
1829         choices[11] = "1.3";
1830         choices[12] = "1.5";
1831         choices[13] = "1.7";
1832         choices[16] = "2.0";
1833     }
1834 };
1835 PAExposureBracketStepSizeInterpreter paExposureBracketStepSizeInterpreter;
1836 
1837 class PAPictureMode2Interpreter: public ChoiceInterpreter<>
1838 {
1839 public:
PAPictureMode2Interpreter()1840     PAPictureMode2Interpreter()
1841     {
1842         choices[0] = "Scene Mode";
1843         choices[1] = "Auto PICT";
1844         choices[2] = "Program AE";
1845         choices[3] = "Green Mode";
1846         choices[4] = "Shutter Speed Priority";
1847         choices[5] = "Aperture Priority";
1848         choices[6] = "Program Tv Shift";
1849         choices[7] = "Program Av Shift";
1850         choices[8] = "Manual";
1851         choices[9] = "Bulb";
1852         choices[10] = "Aperture Priority, Off-Auto-Aperture";
1853         choices[11] = "Manual, Off-Auto-Aperture";
1854         choices[12] = "Bulb, Off-Auto-Aperture";
1855         choices[13] = "Shutter & Aperture Priority AE";
1856         choices[15] = "Sensitivity Priority AE";
1857         choices[16] = "Flash X-Sync Speed AE";
1858     }
1859 };
1860 PAPictureMode2Interpreter paPictureMode2Interpreter;
1861 
1862 class PAProgramLineInterpreter: public Interpreter
1863 {
1864 public:
PAProgramLineInterpreter()1865     PAProgramLineInterpreter() {}
toString(const Tag * t) const1866     std::string toString (const Tag* t) const override
1867     {
1868         std::ostringstream str;
1869         int c = t->toInt (0, BYTE);
1870 
1871         switch (c & 0xf) {
1872             case 0:
1873                 str << "Manual";
1874                 break;
1875 
1876             case 1:
1877                 str << "AF-S";
1878                 break;
1879 
1880             case 2:
1881                 str << "AF-C";
1882                 break;
1883 
1884             case 3:
1885                 str << "AF-A";
1886                 break;
1887         }
1888 
1889         if ( (c & 0xF0) == 0) {
1890             str << ", Point Selection Auto";
1891         } else if ( c & 0x20 ) {
1892             str << ", Fixed Center Point Selected";
1893         } else if ( c & 0x10 ) {
1894             str << ", Point Selected";
1895         }
1896 
1897         return str.str();
1898     }
1899 };
1900 PAProgramLineInterpreter paProgramLineInterpreter;
1901 
1902 class PAAFModeInterpreter: public Interpreter
1903 {
1904 public:
PAAFModeInterpreter()1905     PAAFModeInterpreter() {}
toString(const Tag * t) const1906     std::string toString (const Tag* t) const override
1907     {
1908         switch (t->toInt (0, BYTE) & 0x3) {
1909             case 0:
1910                 return "Normal";
1911 
1912             case 1:
1913                 return "Hi Speed";
1914 
1915             case 2:
1916                 return "Depth";
1917 
1918             case 3:
1919                 return "MTF";
1920         }
1921 
1922         return"Normal";
1923     }
1924 
1925 };
1926 PAAFModeInterpreter paAFModeInterpreter;
1927 
1928 class PAAFPointSelectedInterpreter: public Interpreter
1929 {
1930 public:
PAAFPointSelectedInterpreter()1931     PAAFPointSelectedInterpreter() {}
toString(const Tag * t) const1932     std::string toString (const Tag* t) const override
1933     {
1934         int c = t->toInt (0, SHORT);
1935 
1936         if ( !c ) {
1937             return "Auto";
1938         } else {
1939             const char *ps[] = {"Upper-left", "Top", "Upper-right", "Left", "Mid-left", "Center", "Mid-right", "Right", "Lower-left", "Bottom", "Lower-right"};
1940 
1941             for ( int iBit = 0; iBit < 11; iBit++)
1942                 if ( c & (1 << iBit) ) {
1943                     return ps[iBit];
1944                 }
1945 
1946             return "n/a";
1947         }
1948     }
1949 };
1950 PAAFPointSelectedInterpreter paAFPointSelectedInterpreter;
1951 
1952 class PADriveMode2Interpreter: public Interpreter
1953 {
1954 public:
PADriveMode2Interpreter()1955     PADriveMode2Interpreter() {}
toString(const Tag * t) const1956     std::string toString (const Tag* t) const override
1957     {
1958         int c = t->toInt (0, BYTE);
1959 
1960         if ( !c ) {
1961             return "Single-frame";
1962         } else if ( c & 0x01) {
1963             return "Continuous";
1964         } else if ( c & 0x02) {
1965             return "Continuous (Lo)";
1966         } else if ( c & 0x04) {
1967             return "Self-timer (12 s)";
1968         } else if ( c & 0x08) {
1969             return "Self-timer (2 s)";
1970         } else if ( c & 0x10 ) {
1971             return "Remote Control (3 s delay)";
1972         } else if ( c & 0x20) {
1973             return "Remote Control";
1974         } else if ( c & 0x40) {
1975             return "Exposure Bracket";
1976         } else if ( c & 0x80) {
1977             return "Multiple Exposure";
1978         } else {
1979             return "Unknown";
1980         }
1981     }
1982 };
1983 PADriveMode2Interpreter paDriveMode2Interpreter;
1984 
1985 const TagAttrib pentaxAttribs[] = {
1986     {0, AC_WRITE,  0, nullptr, 0x0000, AUTO, "PentaxVersion", &stdInterpreter},
1987     {0, AC_WRITE,  0, nullptr, 0x0001, AUTO, "PentaxModelType", &stdInterpreter},
1988     {0, AC_SYSTEM, 0, nullptr, 0x0002, AUTO, "PreviewImageSize", &stdInterpreter},
1989     {0, AC_SYSTEM, 0, nullptr, 0x0003, AUTO, "PreviewImageLength", &stdInterpreter},
1990     {0, AC_SYSTEM, 0, nullptr, 0x0004, AUTO, "PreviewImageStart", &stdInterpreter},
1991     {0, AC_WRITE,  0, nullptr, 0x0005, AUTO, "PentaxModelID", &stdInterpreter},
1992     {0, AC_WRITE,  0, nullptr, 0x0006, AUTO, "Date", &stdInterpreter},
1993     {0, AC_WRITE,  0, nullptr, 0x0007, AUTO, "Time", &stdInterpreter},
1994     {0, AC_WRITE,  0, nullptr, 0x0008, AUTO, "Quality", &paQualityInterpreter},
1995     {0, AC_WRITE,  0, nullptr, 0x0009, AUTO, "PentaxImageSize", &stdInterpreter},
1996     {0, AC_WRITE,  0, nullptr, 0x000b, AUTO, "PictureMode", &paPictureModeInterpreter},
1997     {0, AC_WRITE,  0, nullptr, 0x000c, AUTO, "FlashMode", &paFlashModeInterpreter},
1998     {0, AC_WRITE,  0, nullptr, 0x000d, AUTO, "FocusMode", &paFocusModeInterpreter},
1999     {0, AC_WRITE,  0, nullptr, 0x000e, AUTO, "AFPointSelected", &paAFPointInterpreter},
2000     {0, AC_WRITE,  0, nullptr, 0x000f, AUTO, "AFPointsInFocus", &paAFFocusInterpreter},
2001     {0, AC_WRITE,  0, nullptr, 0x0010, AUTO, "FocusPosition", &stdInterpreter},
2002     {0, AC_WRITE,  0, nullptr, 0x0012, AUTO, "ExposureTime", &stdInterpreter},
2003     {0, AC_WRITE,  0, nullptr, 0x0013, AUTO, "FNumber", &paFNumberInterpreter},
2004     {0, AC_WRITE,  0, nullptr, 0x0014, AUTO, "ISO", &paISOInterpreter},
2005     {0, AC_WRITE,  0, nullptr, 0x0015, AUTO, "LightReading", &stdInterpreter},
2006     {0, AC_WRITE,  0, nullptr, 0x0016, AUTO, "ExposureCompensation", &stdInterpreter},
2007     {0, AC_WRITE,  0, nullptr, 0x0017, AUTO, "MeteringMode", &paMeteringModeInterpreter},
2008     {0, AC_WRITE,  0, nullptr, 0x0018, AUTO, "AutoBracketing", &stdInterpreter},
2009     {0, AC_WRITE,  0, nullptr, 0x0019, AUTO, "WhiteBalance", &paWhiteBalanceInterpreter},
2010     {0, AC_WRITE,  0, nullptr, 0x001a, AUTO, "WhiteBalanceMode", &paWhiteBalanceModeInterpreter},
2011     {0, AC_WRITE,  0, nullptr, 0x001b, AUTO, "BlueBalance", &stdInterpreter},
2012     {0, AC_WRITE,  0, nullptr, 0x001c, AUTO, "RedBalance", &stdInterpreter},
2013     {0, AC_WRITE,  0, nullptr, 0x001d, AUTO, "FocalLength", &paFocalLengthInterpreter},
2014     {0, AC_WRITE,  0, nullptr, 0x001e, AUTO, "DigitalZoom", &stdInterpreter},
2015     {0, AC_WRITE,  0, nullptr, 0x001f, AUTO, "Saturation", &paSaturationInterpreter},
2016     {0, AC_WRITE,  0, nullptr, 0x0020, AUTO, "Contrast", &paContrastInterpreter},
2017     {0, AC_WRITE,  0, nullptr, 0x0021, AUTO, "Sharpness", &paSharpnessInterpreter},
2018     {0, AC_WRITE,  0, nullptr, 0x0022, AUTO, "WorldTimeLocation", &stdInterpreter},
2019     {0, AC_WRITE,  0, nullptr, 0x0023, AUTO, "HometownCity", &stdInterpreter},
2020     {0, AC_NEW,    0, nullptr, 0x0024, AUTO, "DestinationCity", &stdInterpreter},
2021     {0, AC_NEW,    0, nullptr, 0x0025, AUTO, "HometownDST", &stdInterpreter},
2022     {0, AC_WRITE,  0, nullptr, 0x0026, AUTO, "DestinationDST", &stdInterpreter},
2023     {0, AC_WRITE,  0, nullptr, 0x0027, AUTO, "DSPFirmwareVersion", &stdInterpreter},
2024     {0, AC_WRITE,  0, nullptr, 0x0028, AUTO, "CPUFirmwareVersion", &stdInterpreter},
2025     {0, AC_WRITE,  0, nullptr, 0x0029, AUTO, "FrameNumber", &stdInterpreter},
2026     {0, AC_WRITE,  0, nullptr, 0x002d, AUTO, "EffectiveLV", &stdInterpreter},
2027     {0, AC_WRITE,  0, nullptr, 0x0032, AUTO, "ImageProcessing", &stdInterpreter},
2028     {0, AC_WRITE,  0, nullptr, 0x0033, AUTO, "PictureMode", &paPictureModeInterpreter2},
2029     {0, AC_WRITE,  0, nullptr, 0x0034, AUTO, "DriveMode", &paDriveModeInterpreter},
2030     {0, AC_WRITE,  0, nullptr, 0x0037, AUTO, "ColorSpace", &paColorSpaceInterpreter},
2031     {0, AC_WRITE,  0, nullptr, 0x0038, AUTO, "ImageAreaOffset", &stdInterpreter},
2032     {0, AC_WRITE,  0, nullptr, 0x0039, AUTO, "RawImageSize", &stdInterpreter},
2033     {0, AC_WRITE,  0, nullptr, 0x003c, AUTO, "AFPointsInFocus", &stdInterpreter},
2034     {0, AC_WRITE,  0, nullptr, 0x003e, AUTO, "PreviewImageBorders", &stdInterpreter},
2035     {0, AC_WRITE,  0, nullptr, 0x003f, AUTO, "LensType", &paLensTypeInterpreter},
2036     {0, AC_WRITE,  0, nullptr, 0x0040, AUTO, "SensitivityAdjust", &stdInterpreter},
2037     {0, AC_WRITE,  0, nullptr, 0x0041, AUTO, "ImageProcessingCount", &stdInterpreter},
2038     {0, AC_WRITE,  0, nullptr, 0x0047, AUTO, "CameraTemperature", &stdInterpreter},
2039     {0, AC_WRITE,  0, nullptr, 0x0048, AUTO, "AELock", &paOnOffInterpreter},
2040     {0, AC_WRITE,  0, nullptr, 0x0049, AUTO, "NoiseReduction", &paOnOffInterpreter},
2041     {0, AC_WRITE,  0, nullptr, 0x004d, AUTO, "FlashExposureComp", &paFlashExposureCompInterpreter},
2042     {0, AC_WRITE,  0, nullptr, 0x004f, AUTO, "ImageTone", &stdInterpreter},
2043     {0, AC_WRITE,  0, nullptr, 0x0050, AUTO, "ColorTemperature", &stdInterpreter},
2044     {0, AC_WRITE,  0, pentaxSRInfoAttribs, 0x005c, AUTO, "ShakeReductionInfo", &stdInterpreter},
2045     {0, AC_WRITE,  0, nullptr, 0x005d, AUTO, "ShutterCount", &stdInterpreter},
2046     {0, AC_WRITE,  0, nullptr, 0x0069, AUTO, "DynamicRangeExpansion", &paOnOffInterpreter},
2047     {0, AC_WRITE,  0, nullptr, 0x0071, AUTO, "HighISONoiseReduction", &paHighISONoiseInterpreter},
2048     {0, AC_WRITE,  0, nullptr, 0x0072, AUTO, "AFAdjustment", &stdInterpreter},
2049     {0, AC_WRITE,  0, nullptr, 0x0073, AUTO, "MonochromeFilterEffect", &paMonochromeFilterEffectInterpreter},
2050     {0, AC_WRITE,  0, nullptr, 0x0074, AUTO, "MonochromeToning", &paMonochromeToningInterpreter},
2051     {0, AC_WRITE,  0, nullptr, 0x0076, AUTO, "FaceDetect", &stdInterpreter},
2052     {0, AC_WRITE,  0, nullptr, 0x0077, AUTO, "FaceDetectFrameSize", &stdInterpreter},
2053     {0, AC_WRITE,  0, nullptr, 0x0079, AUTO, "ShadowCorrection", &paShadowCorrectionInterpreter},
2054     {0, AC_WRITE,  0, nullptr, 0x007a, AUTO, "ISOAutoParameters", &paISOAutoParametersInterpreter},
2055     {0, AC_WRITE,  0, nullptr, 0x007b, AUTO, "CrossProcess", &paCrossProcessInterpreter},
2056     {0, AC_WRITE,  0, pentaxLensCorrAttribs, 0x007d, AUTO, "LensCorr", &stdInterpreter},
2057     {0, AC_WRITE,  0, nullptr, 0x007f, AUTO, "BleachBypassToning", &paBleachBypassToningInterpreter},
2058     {0, AC_WRITE,  0, nullptr, 0x0082, AUTO, "BlurControl", &paBlurControlInterpreter},
2059     {0, AC_WRITE,  0, nullptr, 0x0085, AUTO, "HDR", &paHDRInterpreter},
2060     {0, AC_WRITE,  0, nullptr, 0x0088, AUTO, "NeutralDensityFilter", &paOnOffInterpreter},
2061     {0, AC_WRITE,  0, nullptr, 0x008b, AUTO, "ISO", &stdInterpreter},
2062     {0, AC_WRITE,  0, nullptr, 0x0200, AUTO, "BlackPoint", &stdInterpreter},
2063     {0, AC_WRITE,  0, nullptr, 0x0201, AUTO, "WhitePoint", &stdInterpreter},
2064     {0, AC_WRITE,  0, nullptr, 0x0203, AUTO, "ColorMatrixA", &stdInterpreter},
2065     {0, AC_WRITE,  0, nullptr, 0x0204, AUTO, "ColorMatrixB", &stdInterpreter},
2066     {0, AC_WRITE,  0, pentaxCameraSettingsAttribs, 0x0205, AUTO, "CameraSettings", &stdInterpreter},
2067     {0, AC_WRITE,  0, pentaxAEInfoAttribs, 0x0206, AUTO, "AEInfo", &stdInterpreter},
2068     {0, AC_WRITE,  0, pentaxLensDataAttribs, 0x0207, AUTO, "LensInfo", &stdInterpreter},
2069     {0, AC_WRITE,  0, pentaxFlashInfoAttribs, 0x0208, AUTO, "FlashInfo", &stdInterpreter},
2070     {0, AC_WRITE,  0, nullptr, 0x0209, AUTO, "AEMeteringSegments", &stdInterpreter},
2071     {0, AC_WRITE,  0, nullptr, 0x020a, AUTO, "FlashADump", &stdInterpreter},
2072     {0, AC_WRITE,  0, nullptr, 0x020b, AUTO, "FlashBDump", &stdInterpreter},
2073     {0, AC_WRITE,  0, nullptr, 0x020d, AUTO, "WB_RGGBLevelsDaylight", &stdInterpreter},
2074     {0, AC_WRITE,  0, nullptr, 0x020e, AUTO, "WB_RGGBLevelsShade", &stdInterpreter},
2075     {0, AC_WRITE,  0, nullptr, 0x020f, AUTO, "WB_RGGBLevelsCloudy", &stdInterpreter},
2076     {0, AC_WRITE,  0, nullptr, 0x0210, AUTO, "WB_RGGBLevelsTungsten", &stdInterpreter},
2077     {0, AC_WRITE,  0, nullptr, 0x0211, AUTO, "WB_RGGBLevelsFluorescentD", &stdInterpreter},
2078     {0, AC_WRITE,  0, nullptr, 0x0212, AUTO, "WB_RGGBLevelsFluorescentN", &stdInterpreter},
2079     {0, AC_WRITE,  0, nullptr, 0x0213, AUTO, "WB_RGGBLevelsFluorescentW", &stdInterpreter},
2080     {0, AC_WRITE,  0, nullptr, 0x0214, AUTO, "WB_RGGBLevelsFlash", &stdInterpreter},
2081     {0, AC_WRITE,  0, pentaxCameraInfoAttribs, 0x0215, AUTO, "CameraInfo", &stdInterpreter},
2082     {0, AC_WRITE,  0, pentaxBatteryInfoAttribs, 0x0216, AUTO, "BatteryInfo", &stdInterpreter},
2083     {0, AC_WRITE,  0, nullptr, 0x021f, AUTO, "AFInfo", &stdInterpreter},
2084     {0, AC_WRITE,  0, nullptr, 0x0222, AUTO, "ColorInfo", &stdInterpreter},
2085     {0, AC_WRITE,  0, pentaxLensInfoQAttribs, 0x0239, AUTO, "LensInfoQ", &stdInterpreter},
2086     {0, AC_WRITE,  0, nullptr, 0x03fe, AUTO, "DataDump", &stdInterpreter},
2087     {0, AC_WRITE,  0, nullptr, 0x03ff, AUTO, "UnknownInfo", &stdInterpreter},
2088     {0, AC_WRITE,  0, nullptr, 0x0402, AUTO, "ToneCurve", &stdInterpreter},
2089     {0, AC_WRITE,  0, nullptr, 0x0403, AUTO, "ToneCurves", &stdInterpreter},
2090     {0, AC_WRITE,  0, nullptr, 0x0e00, AUTO, "PrintIM", &stdInterpreter},
2091     { -1, AC_DONTWRITE, 0,  nullptr, 0, AUTO, "", nullptr}
2092 };
2093 
2094 const TagAttrib pentaxSRInfoAttribs[] = {
2095     {0, AC_WRITE, 0, nullptr,  0, AUTO, "SRResult", &paSRResultInterpreter},
2096     {0, AC_WRITE, 0, nullptr,  1, AUTO, "ShakeReduction", &paShakeReductionInterpreter},
2097     {0, AC_WRITE, 0, nullptr,  2, AUTO, "SRHalfPressTime", &stdInterpreter},
2098     {0, AC_WRITE, 0, nullptr,  3, AUTO, "SRFocalLength", &stdInterpreter},
2099     { -1, AC_DONTWRITE, 0,  nullptr, 0, AUTO, "", nullptr}
2100 };
2101 
2102 const TagAttrib pentaxSRInfo2Attribs[] = {
2103     {0, AC_WRITE, 0, nullptr,  0, AUTO, "SRResult", &paSRResultInterpreter},    // assuming it's the same interpreter, but that's not sure
2104     {0, AC_WRITE, 0, nullptr,  1, AUTO, "ShakeReduction", &paShakeReduction2Interpreter},
2105     { -1, AC_DONTWRITE, 0,  nullptr, 0, AUTO, "", nullptr}
2106 };
2107 
2108 const TagAttrib pentaxLensDataAttribs[] = {
2109     {0, AC_WRITE, 0, nullptr, 9,  AUTO, "FocalLength", &paLensDataFocalLengthInterpreter},
2110     {0, AC_WRITE, 0, nullptr, 10, AUTO, "NominalMaxAperture", &paNominalMaxApertureInterpreter},
2111     {0, AC_WRITE, 0, nullptr, 10, AUTO, "NominalMinAperture", &paNominalMinApertureInterpreter},
2112     {0, AC_WRITE, 0, nullptr, 14, AUTO, "MaxAperture", &paMaxApertureInterpreter},
2113     { -1, AC_DONTWRITE, 0,  nullptr, 0, AUTO, "", nullptr}
2114 };
2115 
2116 const TagAttrib pentaxLensInfoQAttribs[] = {
2117     {0, AC_WRITE, 0, nullptr, 12, AUTO, "LensModel", &paLensModelQInterpreter},
2118     {0, AC_WRITE, 0, nullptr, 42, AUTO, "LensInfo", &paLensInfoQInterpreter},
2119     { -1, AC_DONTWRITE, 0,  nullptr, 0, AUTO, "", nullptr}
2120 };
2121 
2122 const TagAttrib pentaxLensCorrAttribs[] = {
2123     {0, AC_WRITE, 0, nullptr, 0, AUTO, "DistortionCorrection", &paOnOffInterpreter},
2124     {0, AC_WRITE, 0, nullptr, 1, AUTO, "ChromaticAberrationCorrection", &paOnOffInterpreter},
2125     {0, AC_WRITE, 0, nullptr, 2, AUTO, "VignettingCorrection", &paOnOffInterpreter},
2126     { -1, AC_DONTWRITE, 0,  nullptr, 0, AUTO, "", nullptr}
2127 };
2128 
2129 const TagAttrib pentaxCameraSettingsAttribs[] = {
2130     {0, AC_WRITE, 0, nullptr,  0, AUTO, "PictureMode2", &paPictureMode2Interpreter},
2131     {0, AC_WRITE, 0, nullptr,  1, AUTO, "ProgramLine", &paProgramLineInterpreter},
2132     {0, AC_WRITE, 0, nullptr,  1, AUTO, "EVSteps", &paEVStepsInterpreter},
2133     {0, AC_WRITE, 0, nullptr,  1, AUTO, "E-DialinProgram", &paEDialinInterpreter},
2134     {0, AC_WRITE, 0, nullptr,  1, AUTO, "ApertureRing", &paApertureRingUseInterpreter},
2135     {0, AC_WRITE, 0, nullptr,  2, AUTO, "FlashOptions", &paFlashOptionInterpreter},
2136     {0, AC_WRITE, 0, nullptr,  2, AUTO, "MeteringMode2", &paMeteringMode2Interpreter},
2137     {0, AC_WRITE, 0, nullptr,  3, AUTO, "AFMode", &paAFModeInterpreter},
2138     {0, AC_WRITE, 0, nullptr,  4, AUTO, "AFPointSelected2", &paAFPointSelectedInterpreter},
2139     {0, AC_WRITE, 0, nullptr,  7, AUTO, "DriveMode2", &paDriveMode2Interpreter},
2140     {0, AC_WRITE, 0, nullptr,  8, AUTO, "ExposureBracketStepSize", &paExposureBracketStepSizeInterpreter},
2141     {0, AC_WRITE, 0, nullptr,  9, AUTO, "BracketShotNumber", &stdInterpreter},
2142     {0, AC_WRITE, 0, nullptr, 10, AUTO, "WhiteBalanceSet", &stdInterpreter},
2143     { -1, AC_DONTWRITE, 0,  nullptr, 0, AUTO, "", nullptr}
2144 };
2145 
2146 const TagAttrib pentaxAEInfoAttribs[] = {
2147     {0, AC_WRITE, 0, nullptr,  0, AUTO, "AEExposureTime", &paExposureTimeInterpreter},
2148     {0, AC_WRITE, 0, nullptr,  1, AUTO, "AEAperture", &paApertureInterpreter},
2149     {0, AC_WRITE, 0, nullptr,  2, AUTO, "AE_ISO", &paISOfInterpreter},
2150     {0, AC_WRITE, 0, nullptr,  3, AUTO, "AEXv", &paAEXvInterpreter},
2151     {0, AC_WRITE, 0, nullptr,  4, SBYTE, "AEBXv", &paAEBXvInterpreter},
2152     {0, AC_WRITE, 0, nullptr,  5, AUTO, "AEMinExposureTime", &paExposureTimeInterpreter},
2153     {0, AC_WRITE, 0, nullptr,  6, AUTO, "AEProgramMode", &paAEProgramModeInterpreter},
2154     {0, AC_WRITE, 0, nullptr,  9, AUTO, "AEMaxAperture", &paApertureInterpreter},
2155     {0, AC_WRITE, 0, nullptr, 10, AUTO, "AEMaxAperture2", &paApertureInterpreter},
2156     {0, AC_WRITE, 0, nullptr, 11, AUTO, "AEMinAperture", &paApertureInterpreter},
2157     {0, AC_WRITE, 0, nullptr, 12, AUTO, "AEMeteringMode", &stdInterpreter},
2158     {0, AC_WRITE, 0, nullptr, 14, SBYTE, "FlashExposureCompSet", &stdInterpreter},
2159     { -1, AC_DONTWRITE, 0,  nullptr, 0, AUTO, "", nullptr}
2160 };
2161 
2162 const TagAttrib pentaxAEInfo2Attribs[] = {
2163     {0, AC_WRITE, 0, nullptr,  2, AUTO, "AEExposureTime", &paExposureTimeInterpreter},
2164     {0, AC_WRITE, 0, nullptr,  3, AUTO, "AEAperture", &paApertureInterpreter},
2165     {0, AC_WRITE, 0, nullptr,  4, AUTO, "AE_ISO", &paISOfInterpreter},
2166     {0, AC_WRITE, 0, nullptr,  5, AUTO, "AEXv", &paAEXvInterpreter},
2167     {0, AC_WRITE, 0, nullptr,  6, SBYTE, "AEBXv", &paAEBXvInterpreter},
2168     {0, AC_WRITE, 0, nullptr,  8, SBYTE, "AEError", &stdInterpreter},
2169 //{0, AC_WRITE, 0, 0, 11, AUTO, "AEApertureSteps", &},
2170     {0, AC_WRITE, 0, nullptr, 15, AUTO, "SceneMode", &paSceneModeInterpreter},
2171     {0, AC_WRITE, 0, nullptr, 16, AUTO, "AEMaxAperture", &paApertureInterpreter},
2172     {0, AC_WRITE, 0, nullptr, 17, AUTO, "AEMaxAperture2", &paApertureInterpreter},
2173     {0, AC_WRITE, 0, nullptr, 18, AUTO, "AEMinAperture", &paApertureInterpreter},
2174     {0, AC_WRITE, 0, nullptr, 19, AUTO, "AEMinExposureTime", &paExposureTimeInterpreter},
2175     { -1, AC_DONTWRITE, 0,  nullptr, 0, AUTO, "", nullptr}
2176 };
2177 
2178 const TagAttrib pentaxAEInfo3Attribs[] = {
2179     {0, AC_WRITE, 0, nullptr, 16, AUTO, "AEExposureTime", &paExposureTimeInterpreter},
2180     {0, AC_WRITE, 0, nullptr, 17, AUTO, "AEAperture", &paApertureInterpreter},
2181     {0, AC_WRITE, 0, nullptr, 18, AUTO, "AE_ISO", &paISOfInterpreter},
2182     {0, AC_WRITE, 0, nullptr, 28, AUTO, "AEMaxAperture", &paApertureInterpreter},
2183     {0, AC_WRITE, 0, nullptr, 29, AUTO, "AEMaxAperture2", &paApertureInterpreter},
2184     {0, AC_WRITE, 0, nullptr, 30, AUTO, "AEMinAperture", &paApertureInterpreter},
2185     {0, AC_WRITE, 0, nullptr, 31, AUTO, "AEMinExposureTime", &paExposureTimeInterpreter},
2186     { -1, AC_DONTWRITE, 0,  nullptr, 0, AUTO, "", nullptr}
2187 };
2188 
2189 const TagAttrib pentaxFlashInfoAttribs[] = {
2190     {0, AC_WRITE, 0, nullptr,  0, AUTO, "FlashStatus", &paFlashStatusInterpreter},
2191     {0, AC_WRITE, 0, nullptr,  1, AUTO, "InternalFlashMode", &paInternalFlashModeInterpreter},
2192     {0, AC_WRITE, 0, nullptr,  2, AUTO, "ExternalFlashMode", &paExternalFlashModeInterpreter},
2193     {0, AC_WRITE, 0, nullptr,  3, AUTO, "InternalFlashStrength", &stdInterpreter},
2194     {0, AC_WRITE, 0, nullptr, 24, AUTO, "ExternalFlashGuideNumber", &paExternalFlashGNInterpreter},
2195     {0, AC_WRITE, 0, nullptr, 25, AUTO, "ExternalFlashExposureComp", &paExternalFlashExposureCompInterpreter},
2196     {0, AC_WRITE, 0, nullptr, 26, AUTO, "ExternalFlashBounce", &paExternalFlashBounceInterpreter},
2197     { -1, AC_DONTWRITE, 0,  nullptr, 0, AUTO, "", nullptr}
2198 };
2199 
2200 const TagAttrib pentaxBatteryInfoAttribs[] = {
2201     {0, AC_WRITE, 0, nullptr,  0, AUTO, "PowerSource", &paPowerSourceInterpreter},
2202     {0, AC_WRITE, 0, nullptr,  1, AUTO, "BatteryStates", &stdInterpreter},
2203     {0, AC_WRITE, 0, nullptr,  2, AUTO, "BatteryADBodyNoLoad", &stdInterpreter},
2204     {0, AC_WRITE, 0, nullptr,  3, AUTO, "BatteryADBodyLoad", &stdInterpreter},
2205     {0, AC_WRITE, 0, nullptr,  4, AUTO, "BatteryADGripNoLoad", &stdInterpreter},
2206     {0, AC_WRITE, 0, nullptr,  5, AUTO, "BatteryADGripLoad", &stdInterpreter},
2207     { -1, AC_DONTWRITE, 0,  nullptr, 0, AUTO, "", nullptr}
2208 };
2209 
2210 const TagAttrib pentaxCameraInfoAttribs[] = {
2211     {0, AC_WRITE, 0, nullptr,  0, AUTO, "PentaxModelID", &stdInterpreter},
2212     {0, AC_WRITE, 0, nullptr,  1, AUTO, "ManufactureDate", &stdInterpreter},
2213     {0, AC_WRITE, 0, nullptr,  2, AUTO, "ProductionCode", &stdInterpreter},
2214     {0, AC_WRITE, 0, nullptr,  4, AUTO, "InternalSerialNumber", &stdInterpreter},
2215     { -1, AC_DONTWRITE, 0,  nullptr, 0, AUTO, "", nullptr}
2216 };
2217 
2218 }
2219 #endif
2220 
2221 
2222 
2223 
2224