Skip to content

Commit fb043da

Browse files
committed
Convert Nikon Z lenses to an ordinary map
1 parent f720c21 commit fb043da

File tree

5 files changed

+54
-66
lines changed

5 files changed

+54
-66
lines changed

src/nikonmn_int.cpp

+51-61
Original file line numberDiff line numberDiff line change
@@ -1689,6 +1689,56 @@ const TagInfo* Nikon3MakerNote::tagListLd3() {
16891689
return tagInfoLd3_;
16901690
}
16911691

1692+
//! LensID, tag index 48
1693+
// see https://github.com/exiftool/exiftool/blob/13.16/lib/Image/ExifTool/Nikon.pm#L5668
1694+
constexpr TagDetails nikonZMountLensId[] = {
1695+
{0, N_("n/a")},
1696+
{1, "Nikon Nikkor Z 24-70mm f/4 S"},
1697+
{2, "Nikon Nikkor Z 14-30mm f/4 S"},
1698+
{4, "Nikon Nikkor Z 35mm f/1.8 S"},
1699+
{8, "Nikon Nikkor Z 58mm f/0.95 S Noct"}, // IB
1700+
{9, "Nikon Nikkor Z 50mm f/1.8 S"},
1701+
{11, "Nikon Nikkor Z DX 16-50mm f/3.5-6.3 VR"},
1702+
{12, "Nikon Nikkor Z DX 50-250mm f/4.5-6.3 VR"},
1703+
{13, "Nikon Nikkor Z 24-70mm f/2.8 S"},
1704+
{14, "Nikon Nikkor Z 85mm f/1.8 S"},
1705+
{15, "Nikon Nikkor Z 24mm f/1.8 S"}, // IB
1706+
{16, "Nikon Nikkor Z 70-200mm f/2.8 VR S"}, // IB
1707+
{17, "Nikon Nikkor Z 20mm f/1.8 S"}, // IB
1708+
{18, "Nikon Nikkor Z 24-200mm f/4-6.3 VR"}, // IB
1709+
{21, "Nikon Nikkor Z 50mm f/1.2 S"}, // IB
1710+
{22, "Nikon Nikkor Z 24-50mm f/4-6.3"}, // IB
1711+
{23, "Nikon Nikkor Z 14-24mm f/2.8 S"}, // IB
1712+
{24, "Nikon Nikkor Z MC 105mm f/2.8 VR S"}, // IB
1713+
{25, "Nikon Nikkor Z 40mm f/2"}, // 28
1714+
{26, "Nikon Nikkor Z DX 18-140mm f/3.5-6.3 VR"}, // IB
1715+
{27, "Nikon Nikkor Z MC 50mm f/2.8"}, // IB
1716+
{28, "Nikon Nikkor Z 100-400mm f/4.5-5.6 VR S"}, // 28
1717+
{29, "Nikon Nikkor Z 28mm f/2.8"}, // IB
1718+
{30, "Nikon Nikkor Z 400mm f/2.8 TC VR S"}, // 28
1719+
{31, "Nikon Nikkor Z 24-120mm f/4 S"}, // 28
1720+
{32, "Nikon Nikkor Z 800mm f/6.3 VR S"}, // 28
1721+
{35, "Nikon Nikkor Z 28-75mm f/2.8"}, // IB
1722+
{36, "Nikon Nikkor Z 400mm f/4.5 VR S"}, // IB
1723+
{37, "Nikon Nikkor Z 600mm f/4 TC VR S"}, // 28
1724+
{38, "Nikon Nikkor Z 85mm f/1.2 S"}, // 28
1725+
{39, "Nikon Nikkor Z 17-28mm f/2.8"}, // IB
1726+
{40, "Nikon Nikkor Z 26mm f/2.8"},
1727+
{41, "Nikon Nikkor Z DX 12-28mm f/3.5-5.6 PZ VR"},
1728+
{42, "Nikon Nikkor Z 180-600mm f/5.6-6.3 VR"},
1729+
{43, "Nikon Nikkor Z DX 24mm f/1.7"},
1730+
{44, "Nikon Nikkor Z 70-180mm f/2.8"},
1731+
{45, "Nikon Nikkor Z 600mm f/6.3 VR S"},
1732+
{46, "Nikon Nikkor Z 135mm f/1.8 S Plena"},
1733+
{47, "Nikon Nikkor Z 35mm f/1.2 S"},
1734+
{48, "Nikon Nikkor Z 28-400mm f/4-8 VR"},
1735+
{51, "Nikon Nikkor Z 35mm f/1.4"},
1736+
{52, "Nikon Nikkor Z 50mm f/1.4"},
1737+
{2305, "Laowa FFII 10mm F2.8 C&D Dreamer"},
1738+
{53251, "Sigma 56mm F1.4 DC DN | C"},
1739+
{57346, "Tamron 35-150mm F/2-2.8 Di III VXD"},
1740+
};
1741+
16921742
// Nikon3 Lens Data 4 Tag Info
16931743
// based on https://exiftool.org/TagNames/Nikon.html#LensData0800
16941744
constexpr TagInfo Nikon3MakerNote::tagInfoLd4_[] = {
@@ -1721,7 +1771,7 @@ constexpr TagInfo Nikon3MakerNote::tagInfoLd4_[] = {
17211771
{20, "EffectiveMaxAperture", N_("Effective Max Aperture"), N_("Effective max aperture"), IfdId::nikonLd4Id,
17221772
SectionId::makerTags, unsignedByte, 1, printAperture},
17231773
{48, "LensID", N_("LensID"), N_("Lens ID"), IfdId::nikonLd4Id, SectionId::makerTags, unsignedShort, 1,
1724-
printLensId4ZMount},
1774+
EXV_PRINT_TAG(nikonZMountLensId)},
17251775
{54, "MaxAperture", N_("Max Aperture"), N_("Max aperture"), IfdId::nikonLd4Id, SectionId::makerTags, unsignedShort,
17261776
1, printApertureLd4},
17271777
{56, "FNumber", N_("F-Number"), N_("F-Number"), IfdId::nikonLd4Id, SectionId::makerTags, unsignedShort, 1,
@@ -3849,66 +3899,6 @@ std::ostream& Nikon3MakerNote::print0x009e(std::ostream& os, const Value& value,
38493899
return os << s;
38503900
}
38513901

3852-
std::ostream& Nikon3MakerNote::printLensId4ZMount(std::ostream& os, const Value& value, const ExifData*) {
3853-
if (value.count() != 1 || value.typeId() != unsignedShort) {
3854-
return os << "(" << value << ")";
3855-
}
3856-
3857-
// cf. https://github.com/exiftool/exiftool/blob/13.16/lib/Image/ExifTool/Nikon.pm#L5668
3858-
static constexpr std::tuple<uint16_t, const char*, const char*> zmountlens[] = {
3859-
{1, "Nikon", "Nikkor Z 24-70mm f/4 S"},
3860-
{2, "Nikon", "Nikkor Z 14-30mm f/4 S"},
3861-
{4, "Nikon", "Nikkor Z 35mm f/1.8 S"},
3862-
{8, "Nikon", "Nikkor Z 58mm f/0.95 S Noct"}, // IB
3863-
{9, "Nikon", "Nikkor Z 50mm f/1.8 S"},
3864-
{11, "Nikon", "Nikkor Z DX 16-50mm f/3.5-6.3 VR"},
3865-
{12, "Nikon", "Nikkor Z DX 50-250mm f/4.5-6.3 VR"},
3866-
{13, "Nikon", "Nikkor Z 24-70mm f/2.8 S"},
3867-
{14, "Nikon", "Nikkor Z 85mm f/1.8 S"},
3868-
{15, "Nikon", "Nikkor Z 24mm f/1.8 S"}, // IB
3869-
{16, "Nikon", "Nikkor Z 70-200mm f/2.8 VR S"}, // IB
3870-
{17, "Nikon", "Nikkor Z 20mm f/1.8 S"}, // IB
3871-
{18, "Nikon", "Nikkor Z 24-200mm f/4-6.3 VR"}, // IB
3872-
{21, "Nikon", "Nikkor Z 50mm f/1.2 S"}, // IB
3873-
{22, "Nikon", "Nikkor Z 24-50mm f/4-6.3"}, // IB
3874-
{23, "Nikon", "Nikkor Z 14-24mm f/2.8 S"}, // IB
3875-
{24, "Nikon", "Nikkor Z MC 105mm f/2.8 VR S"}, // IB
3876-
{25, "Nikon", "Nikkor Z 40mm f/2"}, // 28
3877-
{26, "Nikon", "Nikkor Z DX 18-140mm f/3.5-6.3 VR"}, // IB
3878-
{27, "Nikon", "Nikkor Z MC 50mm f/2.8"}, // IB
3879-
{28, "Nikon", "Nikkor Z 100-400mm f/4.5-5.6 VR S"}, // 28
3880-
{29, "Nikon", "Nikkor Z 28mm f/2.8"}, // IB
3881-
{30, "Nikon", "Nikkor Z 400mm f/2.8 TC VR S"}, // 28
3882-
{31, "Nikon", "Nikkor Z 24-120mm f/4 S"}, // 28
3883-
{32, "Nikon", "Nikkor Z 800mm f/6.3 VR S"}, // 28
3884-
{35, "Nikon", "Nikkor Z 28-75mm f/2.8"}, // IB
3885-
{36, "Nikon", "Nikkor Z 400mm f/4.5 VR S"}, // IB
3886-
{37, "Nikon", "Nikkor Z 600mm f/4 TC VR S"}, // 28
3887-
{38, "Nikon", "Nikkor Z 85mm f/1.2 S"}, // 28
3888-
{39, "Nikon", "Nikkor Z 17-28mm f/2.8"}, // IB
3889-
{40, "Nikon", "Nikkor Z 26mm f/2.8"},
3890-
{41, "Nikon", "Nikkor Z DX 12-28mm f/3.5-5.6 PZ VR"},
3891-
{42, "Nikon", "Nikkor Z 180-600mm f/5.6-6.3 VR"},
3892-
{43, "Nikon", "Nikkor Z DX 24mm f/1.7"},
3893-
{44, "Nikon", "Nikkor Z 70-180mm f/2.8"},
3894-
{45, "Nikon", "Nikkor Z 600mm f/6.3 VR S"},
3895-
{46, "Nikon", "Nikkor Z 135mm f/1.8 S Plena"},
3896-
{47, "Nikon", "Nikkor Z 35mm f/1.2 S"},
3897-
{48, "Nikon", "Nikkor Z 28-400mm f/4-8 VR"},
3898-
{51, "Nikon", "Nikkor Z 35mm f/1.4"},
3899-
{52, "Nikon", "Nikkor Z 50mm f/1.4"},
3900-
{2305, "Laowa", "FFII 10mm F2.8 C&D Dreamer"},
3901-
{53251, "Sigma", "56mm F1.4 DC DN | C"},
3902-
{57346, "Tamron", "35-150mm F/2-2.8 Di III VXD"},
3903-
};
3904-
3905-
auto lid = static_cast<uint16_t>(value.toInt64());
3906-
for (auto&& [l, manuf, lensname] : zmountlens)
3907-
if (l == lid)
3908-
return os << manuf << " " << lensname;
3909-
return os << "(" << value << ")";
3910-
}
3911-
39123902
std::ostream& Nikon3MakerNote::printApertureLd4(std::ostream& os, const Value& value, const ExifData*) {
39133903
if (value.count() != 1 || value.typeId() != unsignedShort) {
39143904
return os << "(" << value << ")";

src/nikonmn_int.hpp

-2
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,6 @@ class Nikon3MakerNote {
171171
static std::ostream& printLensId2(std::ostream& os, const Value& value, const ExifData* metadata);
172172
static std::ostream& printLensId3(std::ostream& os, const Value& value, const ExifData* metadata);
173173
static std::ostream& printLensId4(std::ostream& os, const Value& value, const ExifData* metadata);
174-
//! Print lensname for ZMount Lens in new LensData as used for e.g. Nikon Z 6/7
175-
static std::ostream& printLensId4ZMount(std::ostream& os, const Value& value, const ExifData*);
176174
//! Print focus distance
177175
static std::ostream& printFocusDistance(std::ostream& os, const Value& value, const ExifData*);
178176
//! Print focus distance for new LensData as used for e.g. Nikon Z 6/7

test/data/test_reference_files/CH0_0174.exv.out

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ Exif.NikonLd4.MaxApertureAtMinFocal Byte 1 36 F2.8
112112
Exif.NikonLd4.MaxApertureAtMaxFocal Byte 1 36 F2.8
113113
Exif.NikonLd4.MCUVersion Byte 1 123 123
114114
Exif.NikonLd4.EffectiveMaxAperture Byte 1 36 F2.8
115-
Exif.NikonLd4.LensID Short 1 0 0
115+
Exif.NikonLd4.LensID Short 1 0 n/a
116116
Exif.NikonLd4.MaxAperture Short 1 0 n/a
117117
Exif.NikonLd4.FNumber Short 1 0 n/a
118118
Exif.NikonLd4.FocalLength2 Short 1 0 n/a

test/data/test_reference_files/NikonZ6.exv.out

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ Exif.NikonLd4.AFAperture Byte 1 0 n/a
9090
Exif.NikonLd4.FocusPosition Byte 1 0 0
9191
Exif.NikonLd4.FocusDistance Byte 1 0 n/a
9292
Exif.NikonLd4.FocalLength Byte 1 0 n/a
93-
Exif.NikonLd4.LensIDNumber Byte 1 0 0
93+
Exif.NikonLd4.LensIDNumber Byte 1 0 (0)
9494
Exif.NikonLd4.LensFStops Byte 1 0 F0.0
9595
Exif.NikonLd4.MinFocalLength Byte 1 0 n/a
9696
Exif.NikonLd4.MaxFocalLength Byte 1 0 n/a

tests/bugfixes/github/test_pr_1437.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Nikon_LensData8(metaclass=system_tests.CaseMeta):
2121
Exif.NikonLd4.MaxApertureAtMinFocal Byte 1 F2.8
2222
Exif.NikonLd4.MaxApertureAtMaxFocal Byte 1 F2.8
2323
Exif.NikonLd4.EffectiveMaxAperture Byte 1 F2.8
24-
Exif.NikonLd4.LensID Short 1 0
24+
Exif.NikonLd4.LensID Short 1 n/a
2525
Exif.NikonLd4.MaxAperture Short 1 n/a
2626
Exif.Nikon3.ShutterCount Long 1 174
2727
Exif.Photo.LensSpecification Rational 4 70-200mm F2.8

0 commit comments

Comments
 (0)