diff --git a/rtexif/pentaxattribs.cc b/rtexif/pentaxattribs.cc index 0844dc1b5..d7a3c7d1e 100644 --- a/rtexif/pentaxattribs.cc +++ b/rtexif/pentaxattribs.cc @@ -70,6 +70,15 @@ class PAPictureModeInterpreter : public ChoiceInterpreter { choices[17] = "Fireworks"; choices[18] = "Text"; choices[19] = "Panorama"; + choices[20] = "3-D"; + choices[21] = "Black & White"; + choices[22] = "Sepia"; + choices[23] = "Red"; + choices[24] = "Pink"; + choices[25] = "Purple"; + choices[26] = "Blue"; + choices[27] = "Green"; + choices[28] = "Yellow"; choices[30] = "Self Portrait"; choices[31] = "Illustrations"; choices[33] = "Digital Filter"; @@ -90,6 +99,8 @@ class PAPictureModeInterpreter : public ChoiceInterpreter { choices[60] = "Kids"; choices[61] = "Blur Reduction"; choices[65] = "Half-length Portrait"; + choices[221] = "P"; + choices[255] = "PICT"; } }; PAPictureModeInterpreter paPictureModeInterpreter; @@ -212,11 +223,21 @@ class PAISOInterpreter : public ChoiceInterpreter { choices[400] = "400"; choices[800] = "800"; choices[1600] = "1600"; - choices[3200] = "320"; + choices[3200] = "3200"; } }; PAISOInterpreter paISOInterpreter; +class PAFNumberInterpreter: public Interpreter { +public: + PAFNumberInterpreter () {} + virtual std::string toString (Tag* t) { + sprintf (buffer, "%0.1f", t->toDouble()/10); + return buffer; + } +}; +PAFNumberInterpreter paFNumberInterpreter; + class PAMeteringModeInterpreter : public ChoiceInterpreter { public: PAMeteringModeInterpreter () { @@ -307,190 +328,678 @@ class PASharpnessInterpreter : public ChoiceInterpreter { }; PASharpnessInterpreter paSharpnessInterpreter; -class PALensTypeInterpreter : public ChoiceInterpreter { +class PAPictureModeInterpreter2: public ChoiceInterpreter { +public: + PAPictureModeInterpreter2(){ + choices[ 0] = "Program"; + choices[ 1] = "Hi-speed Program"; + choices[ 2] = "DOF Program"; + choices[ 3] = "MTF Program"; + choices[ 4] = "Standard"; + choices[ 5] = "Portrait"; + choices[ 6] = "Landscape"; + choices[ 7] = "Macro"; + choices[ 8] = "Sport "; + choices[ 9] = "Night Scene Portrait "; + choices[10] = "No Flash"; + choices[11] = "Night Scene"; + choices[12] = "Surf & Snow"; + choices[13] = "Text"; + choices[14] = "Sunset"; + choices[15] = "Kids"; + choices[16] = "Pet"; + choices[17] = "Candlelight"; + choices[18] = "Museum"; + choices[19] = "Food "; + choices[20] = "Stage Lighting"; + choices[21] = "Night Snap"; + choices[256+4] = "Auto PICT"; + choices[256+5] = "Auto PICT (Portrait)"; + choices[256+6] = "Auto PICT (Landscape)"; + choices[256+7] = "Auto PICT (Macro)"; + choices[256+8] = "Auto PICT (Sport)"; + choices[256+8] = "Auto PICT (Sport)"; + choices[512+0] = "Program (HyP)"; + choices[512+1] = "Hi-speed Program (HyP)"; + choices[512+2] = "DOF Program (HyP)"; + choices[512+3] = "MTF Program (HyP)"; + choices[3*256] = "Green Mode"; + choices[4*256] = "Shutter Speed Priority"; + choices[5*256] = "Aperture Priority"; + choices[6*256] = "Program Tv Shift"; + choices[7*256] = "Program Av Shift"; + choices[8*256] = "Manual"; + choices[9*256] = "Bulb"; + choices[10*256] = "Aperture Priority, Off-Auto-Aperture"; + choices[11*256] = "Manual, Off-Auto-Aperture"; + choices[12*256] = "Bulb, Off-Auto-Aperture"; + choices[13*256] = "Shutter & Aperture Priority AE"; + choices[15*256] = "Sensitivity Priority AE"; + choices[16*256] = "Flash X-Sync Speed AE"; + } + virtual std::string toString (Tag* t) { + int c = 256*t->toInt(0,BYTE) + t->toInt(1,BYTE); + std::map::iterator r = choices.find (c); + if (r!=choices.end()){ + std::ostringstream s; + s << r->second; + if( t->toInt(1,BYTE)==0 ) + s << "\n1/2 EV steps"; + else + s << "\n1/3 EV steps"; + return s.str(); + }else { + t->toString (buffer); + return std::string (buffer); + } + } +}; +PAPictureModeInterpreter2 paPictureModeInterpreter2; + +class PADriveModeInterpreter : public ChoiceInterpreter{ + std::map choices1; + std::map choices2; + std::map choices3; +public: + PADriveModeInterpreter(){ + choices[0] = "Single-frame"; + choices[1] = "Continuous"; + choices[2] = "Continuous (Hi)"; + choices[3] = "Burst"; + choices[255] = "Video"; + choices1[0] = "No Timer"; + choices1[1] = "Self-timer (12 s)"; + choices1[2] = "Self-timer (2 s)"; + choices1[255] = "n/a"; + choices2[0] = "Shutter Button"; + choices2[1] = "Remote Control (3 s delay)"; + choices2[2] = "Remote Control"; + choices3[0] = "Single Exposure"; + choices3[1] = "Multiple Exposure"; + choices3[255] = "Video"; + } + virtual std::string toString (Tag* t) { + std::map::iterator r = choices.find (t->toInt(0,BYTE)); + std::map::iterator r1 = choices1.find (t->toInt(1,BYTE)); + std::map::iterator r2 = choices2.find (t->toInt(2,BYTE)); + std::map::iterator r3 = choices3.find (t->toInt(3,BYTE)); + std::ostringstream s; + s << ((r !=choices.end())? r->second : ""); + s << ((r1!=choices1.end())? r1->second : "")<<" "; + s << ((r2!=choices2.end())? r2->second : "")<<" "; + s << ((r3!=choices3.end())? r3->second : "")<<" "; + return s.str(); + } +}; +PADriveModeInterpreter paDriveModeInterpreter; + +class PAColorSpaceInterpreter: public ChoiceInterpreter{ +public: + PAColorSpaceInterpreter(){ + choices[0] = "sRGB"; + choices[1] = "Adobe RGB"; + } +}; +PAColorSpaceInterpreter paColorSpaceInterpreter; + +class PALensTypeInterpreter : public IntLensInterpreter< int > { public: PALensTypeInterpreter () { - choices[256*0+ 0] = "M-42 or No Lens"; - choices[256*1+ 0] = "K,M Lens"; - choices[256*2+ 0] = "A Series Lens"; - choices[256*3+ 0] = "SIGMA"; - choices[256*3+ 17] = "smc PENTAX-FA SOFT 85mm F2.8"; - choices[256*3+ 18] = "smc PENTAX-F 1.7X AF ADAPTER"; - choices[256*3+ 19] = "smc PENTAX-F 24-50mm F4"; - choices[256*3+ 20] = "smc PENTAX-F 35-80mm F4-5.6"; - choices[256*3+ 21] = "smc PENTAX-F 80-200mm F4.7-5.6"; - choices[256*3+ 22] = "smc PENTAX-F FISH-EYE 17-28mm F3.5-4.5"; - choices[256*3+ 23] = "smc PENTAX-F 100-300mm F4.5-5.6"; - choices[256*3+ 24] = "smc PENTAX-F 35-135mm F3.5-4.5"; - choices[256*3+ 25] = "smc PENTAX-F 35-105mm F4-5.6 or SIGMA or Tokina"; - choices[256*3+ 26] = "smc PENTAX-F* 250-600mm F5.6 ED[IF]"; - choices[256*3+ 27] = "smc PENTAX-F 28-80mm F3.5-4.5"; - choices[256*3+ 28] = "smc PENTAX-F 35-70mm F3.5-4.5"; - choices[256*3+ 29] = "PENTAX-F 28-80mm F3.5-4.5 or SIGMA AF 18-125mm F3.5-5.6 DC"; - choices[256*3+ 30] = "PENTAX-F 70-200mm F4-5.6"; - choices[256*3+ 31] = "smc PENTAX-F 70-210mm F4-5.6"; - choices[256*3+ 32] = "smc PENTAX-F 50mm F1.4"; - choices[256*3+ 33] = "smc PENTAX-F 50mm F1.7"; - choices[256*3+ 34] = "smc PENTAX-F 135mm F2.8 [IF]"; - choices[256*3+ 35] = "smc PENTAX-F 28mm F2.8"; - choices[256*3+ 36] = "SIGMA 20mm F1.8 EX DG ASPHERICAL RF"; - choices[256*3+ 38] = "smc PENTAX-F* 300mm F4.5 ED[IF]"; - choices[256*3+ 39] = "smc PENTAX-F* 600mm F4 ED[IF]"; - choices[256*3+ 40] = "smc PENTAX-F MACRO 100mm F2.8"; - choices[256*3+ 41] = "smc PENTAX-F MACRO 50mm F2.8 or Sigma 50mm F2,8 MACRO"; - choices[256*3+ 44] = "Tamron 35-90mm F4 AF or various SIGMA models"; - choices[256*3+ 46] = "SIGMA APO 70-200mm F2.8 EX"; - choices[256*3+ 50] = "smc PENTAX-FA 28-70 F4 AL"; - choices[256*3+ 51] = "SIGMA 28mm F1.8 EX DG ASPHERICAL MACRO"; - choices[256*3+ 52] = "smc PENTAX-FA 28-200mm F3.8-5.6 AL[IF]"; - choices[256*3+ 53] = "smc PENTAX-FA 28-80mm F3.5-5.6 AL"; - choices[256*3+ 247] = "smc PENTAX-DA FISH-EYE 10-17mm F3.5-4.5 ED[IF]"; - choices[256*3+ 248] = "smc PENTAX-DA 12-24mm F4 ED AL[IF]"; - choices[256*3+ 250] = "smc PENTAX-DA 50-200mm F4-5.6 ED"; - choices[256*3+ 251] = "smc PENTAX-DA 40mm F2.8 Limited"; - choices[256*3+ 252] = "smc PENTAX-DA 18-55mm F3.5-5.6 AL"; - choices[256*3+ 253] = "smc PENTAX-DA 14mm F2.8 ED[IF]"; - choices[256*3+ 254] = "smc PENTAX-DA 16-45mm F4 ED AL"; - choices[256*3+ 255] = "SIGMA"; - choices[256*4+ 1] = "smc PENTAX-FA SOFT 28mm F2.8"; - choices[256*4+ 2] = "smc PENTAX-FA 80-320mm F4.5-5.6"; - choices[256*4+ 3] = "smc PENTAX-FA 43mm F1.9 Limited"; - choices[256*4+ 6] = "smc PENTAX-FA 35-80mm F4-5.6"; - choices[256*4+ 12] = "smc PENTAX-FA 50mm F1.4"; - choices[256*4+ 15] = "smc PENTAX-FA 28-105mm F4-5.6 [IF]"; - choices[256*4+ 16] = "TAMRON AF 80-210mm F4-5.6 (178D)"; - choices[256*4+ 19] = "TAMRON SP AF 90mm F2.8 (172E)"; - choices[256*4+ 20] = "smc PENTAX-FA 28-80mm F3.5-5.6"; - choices[256*4+ 21] = "Cosina AF 100-300mm F5.6-6.7"; - choices[256*4+ 22] = "TOKINA 28-80mm F3.5-5.6"; - choices[256*4+ 23] = "smc PENTAX-FA 20-35mm F4 AL"; - choices[256*4+ 24] = "smc PENTAX-FA 77mm F1.8 Limited"; - choices[256*4+ 25] = "TAMRON SP AF 14mm F2.8"; - choices[256*4+ 26] = "smc PENTAX-FA MACRO 100mm F3.5"; - choices[256*4+ 27] = "TAMRON AF28-300mm F/3.5-6.3 LD Aspherical[IF] MACRO (285D)"; - choices[256*4+ 28] = "smc PENTAX-FA 35mm F2 AL"; - choices[256*4+ 29] = "TAMRON AF 28-200mm F/3.8-5.6 LD Super II MACRO (371D)"; - choices[256*4+ 34] = "smc PENTAX-FA 24-90mm F3.5-4.5 AL[IF]"; - choices[256*4+ 35] = "smc PENTAX-FA 100-300mm F4.7-5.8"; - choices[256*4+ 36] = "TAMRON AF70-300mm F/4-5.6 LD MACRO"; - choices[256*4+ 37] = "TAMRON SP AF 24-135mm F3.5-5.6 AD AL (190D)"; - choices[256*4+ 38] = "smc PENTAX-FA 28-105mm F3.2-4.5 AL[IF]"; - choices[256*4+ 39] = "smc PENTAX-FA 31mm F1.8AL Limited"; - choices[256*4+ 41] = "TAMRON AF 28-200mm Super Zoom F3.8-5.6 Aspherical XR [IF] MACRO (A03)"; - choices[256*4+ 43] = "smc PENTAX-FA 28-90mm F3.5-5.6"; - choices[256*4+ 44] = "smc PENTAX-FA J 75-300mm F4.5-5.8 AL"; - choices[256*4+ 45] = "TAMRON 28-300mm F3.5-6.3 Ultra zoom XR"; - choices[256*4+ 46] = "smc PENTAX-FA J 28-80mm F3.5-5.6 AL"; - choices[256*4+ 47] = "smc PENTAX-FA J 18-35mm F4-5.6 AL"; - choices[256*4+ 49] = "TAMRON SP AF 28-75mm F2.8 XR Di (A09)"; - choices[256*4+ 51] = "smc PENTAX-D FA 50mm F2.8 MACRO"; - choices[256*4+ 52] = "smc PENTAX-D FA 100mm F2.8 MACRO"; - choices[256*4+ 75] = "TAMRON SP AF 70-200 F2.8 Di LD [IF] Macro (A001)"; - choices[256*4+ 229] = "smc PENTAX-DA 18-55mm F3.5-5.6 AL II"; - choices[256*4+ 230] = "TAMRON SP AF 17-50mm F2.8 XR Di II"; - choices[256*4+ 231] = "smc PENTAX-DA 18-250mm F3.5-6.3 ED AL [IF]"; - choices[256*4+ 237] = "Samsung/Schneider D-XENOGON 10-17mm F3.5-4.5"; - choices[256*4+ 239] = "Samsung D-XENON 12-24mm F4 ED AL [IF]"; - choices[256*4+ 243] = "smc PENTAX-DA 70mm F2.4 Limited"; - choices[256*4+ 244] = "smc PENTAX-DA 21mm F3.2 AL Limited"; - choices[256*4+ 245] = "Schneider D-XENON 50-200mm"; - choices[256*4+ 246] = "Schneider D-XENON 18-55mm"; - choices[256*4+ 247] = "smc PENTAX-DA 10-17mm F3.5-4.5 ED [IF] Fisheye zoom"; - choices[256*4+ 248] = "smc PENTAX-DA 12-24mm F4 ED AL [IF]"; - choices[256*4+ 249] = "TAMRON XR DiII 18-200mm F3.5-6.3 (A14)"; - choices[256*4+ 250] = "smc PENTAX-DA 50-200mm F4-5.6 ED"; - choices[256*4+ 251] = "smc PENTAX-DA 40mm F2.8 Limited"; - choices[256*4+ 252] = "smc PENTAX-DA 18-55mm F3.5-5.6 AL"; - choices[256*4+ 253] = "smc PENTAX-DA 14mm F2.8 ED[IF]"; - choices[256*4+ 254] = "smc PENTAX-DA 16-45mm F4 ED AL"; - choices[256*5+ 1] = "smc PENTAX-FA* 24mm F2 AL[IF]"; - choices[256*5+ 2] = "smc PENTAX-FA 28mm F2.8 AL"; - choices[256*5+ 3] = "smc PENTAX-FA 50mm F1.7"; - choices[256*5+ 4] = "smc PENTAX-FA 50mm F1.4"; - choices[256*5+ 5] = "smc PENTAX-FA* 600mm F4 ED[IF]"; - choices[256*5+ 6] = "smc PENTAX-FA* 300mm F4.5 ED[IF]"; - choices[256*5+ 7] = "smc PENTAX-FA 135mm F2.8 [IF]"; - choices[256*5+ 8] = "smc PENTAX-FA MACRO 50mm F2.8"; - choices[256*5+ 9] = "smc PENTAX-FA MACRO 100mm F2.8"; - choices[256*5+ 10] = "smc PENTAX-FA* 85mm F1.4 [IF]"; - choices[256*5+ 11] = "smc PENTAX-FA* 200mm F2.8 ED[IF]"; - choices[256*5+ 12] = "smc PENTAX-FA 28-80mm F3.5-4.7"; - choices[256*5+ 13] = "smc PENTAX-FA 70-200mm F4-5.6"; - choices[256*5+ 14] = "smc PENTAX-FA* 250-600mm F5.6 ED[IF]"; - choices[256*5+ 15] = "smc PENTAX-FA 28-105mm F4-5.6"; - choices[256*5+ 16] = "smc PENTAX-FA 100-300mm F4.5-5.6"; - choices[256*5+ 98] = "smc PENTAX-FA 100-300mm F4.5-5.6"; - choices[256*6+ 1] = "smc PENTAX-FA* 85mm F1.4 [IF]"; - choices[256*6+ 2] = "smc PENTAX-FA* 200mm F2.8 ED[IF]"; - choices[256*6+ 3] = "smc PENTAX-FA* 300mm F2.8 ED[IF]"; - choices[256*6+ 4] = "smc PENTAX-FA* 28-70mm F2.8 AL"; - choices[256*6+ 5] = "smc PENTAX-FA* 80-200mm F2.8 ED[IF]"; - choices[256*6+ 6] = "smc PENTAX-FA* 28-70mm F2.8 AL"; - choices[256*6+ 7] = "smc PENTAX-FA* 80-200mm F2.8 ED[IF]"; - choices[256*6+ 8] = "smc PENTAX-FA 28-70mm F4AL"; - choices[256*6+ 9] = "smc PENTAX-FA 20mm F2.8"; - choices[256*6+ 10] = "smc PENTAX-FA* 400mm F5.6 ED[IF]"; - choices[256*6+ 13] = "smc PENTAX-FA* 400mm F5.6 ED[IF]"; - choices[256*6+ 14] = "smc PENTAX-FA* MACRO 200mm F4 ED[IF]"; - choices[256*7+ 0] = "smc PENTAX-DA 21mm F3.2 AL Limited"; - choices[256*7+ 75] = "TAMRON SP AF 70-200mm F2.8 Di LD [IF] Macro (A001)"; - choices[256*7+ 217] = "smc PENTAX-DA 50-200mm F4-5.6 ED WR"; - choices[256*7+ 218] = "smc PENTAX-DA 18-55mm F3.5-5.6 AL WR"; - choices[256*7+ 220] = "TAMRON SP AF 10-24mm F3.5-4.5 Di II LD Aspherical [IF]"; - choices[256*7+ 222] = "smc PENTAX-DA 18-55mm F3.5-5.6 AL II"; - choices[256*7+ 223] = "Samsung D-XENON 18-55mm F3.5-5.6 II"; - choices[256*7+ 224] = "smc PENTAX-DA 15mm F4 ED AL Limited"; - choices[256*7+ 225] = "Samsung D-XENON 18-250mm F3.5-6.3"; - choices[256*7+ 229] = "smc PENTAX-DA 18-55mm F3.5-5.6 AL II"; - choices[256*7+ 230] = "TAMRON AF 17-50mm F2.8 XR Di-II LD (Model A16)"; - choices[256*7+ 231] = "smc PENTAX-DA 18-250mm F3.5-6.3 ED AL [IF]"; - choices[256*7+ 233] = "smc PENTAX-DA 35mm F2.8 Macro Limited"; - choices[256*7+ 234] = "smc PENTAX-DA* 300mm F4 ED [IF] SDM (SDM unused)"; - choices[256*7+ 235] = "smc PENTAX-DA* 200mm F2.8 ED [IF] SDM (SDM unused)"; - choices[256*7+ 236] = "smc PENTAX-DA 55-300mm F4-5.8 ED"; - choices[256*7+ 238] = "TAMRON AF 18-250mm F3.5-6.3 Di II LD Aspherical [IF] MACRO"; - choices[256*7+ 241] = "smc PENTAX-DA* 50-135mm F2.8 ED [IF] SDM (SDM unused)"; - choices[256*7+ 242] = "smc PENTAX-DA* 16-50mm F2.8 ED AL [IF] SDM (SDM unused)"; - choices[256*7+ 243] = "smc PENTAX-DA 70mm F2.4 Limited"; - choices[256*7+ 244] = "smc PENTAX-DA 21mm F3.2 AL Limited"; - choices[256*8+ 226] = "smc PENTAX-DA* 55mm F1.4 SDM"; - choices[256*8+ 227] = "smc PENTAX DA* 60-250mm F4 [IF] SDM"; - choices[256*8+ 232] = "smc PENTAX-DA 17-70mm F4 AL [IF] SDM"; - choices[256*8+ 234] = "smc PENTAX-DA* 300mm F4 ED [IF] SDM"; - choices[256*8+ 235] = "smc PENTAX-DA* 200mm F2.8 ED [IF] SDM"; - choices[256*8+ 241] = "smc PENTAX-DA* 50-135mm F2.8 ED [IF] SDM"; - choices[256*8+ 242] = "smc PENTAX-DA* 16-50mm F2.8 ED AL [IF] SDM"; - choices[256*8+ 255] = "Sigma 70-200mm F2.8 EX DG Macro HSM II or 150-500mm F5-6.3 DG OS"; + choices.insert(p_t( 0,"M-42 or No Lens")); + choices.insert(p_t(256*1, "K,M Lens")); + choices.insert(p_t(256*2, "A Series Lens")); + choices.insert(p_t(256*3+ 0, "Sigma Lens")); + choices.insert(p_t(256*3+ 17, "smc PENTAX-FA SOFT 85mm f/2.8")); + choices.insert(p_t(256*3+ 18, "smc PENTAX-F 1.7X AF ADAPTER")); + choices.insert(p_t(256*3+ 19, "smc PENTAX-F 24-50mm f/4")); + choices.insert(p_t(256*3+ 20, "smc PENTAX-F 35-80mm f/4-5.6")); + choices.insert(p_t(256*3+ 21, "smc PENTAX-F 80-200mm f/4.7-5.6")); + choices.insert(p_t(256*3+ 22, "smc PENTAX-F FISH-EYE 17-28mm f/3.5-4.5")); + choices.insert(p_t(256*3+ 23, "smc PENTAX-F 100-300mm f/4.5-5.6")); + choices.insert(p_t(256*3+ 23, "Sigma AF 28-300mm f/3.5-5.6 DL IF")); + choices.insert(p_t(256*3+ 23, "Sigma AF 28-300mm f/3.5-6.3 DG IF Macro")); + choices.insert(p_t(256*3+ 24, "smc PENTAX-F 35-135mm f/3.5-4.5")); + choices.insert(p_t(256*3+ 25, "smc PENTAX-F 35-105mm f/4-5.6")); + choices.insert(p_t(256*3+ 25, "Sigma AF 28-300mm f/3.5-5.6 DL IF")); + choices.insert(p_t(256*3+ 25, "Sigma 55-200mm f/4-5.6 DC")); + choices.insert(p_t(256*3+ 25, "Sigma AF 28-300mm f/3.5-5.6 DL IF")); + choices.insert(p_t(256*3+ 25, "Sigma AF 28-300mm f/3.5-6.3 DG IF Macro")); + choices.insert(p_t(256*3+ 25, "Tokina 80-200mm f/2.8 ATX-Pro")); + choices.insert(p_t(256*3+ 26, "smc PENTAX-F* 250-600mm f/5.6 ED[IF]")); + choices.insert(p_t(256*3+ 27, "smc PENTAX-F 28-80mm f/3.5-4.5")); + choices.insert(p_t(256*3+ 27, "Tokina AT-X PRO AF 28-70mm f/2.6-2.8")); + choices.insert(p_t(256*3+ 28, "smc PENTAX-F 35-70mm f/3.5-4.5")); + choices.insert(p_t(256*3+ 28, "Tokina 19-35mm f/3.5-4.5 AF")); + choices.insert(p_t(256*3+ 29, "PENTAX-F 28-80mm f/3.5-4.5")); + choices.insert(p_t(256*3+ 29, "Sigma AF 18-125mm f/3.5-5.6 DC")); + choices.insert(p_t(256*3+ 29, "Tokina AT-X PRO 28-70mm f/2.6-2.8")); + choices.insert(p_t(256*3+ 30, "PENTAX-F 70-200mm f/4-5.6")); + choices.insert(p_t(256*3+ 31, "smc PENTAX-F 70-210mm f/4-5.6")); + choices.insert(p_t(256*3+ 31, "Tokina AF 730 75-300mm f/4.5-5.6")); + choices.insert(p_t(256*3+ 31, "Takumar-F 70-210mm f/4-5.6")); + choices.insert(p_t(256*3+ 32, "smc PENTAX-F 50mm f/1.4")); + choices.insert(p_t(256*3+ 33, "smc PENTAX-F 50mm f/1.7")); + choices.insert(p_t(256*3+ 34, "smc PENTAX-F 135mm f/2.8 [IF]")); + choices.insert(p_t(256*3+ 35, "smc PENTAX-F 28mm f/2.8")); + choices.insert(p_t(256*3+ 36, "Sigma 20mm f/1.8 EX DG ASPHERICAL RF")); + choices.insert(p_t(256*3+ 38, "smc PENTAX-F* 300mm f/4.5 ED[IF]")); + choices.insert(p_t(256*3+ 39, "smc PENTAX-F* 600mm f/4 ED[IF]")); + choices.insert(p_t(256*3+ 40, "smc PENTAX-F MACRO 100mm f/2.8")); + choices.insert(p_t(256*3+ 41, "smc PENTAX-F MACRO 50mm f/2.8")); + choices.insert(p_t(256*3+ 41, "Sigma 50mm f/2.8 Macro")); + choices.insert(p_t(256*3+ 44, "Sigma AF 10-20mm f/4-5.6 EX DC")); + choices.insert(p_t(256*3+ 44, "Sigma 12-24mm f/4.5 EX DG")); + choices.insert(p_t(256*3+ 44, "Sigma 17-70mm f/2.8-4.5 DC Macro")); + choices.insert(p_t(256*3+ 44, "Sigma 18-50mm f/3.5-5.6 DC")); + choices.insert(p_t(256*3+ 44, "Tamron 35-90mm f/4 AF")); + choices.insert(p_t(256*3+ 46, "Sigma APO 70-200mm f/2.8 EX")); + choices.insert(p_t(256*3+ 46, "Sigma EX APO 100-300mm f/4 IF")); + choices.insert(p_t(256*3+ 50, "smc PENTAX-FA 28-70 f/4 AL")); + choices.insert(p_t(256*3+ 51, "Sigma 28mm f/1.8 EX DG ASPHERICAL MACRO")); + choices.insert(p_t(256*3+ 52, "smc PENTAX-FA 28-200mm f/3.8-5.6 AL[IF]")); + choices.insert(p_t(256*3+ 52, "Tamron AF LD 28-200mm f/3.8-5.6 [IF] Aspherical (171D)")); + choices.insert(p_t(256*3+ 53, "smc PENTAX-FA 28-80mm f/3.5-5.6 AL")); + choices.insert(p_t(256*3+ 247,"smc PENTAX-DA FISH-EYE 10-17mm f/3.5-4.5 ED[IF]")); + choices.insert(p_t(256*3+ 248,"smc PENTAX-DA 12-24mm f/4 ED AL[IF]")); + choices.insert(p_t(256*3+ 250,"smc PENTAX-DA 50-200mm f/4-5.6 ED")); + choices.insert(p_t(256*3+ 251,"smc PENTAX-DA 40mm f/2.8 Limited")); + choices.insert(p_t(256*3+ 252,"smc PENTAX-DA 18-55mm f/3.5-5.6 AL")); + choices.insert(p_t(256*3+ 253,"smc PENTAX-DA 14mm f/2.8 ED[IF]")); + choices.insert(p_t(256*3+ 254,"smc PENTAX-DA 16-45mm f/4 ED AL")); + choices.insert(p_t(256*3+ 255, "Sigma 18-200mm f/3.5-6.3 DC")); + choices.insert(p_t(256*3+ 255, "Sigma DL-II 35-80mm f/4-5.6")); + choices.insert(p_t(256*3+ 255, "Sigma DL Zoom 75-300mm f/4-5.6")); + choices.insert(p_t(256*3+ 255, "Sigma DF EX Aspherical 28-70mm f/2.8")); + choices.insert(p_t(256*3+ 255, "Sigma AF Tele 400mm f/5.6 Multi-coated")); + choices.insert(p_t(256*3+ 255, "Sigma 24-60mm f/2.8 EX DG")); + choices.insert(p_t(256*3+ 255, "Sigma 70-300mm f/4-5.6 Macro")); + choices.insert(p_t(256*3+ 255, "Sigma 55-200mm f/4-5.6 DC")); + choices.insert(p_t(256*3+ 255, "Sigma 18-50mm f/2.8 EX DC")); + choices.insert(p_t(256*4+ 1, "smc PENTAX-FA SOFT 28mm f/2.8")); + choices.insert(p_t(256*4+ 2, "smc PENTAX-FA 80-320mm f/4.5-5.6")); + choices.insert(p_t(256*4+ 3, "smc PENTAX-FA 43mm f/1.9 Limited")); + choices.insert(p_t(256*4+ 6, "smc PENTAX-FA 35-80mm f/4-5.6")); + choices.insert(p_t(256*4+ 12, "smc PENTAX-FA 50mm f/1.4")); + choices.insert(p_t(256*4+ 15, "smc PENTAX-FA 28-105mm f/4-5.6 [IF]")); + choices.insert(p_t(256*4+ 16, "Tamron AF 80-210mm f/4-5.6 (178D)")); + choices.insert(p_t(256*4+ 19, "Tamron SP AF 90mm f/2.8 (172E)")); + choices.insert(p_t(256*4+ 20, "smc PENTAX-FA 28-80mm f/3.5-5.6")); + choices.insert(p_t(256*4+ 21, "Cosina AF 100-300mm f/5.6-6.7")); + choices.insert(p_t(256*4+ 22, "TOKINA 28-80mm f/3.5-5.6")); + choices.insert(p_t(256*4+ 23, "smc PENTAX-FA 20-35mm f/4 AL")); + choices.insert(p_t(256*4+ 24, "smc PENTAX-FA 77mm f/1.8 Limited")); + choices.insert(p_t(256*4+ 25, "Tamron SP AF 14mm f/2.8")); + choices.insert(p_t(256*4+ 26, "smc PENTAX-FA MACRO 100mm f/3.5")); + choices.insert(p_t(256*4+ 26, "Cosina 100mm f/3.5 Macro")); + choices.insert(p_t(256*4+ 27, "Tamron AF 28-300mm f/3.5-6.3 LD Aspherical[IF] MACRO (285D)")); + choices.insert(p_t(256*4+ 28, "smc PENTAX-FA 35mm f/2 AL")); + choices.insert(p_t(256*4+ 29, "Tamron AF 28-200mm f/3.8-5.6 LD Super II MACRO (371D)")); + choices.insert(p_t(256*4+ 34, "smc PENTAX-FA 24-90mm f/3.5-4.5 AL[IF]")); + choices.insert(p_t(256*4+ 35, "smc PENTAX-FA 100-300mm f/4.7-5.8")); + choices.insert(p_t(256*4+ 36, "Tamron AF 70-300mm f/4-5.6 LD MACRO")); + choices.insert(p_t(256*4+ 37, "Tamron SP AF 24-135mm f/3.5-5.6 AD AL (190D)")); + choices.insert(p_t(256*4+ 38, "smc PENTAX-FA 28-105mm f/3.2-4.5 AL[IF]")); + choices.insert(p_t(256*4+ 39, "smc PENTAX-FA 31mm f/1.8 AL Limited")); + choices.insert(p_t(256*4+ 41, "Tamron AF 28-200mm Super Zoom f/3.8-5.6 Aspherical XR [IF] MACRO (A03)")); + choices.insert(p_t(256*4+ 43, "smc PENTAX-FA 28-90mm f/3.5-5.6")); + choices.insert(p_t(256*4+ 44, "smc PENTAX-FA J 75-300mm f/4.5-5.8 AL")); + choices.insert(p_t(256*4+ 45, "Tamron 28-300mm f/3.5-6.3 Ultra zoom XR")); + choices.insert(p_t(256*4+ 45, "Tamron AF 28-300mm f/3.5-6.3 XR Di LD Aspherical [IF] Macro")); + choices.insert(p_t(256*4+ 46, "smc PENTAX-FA J 28-80mm f/3.5-5.6 AL")); + choices.insert(p_t(256*4+ 47, "smc PENTAX-FA J 18-35mm f/4-5.6 AL")); + choices.insert(p_t(256*4+ 49, "Tamron SP AF 28-75mm f/2.8 XR Di (A09)")); + choices.insert(p_t(256*4+ 51, "smc PENTAX-D FA 50mm f/2.8 MACRO")); + choices.insert(p_t(256*4+ 52, "smc PENTAX-D FA 100mm f/2.8 MACRO")); + choices.insert(p_t(256*4+ 75, "Tamron SP AF 70-200 f/2.8 Di LD [IF] Macro (A001)")); + choices.insert(p_t(256*4+ 229, "smc PENTAX-DA 18-55mm f/3.5-5.6 AL II")); + choices.insert(p_t(256*4+ 230, "Tamron SP AF 17-50mm f/2.8 XR Di II")); + choices.insert(p_t(256*4+ 231, "smc PENTAX-DA 18-250mm f/3.5-6.3 ED AL [IF]")); + choices.insert(p_t(256*4+ 237, "Samsung/Schneider D-XENOGON 10-17mm f/3.5-4.5")); + choices.insert(p_t(256*4+ 239, "Samsung D-XENON 12-24mm f/4 ED AL [IF]")); + choices.insert(p_t(256*4+ 243, "smc PENTAX-DA 70mm f/2.4 Limited")); + choices.insert(p_t(256*4+ 244, "smc PENTAX-DA 21mm f/3.2 AL Limited")); + choices.insert(p_t(256*4+ 245, "Schneider D-XENON 50-200mm")); + choices.insert(p_t(256*4+ 246, "Schneider D-XENON 18-55mm")); + choices.insert(p_t(256*4+ 247, "smc PENTAX-DA 10-17mm f/3.5-4.5 ED [IF] Fisheye zoom")); + choices.insert(p_t(256*4+ 248, "smc PENTAX-DA 12-24mm f/4 ED AL [IF]")); + choices.insert(p_t(256*4+ 249, "Tamron 18-200mm f/3.5-6.3 XR DiII (A14)")); + choices.insert(p_t(256*4+ 250, "smc PENTAX-DA 50-200mm f/4-5.6 ED")); + choices.insert(p_t(256*4+ 251, "smc PENTAX-DA 40mm f/2.8 Limited")); + choices.insert(p_t(256*4+ 252, "smc PENTAX-DA 18-55mm f/3.5-5.6 AL")); + choices.insert(p_t(256*4+ 253, "smc PENTAX-DA 14mm f/2.8 ED[IF]")); + choices.insert(p_t(256*4+ 254, "smc PENTAX-DA 16-45mm f/4 ED AL")); + choices.insert(p_t(256*5+ 1, "smc PENTAX-FA* 24mm f/2 AL[IF]")); + choices.insert(p_t(256*5+ 2, "smc PENTAX-FA 28mm f/2.8 AL")); + choices.insert(p_t(256*5+ 3, "smc PENTAX-FA 50mm f/1.7")); + choices.insert(p_t(256*5+ 4, "smc PENTAX-FA 50mm f/1.4")); + choices.insert(p_t(256*5+ 5, "smc PENTAX-FA* 600mm f/4 ED[IF]")); + choices.insert(p_t(256*5+ 6, "smc PENTAX-FA* 300mm f/4.5 ED[IF]")); + choices.insert(p_t(256*5+ 7, "smc PENTAX-FA 135mm f/2.8 [IF]")); + choices.insert(p_t(256*5+ 8, "smc PENTAX-FA MACRO 50mm f/2.8")); + choices.insert(p_t(256*5+ 9, "smc PENTAX-FA MACRO 100mm f/2.8")); + choices.insert(p_t(256*5+ 10, "smc PENTAX-FA* 85mm f/1.4 [IF]")); + choices.insert(p_t(256*5+ 11, "smc PENTAX-FA* 200mm f/2.8 ED[IF]")); + choices.insert(p_t(256*5+ 12, "smc PENTAX-FA 28-80mm f/3.5-4.7")); + choices.insert(p_t(256*5+ 13, "smc PENTAX-FA 70-200mm f/4-5.6")); + choices.insert(p_t(256*5+ 14, "smc PENTAX-FA* 250-600mm f/5.6 ED[IF]")); + choices.insert(p_t(256*5+ 15, "smc PENTAX-FA 28-105mm f/4-5.6")); + choices.insert(p_t(256*5+ 16, "smc PENTAX-FA 100-300mm f/4.5-5.6")); + choices.insert(p_t(256*5+ 98, "smc PENTAX-FA 100-300mm f/4.5-5.6")); + choices.insert(p_t(256*6+ 1, "smc PENTAX-FA* 85mm f/1.4 [IF]")); + choices.insert(p_t(256*6+ 2, "smc PENTAX-FA* 200mm f/2.8 ED[IF]")); + choices.insert(p_t(256*6+ 3, "smc PENTAX-FA* 300mm f/2.8 ED[IF]")); + choices.insert(p_t(256*6+ 4, "smc PENTAX-FA* 28-70mm f/2.8 AL")); + choices.insert(p_t(256*6+ 5, "smc PENTAX-FA* 80-200mm f/2.8 ED[IF]")); + choices.insert(p_t(256*6+ 6, "smc PENTAX-FA* 28-70mm f/2.8 AL")); + choices.insert(p_t(256*6+ 7, "smc PENTAX-FA* 80-200mm f/2.8 ED[IF]")); + choices.insert(p_t(256*6+ 8, "smc PENTAX-FA 28-70mm f/4 AL")); + choices.insert(p_t(256*6+ 9, "smc PENTAX-FA 20mm f/2.8")); + choices.insert(p_t(256*6+ 10, "smc PENTAX-FA* 400mm f/5.6 ED[IF]")); + choices.insert(p_t(256*6+ 13, "smc PENTAX-FA* 400mm f/5.6 ED[IF]")); + choices.insert(p_t(256*6+ 14, "smc PENTAX-FA* MACRO 200mm f/4 ED[IF]")); + choices.insert(p_t(256*7+ 0, "smc PENTAX-DA 21mm f/3.2 AL Limited")); + choices.insert(p_t(256*7+ 75, "Tamron SP AF 70-200mm f/2.8 Di LD [IF] Macro (A001)")); + choices.insert(p_t(256*7+ 217, "smc PENTAX-DA 50-200mm f/4-5.6 ED WR")); + choices.insert(p_t(256*7+ 218, "smc PENTAX-DA 18-55mm f/3.5-5.6 AL WR")); + choices.insert(p_t(256*7+ 220, "Tamron SP AF 10-24mm f/3.5-4.5 Di II LD Aspherical [IF]")); + choices.insert(p_t(256*7+ 222, "smc PENTAX-DA 18-55mm f/3.5-5.6 AL II")); + choices.insert(p_t(256*7+ 223, "Samsung D-XENON 18-55mm f/3.5-5.6 II")); + choices.insert(p_t(256*7+ 224, "smc PENTAX-DA 15mm f/4 ED AL Limited")); + choices.insert(p_t(256*7+ 225, "Samsung D-XENON 18-250mm f/3.5-6.3")); + choices.insert(p_t(256*7+ 229, "smc PENTAX-DA 18-55mm f/3.5-5.6 AL II")); + choices.insert(p_t(256*7+ 230, "Tamron AF 17-50mm f/2.8 XR Di-II LD (Model A16)")); + choices.insert(p_t(256*7+ 231, "smc PENTAX-DA 18-250mm f/3.5-6.3 ED AL [IF]")); + choices.insert(p_t(256*7+ 233, "smc PENTAX-DA 35mm f/2.8 Macro Limited")); + choices.insert(p_t(256*7+ 234, "smc PENTAX-DA* 300mm f/4 ED [IF] SDM (SDM unused)")); + choices.insert(p_t(256*7+ 235, "smc PENTAX-DA* 200mm f/2.8 ED [IF] SDM (SDM unused)")); + choices.insert(p_t(256*7+ 236, "smc PENTAX-DA 55-300mm f/4-5.8 ED")); + choices.insert(p_t(256*7+ 238, "Tamron AF 18-250mm f/3.5-6.3 Di II LD Aspherical [IF] MACRO")); + choices.insert(p_t(256*7+ 241, "smc PENTAX-DA* 50-135mm f/2.8 ED [IF] SDM (SDM unused)")); + choices.insert(p_t(256*7+ 242, "smc PENTAX-DA* 16-50mm f/2.8 ED AL [IF] SDM (SDM unused)")); + choices.insert(p_t(256*7+ 243, "smc PENTAX-DA 70mm f/2.4 Limited")); + choices.insert(p_t(256*7+ 244, "smc PENTAX-DA 21mm f/3.2 AL Limited")); + choices.insert(p_t(256*8+ 226, "smc PENTAX-DA* 55mm f/1.4 SDM")); + choices.insert(p_t(256*8+ 227, "smc PENTAX DA* 60-250mm f/4 [IF] SDM")); + choices.insert(p_t(256*8+ 232, "smc PENTAX-DA 17-70mm f/4 AL [IF] SDM")); + choices.insert(p_t(256*8+ 234, "smc PENTAX-DA* 300mm f/4 ED [IF] SDM")); + choices.insert(p_t(256*8+ 235, "smc PENTAX-DA* 200mm f/2.8 ED [IF] SDM")); + choices.insert(p_t(256*8+ 241, "smc PENTAX-DA* 50-135mm f/2.8 ED [IF] SDM")); + choices.insert(p_t(256*8+ 242, "smc PENTAX-DA* 16-50mm f/2.8 ED AL [IF] SDM")); + choices.insert(p_t(256*8+ 255, "Sigma 70-200mm f/2.8 EX DG Macro HSM II")); + choices.insert(p_t(256*8+ 255, "Sigma APO 150-500mm f/5-6.3 DG OS HSM")); } virtual std::string toString (Tag* t) { - return choices[256*t->toInt(0,BYTE) + t->toInt(1,BYTE)]; + double maxApertureAtFocal = 0; + double focalLength = 0; + int lensID = 256*t->toInt(0,BYTE) + t->toInt(1,BYTE); + TagDirectory *root=t->getParent()->getRoot(); + if (root){ + Tag *t1; + t1 = root->findTag("FocalLength"); + if( t1) + focalLength = t1->toDouble(); // Focal Length + t1 = root->findTag("MaxAperture"); + if( t1){ + int a=t1->toInt(0,BYTE)&0x7F; + maxApertureAtFocal = pow(2.0, (a-1)/32.0) ; // MaxApertureValue at focal Length + } + } + return guess( lensID, focalLength, maxApertureAtFocal); } }; PALensTypeInterpreter paLensTypeInterpreter; -class PASRInfoInterpreter : public Interpreter { - public: - PASRInfoInterpreter () { } - - virtual std::string toString (Tag* t) { - std::ostringstream str; - int b = t->toInt(0,BYTE); - if (!b) - str << "SRResult = Not stabilized" << std::endl; - else if (b & 1) - str << "SRResult = Stabilized" << std::endl; - b = t->toInt(1,BYTE); - if (!b) - str << "ShakeReduction = Off" << std::endl; - else - str << "ShakeReduction = On" << std::endl; - str << "SRHalfPressTime = " << t->toInt(2,BYTE) << std::endl; - str << "SRFocalLength = " << t->toInt(3,BYTE); - return str.str(); - } +class PASRResultInterpreter: public Interpreter { +public: + PASRResultInterpreter(){ } + virtual std::string toString (Tag* t) { + std::ostringstream str; + int b = t->toInt(0,BYTE); + if (!b) + str << "Not stabilized"; + else if (b & 1) + str << "Stabilized"; + else if (b & 64) + str << "Not Ready"; + return str.str(); + } }; -PASRInfoInterpreter paSRInfoInterpreter; +PASRResultInterpreter paSRResultInterpreter; +class PAHighISONoiseInterpreter: public ChoiceInterpreter { +public: + PAHighISONoiseInterpreter(){ + choices[0] = "Off"; + choices[1] = "Weakest"; + choices[2] = "Weak"; + choices[3] = "Strong"; + } +}; +PAHighISONoiseInterpreter paHighISONoiseInterpreter; + +class PAPowerSourceInterpreter: public ChoiceInterpreter { +public: + PAPowerSourceInterpreter(){ + choices[2] = "Body Battery"; + choices[3] = "Grip Battery "; + choices[4] = "External Power Supply"; + } +}; +PAPowerSourceInterpreter paPowerSourceInterpreter; + +class PAMaxApertureInterpreter: public Interpreter { + public: + PAMaxApertureInterpreter(){} + virtual std::string toString (Tag* t){ + int a = t->toInt(0,BYTE); + a &= 0x7F; + if(a>1){ + sprintf (buffer, "%0.1f", pow(2.0, (a-1)/32.0)); + return buffer; + }else + return "n/a"; + } +}; +PAMaxApertureInterpreter paMaxApertureInterpreter; + +class PANominalMinMaxApertureInterpreter: public Interpreter { +public: + PANominalMinMaxApertureInterpreter(){} + virtual std::string toString (Tag* t){ + int a = t->toInt(0,BYTE); + int mina = a & 0x0F; + int maxa = (a & 0xF0)>>4; + sprintf (buffer, "%0.1f - %0.0f", pow(2.0, maxa/4.0), pow(2.0, (mina+10)/4.0)); + return buffer; + + } +}; +PANominalMinMaxApertureInterpreter paNominalMinMaxApertureInterpreter; + +class PAFlashStatusInterpreter: public ChoiceInterpreter { +public: + PAFlashStatusInterpreter(){ + choices[0x0] = "Off"; + choices[0x2] = "External, Did not fire"; + choices[0x6] = "External, Fired"; + choices[0x9] = "Internal, Did not fire"; + choices[0xd] = "Internal, Fired"; + } +}; +PAFlashStatusInterpreter paFlashStatusInterpreter; + +class PAInternalFlashModeInterpreter: public ChoiceInterpreter { +public: + PAInternalFlashModeInterpreter(){ + choices[0x0] = "n/a - Off-Auto-Aperture"; + choices[0x86] = "On, Wireless (Control)"; + choices[0x95] = "On, Wireless (Master)"; + choices[0xc0] = "On"; + choices[0xc1] = "On, Red-eye reduction"; + choices[0xc2] = "On, Auto"; + choices[0xc3] = "On, Auto, Red-eye reduction"; + choices[0xc8] = "On, Slow-sync"; + choices[0xc9] = "On, Slow-sync, Red-eye reduction"; + choices[0xca] = "On, Trailing-curtain Sync"; + choices[0xf0] = "Off, Normal"; + choices[0xf1] = "Off, Red-eye reduction"; + choices[0xf2] = "Off, Auto"; + choices[0xf3] = "Off, Auto, Red-eye reduction"; + choices[0xf4] = "Off, (Unknown 0xf4)"; + choices[0xf5] = "Off, Wireless (Master)"; + choices[0xf6] = "Off, Wireless (Control)"; + choices[0xf8] = "Off, Slow-sync"; + choices[0xf9] = "Off, Slow-sync, Red-eye reduction"; + choices[0xfa] = "Off, Trailing-curtain Sync"; + } +}; +PAInternalFlashModeInterpreter paInternalFlashModeInterpreter; + +class PAExternalFlashModeInterpreter: public ChoiceInterpreter { + public: + PAExternalFlashModeInterpreter(){ + choices[0x0 ]= "n/a - Off-Auto-Aperture"; + choices[0x3f] = "Off"; + choices[0x40] = "On, Auto"; + choices[0xbf] = "On, Flash Problem"; + choices[0xc0] = "On, Manual"; + choices[0xc4] = "On, P-TTL Auto"; + choices[0xc5] = "On, Contrast-control Sync"; + choices[0xc6] = "On, High-speed Sync"; + choices[0xcc] = "On, Wireless"; + choices[0xcd] = "On, Wireless, High-speed Sync"; + } +}; +PAExternalFlashModeInterpreter paExternalFlashModeInterpreter; + +class PAExternalFlashExposureCompInterpreter: public ChoiceInterpreter { + public: + PAExternalFlashExposureCompInterpreter(){ + choices[0] = "n/a"; + choices[144] = "n/a (Manual Mode)"; + choices[164] = "-3.0"; + choices[167] = "-2.5"; + choices[168] = "-2.0"; + choices[171] = "-1.5"; + choices[172] = "-1.0"; + choices[175] = "-0.5"; + choices[176] = "0"; + choices[179] = "+0.5"; + choices[180] = "+1.0"; + } +}; +PAExternalFlashExposureCompInterpreter paExternalFlashExposureCompInterpreter; + +class PAExternalFlashBounceInterpreter: public ChoiceInterpreter { + public: + PAExternalFlashBounceInterpreter(){ + choices[0] = "n/a"; + choices[16] = "Direct"; + choices[48] = "Bonce"; + } +}; +PAExternalFlashBounceInterpreter paExternalFlashBounceInterpreter; + +class PAExternalFlashGNInterpreter: public Interpreter { + public: + PAExternalFlashGNInterpreter(){} + virtual std::string toString (Tag* t) { + int b = t->toInt(0,BYTE) & 0x1F; + sprintf (buffer, "%0.0f", pow(2.,b/16.+4) ); + return buffer; + } +}; +PAExternalFlashGNInterpreter paExternalFlashGNInterpreter; + +class PAEVStepsInterpreter:public Interpreter { +public: + PAEVStepsInterpreter(){} + virtual std::string toString (Tag* t) { + strcpy(buffer, (t->toInt(0,BYTE) & 0x20)?"1/3 EV steps":"1/2 EV steps"); + return buffer; + } +}; +PAEVStepsInterpreter paEVStepsInterpreter; + +class PAEDialinInterpreter:public Interpreter { +public: + PAEDialinInterpreter(){} + virtual std::string toString (Tag* t) { + strcpy(buffer, (t->toInt(0,BYTE) & 0x40)?"P Shift":"Tv or Av"); + return buffer; + } +}; +PAEDialinInterpreter paEDialinInterpreter; + +class PAApertureRingUseInterpreter: public Interpreter { +public: + PAApertureRingUseInterpreter(){} + virtual std::string toString (Tag* t) { + strcpy(buffer, (t->toInt(0,BYTE) & 0x80)?"Permitted":"Prohibited"); + return buffer; + } +}; +PAApertureRingUseInterpreter paApertureRingUseInterpreter; + +class PAFlashOptionInterpreter: public ChoiceInterpreter { +public: + PAFlashOptionInterpreter(){ + choices[0x0] = "Normal"; + choices[0x1] = "Red-eye reduction"; + choices[0x2] = "Auto"; + choices[0x3] = "Auto, Red-eye reduction"; + choices[0x5] = "Wireless (Master)"; + choices[0x6] = "Wireless (Control)"; + choices[0x8] = "Slow-sync"; + choices[0x9] = "Slow-sync, Red-eye reduction"; + choices[0xa] = "Trailing-curtain Sync"; + } + virtual std::string toString (Tag* t) { + std::map::iterator r = choices.find (t->toInt(0,BYTE) >>4); + if (r!=choices.end()) + return r->second; + else { + t->toString (buffer); + return std::string (buffer); + } + return buffer; + } +}; +PAFlashOptionInterpreter paFlashOptionInterpreter; + +class PAMeteringMode2Interpreter: public Interpreter { +public: + PAMeteringMode2Interpreter(){} + virtual std::string toString (Tag* t) { + std::ostringstream str; + int v = (t->toInt(0,BYTE) & 0xF); + if(!v) + str << "Multi-segment"; + else if(v&1) + str << "Center-weighted average"; + else if(v&2) + str << "Spot"; + return str.str(); + } +}; +PAMeteringMode2Interpreter paMeteringMode2Interpreter; + +class PAExposureBracketStepSizeInterpreter: public ChoiceInterpreter { +public: + PAExposureBracketStepSizeInterpreter(){ + choices[3] = "0.3"; + choices[4] = "0.5"; + choices[5] = "0.7"; + choices[8] = "1.0"; + choices[11] = "1.3"; + choices[12] = "1.5"; + choices[13] = "1.7"; + choices[16] = "2.0"; + } +}; +PAExposureBracketStepSizeInterpreter paExposureBracketStepSizeInterpreter; + +class PAPictureMode2Interpreter: public ChoiceInterpreter { +public: + PAPictureMode2Interpreter(){ + choices[0] = "Scene Mode"; + choices[1] = "Auto PICT"; + choices[2] = "Program AE"; + choices[3] = "Green Mode"; + choices[4] = "Shutter Speed Priority"; + choices[5] = "Aperture Priority"; + choices[6] = "Program Tv Shift"; + choices[7] = "Program Av Shift"; + choices[8] = "Manual"; + choices[9] = "Bulb"; + choices[10] = "Aperture Priority, Off-Auto-Aperture"; + choices[11] = "Manual, Off-Auto-Aperture"; + choices[12] = "Bulb, Off-Auto-Aperture"; + choices[13] = "Shutter & Aperture Priority AE"; + choices[15] = "Sensitivity Priority AE"; + choices[16] = "Flash X-Sync Speed AE"; + } +}; +PAPictureMode2Interpreter paPictureMode2Interpreter; + +class PAProgramLineInterpreter: public Interpreter { +public: + PAProgramLineInterpreter(){} + virtual std::string toString (Tag* t) { + std::ostringstream str; + int c = t->toInt(0,BYTE); + switch(c & 0xf){ + case 0: str << "Manual";break; + case 1: str << "AF-S";break; + case 2: str << "AF-C";break; + case 3: str << "AF-A";break; + } + if( c & 0xF0 == 0) str << ", Point Selection Auto"; + else if( c & 0x20 ) str << ", Fixed Center Point Selected"; + else if( c & 0x10 ) str << ", Point Selected"; + return str.str(); + } +}; +PAProgramLineInterpreter paProgramLineInterpreter; + +class PAAFModeInterpreter: public Interpreter { +public: + PAAFModeInterpreter(){} + virtual std::string toString (Tag* t) { + switch(t->toInt(0,BYTE) & 0x3){ + case 0: return "Normal"; + case 1: return "Hi Speed"; + case 2: return "Depth"; + case 3: return "MTF"; + } + } +}; +PAAFModeInterpreter paAFModeInterpreter; + +class PAAFPointSelectedInterpreter: public Interpreter { +public: + PAAFPointSelectedInterpreter(){} + virtual std::string toString (Tag* t) { + char *ps[]={"Upper-left","Top","Upper-right","Left","Mid-left","Center","Mid-right","Right","Lower-left","Bottom","Lower-right"}; + int c = t->toInt(0,SHORT); + if( !c ) + return "Auto"; + else{ + for( int iBit=0; iBit<11; iBit++) + if( c & (1<toInt(0,BYTE); + if( !c ) + return "Single-frame"; + else if( c & 0x01) + return "Continuous"; + else if( c & 0x04) + return "Self-timer (12 s)"; + else if( c & 0x08) + return "Self-timer (2 s)"; + else if( c & 0x10 ) + return "Remote Control (3 s delay)"; + else if( c & 0x20) + return "Remote Control"; + else if( c & 0x40) + return "Exposure Bracket"; + else if( c & 0x80) + return "Multiple Exposure"; + else + return "Unknown"; + } +}; +PADriveMode2Interpreter paDriveMode2Interpreter; const TagAttrib pentaxAttribs[] = { 0, 1, 0, 0, 0x0001, "PentaxVersion", &stdInterpreter, @@ -510,7 +1019,7 @@ const TagAttrib pentaxAttribs[] = { 0, 1, 0, 0, 0x000f, "AFPointsInFocus", &paAFFocusInterpreter, 0, 1, 0, 0, 0x0010, "FocusPosition", &stdInterpreter, 0, 1, 0, 0, 0x0012, "ExposureTime", &stdInterpreter, - 0, 1, 0, 0, 0x0013, "FNumber", &stdInterpreter, + 0, 1, 0, 0, 0x0013, "FNumber", &paFNumberInterpreter, 0, 1, 0, 0, 0x0014, "ISO", &paISOInterpreter, 0, 1, 0, 0, 0x0015, "LightReading", &stdInterpreter, 0, 1, 0, 0, 0x0016, "ExposureCompensation", &stdInterpreter, @@ -535,9 +1044,9 @@ const TagAttrib pentaxAttribs[] = { 0, 1, 0, 0, 0x0029, "FrameNumber", &stdInterpreter, 0, 1, 0, 0, 0x002d, "EffectiveLV", &stdInterpreter, 0, 1, 0, 0, 0x0032, "ImageProcessing", &stdInterpreter, - 0, 1, 0, 0, 0x0033, "PictureMode", &stdInterpreter, - 0, 1, 0, 0, 0x0034, "DriveMode", &stdInterpreter, - 0, 1, 0, 0, 0x0037, "ColorSpace", &stdInterpreter, + 0, 1, 0, 0, 0x0033, "PictureMode", &paPictureModeInterpreter2, + 0, 1, 0, 0, 0x0034, "DriveMode", &paDriveModeInterpreter, + 0, 1, 0, 0, 0x0037, "ColorSpace", &paColorSpaceInterpreter, 0, 1, 0, 0, 0x0038, "ImageAreaOffset", &stdInterpreter, 0, 1, 0, 0, 0x0039, "RawImageSize", &stdInterpreter, 0, 1, 0, 0, 0x003c, "AFPointsInFocus", &stdInterpreter, @@ -551,14 +1060,19 @@ const TagAttrib pentaxAttribs[] = { 0, 1, 0, 0, 0x004d, "FlashExposureComp", &stdInterpreter, 0, 1, 0, 0, 0x004f, "ImageTone", &stdInterpreter, 0, 1, 0, 0, 0x0050, "ColorTemperature", &stdInterpreter, - 0, 1, 0, 0, 0x005c, "ShakeReductionInfo", &paSRInfoInterpreter, + 0, 1, 0, pentaxSRInfoAttribs, 0x005c, "ShakeReductionInfo", &stdInterpreter, 0, 1, 0, 0, 0x005d, "ShutterCount", &stdInterpreter, + 0, 1, 0, 0, 0x0069, "DynamicRangeExpansion", &paOnOffInterpreter, + 0, 1, 0, 0, 0x0071, "HighISONoiseReduction", &paHighISONoiseInterpreter, + 0, 1, 0, 0, 0x0072, "AFAdjustment", &stdInterpreter, 0, 1, 0, 0, 0x0200, "BlackPoint", &stdInterpreter, 0, 1, 0, 0, 0x0201, "WhitePoint", &stdInterpreter, - 0, 1, 0, 0, 0x0205, "ShotInfo", &stdInterpreter, - 0, 1, 0, 0, 0x0206, "AEInfo", &stdInterpreter, - 0, 1, 0, 0, 0x0207, "LensInfo", &stdInterpreter, - 0, 1, 0, 0, 0x0208, "FlashInfo", &stdInterpreter, + 0, 1, 0, 0, 0x0203, "ColorMatrixA", &stdInterpreter, + 0, 1, 0, 0, 0x0204, "ColorMatrixB", &stdInterpreter, + 0, 1, 0, pentaxCameraSettingsAttribs, 0x0205, "CameraSettings", &stdInterpreter, + 0, 1, 0, pentaxAEInfoAttribs, 0x0206, "AEInfo", &stdInterpreter, + 0, 1, 0, pentaxLensDataAttribs, 0x0207, "LensInfo", &stdInterpreter, + 0, 1, 0, pentaxFlashInfoAttribs, 0x0208, "FlashInfo", &stdInterpreter, 0, 1, 0, 0, 0x0209, "AEMeteringSegments", &stdInterpreter, 0, 1, 0, 0, 0x020a, "FlashADump", &stdInterpreter, 0, 1, 0, 0, 0x020b, "FlashBDump", &stdInterpreter, @@ -571,7 +1085,7 @@ const TagAttrib pentaxAttribs[] = { 0, 1, 0, 0, 0x0213, "WB_RGGBLevelsFluorescentW", &stdInterpreter, 0, 1, 0, 0, 0x0214, "WB_RGGBLevelsFlash", &stdInterpreter, 0, 1, 0, 0, 0x0215, "CameraInfo", &stdInterpreter, - 0, 1, 0, 0, 0x0216, "BatteryInfo", &stdInterpreter, + 0, 1, 0, pentaxBatteryInfoAttribs, 0x0216, "BatteryInfo", &stdInterpreter, 0, 1, 0, 0, 0x021f, "AFInfo", &stdInterpreter, 0, 1, 0, 0, 0x0222, "ColorInfo", &stdInterpreter, 0, 1, 0, 0, 0x03fe, "DataDump", &stdInterpreter, @@ -580,6 +1094,72 @@ const TagAttrib pentaxAttribs[] = { 0, 1, 0, 0, 0x0403, "ToneCurves", &stdInterpreter, 0, 1, 0, 0, 0x0e00, "PrintIM", &stdInterpreter, -1, 0, 0, 0, 0, "", NULL}; + +const TagAttrib pentaxSRInfoAttribs[] = { + 0, 1, 0, 0, 0, "SRResult", &paSRResultInterpreter, + 0, 1, 0, 0, 1, "ShakeReduction", &paOnOffInterpreter, + 0, 1, 0, 0, 2, "SRHalfPressTime", &stdInterpreter, + 0, 1, 0, 0, 3, "SRFocalLength", &stdInterpreter, + -1, 0, 0, 0, 0, "", NULL}; + +const TagAttrib pentaxLensDataAttribs[] = { + 0, 1, 0, 0, 10, "NominalMinMaxAperture", &paNominalMinMaxApertureInterpreter, + 0, 1, 0, 0, 14, "MaxAperture", &paMaxApertureInterpreter, +-1, 0, 0, 0, 0, "", NULL}; + +const TagAttrib pentaxCameraSettingsAttribs[] = { + 0, 1, 0, 0, 0, "PictureMode2", &paPictureMode2Interpreter, + 0, 1, 0, 0, 1, "ProgramLine", &paProgramLineInterpreter, + 0, 1, 0, 0, 1, "EVSteps", &paEVStepsInterpreter, + 0, 1, 0, 0, 1, "E-DialinProgram", &paEDialinInterpreter, + 0, 1, 0, 0, 1, "ApertureRing", &paApertureRingUseInterpreter, + 0, 1, 0, 0, 2, "FlashOptions", &paFlashOptionInterpreter, + 0, 1, 0, 0, 2, "MeteringMode2", &paMeteringMode2Interpreter, + 0, 1, 0, 0, 3, "AFMode", &paAFModeInterpreter, + 0, 1, 0, 0, 4, "AFPointSelected2", &paAFPointSelectedInterpreter, + 0, 1, 0, 0, 7, "DriveMode2", &paDriveMode2Interpreter, + 0, 1, 0, 0, 8, "ExposureBracketStepSize", &paExposureBracketStepSizeInterpreter, + 0, 1, 0, 0, 9, "BracketShotNumber", &stdInterpreter, + 0, 1, 0, 0, 10, "WhiteBalanceSet", &stdInterpreter, +-1, 0, 0, 0, 0, "", NULL}; + +const TagAttrib pentaxAEInfoAttribs[] = { + 0, 1, 0, 0, 0, "AEExposureTime", &stdInterpreter, + 0, 1, 0, 0, 1, "AEAperture", &stdInterpreter, + 0, 1, 0, 0, 2, "AE_ISO", &stdInterpreter, + 0, 1, 0, 0, 3, "AEXv", &stdInterpreter, + 0, 1, 0, 0, 4, "AEBXv", &stdInterpreter, + 0, 1, 0, 0, 5, "AEMinExposureTime", &stdInterpreter, + 0, 1, 0, 0, 6, "AEProgramMode", &stdInterpreter, + 0, 1, 0, 0, 9, "AEMaxAperture", &stdInterpreter, + 0, 1, 0, 0, 10, "AEMaxAperture2", &stdInterpreter, + 0, 1, 0, 0, 11, "AEMinAperture", &stdInterpreter, + 0, 1, 0, 0, 12, "AEMeteringMode", &stdInterpreter, + 0, 1, 0, 0, 14, "FlashExposureCompSet", &stdInterpreter, + -1, 0, 0, 0, 0, "", NULL}; + +const TagAttrib pentaxFlashInfoAttribs[] = { + 0, 1, 0, 0, 0, "FlashStatus", &paFlashStatusInterpreter, + 0, 1, 0, 0, 1, "InternalFlashMode", &paInternalFlashModeInterpreter, + 0, 1, 0, 0, 2, "ExternalFlashMode", &paExternalFlashModeInterpreter, + 0, 1, 0, 0, 3, "InternalFlashStrength", &stdInterpreter, + 0, 1, 0, 0, 24, "ExternalFlashGuideNumber", &paExternalFlashGNInterpreter, + 0, 1, 0, 0, 25, "ExternalFlashExposureComp", &paExternalFlashExposureCompInterpreter, + 0, 1, 0, 0, 26, "ExternalFlashBounce", &paExternalFlashBounceInterpreter, + -1, 0, 0, 0, 0, "", NULL}; + +const TagAttrib pentaxBatteryInfoAttribs[] = { +0, 1, 0, 0, 0, "PowerSource", &paPowerSourceInterpreter, +0, 1, 0, 0, 1, "BatteryStates", &stdInterpreter, +0, 1, 0, 0, 2, "BatteryADBodyNoLoad", &stdInterpreter, +0, 1, 0, 0, 3, "BatteryADBodyLoad", &stdInterpreter, +0, 1, 0, 0, 4, "BatteryADGripNoLoad", &stdInterpreter, +0, 1, 0, 0, 5, "BatteryADGripLoad", &stdInterpreter, +-1, 0, 0, 0, 0, "", NULL}; + }; #endif + + + diff --git a/rtexif/rtexif.cc b/rtexif/rtexif.cc index 5d3bcdf81..394c32bc6 100644 --- a/rtexif/rtexif.cc +++ b/rtexif/rtexif.cc @@ -99,6 +99,11 @@ void TagDirectory::sort () { for (int j=0; tags[i]->getDirectory(j); j++) tags[i]->getDirectory(j)->sort (); } +TagDirectory* TagDirectory::getRoot() +{ + if(parent) return parent->getRoot(); + else return this; +} const TagAttrib* TagDirectory::getAttrib (int id) { @@ -185,6 +190,24 @@ Tag* TagDirectory::getTag (const char* name) const { return NULL; } +Tag* TagDirectory::findTag (const char* name) const { + if (attribs) { + for (int i=0; attribs[i].ignore!=-1; i++) + if (!strcmp (attribs[i].name, name)){ + Tag* t= getTag (attribs[i].ID); + if(t) return t; + else break; + } + } + for (int i=0; iisDirectory()){ + TagDirectory *dir = tags[i]->getDirectory(); + Tag* t=dir->findTag(name); + if(t) return t; + } + return NULL; +} + int TagDirectory::calculateSize () { int size = 2; // space to store the number of tags @@ -310,12 +333,63 @@ void TagDirectory::applyChange (std::string name, std::string value) { } } +TagDirectoryTable::TagDirectoryTable () +:valuesSize(0),zeroOffset(0) +{ +} + +TagDirectoryTable::TagDirectoryTable (TagDirectory* p, unsigned char *v,int memsize,int offs, TagType type, const TagAttrib* ta, ByteOrder border) +:TagDirectory(p,ta,border),valuesSize(memsize),zeroOffset(offs),defaultType( type ) +{ + values = new unsigned char[valuesSize]; + memcpy(values,v,valuesSize); + for( const TagAttrib* tattr = ta; tattr->ignore != -1; tattr++){ + Tag* newTag = new Tag (this, tattr, (values + zeroOffset+ tattr->ID*getTypeSize(type)),type); + tags.push_back(newTag); // Here we can insert more tag in the same offset because of bitfield meaning + } +} + +TagDirectoryTable::TagDirectoryTable (TagDirectory* p, FILE* f, int memsize,int offs, TagType type, const TagAttrib* ta, ByteOrder border) +:TagDirectory(p,ta,border),valuesSize(memsize),zeroOffset(offs),defaultType( type ) +{ + values = new unsigned char[valuesSize]; + fread (values, 1, valuesSize, f); + + for( const TagAttrib* tattr = ta; tattr->ignore != -1; tattr++){ + Tag* newTag = new Tag (this, tattr, (values + zeroOffset+ tattr->ID*getTypeSize(type)),type); + tags.push_back(newTag); // Here we can insert more tag in the same offset because of bitfield meaning + } +} +TagDirectory* TagDirectoryTable::clone (TagDirectory* parent) { + + TagDirectory* td = new TagDirectoryTable (parent,values,valuesSize,zeroOffset,defaultType, attribs, order); + return td; +} + +TagDirectoryTable::~TagDirectoryTable() +{ + if(values) + delete [] values; +} +int TagDirectoryTable::calculateSize () +{ + return valuesSize; +} + +int TagDirectoryTable::write (int start, unsigned char* buffer) { + if( values && valuesSize){ + memcpy(buffer+start,values,valuesSize); + return start+valuesSize; + }else + return start; +} + //--------------- class Tag --------------------------------------------------- // this class represents a tag stored in the directory //----------------------------------------------------------------------------- Tag::Tag (TagDirectory* p, FILE* f, int base) - : parent(p), value(NULL), directory(NULL), count(0), attrib(NULL), type(INVALID) { + : parent(p), value(NULL), directory(NULL), count(0), attrib(NULL), type(INVALID),allocOwnMemory(true) { tag = get2 (f, getOrder()); type = (TagType)get2 (f, getOrder()); @@ -334,7 +408,7 @@ Tag::Tag (TagDirectory* p, FILE* f, int base) int save = ftell(f) + 4; // load value field (possibly seek before) - valuesize = count * ("11124811248484"[type<14?type:0]-'0'); + valuesize = count * getTypeSize(type); if (valuesize > 4) fseek (f, get4(f, getOrder()) + base, SEEK_SET); @@ -453,44 +527,103 @@ Tag::Tag (TagDirectory* p, FILE* f, int base) return; } } - else if (type==UNDEFINED && attrib && attrib->subdirAttribs) { - count = 1; - type = LONG; - directory = new TagDirectory*[2]; - directory[0] = new TagDirectory (parent, f, base, attrib->subdirAttribs, getOrder()); - directory[1] = NULL; + else if (attrib && attrib->subdirAttribs) { + // Some subdirs are specific of maker and model + char make[128], model[128]; + Tag* tmake = parent->getRoot()->getTag ("Make"); + if (tmake) tmake->toString (make); + else make[0] = 0; + Tag* tmodel = parent->getRoot()->getTag ("Model"); + if (tmodel) tmodel->toString (model); + else model[0] = 0; + + + if (!strncmp(make, "SONY", 4)) { + switch( tag ){ + case 0x0114: + { + directory = new TagDirectory*[2]; + directory[1] = NULL; + if( strstr(model, "A330") || strstr(model, "A380") ) + directory[0] = new TagDirectoryTable (parent, f, valuesize*2,0,SHORT , sonyCameraSettingsAttribs2, MOTOROLA); + else + directory[0] = new TagDirectoryTable (parent, f, valuesize*2,0,SHORT , sonyCameraSettingsAttribs, MOTOROLA); + makerNoteKind = TABLESUBDIR; + } + break; + default: + goto defsubdirs; + } + }else if (!strncmp(make, "PENTAX", 6)) { + switch( tag ){ + case 0x005c: + case 0x0205: + case 0x0206: + case 0x0208: + case 0x0216: + directory = new TagDirectory*[2]; + directory[1] = NULL; + directory[0] = new TagDirectoryTable (parent, f, valuesize,0,BYTE , attrib->subdirAttribs, getOrder()); + makerNoteKind = TABLESUBDIR; + break; + case 0x0207: + { // There are 2 format pentaxLensDataAttribs + int offsetFirst = 4; + if( strstr(model, "*ist") || strstr(model, "GX-1") || strstr(model, "K100D") || strstr(model, "K110D") ) + offsetFirst = 3; + directory = new TagDirectory*[2]; + directory[1] = NULL; + directory[0] = new TagDirectoryTable (parent, f, valuesize,offsetFirst,BYTE , attrib->subdirAttribs, getOrder()); + makerNoteKind = TABLESUBDIR; + } + break; + default: + goto defsubdirs; + } + }else if(type==UNDEFINED){ + count = 1; + type = LONG; + directory[0] = new TagDirectory (parent, f, base, attrib->subdirAttribs, getOrder()); + }else + goto defsubdirs; } else { // read value value = new unsigned char [valuesize]; fread (value, 1, valuesize, f); - - // if it is a subdirectory, load it (there may be several directories if count>1) - if (attrib && attrib->subdirAttribs) { - int pos = ftell (f); - // count the number of valid subdirs - int sdcount = count; - if (sdcount>0) { - if (parent->getAttribTable()==olympusAttribs) - sdcount = 1; - // allocate space - directory = new TagDirectory*[sdcount+1]; - // load directories - for (int j=0,i=0; jsubdirAttribs, getOrder()); - fseek (f, pos, SEEK_SET); - } - // set the terminating NULL - directory[sdcount] = NULL; - } - else - type = INVALID; - } } // seek back to the saved position fseek (f, save, SEEK_SET); + return; +defsubdirs: + // read value + value = new unsigned char [valuesize]; + fread (value, 1, valuesize, f); + int pos = ftell (f); + // count the number of valid subdirs + int sdcount = count; + if (sdcount>0) { + if (parent->getAttribTable()==olympusAttribs) + sdcount = 1; + // allocate space + directory = new TagDirectory*[sdcount+1]; + // load directories + for (int j=0,i=0; jsubdirAttribs, getOrder()); + fseek (f, pos, SEEK_SET); + } + // set the terminating NULL + directory[sdcount] = NULL; + } + else + type = INVALID; + +// seek back to the saved position +fseek (f, save, SEEK_SET); +return; + } Tag* Tag::clone (TagDirectory* parent) { @@ -525,7 +658,7 @@ Tag* Tag::clone (TagDirectory* parent) { Tag::~Tag () { // delete value - if (value) + if (value && allocOwnMemory) delete [] value; // if there are directories behind the tag, delete them @@ -559,13 +692,15 @@ void Tag::fromInt (int v) { void Tag::fromString (const char* v, int size) { - delete value; + if( value && allocOwnMemory) + delete [] value; if (size<0) valuesize = strlen (v) + 1; else valuesize = size; count = valuesize; - value = new unsigned char [valuesize]; + if( allocOwnMemory ) + value = new unsigned char [valuesize]; memcpy ((char*)value, v, valuesize); } @@ -720,7 +855,6 @@ int Tag::calculateSize () { size += valuesize; else if (makerNoteKind==HEADERIFD) size += valuesize; - return size; } @@ -770,6 +904,11 @@ int Tag::write (int offs, int dataOffs, unsigned char* buffer) { dataOffs += directory[0]->write (dataOffs, buffer); return dataOffs; } + else if( makerNoteKind==TABLESUBDIR){ + sset4 (dataOffs, buffer+offs, parent->getOrder()); + dataOffs = directory[0]->write (dataOffs, buffer); + return dataOffs; + } else if (!directory[1]) { sset4 (dataOffs, buffer+offs, parent->getOrder()); return directory[0]->write (dataOffs, buffer); @@ -790,21 +929,37 @@ int Tag::write (int offs, int dataOffs, unsigned char* buffer) { } Tag::Tag (TagDirectory* p, const TagAttrib* attr) - : parent(p), attrib(attr), makerNoteKind (NOMK), directory(NULL), keep(true), tag(attr ? attr->ID : -1), count(0), valuesize(0), value(NULL), type(INVALID) { + : parent(p), attrib(attr), makerNoteKind (NOMK), directory(NULL), keep(true), tag(attr ? attr->ID : -1), count(0), valuesize(0), value(NULL), type(INVALID),allocOwnMemory(true) { } Tag::Tag (TagDirectory* p, const TagAttrib* attr, int data, TagType t) - : parent(p), attrib(attr), makerNoteKind (NOMK), directory(NULL), keep(true), tag(attr ? attr->ID : -1), count(1), valuesize(0), value(NULL), type(t) { + : parent(p), attrib(attr), makerNoteKind (NOMK), directory(NULL), keep(true), tag(attr ? attr->ID : -1), count(1), valuesize(0), value(NULL), type(t),allocOwnMemory(true) { initInt (data, t); } +Tag::Tag (TagDirectory* p, const TagAttrib* attr, unsigned char *data, TagType t) + : parent(p), attrib(attr), makerNoteKind (NOMK), directory(NULL), keep(true), tag(attr ? attr->ID : -1), count(1), valuesize(0), value(NULL), type(t),allocOwnMemory(false) { + + initType (data, t); +} + Tag::Tag (TagDirectory* p, const TagAttrib* attr, const char* text) - : parent(p), attrib(attr), makerNoteKind (NOMK), directory(NULL), keep(true), tag(attr ? attr->ID : -1), count(1), valuesize(0), value(NULL), type(ASCII) { + : parent(p), attrib(attr), makerNoteKind (NOMK), directory(NULL), keep(true), tag(attr ? attr->ID : -1), count(1), valuesize(0), value(NULL), type(ASCII),allocOwnMemory(true) { initString (text); } +void Tag::initType (unsigned char *data, TagType type) +{ + valuesize = getTypeSize(type); + if( allocOwnMemory ){ + value = new unsigned char[valuesize]; + memcpy ((char*)value, data, valuesize); + }else + value = data; +} + void Tag::initInt (int data, TagType t, int cnt) { type = t; @@ -1382,6 +1537,13 @@ short int int2_to_signed (short unsigned int i) { return u.s; } +int getTypeSize( TagType type ){ + return ("11124811248484"[type<14?type:0]-'0'); +} + +#undef ABS +#define ABS(a) (((a) < 0) ? -(a) : (a)) + /* Function to parse and extract focal length and aperture information from description * @fullname must conform to the following formats * mm f/ @@ -1430,5 +1592,75 @@ bool extractLensInfo(std::string &fullname,double &minFocal, double &maxFocal, d return false; } +template +std::string IntLensInterpreter< T >::guess( const T lensID, double focalLength, double maxApertureAtFocal ) +{ + it_t r; + size_t nFound = choices.count( lensID ); + switch( nFound ) + { + case 0: // lens Unknown + { + std::ostringstream s; + s << lensID; + return s.str(); + } + case 1: // lens found + r = choices.find ( lensID ); + return r->second; + default: + // More than one hit: we must guess + break; + } + + + double deltaMin = 1000.; + + /* Choose the best match: thanks to exiftool by Phil Harvey + * first throws for "out of focal range" and lower or upper aperture of the lens compared to MaxApertureAtFocal + * if the lens is not constant aperture, calculate aprox. aperture of the lens at focalLength + * and compare with actual aperture. + */ + std::string bestMatch("Unknown"); + std::ostringstream candidates; + for ( r = choices.lower_bound( lensID ); r != choices.upper_bound(lensID); r++ ){ + double a1,a2,f1,f2,lensAperture,dif; + + if( !extractLensInfo( r->second ,f1,f2,a1,a2) ) + continue; + if( f1 == 0. || a1 == 0.) + continue; + + if( focalLength < f1 - .5 || focalLength > f2 + 0.5 ) + continue; + if( maxApertureAtFocal > 0.1){ + if( maxApertureAtFocal < a1 - 0.15 || maxApertureAtFocal > a2 +0.15) + continue; + + if( a1 == a2 || f1 == f2) + lensAperture = a1; + else + lensAperture = exp( log(a1)+(log(a2)-log(a1))/(log(f2)-log(f1))*(log(focalLength)-log(f1)) ); + + dif = ABS(lensAperture - maxApertureAtFocal); + }else + dif = 0; + if( dif < deltaMin ){ + deltaMin = dif; + bestMatch = r->second; + } + if( dif < 0.15){ + if( candidates.tellp() ) + candidates << "\n or " << r->second; + else + candidates << r->second; + } + + } + if( !candidates.tellp() ) + return bestMatch; + else + return candidates.str(); +} } diff --git a/rtexif/rtexif.h b/rtexif/rtexif.h index 7280a6c67..93cff2643 100644 --- a/rtexif/rtexif.h +++ b/rtexif/rtexif.h @@ -23,6 +23,7 @@ #include #include #include +#include #include namespace rtexif { @@ -30,7 +31,7 @@ namespace rtexif { enum TagType {INVALID=0, BYTE=1, ASCII=2, SHORT=3, LONG=4, RATIONAL=5, UNDEFINED=7, SSHORT=8, SLONG=9, SRATIONAL=10, FLOAT=11, DOUBLE=12, OLYUNDEF=13, SUBDIR=99}; enum ActionCode {DONTWRITE=0, WRITE=1, SYSTEM=2}; enum ByteOrder {INTEL=0x4949, MOTOROLA=0x4D4D}; -enum MNKind {NOMK, IFD, HEADERIFD, NIKON3, OLYMPUS2, FUJI}; +enum MNKind {NOMK, IFD, HEADERIFD, NIKON3, OLYMPUS2, FUJI,TABLESUBDIR}; struct TIFFHeader { @@ -48,7 +49,7 @@ struct TagAttrib { int action; //=0: dont write it to the output, =1: write it to the output, =2: dont write, dont show, =3: write, dont show int editable; const TagAttrib* subdirAttribs; // =0 ->not subdir - unsigned short ID; + unsigned short ID; // Numeric identifier of tag (or index inside DirectoryTable) const char* name; Interpreter* interpreter; }; @@ -66,29 +67,48 @@ class TagDirectory { TagDirectory (); TagDirectory (TagDirectory* p, FILE* f, int base, const TagAttrib* ta, ByteOrder border); TagDirectory (TagDirectory* p, const TagAttrib* ta, ByteOrder border); - ~TagDirectory (); + virtual ~TagDirectory (); inline ByteOrder getOrder () const { return order; } TagDirectory* getParent () { return parent; } + TagDirectory* getRoot (); inline int getCount () const { return tags.size (); } const TagAttrib* getAttrib (int id); const TagAttrib* getAttrib (const char* name); const TagAttrib* getAttribTable() { return attribs; } - Tag* getTag (const char* name) const; - Tag* getTag (int ID) const; - void addTag (Tag* a); - void addTagFront (Tag* a); - void replaceTag (Tag* a); + virtual Tag* getTag (const char* name) const; + virtual Tag* getTag (int ID) const; + virtual Tag* findTag (const char* name) const; + virtual void addTag (Tag* a); + virtual void addTagFront (Tag* a); + virtual void replaceTag (Tag* a); inline Tag* getTagByIndex (int ix) { return tags[ix]; } inline void setOrder (ByteOrder bo) { order = bo; } - int calculateSize (); - int write (int start, unsigned char* buffer); - TagDirectory* clone (TagDirectory* parent); - void applyChange (std::string field, std::string value); + virtual int calculateSize (); + virtual int write (int start, unsigned char* buffer); + virtual TagDirectory* clone (TagDirectory* parent); + virtual void applyChange (std::string field, std::string value); - void printAll () const; - void sort (); + virtual void printAll () const; + virtual void sort (); +}; + +// a table of tags: id are offset from beginning and not identifiers +class TagDirectoryTable: public TagDirectory { + protected: + unsigned char *values; // Tags values are saved internally here + long zeroOffset; // Offset 0 (index 0) could be at an offset from values + long valuesSize; // Size of allocated memory + TagType defaultType; // Default type of all tags in this directory + public: + TagDirectoryTable(); + TagDirectoryTable (TagDirectory* p, unsigned char *v,int memsize,int offs, TagType type, const TagAttrib* ta, ByteOrder border); + TagDirectoryTable (TagDirectory* p, FILE* f, int memsize,int offset, TagType type, const TagAttrib* ta, ByteOrder border); + virtual ~TagDirectoryTable(); + virtual int calculateSize (); + virtual int write (int start, unsigned char* buffer); + virtual TagDirectory* clone (TagDirectory* parent); }; // a class representing a single tag @@ -101,6 +121,7 @@ class Tag { unsigned char* value; int valuesize; bool keep; + bool allocOwnMemory; const TagAttrib* attrib; TagDirectory* parent; @@ -109,10 +130,12 @@ class Tag { public: Tag (TagDirectory* parent, FILE* f, int base); // parse next tag from the file - Tag (TagDirectory* parent, const TagAttrib* attr); + Tag (TagDirectory* parent, const TagAttrib* attr); + Tag (TagDirectory* parent, const TagAttrib* attr, unsigned char *data, TagType t); Tag (TagDirectory* parent, const TagAttrib* attr, int data, TagType t); // create a new tag from array (used Tag (TagDirectory* parent, const TagAttrib* attr, const char* data); // create a new tag from array (used ~Tag (); + void initType (unsigned char *data, TagType type); void initInt (int data, TagType t, int count=1); void initString (const char* text); void initSubDir (); @@ -130,6 +153,7 @@ class Tag { inline ByteOrder getOrder () const { return parent ? parent->getOrder() : INTEL; } inline TagDirectory* getParent () const { return parent; } int getValueSize () const { return valuesize; } + bool getOwnMemory() const { return allocOwnMemory; } // read/write value int toInt (int ofs=0, TagType astype=INVALID); @@ -223,6 +247,20 @@ class ChoiceInterpreter : public Interpreter { } }; + +template< class T > +class IntLensInterpreter : public Interpreter { +protected: + typedef std::multimap< T, std::string> container_t; + typedef typename std::multimap< T, std::string>::iterator it_t; + typedef std::pair< T, std::string> p_t; + container_t choices; + + virtual std::string guess(const T lensID, double focalLength, double maxApertureAtFocal ); +}; + +template class IntLensInterpreter< int >; +inline int getTypeSize( TagType type ); inline unsigned short sget2 (unsigned char *s, ByteOrder order); inline int sget4 (unsigned char *s, ByteOrder order); inline unsigned short get2 (FILE* f, ByteOrder order); @@ -241,9 +279,17 @@ extern const TagAttrib nikon2Attribs[]; extern const TagAttrib nikon3Attribs[]; extern const TagAttrib canonAttribs[]; extern const TagAttrib pentaxAttribs[]; +extern const TagAttrib pentaxLensDataAttribs[]; +extern const TagAttrib pentaxAEInfoAttribs[]; +extern const TagAttrib pentaxCameraSettingsAttribs[]; +extern const TagAttrib pentaxFlashInfoAttribs[]; +extern const TagAttrib pentaxSRInfoAttribs[]; +extern const TagAttrib pentaxBatteryInfoAttribs[]; extern const TagAttrib fujiAttribs[]; extern const TagAttrib minoltaAttribs[]; extern const TagAttrib sonyAttribs[]; +extern const TagAttrib sonyCameraSettingsAttribs[]; +extern const TagAttrib sonyCameraSettingsAttribs2[]; extern const TagAttrib olympusAttribs[]; }; #endif diff --git a/rtexif/sonyminoltaattribs.cc b/rtexif/sonyminoltaattribs.cc index a49515020..2eb10520d 100644 --- a/rtexif/sonyminoltaattribs.cc +++ b/rtexif/sonyminoltaattribs.cc @@ -21,13 +21,9 @@ #include #include -#include #include -#include #include -#undef ABS -#define ABS(a) (((a) < 0) ? -(a) : (a)) namespace rtexif { @@ -41,6 +37,22 @@ class SAOnOffInterpreter : public ChoiceInterpreter { }; SAOnOffInterpreter saOnOffInterpreter; +class SAWhiteBalanceInterpreter: public ChoiceInterpreter { + public: + SAWhiteBalanceInterpreter(){ + choices[ 0x0] = "Auto"; + choices[ 0x1] = "Color Temperature/Color Filter"; + choices[0x10] = "Daylight"; + choices[0x20] = "Cloudy"; + choices[0x30] = "Shade"; + choices[0x40] = "Tungsten"; + choices[0x50] = "Flash"; + choices[0x60] = "Fluorescent"; + choices[0x70] = "Custom"; + } +}; +SAWhiteBalanceInterpreter saWhiteBalanceInterpreter; + class SASceneModeInterpreter : public ChoiceInterpreter { public: SASceneModeInterpreter () { @@ -144,11 +156,7 @@ class SAAntiBlurInterpreter : public ChoiceInterpreter { }; SAAntiBlurInterpreter saAntiBlurInterpreter; -class SALensIDInterpreter : public Interpreter { - typedef std::multimap container_t; - typedef std::pair p_t; - protected: - container_t choices; +class SALensIDInterpreter : public IntLensInterpreter< int > { public: SALensIDInterpreter () { choices.insert(p_t(0, "Minolta AF 28-85mm f/3.5-4.5")); @@ -457,71 +465,13 @@ class SALensIDInterpreter : public Interpreter { choices.insert(p_t(65535, "Helios 44-2 58mm f/2")); } - virtual std::string toString (Tag* t) { int lensID = t->toInt(); - size_t nFound = choices.count( lensID ); - container_t::iterator r; - switch( nFound ) - { - case 0: // lens Unknown - t->toString (buffer); - return std::string (buffer); - case 1: // lens found - r = choices.find ( lensID ); - return r->second; - default: - // More than one hit: we must guess - break; - } - - double maxApertureAtFocal = pow(2.0, t->getParent()->getParent()->getTag(0x9205)->toDouble()/2.0); // MaxApertureValue at focal Length - double focalLength = t->getParent()->getParent()->getTag(0x920A)->toDouble(); // Focal Length - double deltaMin = 1000.; - - /* Choose the best match: thanks to exiftool by Phil Harvey - * first throws for "out of focal range" and lower or upper aperture of the lens compared to MaxApertureAtFocal - * if the lens is not constant aperture, calculate aprox. aperture of the lens at focalLength - * and compare with actual aperture. - */ - std::string bestMatch("Unknown"); - std::ostringstream candidates; - for ( r = choices.lower_bound( lensID ); r != choices.upper_bound(lensID); r++ ){ - double a1,a2,f1,f2,lensAperture,dif; - - if( !extractLensInfo( r->second ,f1,f2,a1,a2) ) - continue; - if( f1 == 0. || a1 == 0.) - continue; - - if( focalLength < f1 - .5 || focalLength > f2 + 0.5 ) - continue; - if( maxApertureAtFocal < a1 - 0.15 || maxApertureAtFocal > a2 +0.15) - continue; - - if( a1 == a2 || f1 == f2) - lensAperture = a1; - else - lensAperture = exp( log(a1)+(log(a2)-log(a1))/(log(f2)-log(f1))*(log(focalLength)-log(f1)) ); - - dif = ABS(lensAperture - maxApertureAtFocal); - if( dif < deltaMin ){ - deltaMin = dif; - bestMatch = r->second; - } - if( dif < 0.15){ - if( candidates.tellp() ) - candidates << "\n or " << r->second; - else - candidates << r->second; - } - } - if( !candidates.tellp() ) - return bestMatch; - else - return candidates.str(); - } + double maxApertureAtFocal = pow(2.0, t->getParent()->getParent()->getTag(0x9205)->toDouble()/2.0); // MaxApertureValue at focal Length + double focalLength = t->getParent()->getParent()->getTag(0x920A)->toDouble(); // Focal Length + return guess( lensID, focalLength, maxApertureAtFocal ); + } }; SALensIDInterpreter saLensIDInterpreter; @@ -566,6 +516,240 @@ class MAImageSizeInterpreter : public ChoiceInterpreter { }; MAImageSizeInterpreter maImageSizeInterpreter; +class SAQualityInterpreter2 : public ChoiceInterpreter { + public: + SAQualityInterpreter2 () { + choices[0] = "Raw"; + choices[2] = "cRAW"; + choices[16] = "Extra fine"; + choices[32] = "Fine"; + choices[34] = "RAW + JPEG"; + choices[35] = "cRAW + JPEG"; + choices[48] = "Standard"; + } +}; +SAQualityInterpreter2 saQualityInterpreter2; + +class SADriveMode : public ChoiceInterpreter { + public: + SADriveMode () { + choices[0] = "Single Frame"; + choices[1] = "Continuous High"; + choices[4] = "Self-timer 10 sec"; + choices[5] = "Self-timer 2 sec"; + choices[7] = "Continuous Bracketing"; + choices[12] = "Continuous Low"; + choices[18] = "White Balance Bracketing Low"; + choices[19] = "D-Range Optimizer Bracketing Low"; + } +}; +SADriveMode saDriveMode; + +class SAFocusMode: public ChoiceInterpreter { + public: + SAFocusMode () { + choices[0] = "Manual"; + choices[1] = "AF-S"; + choices[2] = "AF-C"; + choices[3] = "AF-A"; + choices[4] = "Permanent-AF"; + choices[65535] = "n/a"; + } +}; +SAFocusMode saFocusMode; + +class SAAFMode: public ChoiceInterpreter { + public: + SAAFMode(){ + choices[0] = "Default"; + choices[1] = "Multi AF"; + choices[2] = "Center AF"; + choices[3] = "Spot AF"; + choices[4] = "Flexible Spot AF"; + choices[6] = "Touch AF"; + choices[14] = "Manual Focus"; + choices[15] = "Face Detected"; + choices[65535] = "n/a"; + } +}; +SAAFMode saAFMode; + +class SAAFAreaMode: public ChoiceInterpreter { + public: + SAAFAreaMode () { + choices[0] = "Wide"; + choices[1] = "Local"; + choices[2] = "Spot"; + } +}; +SAAFAreaMode saAFAreaMode; + +class SALocalAFAreaPoint: public ChoiceInterpreter { + public: + SALocalAFAreaPoint () { + choices[1] = "Center"; + choices[2] = "Top"; + choices[3] = "Top-Right"; + choices[4] = "Right"; + choices[5] = "Bottom-Right"; + choices[6] = "Bottom"; + choices[7] = "Bottom-Left"; + choices[8] = "Left"; + choices[9] = "Top-Left"; + choices[10] = "Far Right"; + choices[11] = "Far Left"; + } +}; +SALocalAFAreaPoint saLocalAFAreaPoint; + +class SAMeteringMode: public ChoiceInterpreter { + public: + SAMeteringMode () { + choices[1] = "Multi-segment"; + choices[2] = "Center-weighted Average"; + choices[4] = "Spot"; + } +}; +SAMeteringMode saMeteringMode; + +class SADynamicRangeOptimizerMode: public ChoiceInterpreter { + public: + SADynamicRangeOptimizerMode () { + choices[0] = "Off"; + choices[1] = "Standard"; + choices[2] = "Advanced Auto"; + choices[3] = "Advanced Level"; + choices[4097] = "Auto"; + } +}; +SADynamicRangeOptimizerMode saDynamicRangeOptimizerMode; + +class SACreativeStyle: public ChoiceInterpreter { + public: + SACreativeStyle () { + choices[1] = "Standard"; + choices[2] = "Vivid"; + choices[3] = "Portrait"; + choices[4] = "Landscape"; + choices[5] = "Sunset"; + choices[6] = "Night View/Portrait"; + choices[8] = "B&W"; + choices[9] = "Adobe RGB"; + choices[11] = "Neutral"; + choices[12] = "Clear"; + choices[13] = "Deep"; + choices[14] = "Light"; + choices[15] = "Autumn"; + choices[16] = "Sepia"; + } +}; +SACreativeStyle saCreativeStyle; + +class SAFlashMode: public ChoiceInterpreter { + public: + SAFlashMode () { + choices[0] = "ADI"; + choices[1] = "TTL"; + } +}; +SAFlashMode saFlashMode; + +class SAExposureProgram: public ChoiceInterpreter { + public: + SAExposureProgram () { + choices[0] = "Auto"; + choices[1] = "Manual"; + choices[2] = "Program AE"; + choices[3] = "Aperture-priority AE"; + choices[4] = "Shutter speed priority AE"; + choices[8] = "Program Shift A"; + choices[9] = "Program Shift S"; + choices[16] = "Portrait"; + choices[17] = "Sports"; + choices[18] = "Sunset"; + choices[19] = "Night Portrait"; + choices[20] = "Landscape"; + choices[21] = "Macro"; + choices[35] = "Auto No Flash"; + } +}; +SAExposureProgram saExposureProgram; + +class SARotation: public ChoiceInterpreter { + public: + SARotation () { + choices[0] = "Horizontal"; + choices[1] = "Rotate 90 CW"; + choices[2] = "Rotate 270 CW"; + choices[3] = "None"; + } +}; +SARotation saRotation; + +class SASonyImageSize: public ChoiceInterpreter { + public: + SASonyImageSize () { + choices[1] = "Large"; + choices[2] = "Medium "; + choices[3] = "Small"; + } +}; +SASonyImageSize saSonyImageSize; + +class SAAspectRatio: public ChoiceInterpreter { + public: + SAAspectRatio () { + choices[1] = "3:2"; + choices[2] = "16:9"; + } +}; +SAAspectRatio saAspectRatio; + +class SAExposureLevelIncrements: public ChoiceInterpreter { + public: + SAExposureLevelIncrements () { + choices[33] = "1/3 EV"; + choices[50] = "1/2 EV"; + } +}; +SAExposureLevelIncrements saExposureLevelIncrements; + +class SAAFIlluminator: public ChoiceInterpreter { + public: + SAAFIlluminator () { + choices[0] = "Off"; + choices[1] = "Auto"; + choices[65535]="n/a"; + } +}; +SAAFIlluminator saAFIlluminator; + +class SAReleaseModeInterpreter: public ChoiceInterpreter { + public: + SAReleaseModeInterpreter () { + choices[0] = "Normal"; + choices[2] = "Burst"; + choices[5] = "Exposure Bracketing"; + choices[6] = "White Balance Bracketing"; + choices[65535]="n/a"; + } +}; +SAReleaseModeInterpreter saReleaseModeInterpreter; + +class SAImageStyleInterpreter: public ChoiceInterpreter { + public: + SAImageStyleInterpreter () { + choices[1] = "Standard"; + choices[2] = "Vivid"; + choices[9] = "Adobe RGB"; + choices[11] = "Neutral"; + choices[129]="StyleBox1"; + choices[130]="StyleBox2"; + choices[131]="StyleBox3"; + } +}; +SAImageStyleInterpreter saImageStyleInterpreter; + const TagAttrib minoltaAttribs[] = { 0, 1, 0, 0, 0x0000, "MakerNoteVersion", &stdInterpreter, 0, 1, 0, 0, 0x0001, "MinoltaCameraSettingsOld", &stdInterpreter, @@ -593,8 +777,14 @@ const TagAttrib minoltaAttribs[] = { -1, 0, 0, 0, 0, "", NULL}; const TagAttrib sonyAttribs[] = { + 0, 1, 0, 0, 0x0102, "Quality", &maQualityInterpreter, + 0, 1, 0, 0, 0x0104, "FlashExposureComp",&stdInterpreter, + 0, 1, 0, 0, 0x0106, "TeleConverter", &maTeleconverterInterpreter, + 0, 1, 0, sonyCameraSettingsAttribs, 0x0114, "SonyCameraSettings",&stdInterpreter, + 0, 1, 0, 0, 0x0115, "WhiteBalance",&saWhiteBalanceInterpreter, 1, 1, 0, 0, 0x0e00, "PrintIM", &stdInterpreter, 1, 1, 0, 0, 0x2001, "PreviewImage", &stdInterpreter, + 0, 1, 0, 0, 0x200a, "AutoHDR", &stdInterpreter, 0, 1, 0, 0, 0xb020, "ColorReproduction", &stdInterpreter, 0, 1, 0, 0, 0xb021, "ColorTemperature", &stdInterpreter, 0, 1, 0, 0, 0xb023, "SceneMode", &saSceneModeInterpreter, @@ -606,11 +796,66 @@ const TagAttrib sonyAttribs[] = { 0, 1, 0, 0, 0xb029, "ColorMode", &saColorModeInterpreter, 0, 1, 0, 0, 0xb040, "Macro", &saOnOffInterpreter, 0, 1, 0, 0, 0xb041, "ExposureMode", &saExposureModeInterpreter, + 0, 1, 0, 0, 0xb042, "FocusMode", &saFocusMode, + 0, 1, 0, 0, 0xb043, "AFMode", &saAFMode, + 0, 1, 0, 0, 0xb044, "AFIlluminator", &saAFIlluminator, 0, 1, 0, 0, 0xb047, "Quality", &saQualityInterpreter, + 0, 1, 0, 0, 0xb049, "ReleaseMode",&saReleaseModeInterpreter, 0, 1, 0, 0, 0xb04b, "AntiBlur", &saAntiBlurInterpreter, 0, 1, 0, 0, 0xb04e, "LongExposureNoiseReduction", &saOnOffInterpreter, -1, 0, 0, 0, 0, "", NULL}; +const TagAttrib sonyCameraSettingsAttribs[]={ +0, 1, 0, 0, 4, "DriveMode", &saDriveMode, +0, 1, 0, 0, 6, "WhiteBalanceFineTune",&stdInterpreter, +0, 1, 0, 0, 16, "FocusMode",&saFocusMode, +0, 1, 0, 0, 17, "AFAreaMode",&saAFAreaMode, +0, 1, 0, 0, 18, "LocalAFAreaPoint", &saLocalAFAreaPoint, +0, 1, 0, 0, 21, "MeteringMode",&saMeteringMode, +0, 1, 0, 0, 22, "ISOSetting",&stdInterpreter, +0, 1, 0, 0, 24, "DynamicRangeOptimizerMode", &saDynamicRangeOptimizerMode, +0, 1, 0, 0, 25, "DynamicRangeOptimizerLevel",&stdInterpreter, +0, 1, 0, 0, 26, "CreativeStyle",&saCreativeStyle, +0, 1, 0, 0, 28, "Sharpness",&stdInterpreter, +0, 1, 0, 0, 29, "Contrast",&stdInterpreter, +0, 1, 0, 0, 30, "Saturation",&stdInterpreter, +0, 1, 0, 0, 31, "ZoneMatchingValue",&stdInterpreter, +0, 1, 0, 0, 34, "Brightness",&stdInterpreter, +0, 1, 0, 0, 35, "FlashMode",&saFlashMode, +0, 1, 0, 0, 40, "PrioritySetupShutterRelease",&stdInterpreter, +0, 1, 0, 0, 41, "AFIlluminator",&saAFIlluminator, +0, 1, 0, 0, 42, "AFWithShutter",&saOnOffInterpreter, +0, 1, 0, 0, 43, "LongExposureNoiseReduction",&saOnOffInterpreter, +0, 1, 0, 0, 44, "HighISONoiseReduction",&stdInterpreter, +0, 1, 0, 0, 45, "ImageStyle",&saImageStyleInterpreter, +0, 1, 0, 0, 60, "ExposureProgram",&saExposureProgram, +0, 1, 0, 0, 61, "ImageStabilization",&saOnOffInterpreter, +0, 1, 0, 0, 63, "Rotation",&saRotation, +0, 1, 0, 0, 84, "SonyImageSize",&saSonyImageSize, +0, 1, 0, 0, 85, "AspectRatio",&saAspectRatio, +0, 1, 0, 0, 86, "Quality",&saQualityInterpreter2, +0, 1, 0, 0, 88, "ExposureLevelIncrements",&saExposureLevelIncrements, +-1, 0, 0, 0, 0, "", NULL}; + +const TagAttrib sonyCameraSettingsAttribs2[]={ +0, 1, 0, 0, 16, "FocusMode",&saFocusMode, +0, 1, 0, 0, 17, "AFAreaMode",&saAFAreaMode, +0, 1, 0, 0, 18, "LocalAFAreaPoint",&saLocalAFAreaPoint, +0, 1, 0, 0, 19, "MeteringMode",&saMeteringMode, +0, 1, 0, 0, 20, "ISOSetting",&stdInterpreter, +0, 1, 0, 0, 22, "DynamicRangeOptimizerMode",&saDynamicRangeOptimizerMode, +0, 1, 0, 0, 23, "DynamicRangeOptimizerLevel",&stdInterpreter, +0, 1, 0, 0, 24, "CreativeStyle",&saCreativeStyle, +0, 1, 0, 0, 25, "Sharpness",&stdInterpreter, +0, 1, 0, 0, 26, "Contrast",&stdInterpreter, +0, 1, 0, 0, 27, "Saturation",&stdInterpreter, +0, 1, 0, 0, 35, "FlashMode",&saFlashMode, +0, 1, 0, 0, 60, "ExposureProgram",&saExposureProgram, +0, 1, 0, 0, 63, "Rotation",&saRotation, +0, 1, 0, 0, 84, "SonyImageSize",&saSonyImageSize, +-1, 0, 0, 0, 0, "", NULL}; + }; #endif + diff --git a/rtexif/stdattribs.cc b/rtexif/stdattribs.cc index f4f049b66..641d32202 100644 --- a/rtexif/stdattribs.cc +++ b/rtexif/stdattribs.cc @@ -32,6 +32,7 @@ class ColorSpaceInterpreter : public ChoiceInterpreter { public: ColorSpaceInterpreter () { choices[1] = "sRGB"; + choices[2] = "Adobe RGB"; choices[0xffff] = "Uncalibrated"; } }; @@ -324,30 +325,64 @@ class UserCommentInterpreter : public Interpreter { }; UserCommentInterpreter userCommentInterpreter; +class CFAInterpreter : public Interpreter { +public: + CFAInterpreter(){} + virtual std::string toString (Tag* t) { + char colors[]="RGB"; + for( int i=0; i< t->getCount();i++){ + unsigned char c = t->toInt(i,BYTE); + buffer[i]= c<3 ?colors[c]:' '; + } + buffer[t->getCount()]=0; + return buffer; + } +}; +CFAInterpreter cfaInterpreter; + +class OrientationInterpreter : public ChoiceInterpreter { +public: + OrientationInterpreter (){ + choices[1] = "Horizontal (normal)"; + choices[2] = "Mirror horizontal "; + choices[3] = "Rotate 180"; + choices[4] = "Mirror vertical"; + choices[5] = "Mirror horizontal and rotate 270 CW"; + choices[6] = "Rotate 90 CW"; + choices[7] = "Mirror horizontal and rotate 90 CW"; + choices[8] = "Rotate 270 CW"; + } +}; +OrientationInterpreter orientationInterpreter; + +class UnitsInterpreter : public ChoiceInterpreter { +public: + UnitsInterpreter(){ + choices[0] = "Unknown"; + choices[1] = "inches"; + choices[2] = "cm"; + } +}; +UnitsInterpreter unitsInterpreter; + const TagAttrib exifAttribs[] = { + 0, 2, 0, 0, 0x0100, "ImageWidth", &stdInterpreter, + 0, 2, 0, 0, 0x0101, "ImageHeight", &stdInterpreter, + 0, 2, 0, 0, 0x0102, "BitsPerSample", &stdInterpreter, 0, 2, 0, 0, 0x0103, "Compression", &compressionInterpreter, - 0, 2, 0, 0, 0xA000, "FlashpixVersion", &stdInterpreter, - 0, 2, 0, 0, 0xA001, "ColorSpace", &colorSpaceInterpreter, - 0, 1, 0, 0, 0x9000, "ExifVersion", &stdInterpreter, - 0, 1, 0, 0, 0x9003, "DateTimeOriginal", &stdInterpreter, - 0, 1, 0, 0, 0x9004, "DateTimeDigitized", &stdInterpreter, - 0, 2, 0, 0, 0x9101, "ComponentsConfiguration", &stdInterpreter, - 0, 2, 0, 0, 0x9102, "CompressedBitsPerPixel", &stdInterpreter, - 0, 2, 0, 0, 0xA002, "PixelXDimension", &stdInterpreter, - 0, 2, 0, 0, 0xA003, "PixelYDimension", &stdInterpreter, - 0, 1, 0, 0, 0x927C, "MakerNote", &stdInterpreter, - 0, 1, 1, 0, 0x9286, "UserComment", &userCommentInterpreter, - 1, 0, 0, 0, 0xA004, "RelatedSoundFile", &stdInterpreter, - 0, 1, 0, 0, 0x9290, "SubSecTime", &stdInterpreter, - 0, 1, 0, 0, 0x9291, "SubSecTimeOriginal", &stdInterpreter, - 0, 1, 0, 0, 0x9292, "SubSecTimeDigitized", &stdInterpreter, - 0, 1, 0, 0, 0xA420, "ImageUniqueID", &stdInterpreter, + 0, 1, 0, 0, 0x828d, "CFAPatternDim", &stdInterpreter, + 0, 1, 0, 0, 0x828e, "CFAPattern", &cfaInterpreter, 0, 1, 0, 0, 0x829A, "ExposureTime", &exposureTimeInterpreter, 0, 1, 0, 0, 0x829D, "FNumber", &fNumberInterpreter, 0, 1, 0, 0, 0x8822, "ExposureProgram", &exposureProgramInterpreter, 0, 1, 0, 0, 0x8824, "SpectralSensitivity", &stdInterpreter, 0, 1, 0, 0, 0x8827, "ISOSpeedRatings", &stdInterpreter, 0, 1, 0, 0, 0x8828, "OECF", &stdInterpreter, + 0, 1, 0, 0, 0x9000, "ExifVersion", &stdInterpreter, + 0, 1, 0, 0, 0x9003, "DateTimeOriginal", &stdInterpreter, + 0, 1, 0, 0, 0x9004, "DateTimeDigitized", &stdInterpreter, + 0, 2, 0, 0, 0x9101, "ComponentsConfiguration", &stdInterpreter, + 0, 2, 0, 0, 0x9102, "CompressedBitsPerPixel", &stdInterpreter, 0, 1, 0, 0, 0x9201, "ShutterSpeedValue", &shutterSpeedInterpreter, 0, 1, 0, 0, 0x9202, "ApertureValue", &apertureInterpreter, 0, 1, 0, 0, 0x9203, "BrightnessValue", &stdInterpreter, @@ -361,6 +396,17 @@ const TagAttrib exifAttribs[] = { 0, 1, 0, 0, 0x9214, "SubjectArea", &stdInterpreter, 0, 0, 0, 0, 0x9216, "TIFFEPSStandardID", &stdInterpreter, 0, 1, 0, 0, 0x9217, "SensingMethod", &stdInterpreter, + 0, 1, 0, 0, 0x927C, "MakerNote", &stdInterpreter, + 0, 1, 1, 0, 0x9286, "UserComment", &userCommentInterpreter, + 0, 1, 0, 0, 0x9290, "SubSecTime", &stdInterpreter, + 0, 1, 0, 0, 0x9291, "SubSecTimeOriginal", &stdInterpreter, + 0, 1, 0, 0, 0x9292, "SubSecTimeDigitized", &stdInterpreter, + 0, 2, 0, 0, 0xA000, "FlashpixVersion", &stdInterpreter, + 0, 0, 0, 0, 0xA001, "ColorSpace", &colorSpaceInterpreter, + 0, 2, 0, 0, 0xA002, "PixelXDimension", &stdInterpreter, + 0, 2, 0, 0, 0xA003, "PixelYDimension", &stdInterpreter, + 1, 0, 0, 0, 0xA004, "RelatedSoundFile", &stdInterpreter, + 0, 1, 0, iopAttribs, 0xA005, "Interoperability", &stdInterpreter, 0, 1, 0, 0, 0xA20B, "FlashEnergy", &stdInterpreter, 0, 1, 0, 0, 0xA20C, "SpatialFrequencyResponse", &stdInterpreter, 0, 1, 0, 0, 0xA20E, "FocalPlaneXResolution", &stdInterpreter, @@ -371,7 +417,7 @@ const TagAttrib exifAttribs[] = { 0, 1, 0, 0, 0xA217, "SensingMethod", &stdInterpreter, 0, 1, 0, 0, 0xA300, "FileSource", &stdInterpreter, 0, 1, 0, 0, 0xA301, "SceneType", &stdInterpreter, - 0, 0, 0, 0, 0xA302, "CFAPattern", &stdInterpreter, + 0, 0, 0, 0, 0xA302, "CFAPattern", &cfaInterpreter, 0, 1, 0, 0, 0xA401, "CustomRendered", &stdInterpreter, 0, 1, 0, 0, 0xA402, "ExposureMode", &exposureModeInterpreter, 0, 1, 0, 0, 0xA403, "WhiteBalance", &whiteBalanceInterpreter, @@ -384,10 +430,9 @@ const TagAttrib exifAttribs[] = { 0, 1, 0, 0, 0xA40A, "Sharpness", &sharpnessInterpreter, 0, 1, 0, 0, 0xA40B, "DeviceSettingDescription", &stdInterpreter, 0, 1, 0, 0, 0xA40C, "SubjectDistanceRange", &stdInterpreter, - 0, 0, 0, 0, 0x828d, "CFAPattern", &stdInterpreter, - 0, 0, 0, 0, 0x828e, "CFARepeatPatternDim", &stdInterpreter, + 0, 1, 0, 0, 0xA420, "ImageUniqueID", &stdInterpreter, -1, 0, 0, 0, 0, "", NULL }; -// 0, 0xA005, LONG, 1, "Interoperability tag", "Interoperability IFD Pointer"}; + const TagAttrib gpsAttribs[] = { 0, 1, 0, 0, 0x0000, "GPSVersionID", &stdInterpreter, @@ -423,8 +468,6 @@ const TagAttrib gpsAttribs[] = { 0, 1, 0, 0, 0x001e, "GPSDifferential", &stdInterpreter, -1, 0, 0, 0, 0, "", NULL }; - - const TagAttrib iopAttribs[] = { 0, 1, 0, 0, 0x0001, "InteroperabilityIndex", &stdInterpreter, 0, 1, 0, 0, 0x0002, "InteroperabilityVersion", &stdInterpreter, @@ -437,30 +480,35 @@ const TagAttrib iopAttribs[] = { 0, 2, 0, 0, 0x0102, "BitsPerSample", &stdInterpreter, 0, 2, 0, 0, 0x0103, "Compression", &compressionInterpreter, 0, 2, 0, 0, 0x0106, "PhotometricInterpretation", &photometricInterpreter, - 0, 2, 0, 0, 0x0112, "Orientation", &stdInterpreter, - 0, 2, 0, 0, 0x0115, "SamplesPerPixel", &stdInterpreter, - 0, 2, 0, 0, 0x011C, "PlanarConfiguration", &planarConfigInterpreter, - 0, 2, 0, 0, 0x0212, "YCbCrSubSampling", &stdInterpreter, - 0, 2, 0, 0, 0x0213, "YCbCrPositioning", &stdInterpreter, - 0, 2, 0, 0, 0x011A, "XResolution", &stdInterpreter, - 0, 2, 0, 0, 0x011B, "YResolution", &stdInterpreter, - 0, 2, 0, 0, 0x0128, "ResolutionUnit", &stdInterpreter, - 1, 0, 0, 0, 0x0111, "StripOffsets", &stdInterpreter, - 1, 0, 0, 0, 0x0116, "RowsPerStrip", &stdInterpreter, - 1, 0, 0, 0, 0x0117, "StripByteCounts", &stdInterpreter, - 0, 2, 0, 0, 0x0201, "JPEGInterchangeFormat", &stdInterpreter, - 0, 2, 0, 0, 0x0202, "JPEGInterchangeFormatLength", &stdInterpreter, - 0, 2, 0, 0, 0x012D, "TransferFunction", &stdInterpreter, - 0, 2, 0, 0, 0x013E, "WhitePoint", &stdInterpreter, - 0, 2, 0, 0, 0x013F, "PriomaryChromaticities", &stdInterpreter, - 0, 2, 0, 0, 0x0211, "YCbCrCoefficients", &stdInterpreter, - 0, 2, 0, 0, 0x0214, "ReferenceBlackWhite", &stdInterpreter, - 0, 1, 0, 0, 0x0132, "DateTime", &stdInterpreter, 0, 1, 1, 0, 0x010E, "ImageDescription", &stdInterpreter, 0, 1, 0, 0, 0x010F, "Make", &stdInterpreter, 0, 1, 0, 0, 0x0110, "Model", &stdInterpreter, + 1, 0, 0, 0, 0x0111, "StripOffsets", &stdInterpreter, + 0, 2, 0, 0, 0x0112, "Orientation", &orientationInterpreter, + 0, 2, 0, 0, 0x0115, "SamplesPerPixel", &stdInterpreter, + 1, 0, 0, 0, 0x0116, "RowsPerStrip", &stdInterpreter, + 1, 0, 0, 0, 0x0117, "StripByteCounts", &stdInterpreter, + 0, 2, 0, 0, 0x011A, "XResolution", &stdInterpreter, + 0, 2, 0, 0, 0x011B, "YResolution", &stdInterpreter, + 0, 2, 0, 0, 0x011C, "PlanarConfiguration", &planarConfigInterpreter, + 0, 2, 0, 0, 0x0128, "ResolutionUnit", &unitsInterpreter, + 0, 2, 0, 0, 0x012D, "TransferFunction", &stdInterpreter, 0, 2, 0, 0, 0x0131, "Software", &stdInterpreter, + 0, 1, 0, 0, 0x0132, "DateTime", &stdInterpreter, 0, 1, 1, 0, 0x013B, "Artist", &stdInterpreter, + 0, 2, 0, 0, 0x013E, "WhitePoint", &stdInterpreter, + 0, 2, 0, 0, 0x013F, "PriomaryChromaticities", &stdInterpreter, + 0, 1, 0, ifdAttribs, 0x014A, "SubIFD", &stdInterpreter, + 0, 2, 0, 0, 0x0201, "JPEGInterchangeFormat", &stdInterpreter, + 0, 2, 0, 0, 0x0202, "JPEGInterchangeFormatLength", &stdInterpreter, + 0, 2, 0, 0, 0x0211, "YCbCrCoefficients", &stdInterpreter, + 0, 2, 0, 0, 0x0212, "YCbCrSubSampling", &stdInterpreter, + 0, 2, 0, 0, 0x0213, "YCbCrPositioning", &stdInterpreter, + 0, 2, 0, 0, 0x0214, "ReferenceBlackWhite", &stdInterpreter, + 0, 1, 0, 0, 0x4746, "Rating",&stdInterpreter, + 0, 1, 0, 0, 0x4749, "RatingPercent",&stdInterpreter, + 0, 1, 0, 0, 0x828d, "CFAPatternDim", &stdInterpreter, + 0, 1, 0, 0, 0x828e, "CFAPattern", &cfaInterpreter, 0, 1, 1, 0, 0x8298, "Copyright", &stdInterpreter, 0, 1, 0, exifAttribs, 0x8769, "Exif", &stdInterpreter, 0, 2, 0, 0, 0x8773, "ICCProfile", &stdInterpreter, @@ -469,7 +517,6 @@ const TagAttrib iopAttribs[] = { 0, 1, 0, 0, 0x9003, "DateTimeOriginal", &stdInterpreter, 0, 1, 0, 0, 0x9004, "DateTimeDigitized", &stdInterpreter, 0, 1, 0, iopAttribs, 0xA005, "Interoperability", &stdInterpreter, - 1, 2, 0, ifdAttribs, 0x014A, "SubIFD", &stdInterpreter, 0, 0, 0, 0, 0xC4A5, "PrintIMInformation", &stdInterpreter, 0, 2, 0, 0, 0x00fe, "NewSubFileType", &stdInterpreter, -1, 0, 0, 0, 0, "", NULL}; diff --git a/rtgui/exifpanel.cc b/rtgui/exifpanel.cc index 92464029d..3b0a6dac2 100644 --- a/rtgui/exifpanel.cc +++ b/rtgui/exifpanel.cc @@ -205,7 +205,7 @@ void ExifPanel::addDirectory (const TagDirectory* dir, Gtk::TreeModel::Children addDirectory (t->getDirectory(j), ch); } else - addTag (root, t->nameToString (), t->valueToString (), t->getAttrib() ? t->getAttrib()->action : 0, t->getAttrib() && t->getAttrib()->editable); + addTag (root, t->nameToString (), t->valueToString (), t->getAttrib() ? (t->getOwnMemory()?t->getAttrib()->action:SYSTEM) : 0, t->getAttrib() && t->getAttrib()->editable); } }