From 1f3b62992f89794e5323906a34b5f7e16fee019e Mon Sep 17 00:00:00 2001 From: norbertwg Date: Wed, 1 Nov 2023 13:26:33 +0100 Subject: [PATCH 1/2] easy access: Tag sequence changed for serialNumber and lensName --- src/easyaccess.cpp | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/easyaccess.cpp b/src/easyaccess.cpp index 78a5fd88..d9e4ea56 100644 --- a/src/easyaccess.cpp +++ b/src/easyaccess.cpp @@ -272,15 +272,17 @@ ExifData::const_iterator whiteBalance(const ExifData& ed) { ExifData::const_iterator lensName(const ExifData& ed) { static constexpr const char* keys[] = { // Try Exif.CanonCs.LensType first. - "Exif.CanonCs.LensType", "Exif.Photo.LensModel", - "Exif.Canon.LensModel", "Exif.NikonLd1.LensIDNumber", - "Exif.NikonLd2.LensIDNumber", "Exif.NikonLd3.LensIDNumber", - "Exif.NikonLd4.LensID", "Exif.NikonLd4.LensIDNumber", + // Exif.OlympusEq.LensType and Exif.Pentax.LensType in most cases give better information than + // Exif.Photo.LensModel + "Exif.CanonCs.LensType", "Exif.OlympusEq.LensType", "Exif.Pentax.LensType", "Exif.PentaxDng.LensType", - "Exif.Minolta.LensID", "Exif.SonyMinolta.LensID", - "Exif.Sony1.LensID", "Exif.Sony2.LensID", - "Exif.Sony1.LensSpec", "Exif.Sony2.LensSpec", - "Exif.OlympusEq.LensType", "Exif.Panasonic.LensType", + "Exif.Photo.LensModel", "Exif.Canon.LensModel", + "Exif.NikonLd1.LensIDNumber", "Exif.NikonLd2.LensIDNumber", + "Exif.NikonLd3.LensIDNumber", "Exif.NikonLd4.LensID", + "Exif.NikonLd4.LensIDNumber", "Exif.Minolta.LensID", + "Exif.SonyMinolta.LensID", "Exif.Sony1.LensID", + "Exif.Sony2.LensID", "Exif.Sony1.LensSpec", + "Exif.Sony2.LensSpec", "Exif.Panasonic.LensType", "Exif.Samsung2.LensType", "Exif.Photo.LensSpecification", "Exif.Nikon3.Lens", }; @@ -457,10 +459,12 @@ ExifData::const_iterator flash(const ExifData& ed) { ExifData::const_iterator serialNumber(const ExifData& ed) { static constexpr const char* keys[] = { - "Exif.Image.CameraSerialNumber", "Exif.Photo.BodySerialNumber", "Exif.Canon.SerialNumber", - "Exif.Nikon3.SerialNumber", "Exif.Nikon3.SerialNO", "Exif.Fujifilm.SerialNumber", - "Exif.Olympus.SerialNumber2", "Exif.OlympusEq.SerialNumber", "Exif.Pentax.SerialNumber", - "Exif.PentaxDng.SerialNumber", "Exif.Sigma.SerialNumber", "Exif.Sony1.SerialNumber", + // first check Exif.Canon.SerialNumber, because some Canon images contain a wrong value in + // Exif.Photo.BodySerialNumber + "Exif.Canon.SerialNumber", "Exif.Image.CameraSerialNumber", "Exif.Photo.BodySerialNumber", + "Exif.Nikon3.SerialNumber", "Exif.Nikon3.SerialNO", "Exif.Fujifilm.SerialNumber", + "Exif.Olympus.SerialNumber2", "Exif.OlympusEq.SerialNumber", "Exif.Pentax.SerialNumber", + "Exif.PentaxDng.SerialNumber", "Exif.Sigma.SerialNumber", "Exif.Sony1.SerialNumber", "Exif.Sony2.SerialNumber", }; return findMetadatum(ed, keys, std::size(keys)); From a1d2139a7af256af51fc957cfb56034c467c7aca Mon Sep 17 00:00:00 2001 From: norbertwg Date: Sun, 19 Nov 2023 16:42:34 +0100 Subject: [PATCH 2/2] enhance translation for Exif.NikonAf2.AFAreaMode --- src/nikonmn_int.cpp | 27 ++++++++++++++++--- src/nikonmn_int.hpp | 2 ++ .../Tokina_AT-X_14-20_F2_PRO_DX.exv.out | 2 +- 3 files changed, 27 insertions(+), 4 deletions(-) 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