diff --git a/src/nikonmn_int.cpp b/src/nikonmn_int.cpp index 0bd0332e..f9b905eb 100644 --- a/src/nikonmn_int.cpp +++ b/src/nikonmn_int.cpp @@ -744,8 +744,8 @@ constexpr TagDetails nikonAfAreaMode[] = { {3, N_("Group Dynamic")}, {4, N_("Single Area (wide)")}, {5, N_("Dynamic Area (wide)")}, }; -//! AF2 Area Mode -constexpr TagDetails nikonAf2AreaMode[] = { +//! AF2 Area Mode when Contrast Detect AF is off +constexpr TagDetails nikonAf2AreaModeContrastDetectAfOff[] = { {0, N_("Single-point AF")}, {1, N_("Dynamic-area AF")}, {2, N_("Closest Subject")}, @@ -766,6 +766,12 @@ constexpr TagDetails nikonAf2AreaMode[] = { {17, N_("Group-area AF (VL)")}, }; +//! AF2 Area Mode when Contrast Detect AF is on +constexpr TagDetails nikonAf2AreaModeContrastDetectAfOn[] = { + {0, N_("Contrast AF")}, {1, N_("Normal-area AF")}, {2, N_("Wide-area AF")}, + {3, N_("Face-priority AF")}, {4, N_("Subject-tracking AF")}, {5, N_("Pinpoint AF")}, +}; + //! AfPoint constexpr TagDetails nikonAfPoint[] = { {0, N_("Center")}, {1, N_("Top")}, {2, N_("Bottom")}, {3, N_("Mid-left")}, @@ -810,7 +816,7 @@ constexpr TagInfo Nikon3MakerNote::tagInfoAf21_[] = { {4, "ContrastDetectAF", N_("Contrast Detect AF"), N_("Contrast detect AF"), IfdId::nikonAf21Id, SectionId::makerTags, unsignedByte, 1, EXV_PRINT_TAG(nikonOffOn)}, {5, "AFAreaMode", N_("AF Area Mode"), N_("AF area mode"), IfdId::nikonAf21Id, SectionId::makerTags, unsignedByte, 1, - EXV_PRINT_TAG(nikonAf2AreaMode)}, + printAf2AreaMode}, {6, "PhaseDetectAF", N_("Phase Detect AF"), N_("Phase detect AF"), IfdId::nikonAf21Id, SectionId::makerTags, unsignedByte, 1, EXV_PRINT_TAG(nikonPhaseDetectAF)}, {7, "PrimaryAFPoint", N_("Primary AF Point"), N_("Primary AF point"), IfdId::nikonAf21Id, SectionId::makerTags, @@ -1766,6 +1772,21 @@ std::ostream& Nikon3MakerNote::print0x0002(std::ostream& os, const Value& value, return os; } +std::ostream& Nikon3MakerNote::printAf2AreaMode(std::ostream& os, const Value& value, const ExifData* metadata) { + int contrastDetectAF = 0; + if (metadata) { + auto pos = metadata->findKey(ExifKey("Exif.NikonAf2.ContrastDetectAF")); + if (pos != metadata->end() && pos->count() != 0) { + contrastDetectAF = pos->toUint32(); + } + } + + if (contrastDetectAF == 0) + return EXV_PRINT_TAG(nikonAf2AreaModeContrastDetectAfOff)(os, value, nullptr); + else + return EXV_PRINT_TAG(nikonAf2AreaModeContrastDetectAfOn)(os, value, nullptr); +} + std::ostream& Nikon3MakerNote::print0x0007(std::ostream& os, const Value& value, const ExifData*) { std::string focus = value.toString(); if (focus == "AF-C ") diff --git a/src/nikonmn_int.hpp b/src/nikonmn_int.hpp index 9a38df0e..5ed35b5a 100644 --- a/src/nikonmn_int.hpp +++ b/src/nikonmn_int.hpp @@ -144,6 +144,8 @@ class Nikon3MakerNote { //@{ //! Print ISO setting static std::ostream& print0x0002(std::ostream& os, const Value& value, const ExifData*); + //! Print AF2 Area Mode + static std::ostream& printAf2AreaMode(std::ostream& os, const Value& value, const ExifData* metadata); //! Print autofocus mode static std::ostream& print0x0007(std::ostream& os, const Value& value, const ExifData*); //! Print lens type diff --git a/test/data/test_reference_files/Tokina_AT-X_14-20_F2_PRO_DX.exv.out b/test/data/test_reference_files/Tokina_AT-X_14-20_F2_PRO_DX.exv.out index e806bd46..1b91c2c0 100644 --- a/test/data/test_reference_files/Tokina_AT-X_14-20_F2_PRO_DX.exv.out +++ b/test/data/test_reference_files/Tokina_AT-X_14-20_F2_PRO_DX.exv.out @@ -149,7 +149,7 @@ Exif.NikonMe.MultiExposureAutoGain Long 1 0 Off Exif.Nikon3.HighISONoiseReduction Short 1 0 Off Exif.NikonAf2.Version Undefined 4 48 49 48 48 1.00 Exif.NikonAf2.ContrastDetectAF Byte 1 1 On -Exif.NikonAf2.AFAreaMode Byte 1 2 Closest Subject +Exif.NikonAf2.AFAreaMode Byte 1 2 Wide-area AF Exif.NikonAf2.PhaseDetectAF Byte 1 0 Off Exif.NikonAf2.PrimaryAFPoint Byte 1 0 0 Exif.NikonAf2.AFPointsUsed Byte 7 0 0 0 0 0 0 0 0 0 0 0 0 0 0