From 73efa4515c23c1627e460d531f032ae2ec835c1a Mon Sep 17 00:00:00 2001 From: Alexander Steffen Date: Wed, 9 Dec 2020 11:56:58 +0100 Subject: [PATCH 01/17] Add test for all known Canon lenses Generates a test case for every known lens from canonCsLensType, that first sets the corresponding lens metadata and then verifies that exiv2 maps it to the expected lens description. Only metadata fields that are relevant for lens identification are modified. --- test/data/template.exv | Bin 0 -> 12027 bytes tests/bugfixes/github/test_canon_lenses.py | 390 +++++++++++++++++++++ 2 files changed, 390 insertions(+) create mode 100644 test/data/template.exv create mode 100644 tests/bugfixes/github/test_canon_lenses.py diff --git a/test/data/template.exv b/test/data/template.exv new file mode 100644 index 0000000000000000000000000000000000000000..9163325146ff137c79f388c2bdebcf4d8a9f12c9 GIT binary patch literal 12027 zcmeHrXIK==wsuc|A?HCdC@2yn=O7@GB@0Lf2PBMSkRVA!MU*Teh=2r10-_*@0tT`K zMY4iKiRzFud^Lc3bMAMZ`|SILf2VqC>g`qUT2*URcU5)m!c_d6u88c82;cy?1VI`a zybuutLF5o63=R zA|xyWp{ zZmwPeZk`T;mz^;7u3q+Df*1V-MFoTe?dAj{Yc#dA$fFwQvv3V*!SEH z-+U|zLV`j_L_`=7yC11+z(F41N`PT;`y3cPV(}z_T~Gr;f>WbBX1 z5*SvB%>6!$159~<=K!Y4+_wXof?(PE7(fVqfbrvlI3y=Lgz-Fly(0LN0woE^|89)_ zoeZ+UKgoD)f`fAZ4j*g0lm+}FAVGl6fUv^>#z!AG1WE*S6yQ972|*19z%u}&4loHY zNCa4TEBHiwAm;^gvI99O?gkmv0cL>#iSkOiALM8({7=S$i&H#M;JG6tszo&@3_mv4aT?X(U`@;ZJ1I`H`hbbbU zQQ(ICs(3&>@59@Dn7`76kqnltKTE0tW2m zfmu0;z860U{YxT*!0H3o$}kX9PaObVe2s7NLGoEK_X4#_*FfGJ!A({Wp39WV;9lAftfCBjb@x@F;ZG9uJAqqZ1;* zYcvyFV7^6+M|y|savWUct;%^Q6J>C_<_w;|u{wbQ+i{vWe zE7dm~5Q2)EaW@P$1;5N8vl|bqgI{3w*e!2)9p8%*J}PL44dMs8GfuE}9s&RK5Hr}%fyLpk#0>F* z)r<=gf+Qdrz-9wHTEN>+tYCHHfJ7lVNC7$xoq+_v9RsLGgN#osK=U}n1Kv{=pnV2X zg2W+iuoANXJvLC!3CV-?1qAwqCM_oBAr3%96C1<%VElXg96STB4}%_Y`x4op?x3y`+#~dcE5Z!H ze7o;I9MmGAdag;dFrzB17uB}VAW061E3yrG0Nnxlu~0Sif!+zMz2IX6TyrGDl<_QC zR5T!#LR5B?zjtePKjQ-hLhv{N?BgmR2wMw5?(KLskRO^{ciABrJ_9LOgu>vyur`q|Y5nK#KN0v(1pX6&!x6X!;jjOs|Jw+FBapum{`_Ju zQQ^Ot|4U-Te<%JI*?(^TpGP3H)ChWk|HL{f4b_0pIs7>e{v!o~45Xz1I&=a?wSSI+ zKlOqi;6EdTU%2tRh5au`P=M1H1Zw6b9cvLrTHhKfpSS zcw2v;SpGS=-0j=_3bw2WI2`{22?>4#L<9s#BmoHuMMy+OLPkbPLP|?Q_M~&p+UL_>G&lB5p^ zW#um`DqmH-|4>)o(Ad=6()p#UyQjCWe_&*EY<%L!x8c6 zf@ku=7srhod}Y``S=_mrV_i1ow>1PlNU;_!NsgFYLxpciyD?f;D)N<31|(W+uvAth zIdcb5-OY2YoHg=cu3Uh}6a^tUyBU;NE>-xwT(!C+U3f)O&zZg`RuX1?s@{*X$i_du zo7Fpey30VgvmaA!Lr93d@HL|4*|hZ|cSG-)uIp26izdOQOvW?CgoNZ5cptkfmV7m+ zI_;g6H?^`6e(q_;cz{XV+TyT4`si6t8?}y2@$lgkQOEV9QQf)dmrndIjW;!#-=Y`O zN^vIEoy8NnFX9V4rAl~nWG`PF!`yqQTlq!c&7Fu89@y0Tip$okKJUbAkEP|dW6?2U zYBp16e?)#J+hl5AYsQqNb-%+(xJcwpqL96Wgn@DKr!!NFA^t$at>Zv^3END zUt%emEo%?o&aas-$UxZ_Vhn$jpL$+-Ee$2)Dvo<@z|<&~v+6GwDr zRn>*6*p#q`W+F>oTaUFhlOF5k1fuzQb5msQFA>jY@q0N!Itzq%JNyKc3G8A z_m0Z5_F*dH8jZ zgZ4w=usXKx_09RLk-9YIE~^=arn?E1Fe}$%k|x4=WpV*)6WVr?L*nmW3Y(MJs_1nT zUhy|Ubyk}U%T3kDJRiE&SnIsr63}~nQO!sCY7x8Z(CkMf5w$D@Us_Es7r(Vrhx6t} zz?6$7&o85jv{8dgNjFyW#QD~lM6PoVyyhuvX*5a*VCUcRo=;5tUKg^a=0me+x(i)m zc8ODHPtZ!@FT86<5V4>%j*%{k=~uR>ty;79x6R{eLW&q(1)FI?fY0w z=@>iXjN!m{ZMR%bEeEV?^c7VR#fvCL&eXIJG7O(t@6ykJg>Ih-tyy!wH`P6Fm8FbP zHv-voLhf)zV+Zb*RVXiAmOp9mAx}*!IH;ZQgIU5zM~oQuC!6sbdXrFd**p{BNiv3j z;W+CjOvaUN{6#+kV}#N3({U*+TBt1D39}lLWUpyDP-!-3V%<=dY*r{SZ z8|O`ukSMR>$KIF@Q^}h?Lc?YAD7#nO$lF0IIM^?~xol8%bnqsLFk<=w(#z^}p(+}2~OB93Kl9;=jCfYpCPQ)|8T5FBeXCCNZ6nN<#+3*C~D{cK`fN|{oDADQp z+d*21-cD%~zDJ{^mWtIHPPDITzAEoh!fIT^97QD}SRy0%+C(RXoT_jYUc=QCGef`i zx_;@=x^OKJydS5!kVsfG+aEUEs&Ncc`RGFl$4*91#j0!Yb?u$;THNfM=$097FfDVT z8RH?*j4`~%nXteYP&{|3W=`8!>oQVWCzPVACqHXk)OhfGT94SNa*eLA`m;NnLiYFQ&Z)tJgk~4JhEV}lFFG$o{oY7NT>xKBW4Z#uCbIu#b%bTSsLVL|I zu9!Q)B2Q|DyjH2dkQ?20buqs1k=t4mw+qFbKKTmg5EiIZc=q;WUtgOCRc!3jneb5c z)gt$0*Eu(BD<}3?PxVz3P16_Od%0OdI*NiMH<@O=1fx$p$2QxQ#doTA4yKQr5Li&j zy0b49H&vT1myZR?t4yr3+cSEw(c`!=1%-aYmu>$T)<$Im*r21W_>tZ}YY zPE<5DGk(VJm65p2R>$LcwXobs!(%OL6s?;m9gpac(+cm)ed_$h-s-Uym}E?H?LyJc zhHofe;E(y=M3h=+N%~0WYbGgcvL#S+Tsr%s8Qsb<3phf}NO~b~VlhqwDt%Ebi zenvkp`c7CzQ9Ax)Zrnt!LQdz2Wk*E#FT-koxB6N%skV#}c^QFtvr%7r06V>3ARN0RFvSFP4MD_g87EYJ6q{*Mf4Ck-p%U0;l%K8pCgf5Fo62Yi(bs__ zLPyme#>rzf;k1qDg1bwsd^4PeDXBpe1y>nqWX8x+5XdpXCfBmR4o0GZY#kTmf7;ea6p#-~~Y){XQ4wQ5^txRo9 z90~D@PTkm^*^qMXD8i=P?M>KHpjUkIEU%TCu zr<15z)aW~jJ6_d0u!pYZi_e)wGU5taPKAs3OTHREVW*XUM=H&fy@FAEv817v zVLL;P=Y*C=y?ajp%QE9g)FMlYlNGkzL7MJPJ>A=7c~PT5rbTm{v$ErlH!{y&3kWKI z53$pw>!7UTv?&fuHt}E_6JMR!ig-C&Hc?oU^sYqtWprM|^t>~DKLe%pso?KF^QLQG zwCB2V_`6)Heo50pRHvv;#O3=DQeYZ?*R{QMaWgHI)1NOrna5ZD+m6%a*f1eVIm}SC z)=FTN_gcw_wv227WqO`@g%vR*4U$twHXwt9j@0WsB=Q%%kOhH3QfuReS_>Je-pLyA@^vY^P6Q7Y-?FKwvIYXsyHA{KY+2a z|8C-GGd?lS>`u35*HZ>7YPb>7;*;&CaS5d>lylc`%Rfsny~WStE8k!5GwJhP9gmG$ z2rA6fAJ^R0H3;`UDpPj9UeS{>VE*@4Jyz_B?R=yV4MRL};})S`8%Fc4^q6>c?~efC z;03kuA1TVM3^9qitr^RV<0eHrZB+q-fgZSED)N-OCanI)MC^7n(%;uS=dR9umaq^K zx4}1G@U!If5x;naSg!lo_Fo-YqBVY6r+lY+%KdrSq5SHDVncWDS1&Q;H`PvOEJhAd z;9MB&Nvw_X#y;;takpjojpvLNCzKw%uuB$Ek{jMk^XPmo&X;2=c+~TetncLd`Hz_H z#BPc2hJfx+#}ra`d{I;6jtO;*I(h1F9;e(`4c|%A-kUdviz z(>K*O2WaZwGAx&{tlb&wn;VOxQB+`RF!(h8_0wYdO>2gwU5IQg#<=>;%OjFEyX&)y zgD;H#w7wktE?BNt&TF{M+-RQsTSf21#g^Nw5}^;3kZfZKR#y|IR3v>d)8CoQPUMeh zYo56KWR2B5sH=Bmrvkg8?Q0MkeeqSCko<$l$mn0Ag`XbFjA*0zFr;a-xXqOd^STlC z{UXdkx%UyA=%tQO1x%2r_Jy3TBW-c+8m`#SxnUZMU9wpkYNqLDrcRT*{CpWxUaF7u zSYY*kLGDUi4*J#d3U--w2dmcjM=ZzvgFF^sGyEbhAsa2TklIKW+d1I zZjw52c}w6Ll+k)b(#PJcjZU{)#08`@+#Puu<2&Dz@zRRD=KdLYwm{?QP^K;UUe{i| zd5T=`^eb1B?by$Z_awc(ByJp$!)s5RnIippQ{~CjeY5i+uZ_q8V)@kCOki|2S4}?Y z1Wsa;gv~~c`CFpOsZ2zRXI4^tvOfCAWR`HBGHuZ$>J;cHU963%5v-RViBYpGVh$;$ z`yTO~%CJ8DMdO{o$@|e zZSp$4G&}O12G>|#;%ay0(%nKK>w6CJ{(~JgvWBhPAC&W!$o zFz&vDY~>3{kw!&w50ih7Rf)XddWONC^-8pn&6h5I!?m8zFwvH06uGdit591ldTx05 zMpFw;M<=An*)K-r{`SfOB z#7B|QZx{8QDk6MPG!hNA4P(tuk22{M(Wm8{e|=r9V&(C?_(aSH7psrwYz7j?Pq{%I zXTH&{k)>?q_XM-erm;VYpJ}U{F-%!;sxKS&TTb|tC#R5S@zzXM+SDZfs|vAboW*vO zk%Nu@+ZpGh0huNj)f-!~daBFI+wXbH7~es+G8cPl?LrhDk#+OBZ>=f)8YCqRt<=&a z>ZM87O;{$p)L)iMxj3w-;9MVOSXQRtG-#5MLpFn7a-Z;xlteH+9ncLA)OB)g8*f9# zKCiWKsI8^bOBZ{kQ{eJ4d9g9HENj%7&Pm4EbPh)!o!V@o zTTuH6gK2@d!;!MAwX9Gh|M8@YqV~QvWU(ki^MGO#)ib6KMx}a#bqGbTSuGu@>hDJV zYFeu8mk{-uzoVf@chBTX^A!9?tzMbD&dH2+Rga+>2VtkKs144Jr`uh%MITLeL|=Y6 zDkzpI+(#Q99QI5g_?YF83g2{bYh`j zjDgnc)(0&+Gl;%`ZEQ-?dnT)FuA4i}rV$Mb(&&j{?C3M;)MpPmZkBu)*oAQKtRC_9 z8S$DodKPSPe;$p9cx=JG;#g9(qTv`g8x?baX0+h^VTQZ(<1+KQ(Q4-l)UkOQ7Qox+B}zoG)9(NeG+Er6tF_UX)gxx)abU zI%}pqnDWd}OhrjSbN!b>UxmiJW!ZOJ{5OruCj?g_yr*@zkT@-&;niV^^6;5A+`j|n zqNbX~TdX@3FzMkt#3@6QTDXoRpUY2g`=07*<8CG5+Uny@=y2_3E5s$}zVPH1ba=_w z&>Z4ddn=^1S2WQ=bMm1)QMbpZ`E*v(Z%((xOgzLcKhj{K?z=vP9ap%s@}7I~6QSN@ zzBKczu?mc(zn4?xBOa@4yEnTKXUkY(T{xVQfs3Ls)p)1+N?6Yj>J&qR^0m~!J9i^D z`V|jzlIx^9IZh=*vPn7oJHq=n z^Op3pn(|lXjjzbbp0KzGWM`4Bj+>}bWJXzI$m6$k0pFXNp zc-)CZW}YiZReqcA&b(3Lv$C*_x)<>jIF$15si4A-tvGAT$9`MxfuEPnc4UvJ7KZ;? z2~beAHJypT{ZNDH4suqbyER?2={8eoEuK4;jC}8(H0&vEe>~czW17K*es=TBwc4Q& zoj1_w@;Rm}k22Tzw4z&D28LSNj}PQiwQJ01>>RtAkU|&0QN5%_S|Uents!2#_Br}W zTJj1y%59#Wm41o&mPgF5MQg@~7@pyR#)tXSBh#8y9%_Ya*oIr@Z%T8x2}zBm{GR*y z%hi^m^9K93qEb)4Xrm)J#a@P*4}HJ2cX3=9N(BdYt+PUAQ$5<^8!ui2^<^?A7g~r* zN@O@s1RXJa|Hh}lsph1l4Ed75RE3T(iF8w@DAs z#mQ{<>VFGn923DCTey)?mgn{YK zxfLt*<}HFCNs$|<6K6racJlCr!q#^GyeSYaHLar8Do$lPY z_$FS0E?~JNF5j@f!ElySLo4wWo9(>l=y=uBFHSQ2PgvzxpX=NrmmHh6z8LaODp2cc zUZ7yFH}*>OkE^Wbnpp&fFKbZisB=FV9uF4p56_yrSn|3%UDUX+P`_!DPp8vI@5I&7 z>}LbluKd(>ty#AH`J=KTx-05=ofqvg`MX)GuH#P5=j@#cBm{>+o5r< zF!@51-shssn_H@z!zoIx8SIsB;W@glm0N`uti7cMzs+~hPkT8AWOwQm@K40f4OD)8 dJ0AUQav?KEEkR}5!qeq-`fmUJVg7Fa{{nQpi>Uwr literal 0 HcmV?d00001 diff --git a/tests/bugfixes/github/test_canon_lenses.py b/tests/bugfixes/github/test_canon_lenses.py new file mode 100644 index 0000000000..c1165aa240 --- /dev/null +++ b/tests/bugfixes/github/test_canon_lenses.py @@ -0,0 +1,390 @@ +# -*- coding: utf-8 -*- + +import re + +import system_tests + + +# List of all supported lenses, duplicated from canonCsLensType in src/canonmn_int.cpp, +# to ensure that lenses do not get removed accidentially. +# Lenses should never be removed from this list to guarantee backwards-compatibility. +lenses = ''' + { 1, "Canon EF 50mm f/1.8" }, + { 2, "Canon EF 28mm f/2.8" }, + { 3, "Canon EF 135mm f/2.8 Soft" }, + { 4, "Canon EF 35-105mm f/3.5-4.5" }, // 0 + { 4, "Sigma UC Zoom 35-135mm f/4-5.6" }, // 1 + { 5, "Canon EF 35-70mm f/3.5-4.5" }, + { 6, "Canon EF 28-70mm f/3.5-4.5" }, // 0 + { 6, "Sigma 18-50mm f/3.5-5.6 DC" }, // 1 + { 6, "Sigma 18-125mm f/3.5-5.6 DC IF ASP" }, // 2 + { 6, "Tokina AF193-2 19-35mm f/3.5-4.5" }, // 3 + { 6, "Sigma 28-80mm f/3.5-5.6 II Macro" }, // 4 + { 7, "Canon EF 100-300mm f/5.6L" }, + { 8, "Canon EF 100-300mm f/5.6" }, // 0 + { 8, "Sigma 70-300mm f/4-5.6 [APO] DG Macro" }, // 1 + { 8, "Tokina AT-X 242 AF 24-200mm f/3.5-5.6" }, // 2 + { 9, "Canon EF 70-210mm f/4" }, // 0 + { 9, "Sigma 55-200mm f/4-5.6 DC" }, // 1 + { 10, "Canon EF 50mm f/2.5 Macro" }, // 0 + { 10, "Sigma 50mm f/2.8 EX" }, // 1 + { 10, "Sigma 28mm f/1.8" }, // 2 + { 10, "Sigma 105mm f/2.8 Macro EX" }, // 3 + { 10, "Sigma 70mm f/2.8 EX DG Macro EF" }, // 4 + { 11, "Canon EF 35mm f/2" }, + { 13, "Canon EF 15mm f/2.8 Fisheye" }, + { 14, "Canon EF 50-200mm f/3.5-4.5L" }, + { 15, "Canon EF 50-200mm f/3.5-4.5" }, + { 16, "Canon EF 35-135mm f/3.5-4.5" }, + { 17, "Canon EF 35-70mm f/3.5-4.5A" }, + { 18, "Canon EF 28-70mm f/3.5-4.5" }, + { 20, "Canon EF 100-200mm f/4.5A" }, + { 21, "Canon EF 80-200mm f/2.8L" }, + { 22, "Canon EF 20-35mm f/2.8L" }, // 0 + { 22, "Tokina AT-X 280 AF PRO 28-80mm f/2.8 Aspherical" }, // 1 + { 23, "Canon EF 35-105mm f/3.5-4.5" }, + { 24, "Canon EF 35-80mm f/4-5.6 Power Zoom" }, + { 25, "Canon EF 35-80mm f/4-5.6 Power Zoom" }, + { 26, "Canon EF 100mm f/2.8 Macro" }, // 0 + { 26, "Cosina 100mm f/3.5 Macro AF" }, // 1 + { 26, "Tamron SP AF 90mm f/2.8 Di Macro" }, // 2 + { 26, "Tamron SP AF 180mm f/3.5 Di Macro" }, // 3 + { 26, "Carl Zeiss Planar T* 50mm f/1.4" }, // 4 + { 27, "Canon EF 35-80mm f/4-5.6" }, + { 28, "Canon EF 80-200mm f/4.5-5.6" }, // 0 + { 28, "Tamron SP AF 28-105mm f/2.8 LD Aspherical IF" }, // 1 + { 28, "Tamron SP AF 28-75mm f/2.8 XR Di LD Aspherical [IF] Macro" }, // 2 + { 28, "Tamron AF 70-300mm f/4-5.6 Di LD 1:2 Macro" }, // 3 + { 28, "Tamron AF Aspherical 28-200mm f/3.8-5.6" }, // 4 + { 29, "Canon EF 50mm f/1.8 II" }, + { 30, "Canon EF 35-105mm f/4.5-5.6" }, + { 31, "Canon EF 75-300mm f/4-5.6" }, // 0 + { 31, "Tamron SP AF 300mm f/2.8 LD IF" }, // 1 + { 32, "Canon EF 24mm f/2.8" }, // 0 + { 32, "Sigma 15mm f/2.8 EX Fisheye" }, // 1 + { 33, "Voigtlander Ultron 40mm f/2 SLII Aspherical" }, // 0 + { 33, "Voigtlander Color Skopar 20mm f/3.5 SLII Aspherical" }, // 1 + { 33, "Voigtlander APO-Lanthar 90mm f/3.5 SLII Close Focus" }, // 2 + { 33, "Carl Zeiss Distagon 15mm T* f/2.8 ZE" }, // 3 + { 33, "Carl Zeiss Distagon 18mm T* f/3.5 ZE" }, // 4 + { 33, "Carl Zeiss Distagon 21mm T* f/2.8 ZE" }, // 5 + { 33, "Carl Zeiss Distagon 25mm T* f/2 ZE" }, // 6 + { 33, "Carl Zeiss Distagon 28mm T* f/2 ZE" }, // 7 + { 33, "Carl Zeiss Distagon 35mm T* f/2 ZE" }, // 8 + { 33, "Carl Zeiss Distagon 35mm T* f/1.4 ZE" }, // 9 + { 33, "Carl Zeiss Planar 50mm T* f/1.4 ZE" }, // 10 + { 33, "Carl Zeiss Makro-Planar T* 50mm f/2 ZE" }, // 11 + { 33, "Carl Zeiss Makro-Planar T* 100mm f/2 ZE" }, // 12 + { 33, "Carl Zeiss Apo-Sonnar T* 135mm f/2 ZE" }, // 13 + { 35, "Canon EF 35-80mm f/4-5.6" }, + { 36, "Canon EF 38-76mm f/4.5-5.6" }, + { 37, "Canon EF 35-80mm f/4-5.6" }, // 0 + { 37, "Tamron 70-200mm f/2.8 Di LD IF Macro" }, // 1 + { 37, "Tamron AF 28-300mm f/3.5-6.3 XR Di VC LD Aspherical [IF] Macro Model A20" }, // 2 + { 37, "Tamron SP AF 17-50mm f/2.8 XR Di II VC LD Aspherical [IF]" }, // 3 + { 37, "Tamron AF 18-270mm f/3.5-6.3 Di II VC LD Aspherical [IF] Macro" }, // 4 + { 38, "Canon EF 80-200mm f/4.5-5.6" }, + { 39, "Canon EF 75-300mm f/4-5.6" }, + { 40, "Canon EF 28-80mm f/3.5-5.6" }, + { 41, "Canon EF 28-90mm f/4-5.6" }, + { 42, "Canon EF 28-200mm f/3.5-5.6" }, // 0 + { 42, "Tamron AF 28-300mm f/3.5-6.3 XR Di VC LD Aspherical [IF] Macro Model A20" }, // 1 + { 43, "Canon EF 28-105mm f/4-5.6" }, + { 44, "Canon EF 90-300mm f/4.5-5.6" }, + { 45, "Canon EF-S 18-55mm f/3.5-5.6" }, + { 46, "Canon EF 28-90mm f/4-5.6" }, + { 47, "Zeiss Milvus 35mm f/2" }, // 0 + { 47, "Zeiss Milvus 50mm f/2 Makro" }, // 1 + { 48, "Canon EF-S 18-55mm f/3.5-5.6 IS" }, + { 49, "Canon EF-S 55-250mm f/4-5.6 IS" }, + { 50, "Canon EF-S 18-200mm f/3.5-5.6 IS" }, + { 51, "Canon EF-S 18-135mm f/3.5-5.6 IS" }, + { 52, "Canon EF-S 18-55mm f/3.5-5.6 IS II" }, + { 53, "Canon EF-S 18-55mm f/3.5-5.6 III" }, + { 54, "Canon EF-S 55-250mm f/4-5.6 IS II" }, + { 60, "Irix 11mm f/4" }, + { 82, "Canon TS-E 135mm f/4L Macro" }, + { 94, "Canon TS-E 17mm f/4L" }, + { 95, "Canon TS-E 24mm f/3.5L II" }, + { 124, "Canon MP-E 65mm f/2.8 1-5x Macro Photo" }, + { 125, "Canon TS-E 24mm f/3.5L" }, + { 126, "Canon TS-E 45mm f/2.8" }, + { 127, "Canon TS-E 90mm f/2.8" }, + { 129, "Canon EF 300mm f/2.8L" }, + { 130, "Canon EF 50mm f/1.0L" }, + { 131, "Canon EF 28-80mm f/2.8-4L" }, // 0 + { 131, "Sigma 8mm f/3.5 EX DG Circular Fisheye" }, // 1 + { 131, "Sigma 17-35mm f/2.8-4 EX DG Aspherical HSM" }, // 2 + { 131, "Sigma 17-70mm f/2.8-4.5 DC Macro" }, // 3 + { 131, "Sigma APO 50-150mm f/2.8 EX DC HSM" }, // 4 + { 131, "Sigma APO 120-300mm f/2.8 EX DG HSM" }, // 5 + { 131, "Sigma 70-200mm f/2.8 APO EX HSM" }, // 6 + { 132, "Canon EF 1200mm f/5.6L" }, + { 134, "Canon EF 600mm f/4L IS" }, + { 135, "Canon EF 200mm f/1.8L" }, + { 136, "Canon EF 300mm f/2.8L" }, // 0 + { 136, "Tamron SP 15-30mm f/2.8 Di VC USD A012" }, // 1 + { 137, "Canon EF 85mm f/1.2L" }, // 0 + { 137, "Sigma 18-50mm f/2.8-4.5 DC OS HSM" }, // 1 + { 137, "Sigma 50-200mm f/4-5.6 DC OS HSM" }, // 2 + { 137, "Sigma 18-250mm f/3.5-6.3 DC OS HSM" }, // 3 + { 137, "Sigma 24-70mm f/2.8 IF EX DG HSM" }, // 4 + { 137, "Sigma 18-125mm f/3.8-5.6 DC OS HSM" }, // 5 + { 137, "Sigma 17-70mm f/2.8-4 DC Macro OS HSM | C" }, // 6 + { 137, "Sigma 17-50mm f/2.8 OS HSM" }, // 7 + { 137, "Sigma 18-200mm f/3.5-6.3 DC OS HSM [II]" }, // 8 + { 137, "Tamron AF 18-270mm f/3.5-6.3 Di II VC PZD" }, // 9 + { 137, "Sigma 8-16mm f/4.5-5.6 DC HSM" }, // 10 + { 137, "Tamron SP 60mm f/2 Macro Di II" }, // 11 + { 137, "Sigma 10-20mm f/3.5 EX DC HSM" }, // 12 + { 137, "Sigma 18-35mm f/1.8 DC HSM | A" }, // 13 + { 137, "Sigma 12-24mm f/4.5-5.6 DG HSM II" }, // 14 + { 138, "Canon EF 28-80mm f/2.8-4L" }, + { 139, "Canon EF 400mm f/2.8L" }, + { 140, "Canon EF 500mm f/4.5L" }, + { 141, "Canon EF 500mm f/4.5L" }, + { 142, "Canon EF 300mm f/2.8L IS" }, + { 143, "Canon EF 500mm f/4L IS" }, // 0 + { 143, "Sigma 17-70mm f/2.8-4 DC Macro OS HSM" }, // 1 + { 143, "Sigma 24-105mm f/4 DG OS HSM | A" }, // 2 + { 144, "Canon EF 35-135mm f/4-5.6 USM" }, + { 145, "Canon EF 100-300mm f/4.5-5.6 USM" }, + { 146, "Canon EF 70-210mm f/3.5-4.5 USM" }, + { 147, "Canon EF 35-135mm f/4-5.6 USM" }, + { 148, "Canon EF 28-80mm f/3.5-5.6 USM" }, + { 149, "Canon EF 100mm f/2 USM" }, + { 150, "Canon EF 14mm f/2.8L" }, // 0 + { 150, "Sigma 20mm EX f/1.8" }, // 1 + { 150, "Sigma 30mm f/1.4 DC HSM" }, // 2 + { 150, "Sigma 24mm f/1.8 DG Macro EX" }, // 3 + { 150, "Sigma 28mm f/1.8 DG Macro EX" }, // 4 + { 150, "Sigma 18-35mm f/1.8 DC HSM | A" }, // 5 + { 151, "Canon EF 200mm f/2.8L" }, + { 152, "Canon EF 300mm f/4L IS" }, // 0 + { 152, "Sigma 12-24mm f/4.5-5.6 EX DG ASPHERICAL HSM" }, // 1 + { 152, "Sigma 14mm f/2.8 EX Aspherical HSM" }, // 2 + { 152, "Sigma 10-20mm f/4-5.6" }, // 3 + { 152, "Sigma 100-300mm f/4" }, // 4 + { 153, "Canon EF 35-350mm f/3.5-5.6L" }, // 0 + { 153, "Sigma 50-500mm f/4-6.3 APO HSM EX" }, // 1 + { 153, "Tamron AF 28-300mm f/3.5-6.3 XR LD Aspherical [IF] Macro" }, // 2 + { 153, "Tamron AF 18-200mm f/3.5-6.3 XR Di II LD Aspherical [IF] Macro Model A14" }, // 3 + { 153, "Tamron 18-250mm f/3.5-6.3 Di II LD Aspherical [IF] Macro" }, // 4 + { 154, "Canon EF 20mm f/2.8 USM" }, // 0 + { 154, "Zeiss Milvus 21mm f/2.8" }, // 1 + { 155, "Canon EF 85mm f/1.8 USM" }, // 0 + { 155, "Sigma 14mm f/1.8 DG HSM | A" }, // 1 + { 156, "Canon EF 28-105mm f/3.5-4.5 USM" }, // 0 + { 156, "Tamron SP 70-300mm f/4-5.6 Di VC USD" }, // 1 + { 156, "Tamron SP AF 28-105mm f/2.8 LD Aspherical IF" }, // 2 + { 160, "Canon EF 20-35mm f/3.5-4.5 USM" }, // 0 + { 160, "Tamron AF 19-35mm f/3.5-4.5" }, // 1 + { 160, "Tokina AT-X 124 AF 12-24mm f/4 DX" }, // 2 + { 160, "Tokina AT-X 107 AF DX Fish-eye 10-17mm f/3.5-4.5" }, // 3 + { 160, "Tokina AT-X 116 PRO DX AF 11-16mm f/2.8" }, // 4 + { 160, "Tokina AT-X 11-20 F2.8 PRO DX Aspherical 11-20mm f/2.8" }, // 5 + { 161, "Canon EF 28-70mm f/2.8L" }, // 0 + { 161, "Sigma 24-70mm EX f/2.8" }, // 1 + { 161, "Sigma 24-60mm f/2.8 EX DG" }, // 2 + { 161, "Tamron AF 17-50mm f/2.8 Di-II LD Aspherical" }, // 3 + { 161, "Tamron 90mm f/2.8" }, // 4 + { 161, "Tamron SP AF 17-35mm f/2.8-4 Di LD Aspherical IF" }, // 5 + { 161, "Tamron SP AF 28-75mm f/2.8 XR Di LD Aspherical [IF] Macro" }, // 6 + { 162, "Canon EF 200mm f/2.8L" }, + { 163, "Canon EF 300mm f/4L" }, + { 164, "Canon EF 400mm f/5.6L" }, + { 165, "Canon EF 70-200mm f/2.8L" }, + { 166, "Canon EF 70-200mm f/2.8L + 1.4x" }, + { 167, "Canon EF 70-200mm f/2.8L + 2x" }, + { 168, "Canon EF 28mm f/1.8 USM" }, // 0 + { 168, "Sigma 50-100mm f/1.8 DC HSM | A" }, // 1 + { 169, "Canon EF 17-35mm f/2.8L" }, // 0 + { 169, "Sigma 18-200mm f/3.5-6.3 DC OS" }, // 1 + { 169, "Sigma 15-30mm f/3.5-4.5 EX DG Aspherical" }, // 2 + { 169, "Sigma 18-50mm f/2.8 Macro" }, // 3 + { 169, "Sigma 50mm f/1.4 EX DG HSM" }, // 4 + { 169, "Sigma 85mm f/1.4 EX DG HSM" }, // 5 + { 169, "Sigma 30mm f/1.4 EX DC HSM" }, // 6 + { 169, "Sigma 35mm f/1.4 DG HSM" }, // 7 + { 170, "Canon EF 200mm f/2.8L II" }, + { 171, "Canon EF 300mm f/4L" }, + { 172, "Canon EF 400mm f/5.6L" }, // 0 + { 172, "Sigma 150-600mm f/5-6.3 DG OS HSM | S" }, // 1 + { 172, "Sigma 150-500mm f/5-6.3 APO DG OS HSM + 1.4x" }, // 2 + { 173, "Canon EF 180mm Macro f/3.5L" }, // 0 + { 173, "Sigma APO Macro 150mm f/3.5 EX DG IF HSM" }, // 1 + { 173, "Sigma 150-500mm f/5-6.3 APO DG OS HSM + 2x" }, // 2 + { 174, "Canon EF 135mm f/2L" }, // 0 + { 174, "Sigma 70-200mm f/2.8 EX DG APO OS HSM" }, // 1 + { 174, "Sigma 50-500mm f/4.5-6.3 APO DG OS HSM" }, // 2 + { 174, "Sigma 150-500mm f/5-6.3 APO DG OS HSM" }, // 3 + { 174, "Zeiss Milvus 100mm f/2 Makro" }, // 4 + { 174, "Sigma 120-300mm f/2.8 EX APO DG OS HSM" }, // 5 + { 175, "Canon EF 400mm f/2.8L" }, + { 176, "Canon EF 24-85mm f/3.5-4.5 USM" }, + { 177, "Canon EF 300mm f/4L IS" }, + { 178, "Canon EF 28-135mm f/3.5-5.6 IS" }, + { 179, "Canon EF 24mm f/1.4L" }, + { 180, "Canon EF 35mm f/1.4L" }, // 0 + { 180, "Sigma 50mm f/1.4 DG HSM | A" }, // 1 + { 180, "Sigma 24mm f/1.4 DG HSM | A" }, // 2 + { 180, "Sigma 20mm f/1.4 DG HSM | A" }, // 3 + { 180, "Zeiss Milvus 85mm f/1.4" }, // 4 + { 180, "Zeiss Otus 28mm f/1.4 ZE" }, // 5 + { 181, "Canon EF 100-400mm f/4.5-5.6L IS + 1.4x" }, // 0 + { 181, "Sigma 150-600mm f/5-6.3 DG OS HSM | S + 1.4x" }, // 1 + { 182, "Canon EF 100-400mm f/4.5-5.6L IS + 2x" }, // 0 + { 182, "Sigma 150-600mm f/5-6.3 DG OS HSM | S + 2x" }, // 1 + { 183, "Canon EF 100-400mm f/4.5-5.6L IS" }, // 0 + { 183, "Sigma 150mm f/2.8 EX DG OS HSM APO Macro" }, // 1 + { 183, "Sigma 105mm f/2.8 EX DG OS HSM Macro" }, // 2 + { 183, "Sigma 180mm f/2.8 EX DG OS HSM APO Macro" }, // 3 + { 183, "Sigma 150-600mm f/5-6.3 DG OS HSM | C" }, // 4 + { 184, "Canon EF 400mm f/2.8L + 2x" }, + { 185, "Canon EF 600mm f/4L IS" }, + { 186, "Canon EF 70-200mm f/4L" }, + { 187, "Canon EF 70-200mm f/4L + 1.4x" }, + { 188, "Canon EF 70-200mm f/4L + 2x" }, + { 189, "Canon EF 70-200mm f/4L + 2.8x" }, + { 190, "Canon EF 100mm f/2.8 Macro USM" }, + { 191, "Canon EF 400mm f/4 DO IS" }, + { 193, "Canon EF 35-80mm f/4-5.6 USM" }, + { 194, "Canon EF 80-200mm f/4.5-5.6 USM" }, + { 195, "Canon EF 35-105mm f/4.5-5.6 USM" }, + { 196, "Canon EF 75-300mm f/4-5.6 USM" }, + { 197, "Canon EF 75-300mm f/4-5.6 IS USM" }, // 0 + { 197, "Sigma 18-300mm f/3.5-6.3 DC Macro HSM" }, // 1 + { 198, "Canon EF 50mm f/1.4 USM" }, // 0 + { 198, "Zeiss Otus 55mm f/1.4 ZE" }, // 1 + { 198, "Zeiss Otus 85mm f/1.4 ZE" }, // 2 + { 199, "Canon EF 28-80mm f/3.5-5.6 USM" }, + { 200, "Canon EF 75-300mm f/4-5.6 USM" }, + { 201, "Canon EF 28-80mm f/3.5-5.6 USM" }, + { 202, "Canon EF 28-80mm f/3.5-5.6 USM IV" }, + { 208, "Canon EF 22-55mm f/4-5.6 USM" }, + { 209, "Canon EF 55-200mm f/4.5-5.6" }, + { 210, "Canon EF 28-90mm f/4-5.6 USM" }, + { 211, "Canon EF 28-200mm f/3.5-5.6 USM" }, + { 212, "Canon EF 28-105mm f/4-5.6 USM" }, + { 213, "Canon EF 90-300mm f/4.5-5.6 USM" }, // 0 + { 213, "Tamron SP 150-600mm f/5-6.3 Di VC USD" }, // 1 + { 213, "Tamron 16-300mm f/3.5-6.3 Di II VC PZD Macro" }, // 2 + { 213, "Tamron SP 35mm f/1.8 Di VC USD" }, // 3 + { 213, "Tamron SP 45mm f/1.8 Di VC USD" }, // 4 + { 213, "Tamron SP 70-300mm f/4-5.6 Di VC USD" }, // 5 + { 214, "Canon EF-S 18-55mm f/3.5-5.6 USM" }, + { 215, "Canon EF 55-200mm f/4.5-5.6 II USM" }, + { 217, "Tamron AF 18-270mm f/3.5-6.3 Di II VC PZD" }, + { 224, "Canon EF 70-200mm f/2.8L IS" }, + { 225, "Canon EF 70-200mm f/2.8L IS + 1.4x" }, + { 226, "Canon EF 70-200mm f/2.8L IS + 2x" }, + { 227, "Canon EF 70-200mm f/2.8L IS + 2.8x" }, + { 228, "Canon EF 28-105mm f/3.5-4.5 USM" }, + { 229, "Canon EF 16-35mm f/2.8L" }, + { 230, "Canon EF 24-70mm f/2.8L" }, + { 231, "Canon EF 17-40mm f/4L" }, + { 232, "Canon EF 70-300mm f/4.5-5.6 DO IS USM" }, + { 233, "Canon EF 28-300mm f/3.5-5.6L IS" }, + { 234, "Canon EF-S 17-85mm f/4-5.6 IS USM" }, // 0 + { 234, "Tokina AT-X 12-28 PRO DX 12-28mm f/4" }, // 1 + { 235, "Canon EF-S 10-22mm f/3.5-4.5 USM" }, + { 236, "Canon EF-S 60mm f/2.8 Macro USM" }, + { 237, "Canon EF 24-105mm f/4L IS" }, + { 238, "Canon EF 70-300mm f/4-5.6 IS USM" }, + { 239, "Canon EF 85mm f/1.2L II" }, + { 240, "Canon EF-S 17-55mm f/2.8 IS USM" }, + { 241, "Canon EF 50mm f/1.2L" }, + { 242, "Canon EF 70-200mm f/4L IS" }, + { 243, "Canon EF 70-200mm f/4L IS + 1.4x" }, + { 244, "Canon EF 70-200mm f/4L IS + 2x" }, + { 245, "Canon EF 70-200mm f/4L IS + 2.8x" }, + { 246, "Canon EF 16-35mm f/2.8L II" }, + { 247, "Canon EF 14mm f/2.8L II USM" }, + { 248, "Canon EF 200mm f/2L IS" }, // 0 + { 248, "Sigma 24-35mm f/2 DG HSM | A" }, // 1 + { 249, "Canon EF 800mm f/5.6L IS" }, + { 250, "Canon EF 24mm f/1.4L II" }, // 0 + { 250, "Sigma 20mm f/1.4 DG HSM | A" }, // 1 + { 251, "Canon EF 70-200mm f/2.8L IS II USM" }, + { 252, "Canon EF 70-200mm f/2.8L IS II USM + 1.4x" }, + { 253, "Canon EF 70-200mm f/2.8L IS II USM + 2x" }, + { 254, "Canon EF 100mm f/2.8L Macro IS USM" }, // 0 + { 254, "Tamron SP 90mm f/2.8 Di VC USD Macro 1:1" }, // 1 + { 255, "Sigma 24-105mm f/4 DG OS HSM | A" }, // 0 + { 255, "Sigma 180mm f/2.8 EX DG OS HSM APO Macro" }, // 1 + { 368, "Sigma 18-35mm f/1.8 DC HSM | A" }, + { 488, "Canon EF-S 15-85mm f/3.5-5.6 IS USM" }, + { 489, "Canon EF 70-300mm f/4-5.6L IS USM" }, + { 490, "Canon EF 8-15mm f/4L Fisheye USM" }, + { 491, "Canon EF 300mm f/2.8L IS II USM" }, // 0 + { 491, "Tamron SP 24-70mm f/2.8 Di VC USD G2" }, // 1 + { 492, "Canon EF 400mm f/2.8L IS II USM" }, + { 493, "Canon EF 500mm f/4L IS II USM" }, // 0 + { 493, "Canon EF 24-105mm f/4L IS USM" }, // 1 + { 494, "Canon EF 600mm f/4L IS II USM" }, + { 495, "Canon EF 24-70mm f/2.8L II USM" }, + { 496, "Canon EF 200-400mm f/4L IS USM" }, + { 499, "Canon EF 200-400mm f/4L IS USM + 1.4x" }, + { 502, "Canon EF 28mm f/2.8 IS USM" }, + { 503, "Canon EF 24mm f/2.8 IS USM" }, + { 504, "Canon EF 24-70mm f/4L IS USM" }, + { 505, "Canon EF 35mm f/2 IS USM" }, + { 506, "Canon EF 400mm f/4 DO IS II USM" }, + { 507, "Canon EF 16-35mm f/4L IS USM" }, + { 508, "Canon EF 11-24mm f/4L USM" }, + { 624, "Sigma 14mm f/1.8 DG HSM | A" }, // 0 + { 624, "Sigma 150-600mm f/5-6.3 DG OS HSM | C" }, // 1 + { 624, "Sigma 150-600mm f/5-6.3 DG OS HSM | C + 1.4x" }, // 2 + { 747, "Canon EF 100-400mm f/4.5-5.6L IS II USM" }, // 0 + { 747, "Tamron SP 150-600mm f/5-6.3 Di VC USD G2" }, // 1 + { 748, "Canon EF 100-400mm f/4.5-5.6L IS II USM + 1.4x" }, + { 750, "Canon EF 35mm f/1.4L II USM" }, + { 751, "Canon EF 16-35mm f/2.8L III USM" }, + { 752, "Canon EF 24-105mm f/4L IS II USM" }, + { 4142,"Canon EF-S 18-135mm f/3.5-5.6 IS STM" }, + { 4143,"Canon EF-M 18-55mm f/3.5-5.6 IS STM" }, // 0 + { 4143,"Tamron 18-200mm f/3.5-6.3 Di III VC" }, // 1 + { 4144,"Canon EF 40mm f/2.8 STM" }, + { 4145,"Canon EF-M 22mm f/2 STM" }, + { 4146,"Canon EF-S 18-55mm f/3.5-5.6 IS STM" }, + { 4147,"Canon EF-M 11-22mm f/4-5.6 IS STM" }, + { 4148,"Canon EF-S 55-250mm f/4-5.6 IS STM" }, + { 4149,"Canon EF-M 55-200mm f/4.5-6.3 IS STM" }, + { 4150,"Canon EF-S 10-18mm f/4.5-5.6 IS STM" }, + { 4152,"Canon EF 24-105mm f/3.5-5.6 IS STM" }, + { 4153,"Canon EF-M 15-45mm f/3.5-6.3 IS STM" }, + { 4154,"Canon EF-S 24mm f/2.8 STM" }, + { 4155,"Canon EF-M 28mm f/3.5 Macro IS STM" }, + { 4156,"Canon EF 50mm f/1.8 STM" }, + { 4157,"Canon EF-M 18-150mm f/3.5-6.3 IS STM" }, + { 4158,"Canon EF-S 18-55mm f/4-5.6 IS STM" }, + { 4160,"Canon EF-S 35mm f/2.8 Macro IS STM" }, + {36910,"Canon EF 70-300mm f/4-5.6 IS II USM" }, + {36912,"Canon EF-S 18-135mm f/3.5-5.6 IS USM" }, +''' + +apertures = '1.0', '1.1', '1.2', '1.4', '1.6', '1.8', '2', '2.2', '2.5', '2.8', '3.2', '3.5', '4', '4.5', '5', '5.6', '6.3', '7.1', '8', '9', '10', '11', '13', '14', '16', '18', '20', '22', '25', '29', '32', '36', '40', '45' +fractions = {0: 0, 1: 12, 2: 20} +aperture_map = {value: (index // 3) * 32 + fractions[index % 3] for index, value in enumerate(apertures)} +aperture_map['3.8'] = '32000' # aperture value cannot be represented in metadata, ignore it by using invalid value + +for lens_match in re.finditer('(?P[0-9]+),.*"(?P.*)"', lenses): + lens = lens_match.group('lens_description') + + metadata_match = re.search('((?P[0-9]+)-)?(?P[0-9]+)mm.*f/(?P[0-9]+(\\.[0-9]+)?)[^+]*(\\+ (?P[0-9.]+)x)?', lens) + if not metadata_match: + raise ValueError('Invalid lens format: ' + lens) + tc = float(metadata_match.group('tc') or 1) + + testname = lens_match.group('lens_id') + '_' + lens + globals()[testname] = system_tests.CaseMeta('canon_lenses.' + testname, tuple(), { + 'filename': '$data_path/template.exv', + 'commands': ['$exiv2 -M"set Exif.CanonCs.LensType $lens_id" -M"set Exif.CanonCs.Lens $focal_length_max $focal_length_min 1" -M"set Exif.CanonCs.MaxAperture $aperture" $filename && $exiv2 -pa -K Exif.CanonCs.LensType $filename'], + 'stderr': [''], + 'stdout': ['Exif.CanonCs.LensType Short 1 $lens_description\n'], + 'retval': [0], + **lens_match.groupdict(), + 'aperture': aperture_map[metadata_match.group('aperture')], + 'focal_length_min': int(int(metadata_match.group('focal_length_min') or metadata_match.group('focal_length_max')) * tc), + 'focal_length_max': int(int(metadata_match.group('focal_length_max')) * tc), + }) From fa4ce38d77a6428e111a8a542396e79bb0e379ba Mon Sep 17 00:00:00 2001 From: Alexander Steffen Date: Wed, 9 Dec 2020 10:36:17 +0100 Subject: [PATCH 02/17] Execute test commands always with shell There is no need to handle tests on Windows and Unix differently here. Always using a shell allows for more flexibility when writing tests. (rebased by hassec) --- tests/system_tests.py | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/tests/system_tests.py b/tests/system_tests.py index e1e95186bc..8d37bd5670 100644 --- a/tests/system_tests.py +++ b/tests/system_tests.py @@ -5,33 +5,18 @@ import inspect import subprocess import threading -import shlex import sys import shutil import string import unittest - from bash_tests import utils as BT - if sys.platform in [ 'win32', 'msys', 'cygwin' ]: - #: invoke subprocess.Popen with shell=True on Windows - _SUBPROCESS_SHELL = True - - def _cmd_splitter(cmd): - return cmd - def _process_output_post(output): return output.replace('\r\n', '\n') else: - #: invoke subprocess.Popen with shell=False on Unix - _SUBPROCESS_SHELL = False - - def _cmd_splitter(cmd): - return shlex.split(cmd) - def _process_output_post(output): return output @@ -586,13 +571,13 @@ def test_run(self): ) proc = subprocess.Popen( - _cmd_splitter(command), + command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE if stdin is not None else None, env=self._get_env(), cwd=self.work_dir, - shell=_SUBPROCESS_SHELL + shell=True, ) # Setup a threading.Timer which will terminate the command if it takes From 0d030eefdf00ca5a32e13c1a2bd52ed4d00ccd8d Mon Sep 17 00:00:00 2001 From: Alexander Steffen Date: Wed, 9 Dec 2020 12:46:59 +0100 Subject: [PATCH 03/17] Remove undetectable lenses Lenses that have the exact same ID, focal length and aperture as some other lens that comes earlier in the list (and thus always wins): * 137, "Tamron SP 17-50mm f/2.8 XR Di II VC" * 137, "Tamron SP 24-70mm f/2.8 Di VC USD" * 161, "Sigma 28-70mm f/2.8 EX" * 173, "Sigma 180mm EX HSM Macro f/3.5" * 180, "Zeiss Milvus 50mm f/1.4" * 183, "Sigma 150-600mm f/5-6.3 DG OS HSM | S" * 254, "Tamron SP 90mm f/2.8 Di VC USD Macro 1:1 F004" * 254, "Tamron SP 90mm f/2.8 Di VC USD Macro 1:1 F017" Lenses that share their IDs with other lenses, but have no or an unsupported focal length: * 33, "Voigtlander or Carl Zeiss Lens" * 131, "Sigma 4.5mm f/2.8 EX DC HSM Circular Fisheye" --- src/canonmn_int.cpp | 73 ++++++++++++++++++++------------------------- 1 file changed, 32 insertions(+), 41 deletions(-) diff --git a/src/canonmn_int.cpp b/src/canonmn_int.cpp index 62db09c275..38181c5d70 100644 --- a/src/canonmn_int.cpp +++ b/src/canonmn_int.cpp @@ -1655,21 +1655,20 @@ namespace Exiv2 { { 31, "Tamron SP AF 300mm f/2.8 LD IF" }, // 1 { 32, "Canon EF 24mm f/2.8" }, { 32, "Sigma 15mm f/2.8 EX Fisheye" }, // 1 - { 33, "Voigtlander or Carl Zeiss Lens" }, - { 33, "Voigtlander Ultron 40mm f/2 SLII Aspherical" }, // 1 - { 33, "Voigtlander Color Skopar 20mm f/3.5 SLII Aspherical" }, // 2 - { 33, "Voigtlander APO-Lanthar 90mm f/3.5 SLII Close Focus" }, // 3 - { 33, "Carl Zeiss Distagon T* 15mm f/2.8 ZE" }, // 4 - { 33, "Carl Zeiss Distagon T* 18mm f/3.5 ZE" }, // 5 - { 33, "Carl Zeiss Distagon T* 21mm f/2.8 ZE" }, // 6 - { 33, "Carl Zeiss Distagon T* 25mm f/2 ZE" }, // 7 - { 33, "Carl Zeiss Distagon T* 28mm f/2 ZE" }, // 8 - { 33, "Carl Zeiss Distagon T* 35mm f/2 ZE" }, // 9 - { 33, "Carl Zeiss Distagon T* 35mm f/1.4 ZE" }, // 10 - { 33, "Carl Zeiss Planar T* 50mm f/1.4 ZE" }, // 11 - { 33, "Carl Zeiss Makro-Planar T* 50mm f/2 ZE" }, // 12 - { 33, "Carl Zeiss Makro-Planar T* 100mm f/2 ZE" }, // 13 - { 33, "Carl Zeiss Apo-Sonnar T* 135mm f/2 ZE" }, // 14 + { 33, "Voigtlander Ultron 40mm f/2 SLII Aspherical" }, + { 33, "Voigtlander Color Skopar 20mm f/3.5 SLII Aspherical" }, // 1 + { 33, "Voigtlander APO-Lanthar 90mm f/3.5 SLII Close Focus" }, // 2 + { 33, "Carl Zeiss Distagon T* 15mm f/2.8 ZE" }, // 3 + { 33, "Carl Zeiss Distagon T* 18mm f/3.5 ZE" }, // 4 + { 33, "Carl Zeiss Distagon T* 21mm f/2.8 ZE" }, // 5 + { 33, "Carl Zeiss Distagon T* 25mm f/2 ZE" }, // 6 + { 33, "Carl Zeiss Distagon T* 28mm f/2 ZE" }, // 7 + { 33, "Carl Zeiss Distagon T* 35mm f/2 ZE" }, // 8 + { 33, "Carl Zeiss Distagon T* 35mm f/1.4 ZE" }, // 9 + { 33, "Carl Zeiss Planar T* 50mm f/1.4 ZE" }, // 10 + { 33, "Carl Zeiss Makro-Planar T* 50mm f/2 ZE" }, // 11 + { 33, "Carl Zeiss Makro-Planar T* 100mm f/2 ZE" }, // 12 + { 33, "Carl Zeiss Apo-Sonnar T* 135mm f/2 ZE" }, // 13 { 35, "Canon EF 35-80mm f/4-5.6" }, { 36, "Canon EF 38-76mm f/4.5-5.6" }, { 37, "Canon EF 35-80mm f/4-5.6" }, @@ -1725,9 +1724,8 @@ namespace Exiv2 { { 131, "Sigma 17-70mm f/2.8-4.5 DC Macro" }, // 3 { 131, "Sigma APO 50-150mm f/2.8 [II] EX DC HSM" }, // 4 { 131, "Sigma APO 120-300mm f/2.8 EX DG HSM" }, // 5 - { 131, "Sigma 4.5mm f/2.8 EX DC HSM Circular Fisheye" }, // 6 - { 131, "Sigma 70-200mm f/2.8 APO EX HSM" }, // 7 - { 131, "Sigma 28-70mm f/2.8-4 DG" }, // 8 + { 131, "Sigma 70-200mm f/2.8 APO EX HSM" }, // 6 + { 131, "Sigma 28-70mm f/2.8-4 DG" }, // 7 { 132, "Canon EF 1200mm f/5.6L USM" }, { 134, "Canon EF 600mm f/4L IS USM" }, { 135, "Canon EF 200mm f/1.8L USM" }, @@ -1744,13 +1742,11 @@ namespace Exiv2 { { 137, "Sigma 18-200mm f/3.5-6.3 DC OS HSM [II]" }, // 8 { 137, "Tamron AF 18-270mm f/3.5-6.3 Di II VC PZD" }, // 9 { 137, "Sigma 8-16mm f/4.5-5.6 DC HSM" }, // 10 - { 137, "Tamron SP 17-50mm f/2.8 XR Di II VC" }, // 11 - { 137, "Tamron SP 60mm f/2 Macro Di II" }, // 12 - { 137, "Sigma 10-20mm f/3.5 EX DC HSM" }, // 13 - { 137, "Tamron SP 24-70mm f/2.8 Di VC USD" }, // 14 - { 137, "Sigma 18-35mm f/1.8 DC HSM | A" }, // 15 - { 137, "Sigma 12-24mm f/4.5-5.6 DG HSM II" }, // 16 - { 137, "Sigma 70-300mm f/4-5.6 DG OS" }, // 17 + { 137, "Tamron SP 60mm f/2 Macro Di II" }, // 11 + { 137, "Sigma 10-20mm f/3.5 EX DC HSM" }, // 12 + { 137, "Sigma 18-35mm f/1.8 DC HSM | A" }, // 13 + { 137, "Sigma 12-24mm f/4.5-5.6 DG HSM II" }, // 14 + { 137, "Sigma 70-300mm f/4-5.6 DG OS" }, // 15 { 138, "Canon EF 28-80mm f/2.8-4L" }, { 139, "Canon EF 400mm f/2.8L USM" }, { 140, "Canon EF 500mm f/4.5L USM" }, @@ -1806,7 +1802,6 @@ namespace Exiv2 { { 161, "Tamron 90mm f/2.8" }, // 5 { 161, "Tamron SP AF 17-35mm f/2.8-4 Di LD Aspherical IF" }, // 6 { 161, "Tamron SP AF 28-75mm f/2.8 XR Di LD Aspherical [IF] Macro" }, // 7 - { 161, "Tokina AT-X 24-70mm f/2.8 PRO FX (IF)" }, // 8 { 162, "Canon EF 200mm f/2.8L USM" }, { 163, "Canon EF 300mm f/4L" }, { 164, "Canon EF 400mm f/5.6L" }, @@ -1833,12 +1828,11 @@ namespace Exiv2 { { 172, "Sigma 150-600mm f/5-6.3 DG OS HSM | S" }, // 1 { 172, "Sigma 500mm f/4.5 APO EX DG HSM" }, // 2 { 173, "Canon EF 180mm Macro f/3.5L USM" }, - { 173, "Sigma 180mm EX HSM Macro f/3.5" }, // 1 - { 173, "Sigma APO Macro 150mm f/2.8 EX DG HSM" }, // 2 - { 173, "Sigma 10mm f/2.8 EX DC Fisheye" }, // 3 - { 173, "Sigma 15mm f/2.8 EX DG Diagonal Fisheye" }, // 4 - { 173, "Venus Laowa 100mm F2.8 2X Ultra Macro APO" }, // 5 - { 173, "Sigma 150-500mm f/5-6.3 APO DG OS HSM + 2x" }, // 6 + { 173, "Sigma APO Macro 150mm f/2.8 EX DG HSM" }, // 1 + { 173, "Sigma 10mm f/2.8 EX DC Fisheye" }, // 2 + { 173, "Sigma 15mm f/2.8 EX DG Diagonal Fisheye" }, // 3 + { 173, "Venus Laowa 100mm F2.8 2X Ultra Macro APO" }, // 4 + { 173, "Sigma 150-500mm f/5-6.3 APO DG OS HSM + 2x" }, // 5 { 174, "Canon EF 135mm f/2L USM" }, { 174, "Sigma 70-200mm f/2.8 EX DG APO OS HSM" }, // 1 { 174, "Sigma 50-500mm f/4.5-6.3 APO DG OS HSM" }, // 2 @@ -1857,14 +1851,12 @@ namespace Exiv2 { { 180, "Canon EF 35mm f/1.4L USM" }, { 180, "Sigma 50mm f/1.4 DG HSM | A" }, // 1 { 180, "Sigma 24mm f/1.4 DG HSM | A" }, // 2 - { 180, "Zeiss Milvus 50mm f/1.4" }, // 3 - { 180, "Zeiss Milvus 85mm f/1.4" }, // 4 - { 180, "Zeiss Otus 28mm f/1.4 ZE" }, // 5 - { 180, "Sigma 24mm f/1.5 FF High-Speed Prime | 017" }, // 6 - { 180, "Sigma 50mm f/1.5 FF High-Speed Prime | 017" }, // 7 - { 180, "Sigma 85mm f/1.5 FF High-Speed Prime | 017" }, // 8 - { 180, "Tokina Opera 50mm f/1.4 FF" }, // 9 - { 180, "Sigma 20mm f/1.4 DG HSM | A" }, // 10 + { 180, "Zeiss Milvus 85mm f/1.4" }, // 3 + { 180, "Zeiss Otus 28mm f/1.4 ZE" }, // 4 + { 180, "Sigma 24mm f/1.5 FF High-Speed Prime | 017" }, // 5 + { 180, "Sigma 50mm f/1.5 FF High-Speed Prime | 017" }, // 6 + { 180, "Sigma 85mm f/1.5 FF High-Speed Prime | 017" }, // 7 + { 180, "Sigma 20mm f/1.4 DG HSM | A" }, // 8 { 181, "Canon EF 100-400mm f/4.5-5.6L IS USM + 1.4x" }, { 181, "Sigma 150-600mm f/5-6.3 DG OS HSM | S + 1.4x" }, // 1 { 182, "Canon EF 100-400mm f/4.5-5.6L IS USM + 2x" }, @@ -1874,7 +1866,6 @@ namespace Exiv2 { { 183, "Sigma 105mm f/2.8 EX DG OS HSM Macro" }, // 2 { 183, "Sigma 180mm f/2.8 EX DG OS HSM APO Macro" }, // 3 { 183, "Sigma 150-600mm f/5-6.3 DG OS HSM | C" }, // 4 - { 183, "Sigma 150-600mm f/5-6.3 DG OS HSM | S" }, // 5 { 183, "Sigma 100-400mm f/5-6.3 DG OS HSM" }, // 6 { 183, "Sigma 180mm f/3.5 APO Macro EX DG IF HSM" }, // 7 { 184, "Canon EF 400mm f/2.8L USM + 2x" }, From d7f613c48ed9c71a44887848387d66b1b40c6b12 Mon Sep 17 00:00:00 2001 From: Alexander Steffen Date: Wed, 9 Dec 2020 10:31:17 +0100 Subject: [PATCH 04/17] Clean up Canon lens list Fixes some small inconsistencies, so that all lenses use the same format, that is also shared with other lens databases such as lensfun: * Always prefix aperture with f/ * Never add .0 to aperture * Always add mm to focal length * Always use | A for Sigma Art lenses --- tests/bugfixes/github/test_issue_45.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/bugfixes/github/test_issue_45.py b/tests/bugfixes/github/test_issue_45.py index ca7ca1d4e9..0c066ea743 100644 --- a/tests/bugfixes/github/test_issue_45.py +++ b/tests/bugfixes/github/test_issue_45.py @@ -9,7 +9,7 @@ class Sigma24_105mmRecognization(metaclass=system_tests.CaseMeta): filename = "$data_path/exiv2-g45.exv" commands = ["$exiv2 -pa --grep lens/i " + filename] - stdout = ["""Exif.CanonCs.LensType Short 1 Sigma 24-105mm F4 DG OS HSM | A + stdout = ["""Exif.CanonCs.LensType Short 1 Sigma 24-105mm f/4 DG OS HSM | A Exif.CanonCs.Lens Short 3 24.0 - 105.0 mm Exif.CanonCf.LensAFStopButton Short 1 0 Exif.Canon.LensModel Ascii 74 24-105mm F4 DG OS HSM | Art 013 From 477150f0670568288784d6ea7a3147c08ac1fbe9 Mon Sep 17 00:00:00 2001 From: Alexander Steffen Date: Wed, 9 Dec 2020 12:36:52 +0100 Subject: [PATCH 05/17] Fix rounding error in fnumber calculation The mathematical calculation of fnumbers does not always match the expected values: For example for f/3.5 the precise mathematical value is 3.564..., which gets rounded to 3.6. Fix this special case by returning a value closer to the expected value. --- src/tags_int.cpp | 6 +++++- test/data/exiv2-test.out | 10 +++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/tags_int.cpp b/src/tags_int.cpp index e4939dadd0..1809df7fdc 100644 --- a/src/tags_int.cpp +++ b/src/tags_int.cpp @@ -2577,7 +2577,11 @@ namespace Exiv2 { float fnumber(float apertureValue) { - return std::exp(std::log(2.0F) * apertureValue / 2.F); + float result = std::exp(std::log(2.0F) * apertureValue / 2.F); + if (std::abs(result - 3.5) < 0.1) { + result = 3.5; + } + return result; } URational exposureTime(float shutterSpeedValue) diff --git a/test/data/exiv2-test.out b/test/data/exiv2-test.out index f4ef1a5ad6..feaac1f93e 100644 --- a/test/data/exiv2-test.out +++ b/test/data/exiv2-test.out @@ -1093,7 +1093,7 @@ File 6/16: 20030925_201850.jpg 20030925_201850.jpg Exif.CanonCs.0x0015 Short 1 32767 20030925_201850.jpg Exif.CanonCs.LensType Short 1 n/a 20030925_201850.jpg Exif.CanonCs.Lens Short 3 18.0 - 55.0 mm -20030925_201850.jpg Exif.CanonCs.MaxAperture Short 1 F3.6 +20030925_201850.jpg Exif.CanonCs.MaxAperture Short 1 F3.5 20030925_201850.jpg Exif.CanonCs.MinAperture Short 1 F22 20030925_201850.jpg Exif.CanonCs.FlashActivity Short 1 Did not fire 20030925_201850.jpg Exif.CanonCs.FlashDetails Short 1 @@ -2734,7 +2734,7 @@ Compare image data and extracted data ------------------------------------ < 20030925_201850.jpg Exif.CanonCs.0x0015 Short 1 32767 < 20030925_201850.jpg Exif.CanonCs.LensType Short 1 n/a < 20030925_201850.jpg Exif.CanonCs.Lens Short 3 18.0 - 55.0 mm -< 20030925_201850.jpg Exif.CanonCs.MaxAperture Short 1 F3.6 +< 20030925_201850.jpg Exif.CanonCs.MaxAperture Short 1 F3.5 < 20030925_201850.jpg Exif.CanonCs.MinAperture Short 1 F22 < 20030925_201850.jpg Exif.CanonCs.FlashActivity Short 1 Did not fire < 20030925_201850.jpg Exif.CanonCs.FlashDetails Short 1 @@ -4297,7 +4297,7 @@ Compare image data and extracted data ------------------------------------ > 20030925_201850.exv Exif.CanonCs.0x0015 Short 1 32767 > 20030925_201850.exv Exif.CanonCs.LensType Short 1 n/a > 20030925_201850.exv Exif.CanonCs.Lens Short 3 18.0 - 55.0 mm -> 20030925_201850.exv Exif.CanonCs.MaxAperture Short 1 F3.6 +> 20030925_201850.exv Exif.CanonCs.MaxAperture Short 1 F3.5 > 20030925_201850.exv Exif.CanonCs.MinAperture Short 1 F22 > 20030925_201850.exv Exif.CanonCs.FlashActivity Short 1 Did not fire > 20030925_201850.exv Exif.CanonCs.FlashDetails Short 1 @@ -6098,7 +6098,7 @@ Compare original and inserted image data --------------------------------- < 20030925_201850.jpg Exif.CanonCs.0x0015 Short 1 32767 < 20030925_201850.jpg Exif.CanonCs.LensType Short 1 n/a < 20030925_201850.jpg Exif.CanonCs.Lens Short 3 18.0 - 55.0 mm -< 20030925_201850.jpg Exif.CanonCs.MaxAperture Short 1 F3.6 +< 20030925_201850.jpg Exif.CanonCs.MaxAperture Short 1 F3.5 < 20030925_201850.jpg Exif.CanonCs.MinAperture Short 1 F22 < 20030925_201850.jpg Exif.CanonCs.FlashActivity Short 1 Did not fire < 20030925_201850.jpg Exif.CanonCs.FlashDetails Short 1 @@ -7661,7 +7661,7 @@ Compare original and inserted image data --------------------------------- > 20030925_201850.exv Exif.CanonCs.0x0015 Short 1 32767 > 20030925_201850.exv Exif.CanonCs.LensType Short 1 n/a > 20030925_201850.exv Exif.CanonCs.Lens Short 3 18.0 - 55.0 mm -> 20030925_201850.exv Exif.CanonCs.MaxAperture Short 1 F3.6 +> 20030925_201850.exv Exif.CanonCs.MaxAperture Short 1 F3.5 > 20030925_201850.exv Exif.CanonCs.MinAperture Short 1 F22 > 20030925_201850.exv Exif.CanonCs.FlashActivity Short 1 Did not fire > 20030925_201850.exv Exif.CanonCs.FlashDetails Short 1 From 9962b88db352facadec21b5f6e3376416daafddd Mon Sep 17 00:00:00 2001 From: Alexander Steffen Date: Wed, 9 Dec 2020 12:40:37 +0100 Subject: [PATCH 06/17] Fix misdetection of Tamron SP AF 300mm as Canon EF 75-300mm When searching for the Tamron lens, only the string "300mm" is searched in the lens description, which also happens to be present for the Canon lens. Since the Canon lens comes first in the list, it wins. Fix this issue by prefixing the search string with a single space so it always has to match the full focal length specification. --- src/canonmn_int.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/canonmn_int.cpp b/src/canonmn_int.cpp index 38181c5d70..f17e1cd817 100644 --- a/src/canonmn_int.cpp +++ b/src/canonmn_int.cpp @@ -2842,9 +2842,9 @@ namespace Exiv2 { std::ostringstream oss; oss << std::fixed << std::setprecision(0); if (ltfl.focalLengthMin_ == ltfl.focalLengthMax_) { - oss << (ltfl.focalLengthMin_ / divisor) << "mm"; + oss << " " << (ltfl.focalLengthMin_ / divisor) << "mm"; } else { - oss << (ltfl.focalLengthMin_ / divisor) << "-" << (ltfl.focalLengthMax_ / divisor) << "mm"; + oss << " " << (ltfl.focalLengthMin_ / divisor) << "-" << (ltfl.focalLengthMax_ / divisor) << "mm"; } ltfl.focalLength_ = oss.str(); } From 56f9979a4b269c8c3af0f33de8d58adbd021f131 Mon Sep 17 00:00:00 2001 From: Alexander Steffen Date: Thu, 20 Sep 2018 00:55:58 +0200 Subject: [PATCH 07/17] Improve detection of Canon lenses with TC Lenses with and without a TC may share the same lens ID. Prefer entries that explicitly mention the TC. --- src/canonmn_int.cpp | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/src/canonmn_int.cpp b/src/canonmn_int.cpp index f17e1cd817..56ea009c73 100644 --- a/src/canonmn_int.cpp +++ b/src/canonmn_int.cpp @@ -2922,19 +2922,28 @@ namespace Exiv2 { ltfl.lensType_ = value.toLong(); extractLensFocalLength(ltfl, metadata); - if (ltfl.focalLengthMax_ == 0.0F) - return os << value; - convertFocalLength(ltfl, 1.0F); // just lens - const TagDetails* td = find(canonCsLensType, ltfl); - if (!td) { - convertFocalLength(ltfl, 1.4F); // lens + 1.4x TC - td = find(canonCsLensType, ltfl); - if (!td) { - convertFocalLength(ltfl, 2.0F); // lens + 2x TC + + if (ltfl.focalLengthMax_ == 0.0) return os << value; + + const TagDetails* td; + const double factors[] = {1.0, 1.4, 2.0}; + for (const double &factor : factors) + { + convertFocalLength(ltfl, factor); + + std::ostringstream oss; + oss << std::setprecision(2); + oss << factor << "x"; + + ltfl.maxAperture_ = oss.str(); td = find(canonCsLensType, ltfl); - if (!td) return os << value; - } + if (td) break; + + ltfl.maxAperture_ = ""; + td = find(canonCsLensType, ltfl); + if (td) break; } + if (!td) return os << value; return os << td->label_; } From 47d518bc654e605e7d2f3e528017d6cf59fd6434 Mon Sep 17 00:00:00 2001 From: Christoph Hasse Date: Tue, 1 Jun 2021 22:28:13 +0200 Subject: [PATCH 08/17] refactor: move canon lens tests into new test directory This commit does some restructuring to make common utils available for future similar test for other brands --- tests/bugfixes/github/test_canon_lenses.py | 390 --------------------- tests/lens_tests/__init__.py | 0 tests/lens_tests/test_canon_lenses.py | 81 +++++ tests/lens_tests/utils.py | 95 +++++ 4 files changed, 176 insertions(+), 390 deletions(-) delete mode 100644 tests/bugfixes/github/test_canon_lenses.py create mode 100644 tests/lens_tests/__init__.py create mode 100644 tests/lens_tests/test_canon_lenses.py create mode 100644 tests/lens_tests/utils.py diff --git a/tests/bugfixes/github/test_canon_lenses.py b/tests/bugfixes/github/test_canon_lenses.py deleted file mode 100644 index c1165aa240..0000000000 --- a/tests/bugfixes/github/test_canon_lenses.py +++ /dev/null @@ -1,390 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -import system_tests - - -# List of all supported lenses, duplicated from canonCsLensType in src/canonmn_int.cpp, -# to ensure that lenses do not get removed accidentially. -# Lenses should never be removed from this list to guarantee backwards-compatibility. -lenses = ''' - { 1, "Canon EF 50mm f/1.8" }, - { 2, "Canon EF 28mm f/2.8" }, - { 3, "Canon EF 135mm f/2.8 Soft" }, - { 4, "Canon EF 35-105mm f/3.5-4.5" }, // 0 - { 4, "Sigma UC Zoom 35-135mm f/4-5.6" }, // 1 - { 5, "Canon EF 35-70mm f/3.5-4.5" }, - { 6, "Canon EF 28-70mm f/3.5-4.5" }, // 0 - { 6, "Sigma 18-50mm f/3.5-5.6 DC" }, // 1 - { 6, "Sigma 18-125mm f/3.5-5.6 DC IF ASP" }, // 2 - { 6, "Tokina AF193-2 19-35mm f/3.5-4.5" }, // 3 - { 6, "Sigma 28-80mm f/3.5-5.6 II Macro" }, // 4 - { 7, "Canon EF 100-300mm f/5.6L" }, - { 8, "Canon EF 100-300mm f/5.6" }, // 0 - { 8, "Sigma 70-300mm f/4-5.6 [APO] DG Macro" }, // 1 - { 8, "Tokina AT-X 242 AF 24-200mm f/3.5-5.6" }, // 2 - { 9, "Canon EF 70-210mm f/4" }, // 0 - { 9, "Sigma 55-200mm f/4-5.6 DC" }, // 1 - { 10, "Canon EF 50mm f/2.5 Macro" }, // 0 - { 10, "Sigma 50mm f/2.8 EX" }, // 1 - { 10, "Sigma 28mm f/1.8" }, // 2 - { 10, "Sigma 105mm f/2.8 Macro EX" }, // 3 - { 10, "Sigma 70mm f/2.8 EX DG Macro EF" }, // 4 - { 11, "Canon EF 35mm f/2" }, - { 13, "Canon EF 15mm f/2.8 Fisheye" }, - { 14, "Canon EF 50-200mm f/3.5-4.5L" }, - { 15, "Canon EF 50-200mm f/3.5-4.5" }, - { 16, "Canon EF 35-135mm f/3.5-4.5" }, - { 17, "Canon EF 35-70mm f/3.5-4.5A" }, - { 18, "Canon EF 28-70mm f/3.5-4.5" }, - { 20, "Canon EF 100-200mm f/4.5A" }, - { 21, "Canon EF 80-200mm f/2.8L" }, - { 22, "Canon EF 20-35mm f/2.8L" }, // 0 - { 22, "Tokina AT-X 280 AF PRO 28-80mm f/2.8 Aspherical" }, // 1 - { 23, "Canon EF 35-105mm f/3.5-4.5" }, - { 24, "Canon EF 35-80mm f/4-5.6 Power Zoom" }, - { 25, "Canon EF 35-80mm f/4-5.6 Power Zoom" }, - { 26, "Canon EF 100mm f/2.8 Macro" }, // 0 - { 26, "Cosina 100mm f/3.5 Macro AF" }, // 1 - { 26, "Tamron SP AF 90mm f/2.8 Di Macro" }, // 2 - { 26, "Tamron SP AF 180mm f/3.5 Di Macro" }, // 3 - { 26, "Carl Zeiss Planar T* 50mm f/1.4" }, // 4 - { 27, "Canon EF 35-80mm f/4-5.6" }, - { 28, "Canon EF 80-200mm f/4.5-5.6" }, // 0 - { 28, "Tamron SP AF 28-105mm f/2.8 LD Aspherical IF" }, // 1 - { 28, "Tamron SP AF 28-75mm f/2.8 XR Di LD Aspherical [IF] Macro" }, // 2 - { 28, "Tamron AF 70-300mm f/4-5.6 Di LD 1:2 Macro" }, // 3 - { 28, "Tamron AF Aspherical 28-200mm f/3.8-5.6" }, // 4 - { 29, "Canon EF 50mm f/1.8 II" }, - { 30, "Canon EF 35-105mm f/4.5-5.6" }, - { 31, "Canon EF 75-300mm f/4-5.6" }, // 0 - { 31, "Tamron SP AF 300mm f/2.8 LD IF" }, // 1 - { 32, "Canon EF 24mm f/2.8" }, // 0 - { 32, "Sigma 15mm f/2.8 EX Fisheye" }, // 1 - { 33, "Voigtlander Ultron 40mm f/2 SLII Aspherical" }, // 0 - { 33, "Voigtlander Color Skopar 20mm f/3.5 SLII Aspherical" }, // 1 - { 33, "Voigtlander APO-Lanthar 90mm f/3.5 SLII Close Focus" }, // 2 - { 33, "Carl Zeiss Distagon 15mm T* f/2.8 ZE" }, // 3 - { 33, "Carl Zeiss Distagon 18mm T* f/3.5 ZE" }, // 4 - { 33, "Carl Zeiss Distagon 21mm T* f/2.8 ZE" }, // 5 - { 33, "Carl Zeiss Distagon 25mm T* f/2 ZE" }, // 6 - { 33, "Carl Zeiss Distagon 28mm T* f/2 ZE" }, // 7 - { 33, "Carl Zeiss Distagon 35mm T* f/2 ZE" }, // 8 - { 33, "Carl Zeiss Distagon 35mm T* f/1.4 ZE" }, // 9 - { 33, "Carl Zeiss Planar 50mm T* f/1.4 ZE" }, // 10 - { 33, "Carl Zeiss Makro-Planar T* 50mm f/2 ZE" }, // 11 - { 33, "Carl Zeiss Makro-Planar T* 100mm f/2 ZE" }, // 12 - { 33, "Carl Zeiss Apo-Sonnar T* 135mm f/2 ZE" }, // 13 - { 35, "Canon EF 35-80mm f/4-5.6" }, - { 36, "Canon EF 38-76mm f/4.5-5.6" }, - { 37, "Canon EF 35-80mm f/4-5.6" }, // 0 - { 37, "Tamron 70-200mm f/2.8 Di LD IF Macro" }, // 1 - { 37, "Tamron AF 28-300mm f/3.5-6.3 XR Di VC LD Aspherical [IF] Macro Model A20" }, // 2 - { 37, "Tamron SP AF 17-50mm f/2.8 XR Di II VC LD Aspherical [IF]" }, // 3 - { 37, "Tamron AF 18-270mm f/3.5-6.3 Di II VC LD Aspherical [IF] Macro" }, // 4 - { 38, "Canon EF 80-200mm f/4.5-5.6" }, - { 39, "Canon EF 75-300mm f/4-5.6" }, - { 40, "Canon EF 28-80mm f/3.5-5.6" }, - { 41, "Canon EF 28-90mm f/4-5.6" }, - { 42, "Canon EF 28-200mm f/3.5-5.6" }, // 0 - { 42, "Tamron AF 28-300mm f/3.5-6.3 XR Di VC LD Aspherical [IF] Macro Model A20" }, // 1 - { 43, "Canon EF 28-105mm f/4-5.6" }, - { 44, "Canon EF 90-300mm f/4.5-5.6" }, - { 45, "Canon EF-S 18-55mm f/3.5-5.6" }, - { 46, "Canon EF 28-90mm f/4-5.6" }, - { 47, "Zeiss Milvus 35mm f/2" }, // 0 - { 47, "Zeiss Milvus 50mm f/2 Makro" }, // 1 - { 48, "Canon EF-S 18-55mm f/3.5-5.6 IS" }, - { 49, "Canon EF-S 55-250mm f/4-5.6 IS" }, - { 50, "Canon EF-S 18-200mm f/3.5-5.6 IS" }, - { 51, "Canon EF-S 18-135mm f/3.5-5.6 IS" }, - { 52, "Canon EF-S 18-55mm f/3.5-5.6 IS II" }, - { 53, "Canon EF-S 18-55mm f/3.5-5.6 III" }, - { 54, "Canon EF-S 55-250mm f/4-5.6 IS II" }, - { 60, "Irix 11mm f/4" }, - { 82, "Canon TS-E 135mm f/4L Macro" }, - { 94, "Canon TS-E 17mm f/4L" }, - { 95, "Canon TS-E 24mm f/3.5L II" }, - { 124, "Canon MP-E 65mm f/2.8 1-5x Macro Photo" }, - { 125, "Canon TS-E 24mm f/3.5L" }, - { 126, "Canon TS-E 45mm f/2.8" }, - { 127, "Canon TS-E 90mm f/2.8" }, - { 129, "Canon EF 300mm f/2.8L" }, - { 130, "Canon EF 50mm f/1.0L" }, - { 131, "Canon EF 28-80mm f/2.8-4L" }, // 0 - { 131, "Sigma 8mm f/3.5 EX DG Circular Fisheye" }, // 1 - { 131, "Sigma 17-35mm f/2.8-4 EX DG Aspherical HSM" }, // 2 - { 131, "Sigma 17-70mm f/2.8-4.5 DC Macro" }, // 3 - { 131, "Sigma APO 50-150mm f/2.8 EX DC HSM" }, // 4 - { 131, "Sigma APO 120-300mm f/2.8 EX DG HSM" }, // 5 - { 131, "Sigma 70-200mm f/2.8 APO EX HSM" }, // 6 - { 132, "Canon EF 1200mm f/5.6L" }, - { 134, "Canon EF 600mm f/4L IS" }, - { 135, "Canon EF 200mm f/1.8L" }, - { 136, "Canon EF 300mm f/2.8L" }, // 0 - { 136, "Tamron SP 15-30mm f/2.8 Di VC USD A012" }, // 1 - { 137, "Canon EF 85mm f/1.2L" }, // 0 - { 137, "Sigma 18-50mm f/2.8-4.5 DC OS HSM" }, // 1 - { 137, "Sigma 50-200mm f/4-5.6 DC OS HSM" }, // 2 - { 137, "Sigma 18-250mm f/3.5-6.3 DC OS HSM" }, // 3 - { 137, "Sigma 24-70mm f/2.8 IF EX DG HSM" }, // 4 - { 137, "Sigma 18-125mm f/3.8-5.6 DC OS HSM" }, // 5 - { 137, "Sigma 17-70mm f/2.8-4 DC Macro OS HSM | C" }, // 6 - { 137, "Sigma 17-50mm f/2.8 OS HSM" }, // 7 - { 137, "Sigma 18-200mm f/3.5-6.3 DC OS HSM [II]" }, // 8 - { 137, "Tamron AF 18-270mm f/3.5-6.3 Di II VC PZD" }, // 9 - { 137, "Sigma 8-16mm f/4.5-5.6 DC HSM" }, // 10 - { 137, "Tamron SP 60mm f/2 Macro Di II" }, // 11 - { 137, "Sigma 10-20mm f/3.5 EX DC HSM" }, // 12 - { 137, "Sigma 18-35mm f/1.8 DC HSM | A" }, // 13 - { 137, "Sigma 12-24mm f/4.5-5.6 DG HSM II" }, // 14 - { 138, "Canon EF 28-80mm f/2.8-4L" }, - { 139, "Canon EF 400mm f/2.8L" }, - { 140, "Canon EF 500mm f/4.5L" }, - { 141, "Canon EF 500mm f/4.5L" }, - { 142, "Canon EF 300mm f/2.8L IS" }, - { 143, "Canon EF 500mm f/4L IS" }, // 0 - { 143, "Sigma 17-70mm f/2.8-4 DC Macro OS HSM" }, // 1 - { 143, "Sigma 24-105mm f/4 DG OS HSM | A" }, // 2 - { 144, "Canon EF 35-135mm f/4-5.6 USM" }, - { 145, "Canon EF 100-300mm f/4.5-5.6 USM" }, - { 146, "Canon EF 70-210mm f/3.5-4.5 USM" }, - { 147, "Canon EF 35-135mm f/4-5.6 USM" }, - { 148, "Canon EF 28-80mm f/3.5-5.6 USM" }, - { 149, "Canon EF 100mm f/2 USM" }, - { 150, "Canon EF 14mm f/2.8L" }, // 0 - { 150, "Sigma 20mm EX f/1.8" }, // 1 - { 150, "Sigma 30mm f/1.4 DC HSM" }, // 2 - { 150, "Sigma 24mm f/1.8 DG Macro EX" }, // 3 - { 150, "Sigma 28mm f/1.8 DG Macro EX" }, // 4 - { 150, "Sigma 18-35mm f/1.8 DC HSM | A" }, // 5 - { 151, "Canon EF 200mm f/2.8L" }, - { 152, "Canon EF 300mm f/4L IS" }, // 0 - { 152, "Sigma 12-24mm f/4.5-5.6 EX DG ASPHERICAL HSM" }, // 1 - { 152, "Sigma 14mm f/2.8 EX Aspherical HSM" }, // 2 - { 152, "Sigma 10-20mm f/4-5.6" }, // 3 - { 152, "Sigma 100-300mm f/4" }, // 4 - { 153, "Canon EF 35-350mm f/3.5-5.6L" }, // 0 - { 153, "Sigma 50-500mm f/4-6.3 APO HSM EX" }, // 1 - { 153, "Tamron AF 28-300mm f/3.5-6.3 XR LD Aspherical [IF] Macro" }, // 2 - { 153, "Tamron AF 18-200mm f/3.5-6.3 XR Di II LD Aspherical [IF] Macro Model A14" }, // 3 - { 153, "Tamron 18-250mm f/3.5-6.3 Di II LD Aspherical [IF] Macro" }, // 4 - { 154, "Canon EF 20mm f/2.8 USM" }, // 0 - { 154, "Zeiss Milvus 21mm f/2.8" }, // 1 - { 155, "Canon EF 85mm f/1.8 USM" }, // 0 - { 155, "Sigma 14mm f/1.8 DG HSM | A" }, // 1 - { 156, "Canon EF 28-105mm f/3.5-4.5 USM" }, // 0 - { 156, "Tamron SP 70-300mm f/4-5.6 Di VC USD" }, // 1 - { 156, "Tamron SP AF 28-105mm f/2.8 LD Aspherical IF" }, // 2 - { 160, "Canon EF 20-35mm f/3.5-4.5 USM" }, // 0 - { 160, "Tamron AF 19-35mm f/3.5-4.5" }, // 1 - { 160, "Tokina AT-X 124 AF 12-24mm f/4 DX" }, // 2 - { 160, "Tokina AT-X 107 AF DX Fish-eye 10-17mm f/3.5-4.5" }, // 3 - { 160, "Tokina AT-X 116 PRO DX AF 11-16mm f/2.8" }, // 4 - { 160, "Tokina AT-X 11-20 F2.8 PRO DX Aspherical 11-20mm f/2.8" }, // 5 - { 161, "Canon EF 28-70mm f/2.8L" }, // 0 - { 161, "Sigma 24-70mm EX f/2.8" }, // 1 - { 161, "Sigma 24-60mm f/2.8 EX DG" }, // 2 - { 161, "Tamron AF 17-50mm f/2.8 Di-II LD Aspherical" }, // 3 - { 161, "Tamron 90mm f/2.8" }, // 4 - { 161, "Tamron SP AF 17-35mm f/2.8-4 Di LD Aspherical IF" }, // 5 - { 161, "Tamron SP AF 28-75mm f/2.8 XR Di LD Aspherical [IF] Macro" }, // 6 - { 162, "Canon EF 200mm f/2.8L" }, - { 163, "Canon EF 300mm f/4L" }, - { 164, "Canon EF 400mm f/5.6L" }, - { 165, "Canon EF 70-200mm f/2.8L" }, - { 166, "Canon EF 70-200mm f/2.8L + 1.4x" }, - { 167, "Canon EF 70-200mm f/2.8L + 2x" }, - { 168, "Canon EF 28mm f/1.8 USM" }, // 0 - { 168, "Sigma 50-100mm f/1.8 DC HSM | A" }, // 1 - { 169, "Canon EF 17-35mm f/2.8L" }, // 0 - { 169, "Sigma 18-200mm f/3.5-6.3 DC OS" }, // 1 - { 169, "Sigma 15-30mm f/3.5-4.5 EX DG Aspherical" }, // 2 - { 169, "Sigma 18-50mm f/2.8 Macro" }, // 3 - { 169, "Sigma 50mm f/1.4 EX DG HSM" }, // 4 - { 169, "Sigma 85mm f/1.4 EX DG HSM" }, // 5 - { 169, "Sigma 30mm f/1.4 EX DC HSM" }, // 6 - { 169, "Sigma 35mm f/1.4 DG HSM" }, // 7 - { 170, "Canon EF 200mm f/2.8L II" }, - { 171, "Canon EF 300mm f/4L" }, - { 172, "Canon EF 400mm f/5.6L" }, // 0 - { 172, "Sigma 150-600mm f/5-6.3 DG OS HSM | S" }, // 1 - { 172, "Sigma 150-500mm f/5-6.3 APO DG OS HSM + 1.4x" }, // 2 - { 173, "Canon EF 180mm Macro f/3.5L" }, // 0 - { 173, "Sigma APO Macro 150mm f/3.5 EX DG IF HSM" }, // 1 - { 173, "Sigma 150-500mm f/5-6.3 APO DG OS HSM + 2x" }, // 2 - { 174, "Canon EF 135mm f/2L" }, // 0 - { 174, "Sigma 70-200mm f/2.8 EX DG APO OS HSM" }, // 1 - { 174, "Sigma 50-500mm f/4.5-6.3 APO DG OS HSM" }, // 2 - { 174, "Sigma 150-500mm f/5-6.3 APO DG OS HSM" }, // 3 - { 174, "Zeiss Milvus 100mm f/2 Makro" }, // 4 - { 174, "Sigma 120-300mm f/2.8 EX APO DG OS HSM" }, // 5 - { 175, "Canon EF 400mm f/2.8L" }, - { 176, "Canon EF 24-85mm f/3.5-4.5 USM" }, - { 177, "Canon EF 300mm f/4L IS" }, - { 178, "Canon EF 28-135mm f/3.5-5.6 IS" }, - { 179, "Canon EF 24mm f/1.4L" }, - { 180, "Canon EF 35mm f/1.4L" }, // 0 - { 180, "Sigma 50mm f/1.4 DG HSM | A" }, // 1 - { 180, "Sigma 24mm f/1.4 DG HSM | A" }, // 2 - { 180, "Sigma 20mm f/1.4 DG HSM | A" }, // 3 - { 180, "Zeiss Milvus 85mm f/1.4" }, // 4 - { 180, "Zeiss Otus 28mm f/1.4 ZE" }, // 5 - { 181, "Canon EF 100-400mm f/4.5-5.6L IS + 1.4x" }, // 0 - { 181, "Sigma 150-600mm f/5-6.3 DG OS HSM | S + 1.4x" }, // 1 - { 182, "Canon EF 100-400mm f/4.5-5.6L IS + 2x" }, // 0 - { 182, "Sigma 150-600mm f/5-6.3 DG OS HSM | S + 2x" }, // 1 - { 183, "Canon EF 100-400mm f/4.5-5.6L IS" }, // 0 - { 183, "Sigma 150mm f/2.8 EX DG OS HSM APO Macro" }, // 1 - { 183, "Sigma 105mm f/2.8 EX DG OS HSM Macro" }, // 2 - { 183, "Sigma 180mm f/2.8 EX DG OS HSM APO Macro" }, // 3 - { 183, "Sigma 150-600mm f/5-6.3 DG OS HSM | C" }, // 4 - { 184, "Canon EF 400mm f/2.8L + 2x" }, - { 185, "Canon EF 600mm f/4L IS" }, - { 186, "Canon EF 70-200mm f/4L" }, - { 187, "Canon EF 70-200mm f/4L + 1.4x" }, - { 188, "Canon EF 70-200mm f/4L + 2x" }, - { 189, "Canon EF 70-200mm f/4L + 2.8x" }, - { 190, "Canon EF 100mm f/2.8 Macro USM" }, - { 191, "Canon EF 400mm f/4 DO IS" }, - { 193, "Canon EF 35-80mm f/4-5.6 USM" }, - { 194, "Canon EF 80-200mm f/4.5-5.6 USM" }, - { 195, "Canon EF 35-105mm f/4.5-5.6 USM" }, - { 196, "Canon EF 75-300mm f/4-5.6 USM" }, - { 197, "Canon EF 75-300mm f/4-5.6 IS USM" }, // 0 - { 197, "Sigma 18-300mm f/3.5-6.3 DC Macro HSM" }, // 1 - { 198, "Canon EF 50mm f/1.4 USM" }, // 0 - { 198, "Zeiss Otus 55mm f/1.4 ZE" }, // 1 - { 198, "Zeiss Otus 85mm f/1.4 ZE" }, // 2 - { 199, "Canon EF 28-80mm f/3.5-5.6 USM" }, - { 200, "Canon EF 75-300mm f/4-5.6 USM" }, - { 201, "Canon EF 28-80mm f/3.5-5.6 USM" }, - { 202, "Canon EF 28-80mm f/3.5-5.6 USM IV" }, - { 208, "Canon EF 22-55mm f/4-5.6 USM" }, - { 209, "Canon EF 55-200mm f/4.5-5.6" }, - { 210, "Canon EF 28-90mm f/4-5.6 USM" }, - { 211, "Canon EF 28-200mm f/3.5-5.6 USM" }, - { 212, "Canon EF 28-105mm f/4-5.6 USM" }, - { 213, "Canon EF 90-300mm f/4.5-5.6 USM" }, // 0 - { 213, "Tamron SP 150-600mm f/5-6.3 Di VC USD" }, // 1 - { 213, "Tamron 16-300mm f/3.5-6.3 Di II VC PZD Macro" }, // 2 - { 213, "Tamron SP 35mm f/1.8 Di VC USD" }, // 3 - { 213, "Tamron SP 45mm f/1.8 Di VC USD" }, // 4 - { 213, "Tamron SP 70-300mm f/4-5.6 Di VC USD" }, // 5 - { 214, "Canon EF-S 18-55mm f/3.5-5.6 USM" }, - { 215, "Canon EF 55-200mm f/4.5-5.6 II USM" }, - { 217, "Tamron AF 18-270mm f/3.5-6.3 Di II VC PZD" }, - { 224, "Canon EF 70-200mm f/2.8L IS" }, - { 225, "Canon EF 70-200mm f/2.8L IS + 1.4x" }, - { 226, "Canon EF 70-200mm f/2.8L IS + 2x" }, - { 227, "Canon EF 70-200mm f/2.8L IS + 2.8x" }, - { 228, "Canon EF 28-105mm f/3.5-4.5 USM" }, - { 229, "Canon EF 16-35mm f/2.8L" }, - { 230, "Canon EF 24-70mm f/2.8L" }, - { 231, "Canon EF 17-40mm f/4L" }, - { 232, "Canon EF 70-300mm f/4.5-5.6 DO IS USM" }, - { 233, "Canon EF 28-300mm f/3.5-5.6L IS" }, - { 234, "Canon EF-S 17-85mm f/4-5.6 IS USM" }, // 0 - { 234, "Tokina AT-X 12-28 PRO DX 12-28mm f/4" }, // 1 - { 235, "Canon EF-S 10-22mm f/3.5-4.5 USM" }, - { 236, "Canon EF-S 60mm f/2.8 Macro USM" }, - { 237, "Canon EF 24-105mm f/4L IS" }, - { 238, "Canon EF 70-300mm f/4-5.6 IS USM" }, - { 239, "Canon EF 85mm f/1.2L II" }, - { 240, "Canon EF-S 17-55mm f/2.8 IS USM" }, - { 241, "Canon EF 50mm f/1.2L" }, - { 242, "Canon EF 70-200mm f/4L IS" }, - { 243, "Canon EF 70-200mm f/4L IS + 1.4x" }, - { 244, "Canon EF 70-200mm f/4L IS + 2x" }, - { 245, "Canon EF 70-200mm f/4L IS + 2.8x" }, - { 246, "Canon EF 16-35mm f/2.8L II" }, - { 247, "Canon EF 14mm f/2.8L II USM" }, - { 248, "Canon EF 200mm f/2L IS" }, // 0 - { 248, "Sigma 24-35mm f/2 DG HSM | A" }, // 1 - { 249, "Canon EF 800mm f/5.6L IS" }, - { 250, "Canon EF 24mm f/1.4L II" }, // 0 - { 250, "Sigma 20mm f/1.4 DG HSM | A" }, // 1 - { 251, "Canon EF 70-200mm f/2.8L IS II USM" }, - { 252, "Canon EF 70-200mm f/2.8L IS II USM + 1.4x" }, - { 253, "Canon EF 70-200mm f/2.8L IS II USM + 2x" }, - { 254, "Canon EF 100mm f/2.8L Macro IS USM" }, // 0 - { 254, "Tamron SP 90mm f/2.8 Di VC USD Macro 1:1" }, // 1 - { 255, "Sigma 24-105mm f/4 DG OS HSM | A" }, // 0 - { 255, "Sigma 180mm f/2.8 EX DG OS HSM APO Macro" }, // 1 - { 368, "Sigma 18-35mm f/1.8 DC HSM | A" }, - { 488, "Canon EF-S 15-85mm f/3.5-5.6 IS USM" }, - { 489, "Canon EF 70-300mm f/4-5.6L IS USM" }, - { 490, "Canon EF 8-15mm f/4L Fisheye USM" }, - { 491, "Canon EF 300mm f/2.8L IS II USM" }, // 0 - { 491, "Tamron SP 24-70mm f/2.8 Di VC USD G2" }, // 1 - { 492, "Canon EF 400mm f/2.8L IS II USM" }, - { 493, "Canon EF 500mm f/4L IS II USM" }, // 0 - { 493, "Canon EF 24-105mm f/4L IS USM" }, // 1 - { 494, "Canon EF 600mm f/4L IS II USM" }, - { 495, "Canon EF 24-70mm f/2.8L II USM" }, - { 496, "Canon EF 200-400mm f/4L IS USM" }, - { 499, "Canon EF 200-400mm f/4L IS USM + 1.4x" }, - { 502, "Canon EF 28mm f/2.8 IS USM" }, - { 503, "Canon EF 24mm f/2.8 IS USM" }, - { 504, "Canon EF 24-70mm f/4L IS USM" }, - { 505, "Canon EF 35mm f/2 IS USM" }, - { 506, "Canon EF 400mm f/4 DO IS II USM" }, - { 507, "Canon EF 16-35mm f/4L IS USM" }, - { 508, "Canon EF 11-24mm f/4L USM" }, - { 624, "Sigma 14mm f/1.8 DG HSM | A" }, // 0 - { 624, "Sigma 150-600mm f/5-6.3 DG OS HSM | C" }, // 1 - { 624, "Sigma 150-600mm f/5-6.3 DG OS HSM | C + 1.4x" }, // 2 - { 747, "Canon EF 100-400mm f/4.5-5.6L IS II USM" }, // 0 - { 747, "Tamron SP 150-600mm f/5-6.3 Di VC USD G2" }, // 1 - { 748, "Canon EF 100-400mm f/4.5-5.6L IS II USM + 1.4x" }, - { 750, "Canon EF 35mm f/1.4L II USM" }, - { 751, "Canon EF 16-35mm f/2.8L III USM" }, - { 752, "Canon EF 24-105mm f/4L IS II USM" }, - { 4142,"Canon EF-S 18-135mm f/3.5-5.6 IS STM" }, - { 4143,"Canon EF-M 18-55mm f/3.5-5.6 IS STM" }, // 0 - { 4143,"Tamron 18-200mm f/3.5-6.3 Di III VC" }, // 1 - { 4144,"Canon EF 40mm f/2.8 STM" }, - { 4145,"Canon EF-M 22mm f/2 STM" }, - { 4146,"Canon EF-S 18-55mm f/3.5-5.6 IS STM" }, - { 4147,"Canon EF-M 11-22mm f/4-5.6 IS STM" }, - { 4148,"Canon EF-S 55-250mm f/4-5.6 IS STM" }, - { 4149,"Canon EF-M 55-200mm f/4.5-6.3 IS STM" }, - { 4150,"Canon EF-S 10-18mm f/4.5-5.6 IS STM" }, - { 4152,"Canon EF 24-105mm f/3.5-5.6 IS STM" }, - { 4153,"Canon EF-M 15-45mm f/3.5-6.3 IS STM" }, - { 4154,"Canon EF-S 24mm f/2.8 STM" }, - { 4155,"Canon EF-M 28mm f/3.5 Macro IS STM" }, - { 4156,"Canon EF 50mm f/1.8 STM" }, - { 4157,"Canon EF-M 18-150mm f/3.5-6.3 IS STM" }, - { 4158,"Canon EF-S 18-55mm f/4-5.6 IS STM" }, - { 4160,"Canon EF-S 35mm f/2.8 Macro IS STM" }, - {36910,"Canon EF 70-300mm f/4-5.6 IS II USM" }, - {36912,"Canon EF-S 18-135mm f/3.5-5.6 IS USM" }, -''' - -apertures = '1.0', '1.1', '1.2', '1.4', '1.6', '1.8', '2', '2.2', '2.5', '2.8', '3.2', '3.5', '4', '4.5', '5', '5.6', '6.3', '7.1', '8', '9', '10', '11', '13', '14', '16', '18', '20', '22', '25', '29', '32', '36', '40', '45' -fractions = {0: 0, 1: 12, 2: 20} -aperture_map = {value: (index // 3) * 32 + fractions[index % 3] for index, value in enumerate(apertures)} -aperture_map['3.8'] = '32000' # aperture value cannot be represented in metadata, ignore it by using invalid value - -for lens_match in re.finditer('(?P[0-9]+),.*"(?P.*)"', lenses): - lens = lens_match.group('lens_description') - - metadata_match = re.search('((?P[0-9]+)-)?(?P[0-9]+)mm.*f/(?P[0-9]+(\\.[0-9]+)?)[^+]*(\\+ (?P[0-9.]+)x)?', lens) - if not metadata_match: - raise ValueError('Invalid lens format: ' + lens) - tc = float(metadata_match.group('tc') or 1) - - testname = lens_match.group('lens_id') + '_' + lens - globals()[testname] = system_tests.CaseMeta('canon_lenses.' + testname, tuple(), { - 'filename': '$data_path/template.exv', - 'commands': ['$exiv2 -M"set Exif.CanonCs.LensType $lens_id" -M"set Exif.CanonCs.Lens $focal_length_max $focal_length_min 1" -M"set Exif.CanonCs.MaxAperture $aperture" $filename && $exiv2 -pa -K Exif.CanonCs.LensType $filename'], - 'stderr': [''], - 'stdout': ['Exif.CanonCs.LensType Short 1 $lens_description\n'], - 'retval': [0], - **lens_match.groupdict(), - 'aperture': aperture_map[metadata_match.group('aperture')], - 'focal_length_min': int(int(metadata_match.group('focal_length_min') or metadata_match.group('focal_length_max')) * tc), - 'focal_length_max': int(int(metadata_match.group('focal_length_max')) * tc), - }) diff --git a/tests/lens_tests/__init__.py b/tests/lens_tests/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/lens_tests/test_canon_lenses.py b/tests/lens_tests/test_canon_lenses.py new file mode 100644 index 0000000000..623cf81424 --- /dev/null +++ b/tests/lens_tests/test_canon_lenses.py @@ -0,0 +1,81 @@ +# -*- coding: utf-8 -*- + +import re +import os +import system_tests +from lens_tests.utils import extract_lenses_from_cpp + +# get directory of the current file +file_dir = os.path.dirname(os.path.realpath(__file__)) +# to get the canon maker note cpp file that contains list of all supported lenses +canon_lens_file = os.path.abspath(os.path.join(file_dir, "./../../src/canonmn_int.cpp")) +# tell the below function what the start of the lens array looks like +startpattern = "constexpr TagDetails canonCsLensType[] = {" +# use utils function to extract all lenses +lenses = extract_lenses_from_cpp(canon_lens_file, startpattern) + +apertures = ( + "1.0", + "1.1", + "1.2", + "1.4", + "1.6", + "1.8", + "2", + "2.2", + "2.5", + "2.8", + "3.2", + "3.5", + "4", + "4.5", + "5", + "5.6", + "6.3", + "7.1", + "8", + "9", + "10", + "11", + "13", + "14", + "16", + "18", + "20", + "22", + "25", + "29", + "32", + "36", + "40", + "45", +) + +fractions = {0: 0, 1: 12, 2: 20} +aperture_map = {value: (index // 3) * 32 + fractions[index % 3] for index, value in enumerate(apertures)} +aperture_map["3.8"] = "32000" # aperture value cannot be represented in metadata, ignore it by using invalid value + +for (lens_id, lens_desc, meta) in lenses[:5]: + + tc = float(meta["tc"] or 1) + + testname = lens_id + "_" + lens_desc + + globals()[testname] = system_tests.CaseMeta( + "canon_lenses." + testname, + tuple(), + { + "filename": "$data_path/template.exv", + "commands": [ + '$exiv2 -M"set Exif.CanonCs.LensType $lens_id" -M"set Exif.CanonCs.Lens $focal_length_max $focal_length_min 1" -M"set Exif.CanonCs.MaxAperture $aperture_max" $filename && $exiv2 -pa -K Exif.CanonCs.LensType $filename' + ], + "stderr": [""], + "stdout": ["Exif.CanonCs.LensType Short 1 $lens_description\n"], + "retval": [0], + "lens_id": lens_id, + "lens_description": lens_desc, + "aperture_max": aperture_map[meta["aperture_min"] or meta["aperture_max"]], + "focal_length_min": int(int(meta["focal_length_min"] or meta["focal_length_max"]) * tc), + "focal_length_max": int(int(meta["focal_length_max"]) * tc), + }, + ) diff --git a/tests/lens_tests/utils.py b/tests/lens_tests/utils.py new file mode 100644 index 0000000000..d27630dcfc --- /dev/null +++ b/tests/lens_tests/utils.py @@ -0,0 +1,95 @@ +import re +import os +import logging + +log = logging.getLogger(__name__) + + +LENS_ENTRY_DEFAULT_RE = re.compile('^\{\s*(?P[0-9]+),\s*"(?P.*)"') + +LENS_META_DEFAULT_RE = re.compile( + ( + # anything at the start + ".*?" + # maybe min focal length and hyhpen, surely max focal length e.g.: 24-70mm + "(?:(?P[0-9]+)-)?(?P[0-9]+)mm" + # anything inbetween + ".*?" + # maybe short focal length max aperture and hyhpen, surely maxaperture e.g.: f/4.5-5.6 + "f\/(?:(?P[0-9]+(?:\.[0-9]+)?)-)?(?P[0-9]+(?:\.[0-9])?)" + # check if there is a teleconverter pattern e.g. + 1.4x + "(?:.*?\+.*?(?P[0-9.]+x))?" + ) +) + + +def parse_lens_entry(text, pattern=LENS_ENTRY_DEFAULT_RE): + """get the ID, and description from a lens entry field + Expexted input format: + { 748, "Canon EF 100-400mm f/4.5-5.6L IS II USM + 1.4x" } + We return a dict of: + lens_id = 748 + lens_description = "Canon EF 100-400mm f/4.5-5.6L IS II USM + 1.4x" + """ + result = pattern.match(text) + return result.groups() if result else None + + +def extract_meta(text, pattern=LENS_META_DEFAULT_RE): + """ + Extract metadata from lens description. + Input expected in the form of e.g. "Canon EF 100-400mm f/4.5-5.6L IS II USM + 1.4x" + We return a dict of: + focal_length_min = 100 + focal_length_max = 400 + aperture_min = 4.5 + aperture_max = 5.6 + tc = 1.4 + """ + result = pattern.match(text) + + return result.groupdict() if result else None + + +def extract_lenses_from_cpp(filename, start_pattern): + """ + Extract lens information from the lens descritpions array in a maker note cpp file + filename: path to cpp file + start_pattern: start_pattern == line.strip() should return True for + the starting line of the array containing the lenses. + returns: a list of lens entries containing a tuple of the form: + (lens ID, lens description, metadata dictionary) + for content of metadata see extract_meta() function. + """ + lenses = [] + with open(filename, "r") as f: + in_lens_array = False + + for line in f.readlines(): + stripped = line.strip() + + if stripped == start_pattern: + in_lens_array = True + continue + + if stripped == "};": + in_lens_array = False + continue + + if in_lens_array: + lens_entry = parse_lens_entry(stripped) + if not lens_entry: + log.error(f"Failure parsing lens entry: {stripped}.") + continue + + if lens_entry[1] == "n/a": + continue + + meta = extract_meta(lens_entry[1]) + if not meta: + log.error(f"Failure extracing metadata from lens description: {lens_entry[1]}.") + continue + + lenses.append((*lens_entry, meta)) + return lenses + From 4ee8962d42a75adb5ee62684a2c1f46fd330c63b Mon Sep 17 00:00:00 2001 From: Christoph Hasse Date: Wed, 2 Jun 2021 21:18:49 +0200 Subject: [PATCH 09/17] refactor!: use lensfun style nameing for lenses --- src/canonmn_int.cpp | 65 ++++++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 33 deletions(-) diff --git a/src/canonmn_int.cpp b/src/canonmn_int.cpp index 56ea009c73..27bcfa9f82 100644 --- a/src/canonmn_int.cpp +++ b/src/canonmn_int.cpp @@ -1597,7 +1597,6 @@ namespace Exiv2 { //! LensType, tag 0x0016 constexpr TagDetails canonCsLensType[] = { - { -1, "n/a" }, { 1, "Canon EF 50mm f/1.8" }, { 2, "Canon EF 28mm f/2.8" }, { 2, "Sigma 24mm f/2.8 Super Wide II" }, // 1 @@ -1641,7 +1640,7 @@ namespace Exiv2 { { 26, "Tamron SP AF 90mm f/2.8 Di Macro" }, // 2 { 26, "Tamron SP AF 180mm f/3.5 Di Macro" }, // 3 { 26, "Carl Zeiss Planar T* 50mm f/1.4" }, // 4 - { 26, "Voigtlander APO Lanthar 125mm F2.5 SL Macro" }, // 5 + { 26, "Voigtlander APO Lanthar 125mm f/2.5 SL Macro" }, // 5 { 26, "Carl Zeiss Planar T 85mm f/1.4 ZE" }, // 6 { 27, "Canon EF 35-80mm f/4-5.6" }, { 28, "Canon EF 80-200mm f/4.5-5.6" }, @@ -1754,7 +1753,7 @@ namespace Exiv2 { { 142, "Canon EF 300mm f/2.8L IS USM" }, { 143, "Canon EF 500mm f/4L IS USM" }, { 143, "Sigma 17-70mm f/2.8-4 DC Macro OS HSM" }, // 1 - { 143, "Sigma 24-105mm F4 DG OS HSM | A" }, // 2 + { 143, "Sigma 24-105mm f/4 DG OS HSM | A" }, // 2 { 144, "Canon EF 35-135mm f/4-5.6 USM" }, { 145, "Canon EF 100-300mm f/4.5-5.6 USM" }, { 146, "Canon EF 70-210mm f/3.5-4.5 USM" }, @@ -1793,7 +1792,7 @@ namespace Exiv2 { { 160, "Tokina AT-X 124 AF Pro DX 12-24mm f/4" }, // 2 { 160, "Tokina AT-X 107 AF DX 10-17mm f/3.5-4.5 Fisheye" }, // 3 { 160, "Tokina AT-X 116 AF Pro DX 11-16mm f/2.8" }, // 4 - { 160, "Tokina AT-X 11-20 F2.8 PRO DX Aspherical 11-20mm f/2.8" }, // 5 + { 160, "Tokina AT-X 11-20 f/2.8 PRO DX Aspherical 11-20mm f/2.8" }, // 5 { 161, "Canon EF 28-70mm f/2.8L USM" }, { 161, "Sigma 24-70mm f/2.8 EX" }, // 1 { 161, "Sigma 28-70mm f/2.8 EX" }, // 2 @@ -1831,7 +1830,7 @@ namespace Exiv2 { { 173, "Sigma APO Macro 150mm f/2.8 EX DG HSM" }, // 1 { 173, "Sigma 10mm f/2.8 EX DC Fisheye" }, // 2 { 173, "Sigma 15mm f/2.8 EX DG Diagonal Fisheye" }, // 3 - { 173, "Venus Laowa 100mm F2.8 2X Ultra Macro APO" }, // 4 + { 173, "Venus Laowa 100mm f/2.8 2X Ultra Macro APO" }, // 4 { 173, "Sigma 150-500mm f/5-6.3 APO DG OS HSM + 2x" }, // 5 { 174, "Canon EF 135mm f/2L USM" }, { 174, "Sigma 70-200mm f/2.8 EX DG APO OS HSM" }, // 1 @@ -2041,34 +2040,34 @@ namespace Exiv2 { {61494, "Canon CN-E 85mm T1.3 L F" }, {61495, "Canon CN-E 135mm T2.2 L F" }, {61496, "Canon CN-E 35mm T1.5 L F" }, - {61182, "Canon RF 35mm F1.8 Macro IS STM" }, - {61182, "Canon RF 50mm F1.2 L USM" }, // 1 - {61182, "Canon RF 24-105mm F4 L IS USM" }, // 2 - {61182, "Canon RF 28-70mm F2 L USM" }, // 3 - {61182, "Canon RF 85mm F1.2L USM" }, // 4 - {61182, "Canon RF 24-240mm F4-6.3 IS USM" }, // 5 - {61182, "Canon RF 24-70mm F2.8 L IS USM" }, // 6 - {61182, "Canon RF 15-35mm F2.8 L IS USM" }, // 7 - {61182, "Canon RF 50mm F1.8 STM" }, // 8 - {61182, "Canon RF 70-200mm F4L IS USM" }, // 9 - {61182, "Canon RF 28-70mm F2L USM" }, // 10 - {61182, "Canon RF 85mm F2 MACRO IS STM" }, // 11 - {61182, "Canon RF 100-500mm F4.5-7.1L IS USM + RF2x" }, // 12 - {61182, "Canon RF 35mm F1.8 MACRO IS STM" }, // 13 - {61182, "Canon RF 85mm F1.2L USM DS" }, // 14 - {61182, "Canon RF 24-70mm F2.8L IS USM" }, // 15 - {61182, "Canon RF 15-35mm F2.8L IS USM" }, // 16 - {61182, "Canon RF 24-240mm F4-6.3 IS USM" }, // 17 - {61182, "Canon RF 70-200mm F2.8L IS USM" }, // 18 - {61182, "Canon RF 600mm F11 IS STM" }, // 19 - {61182, "Canon RF 600mm F11 IS STM + RF1.4x" }, // 20 - {61182, "Canon RF 600mm F11 IS STM + RF2x" }, // 21 - {61182, "Canon RF 800mm F11 IS STM" }, // 22 - {61182, "Canon RF 800mm F11 IS STM + RF1.4x" }, // 23 - {61182, "Canon RF 800mm F11 IS STM + RF2x" }, // 24 - {61182, "Canon RF 24-105mm F4-7.1 IS STM" }, // 25 - {61182, "Canon RF 100-500mm F4.5-7.1 L IS USM" }, // 26 - {61182, "Canon RF 100-500mm F4.5-7.1L IS USM + RF2x" }, // 27 + {61182, "Canon RF 35mm f/1.8 Macro IS STM" }, + {61182, "Canon RF 50mm f/1.2 L USM" }, // 1 + {61182, "Canon RF 24-105mm f/4 L IS USM" }, // 2 + {61182, "Canon RF 28-70mm f/2 L USM" }, // 3 + {61182, "Canon RF 85mm f/1.2L USM" }, // 4 + {61182, "Canon RF 24-240mm f/4-6.3 IS USM" }, // 5 + {61182, "Canon RF 24-70mm f/2.8 L IS USM" }, // 6 + {61182, "Canon RF 15-35mm f/2.8 L IS USM" }, // 7 + {61182, "Canon RF 50mm f/1.8 STM" }, // 8 + {61182, "Canon RF 70-200mm f/4L IS USM" }, // 9 + {61182, "Canon RF 28-70mm f/2L USM" }, // 10 + {61182, "Canon RF 85mm f/2 MACRO IS STM" }, // 11 + {61182, "Canon RF 100-500mm f/4.5-7.1L IS USM + RF2x" }, // 12 + {61182, "Canon RF 35mm f/1.8 MACRO IS STM" }, // 13 + {61182, "Canon RF 85mm f/1.2L USM DS" }, // 14 + {61182, "Canon RF 24-70mm f/2.8L IS USM" }, // 15 + {61182, "Canon RF 15-35mm f/2.8L IS USM" }, // 16 + {61182, "Canon RF 24-240mm f/4-6.3 IS USM" }, // 17 + {61182, "Canon RF 70-200mm f/2.8L IS USM" }, // 18 + {61182, "Canon RF 600mm f/11 IS STM" }, // 19 + {61182, "Canon RF 600mm f/11 IS STM + RF1.4x" }, // 20 + {61182, "Canon RF 600mm f/11 IS STM + RF2x" }, // 21 + {61182, "Canon RF 800mm f/11 IS STM" }, // 22 + {61182, "Canon RF 800mm f/11 IS STM + RF1.4x" }, // 23 + {61182, "Canon RF 800mm f/11 IS STM + RF2x" }, // 24 + {61182, "Canon RF 24-105mm f/4-7.1 IS STM" }, // 25 + {61182, "Canon RF 100-500mm f/4.5-7.1 L IS USM" }, // 26 + {61182, "Canon RF 100-500mm f/4.5-7.1L IS USM + RF2x" }, // 27 {65535, "n/a" } }; From a70896c1ac887e7c944669b458c1ae1760684524 Mon Sep 17 00:00:00 2001 From: Christoph Hasse Date: Wed, 2 Jun 2021 21:36:13 +0200 Subject: [PATCH 10/17] refactor: use function to calculate raw exif value given aperture --- tests/lens_tests/test_canon_lenses.py | 70 +++++++++++---------------- tests/lens_tests/utils.py | 23 ++++++--- 2 files changed, 44 insertions(+), 49 deletions(-) diff --git a/tests/lens_tests/test_canon_lenses.py b/tests/lens_tests/test_canon_lenses.py index 623cf81424..3217574da6 100644 --- a/tests/lens_tests/test_canon_lenses.py +++ b/tests/lens_tests/test_canon_lenses.py @@ -3,6 +3,7 @@ import re import os import system_tests +import math from lens_tests.utils import extract_lenses_from_cpp # get directory of the current file @@ -14,48 +15,33 @@ # use utils function to extract all lenses lenses = extract_lenses_from_cpp(canon_lens_file, startpattern) -apertures = ( - "1.0", - "1.1", - "1.2", - "1.4", - "1.6", - "1.8", - "2", - "2.2", - "2.5", - "2.8", - "3.2", - "3.5", - "4", - "4.5", - "5", - "5.6", - "6.3", - "7.1", - "8", - "9", - "10", - "11", - "13", - "14", - "16", - "18", - "20", - "22", - "25", - "29", - "32", - "36", - "40", - "45", -) +def aperture_to_raw_exif(aperture): + #see https://github.com/exiftool/exiftool/blob/master/lib/Image/ExifTool/Canon.pm#L9678 + aperture = float(aperture) + # for apertures < 1 the below is negative + num = math.log(aperture)*2/math.log(2) -fractions = {0: 0, 1: 12, 2: 20} -aperture_map = {value: (index // 3) * 32 + fractions[index % 3] for index, value in enumerate(apertures)} -aperture_map["3.8"] = "32000" # aperture value cannot be represented in metadata, ignore it by using invalid value + # temporarily make the number positive + if (num < 0): + num = -num + sign = -1 + else: + sign = 1; -for (lens_id, lens_desc, meta) in lenses[:5]: + val = int(num) + frac = num - val + + if (abs(frac - 0.33) < 0.05): + frac = 0x0c + elif (abs(frac - 0.67) < 0.05): + frac = 0x14; + else: + frac = int(frac * 0x20 + 0.5) + + return sign * (val * 0x20 + frac); + + +for (lens_id, lens_desc, meta) in lenses: tc = float(meta["tc"] or 1) @@ -74,8 +60,8 @@ "retval": [0], "lens_id": lens_id, "lens_description": lens_desc, - "aperture_max": aperture_map[meta["aperture_min"] or meta["aperture_max"]], - "focal_length_min": int(int(meta["focal_length_min"] or meta["focal_length_max"]) * tc), + "aperture_max": aperture_to_raw_exif(meta["aperture_max_short"]), + "focal_length_min": int(int(meta["focal_length_min"]) * tc), "focal_length_max": int(int(meta["focal_length_max"]) * tc), }, ) diff --git a/tests/lens_tests/utils.py b/tests/lens_tests/utils.py index d27630dcfc..31e7afa655 100644 --- a/tests/lens_tests/utils.py +++ b/tests/lens_tests/utils.py @@ -15,10 +15,11 @@ "(?:(?P[0-9]+)-)?(?P[0-9]+)mm" # anything inbetween ".*?" - # maybe short focal length max aperture and hyhpen, surely maxaperture e.g.: f/4.5-5.6 - "f\/(?:(?P[0-9]+(?:\.[0-9]+)?)-)?(?P[0-9]+(?:\.[0-9])?)" + # maybe short focal length max aperture and hyhpen, surely at least single max aperture e.g.: f/4.5-5.6 + # short and tele indicate apertures at the short (focal_length_min) and tele (focal_length_max) position of the lens + "(?:(?:f\/)|T)(?:(?P[0-9]+(?:\.[0-9]+)?)-)?(?P[0-9]+(?:\.[0-9])?)" # check if there is a teleconverter pattern e.g. + 1.4x - "(?:.*?\+.*?(?P[0-9.]+x))?" + "(?:.*?\+.*?(?P[0-9.]+)x)?" ) ) @@ -42,13 +43,21 @@ def extract_meta(text, pattern=LENS_META_DEFAULT_RE): We return a dict of: focal_length_min = 100 focal_length_max = 400 - aperture_min = 4.5 - aperture_max = 5.6 + aperture_max_short = 4.5 + aperture_max_tele = 5.6 tc = 1.4 """ result = pattern.match(text) - return result.groupdict() if result else None + if(not result): + # didn't match + return None + + ret = result.groupdict() + # set min to max value if we didn't get a range but a single value + ret['focal_length_min'] = ret['focal_length_min'] or ret['focal_length_max'] + ret['aperture_max_short'] = ret['aperture_max_short'] or ret['aperture_max_tele'] + return ret def extract_lenses_from_cpp(filename, start_pattern): @@ -87,7 +96,7 @@ def extract_lenses_from_cpp(filename, start_pattern): meta = extract_meta(lens_entry[1]) if not meta: - log.error(f"Failure extracing metadata from lens description: {lens_entry[1]}.") + log.error(f"Failure extracing metadata from lens description: {lens_entry[0]}: {lens_entry[1]}.") continue lenses.append((*lens_entry, meta)) From cc89dca5a216eced7ebed84eba432896b074443c Mon Sep 17 00:00:00 2001 From: Christoph Hasse Date: Thu, 3 Jun 2021 00:03:06 +0200 Subject: [PATCH 11/17] feat: rework lens test to account for ambiguous lenses For each lens, its test target is now defined as the list of all lenses which are possible given that lenses exif values. --- tests/lens_tests/test_canon_lenses.py | 39 +++++++++++----------- tests/lens_tests/utils.py | 47 ++++++++++++++++++++++++--- 2 files changed, 61 insertions(+), 25 deletions(-) diff --git a/tests/lens_tests/test_canon_lenses.py b/tests/lens_tests/test_canon_lenses.py index 3217574da6..37f5200a52 100644 --- a/tests/lens_tests/test_canon_lenses.py +++ b/tests/lens_tests/test_canon_lenses.py @@ -4,7 +4,7 @@ import os import system_tests import math -from lens_tests.utils import extract_lenses_from_cpp +from lens_tests.utils import extract_lenses_from_cpp, make_test_cases # get directory of the current file file_dir = os.path.dirname(os.path.realpath(__file__)) @@ -14,38 +14,37 @@ startpattern = "constexpr TagDetails canonCsLensType[] = {" # use utils function to extract all lenses lenses = extract_lenses_from_cpp(canon_lens_file, startpattern) +# use utils function to define test case data +test_cases = make_test_cases(lenses) +# see https://github.com/exiftool/exiftool/blob/master/lib/Image/ExifTool/Canon.pm#L9678 def aperture_to_raw_exif(aperture): - #see https://github.com/exiftool/exiftool/blob/master/lib/Image/ExifTool/Canon.pm#L9678 - aperture = float(aperture) # for apertures < 1 the below is negative - num = math.log(aperture)*2/math.log(2) + num = math.log(aperture) * 2 / math.log(2) # temporarily make the number positive - if (num < 0): + if num < 0: num = -num sign = -1 else: - sign = 1; + sign = 1 val = int(num) frac = num - val - if (abs(frac - 0.33) < 0.05): - frac = 0x0c - elif (abs(frac - 0.67) < 0.05): - frac = 0x14; + if abs(frac - 0.33) < 0.05: + frac = 0x0C + elif abs(frac - 0.67) < 0.05: + frac = 0x14 else: frac = int(frac * 0x20 + 0.5) - return sign * (val * 0x20 + frac); + return sign * (val * 0x20 + frac) -for (lens_id, lens_desc, meta) in lenses: +for lens_tc in test_cases: - tc = float(meta["tc"] or 1) - - testname = lens_id + "_" + lens_desc + testname = lens_tc["id"] + "_" + lens_tc["desc"] globals()[testname] = system_tests.CaseMeta( "canon_lenses." + testname, @@ -58,10 +57,10 @@ def aperture_to_raw_exif(aperture): "stderr": [""], "stdout": ["Exif.CanonCs.LensType Short 1 $lens_description\n"], "retval": [0], - "lens_id": lens_id, - "lens_description": lens_desc, - "aperture_max": aperture_to_raw_exif(meta["aperture_max_short"]), - "focal_length_min": int(int(meta["focal_length_min"]) * tc), - "focal_length_max": int(int(meta["focal_length_max"]) * tc), + "lens_id": lens_tc["id"], + "lens_description": lens_tc["target"], + "aperture_max": aperture_to_raw_exif(lens_tc["aperture_max_short"]), + "focal_length_min": int(lens_tc["focal_length_min"] * lens_tc["tc"]), + "focal_length_max": int(lens_tc["focal_length_max"] * lens_tc["tc"]), }, ) diff --git a/tests/lens_tests/utils.py b/tests/lens_tests/utils.py index 31e7afa655..fa03cf86e9 100644 --- a/tests/lens_tests/utils.py +++ b/tests/lens_tests/utils.py @@ -1,6 +1,7 @@ import re import os import logging +from itertools import groupby log = logging.getLogger(__name__) @@ -49,17 +50,54 @@ def extract_meta(text, pattern=LENS_META_DEFAULT_RE): """ result = pattern.match(text) - if(not result): + if not result: # didn't match return None ret = result.groupdict() # set min to max value if we didn't get a range but a single value - ret['focal_length_min'] = ret['focal_length_min'] or ret['focal_length_max'] - ret['aperture_max_short'] = ret['aperture_max_short'] or ret['aperture_max_tele'] + ret["focal_length_min"] = int(ret["focal_length_min"] or ret["focal_length_max"]) + ret["focal_length_max"] = int(ret["focal_length_max"]) + ret["aperture_max_short"] = float(ret["aperture_max_short"] or ret["aperture_max_tele"]) + ret["aperture_max_tele"] = float(ret["aperture_max_tele"]) + ret["tc"] = float(ret["tc"] or 1) return ret +# FIXME explain somwhere that lens_is_match(l1,l2) does not imply lens_is_match(l2,l1) +# becuse we don't have short and tele aperture values in exif +def lens_is_match(l1, l2): + """ + Test if lens l2 is compatible with lens l1, + assuming we write l1's metadata and apeture_max_short into exif + """ + return ( + all([l1[k] == l2[k] for k in ["tc", "focal_length_min", "focal_length_max"]]) + and l2["aperture_max_short"] <= l1["aperture_max_short"] <= l2["aperture_max_tele"] + ) + + +def make_test_cases(lenses): + """ + Creates a test case for each lens + Main job of this function is to collect all ambiguous lenses and define a test target + as the " *OR* " joined string of all ambiguous lens descriptions + """ + test_cases = [] + for lens_id, group in groupby(lenses, lambda x: x["id"]): + lens_group = list(group) + test_cases += [ + { + **lens["meta"], + "id": lens["id"], + "desc": lens["desc"], + "target": " *OR* ".join([l["desc"] for l in lens_group if lens_is_match(lens["meta"], l["meta"])]), + } + for lens in lens_group + ] + return test_cases + + def extract_lenses_from_cpp(filename, start_pattern): """ Extract lens information from the lens descritpions array in a maker note cpp file @@ -99,6 +137,5 @@ def extract_lenses_from_cpp(filename, start_pattern): log.error(f"Failure extracing metadata from lens description: {lens_entry[0]}: {lens_entry[1]}.") continue - lenses.append((*lens_entry, meta)) + lenses.append({"id": lens_entry[0], "desc": lens_entry[1], "meta": meta}) return lenses - From 907fe2369ec879dcabaeb7ebe56951c83773d275 Mon Sep 17 00:00:00 2001 From: Christoph Hasse Date: Thu, 3 Jun 2021 21:40:05 +0200 Subject: [PATCH 12/17] fix: readd some previously removed lenses now that we plan to trea ambiguous lenses --- src/canonmn_int.cpp | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/src/canonmn_int.cpp b/src/canonmn_int.cpp index 27bcfa9f82..737a01a2cd 100644 --- a/src/canonmn_int.cpp +++ b/src/canonmn_int.cpp @@ -1741,11 +1741,13 @@ namespace Exiv2 { { 137, "Sigma 18-200mm f/3.5-6.3 DC OS HSM [II]" }, // 8 { 137, "Tamron AF 18-270mm f/3.5-6.3 Di II VC PZD" }, // 9 { 137, "Sigma 8-16mm f/4.5-5.6 DC HSM" }, // 10 - { 137, "Tamron SP 60mm f/2 Macro Di II" }, // 11 - { 137, "Sigma 10-20mm f/3.5 EX DC HSM" }, // 12 - { 137, "Sigma 18-35mm f/1.8 DC HSM | A" }, // 13 - { 137, "Sigma 12-24mm f/4.5-5.6 DG HSM II" }, // 14 - { 137, "Sigma 70-300mm f/4-5.6 DG OS" }, // 15 + { 137, "Tamron SP 17-50mm f/2.8 XR Di II VC" }, // 11 + { 137, "Tamron SP 60mm f/2 Macro Di II" }, // 12 + { 137, "Sigma 10-20mm f/3.5 EX DC HSM" }, // 13 + { 137, "Tamron SP 24-70mm f/2.8 Di VC USD" }, // 14 + { 137, "Sigma 18-35mm f/1.8 DC HSM | A" }, // 15 + { 137, "Sigma 12-24mm f/4.5-5.6 DG HSM II" }, // 16 + { 137, "Sigma 70-300mm f/4-5.6 DG OS" }, // 17 { 138, "Canon EF 28-80mm f/2.8-4L" }, { 139, "Canon EF 400mm f/2.8L USM" }, { 140, "Canon EF 500mm f/4.5L USM" }, @@ -1801,6 +1803,7 @@ namespace Exiv2 { { 161, "Tamron 90mm f/2.8" }, // 5 { 161, "Tamron SP AF 17-35mm f/2.8-4 Di LD Aspherical IF" }, // 6 { 161, "Tamron SP AF 28-75mm f/2.8 XR Di LD Aspherical [IF] Macro" }, // 7 + { 161, "Tokina AT-X 24-70mm f/2.8 PRO FX (IF)" }, // 8 { 162, "Canon EF 200mm f/2.8L USM" }, { 163, "Canon EF 300mm f/4L" }, { 164, "Canon EF 400mm f/5.6L" }, @@ -1827,11 +1830,12 @@ namespace Exiv2 { { 172, "Sigma 150-600mm f/5-6.3 DG OS HSM | S" }, // 1 { 172, "Sigma 500mm f/4.5 APO EX DG HSM" }, // 2 { 173, "Canon EF 180mm Macro f/3.5L USM" }, - { 173, "Sigma APO Macro 150mm f/2.8 EX DG HSM" }, // 1 - { 173, "Sigma 10mm f/2.8 EX DC Fisheye" }, // 2 - { 173, "Sigma 15mm f/2.8 EX DG Diagonal Fisheye" }, // 3 - { 173, "Venus Laowa 100mm f/2.8 2X Ultra Macro APO" }, // 4 - { 173, "Sigma 150-500mm f/5-6.3 APO DG OS HSM + 2x" }, // 5 + { 173, "Sigma 180mm EX HSM Macro f/3.5" }, // 1 + { 173, "Sigma APO Macro 150mm f/2.8 EX DG HSM" }, // 2 + { 173, "Sigma 10mm f/2.8 EX DC Fisheye" }, // 3 + { 173, "Sigma 15mm f/2.8 EX DG Diagonal Fisheye" }, // 4 + { 173, "Venus Laowa 100mm f/2.8 2X Ultra Macro APO" }, // 5 + { 173, "Sigma 150-500mm f/5-6.3 APO DG OS HSM + 2x" }, // 6 { 174, "Canon EF 135mm f/2L USM" }, { 174, "Sigma 70-200mm f/2.8 EX DG APO OS HSM" }, // 1 { 174, "Sigma 50-500mm f/4.5-6.3 APO DG OS HSM" }, // 2 @@ -1850,12 +1854,14 @@ namespace Exiv2 { { 180, "Canon EF 35mm f/1.4L USM" }, { 180, "Sigma 50mm f/1.4 DG HSM | A" }, // 1 { 180, "Sigma 24mm f/1.4 DG HSM | A" }, // 2 - { 180, "Zeiss Milvus 85mm f/1.4" }, // 3 - { 180, "Zeiss Otus 28mm f/1.4 ZE" }, // 4 - { 180, "Sigma 24mm f/1.5 FF High-Speed Prime | 017" }, // 5 - { 180, "Sigma 50mm f/1.5 FF High-Speed Prime | 017" }, // 6 - { 180, "Sigma 85mm f/1.5 FF High-Speed Prime | 017" }, // 7 - { 180, "Sigma 20mm f/1.4 DG HSM | A" }, // 8 + { 180, "Zeiss Milvus 50mm f/1.4" }, // 3 + { 180, "Zeiss Milvus 85mm f/1.4" }, // 4 + { 180, "Zeiss Otus 28mm f/1.4 ZE" }, // 5 + { 180, "Sigma 24mm f/1.5 FF High-Speed Prime | 017" }, // 6 + { 180, "Sigma 50mm f/1.5 FF High-Speed Prime | 017" }, // 7 + { 180, "Sigma 85mm f/1.5 FF High-Speed Prime | 017" }, // 8 + { 180, "Tokina Opera 50mm f/1.4 FF" }, // 9 + { 180, "Sigma 20mm f/1.4 DG HSM | A" }, // 10 { 181, "Canon EF 100-400mm f/4.5-5.6L IS USM + 1.4x" }, { 181, "Sigma 150-600mm f/5-6.3 DG OS HSM | S + 1.4x" }, // 1 { 182, "Canon EF 100-400mm f/4.5-5.6L IS USM + 2x" }, @@ -1865,6 +1871,7 @@ namespace Exiv2 { { 183, "Sigma 105mm f/2.8 EX DG OS HSM Macro" }, // 2 { 183, "Sigma 180mm f/2.8 EX DG OS HSM APO Macro" }, // 3 { 183, "Sigma 150-600mm f/5-6.3 DG OS HSM | C" }, // 4 + { 183, "Sigma 150-600mm f/5-6.3 DG OS HSM | S" }, // 5 { 183, "Sigma 100-400mm f/5-6.3 DG OS HSM" }, // 6 { 183, "Sigma 180mm f/3.5 APO Macro EX DG IF HSM" }, // 7 { 184, "Canon EF 400mm f/2.8L USM + 2x" }, From bdd8a386b506da1d621cc170b1720821cf3580df Mon Sep 17 00:00:00 2001 From: Christoph Hasse Date: Tue, 8 Jun 2021 21:56:04 +0200 Subject: [PATCH 13/17] feat: improve lens recognition of canon makernote If multiple choices are possible they are now all reported. This behaviour is now the same as it is in exiftool. All lenses are tested in the new test_canon_lenses.py test --- src/canonmn_int.cpp | 729 +++++++++++--------------- tests/lens_tests/test_canon_lenses.py | 38 +- tests/lens_tests/utils.py | 90 +++- 3 files changed, 383 insertions(+), 474 deletions(-) diff --git a/src/canonmn_int.cpp b/src/canonmn_int.cpp index 737a01a2cd..842237fc4a 100644 --- a/src/canonmn_int.cpp +++ b/src/canonmn_int.cpp @@ -25,6 +25,7 @@ */ // ***************************************************************************** // included header files +#include "error.hpp" #include "types.hpp" #include "makernote_int.hpp" #include "canonmn_int.hpp" @@ -34,6 +35,7 @@ #include "i18n.h" // NLS support. // + standard includes +#include #include #include #include @@ -54,18 +56,8 @@ namespace Exiv2 { { 1, N_("On") } }; - //! Special treatment pretty-print function for non-unique lens ids. - std::ostream& printCsLensByFocalLengthAndMaxAperture(std::ostream& os, - const Value& value, - const ExifData* metadata); - //! Special treatment pretty-print function for non-unique lens ids. - std::ostream& printCsLensByFocalLength(std::ostream& os, - const Value& value, - const ExifData* metadata); - //! Special treatment pretty-print function for non-unique lens ids. - std::ostream& printCsLensByFocalLengthTC(std::ostream& os, - const Value& value, - const ExifData* metadata); + std::ostream& printCsLensTypeByMetadata(std::ostream& os, const Value& value, const ExifData* metadata); + //! Special treatment pretty-print function for non-unique lens ids. std::ostream& printCsLensFFFF(std::ostream& os, const Value& value, @@ -73,11 +65,11 @@ namespace Exiv2 { //! ModelId, tag 0x0010 constexpr TagDetails canonModelId[] = { - { static_cast(0x00000811), "EOS M6 Mark II"}, - { static_cast(0x00000804), "Powershot G5 X Mark II"}, - { static_cast(0x00000805), "PowerShot SX70 HS"}, - { static_cast(0x00000808), "PowerShot G7 X Mark III"}, - { static_cast(0x00000812), "EOS M200"}, + { static_cast(0x00000811), "EOS M6 Mark II"}, + { static_cast(0x00000804), "Powershot G5 X Mark II"}, + { static_cast(0x00000805), "PowerShot SX70 HS"}, + { static_cast(0x00000808), "PowerShot G7 X Mark III"}, + { static_cast(0x00000812), "EOS M200"}, { static_cast(0x1010000), "PowerShot A30" }, { static_cast(0x1040000), "PowerShot S300 / Digital IXUS 300 / IXY Digital 300" }, { static_cast(0x1060000), "PowerShot A20" }, @@ -407,7 +399,7 @@ namespace Exiv2 { { static_cast(0x80000406), "EOS 6D Mark II" }, { static_cast(0x80000408), "EOS 77D / 9000D" }, { static_cast(0x80000417), "EOS Rebel SL2 / 200D / Kiss X9" }, - { static_cast(0x80000421), "EOS R5" }, + { static_cast(0x80000421), "EOS R5" }, { static_cast(0x80000422), "EOS Rebel T100 / 4000D / 3000D" }, { static_cast(0x80000424), "EOS R" }, { static_cast(0x80000428), "EOS-1D X Mark III" }, @@ -553,53 +545,53 @@ namespace Exiv2 { {0x000e, "FileLength", N_("FileLength"), N_("FileLength"), canonId, makerTags, unsignedLong, -1, printValue}, {0x000f, "CustomFunctions", N_("Custom Functions"), N_("Custom Functions"), canonId, makerTags, unsignedShort, -1, printValue}, {0x0010, "ModelID", N_("ModelID"), N_("Model ID"), canonId, makerTags, unsignedLong, -1, EXV_PRINT_TAG(canonModelId)}, - {0x0011, "MovieInfo", N_("MovieInfo"), N_("Movie info"), canonId, makerTags, unsignedShort, -1, printValue}, + {0x0011, "MovieInfo", N_("MovieInfo"), N_("Movie info"), canonId, makerTags, unsignedShort, -1, printValue}, {0x0012, "PictureInfo", N_("Picture Info"), N_("Picture info"), canonId, makerTags, unsignedShort, -1, printValue}, {0x0013, "ThumbnailImageValidArea", N_("Thumbnail Image Valid Area"), N_("Thumbnail image valid area"), canonId, makerTags, signedShort, -1, printValue}, {0x0015, "SerialNumberFormat", N_("Serial Number Format"), N_("Serial number format"), canonId, makerTags, unsignedLong, -1, EXV_PRINT_TAG(canonSerialNumberFormat)}, {0x001a, "SuperMacro", N_("Super Macro"), N_("Super macro"), canonId, makerTags, signedShort, -1, EXV_PRINT_TAG(canonSuperMacro)}, - {0x001c, "DateStampMode", N_("DateStampMode"), N_("Data_Stamp_Mode"), canonId, makerTags, unsignedShort, -1, EXV_PRINT_TAG(canonDateStampMode)}, - {0x001d, "MyColors", N_("MyColors"), N_("My_Colors"), canonId, makerTags, unsignedShort, -1, printValue}, - {0x001e, "FirmwareRevision", N_("FirmwareRevision"), N_("Firmware_Revision"), canonId, makerTags, unsignedLong, -1, printValue}, - // {0x0023, "Categories", N_("Categories"), N_("Categories"), canonId, makerTags, unsignedLong -1, EXV_PRINT_TAG(canonCategories)}, - {0x0024, "FaceDetect1", N_("FaceDetect1"), N_("FaceDetect1"), canonId, makerTags, unsignedShort, -1, printValue}, - {0x0025, "FaceDetect2", N_("FaceDetect2"), N_("FaceDetect2"), canonId, makerTags, unsignedShort, -1, printValue}, + {0x001c, "DateStampMode", N_("DateStampMode"), N_("Data_Stamp_Mode"), canonId, makerTags, unsignedShort, -1, EXV_PRINT_TAG(canonDateStampMode)}, + {0x001d, "MyColors", N_("MyColors"), N_("My_Colors"), canonId, makerTags, unsignedShort, -1, printValue}, + {0x001e, "FirmwareRevision", N_("FirmwareRevision"), N_("Firmware_Revision"), canonId, makerTags, unsignedLong, -1, printValue}, + // {0x0023, "Categories", N_("Categories"), N_("Categories"), canonId, makerTags, unsignedLong -1, EXV_PRINT_TAG(canonCategories)}, + {0x0024, "FaceDetect1", N_("FaceDetect1"), N_("FaceDetect1"), canonId, makerTags, unsignedShort, -1, printValue}, + {0x0025, "FaceDetect2", N_("FaceDetect2"), N_("FaceDetect2"), canonId, makerTags, unsignedShort, -1, printValue}, {0x0026, "AFInfo", N_("AF Info"), N_("AF info"), canonId, makerTags, unsignedShort, -1, printValue}, - {0x0027, "ContrastInfo", N_("ContrastInfo"), N_("ContrastInfo"), canonId, makerTags, unsignedShort, -1, printValue}, - {0x0028, "ImageUniqueID", N_("ImageUniqueID"), N_("ImageUniqueID"), canonId, makerTags, unsignedShort, -1, printValue}, - {0x0029, "WBInfo", N_("WBInfo"), N_("WBInfo"), canonId, makerTags, unsignedShort, -1, printValue}, - {0x002f, "FaceDetect3", N_("FaceDetect3"), N_("FaceDetect3"), canonId, makerTags, unsignedShort, -1, printValue}, + {0x0027, "ContrastInfo", N_("ContrastInfo"), N_("ContrastInfo"), canonId, makerTags, unsignedShort, -1, printValue}, + {0x0028, "ImageUniqueID", N_("ImageUniqueID"), N_("ImageUniqueID"), canonId, makerTags, unsignedShort, -1, printValue}, + {0x0029, "WBInfo", N_("WBInfo"), N_("WBInfo"), canonId, makerTags, unsignedShort, -1, printValue}, + {0x002f, "FaceDetect3", N_("FaceDetect3"), N_("FaceDetect3"), canonId, makerTags, unsignedShort, -1, printValue}, {0x0035, "TimeInfo", N_("Time Info"), N_("Time zone information"), canonId, makerTags, signedLong, -1, printValue}, - {0x0038, "BatteryType", N_("BatteryType"), N_("BatteryType"), canonId, makerTags, unsignedLong, -1, printValue}, - {0x003c, "AFInfo3", N_("AFInfo3"), N_("AFInfo3"), canonId, makerTags, unsignedShort, -1, printValue}, - {0x0081, "RawDataOffset", N_("RawDataOffset"), N_("RawDataOffset"), canonId, makerTags, signedLong, -1, printValue}, + {0x0038, "BatteryType", N_("BatteryType"), N_("BatteryType"), canonId, makerTags, unsignedLong, -1, printValue}, + {0x003c, "AFInfo3", N_("AFInfo3"), N_("AFInfo3"), canonId, makerTags, unsignedShort, -1, printValue}, + {0x0081, "RawDataOffset", N_("RawDataOffset"), N_("RawDataOffset"), canonId, makerTags, signedLong, -1, printValue}, {0x0083, "OriginalDecisionDataOffset", N_("Original Decision Data Offset"), N_("Original decision data offset"), canonId, makerTags, signedLong, -1, printValue}, {0x00a4, "WhiteBalanceTable", N_("White Balance Table"), N_("White balance table"), canonId, makerTags, unsignedShort, -1, printValue}, // {0x0090, "CustomFunctions1D", N_("CustomFunctions1D"), N_("CustomFunctions1D"), canonId, makerTags, unsignedShort, -1, printValue}, // ToDo // {0x0091, "PersonalFunctions", N_("PersonalFunctions"), N_("PersonalFunctions"), canonId, makerTags, unsignedShort, -1, printValue}, // ToDo // {0x0092, "PersonalFunctionValues", N_("PersonalFunctionValues"), N_("PersonalFunctionValues"), canonId, makerTags, unsignedShort, -1, printValue}, // ToDo - {0x0093, "CanonFileInfo", N_("CanonFileInfo"), N_("CanonFileInfo"), canonId, makerTags, unsignedShort, -1, printValue}, - {0x0094, "AFPointsInFocus1D", N_("AFPointsInFocus1D"), N_("AFPointsInFocus1D"), canonId, makerTags, unsignedShort, -1, printValue}, + {0x0093, "CanonFileInfo", N_("CanonFileInfo"), N_("CanonFileInfo"), canonId, makerTags, unsignedShort, -1, printValue}, + {0x0094, "AFPointsInFocus1D", N_("AFPointsInFocus1D"), N_("AFPointsInFocus1D"), canonId, makerTags, unsignedShort, -1, printValue}, {0x0095, "LensModel", N_("Lens Model"), N_("Lens model"), canonId, makerTags, asciiString, -1, printValue}, {0x0096, "InternalSerialNumber", N_("Internal Serial Number"), N_("Internal serial number"), canonId, makerTags, asciiString, -1, printValue}, {0x0097, "DustRemovalData", N_("Dust Removal Data"), N_("Dust removal data"), canonId, makerTags, asciiString, -1, printValue}, {0x0099, "CustomFunctions", N_("Custom Functions"), N_("Custom functions"), canonId, makerTags, unsignedShort, -1, printValue}, - {0x009a, "AspectInfo", N_("AspectInfo"), N_("AspectInfo"), canonId, makerTags, unsignedShort, -1, printValue}, + {0x009a, "AspectInfo", N_("AspectInfo"), N_("AspectInfo"), canonId, makerTags, unsignedShort, -1, printValue}, {0x00a0, "ProcessingInfo", N_("Processing Info"), N_("Processing info"), canonId, makerTags, unsignedShort, -1, printValue}, - {0x00a1, "ToneCurveTable", N_("ToneCurveTable"), N_("ToneCurveTable"), canonId, makerTags, unsignedShort, -1, printValue}, - {0x00a2, "SharpnessTable", N_("SharpnessTable"), N_("SharpnessTable"), canonId, makerTags, unsignedShort, -1, printValue}, - {0x00a3, "SharpnessFreqTable", N_("SharpnessTable"), N_("SharpnessTable"), canonId, makerTags, unsignedShort, -1, printValue}, - {0x00a4, "WhiteBalanceTable", N_("SharpnessTable"), N_("SharpnessTable"), canonId, makerTags, unsignedShort, -1, printValue}, - {0x00a9, "ColorBalance", N_("ColorBalance"), N_("ColorBalance"), canonId, makerTags, unsignedShort, -1, printValue}, + {0x00a1, "ToneCurveTable", N_("ToneCurveTable"), N_("ToneCurveTable"), canonId, makerTags, unsignedShort, -1, printValue}, + {0x00a2, "SharpnessTable", N_("SharpnessTable"), N_("SharpnessTable"), canonId, makerTags, unsignedShort, -1, printValue}, + {0x00a3, "SharpnessFreqTable", N_("SharpnessTable"), N_("SharpnessTable"), canonId, makerTags, unsignedShort, -1, printValue}, + {0x00a4, "WhiteBalanceTable", N_("SharpnessTable"), N_("SharpnessTable"), canonId, makerTags, unsignedShort, -1, printValue}, + {0x00a9, "ColorBalance", N_("ColorBalance"), N_("ColorBalance"), canonId, makerTags, unsignedShort, -1, printValue}, {0x00aa, "MeasuredColor", N_("Measured Color"), N_("Measured color"), canonId, makerTags, unsignedShort, -1, printValue}, - {0x00ae, "ColorTemperature", N_("ColorTemperature"), N_("ColorTemperature"), canonId, makerTags, unsignedShort, -1, printValue}, - {0x00b0, "CanonFlags", N_("CanonFlags"), N_("CanonFlags"), canonId, makerTags, unsignedShort, -1, printValue}, - {0x00b1, "ModifiedInfo", N_("ModifiedInfo"), N_("ModifiedInfo"), canonId, makerTags, unsignedShort, -1, printValue}, - {0x00b2, "ToneCurveMatching", N_("ToneCurveMatching"), N_("ToneCurveMatching"), canonId, makerTags, unsignedShort, -1, printValue}, - {0x00b3, "WhiteBalanceMatching", N_("WhiteBalanceMatching"), N_("WhiteBalanceMatching"), canonId, makerTags, unsignedShort, -1, printValue}, + {0x00ae, "ColorTemperature", N_("ColorTemperature"), N_("ColorTemperature"), canonId, makerTags, unsignedShort, -1, printValue}, + {0x00b0, "CanonFlags", N_("CanonFlags"), N_("CanonFlags"), canonId, makerTags, unsignedShort, -1, printValue}, + {0x00b1, "ModifiedInfo", N_("ModifiedInfo"), N_("ModifiedInfo"), canonId, makerTags, unsignedShort, -1, printValue}, + {0x00b2, "ToneCurveMatching", N_("ToneCurveMatching"), N_("ToneCurveMatching"), canonId, makerTags, unsignedShort, -1, printValue}, + {0x00b3, "WhiteBalanceMatching", N_("WhiteBalanceMatching"), N_("WhiteBalanceMatching"), canonId, makerTags, unsignedShort, -1, printValue}, {0x00b4, "ColorSpace", N_("ColorSpace"), N_("ColorSpace"), canonId, makerTags, signedShort, -1, EXV_PRINT_TAG(canonColorSpace)}, {0x00b5, "0x00b5", "0x00b5", N_("Unknown"), canonId, makerTags, unsignedShort, -1, printValue}, - {0x00b6, "PreviewImageInfo", "PreviewImageInfo", N_("PreviewImageInfo"), canonId, makerTags, unsignedShort, -1, printValue}, + {0x00b6, "PreviewImageInfo", "PreviewImageInfo", N_("PreviewImageInfo"), canonId, makerTags, unsignedShort, -1, printValue}, {0x00c0, "0x00c0", "0x00c0", N_("Unknown"), canonId, makerTags, unsignedShort, -1, printValue}, {0x00c1, "0x00c1", "0x00c1", N_("Unknown"), canonId, makerTags, unsignedShort, -1, printValue}, {0x00d0, "VRDOffset", N_("VRD Offset"), N_("VRD offset"), canonId, makerTags, unsignedLong, -1, printValue}, @@ -620,23 +612,23 @@ namespace Exiv2 { {0x260d, "AFPointsSelected", N_("AF Points Selected"), N_("AF Points Selected"), canonId, makerTags, signedShort, -1, printBitmask}, {0x260e, "AFPointsUnusable", N_("AF Points Unusable"), N_("AF Points Unusable"), canonId, makerTags, signedShort, -1, printBitmask}, {0x4001, "ColorData", N_("Color Data"), N_("Color data"), canonId, makerTags, unsignedShort, -1, printValue}, - {0x4002, "CRWParam", N_("CRWParam"), N_("CRWParam"), canonId, makerTags, unsignedShort, -1, printValue}, - {0x4003, "ColorInfo", N_("ColorInfo"), N_("ColorInfo"), canonId, makerTags, unsignedShort, -1, printValue}, - {0x4005, "Flavor", N_("Flavor"), N_("Flavor"), canonId, makerTags, unsignedShort, -1, printValue}, - {0x4008, "PictureStyleUserDef", N_("PictureStyleUserDef"), N_("PictureStyleUserDef"), canonId, makerTags, unsignedShort, -1, EXV_PRINT_TAG(canonPictureStyle)}, - // {0x4009, "PictureStylePC", N_("PictureStylePC"), N_("PictureStylePC"), canonId, makerTags, unsignedShort, -1, EXV_PRINT_TAG(canonPictureStyle)}, - {0x4010, "CustomPictureStyleFileName", N_("CustomPictureStyleFileName"), N_("CustomPictureStyleFileName"), canonId, makerTags, unsignedShort, -1, printValue}, - {0x4013, "AFMicroAdj", N_("AFMicroAdj"), N_("AFMicroAdj"), canonId, makerTags, unsignedShort, -1, printValue}, - {0x4015, "VignettingCorr", N_("VignettingCorr"), N_("VignettingCorr"), canonId, makerTags, unsignedShort, -1, printValue}, - {0x4016, "VignettingCorr2", N_("VignettingCorr2"), N_("VignettingCorr2"), canonId, makerTags, unsignedShort, -1, printValue}, - {0x4018, "LightingOpt", N_("LightingOpt"), N_("LightingOpt"), canonId, makerTags, unsignedShort, -1, printValue}, - {0x4018, "LensInfo", N_("LensInfo"), N_("LensInfo"), canonId, makerTags, unsignedShort, -1, printValue}, - {0x4020, "AmbienceInfo", N_("AmbienceInfo"), N_("AmbienceInfo"), canonId, makerTags, unsignedShort, -1, printValue}, - {0x4021, "MultiExp", N_("MultiExp"), N_("MultiExp"), canonId, makerTags, unsignedShort, -1, printValue}, - {0x4024, "FilterInfo", N_("FilterInfo"), N_("FilterInfo"), canonId, makerTags, unsignedShort, -1, printValue}, - {0x4025, "HDRInfo", N_("HDRInfo"), N_("HDRInfo"), canonId, makerTags, unsignedShort, -1, printValue}, - {0x4028, "AFConfig", N_("AFConfig"), N_("AFConfig"), canonId, makerTags, unsignedShort, -1, printValue}, - {0x403f, "RawBurstModeRoll", N_("RawBurstModeRoll"), N_("RawBurstModeRoll"), canonId, makerTags, unsignedShort, -1, printValue}, + {0x4002, "CRWParam", N_("CRWParam"), N_("CRWParam"), canonId, makerTags, unsignedShort, -1, printValue}, + {0x4003, "ColorInfo", N_("ColorInfo"), N_("ColorInfo"), canonId, makerTags, unsignedShort, -1, printValue}, + {0x4005, "Flavor", N_("Flavor"), N_("Flavor"), canonId, makerTags, unsignedShort, -1, printValue}, + {0x4008, "PictureStyleUserDef", N_("PictureStyleUserDef"), N_("PictureStyleUserDef"), canonId, makerTags, unsignedShort, -1, EXV_PRINT_TAG(canonPictureStyle)}, + // {0x4009, "PictureStylePC", N_("PictureStylePC"), N_("PictureStylePC"), canonId, makerTags, unsignedShort, -1, EXV_PRINT_TAG(canonPictureStyle)}, + {0x4010, "CustomPictureStyleFileName", N_("CustomPictureStyleFileName"), N_("CustomPictureStyleFileName"), canonId, makerTags, unsignedShort, -1, printValue}, + {0x4013, "AFMicroAdj", N_("AFMicroAdj"), N_("AFMicroAdj"), canonId, makerTags, unsignedShort, -1, printValue}, + {0x4015, "VignettingCorr", N_("VignettingCorr"), N_("VignettingCorr"), canonId, makerTags, unsignedShort, -1, printValue}, + {0x4016, "VignettingCorr2", N_("VignettingCorr2"), N_("VignettingCorr2"), canonId, makerTags, unsignedShort, -1, printValue}, + {0x4018, "LightingOpt", N_("LightingOpt"), N_("LightingOpt"), canonId, makerTags, unsignedShort, -1, printValue}, + {0x4018, "LensInfo", N_("LensInfo"), N_("LensInfo"), canonId, makerTags, unsignedShort, -1, printValue}, + {0x4020, "AmbienceInfo", N_("AmbienceInfo"), N_("AmbienceInfo"), canonId, makerTags, unsignedShort, -1, printValue}, + {0x4021, "MultiExp", N_("MultiExp"), N_("MultiExp"), canonId, makerTags, unsignedShort, -1, printValue}, + {0x4024, "FilterInfo", N_("FilterInfo"), N_("FilterInfo"), canonId, makerTags, unsignedShort, -1, printValue}, + {0x4025, "HDRInfo", N_("HDRInfo"), N_("HDRInfo"), canonId, makerTags, unsignedShort, -1, printValue}, + {0x4028, "AFConfig", N_("AFConfig"), N_("AFConfig"), canonId, makerTags, unsignedShort, -1, printValue}, + {0x403f, "RawBurstModeRoll", N_("RawBurstModeRoll"), N_("RawBurstModeRoll"), canonId, makerTags, unsignedShort, -1, printValue}, // End of list marker {0xffff, "(UnknownCanonMakerNoteTag)", "(UnknownCanonMakerNoteTag)", N_("Unknown CanonMakerNote tag"), canonId, makerTags, asciiString, -1, printValue}, }; @@ -645,8 +637,8 @@ namespace Exiv2 { { return tagInfo_; } - - // Canon Movie Info Tag + + // Canon Movie Info Tag constexpr TagInfo CanonMakerNote::tagInfoMv_[] = { {0x0001, "FrameRate", N_("FrameRate"), N_("FrameRate"), canonMvId, makerTags, unsignedShort, -1, printValue}, {0x0002, "FrameCount", N_("FrameCount"), N_("FrameCount"), canonMvId, makerTags, unsignedShort, -1, printValue}, @@ -683,17 +675,17 @@ namespace Exiv2 { }; - // Canon My Colors Info Tag + // Canon My Colors Info Tag constexpr TagInfo CanonMakerNote::tagInfoMc_[] = { {0x0002, "MyColorMode", N_("My Color Mode"), N_("My Color Mode"), canonMyColorID, makerTags, unsignedShort, -1, EXV_PRINT_TAG(canonMyColors)}, }; - + const TagInfo* CanonMakerNote::tagListMc() { return tagInfoMc_; } - // Canon FaceDetect 1 Info Tag + // Canon FaceDetect 1 Info Tag constexpr TagInfo CanonMakerNote::tagInfoFcd1_[] = { {0x0002, "FacesDetected", N_("Faces Detected"), N_("Faces Detected"), canonFcd1Id, makerTags, unsignedShort, -1, printValue}, {0x0003, "FacesDetectedFrameSize", N_("Faces Detected Frame Size"), N_("Faces Detected Frame Size"), canonFcd1Id, makerTags, unsignedShort, -1, printValue}, @@ -707,18 +699,18 @@ namespace Exiv2 { {0x0016, "Face8Position", N_("Face 8 Position"), N_("Face 8 Position"), canonFcd1Id, makerTags, signedShort, -1, printValue}, {0x0018, "Face9Position", N_("Face 9 Position"), N_("Face 9 Position"), canonFcd1Id, makerTags, signedShort, -1, printValue}, }; - + const TagInfo* CanonMakerNote::tagListFcd1() { return tagInfoFcd1_; } - // Canon FaceDetect 2 Info Tag + // Canon FaceDetect 2 Info Tag constexpr TagInfo CanonMakerNote::tagInfoFcd2_[] = { {0x0001, "FaceWidth", N_("Face Width"), N_("Faces Width"), canonFcd2Id, makerTags, unsignedByte, -1, printValue}, - {0x0002, "FacesDetected", N_("Faces Detected"), N_("Faces Detected"), canonFcd2Id, makerTags, unsignedByte, -1, printValue}, + {0x0002, "FacesDetected", N_("Faces Detected"), N_("Faces Detected"), canonFcd2Id, makerTags, unsignedByte, -1, printValue}, }; - + const TagInfo* CanonMakerNote::tagListFcd2() { return tagInfoFcd2_; @@ -732,47 +724,47 @@ namespace Exiv2 { }; - // Canon Contrast Info Tag + // Canon Contrast Info Tag constexpr TagInfo CanonMakerNote::tagInfoCo_[] = { - {0x0004, "IntelligentContrast", N_("Intelligent Contrast"), N_("Intelligent Contrast"), canonContrastId, makerTags, unsignedShort, -1, EXV_PRINT_TAG(canonContrastInfo)}, + {0x0004, "IntelligentContrast", N_("Intelligent Contrast"), N_("Intelligent Contrast"), canonContrastId, makerTags, unsignedShort, -1, EXV_PRINT_TAG(canonContrastInfo)}, }; - + const TagInfo* CanonMakerNote::tagListCo() { return tagInfoCo_; } - // Canon WhiteBalance Info Tag + // Canon WhiteBalance Info Tag constexpr TagInfo CanonMakerNote::tagInfoWbi_[] = { - {0x0002, "WB_GRGBLevelsAuto", N_("WB_G RGB Levels Auto"), N_("WB_G RGB Levels Auto"), canonWbId, makerTags, unsignedLong, -1, printValue}, - {0x000a, "WB_GRGBLevelsDaylight", N_("WB_G RGB Levels Daylight"), N_("WB_G RGB Levels Daylight"), canonWbId, makerTags, unsignedLong, -1, printValue}, - {0x0012, "WB_GRGBLevelsCloudy", N_("WB_G RGB Levels Cloudy"), N_("WB_G RGB Levels Cloudy"), canonWbId, makerTags, unsignedLong, -1, printValue}, - {0x001a, "WB_GRGBLevelsTungsten", N_("WB_G RGB Levels Tungsten"), N_("WB_G RGB Levels Tungsten"), canonWbId, makerTags, unsignedLong, -1, printValue}, - {0x0022, "WB_GRGBLevelsFluorescent", N_("WB_G RGB Levels Flourescent"), N_("WB_G RGB Levels Flourescent"), canonWbId, makerTags, unsignedLong, -1, printValue}, - {0x002a, "WB_GRGBLevelsFluorHigh", N_("WB_G RGB Levels Flourecent High"), N_("WB_G RGB Levels Flourecent High"), canonWbId, makerTags, unsignedLong, -1, printValue}, - {0x0032, "WB_GRGBLevelsFlash", N_("WB_G RGB Levels Flash"), N_("WB_G RGB Levels Flash"), canonWbId, makerTags, unsignedLong, -1, printValue}, - {0x003a, "WB_GRGBLevelsUnderwater", N_("WB_G RGB Levels Underwater"), N_("WB_G RGB Levels Underwater"), canonWbId, makerTags, unsignedLong, -1, printValue}, - {0x0042, "WB_GRGBLevelsCustom1", N_("WB_G RGB Levels Custom 1"), N_("WB_G RGB Levels Custom 1"), canonWbId, makerTags, unsignedLong, -1, printValue}, + {0x0002, "WB_GRGBLevelsAuto", N_("WB_G RGB Levels Auto"), N_("WB_G RGB Levels Auto"), canonWbId, makerTags, unsignedLong, -1, printValue}, + {0x000a, "WB_GRGBLevelsDaylight", N_("WB_G RGB Levels Daylight"), N_("WB_G RGB Levels Daylight"), canonWbId, makerTags, unsignedLong, -1, printValue}, + {0x0012, "WB_GRGBLevelsCloudy", N_("WB_G RGB Levels Cloudy"), N_("WB_G RGB Levels Cloudy"), canonWbId, makerTags, unsignedLong, -1, printValue}, + {0x001a, "WB_GRGBLevelsTungsten", N_("WB_G RGB Levels Tungsten"), N_("WB_G RGB Levels Tungsten"), canonWbId, makerTags, unsignedLong, -1, printValue}, + {0x0022, "WB_GRGBLevelsFluorescent", N_("WB_G RGB Levels Flourescent"), N_("WB_G RGB Levels Flourescent"), canonWbId, makerTags, unsignedLong, -1, printValue}, + {0x002a, "WB_GRGBLevelsFluorHigh", N_("WB_G RGB Levels Flourecent High"), N_("WB_G RGB Levels Flourecent High"), canonWbId, makerTags, unsignedLong, -1, printValue}, + {0x0032, "WB_GRGBLevelsFlash", N_("WB_G RGB Levels Flash"), N_("WB_G RGB Levels Flash"), canonWbId, makerTags, unsignedLong, -1, printValue}, + {0x003a, "WB_GRGBLevelsUnderwater", N_("WB_G RGB Levels Underwater"), N_("WB_G RGB Levels Underwater"), canonWbId, makerTags, unsignedLong, -1, printValue}, + {0x0042, "WB_GRGBLevelsCustom1", N_("WB_G RGB Levels Custom 1"), N_("WB_G RGB Levels Custom 1"), canonWbId, makerTags, unsignedLong, -1, printValue}, {0x004a, "WB_GRGBLevelsCustom2", N_("WB_G RGB Levels Custom 2"), N_("WB_G RGB Levels Custom 2"), canonWbId, makerTags, unsignedLong, -1, printValue}, }; - + const TagInfo* CanonMakerNote::tagListWbi() { return tagInfoWbi_; } - // Canon FaceDetect 3 Info Tag + // Canon FaceDetect 3 Info Tag constexpr TagInfo CanonMakerNote::tagInfoFcd3_[] = { - {0x0003, "FacesDetected", N_("Face Detected"), N_("Faces Detected"), canonFcd3Id, makerTags, unsignedShort, -1, printValue}, + {0x0003, "FacesDetected", N_("Face Detected"), N_("Faces Detected"), canonFcd3Id, makerTags, unsignedShort, -1, printValue}, }; - + const TagInfo* CanonMakerNote::tagListFcd3() { return tagInfoFcd3_; } - - // Canon AFInfo2 Info Tag + + // Canon AFInfo2 Info Tag constexpr TagInfo CanonMakerNote::tagInfoAf2_[] = { {0x0000, "AFInfoSize", N_("AF InfoSize"), N_("AF InfoSize"), canonAf2Id, makerTags, signedShort, -1, printValue}, {0x0001, "AFAreaMode", N_("AF Area Mode"), N_("AF Area Mode"), canonAf2Id, makerTags, signedShort, -1, EXV_PRINT_TAG(canonAFAreaMode)}, @@ -788,16 +780,16 @@ namespace Exiv2 { {0x000b, "AFYPositions", N_("AF Y Positions"), N_("AF Y Positions"), canonAf2Id, makerTags, signedShort, -1, printValue}, {0x000c, "AFPointsInFocus", N_("AF Points in Focus"), N_("AF Points in Focus"), canonAf2Id, makerTags, signedShort, -1,printBitmask}, {0x000d, "AFPointsSelected", N_("AF Points Selected"), N_("AF Points Selected"), canonAf2Id, makerTags, signedShort, -1, printBitmask}, - {0x000e, "AFPrimaryPoint", N_("AF Primary Point"), N_("AF Primary Point"), canonAf2Id, makerTags, signedShort, -1, printBitmask}, + {0x000e, "AFPrimaryPoint", N_("AF Primary Point"), N_("AF Primary Point"), canonAf2Id, makerTags, signedShort, -1, printBitmask}, }; - + const TagInfo* CanonMakerNote::tagListAf2() { return tagInfoAf2_; } - // Canon AFInfo3 Info Tag + // Canon AFInfo3 Info Tag constexpr TagInfo CanonMakerNote::tagInfoAf3_[] = { {0x0000, "AFInfoSize", N_("AF InfoSize"), N_("AF InfoSize"), canonAf3Id, makerTags, signedShort, -1, printValue}, {0x0001, "AFAreaMode", N_("AF Area Mode"), N_("AF Area Mode"), canonAf3Id, makerTags, signedShort, -1, EXV_PRINT_TAG(canonAFAreaMode)}, @@ -813,9 +805,9 @@ namespace Exiv2 { {0x000b, "AFYPositions", N_("AF Y Positions"), N_("AF Y Positions"), canonAf3Id, makerTags, signedShort, -1, printValue}, {0x000c, "AFPointsInFocus", N_("AF Points in Focus"), N_("AF Points in Focus"), canonAf3Id, makerTags, signedShort, -1,printBitmask}, {0x000d, "AFPointsSelected", N_("AF Points Selected"), N_("AF Points Selected"), canonAf3Id, makerTags, signedShort, -1, printBitmask}, - {0x000e, "AFPrimaryPoint", N_("AF Primary Point"), N_("AF Primary Point"), canonAf3Id, makerTags, signedShort, -1, printBitmask}, + {0x000e, "AFPrimaryPoint", N_("AF Primary Point"), N_("AF Primary Point"), canonAf3Id, makerTags, signedShort, -1, printBitmask}, }; - + const TagInfo* CanonMakerNote::tagListAf3() { return tagInfoAf3_; @@ -835,45 +827,45 @@ namespace Exiv2 { }; */ - // Canon Aspect Info Tag + // Canon Aspect Info Tag constexpr TagInfo CanonMakerNote::tagInfoAs_[] = { {0x0000, "AspectRatio", N_("Aspect Ratio"), N_("Aspect Ratio"), canonAsId, makerTags, unsignedLong, -1, printValue}, - {0x0001, "CroppedImageWidth", N_("Cropped Image Width"), N_("Cropped Image Width"), canonAsId, makerTags, unsignedLong, -1, printValue}, - {0x0002, "CroppedImageHeight", N_("Cropped Image Height"), N_("Cropped Image Height"), canonAsId, makerTags, unsignedLong, -1, printValue}, - {0x0003, "CroppedImageLeft", N_("Cropped Image Left"), N_("Cropped Image Left"), canonAsId, makerTags, unsignedLong, -1, printValue}, + {0x0001, "CroppedImageWidth", N_("Cropped Image Width"), N_("Cropped Image Width"), canonAsId, makerTags, unsignedLong, -1, printValue}, + {0x0002, "CroppedImageHeight", N_("Cropped Image Height"), N_("Cropped Image Height"), canonAsId, makerTags, unsignedLong, -1, printValue}, + {0x0003, "CroppedImageLeft", N_("Cropped Image Left"), N_("Cropped Image Left"), canonAsId, makerTags, unsignedLong, -1, printValue}, {0x0004, "CroppedImageTop", N_("Cropped Image Top"), N_("Cropped Image Top"), canonAsId, makerTags, unsignedLong, -1, printValue}, - }; - + }; + const TagInfo* CanonMakerNote::tagListAs() { return tagInfoAs_; } - - - // Canon Color Balance Info Tag + + + // Canon Color Balance Info Tag constexpr TagInfo CanonMakerNote::tagInfoCbi_[] = { - {0x0001, "WB_RGGBLevelsAuto", N_("WB_RGGB Levels Auto"), N_("WB_RGGB Levels Auto"), canonCbId, makerTags, signedShort, -1, printValue}, - {0x0005, "WB_RGGBLevelsDaylight", N_("WB_RGGB Levels Daylight"), N_("WB_RGGB Levels Daylight"), canonCbId, makerTags, signedShort, -1, printValue}, - {0x000d, "WB_RGGBLevelsShade", N_("WB_RGGB Levels Shade"), N_("WB_RGGB Levels Shade"), canonCbId, makerTags, signedShort, -1, printValue}, - {0x001a, "WB_RGGBLevelsCloudy", N_("WB_RGGB Levels Cloudy"), N_("WB_RGGB Levels Cloudy"), canonCbId, makerTags, signedShort, -1, printValue}, - {0x0011, "WB_RGGBLevelsTungsten", N_("WB_RGGB Levels Tungsten"), N_("WB_RGGB Levels Tungsten"), canonCbId, makerTags, signedShort, -1, printValue}, - {0x0015, "WB_RGGBLevelsFlourescent", N_("WB_RGGB Levels Flourecent"), N_("WB_RGGB Levels Flourecent"), canonCbId, makerTags, signedShort, -1, printValue}, - {0x0032, "WB_RGGBLevelsFlash", N_("WB_RGGB Levels Flash"), N_("WB_RGGB Levels Flash"), canonCbId, makerTags, signedShort, -1, printValue}, - {0x001d, "WB_RGGBLevelsCustomBlackLevels", N_("WB_RGGB Levels Custom Black Levels"), N_("WB_RGGB Levels Custom Black Levels"), canonCbId, makerTags, signedShort, -1, printValue}, - {0x0021, "WB_RGGBLevelsKelvin", N_("WB_RGGB Levels Kelvin"), N_("WB_RGGB Levels Kelvin"), canonCbId, makerTags, signedShort, -1, printValue}, + {0x0001, "WB_RGGBLevelsAuto", N_("WB_RGGB Levels Auto"), N_("WB_RGGB Levels Auto"), canonCbId, makerTags, signedShort, -1, printValue}, + {0x0005, "WB_RGGBLevelsDaylight", N_("WB_RGGB Levels Daylight"), N_("WB_RGGB Levels Daylight"), canonCbId, makerTags, signedShort, -1, printValue}, + {0x000d, "WB_RGGBLevelsShade", N_("WB_RGGB Levels Shade"), N_("WB_RGGB Levels Shade"), canonCbId, makerTags, signedShort, -1, printValue}, + {0x001a, "WB_RGGBLevelsCloudy", N_("WB_RGGB Levels Cloudy"), N_("WB_RGGB Levels Cloudy"), canonCbId, makerTags, signedShort, -1, printValue}, + {0x0011, "WB_RGGBLevelsTungsten", N_("WB_RGGB Levels Tungsten"), N_("WB_RGGB Levels Tungsten"), canonCbId, makerTags, signedShort, -1, printValue}, + {0x0015, "WB_RGGBLevelsFlourescent", N_("WB_RGGB Levels Flourecent"), N_("WB_RGGB Levels Flourecent"), canonCbId, makerTags, signedShort, -1, printValue}, + {0x0032, "WB_RGGBLevelsFlash", N_("WB_RGGB Levels Flash"), N_("WB_RGGB Levels Flash"), canonCbId, makerTags, signedShort, -1, printValue}, + {0x001d, "WB_RGGBLevelsCustomBlackLevels", N_("WB_RGGB Levels Custom Black Levels"), N_("WB_RGGB Levels Custom Black Levels"), canonCbId, makerTags, signedShort, -1, printValue}, + {0x0021, "WB_RGGBLevelsKelvin", N_("WB_RGGB Levels Kelvin"), N_("WB_RGGB Levels Kelvin"), canonCbId, makerTags, signedShort, -1, printValue}, {0x0025, "WB_RGGBBlackLevels", N_("WB_RGGB Black Levels"), N_("WB_RGGB Black Levels"), canonCbId, makerTags, signedShort, -1, printValue}, }; - + const TagInfo* CanonMakerNote::tagListCbi() { return tagInfoCbi_; } - // Canon Flags Tag + // Canon Flags Tag constexpr TagInfo CanonMakerNote::tagInfoFl_[] = { - {0x0001, "ModifiedParamFlag", N_("Modified Param Flag"), N_("Modified Param Flag"), canonFlId, makerTags, signedShort, -1, printValue}, - }; - + {0x0001, "ModifiedParamFlag", N_("Modified Param Flag"), N_("Modified Param Flag"), canonFlId, makerTags, signedShort, -1, printValue}, + }; + const TagInfo* CanonMakerNote::tagListFl() { return tagInfoFl_; @@ -883,7 +875,7 @@ namespace Exiv2 { constexpr TagDetails canonModifiedToneCurve[] = { { 0, N_("Standard") }, { 1, N_("Manual") }, - { 2, N_("Custom") } + { 2, N_("Custom") } }; // Canon Modified Sharpness Freq Info, tag 0x0002 @@ -894,9 +886,9 @@ namespace Exiv2 { { 3, N_("Standard") }, { 4, N_("High") }, { 5, N_("Highest") } - }; - - // Canon ModifiedInfo Tag + }; + + // Canon ModifiedInfo Tag constexpr TagInfo CanonMakerNote::tagInfoMo_[] = { {0x0001, "ModifiedToneCurve", N_("Modified ToneCurve"), N_("Modified ToneCurve"), canonMoID, makerTags, signedShort, -1, EXV_PRINT_TAG(canonModifiedToneCurve)}, {0x0002, "ModifiedSharpness", N_("Modified Sharpness"), N_("Modified Sharpness"), canonMoID, makerTags, signedShort, -1, EXV_PRINT_TAG(canonModifiedSharpnessFreq)}, @@ -910,7 +902,7 @@ namespace Exiv2 { {0x000a, "ModifiedPictureStyle", N_("Modified Picture Style"), N_("Modified Picture Style"), canonMoID, makerTags, signedShort, -1, EXV_PRINT_TAG(canonPictureStyle)}, {0x000b, "ModifiedDigitalGain", N_("Modified Param Flag"), N_("Modified Param Flag"), canonMoID, makerTags, signedShort, -1, printValue}, }; - + const TagInfo* CanonMakerNote::tagListMo() { return tagInfoMo_; @@ -927,58 +919,58 @@ namespace Exiv2 { { 7, N_("CRAW") }, { 130, N_("Normal Movie") }, { 131, N_("Movie (2)") } - }; - - // Canon Preview Image Info Tag + }; + + // Canon Preview Image Info Tag constexpr TagInfo CanonMakerNote::tagInfoPreI_[] = { {0x0001, "PreviewQuality", N_("Preview Quality"), N_("Preview Quality"), canonPreID, makerTags, unsignedLong, -1, EXV_PRINT_TAG(canonPreviewQuality)}, {0x0002, "PreviewImageLength", N_("Preview Image Length"), N_("Preview Image Length"), canonPreID, makerTags, unsignedLong, -1, printValue}, {0x0003, "PreviewImageWidth", N_("Preview Image Width"), N_("Preview Image Width"), canonPreID, makerTags, unsignedLong, -1, printValue}, {0x0004, "PreviewImageHeight", N_("Preview Image Height"), N_("Preview Image Height"), canonPreID, makerTags, unsignedLong, -1, printValue}, {0x0005, "PreviewImageStart", N_("Preview Image Start"), N_("Preview Image Start"), canonPreID, makerTags, unsignedLong, -1, printValue}, - }; - + }; + const TagInfo* CanonMakerNote::tagListPreI() { return tagInfoPreI_; } - // Canon Color Info Tag + // Canon Color Info Tag constexpr TagInfo CanonMakerNote::tagInfoCi_[] = { {0x0001, "Saturation", N_("Saturation"), N_("Saturation"), canonCiId, makerTags, signedShort, -1, printValue}, {0x0002, "ColorTone", N_("Color Tone"), N_("Color Tone"), canonCiId, makerTags, signedShort, -1, printValue}, {0x0003, "ColorSpace", N_("Color Space"), N_("Color Space"), canonCiId, makerTags, signedShort, -1, EXV_PRINT_TAG(canonColorSpace)}, - }; - + }; + const TagInfo* CanonMakerNote::tagListCi() { return tagInfoCi_; - } + } // Canon AFMicroAdjMode Quality Info, tag 0x0001 constexpr TagDetails canonAFMicroAdjMode[] = { { 0, N_("Disable") }, { 1, N_("Adjust all by the same amount") }, { 2, N_("Adjust by lens") } - }; - + }; + - // Canon AFMicroAdj Info Tag + // Canon AFMicroAdj Info Tag constexpr TagInfo CanonMakerNote::tagInfoAfMiAdj_[] = { {0x0001, "AFMicroAdjMode", N_("AFMicroAdjMode"), N_("AFMicroAdjMode"), canonAfMiAdjId, makerTags, signedLong, -1, EXV_PRINT_TAG(canonAFMicroAdjMode)}, - {0x0002, "AFMicroAdjValue", N_("AF Micro Adj Value"), N_("AF Micro Adj Value"), canonAfMiAdjId, makerTags, signedRational, -1, printValue}, - }; - + {0x0002, "AFMicroAdjValue", N_("AF Micro Adj Value"), N_("AF Micro Adj Value"), canonAfMiAdjId, makerTags, signedRational, -1, printValue}, + }; + const TagInfo* CanonMakerNote::tagListAfMiAdj() { return tagInfoAfMiAdj_; } - // Canon VignettingCorr Tag + // Canon VignettingCorr Tag constexpr TagInfo CanonMakerNote::tagInfoVigCor_[] = { {0x0000, "VignettingCorrVersion", N_("Vignetting Corr Version"), N_("Vignetting Corr Version"), canonVigCorId, makerTags, unsignedShort, -1, printValue}, - {0x0002, "PeripheralLighting", N_("Peripheral Lighting"), N_("Peripheral Lighting"), canonVigCorId, makerTags, signedShort, -1, EXV_PRINT_TAG(canonOffOn)}, + {0x0002, "PeripheralLighting", N_("Peripheral Lighting"), N_("Peripheral Lighting"), canonVigCorId, makerTags, signedShort, -1, EXV_PRINT_TAG(canonOffOn)}, {0x0003, "DistortionCorrection", N_("Distortion Correction"), N_("Distortion Correction"), canonVigCorId, makerTags, signedShort, -1, EXV_PRINT_TAG(canonOffOn)}, {0x0004, "ChromaticAberrationCorr", N_("Chromatic Aberration Corr"), N_("Chromatic Aberration Corr"), canonVigCorId, makerTags, signedShort, -1, EXV_PRINT_TAG(canonOffOn)}, {0x0005, "ChromaticAberrationCorr", N_("Chromatic Aberration Corr"), N_("Chromatic Aberration Corr"), canonVigCorId, makerTags, signedShort, -1, EXV_PRINT_TAG(canonOffOn)}, @@ -987,19 +979,19 @@ namespace Exiv2 { {0x000b, "OriginalImageWidth", N_("Original Image Width"), N_("Original Image Width"), canonVigCorId, makerTags, signedShort, -1, printValue}, {0x000c, "OriginalImageHeight", N_("Original Image Height"), N_("Original Image Height"), canonVigCorId, makerTags, signedShort, -1, printValue}, }; - + const TagInfo* CanonMakerNote::tagListVigCor() { return tagInfoVigCor_; - } + } - // Canon VignettingCorr2 Tag + // Canon VignettingCorr2 Tag constexpr TagInfo CanonMakerNote::tagInfoVigCor2_[] = { {0x0005, "PeripheralLightingSetting", N_("Peripheral Lighting Setting"), N_("Peripheral Lighting Setting"), canonVigCor2Id, makerTags, signedLong, -1, EXV_PRINT_TAG(canonOffOn)}, - {0x0006, "ChromaticAberrationSetting", N_("Chromatic Aberration Setting"), N_("Chromatic Aberration Setting"), canonVigCor2Id, makerTags, signedLong, -1, EXV_PRINT_TAG(canonOffOn)}, - {0x0007, "DistortionCorrectionSetting", N_("Distortion Correction Setting"), N_("Distortion Correction Setting"), canonVigCor2Id, makerTags, signedLong, -1, EXV_PRINT_TAG(canonOffOn)}, + {0x0006, "ChromaticAberrationSetting", N_("Chromatic Aberration Setting"), N_("Chromatic Aberration Setting"), canonVigCor2Id, makerTags, signedLong, -1, EXV_PRINT_TAG(canonOffOn)}, + {0x0007, "DistortionCorrectionSetting", N_("Distortion Correction Setting"), N_("Distortion Correction Setting"), canonVigCor2Id, makerTags, signedLong, -1, EXV_PRINT_TAG(canonOffOn)}, }; - + const TagInfo* CanonMakerNote::tagListVigCor2() { return tagInfoVigCor2_; @@ -1011,14 +1003,14 @@ namespace Exiv2 { { 1, N_("Low") }, { 2, N_("Strong") }, { 2, N_("Off") } - }; + }; // Canon HighISONoiseReduction, tag 0x0004 constexpr TagDetails canonLongExposureNoiseReduction[] = { { 0, N_("Off") }, { 1, N_("Auto") }, - { 2, N_("On") } - }; + { 2, N_("On") } + }; // Canon HighISONoiseReduction, tag 0x0005 constexpr TagDetails canonHighISONoiseReduction[] = { @@ -1026,17 +1018,17 @@ namespace Exiv2 { { 1, N_("Low") }, { 2, N_("Strong") }, { 2, N_("off") } - }; + }; - // Canon LightingOpt Tag + // Canon LightingOpt Tag constexpr TagInfo CanonMakerNote::tagInfoLiOp_[] = { {0x0001, "PeripheralIlluminationCorr", N_("Peripheral Lighting Setting"), N_("Peripheral Lighting Setting"), canonLiOpId, makerTags, signedLong, -1, EXV_PRINT_TAG(canonOffOn)}, - {0x0002, "AutoLightingOptimizer", N_("Chromatic Aberration Setting"), N_("Chromatic Aberration Setting"), canonLiOpId, makerTags, signedLong, -1, EXV_PRINT_TAG(canonAutoLightingOptimizer)}, - {0x0003, "HighlightTonePriority", N_("Distortion Correction Setting"), N_("Distortion Correction Setting"), canonLiOpId, makerTags, signedLong, -1, EXV_PRINT_TAG(canonOffOn)}, - {0x0004, "LongExposureNoiseReduction", N_("Distortion Correction Setting"), N_("Distortion Correction Setting"), canonLiOpId, makerTags, signedLong, -1, EXV_PRINT_TAG(canonLongExposureNoiseReduction)}, - {0x0005, "HighISONoiseReduction", N_("Distortion Correction Setting"), N_("Distortion Correction Setting"), canonLiOpId, makerTags, signedLong, -1, EXV_PRINT_TAG(canonHighISONoiseReduction)}, + {0x0002, "AutoLightingOptimizer", N_("Chromatic Aberration Setting"), N_("Chromatic Aberration Setting"), canonLiOpId, makerTags, signedLong, -1, EXV_PRINT_TAG(canonAutoLightingOptimizer)}, + {0x0003, "HighlightTonePriority", N_("Distortion Correction Setting"), N_("Distortion Correction Setting"), canonLiOpId, makerTags, signedLong, -1, EXV_PRINT_TAG(canonOffOn)}, + {0x0004, "LongExposureNoiseReduction", N_("Distortion Correction Setting"), N_("Distortion Correction Setting"), canonLiOpId, makerTags, signedLong, -1, EXV_PRINT_TAG(canonLongExposureNoiseReduction)}, + {0x0005, "HighISONoiseReduction", N_("Distortion Correction Setting"), N_("Distortion Correction Setting"), canonLiOpId, makerTags, signedLong, -1, EXV_PRINT_TAG(canonHighISONoiseReduction)}, }; - + const TagInfo* CanonMakerNote::tagListLiOp() { return tagInfoLiOp_; @@ -1044,13 +1036,13 @@ namespace Exiv2 { // Canon LensInfo Tag constexpr TagInfo CanonMakerNote::tagInfoLe_[] = { - {0x0000, "LensSerialNumber", N_("Lens Seria lNumber"), N_("Lens Serial Number"), canonLeId, makerTags, asciiString, -1, printValue}, + {0x0000, "LensSerialNumber", N_("Lens Seria lNumber"), N_("Lens Serial Number"), canonLeId, makerTags, asciiString, -1, printValue}, }; - + const TagInfo* CanonMakerNote::tagListLe() { return tagInfoLe_; - } + } // Canon AmbienceSelection, tag 0x0001 @@ -1064,25 +1056,25 @@ namespace Exiv2 { { 6, N_("Brighter") }, { 7, N_("Darker") }, { 8, N_("Monochrome") } - }; + }; // Canon Ambience Tag constexpr TagInfo CanonMakerNote::tagInfoAm_[] = { - {0x0001, "AmbienceSelection", N_("Ambience Selection"), N_("Ambience Selection"), canonAmId, makerTags, signedLong, -1, EXV_PRINT_TAG(canonAmbienceSelection)}, + {0x0001, "AmbienceSelection", N_("Ambience Selection"), N_("Ambience Selection"), canonAmId, makerTags, signedLong, -1, EXV_PRINT_TAG(canonAmbienceSelection)}, }; - + const TagInfo* CanonMakerNote::tagListAm() { return tagInfoAm_; - } + } // Canon MultiExposure, tag 0x0001 constexpr TagDetails canonMultiExposure[] = { { 0, N_("Off") }, { 1, N_("On") }, { 2, N_("On (RAW)") } - }; + }; // Canon MultiExposureControl, tag 0x0001 constexpr TagDetails canonMultiExposureControl[] = { @@ -1090,7 +1082,7 @@ namespace Exiv2 { { 1, N_("Average") }, { 2, N_("Bright (comparative)") }, { 3, N_("Dark (comparative)") } - }; + }; // Canon MultiExp Tag constexpr TagInfo CanonMakerNote::tagInfoMe_[] = { @@ -1098,7 +1090,7 @@ namespace Exiv2 { {0x0002, "MultiExposureControl", N_("Multi Exposure Control"), N_("Multi Exposure Control"), canonMeId, makerTags, signedLong, -1, EXV_PRINT_TAG(canonMultiExposureControl)}, {0x0003, "MultiExposureShots", N_("Multi Exposure Shots"), N_("Multi Exposure Shots"), canonMeId, makerTags, signedLong, -1, EXV_PRINT_TAG(canonMultiExposure)}, }; - + const TagInfo* CanonMakerNote::tagListMe() { return tagInfoMe_; @@ -1107,13 +1099,13 @@ namespace Exiv2 { // Canon FilterInfo, tag 0x0001 constexpr TagDetails canonFilterInfo[] = { { -1, N_("Off") } - }; + }; // Canon MiniatureFilterOrientation, tag 0x0001 constexpr TagDetails canonMiniatureFilterOrientation[] = { { 0, N_("Horizontal") }, { 1, N_("Vertical") } - }; + }; // Canon Filter Info Tag constexpr TagInfo CanonMakerNote::tagInfoFil_[] = { @@ -1121,19 +1113,19 @@ namespace Exiv2 { {0x0201, "SoftFocusFilter", N_("Soft Focus Filter"), N_("Soft Focus Filter"), canonFilId, makerTags, asciiString, -1, EXV_PRINT_TAG(canonFilterInfo)}, {0x0301, "ToyCameraFilter", N_("Toy Camera Filter"), N_("Toy Camera Filter"), canonFilId, makerTags, asciiString, -1, EXV_PRINT_TAG(canonFilterInfo)}, {0x0401, "MiniatureFilter", N_("Miniature Filter"), N_("Miniature Filter"), canonFilId, makerTags, asciiString, -1, EXV_PRINT_TAG(canonFilterInfo)}, - {0x0402, "MiniatureFilterOrientation", N_("Miniature Filter Orientation"), N_("Miniature Filter Orientation"), canonFilId, makerTags, asciiString, -1, EXV_PRINT_TAG(canonMiniatureFilterOrientation)}, + {0x0402, "MiniatureFilterOrientation", N_("Miniature Filter Orientation"), N_("Miniature Filter Orientation"), canonFilId, makerTags, asciiString, -1, EXV_PRINT_TAG(canonMiniatureFilterOrientation)}, {0x0403, "MiniatureFilterPosition", N_("Miniature Filter Position"), N_("Miniature Filter Position"), canonFilId, makerTags, asciiString, -1, printValue}, {0x0404, "MiniatureFilterParameter", N_("Miniature Filter Parameter"), N_("Miniature Filter Parameter"), canonFilId, makerTags, asciiString, -1, printValue}, {0x0501, "FisheyeFilter", N_("Fisheye Filter"), N_("Fisheye Filter"), canonFilId, makerTags, asciiString, -1, EXV_PRINT_TAG(canonFilterInfo)}, {0x0601, "PaintingFilter", N_("Painting Filter"), N_("Painting Filter"), canonFilId, makerTags, asciiString, -1, EXV_PRINT_TAG(canonFilterInfo)}, {0x0701, "WatercolorFilter", N_("Watercolor Filter"), N_("Watercolor Filter"), canonFilId, makerTags, asciiString, -1, EXV_PRINT_TAG(canonFilterInfo)}, - }; - - + }; + + const TagInfo* CanonMakerNote::tagListFil() { return tagInfoFil_; - } + } // Canon HDR, tag 0x0001 @@ -1141,7 +1133,7 @@ namespace Exiv2 { { 0, N_("Off") }, { 1, N_("On") }, { 2, N_("On (RAW") } - }; + }; // Canon HDREffect, tag 0x0001 constexpr TagDetails canonHdrEffect[] = { @@ -1150,15 +1142,15 @@ namespace Exiv2 { { 2, N_("Art (vivid)") }, { 3, N_("Art (bold)") }, { 4, N_("Art (embossed)") } - }; + }; // Canon HDR Info Tag constexpr TagInfo CanonMakerNote::tagInfoHdr_[] = { {0x0001, "HDR", N_("HDR"), N_("HDR"), canonHdrId, makerTags, signedLong, -1, EXV_PRINT_TAG(canonHdr)}, - {0x0002, "HDREffect", N_("HDR Effect"), N_("HDR Effect"), canonHdrId, makerTags, signedLong, -1, EXV_PRINT_TAG(canonHdrEffect)}, + {0x0002, "HDREffect", N_("HDR Effect"), N_("HDR Effect"), canonHdrId, makerTags, signedLong, -1, EXV_PRINT_TAG(canonHdrEffect)}, }; - - + + const TagInfo* CanonMakerNote::tagListHdr() { return tagInfoHdr_; @@ -1169,7 +1161,7 @@ namespace Exiv2 { { 0, N_("Equal Priority") }, { 1, N_("Release Priority") }, { 2, N_("Focus Priority") } - }; + }; // Canon AIServoSecondImage, tag 0x0001 constexpr TagDetails canonAIServoSecondImage[] = { @@ -1178,44 +1170,44 @@ namespace Exiv2 { { 2, N_("Focus Priority") }, { 3, N_("Release High Priority") }, { 4, N_("Focus High Priority") }, - }; - + }; + // Canon USMLensElectronicMF, tag 0x0001 constexpr TagDetails canonUSMLensElectronicMF[] = { { 0, N_("Enable After AF") }, { 1, N_("Disable After AF") }, { 2, N_("Disable in AF Mode") } - }; + }; // Canon AFAssistBeam, tag 0x0001 constexpr TagDetails canonAFAssistBeam[] = { { 0, N_("Enable") }, { 1, N_("Disable") }, { 2, N_("IR AF Assist Beam Mode") } - }; + }; // Canon OneShotAFRelease, tag 0x0001 constexpr TagDetails canonOneShotAFRelease[] = { { 0, N_("Focus Priority") }, - { 1, N_("Release Priortiy") } - }; + { 1, N_("Release Priortiy") } + }; // Canon AutoAFPointSelEOSiTRAF, tag 0x0001 constexpr TagDetails canonAutoAFPointSelEOSiTRAF[] = { { 0, N_("Enable") }, - { 1, N_("Disable") } + { 1, N_("Disable") } }; // Canon LensDriveWhenAFImpossible, tag 0x0001 constexpr TagDetails canonLensDriveWhenAFImpossible[] = { { 0, N_("Continue Focus Search") }, - { 1, N_("Stop Focus Search") } + { 1, N_("Stop Focus Search") } }; // Canon SelectAFAreaSelectionMode, tag 0x0001 constexpr TagDetails canonSelectAFAreaSelectionMode[] = { { 0, N_("Single-Point-AF") }, - { 1, N_("Auto") }, + { 1, N_("Auto") }, { 2, N_("Zone AF") }, { 3, N_("AF Point Expansion (4 point)") }, { 4, N_("Spot AF") }, @@ -1225,26 +1217,26 @@ namespace Exiv2 { // Canon AFAreaSelectionMethod, tag 0x0001 constexpr TagDetails canonAFAreaSelectionMethod[] = { { 0, N_("M-Fn Button") }, - { 1, N_("Main Dial") } + { 1, N_("Main Dial") } }; // Canon OrientationLinkedAF, tag 0x0001 constexpr TagDetails canonOrientationLinkedAF[] = { { 0, N_("Same for Vert/Horiz Points") }, - { 1, N_("Separate for Vert/Horiz Points") }, + { 1, N_("Separate for Vert/Horiz Points") }, { 2, N_("Separate Area+Points") } }; // Canon ManualAFPointSelPattern, tag 0x0001 constexpr TagDetails canonManualAFPointSelPattern[] = { { 0, N_("Stops at AF Area Edges") }, - { 1, N_("Continous") } + { 1, N_("Continous") } }; // Canon AFPointDisplayDuringFocus, tag 0x0001 constexpr TagDetails canonAFPointDisplayDuringFocus[] = { { 0, N_("Selected (constant)") }, - { 1, N_("All (constant)") }, + { 1, N_("All (constant)") }, { 1, N_("Selected (pre-AF, focused)") }, { 1, N_("Selected (focused)") }, { 1, N_("Disabled") } @@ -1254,21 +1246,21 @@ namespace Exiv2 { constexpr TagDetails canonAVFDisplayIllumination[] = { { 0, N_("Auto") }, { 1, N_("Enable") }, - { 2, N_("Disable") }, + { 2, N_("Disable") }, }; // Canon AFStatusViewfinder, tag 0x0001 constexpr TagDetails canonAFStatusViewfinder[] = { { 0, N_("Auto") }, { 1, N_("Enable") }, - { 2, N_("Disable") }, + { 2, N_("Disable") }, }; // Canon InitialAFPointInServo, tag 0x0001 constexpr TagDetails canonInitialAFPointInServo[] = { { 0, N_("Initial AF Point Selected") }, { 1, N_("Manual AF Point") }, - { 2, N_("Auto") }, + { 2, N_("Auto") }, }; //Canon AFConfig Tags @@ -1291,7 +1283,7 @@ namespace Exiv2 { {0x0010, "AFPointDisplayDuringFocus", N_("AF Point Display During Focus"), N_("AF Point Display During Focus"), canonAfCId, makerTags, signedLong, -1, EXV_PRINT_TAG(canonAFPointDisplayDuringFocus)}, {0x0011, "VFDisplayIllumination", N_("VF Display Illumination"), N_("VF Display Illumination"), canonAfCId, makerTags, signedLong, -1, EXV_PRINT_TAG(canonAVFDisplayIllumination)}, {0x0012, "AFStatusViewfinder", N_("AF Status Viewfinder"), N_("AF Status Viewfinder"), canonAfCId, makerTags, signedLong, -1, EXV_PRINT_TAG(canonAFStatusViewfinder)}, - {0x0013, "InitialAFPointInServo", N_("Initial AF Point In Servo"), N_("Initial AF Point In Servo"), canonAfCId, makerTags, signedLong, -1, EXV_PRINT_TAG(canonInitialAFPointInServo)}, + {0x0013, "InitialAFPointInServo", N_("Initial AF Point In Servo"), N_("Initial AF Point In Servo"), canonAfCId, makerTags, signedLong, -1, EXV_PRINT_TAG(canonInitialAFPointInServo)}, }; const TagInfo* CanonMakerNote::tagListAfC() @@ -1304,7 +1296,7 @@ namespace Exiv2 { // Canon RawBurstInfo Info Tag constexpr TagInfo CanonMakerNote::tagInfoRawB_[] = { {0x0001, "RawBurstImageNum", N_("Raw Burst Image Num"), N_("Raw Burst Image Num"), canonRawBId, makerTags, unsignedLong, -1, printValue}, - {0x0002, "RawBurstImageCount", N_("Raw Burst Image Count"), N_("Raw Burst Image Count"), canonRawBId, makerTags, unsignedLong, -1, printValue} + {0x0002, "RawBurstImageCount", N_("Raw Burst Image Count"), N_("Raw Burst Image Count"), canonRawBId, makerTags, unsignedLong, -1, printValue} }; const TagInfo* CanonMakerNote::tagListRawB() @@ -1387,9 +1379,9 @@ namespace Exiv2 { { 10, N_("MP4") }, { 11, N_("CRM") }, { 12, N_("CR3") }, - { 13, N_("CR3+JPEG") }, - { 14, N_("HIF") }, - { 15, N_("CR3+HIF") } + { 13, N_("CR3+JPEG") }, + { 14, N_("HIF") }, + { 15, N_("CR3+HIF") } }; //! ImageSize, tag 0x000a @@ -1536,14 +1528,14 @@ namespace Exiv2 { { 22784, "6400" }, { 24384, "8000" }, { 26384, "10000" }, - { 29184, "12800" }, - { 29184, "16000" }, - { 29184, "20000" }, - { 29184, "25600" }, - { 29184, "32000" }, - { 29184, "40000" }, - { 29184, "H1(51200)" }, - { 29184, "H2(102400)" } + { 29184, "12800" }, + { 29184, "16000" }, + { 29184, "20000" }, + { 29184, "25600" }, + { 29184, "32000" }, + { 29184, "40000" }, + { 29184, "H1(51200)" }, + { 29184, "H2(102400)" } }; //! MeteringMode, tag 0x0011 @@ -1972,10 +1964,9 @@ namespace Exiv2 { { 368, "Sigma 150-600mm f/5-6.3 DG OS HSM | S" }, // 6 { 368, "Sigma 85mm f/1.4 DG HSM | A" }, // 7 { 368, "Sigma 105mm f/1.4 DG HSM" }, // 8 - { 368, "Sigma 14-24mm f/2.8 DG HSM" }, // 9 - { 368, "Sigma 70mm f/2.8 DG Macro" }, // 10 - { 368, "Sigma 18-35mm f/1.8 DC HSM | A" }, // 11 - { 368, "Sigma 35mm f/1.4 DG HSM | A" }, // 12 + { 368, "Sigma 70mm f/2.8 DG Macro" }, // 9 + { 368, "Sigma 18-35mm f/1.8 DC HSM | A" }, // 10 + { 368, "Sigma 35mm f/1.4 DG HSM | A" }, // 11 { 488, "Canon EF-S 15-85mm f/3.5-5.6 IS USM" }, { 489, "Canon EF 70-300mm f/4-5.6L IS USM" }, { 490, "Canon EF 8-15mm f/4L Fisheye USM" }, @@ -2056,92 +2047,28 @@ namespace Exiv2 { {61182, "Canon RF 24-70mm f/2.8 L IS USM" }, // 6 {61182, "Canon RF 15-35mm f/2.8 L IS USM" }, // 7 {61182, "Canon RF 50mm f/1.8 STM" }, // 8 - {61182, "Canon RF 70-200mm f/4L IS USM" }, // 9 - {61182, "Canon RF 28-70mm f/2L USM" }, // 10 - {61182, "Canon RF 85mm f/2 MACRO IS STM" }, // 11 - {61182, "Canon RF 100-500mm f/4.5-7.1L IS USM + RF2x" }, // 12 - {61182, "Canon RF 35mm f/1.8 MACRO IS STM" }, // 13 - {61182, "Canon RF 85mm f/1.2L USM DS" }, // 14 - {61182, "Canon RF 24-70mm f/2.8L IS USM" }, // 15 + {61182, "Canon RF 70-200mm f/4L IS USM" }, // 9 + {61182, "Canon RF 28-70mm f/2L USM" }, // 10 + {61182, "Canon RF 85mm f/2 MACRO IS STM" }, // 11 + {61182, "Canon RF 100-500mm f/4.5-7.1L IS USM + RF2x" }, // 12 + {61182, "Canon RF 35mm f/1.8 MACRO IS STM" }, // 13 + {61182, "Canon RF 85mm f/1.2L USM DS" }, // 14 + {61182, "Canon RF 24-70mm f/2.8L IS USM" }, // 15 {61182, "Canon RF 15-35mm f/2.8L IS USM" }, // 16 {61182, "Canon RF 24-240mm f/4-6.3 IS USM" }, // 17 - {61182, "Canon RF 70-200mm f/2.8L IS USM" }, // 18 - {61182, "Canon RF 600mm f/11 IS STM" }, // 19 - {61182, "Canon RF 600mm f/11 IS STM + RF1.4x" }, // 20 - {61182, "Canon RF 600mm f/11 IS STM + RF2x" }, // 21 - {61182, "Canon RF 800mm f/11 IS STM" }, // 22 - {61182, "Canon RF 800mm f/11 IS STM + RF1.4x" }, // 23 - {61182, "Canon RF 800mm f/11 IS STM + RF2x" }, // 24 - {61182, "Canon RF 24-105mm f/4-7.1 IS STM" }, // 25 - {61182, "Canon RF 100-500mm f/4.5-7.1 L IS USM" }, // 26 - {61182, "Canon RF 100-500mm f/4.5-7.1L IS USM + RF2x" }, // 27 + {61182, "Canon RF 70-200mm f/2.8L IS USM" }, // 18 + {61182, "Canon RF 600mm f/11 IS STM" }, // 19 + {61182, "Canon RF 600mm f/11 IS STM + RF1.4x" }, // 20 + {61182, "Canon RF 600mm f/11 IS STM + RF2x" }, // 21 + {61182, "Canon RF 800mm f/11 IS STM" }, // 22 + {61182, "Canon RF 800mm f/11 IS STM + RF1.4x" }, // 23 + {61182, "Canon RF 800mm f/11 IS STM + RF2x" }, // 24 + {61182, "Canon RF 24-105mm f/4-7.1 IS STM" }, // 25 + {61182, "Canon RF 100-500mm f/4.5-7.1 L IS USM" }, // 26 + {61182, "Canon RF 100-500mm f/4.5-7.1L IS USM + RF2x" }, // 27 {65535, "n/a" } }; - //! A lens id and a pretty-print function for special treatment of the id. - struct LensIdFct { - long id_; //!< Lens id - PrintFct fct_; //!< Pretty-print function - //! Comparison operator for find template - bool operator==(long id) const { return id_ == id; } - }; - - //! List of lens ids which require special treatment with the medicine - const LensIdFct lensIdFct[] = { - { 4, printCsLensByFocalLength }, // not tested - { 6, printCsLensByFocalLength }, - { 8, printCsLensByFocalLength }, - { 9, printCsLensByFocalLength }, - { 10, printCsLensByFocalLengthAndMaxAperture }, // works partly - { 22, printCsLensByFocalLength }, - { 26, printCsLensByFocalLengthAndMaxAperture }, // works partly - { 28, printCsLensByFocalLength }, - { 31, printCsLensByFocalLength }, - { 32, printCsLensByFocalLength }, - { 33, printCsLensByFocalLengthAndMaxAperture }, // works partly - { 37, printCsLensByFocalLength }, - { 42, printCsLensByFocalLength }, - { 47, printCsLensByFocalLength }, // not tested - { 131, printCsLensByFocalLength }, - { 136, printCsLensByFocalLength }, - { 137, printCsLensByFocalLength }, // not tested - { 143, printCsLensByFocalLength }, - { 150, printCsLensByFocalLength }, - { 152, printCsLensByFocalLength }, - { 153, printCsLensByFocalLength }, - { 154, printCsLensByFocalLength }, // not tested - { 155, printCsLensByFocalLength }, - { 156, printCsLensByFocalLengthAndMaxAperture }, - { 160, printCsLensByFocalLength }, - { 161, printCsLensByFocalLength }, - { 168, printCsLensByFocalLength }, - { 169, printCsLensByFocalLengthAndMaxAperture }, - { 172, printCsLensByFocalLengthTC }, // not tested - { 173, printCsLensByFocalLengthTC }, // works partly - { 174, printCsLensByFocalLength }, // not tested - { 197, printCsLensByFocalLength }, - { 180, printCsLensByFocalLength }, - { 181, printCsLensByFocalLengthTC }, // not tested - { 182, printCsLensByFocalLengthTC }, // not tested - { 183, printCsLensByFocalLength }, // not tested - { 198, printCsLensByFocalLength }, // not tested - { 213, printCsLensByFocalLength }, // not tested - { 234, printCsLensByFocalLength }, // not tested - { 248, printCsLensByFocalLength }, // not tested - { 250, printCsLensByFocalLength }, // not tested - { 254, printCsLensByFocalLength }, - { 255, printCsLensByFocalLength }, // not tested - { 368, printCsLensByFocalLengthAndMaxAperture }, - { 491, printCsLensByFocalLength }, - { 493, printCsLensByFocalLength }, // not tested - { 624, printCsLensByFocalLengthTC }, - { 747, printCsLensByFocalLength }, // not tested - { 4143,printCsLensByFocalLength }, // not tested - { 4154,printCsLensByFocalLength }, // not tested - {61182,printCsLensByFocalLength }, - {0xffff,printCsLensFFFF } - }; - //! FlashActivity, tag 0x001c constexpr TagDetails canonCsFlashActivity[] = { { 0, N_("Did not fire") }, @@ -2572,7 +2499,7 @@ namespace Exiv2 { {0x0014, "FocusDistanceUpper", N_("Focus Distance Upper"), N_("Focus Distance Upper"), canonFiId, makerTags, unsignedShort, 1, printFiFocusDistance}, {0x0015, "FocusDistanceLower", N_("Focus Distance Lower"), N_("Focus Distance Lower"), canonFiId, makerTags, unsignedShort, 1, printFiFocusDistance}, {0x0019, "FlashExposureLock", N_("Flash Exposure Lock"), N_("Flash exposure lock"), canonFiId, makerTags, signedShort, 1, EXV_PRINT_TAG(canonOffOn)}, - {0x003D, "RFLensType", N_("RF Lens Type"), N_("RF Lens Type"), canonFiId, makerTags, unsignedShort, 1, EXV_PRINT_TAG(canonRFLensType)}, + {0x003D, "RFLensType", N_("RF Lens Type"), N_("RF Lens Type"), canonFiId, makerTags, unsignedShort, 1, EXV_PRINT_TAG(canonRFLensType)}, // End of list marker {0xffff, "(UnknownCanonFiTag)", "(UnknownCanonFiTag)", N_("Unknown Canon File Info tag"), canonFiId, makerTags, signedShort, 1, printValue}, }; @@ -2805,152 +2732,97 @@ namespace Exiv2 { return EXV_PRINT_TAG(canonCsLensType)(os, value, metadata); } - //! Helper structure - struct LensTypeAndFocalLengthAndMaxAperture { - long lensType_; //!< Lens type - float focalLengthMin_; //!< Mininum focal length - float focalLengthMax_; //!< Maximum focal length - std::string focalLength_; //!< Focal length as a string - std::string maxAperture_; //!< Aperture - }; - - //! Compare tag details with a lens entry - bool operator==(const TagDetails& td, const LensTypeAndFocalLengthAndMaxAperture& ltfl) { - return ( td.val_ == ltfl.lensType_ - && std::string(td.label_).find(ltfl.focalLength_) != std::string::npos - && std::string(td.label_).find(ltfl.maxAperture_) != std::string::npos); - } - - //! extractLensFocalLength from metadata - void extractLensFocalLength(LensTypeAndFocalLengthAndMaxAperture& ltfl, - const ExifData* metadata) - { - ExifKey key("Exif.CanonCs.Lens"); - auto pos = metadata->findKey(key); - ltfl.focalLengthMin_ = 0.0F; - ltfl.focalLengthMax_ = 0.0F; - if (pos != metadata->end()) { - const Value &value = pos->value(); - if ( value.count() >= 3 - && value.typeId() == unsignedShort) { - float fu = value.toFloat(2); - if (fu != 0.0F) { - ltfl.focalLengthMin_ = value.toLong(1) / fu; - ltfl.focalLengthMax_ = value.toLong(0) / fu; - } - } - } - } - - //! convertFocalLength to a human readable string - void convertFocalLength(LensTypeAndFocalLengthAndMaxAperture& ltfl, float divisor) - { - std::ostringstream oss; - oss << std::fixed << std::setprecision(0); - if (ltfl.focalLengthMin_ == ltfl.focalLengthMax_) { - oss << " " << (ltfl.focalLengthMin_ / divisor) << "mm"; - } else { - oss << " " << (ltfl.focalLengthMin_ / divisor) << "-" << (ltfl.focalLengthMax_ / divisor) << "mm"; - } - ltfl.focalLength_ = oss.str(); - } - - //! printCsLensByFocalLengthAndMaxAperture to human readable string - std::ostream& printCsLensByFocalLengthAndMaxAperture(std::ostream& os, - const Value& value, - const ExifData* metadata) + std::ostream& printCsLensTypeByMetadata(std::ostream& os, const Value& value, const ExifData* metadata) { - if ( !metadata || value.typeId() != unsignedShort - || value.count() == 0) return os << value; - - LensTypeAndFocalLengthAndMaxAperture ltfl; - ltfl.lensType_ = value.toLong(); - - extractLensFocalLength(ltfl, metadata); - if (ltfl.focalLengthMax_ == 0.0F) + if (!metadata || value.typeId() != unsignedShort || value.count() == 0) return os << value; - convertFocalLength(ltfl, 1.0F); - ExifKey key("Exif.CanonCs.MaxAperture"); - auto pos = metadata->findKey(key); - if ( pos != metadata->end() - && pos->value().count() == 1 - && pos->value().typeId() == unsignedShort) { + auto const lensType = value.toLong(); - long val = static_cast(pos->value().toLong(0)); - if (val > 0) - { - std::ostringstream oss; - oss << std::setprecision(2); - oss << fnumber(canonEv(val)); - ltfl.maxAperture_ = oss.str(); - } + if (lensType == 0xffff){ + return printCsLensFFFF(os, value, metadata); } - if (ltfl.maxAperture_.empty()) return os << value; - - const TagDetails* td = find(canonCsLensType, ltfl); - if (!td) return os << value; - return os << td->label_; - } - //! printCsLensByFocalLength to human readable string - std::ostream& printCsLensByFocalLength(std::ostream& os, - const Value& value, - const ExifData* metadata) - { - if ( !metadata || value.typeId() != unsignedShort - || value.count() == 0) return os << value; - - LensTypeAndFocalLengthAndMaxAperture ltfl; - ltfl.lensType_ = value.toLong(); + // get the values we need from the metadata container + ExifKey lensKey("Exif.CanonCs.Lens"); + auto pos = metadata->findKey(lensKey); + // catch possible error cases + if (pos == metadata->end() or pos->value().count() < 3 or pos->value().typeId() != unsignedShort or + pos->value().toFloat(2) == 0.0F) { + os << "Unknown Lens (" << lensType << ")"; + } - extractLensFocalLength(ltfl, metadata); - if (ltfl.focalLengthMax_ == 0.0F) - return os << value; - convertFocalLength(ltfl, 1.0F); + int const exifFlMin = pos->value().toLong(1) / pos->value().toFloat(2); + int const exifFlMax = pos->value().toLong(0) / pos->value().toFloat(2); - if (ltfl.focalLength_.empty()) return os << value; + ExifKey aperKey("Exif.CanonCs.MaxAperture"); + pos = metadata->findKey(aperKey); + if (pos == metadata->end() or pos->value().count() != 1 or pos->value().typeId() != unsignedShort) { + os << "Unknown Lens (" << lensType << ")"; + } - const TagDetails* td = find(canonCsLensType, ltfl); - if (!td) return os << value; - return os << td->label_; - } + auto exifAperMax = fnumber(canonEv(static_cast(pos->value().toLong(0)))); + + // regex to extract short and tele focal length, max aperture at short and tele position + // and the teleconverter factor from the lens label + std::regex const lens_regex( + // anything at the start + ".*?" + // maybe min focal length and hyphen, surely max focal length e.g.: 24-70mm + "(?:([0-9]+)-)?([0-9]+)mm" + // anything in-between + ".*?" + // maybe short focal length max aperture and hyphen, surely at least single max aperture e.g.: f/4.5-5.6 + // short and tele indicate apertures at the short (focal_length_min) and tele (focal_length_max) + // position of the lens + "(?:(?:f\\/)|T)(?:([0-9]+(?:\\.[0-9]+)?)-)?([0-9]+(?:\\.[0-9])?)" + // check if there is a teleconverter pattern e.g. + 1.4x + "(?:.*?\\+.*?([0-9.]+)x)?" + ); + + bool unmatched = true; + // we loop over all our lenses to print out all matching lenses + // if we have multiple possibilities, they are concatenated by "*OR*" + for (auto const& lens : canonCsLensType) { + if (lens.val_ != lensType) { + continue; + } - //! printCsLensByFocalLengthTC to human readable string - std::ostream& printCsLensByFocalLengthTC(std::ostream& os, - const Value& value, - const ExifData* metadata) - { - if ( !metadata || value.typeId() != unsignedShort - || value.count() == 0) return os << value; + std::cmatch base_match; + if (not std::regex_search(lens.label_, base_match, lens_regex)) { + // this should never happen, as it would indicate the lens is specified incorrectly + // in the CanonCsLensType array + throw Error(kerErrorMessage, std::string("Lens regex didn't match for: ") + std::string(lens.label_)); + } - LensTypeAndFocalLengthAndMaxAperture ltfl; - ltfl.lensType_ = value.toLong(); + auto tc = base_match[5].length() > 0 ? std::stof(base_match[5].str()) : 1.f; - extractLensFocalLength(ltfl, metadata); + int flMax = std::stoi(base_match[2].str()) * tc; + int flMin = base_match[1].length() > 0 ? std::stoi(base_match[1].str()) * tc : flMax; - if (ltfl.focalLengthMax_ == 0.0) return os << value; + auto aperMaxTele = std::stof(base_match[4].str()) * tc; + auto aperMaxShort = base_match[3].length() > 0 ? std::stof(base_match[3].str()) * tc : aperMaxTele; - const TagDetails* td; - const double factors[] = {1.0, 1.4, 2.0}; - for (const double &factor : factors) - { - convertFocalLength(ltfl, factor); + if (flMin != exifFlMin or flMax != exifFlMax or exifAperMax < (aperMaxShort - .1) or + exifAperMax > (aperMaxTele + .1)) { + continue; + } - std::ostringstream oss; - oss << std::setprecision(2); - oss << factor << "x"; + if (unmatched) { + unmatched = false; + os << lens.label_; + continue; + } - ltfl.maxAperture_ = oss.str(); - td = find(canonCsLensType, ltfl); - if (td) break; + os << " *OR* " << lens.label_; + } - ltfl.maxAperture_ = ""; - td = find(canonCsLensType, ltfl); - if (td) break; + // if the entire for loop left us with unmatched==false + // we weren't able to find a single matching lens :( + if (unmatched) { + os << "Unknown Lens (" << lensType << ")"; } - if (!td) return os << value; - return os << td->label_; + return os; } //! printCsLensType by searching the config file if necessary @@ -2968,14 +2840,9 @@ namespace Exiv2 { return os << Internal::readExiv2Config(section,value.toString(),undefined); } - const LensIdFct* lif = find(lensIdFct, value.toLong()); - if (!lif) { - return EXV_PRINT_TAG(canonCsLensType)(os, value, metadata); - } - if (metadata && lif->fct_) { - return lif->fct_(os, value, metadata); - } - return os << value; + // try our best to determine the lens based on metadata + // sometimes the result will be a set of multiple choices + return printCsLensTypeByMetadata(os, value, metadata); } std::ostream& CanonMakerNote::printCsLens(std::ostream& os, diff --git a/tests/lens_tests/test_canon_lenses.py b/tests/lens_tests/test_canon_lenses.py index 37f5200a52..a67597bd3d 100644 --- a/tests/lens_tests/test_canon_lenses.py +++ b/tests/lens_tests/test_canon_lenses.py @@ -1,10 +1,15 @@ # -*- coding: utf-8 -*- - import re import os import system_tests -import math -from lens_tests.utils import extract_lenses_from_cpp, make_test_cases +from lens_tests.utils import extract_lenses_from_cpp, make_test_cases, aperture_to_raw_exif + +# NOTE +# Normally the canon maker note holds the max aperture of the lens at the focal length +# the picture was taken at. Thus for a f/4-6.3 lens, this value could be anywhere in that range. +# For the below tests we only test the scenario where the lens was used at it's shortest focal length. +# Thus we always pick the 'aperture_max_short' of a lens as the value to write into the +# Exif.CanonCs.MaxAperture field. # get directory of the current file file_dir = os.path.dirname(os.path.realpath(__file__)) @@ -17,31 +22,6 @@ # use utils function to define test case data test_cases = make_test_cases(lenses) -# see https://github.com/exiftool/exiftool/blob/master/lib/Image/ExifTool/Canon.pm#L9678 -def aperture_to_raw_exif(aperture): - # for apertures < 1 the below is negative - num = math.log(aperture) * 2 / math.log(2) - - # temporarily make the number positive - if num < 0: - num = -num - sign = -1 - else: - sign = 1 - - val = int(num) - frac = num - val - - if abs(frac - 0.33) < 0.05: - frac = 0x0C - elif abs(frac - 0.67) < 0.05: - frac = 0x14 - else: - frac = int(frac * 0x20 + 0.5) - - return sign * (val * 0x20 + frac) - - for lens_tc in test_cases: testname = lens_tc["id"] + "_" + lens_tc["desc"] @@ -59,7 +39,7 @@ def aperture_to_raw_exif(aperture): "retval": [0], "lens_id": lens_tc["id"], "lens_description": lens_tc["target"], - "aperture_max": aperture_to_raw_exif(lens_tc["aperture_max_short"]), + "aperture_max": aperture_to_raw_exif(lens_tc["aperture_max_short"] * lens_tc["tc"]), "focal_length_min": int(lens_tc["focal_length_min"] * lens_tc["tc"]), "focal_length_max": int(lens_tc["focal_length_max"] * lens_tc["tc"]), }, diff --git a/tests/lens_tests/utils.py b/tests/lens_tests/utils.py index fa03cf86e9..b3d61319ad 100644 --- a/tests/lens_tests/utils.py +++ b/tests/lens_tests/utils.py @@ -1,6 +1,7 @@ import re import os import logging +import math from itertools import groupby log = logging.getLogger(__name__) @@ -12,11 +13,11 @@ ( # anything at the start ".*?" - # maybe min focal length and hyhpen, surely max focal length e.g.: 24-70mm + # maybe min focal length and hyphen, surely max focal length e.g.: 24-70mm "(?:(?P[0-9]+)-)?(?P[0-9]+)mm" - # anything inbetween + # anything in-between ".*?" - # maybe short focal length max aperture and hyhpen, surely at least single max aperture e.g.: f/4.5-5.6 + # maybe short focal length max aperture and hyphen, surely at least single max aperture e.g.: f/4.5-5.6 # short and tele indicate apertures at the short (focal_length_min) and tele (focal_length_max) position of the lens "(?:(?:f\/)|T)(?:(?P[0-9]+(?:\.[0-9]+)?)-)?(?P[0-9]+(?:\.[0-9])?)" # check if there is a teleconverter pattern e.g. + 1.4x @@ -25,9 +26,58 @@ ) +def aperture_to_raw_exif(aperture): + # see https://github.com/exiftool/exiftool/blob/master/lib/Image/ExifTool/Canon.pm#L9678 + """Transform aperture value to Canon maker note style hex format.""" + # for apertures < 1 the below is negative + num = math.log(aperture) * 2 / math.log(2) + + # temporarily make the number positive + if num < 0: + num = -num + sign = -1 + else: + sign = 1 + + val = int(num) + frac = num - val + + if abs(frac - 0.33) < 0.05: + frac = 0x0C + elif abs(frac - 0.67) < 0.05: + frac = 0x14 + else: + frac = int(frac * 0x20 + 0.5) + + return sign * (val * 0x20 + frac) + + +def raw_exif_to_aperture(raw): + """The inverse operation of aperture_to_raw_exif""" + val = raw + if val < 0: + val = -val + sign = -1 + else: + sign = 1 + + frac = val & 0x1F + val -= frac + # Convert 1/3 and 2/3 codes + if frac == 0x0C: + frac = 0x20 / 3 + elif frac == 0x14: + frac = 0x40 / 3 + + ev = sign * (val + frac) / 0x20 + return math.exp(ev * math.log(2) / 2) + + def parse_lens_entry(text, pattern=LENS_ENTRY_DEFAULT_RE): - """get the ID, and description from a lens entry field - Expexted input format: + """ + get the ID, and description from a lens entry field + + Expected input format: { 748, "Canon EF 100-400mm f/4.5-5.6L IS II USM + 1.4x" } We return a dict of: lens_id = 748 @@ -40,6 +90,7 @@ def parse_lens_entry(text, pattern=LENS_ENTRY_DEFAULT_RE): def extract_meta(text, pattern=LENS_META_DEFAULT_RE): """ Extract metadata from lens description. + Input expected in the form of e.g. "Canon EF 100-400mm f/4.5-5.6L IS II USM + 1.4x" We return a dict of: focal_length_min = 100 @@ -64,16 +115,27 @@ def extract_meta(text, pattern=LENS_META_DEFAULT_RE): return ret -# FIXME explain somwhere that lens_is_match(l1,l2) does not imply lens_is_match(l2,l1) -# becuse we don't have short and tele aperture values in exif def lens_is_match(l1, l2): """ - Test if lens l2 is compatible with lens l1, - assuming we write l1's metadata and apeture_max_short into exif + Test if lens l2 is compatible with lens l1 + + This assumes we write l1's metadata and pick its 'aperture_max_short' value + as the maximum aperture value to write into exif. + Normally the canon maker note holds the max aperture of the lens at the focal length + the picture was taken at. Thus for a f/4-6.3 lens, this value could be anywhere in that range. """ - return ( - all([l1[k] == l2[k] for k in ["tc", "focal_length_min", "focal_length_max"]]) - and l2["aperture_max_short"] <= l1["aperture_max_short"] <= l2["aperture_max_tele"] + # the problem is that the round trip transformation isn't exact + # so we need to account for this here as well to not define a target + # which isn't achievable for exiv2 + reconstructed_aperture = raw_exif_to_aperture(aperture_to_raw_exif(l1["aperture_max_short"] * l1["tc"])) + return all( + [ + l1["focal_length_min"] * l1["tc"] == l2["focal_length_min"] * l2["tc"], + l1["focal_length_max"] * l1["tc"] == l2["focal_length_max"] * l2["tc"], + (l2["aperture_max_short"] * l2["tc"]) - 0.1 + <= reconstructed_aperture + <= (l2["aperture_max_tele"] * l2["tc"]) + 0.1, + ] ) @@ -100,7 +162,7 @@ def make_test_cases(lenses): def extract_lenses_from_cpp(filename, start_pattern): """ - Extract lens information from the lens descritpions array in a maker note cpp file + Extract lens information from the lens descriptions array in a maker note cpp file filename: path to cpp file start_pattern: start_pattern == line.strip() should return True for the starting line of the array containing the lenses. @@ -134,7 +196,7 @@ def extract_lenses_from_cpp(filename, start_pattern): meta = extract_meta(lens_entry[1]) if not meta: - log.error(f"Failure extracing metadata from lens description: {lens_entry[0]}: {lens_entry[1]}.") + log.error(f"Failure extracting metadata from lens description: {lens_entry[0]}: {lens_entry[1]}.") continue lenses.append({"id": lens_entry[0], "desc": lens_entry[1], "meta": meta}) From 20cff55cd877f63e0e4dbbdcc3adc534451b80e8 Mon Sep 17 00:00:00 2001 From: Christoph Hasse Date: Tue, 8 Jun 2021 22:25:07 +0200 Subject: [PATCH 14/17] fix: fix bash test following the new canon lens identification --- test/data/exiv2-test.out | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/data/exiv2-test.out b/test/data/exiv2-test.out index feaac1f93e..307ebfde5e 100644 --- a/test/data/exiv2-test.out +++ b/test/data/exiv2-test.out @@ -1906,7 +1906,7 @@ File 14/16: 20001004_015404.jpg 20001004_015404.jpg Exif.CanonCs.AFPoint Short 1 Auto-selected 20001004_015404.jpg Exif.CanonCs.ExposureProgram Short 1 Aperture priority (Av) 20001004_015404.jpg Exif.CanonCs.0x0015 Short 1 0 -20001004_015404.jpg Exif.CanonCs.LensType Short 1 Canon EF 28-70mm f/2.8L USM +20001004_015404.jpg Exif.CanonCs.LensType Short 1 Canon EF 28-70mm f/2.8L USM *OR* Sigma 28-70mm f/2.8 EX 20001004_015404.jpg Exif.CanonCs.Lens Short 3 28.0 - 70.0 mm 20001004_015404.jpg Exif.CanonCs.MaxAperture Short 1 F2.8 20001004_015404.jpg Exif.CanonCs.MinAperture Short 1 F22 @@ -3546,7 +3546,7 @@ Compare image data and extracted data ------------------------------------ < 20001004_015404.jpg Exif.CanonCs.AFPoint Short 1 Auto-selected < 20001004_015404.jpg Exif.CanonCs.ExposureProgram Short 1 Aperture priority (Av) < 20001004_015404.jpg Exif.CanonCs.0x0015 Short 1 0 -< 20001004_015404.jpg Exif.CanonCs.LensType Short 1 Canon EF 28-70mm f/2.8L USM +< 20001004_015404.jpg Exif.CanonCs.LensType Short 1 Canon EF 28-70mm f/2.8L USM *OR* Sigma 28-70mm f/2.8 EX < 20001004_015404.jpg Exif.CanonCs.Lens Short 3 28.0 - 70.0 mm < 20001004_015404.jpg Exif.CanonCs.MaxAperture Short 1 F2.8 < 20001004_015404.jpg Exif.CanonCs.MinAperture Short 1 F22 @@ -5109,7 +5109,7 @@ Compare image data and extracted data ------------------------------------ > 20001004_015404.exv Exif.CanonCs.AFPoint Short 1 Auto-selected > 20001004_015404.exv Exif.CanonCs.ExposureProgram Short 1 Aperture priority (Av) > 20001004_015404.exv Exif.CanonCs.0x0015 Short 1 0 -> 20001004_015404.exv Exif.CanonCs.LensType Short 1 Canon EF 28-70mm f/2.8L USM +> 20001004_015404.exv Exif.CanonCs.LensType Short 1 Canon EF 28-70mm f/2.8L USM *OR* Sigma 28-70mm f/2.8 EX > 20001004_015404.exv Exif.CanonCs.Lens Short 3 28.0 - 70.0 mm > 20001004_015404.exv Exif.CanonCs.MaxAperture Short 1 F2.8 > 20001004_015404.exv Exif.CanonCs.MinAperture Short 1 F22 @@ -6910,7 +6910,7 @@ Compare original and inserted image data --------------------------------- < 20001004_015404.jpg Exif.CanonCs.AFPoint Short 1 Auto-selected < 20001004_015404.jpg Exif.CanonCs.ExposureProgram Short 1 Aperture priority (Av) < 20001004_015404.jpg Exif.CanonCs.0x0015 Short 1 0 -< 20001004_015404.jpg Exif.CanonCs.LensType Short 1 Canon EF 28-70mm f/2.8L USM +< 20001004_015404.jpg Exif.CanonCs.LensType Short 1 Canon EF 28-70mm f/2.8L USM *OR* Sigma 28-70mm f/2.8 EX < 20001004_015404.jpg Exif.CanonCs.Lens Short 3 28.0 - 70.0 mm < 20001004_015404.jpg Exif.CanonCs.MaxAperture Short 1 F2.8 < 20001004_015404.jpg Exif.CanonCs.MinAperture Short 1 F22 @@ -8473,7 +8473,7 @@ Compare original and inserted image data --------------------------------- > 20001004_015404.exv Exif.CanonCs.AFPoint Short 1 Auto-selected > 20001004_015404.exv Exif.CanonCs.ExposureProgram Short 1 Aperture priority (Av) > 20001004_015404.exv Exif.CanonCs.0x0015 Short 1 0 -> 20001004_015404.exv Exif.CanonCs.LensType Short 1 Canon EF 28-70mm f/2.8L USM +> 20001004_015404.exv Exif.CanonCs.LensType Short 1 Canon EF 28-70mm f/2.8L USM *OR* Sigma 28-70mm f/2.8 EX > 20001004_015404.exv Exif.CanonCs.Lens Short 3 28.0 - 70.0 mm > 20001004_015404.exv Exif.CanonCs.MaxAperture Short 1 F2.8 > 20001004_015404.exv Exif.CanonCs.MinAperture Short 1 F22 From 7bc9c01d95ebea76f9efef6a79618bfbf3460d83 Mon Sep 17 00:00:00 2001 From: Christoph Hasse Date: Tue, 8 Jun 2021 22:35:45 +0200 Subject: [PATCH 15/17] fix: update tests following new canon lens identification --- tests/bugfixes/redmine/test_issue_1166.py | 2 +- tests/bugfixes/redmine/test_issue_1170.py | 2 +- tests/bugfixes/redmine/test_issue_1252.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/bugfixes/redmine/test_issue_1166.py b/tests/bugfixes/redmine/test_issue_1166.py index fae7ced131..b004a344a9 100644 --- a/tests/bugfixes/redmine/test_issue_1166.py +++ b/tests/bugfixes/redmine/test_issue_1166.py @@ -10,7 +10,7 @@ class CheckTokina11_20mm(metaclass=system_tests.CaseMeta): commands = [ "$exiv2 -pa --grep lens/i $filename" ] - stdout = [ """Exif.CanonCs.LensType Short 1 Tokina AT-X 11-20 F2.8 PRO DX Aspherical 11-20mm f/2.8 + stdout = [ """Exif.CanonCs.LensType Short 1 Tokina AT-X 11-20 f/2.8 PRO DX Aspherical 11-20mm f/2.8 Exif.CanonCs.Lens Short 3 11.0 - 20.0 mm Exif.Canon.LensModel Ascii 74 11-20mm Exif.Photo.LensSpecification Rational 4 11/1 20/1 0/1 0/1 diff --git a/tests/bugfixes/redmine/test_issue_1170.py b/tests/bugfixes/redmine/test_issue_1170.py index 6d973f5406..f2a3bcaaed 100644 --- a/tests/bugfixes/redmine/test_issue_1170.py +++ b/tests/bugfixes/redmine/test_issue_1170.py @@ -10,7 +10,7 @@ class CheckSigma35mm(metaclass=system_tests.CaseMeta): commands = [ "$exiv2 -pa --grep lens/i $filename" ] - stdout = [ """Exif.CanonCs.LensType Short 1 Sigma 35mm f/1.4 DG HSM + stdout = [ """Exif.CanonCs.LensType Short 1 Sigma 35mm f/1.4 DG HSM *OR* Sigma 35mm f/1.5 FF High-Speed Prime | 017 Exif.CanonCs.Lens Short 3 35.0 mm Exif.Canon.LensModel Ascii 74 35mm Exif.Photo.LensSpecification Rational 4 35/1 35/1 0/1 0/1 diff --git a/tests/bugfixes/redmine/test_issue_1252.py b/tests/bugfixes/redmine/test_issue_1252.py index 3da585070f..a5d6ee78a1 100644 --- a/tests/bugfixes/redmine/test_issue_1252.py +++ b/tests/bugfixes/redmine/test_issue_1252.py @@ -16,7 +16,7 @@ class CanonLenses(metaclass=system_tests.CaseMeta): "$exiv2 -pa --grep lens/i " + filenames[1], ] - stdout = ["""Exif.CanonCs.LensType Short 1 Sigma APO 120-300mm f/2.8 EX DG OS HSM + stdout = ["""Exif.CanonCs.LensType Short 1 Sigma APO 120-300mm f/2.8 EX DG OS HSM *OR* Sigma 120-300mm f/2.8 DG OS HSM S013 Exif.CanonCs.Lens Short 3 120.0 - 300.0 mm Exif.Canon.LensModel Ascii 74 120-300mm Exif.Photo.LensSpecification Rational 4 120/1 300/1 0/1 0/1 From 7867343611488325a46785c1b3239583000b6fec Mon Sep 17 00:00:00 2001 From: Christoph Hasse Date: Tue, 8 Jun 2021 23:03:28 +0200 Subject: [PATCH 16/17] fix: prefer symbolic boolean operators so windows is happy --- src/canonmn_int.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/canonmn_int.cpp b/src/canonmn_int.cpp index 842237fc4a..c0077251de 100644 --- a/src/canonmn_int.cpp +++ b/src/canonmn_int.cpp @@ -2747,7 +2747,7 @@ namespace Exiv2 { ExifKey lensKey("Exif.CanonCs.Lens"); auto pos = metadata->findKey(lensKey); // catch possible error cases - if (pos == metadata->end() or pos->value().count() < 3 or pos->value().typeId() != unsignedShort or + if (pos == metadata->end() || pos->value().count() < 3 || pos->value().typeId() != unsignedShort || pos->value().toFloat(2) == 0.0F) { os << "Unknown Lens (" << lensType << ")"; } @@ -2757,7 +2757,7 @@ namespace Exiv2 { ExifKey aperKey("Exif.CanonCs.MaxAperture"); pos = metadata->findKey(aperKey); - if (pos == metadata->end() or pos->value().count() != 1 or pos->value().typeId() != unsignedShort) { + if (pos == metadata->end() || pos->value().count() != 1 || pos->value().typeId() != unsignedShort) { os << "Unknown Lens (" << lensType << ")"; } @@ -2789,7 +2789,7 @@ namespace Exiv2 { } std::cmatch base_match; - if (not std::regex_search(lens.label_, base_match, lens_regex)) { + if (!std::regex_search(lens.label_, base_match, lens_regex)) { // this should never happen, as it would indicate the lens is specified incorrectly // in the CanonCsLensType array throw Error(kerErrorMessage, std::string("Lens regex didn't match for: ") + std::string(lens.label_)); @@ -2803,7 +2803,7 @@ namespace Exiv2 { auto aperMaxTele = std::stof(base_match[4].str()) * tc; auto aperMaxShort = base_match[3].length() > 0 ? std::stof(base_match[3].str()) * tc : aperMaxTele; - if (flMin != exifFlMin or flMax != exifFlMax or exifAperMax < (aperMaxShort - .1) or + if (flMin != exifFlMin || flMax != exifFlMax || exifAperMax < (aperMaxShort - .1) || exifAperMax > (aperMaxTele + .1)) { continue; } From efb0af85062b9fc81da375d17337cfd8088e497a Mon Sep 17 00:00:00 2001 From: Christoph Hasse Date: Tue, 8 Jun 2021 23:33:03 +0200 Subject: [PATCH 17/17] fix: make casts explicit to please msvc --- src/canonmn_int.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/canonmn_int.cpp b/src/canonmn_int.cpp index c0077251de..c78109c3a7 100644 --- a/src/canonmn_int.cpp +++ b/src/canonmn_int.cpp @@ -2752,8 +2752,8 @@ namespace Exiv2 { os << "Unknown Lens (" << lensType << ")"; } - int const exifFlMin = pos->value().toLong(1) / pos->value().toFloat(2); - int const exifFlMax = pos->value().toLong(0) / pos->value().toFloat(2); + int const exifFlMin = static_cast(static_cast(pos->value().toLong(1)) / pos->value().toFloat(2)); + int const exifFlMax = static_cast(static_cast(pos->value().toLong(0)) / pos->value().toFloat(2)); ExifKey aperKey("Exif.CanonCs.MaxAperture"); pos = metadata->findKey(aperKey); @@ -2797,8 +2797,8 @@ namespace Exiv2 { auto tc = base_match[5].length() > 0 ? std::stof(base_match[5].str()) : 1.f; - int flMax = std::stoi(base_match[2].str()) * tc; - int flMin = base_match[1].length() > 0 ? std::stoi(base_match[1].str()) * tc : flMax; + int flMax = static_cast(std::stof(base_match[2].str()) * tc); + int flMin = base_match[1].length() > 0 ? static_cast(std::stof(base_match[1].str()) * tc) : flMax; auto aperMaxTele = std::stof(base_match[4].str()) * tc; auto aperMaxShort = base_match[3].length() > 0 ? std::stof(base_match[3].str()) * tc : aperMaxTele;