From 13704dcba4f8094cdfb7d2c83e92d8a0156392da Mon Sep 17 00:00:00 2001 From: Andreas Huggel Date: Thu, 4 Mar 2010 14:46:01 +0000 Subject: [PATCH] #684: Extended SubIFD support to 9 SubIFDs. --- src/exif.cpp | 5 ++++ src/tags.cpp | 10 +++++++ src/tiffcomposite.cpp | 5 ++++ src/tiffcomposite_int.hpp | 6 ++++ src/tiffimage.cpp | 60 +++++++++++++++++++++++++++++++++++++++ src/tiffvisitor.cpp | 5 ++-- src/types.hpp | 5 ++++ 7 files changed, 93 insertions(+), 3 deletions(-) diff --git a/src/exif.cpp b/src/exif.cpp index 7bd237a7..03c10df5 100644 --- a/src/exif.cpp +++ b/src/exif.cpp @@ -688,6 +688,11 @@ namespace Exiv2 { subImage2Id, subImage3Id, subImage4Id, + subImage5Id, + subImage6Id, + subImage7Id, + subImage8Id, + subImage9Id, panaRawIfdId, ifd2Id, ifd3Id diff --git a/src/tags.cpp b/src/tags.cpp index 1dcaa6f8..88c74f79 100644 --- a/src/tags.cpp +++ b/src/tags.cpp @@ -105,6 +105,11 @@ namespace Exiv2 { { subImage2Id, "SubImage2", "SubImage2", ExifTags::ifdTagList }, { subImage3Id, "SubImage3", "SubImage3", ExifTags::ifdTagList }, { subImage4Id, "SubImage4", "SubImage4", ExifTags::ifdTagList }, + { subImage5Id, "SubImage5", "SubImage5", ExifTags::ifdTagList }, + { subImage6Id, "SubImage6", "SubImage6", ExifTags::ifdTagList }, + { subImage7Id, "SubImage7", "SubImage7", ExifTags::ifdTagList }, + { subImage8Id, "SubImage8", "SubImage8", ExifTags::ifdTagList }, + { subImage9Id, "SubImage9", "SubImage9", ExifTags::ifdTagList }, { mnIfdId, "Makernote", "MakerNote", ExifTags::mnTagList }, { canonIfdId, "Makernote", "Canon", CanonMakerNote::tagList }, { canonCsIfdId, "Makernote", "CanonCs", CanonMakerNote::tagListCs }, @@ -1768,6 +1773,11 @@ namespace Exiv2 { case subImage2Id: case subImage3Id: case subImage4Id: + case subImage5Id: + case subImage6Id: + case subImage7Id: + case subImage8Id: + case subImage9Id: case panaRawIfdId: rc = true; break; default: rc = false; break; } diff --git a/src/tiffcomposite.cpp b/src/tiffcomposite.cpp index 8ea92f54..074240c0 100644 --- a/src/tiffcomposite.cpp +++ b/src/tiffcomposite.cpp @@ -87,6 +87,11 @@ namespace Exiv2 { { 9, "SubImage2" }, { 10, "SubImage3" }, { 11, "SubImage4" }, + { 12, "SubImage5" }, + { 13, "SubImage6" }, + { 14, "SubImage7" }, + { 15, "SubImage8" }, + { 16, "SubImage9" }, { 64, "PanasonicRaw" }, { 256, "MakerNote" }, // 257 not needed (olympmn) diff --git a/src/tiffcomposite_int.hpp b/src/tiffcomposite_int.hpp index 918ed896..5cfc7f8a 100644 --- a/src/tiffcomposite_int.hpp +++ b/src/tiffcomposite_int.hpp @@ -97,6 +97,12 @@ namespace Exiv2 { const uint16_t subimg2 = 9; //!< 2nd TIFF SubIFD in IFD0 const uint16_t subimg3 = 10; //!< 3rd TIFF SubIFD in IFD0 const uint16_t subimg4 = 11; //!< 4th TIFF SubIFD in IFD0 + const uint16_t subimg5 = 12; //!< 5th TIFF SubIFD in IFD0 + const uint16_t subimg6 = 13; //!< 6th TIFF SubIFD in IFD0 + const uint16_t subimg7 = 14; //!< 7th TIFF SubIFD in IFD0 + const uint16_t subimg8 = 15; //!< 8th TIFF SubIFD in IFD0 + const uint16_t subimg9 = 16; //!< 9th TIFF SubIFD in IFD0 + const uint16_t subimgX = 17; //!< End of SubIFD list marker, not a valid group const uint16_t panaraw = 64; //!< IFD0 of Panasonic RAW images const uint16_t mn = 256; //!< Makernote const uint16_t ignr = 511; //!< Read but do not decode diff --git a/src/tiffimage.cpp b/src/tiffimage.cpp index 38dd692e..3ce8ef96 100644 --- a/src/tiffimage.cpp +++ b/src/tiffimage.cpp @@ -97,6 +97,11 @@ namespace Exiv2 { "Exif.SubImage2.NewSubfileType", "Exif.SubImage3.NewSubfileType", "Exif.SubImage4.NewSubfileType" + "Exif.SubImage5.NewSubfileType" + "Exif.SubImage6.NewSubfileType" + "Exif.SubImage7.NewSubfileType" + "Exif.SubImage8.NewSubfileType" + "Exif.SubImage9.NewSubfileType" }; // Find the group of the primary image, default to "Image" std::string groupName = "Image"; @@ -807,6 +812,11 @@ namespace Exiv2 { { Tag::root, Group::subimg2, Group::ifd0, 0x014a }, { Tag::root, Group::subimg3, Group::ifd0, 0x014a }, { Tag::root, Group::subimg4, Group::ifd0, 0x014a }, + { Tag::root, Group::subimg5, Group::ifd0, 0x014a }, + { Tag::root, Group::subimg6, Group::ifd0, 0x014a }, + { Tag::root, Group::subimg7, Group::ifd0, 0x014a }, + { Tag::root, Group::subimg8, Group::ifd0, 0x014a }, + { Tag::root, Group::subimg9, Group::ifd0, 0x014a }, { Tag::root, Group::exif, Group::ifd0, 0x8769 }, { Tag::root, Group::gps, Group::ifd0, 0x8825 }, { Tag::root, Group::iop, Group::exif, 0xa005 }, @@ -951,6 +961,56 @@ namespace Exiv2 { { Tag::next, Group::subimg4, newTiffDirectory }, { Tag::all, Group::subimg4, newTiffEntry }, + // Subdir subimg5 + { 0x0111, Group::subimg5, newTiffImageData<0x0117, Group::subimg5> }, + { 0x0117, Group::subimg5, newTiffImageSize<0x0111, Group::subimg5> }, + { 0x0144, Group::subimg5, newTiffImageData<0x0145, Group::subimg5> }, + { 0x0145, Group::subimg5, newTiffImageSize<0x0144, Group::subimg5> }, + { 0x0201, Group::subimg5, newTiffImageData<0x0202, Group::subimg5> }, + { 0x0202, Group::subimg5, newTiffImageSize<0x0201, Group::subimg5> }, + { Tag::next, Group::subimg5, newTiffDirectory }, + { Tag::all, Group::subimg5, newTiffEntry }, + + // Subdir subimg6 + { 0x0111, Group::subimg6, newTiffImageData<0x0117, Group::subimg6> }, + { 0x0117, Group::subimg6, newTiffImageSize<0x0111, Group::subimg6> }, + { 0x0144, Group::subimg6, newTiffImageData<0x0145, Group::subimg6> }, + { 0x0145, Group::subimg6, newTiffImageSize<0x0144, Group::subimg6> }, + { 0x0201, Group::subimg6, newTiffImageData<0x0202, Group::subimg6> }, + { 0x0202, Group::subimg6, newTiffImageSize<0x0201, Group::subimg6> }, + { Tag::next, Group::subimg6, newTiffDirectory }, + { Tag::all, Group::subimg6, newTiffEntry }, + + // Subdir subimg7 + { 0x0111, Group::subimg7, newTiffImageData<0x0117, Group::subimg7> }, + { 0x0117, Group::subimg7, newTiffImageSize<0x0111, Group::subimg7> }, + { 0x0144, Group::subimg7, newTiffImageData<0x0145, Group::subimg7> }, + { 0x0145, Group::subimg7, newTiffImageSize<0x0144, Group::subimg7> }, + { 0x0201, Group::subimg7, newTiffImageData<0x0202, Group::subimg7> }, + { 0x0202, Group::subimg7, newTiffImageSize<0x0201, Group::subimg7> }, + { Tag::next, Group::subimg7, newTiffDirectory }, + { Tag::all, Group::subimg7, newTiffEntry }, + + // Subdir subimg8 + { 0x0111, Group::subimg8, newTiffImageData<0x0117, Group::subimg8> }, + { 0x0117, Group::subimg8, newTiffImageSize<0x0111, Group::subimg8> }, + { 0x0144, Group::subimg8, newTiffImageData<0x0145, Group::subimg8> }, + { 0x0145, Group::subimg8, newTiffImageSize<0x0144, Group::subimg8> }, + { 0x0201, Group::subimg8, newTiffImageData<0x0202, Group::subimg8> }, + { 0x0202, Group::subimg8, newTiffImageSize<0x0201, Group::subimg8> }, + { Tag::next, Group::subimg8, newTiffDirectory }, + { Tag::all, Group::subimg8, newTiffEntry }, + + // Subdir subimg9 + { 0x0111, Group::subimg9, newTiffImageData<0x0117, Group::subimg9> }, + { 0x0117, Group::subimg9, newTiffImageSize<0x0111, Group::subimg9> }, + { 0x0144, Group::subimg9, newTiffImageData<0x0145, Group::subimg9> }, + { 0x0145, Group::subimg9, newTiffImageSize<0x0144, Group::subimg9> }, + { 0x0201, Group::subimg9, newTiffImageData<0x0202, Group::subimg9> }, + { 0x0202, Group::subimg9, newTiffImageSize<0x0201, Group::subimg9> }, + { Tag::next, Group::subimg9, newTiffDirectory }, + { Tag::all, Group::subimg9, newTiffEntry }, + // Exif subdir { 0xa005, Group::exif, newTiffSubIfd }, { 0x927c, Group::exif, newTiffMnEntry }, diff --git a/src/tiffvisitor.cpp b/src/tiffvisitor.cpp index cb589636..25f4fe78 100644 --- a/src/tiffvisitor.cpp +++ b/src/tiffvisitor.cpp @@ -1250,14 +1250,13 @@ namespace Exiv2 { #endif return; } - // Todo: Don't use a hardcoded constant here - if (i == 4) { + if (object->newGroup_ + i == Group::subimgX) { #ifndef SUPPRESS_WARNINGS std::cerr << "Warning: " << "Directory " << tiffGroupName(object->group()) << ", entry 0x" << std::setw(4) << std::setfill('0') << std::hex << object->tag() - << ": Skipping sub-IFDs beyond the first four.\n"; + << ": Skipping sub-IFDs beyond the first " << i << ".\n"; #endif break; } diff --git a/src/types.hpp b/src/types.hpp index 6a7a6d89..da1eefc0 100644 --- a/src/types.hpp +++ b/src/types.hpp @@ -158,6 +158,11 @@ namespace Exiv2 { subImage2Id, subImage3Id, subImage4Id, + subImage5Id, + subImage6Id, + subImage7Id, + subImage8Id, + subImage9Id, mnIfdId, canonIfdId, canonCsIfdId,