From d5428722284931689122c8b16e77ad8374897a86 Mon Sep 17 00:00:00 2001 From: Andreas Huggel Date: Mon, 26 Dec 2011 17:12:55 +0000 Subject: [PATCH] Added SamsungPictureWizard group with a decoding table for the Mode tag from Pascal de Bruijn. --- doc/templates/Makefile | 1 + doc/templates/tags-samsung.html.in | 9 ++++- src/samsungmn.cpp | 54 +++++++++++++++++++++++------- src/samsungmn_int.hpp | 4 +++ src/tags.cpp | 1 + src/tags_int.hpp | 1 + src/tiffimage.cpp | 25 ++++++++++++++ 7 files changed, 81 insertions(+), 14 deletions(-) diff --git a/doc/templates/Makefile b/doc/templates/Makefile index a0018ab3..4808cb0d 100644 --- a/doc/templates/Makefile +++ b/doc/templates/Makefile @@ -100,6 +100,7 @@ TABLES = Exif \ PanasonicRaw \ Pentax \ Samsung2 \ + SamsungPictureWizard \ Sigma \ Sony1 \ SonyMinolta \ diff --git a/doc/templates/tags-samsung.html.in b/doc/templates/tags-samsung.html.in index 183171dd..11a86f1d 100644 --- a/doc/templates/tags-samsung.html.in +++ b/doc/templates/tags-samsung.html.in @@ -8,10 +8,17 @@ __index1__ __index2__

Samsung MakerNote Tags defined in Exiv2

-

Tags found in the MakerNote of images taken with Samsung cameras..

+

Tags found in the MakerNote of images taken with Samsung cameras.

Click on a column header to sort the table.

__Samsung2__ +
+ +

Samsung Picture Wizard Tags

+

Click on a column header to sort the table.

