From 6c988e94d4bfa1c4b2cc5eb665f3b32efdc41a95 Mon Sep 17 00:00:00 2001 From: Hombre57 Date: Mon, 18 Sep 2017 21:30:42 +0200 Subject: [PATCH] FileBrowser now detects the 2 frames from DualPixel Canon files The QuickInfo frame from the EditorPanel now display the number of frame contained in the image file if > 1 See #4008 --- rtdata/languages/Francais | 1 + rtdata/languages/default | 1 + rtexif/canonattribs.cc | 17 ---------------- rtexif/rtexif.cc | 42 ++++++++++++++++++++++++++------------- rtexif/stdattribs.cc | 33 ++++++++++++++++++++++-------- rtgui/editorpanel.cc | 2 ++ 6 files changed, 57 insertions(+), 39 deletions(-) diff --git a/rtdata/languages/Francais b/rtdata/languages/Francais index e2d2faea6..b45b41e02 100644 --- a/rtdata/languages/Francais +++ b/rtdata/languages/Francais @@ -1153,6 +1153,7 @@ PROGRESSBAR_SAVEPNG;Enregistrement du fichier PNG... PROGRESSBAR_SAVETIFF;Enregistrement du fichier TIFF... PROGRESSBAR_SNAPSHOT_ADDED;Signet ajouté PROGRESSDLG_PROFILECHANGEDINBROWSER;Profil modifié dans le navigateur +QINFO_FRAMECOUNT;%2 images QINFO_HDR;HDR / %2 image(s) QINFO_ISO;ISO QINFO_NOEXIF;Données EXIF non disponibles. diff --git a/rtdata/languages/default b/rtdata/languages/default index ffb6ce194..1f1bb98e0 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -1176,6 +1176,7 @@ PROGRESSBAR_SAVEPNG;Saving PNG file... PROGRESSBAR_SAVETIFF;Saving TIFF file... PROGRESSBAR_SNAPSHOT_ADDED;Snapshot added PROGRESSDLG_PROFILECHANGEDINBROWSER;Processing profile changed in browser +QINFO_FRAMECOUNT;%2 frames QINFO_HDR;HDR / %2 frame(s) QINFO_ISO;ISO QINFO_NOEXIF;Exif data not available. diff --git a/rtexif/canonattribs.cc b/rtexif/canonattribs.cc index eaea38378..01b00dd53 100644 --- a/rtexif/canonattribs.cc +++ b/rtexif/canonattribs.cc @@ -1068,22 +1068,6 @@ public: }; CAFocalPlaneInterpreter caFocalPlaneInterpreter; -class RawImageSegmentationInterpreter : public Interpreter -{ -public: - virtual std::string toString (Tag* t) - { - int segmentNumber = t->toInt(0, SHORT); - int segmentWidth = t->toInt(2, SHORT); - int lastSegmentWidth = t->toInt(4, SHORT); - - char buffer[32]; - sprintf (buffer, "%d %d %d", segmentNumber, segmentWidth, lastSegmentWidth); - return buffer; - } -}; -RawImageSegmentationInterpreter rawImageSegmentationInterpreter; - class CAExposureTimeInterpreter : public Interpreter { public: @@ -2011,7 +1995,6 @@ const TagAttrib canonAttribs[] = { {1, AC_WRITE, 0, nullptr, 0x4005, AUTO, "UnknownBlock2", &stdInterpreter}, {1, AC_WRITE, 0, nullptr, 0x4008, AUTO, "BlackLevel", &stdInterpreter}, {1, AC_WRITE, 0, canonMicroAdjustAttrib, 0x4013, AUTO, "AFMicroAdj", &stdInterpreter}, - {1, AC_WRITE, 0, nullptr, 0xc640, AUTO, "RawImageSegmentation", &rawImageSegmentationInterpreter}, { -1, AC_DONTWRITE, 0, nullptr, 0, AUTO, "", nullptr} }; } diff --git a/rtexif/rtexif.cc b/rtexif/rtexif.cc index c6ffabec9..3494d12e8 100644 --- a/rtexif/rtexif.cc +++ b/rtexif/rtexif.cc @@ -2318,9 +2318,6 @@ void ExifManager::parseCIFF (int length, TagDirectory* root) root->addTag (t); } - if (root->getTag("RawImageSegmentation")) { // Canon CR2 files - frames.push_back(root); - } roots.push_back(root); } @@ -2932,25 +2929,42 @@ void ExifManager::parse (bool isRaw, bool skipIgnored) // --- detecting image root IFD based on SubFileType, or if not provided, on PhotometricInterpretation bool frameRootDetected = false; - std::vector sftTagList = root->findTags(TIFFTAG_SUBFILETYPE); - if (!sftTagList.empty()) { - for (auto sft : sftTagList) { - int sftVal = sft->toInt(); - if (sftVal == (isRaw ? 0 : 2)) { - frames.push_back(sft->getParent()); + if(!frameRootDetected) { + std::vector risTagList = root->findTags("RawImageSegmentation"); + if (!risTagList.empty()) { + for (auto ris : risTagList) { + frames.push_back(ris->getParent()); frameRootDetected = true; -#if PRINT_METADATA_TREE - printf("\n--------------- FRAME (SUBFILETYPE) ---------------\n\n"); - sft->getParent()->printAll (); -#endif + #if PRINT_METADATA_TREE + printf("\n--------------- FRAME (RAWIMAGESEGMENTATION) ---------------\n\n"); + ris->getParent()->printAll (); + #endif } } } if(!frameRootDetected) { - sftTagList = root->findTags(TIFFTAG_OSUBFILETYPE); + std::vector sftTagList = root->findTags(TIFFTAG_SUBFILETYPE); + if (!sftTagList.empty()) { + for (auto sft : sftTagList) { + int sftVal = sft->toInt(); + if (sftVal == (isRaw ? 0 : 2)) { + frames.push_back(sft->getParent()); + frameRootDetected = true; + +#if PRINT_METADATA_TREE + printf("\n--------------- FRAME (SUBFILETYPE) ---------------\n\n"); + sft->getParent()->printAll (); +#endif + } + } + } + } + + if(!frameRootDetected) { + std::vector sftTagList = root->findTags(TIFFTAG_OSUBFILETYPE); if (!sftTagList.empty()) { for (auto sft : sftTagList) { int sftVal = sft->toInt(); diff --git a/rtexif/stdattribs.cc b/rtexif/stdattribs.cc index f59fa9b36..bacd6ffef 100644 --- a/rtexif/stdattribs.cc +++ b/rtexif/stdattribs.cc @@ -534,6 +534,22 @@ public: }; UTF8BinInterpreter utf8BinInterpreter; +class RawImageSegmentationInterpreter : public Interpreter +{ +public: + virtual std::string toString (Tag* t) + { + int segmentNumber = t->toInt(0, SHORT); + int segmentWidth = t->toInt(2, SHORT); + int lastSegmentWidth = t->toInt(4, SHORT); + + char buffer[32]; + sprintf (buffer, "%d %d %d", segmentNumber, segmentWidth, lastSegmentWidth); + return buffer; + } +}; +RawImageSegmentationInterpreter rawImageSegmentationInterpreter; + const TagAttrib exifAttribs[] = { {0, AC_SYSTEM, 0, nullptr, 0x0100, AUTO, "ImageWidth", &stdInterpreter}, {0, AC_SYSTEM, 0, nullptr, 0x0101, AUTO, "ImageHeight", &stdInterpreter}, @@ -644,9 +660,9 @@ const TagAttrib exifAttribs[] = { {0, AC_WRITE, 0, nullptr, 0xC68B, AUTO, "OriginalRawFileName", &stdInterpreter}, {0, AC_WRITE, 0, nullptr, 0xC68D, AUTO, "ActiveArea", &stdInterpreter}, {0, AC_WRITE, 0, nullptr, 0xC68E, AUTO, "MaskedAreas", &stdInterpreter}, -// {0, AC_WRITE, 0, 0, 0xC68F, AUTO, "AsShotICCProfile", & ???}, +// {0, AC_WRITE, 0, nullptr, 0xC68F, AUTO, "AsShotICCProfile", & ???}, {0, AC_WRITE, 0, nullptr, 0xC690, AUTO, "AsShotPreProfileMatrix", &stdInterpreter}, -// {0, AC_WRITE, 0, 0, 0xC691, AUTO, "CurrentICCProfile", & ???}, +// {0, AC_WRITE, 0, nullptr, 0xC691, AUTO, "CurrentICCProfile", & ???}, {0, AC_WRITE, 0, nullptr, 0xC692, AUTO, "CurrentPreProfileMatrix", &stdInterpreter}, {0, AC_WRITE, 0, nullptr, 0xC6BF, AUTO, "ColorimetricReference", &stdInterpreter}, {0, AC_WRITE, 0, nullptr, 0xC6F3, AUTO, "CameraCalibrationSig", &stdInterpreter}, @@ -671,13 +687,13 @@ const TagAttrib exifAttribs[] = { {0, AC_WRITE, 0, nullptr, 0xC71B, AUTO, "PreviewDateTime", &stdInterpreter}, {0, AC_WRITE, 0, nullptr, 0xC71C, AUTO, "RawImageDigest", &stdInterpreter}, {0, AC_WRITE, 0, nullptr, 0xC71D, AUTO, "OriginalRawFileDigest", &stdInterpreter}, -// {0, AC_WRITE, 0, 0, 0xC71E, AUTO, "SubTileBlockSize", & ???}, -// {0, AC_WRITE, 0, 0, 0xC71F, AUTO, "RowInterleaveFactor", & ???}, +// {0, AC_WRITE, 0, nullptr, 0xC71E, AUTO, "SubTileBlockSize", & ???}, +// {0, AC_WRITE, 0, nullptr, 0xC71F, AUTO, "RowInterleaveFactor", & ???}, {0, AC_WRITE, 0, nullptr, 0xC725, AUTO, "ProfileLookTableDims", &stdInterpreter}, {0, AC_WRITE, 0, nullptr, 0xC726, AUTO, "ProfileLookTableData", &stdInterpreter}, -// {0, AC_WRITE, 0, 0, 0xC740, AUTO, "OpcodeList1", & ???}, -// {0, AC_WRITE, 0, 0, 0xC741, AUTO, "OpcodeList2", & ???}, -// {0, AC_WRITE, 0, 0, 0xC74E, AUTO, "OpcodeList3", & ???}, +// {0, AC_WRITE, 0, nullptr, 0xC740, AUTO, "OpcodeList1", & ???}, +// {0, AC_WRITE, 0, nullptr, 0xC741, AUTO, "OpcodeList2", & ???}, +// {0, AC_WRITE, 0, nullptr, 0xC74E, AUTO, "OpcodeList3", & ???}, {0, AC_WRITE, 0, nullptr, 0xC761, AUTO, "NoiseProfile", &stdInterpreter}, {0, AC_WRITE, 0, nullptr, 0xC763, AUTO, "TimeCodes", &stdInterpreter}, {0, AC_WRITE, 0, nullptr, 0xC764, AUTO, "FrameRate", &stdInterpreter}, @@ -754,6 +770,7 @@ const TagAttrib iopAttribs[] = { const TagAttrib ifdAttribs[] = { {0, AC_SYSTEM, 0, nullptr, 0x0017, AUTO, "PanaISO", &stdInterpreter}, + {0, AC_SYSTEM, 0, nullptr, 0x00fe, AUTO, "NewSubFileType", &stdInterpreter}, {0, AC_SYSTEM, 0, nullptr, 0x0100, AUTO, "ImageWidth", &stdInterpreter}, {0, AC_SYSTEM, 0, nullptr, 0x0101, AUTO, "ImageHeight", &stdInterpreter}, {0, AC_SYSTEM, 0, nullptr, 0x0102, AUTO, "BitsPerSample", &stdInterpreter}, @@ -809,9 +826,9 @@ const TagAttrib ifdAttribs[] = { {0, AC_WRITE, 0, nullptr, 0xc62f, AUTO, "CameraSerialNumber", &stdInterpreter}, {0, AC_SYSTEM, 0, nullptr, 0xc630, AUTO, "DNGLensInfo", &stdInterpreter}, {0, AC_DONTWRITE, 0, nullptr, 0xC634, AUTO, "MakerNote", &stdInterpreter}, //DNGPrivateData + {0, AC_DONTWRITE, 0, nullptr, 0xC640, AUTO, "RawImageSegmentation", &rawImageSegmentationInterpreter}, {0, AC_WRITE, 0, nullptr, 0xc65d, AUTO, "RawDataUniqueID", &stdInterpreter}, {0, AC_DONTWRITE, 0, nullptr, 0xc761, AUTO, "NoiseProfile", &stdInterpreter}, - {0, AC_SYSTEM, 0, nullptr, 0x00fe, AUTO, "NewSubFileType", &stdInterpreter}, { -1, AC_DONTWRITE, 0, nullptr, 0, AUTO, "", nullptr} }; } diff --git a/rtgui/editorpanel.cc b/rtgui/editorpanel.cc index 1604384a5..d858ab9d7 100644 --- a/rtgui/editorpanel.cc +++ b/rtgui/editorpanel.cc @@ -1356,6 +1356,8 @@ void EditorPanel::info_toggled () } } else if (isPixelShift) { infoString = Glib::ustring::compose ("%1\n" + M("QINFO_PIXELSHIFT"), infoString, numFrames); + } else if (numFrames > 1) { + infoString = Glib::ustring::compose ("%1\n" + M("QINFO_FRAMECOUNT"), infoString, numFrames); } } else { infoString = M ("QINFO_NOEXIF");