diff --git a/src/nikonmn_int.cpp b/src/nikonmn_int.cpp index dc2d5d63..d191d3dd 100644 --- a/src/nikonmn_int.cpp +++ b/src/nikonmn_int.cpp @@ -1719,8 +1719,8 @@ constexpr TagInfo Nikon3MakerNote::tagInfoLd4_[] = { printApertureLd4}, {60, "FocalLength2", N_("Focal Length 2"), N_("Focal length 2"), IfdId::nikonLd4Id, SectionId::makerTags, unsignedShort, 1, printFocalLd4}, - {79, "FocusDistance2", N_("Focus Distance 2"), N_("Focus distance 2"), IfdId::nikonLd4Id, SectionId::makerTags, - unsignedByte, 1, printFocusDistance}, + {78, "FocusDistance2", N_("Focus Distance 2"), N_("Focus distance 2"), IfdId::nikonLd4Id, SectionId::makerTags, + unsignedShort, 1, printFocusDistanceLd4}, // End of list marker {0xffff, "(UnknownNikonLd4Tag)", "(UnknownNikonLd4Tag)", N_("Unknown Nikon Lens Data 3 Tag"), IfdId::nikonLd4Id, SectionId::makerTags, unsignedByte, 1, printValue}, @@ -3963,4 +3963,16 @@ std::ostream& Nikon3MakerNote::printFocalLd4(std::ostream& os, const Value& valu return os; } +std::ostream& Nikon3MakerNote::printFocusDistanceLd4(std::ostream& os, const Value& value, const ExifData*) { + if (value.count() != 1 || value.typeId() != unsignedShort) { + return os << "(" << value << ")"; + } + double dist = 0.01 * pow(10.0, (value.toInt64() / 256.0) / 40.0); + std::ostringstream oss; + oss.copyfmt(os); + os << std::fixed << std::setprecision(2) << dist << " m"; + os.copyfmt(oss); + return os; +} + } // namespace Exiv2::Internal diff --git a/src/nikonmn_int.hpp b/src/nikonmn_int.hpp index 66d6a1a7..9a38df0e 100644 --- a/src/nikonmn_int.hpp +++ b/src/nikonmn_int.hpp @@ -173,6 +173,8 @@ class Nikon3MakerNote { static std::ostream& printLensId4ZMount(std::ostream& os, const Value& value, const ExifData*); //! Print focus distance static std::ostream& printFocusDistance(std::ostream& os, const Value& value, const ExifData*); + //! Print focus distance for new LensData as used for e.g. Nikon Z 6/7 + static std::ostream& printFocusDistanceLd4(std::ostream& os, const Value& value, const ExifData*); //! Print lens aperture value static std::ostream& printAperture(std::ostream& os, const Value& value, const ExifData*); //! Print lens aperture value for new LensData as used for e.g. Nikon Z 6/7 diff --git a/src/tiffimage_int.cpp b/src/tiffimage_int.cpp index 5b351503..2e33ebac 100644 --- a/src/tiffimage_int.cpp +++ b/src/tiffimage_int.cpp @@ -772,9 +772,10 @@ constexpr ArrayDef nikonLdDef[] = { constexpr ArrayDef nikonLd4Def[] = { {0, ttUndefined, 4}, // Version {48, ttUnsignedShort, 1}, // LensID - {54, ttUnsignedShort, 1}, // MacAperture + {54, ttUnsignedShort, 1}, // MaxAperture {56, ttUnsignedShort, 1}, // FNumber {60, ttUnsignedShort, 1}, // FocalLength + {78, ttUnsignedShort, 1}, // FocusDistance }; //! Nikon Lens Data configurations and definitions constexpr ArraySet nikonLdSet[] = { diff --git a/test/data/test_reference_files/CH0_0174.exv.out b/test/data/test_reference_files/CH0_0174.exv.out index afe284a0..c6d694f8 100644 --- a/test/data/test_reference_files/CH0_0174.exv.out +++ b/test/data/test_reference_files/CH0_0174.exv.out @@ -116,7 +116,7 @@ Exif.NikonLd4.LensID Short 1 0 0 Exif.NikonLd4.MaxAperture Short 1 0 F0.5 Exif.NikonLd4.FNumber Short 1 0 F0.5 Exif.NikonLd4.FocalLength2 Short 1 0 0 mm -Exif.NikonLd4.FocusDistance2 Byte 1 0 0.01 m +Exif.NikonLd4.FocusDistance2 Short 1 0 0.01 m Exif.Nikon3.RawImageCenter Short 2 2274 1515 2274 1515 Exif.Nikon3.RetouchHistory Short 10 0 0 0 0 0 0 0 0 0 0 None Exif.Nikon3.ShutterCount Long 1 174 174