+__SamsungPictureWizard__ +
+ diff --git a/src/samsungmn.cpp b/src/samsungmn.cpp index 50dc090a..49264642 100644 --- a/src/samsungmn.cpp +++ b/src/samsungmn.cpp @@ -72,18 +72,6 @@ namespace Exiv2 { { 1, N_("On") } }; - std::ostream& printPictureWizard(std::ostream& os, const Value& value, const ExifData*) - { - if (value.count() != 5 || value.typeId() != unsignedShort) { - return os << value; - } - return os << "Mode: " << value.toLong(0) - << ", Col: " << value.toLong(1) - << ", Sat: " << value.toLong(2) - 4 - << ", Sha: " << value.toLong(3) - 4 - << ", Con: " << value.toLong(4) - 4; - } - std::ostream& printCameraTemperature(std::ostream& os, const Value& value, const ExifData*) { if (value.count() != 1 || value.typeId() != signedRational) { @@ -113,7 +101,7 @@ namespace Exiv2 { // Samsung MakerNote Tag Info const TagInfo Samsung2MakerNote::tagInfo_[] = { TagInfo(0x0001, "Version", N_("Version"), N_("Makernote version"), samsung2Id, makerTags, undefined, -1, printExifVersion), - TagInfo(0x0021, "PictureWizard", N_("Picture Wizard"), N_("Picture wizard"), samsung2Id, makerTags, unsignedShort, -1, printPictureWizard), + TagInfo(0x0021, "PictureWizard", N_("Picture Wizard"), N_("Picture wizard composite tag"), samsung2Id, makerTags, unsignedShort, -1, printValue), TagInfo(0x0030, "LocalLocationName", N_("Local Location Name"), N_("Local location name"), samsung2Id, makerTags, asciiString, -1, printValue), TagInfo(0x0031, "LocationName", N_("Location Name"), N_("Location name"), samsung2Id, makerTags, asciiString, -1, printValue), TagInfo(0x0035, "Preview", N_("Pointer to a preview image"), N_("Offset to an IFD containing a preview image"), samsung2Id, makerTags, unsignedLong, -1, printValue), @@ -151,4 +139,44 @@ namespace Exiv2 { return tagInfo_; } + //! PictureWizard Mode + extern const TagDetails samsungPwMode[] = { + { 0, N_("Standard") }, + { 1, N_("Vivid") }, + { 2, N_("Portrait") }, + { 3, N_("Landscape") }, + { 4, N_("Forest") }, + { 5, N_("Retro") }, + { 6, N_("Cool") }, + { 7, N_("Calm") }, + { 8, N_("Classic") }, + { 9, N_("Custom1") }, + { 10, N_("Custom2") }, + { 11, N_("Custom3") } + }; + + std::ostream& printValueMinus4(std::ostream& os, const Value& value, const ExifData*) + { + if (value.count() != 1 || value.typeId() != unsignedShort) { + return os << value; + } + return os << value.toLong(0) - 4; + } + + // Samsung PictureWizard Tag Info + const TagInfo Samsung2MakerNote::tagInfoPw_[] = { + TagInfo(0x0000, "Mode", N_("Mode"), N_("Mode"), samsungPwId, makerTags, unsignedShort, 1, EXV_PRINT_TAG(samsungPwMode)), + TagInfo(0x0001, "Color", N_("Color"), N_("Color"), samsungPwId, makerTags, unsignedShort, 1, printValue), + TagInfo(0x0002, "Saturation", N_("Saturation"), N_("Saturation"), samsungPwId, makerTags, unsignedShort, 1, printValueMinus4), + TagInfo(0x0003, "Sharpness", N_("Sharpness"), N_("Sharpness"), samsungPwId, makerTags, unsignedShort, 1, printValueMinus4), + TagInfo(0x0004, "Contrast", N_("Contrast"), N_("Contrast"), samsungPwId, makerTags, unsignedShort, 1, printValueMinus4), + // End of list marker + TagInfo(0xffff, "(UnknownSamsungPictureWizardTag)", "(UnknownSamsungPictureWizardTag)", N_("Unknown SamsungPictureWizard tag"), samsungPwId, makerTags, unsignedShort, 1, printValue) + }; + + const TagInfo* Samsung2MakerNote::tagListPw() + { + return tagInfoPw_; + } + }} // namespace Internal, Exiv2 diff --git a/src/samsungmn_int.hpp b/src/samsungmn_int.hpp index 9f3ab3fe..66c8b897 100644 --- a/src/samsungmn_int.hpp +++ b/src/samsungmn_int.hpp @@ -53,10 +53,14 @@ namespace Exiv2 { public: //! Return read-only list of built-in Samsung tags static const TagInfo* tagList(); + //! Return read-only list of built-in PictureWizard tags + static const TagInfo* tagListPw(); private: //! Tag information static const TagInfo tagInfo_[]; + //! PictureWizard tag information + static const TagInfo tagInfoPw_[]; }; // class Samsung2MakerNote diff --git a/src/tags.cpp b/src/tags.cpp index af3bf9d5..4f337539 100644 --- a/src/tags.cpp +++ b/src/tags.cpp @@ -163,6 +163,7 @@ namespace Exiv2 { { pentaxId, "Makernote", "Pentax", PentaxMakerNote::tagList }, { samsung2Id, "Makernote", "Samsung2", Samsung2MakerNote::tagList }, { samsungPvId, "Makernote", "SamsungPreview", ifdTagList }, + { samsungPwId, "Makernote", "SamsungPictureWizard", Samsung2MakerNote::tagListPw }, { sigmaId, "Makernote", "Sigma", SigmaMakerNote::tagList }, { sony1Id, "Makernote", "Sony1", SonyMakerNote::tagList }, { sony2Id, "Makernote", "Sony2", SonyMakerNote::tagList }, diff --git a/src/tags_int.hpp b/src/tags_int.hpp index a3ffc2ec..e120eb53 100644 --- a/src/tags_int.hpp +++ b/src/tags_int.hpp @@ -141,6 +141,7 @@ namespace Exiv2 { pentaxId, samsung2Id, samsungPvId, + samsungPwId, sigmaId, sony1Id, sony2Id, diff --git a/src/tiffimage.cpp b/src/tiffimage.cpp index d588a1f8..354bfb9b 100644 --- a/src/tiffimage.cpp +++ b/src/tiffimage.cpp @@ -1117,6 +1117,26 @@ namespace Exiv2 { { 190, ttSignedShort, 1 } // Exif.Sony1MltCsA100.ColorCompensationFilter2 }; + //! Samsung PictureWizard binary array - configuration + extern const ArrayCfg samsungPwCfg = { + samsungPwId, // Group for the elements + invalidByteOrder, // Use byte order from parent + ttUnsignedShort, // Type for array entry + notEncrypted, // Not encrypted + false, // No size element + true, // Write all tags + true, // Concatenate gaps + { 0, ttUnsignedShort, 1 } + }; + //! Samsung PictureWizard binary array - definition + extern const ArrayDef samsungPwDef[] = { + { 0, ttUnsignedShort, 1 }, // Mode + { 2, ttUnsignedShort, 1 }, // Color + { 4, ttUnsignedShort, 1 }, // Saturation + { 6, ttUnsignedShort, 1 }, // Sharpness + { 8, ttUnsignedShort, 1 } // Contrast + }; + /* This table lists for each group in a tree, its parent group and tag. Root identifies the root of a TIFF tree, as there is a need for multiple @@ -1208,6 +1228,7 @@ namespace Exiv2 { { Tag::root, panasonicId, exifId, 0x927c }, { Tag::root, pentaxId, exifId, 0x927c }, { Tag::root, samsung2Id, exifId, 0x927c }, + { Tag::root, samsungPwId, samsung2Id, 0x0021 }, { Tag::root, samsungPvId, samsung2Id, 0x0035 }, { Tag::root, sigmaId, exifId, 0x927c }, { Tag::root, sony1Id, exifId, 0x927c }, @@ -1608,10 +1629,14 @@ namespace Exiv2 { { Tag::all, pentaxId, newTiffEntry }, // Samsung2 makernote + { 0x0021, samsung2Id, EXV_BINARY_ARRAY(samsungPwCfg, samsungPwDef) }, { 0x0035, samsung2Id, newTiffSubIfd }, { Tag::next, samsung2Id, newTiffDirectory }, { Tag::all, samsung2Id, newTiffEntry }, + // Samsung PictureWizard binary array + { Tag::all, samsungPwId, newTiffBinaryElement }, + // Samsung2 makernote preview subdir { 0x0201, samsungPvId, newTiffThumbData<0x0202, samsungPvId> }, { 0x0202, samsungPvId, newTiffThumbSize<0x0201, samsungPvId> },