[SCM] exiv2 packaging branch, master, updated. debian/0.25-3.1-3734-gdcbc29a

Maximiliano Curia maxy at moszumanska.debian.org
Thu Jul 13 17:37:40 UTC 2017


Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/exiv2.git;a=commitdiff;h=cb828a7

The following commit has been merged in the master branch:
commit cb828a7f5794fda192133a4fb83a580dd0288113
Author: Andreas Huggel <ahuggel at gmx.net>
Date:   Thu May 25 10:00:35 2006 +0000

    Added more specific decode function to map subIFD tags with data for the primary image to the Image group, removed generic mappers for now.
---
 src/tags.cpp        | 14 +++++++++++++-
 src/tiffvisitor.cpp | 36 +++++++++++++++++++++++++++++-------
 src/tiffvisitor.hpp | 36 +++++++-----------------------------
 3 files changed, 49 insertions(+), 37 deletions(-)

diff --git a/src/tags.cpp b/src/tags.cpp
index c0f5715..41fb35f 100644
--- a/src/tags.cpp
+++ b/src/tags.cpp
@@ -128,9 +128,21 @@ namespace Exiv2 {
     {
     }
 
+    //! NewSubfileType, TIFF tag 0x00fe - this is actually a bitmask
+    extern const TagDetails exifNewSubfileType[] = {
+        {  0, "Primary image"                                               },
+        {  1, "Thumbnail/Preview image"                                     },
+        {  2, "Primary image, Multi page file"                              },
+        {  3, "Thumbnail/Preview image, Multi page file"                    },
+        {  4, "Primary image, Transparency mask"                            },
+        {  5, "Thumbnail/Preview image, Transparency mask"                  },
+        {  6, "Primary image, Multi page file, Transparency mask"           },
+        {  7, "Thumbnail/Preview image, Multi page file, Transparency mask" }
+    };
+
     // Base IFD Tags (IFD0 and IFD1)
     static const TagInfo ifdTagInfo[] = {
-        TagInfo(0x00fe, "NewSubfileType", "New Subfile Type", "A general indication of the kind of data contained in this subfile.", ifd0Id, imgStruct, unsignedLong, printValue), // TIFF tag
+        TagInfo(0x00fe, "NewSubfileType", "New Subfile Type", "A general indication of the kind of data contained in this subfile.", ifd0Id, imgStruct, unsignedLong, EXV_PRINT_TAG(exifNewSubfileType)), // TIFF tag
         TagInfo(0x0100, "ImageWidth", "Image Width", "Image width", ifd0Id, imgStruct, unsignedLong, printValue),
         TagInfo(0x0101, "ImageLength", "Image Length", "Image height", ifd0Id, imgStruct, unsignedLong, printValue),
         TagInfo(0x0102, "BitsPerSample", "Bits per Sample", "Number of bits per component", ifd0Id, imgStruct, unsignedShort, printValue),
diff --git a/src/tiffvisitor.cpp b/src/tiffvisitor.cpp
index 7a4d777..54f9931 100644
--- a/src/tiffvisitor.cpp
+++ b/src/tiffvisitor.cpp
@@ -56,12 +56,10 @@ namespace Exiv2 {
     // TIFF Decoder table for special decoding requirements
     const TiffDecoderInfo TiffMetadataDecoder::tiffDecoderInfo_[] = {
         { "*",       Tag::all, Group::ignr,    0 }, // Do not decode tags with group == Group::ignr
-        { "OLYMPUS",   0x0100, Group::olympmn, &TiffMetadataDecoder::decodeOlympThumb           },
-        { "NIKON",     0x014a, Group::ifd0,    0 }, // Todo: Controversial, causes problems with Exiftool
-        { "NIKON",   Tag::all, Group::sub0_0,  &TiffMetadataDecoder::decodeToGroup<Group::ifd0> },
-        { "NIKON",   Tag::all, Group::sub0_1,  &TiffMetadataDecoder::decodeToGroup<Group::ifd0> },
-        { "SONY",      0x014a, Group::ifd0,    0 }, // Todo: see above
-        { "SONY",    Tag::all, Group::sub0_0,  &TiffMetadataDecoder::decodeToGroup<Group::ifd0> }
+        { "OLYMPUS",   0x0100, Group::olympmn, &TiffMetadataDecoder::decodeOlympThumb },
+        { "*",         0x014a, Group::ifd0,    0 }, // Todo: Controversial, causes problems with Exiftool
+        { "*",       Tag::all, Group::sub0_0,  &TiffMetadataDecoder::decodeSubIfd     },
+        { "*",       Tag::all, Group::sub0_1,  &TiffMetadataDecoder::decodeSubIfd     }
     };
 
     bool TiffDecoderInfo::operator==(const TiffDecoderInfo::Key& key) const
@@ -196,12 +194,36 @@ namespace Exiv2 {
         }
     }
 
+    void TiffMetadataDecoder::decodeSubIfd(const TiffEntryBase* object)
+    {
+        assert(object);
+
+        // Only applicable if ifd0 NewSubfileType is Thumbnail/Preview image
+        GroupType::const_iterator i = groupType_.find(Group::ifd0);
+        if (i == groupType_.end() || i->second & 1 == 0) return;
+
+        // Only applicable if subIFD NewSubfileType is Primary image
+        i = groupType_.find(object->group());
+        if (i == groupType_.end() || i->second & 1 == 1) return;
+
+        // Todo: ExifKey should have an appropriate c'tor, it should not be 
+        //       necessary to use groupName here
+        ExifKey key(object->tag(), tiffGroupName(Group::ifd0));        
+        setExifTag(key, object->pValue());
+
+    }
+
     void TiffMetadataDecoder::decodeTiffEntry(const TiffEntryBase* object)
     {
         assert(object != 0);
+
+        // Remember NewSubfileType
+        if (object->tag() == 0x00fe && object->pValue()) {
+            groupType_[object->group()] = object->pValue()->toLong();
+        }
+
         const TiffDecoderInfo* td = find(tiffDecoderInfo_, 
             TiffDecoderInfo::Key(make_, object->tag(), object->group()));
-
         if (td) {
             // skip decoding if td->decoderFct_ == 0
             if (td->decoderFct_) {
diff --git a/src/tiffvisitor.hpp b/src/tiffvisitor.hpp
index d984630..13e3ba3 100644
--- a/src/tiffvisitor.hpp
+++ b/src/tiffvisitor.hpp
@@ -40,6 +40,7 @@
 #include <iostream>
 #include <iomanip>
 #include <cassert>
+#include <map>
 
 // *****************************************************************************
 // namespace extensions
@@ -279,12 +280,8 @@ namespace Exiv2 {
         void decodeTiffEntry(const TiffEntryBase* object);
         //! Decode Olympus Thumbnail from the TIFF makernote into IFD1
         void decodeOlympThumb(const TiffEntryBase* object);
-        //! Decode object to the Exif entry tag, group given as template parameters
-        template<uint16_t tag, uint16_t group>
-        void decodeToTag(const TiffEntryBase* object);
-        //! Decode object to the Exif entry with group according to the template parameter
-        template<uint16_t group>
-        void decodeToGroup(const TiffEntryBase* object);
+        //! Decode SubIFD contents to Image group if it contains primary image data
+        void decodeSubIfd(const TiffEntryBase* object);
         //@}
 
     private:
@@ -297,6 +294,10 @@ namespace Exiv2 {
         const uint32_t threshold_;   //!< Threshold, see constructor documentation.
         std::string make_;           //!< Camera make, determined from the tags to decode
 
+        //! Type used to remember tag 0x00fe (NewSubfileType) for each group
+        typedef std::map<uint16_t, uint32_t> GroupType;
+        GroupType groupType_;        //!< NewSubfileType for each group
+
         static const TiffDecoderInfo tiffDecoderInfo_[]; //<! TIFF decoder table
 
     }; // class TiffMetadataDecoder
@@ -502,29 +503,6 @@ namespace Exiv2 {
         static const std::string indent_;       //!< Indent for one level
     }; // class TiffPrinter
 
-// *****************************************************************************
-// template, inline and free functions
-
-    template<uint16_t tag, uint16_t group>
-    void TiffMetadataDecoder::decodeToTag(const TiffEntryBase* object)
-    {
-        assert(object);
-        // Todo: ExifKey should have an appropriate c'tor, it should not be 
-        //       necessary to use groupName here
-        ExifKey key(tag, tiffGroupName(group));        
-        setExifTag(key, object->pValue());
-    }
-
-    template<uint16_t group>
-    void TiffMetadataDecoder::decodeToGroup(const TiffEntryBase* object)
-    {
-        assert(object);
-        // Todo: ExifKey should have an appropriate c'tor, it should not be 
-        //       necessary to use groupName here
-        ExifKey key(object->tag(), tiffGroupName(group));        
-        setExifTag(key, object->pValue());
-    }
-
 }                                       // namespace Exiv2
 
 #endif                                  // #ifndef TIFFVISITOR_HPP_

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list