/src/exiv2/src/samsungmn_int.cpp
Line | Count | Source |
1 | | // SPDX-License-Identifier: GPL-2.0-or-later |
2 | | |
3 | | // included header files |
4 | | #include "samsungmn_int.hpp" |
5 | | #include "i18n.h" // NLS support. |
6 | | #include "image_int.hpp" |
7 | | #include "tags.hpp" |
8 | | #include "tags_int.hpp" |
9 | | #include "types.hpp" |
10 | | #include "value.hpp" |
11 | | |
12 | | // + standard includes |
13 | | #include <ostream> |
14 | | |
15 | | // ***************************************************************************** |
16 | | // class member definitions |
17 | | namespace Exiv2::Internal { |
18 | | //! LensType, tag 0xa003 |
19 | | constexpr TagDetails samsung2LensType[] = { |
20 | | {0, N_("Built-in")}, |
21 | | {1, "Samsung NX 30mm F2 Pancake"}, |
22 | | {2, "Samsung NX 18-55mm F3.5-5.6 OIS"}, |
23 | | {3, "Samsung NX 50-200mm F4-5.6 ED OIS"}, |
24 | | {4, "Samsung NX 20-50mm F3.5-5.6 ED"}, |
25 | | {5, "Samsung NX 20mm F2.8 Pancake"}, |
26 | | {6, "Samsung NX 18-200mm F3.5-6.3 ED OIS"}, |
27 | | {7, "Samsung NX 60mm F2.8 Macro ED OIS SSA"}, |
28 | | {8, "Samsung NX 16mm F2.4 Pancake"}, |
29 | | {9, "Samsung NX 85mm F1.4 ED SSA"}, |
30 | | {10, "Samsung NX 45mm F1.8"}, |
31 | | {11, "Samsung NX 45mm F1.8 2D/3D"}, |
32 | | {12, "Samsung NX 12-24mm F4-5.6 ED"}, |
33 | | {13, "Samsung NX 16-50mm F2-2.8 S ED OIS"}, |
34 | | {14, "Samsung NX 10mm F3.5 Fisheye"}, |
35 | | {15, "Samsung NX 16-50mm F3.5-5.6 Power Zoom ED OIS"}, |
36 | | {20, "Samsung NX 50-150mm F2.8 S ED OIS"}, |
37 | | {21, "Samsung NX 300mm F2.8 ED OIS"}, |
38 | | }; |
39 | | |
40 | | //! ColorSpace, tag 0xa011 |
41 | | constexpr TagDetails samsung2ColorSpace[] = { |
42 | | {0, N_("sRGB")}, |
43 | | {1, N_("Adobe RGB")}, |
44 | | }; |
45 | | |
46 | | //! SmartRange, tag 0xa012 |
47 | | constexpr TagDetails samsung2SmartRange[] = { |
48 | | {0, N_("Off")}, |
49 | | {1, N_("On")}, |
50 | | }; |
51 | | |
52 | | //! Print the camera temperature |
53 | 26 | static std::ostream& printCameraTemperature(std::ostream& os, const Value& value, const ExifData*) { |
54 | 26 | if (value.count() != 1 || value.typeId() != signedRational) { |
55 | 26 | return os << value; |
56 | 26 | } |
57 | 0 | return os << value.toFloat() << " C"; |
58 | 26 | } |
59 | | |
60 | | //! Print the 35mm focal length |
61 | 24 | static std::ostream& printFocalLength35(std::ostream& os, const Value& value, const ExifData*) { |
62 | 24 | if (value.count() != 1 || value.typeId() != unsignedLong) { |
63 | 12 | return os << value; |
64 | 12 | } |
65 | 12 | auto length = value.toInt64(); |
66 | 12 | if (length == 0) { |
67 | 6 | return os << _("Unknown"); |
68 | 6 | } |
69 | 6 | return os << stringFormat("{:.1f} mm", length / 10.0); |
70 | 12 | } |
71 | | |
72 | | // Samsung MakerNote Tag Info |
73 | | constexpr TagInfo Samsung2MakerNote::tagInfo_[] = { |
74 | | {0x0001, "Version", N_("Version"), N_("Makernote version"), IfdId::samsung2Id, SectionId::makerTags, undefined, -1, |
75 | | printExifVersion}, |
76 | | {0x0021, "PictureWizard", N_("Picture Wizard"), N_("Picture wizard composite tag"), IfdId::samsung2Id, |
77 | | SectionId::makerTags, unsignedShort, -1, printValue}, |
78 | | {0x0030, "LocalLocationName", N_("Local Location Name"), N_("Local location name"), IfdId::samsung2Id, |
79 | | SectionId::makerTags, asciiString, -1, printValue}, |
80 | | {0x0031, "LocationName", N_("Location Name"), N_("Location name"), IfdId::samsung2Id, SectionId::makerTags, |
81 | | asciiString, -1, printValue}, |
82 | | {0x0035, "Preview", N_("Pointer to a preview image"), N_("Offset to an IFD containing a preview image"), |
83 | | IfdId::samsung2Id, SectionId::makerTags, unsignedLong, -1, printValue}, |
84 | | {0x0043, "CameraTemperature", N_("Camera Temperature"), N_("Camera temperature"), IfdId::samsung2Id, |
85 | | SectionId::makerTags, signedRational, -1, printCameraTemperature}, |
86 | | {0xa001, "FirmwareName", N_("Firmware Name"), N_("Firmware name"), IfdId::samsung2Id, SectionId::makerTags, |
87 | | asciiString, -1, printValue}, |
88 | | {0xa003, "LensType", N_("Lens Type"), N_("Lens type"), IfdId::samsung2Id, SectionId::makerTags, unsignedShort, -1, |
89 | | EXV_PRINT_TAG(samsung2LensType)}, |
90 | | {0xa004, "LensFirmware", N_("Lens Firmware"), N_("Lens firmware"), IfdId::samsung2Id, SectionId::makerTags, |
91 | | asciiString, -1, printValue}, |
92 | | {0xa010, "SensorAreas", N_("Sensor Areas"), N_("Sensor areas"), IfdId::samsung2Id, SectionId::makerTags, |
93 | | unsignedLong, -1, printValue}, |
94 | | {0xa011, "ColorSpace", N_("Color Space"), N_("Color space"), IfdId::samsung2Id, SectionId::makerTags, unsignedShort, |
95 | | -1, EXV_PRINT_TAG(samsung2ColorSpace)}, |
96 | | {0xa012, "SmartRange", N_("Smart Range"), N_("Smart range"), IfdId::samsung2Id, SectionId::makerTags, unsignedShort, |
97 | | -1, EXV_PRINT_TAG(samsung2SmartRange)}, |
98 | | {0xa013, "ExposureBiasValue", N_("Exposure Bias Value"), N_("Exposure bias value"), IfdId::samsung2Id, |
99 | | SectionId::makerTags, signedRational, -1, print0x9204}, |
100 | | {0xa014, "ISO", N_("ISO"), N_("ISO"), IfdId::samsung2Id, SectionId::makerTags, unsignedLong, -1, printValue}, |
101 | | {0xa018, "ExposureTime", N_("Exposure Time"), N_("Exposure time"), IfdId::samsung2Id, SectionId::makerTags, |
102 | | unsignedRational, -1, print0x829a}, |
103 | | {0xa019, "FNumber", N_("FNumber"), N_("The F number."), IfdId::samsung2Id, SectionId::makerTags, unsignedRational, |
104 | | -1, print0x829d}, |
105 | | {0xa01a, "FocalLengthIn35mmFormat", N_("Focal Length In 35mm Format"), N_("Focal length in 35mm format"), |
106 | | IfdId::samsung2Id, SectionId::makerTags, unsignedLong, -1, printFocalLength35}, |
107 | | {0xa020, "EncryptionKey", N_("Encryption Key"), N_("Encryption key"), IfdId::samsung2Id, SectionId::makerTags, |
108 | | unsignedLong, -1, printValue}, |
109 | | {0xa021, "WB_RGGBLevelsUncorrected", N_("WB RGGB Levels Uncorrected"), |
110 | | N_("WB RGGB levels not corrected for WB_RGGBLevelsBlack"), IfdId::samsung2Id, SectionId::makerTags, unsignedLong, |
111 | | -1, printValue}, |
112 | | {0xa022, "WB_RGGBLevelsAuto", N_("WB RGGB Levels Auto"), N_("WB RGGB levels auto"), IfdId::samsung2Id, |
113 | | SectionId::makerTags, unsignedLong, -1, printValue}, |
114 | | {0xa023, "WB_RGGBLevelsIlluminator1", N_("WB RGGB Levels Illuminator1"), N_("WB RGGB levels illuminator1"), |
115 | | IfdId::samsung2Id, SectionId::makerTags, unsignedLong, -1, printValue}, |
116 | | {0xa024, "WB_RGGBLevelsIlluminator2", N_("WB RGGB Levels Illuminator2"), N_("WB RGGB levels illuminator2"), |
117 | | IfdId::samsung2Id, SectionId::makerTags, unsignedLong, -1, printValue}, |
118 | | {0xa028, "WB_RGGBLevelsBlack", N_("WB RGGB Levels Black"), N_("WB RGGB levels black"), IfdId::samsung2Id, |
119 | | SectionId::makerTags, signedLong, -1, printValue}, |
120 | | {0xa030, "ColorMatrix", N_("Color Matrix"), N_("Color matrix"), IfdId::samsung2Id, SectionId::makerTags, signedLong, |
121 | | -1, printValue}, |
122 | | {0xa031, "ColorMatrixSRGB", N_("Color Matrix sRGB"), N_("Color matrix sRGB"), IfdId::samsung2Id, |
123 | | SectionId::makerTags, signedLong, -1, printValue}, |
124 | | {0xa032, "ColorMatrixAdobeRGB", N_("Color Matrix Adobe RGB"), N_("Color matrix Adobe RGB"), IfdId::samsung2Id, |
125 | | SectionId::makerTags, signedLong, -1, printValue}, |
126 | | {0xa040, "ToneCurve1", N_("Tone Curve 1"), N_("Tone curve 1"), IfdId::samsung2Id, SectionId::makerTags, |
127 | | unsignedLong, -1, printValue}, |
128 | | {0xa041, "ToneCurve2", N_("Tone Curve 2"), N_("Tone curve 2"), IfdId::samsung2Id, SectionId::makerTags, |
129 | | unsignedLong, -1, printValue}, |
130 | | {0xa042, "ToneCurve3", N_("Tone Curve 3"), N_("Tone curve 3"), IfdId::samsung2Id, SectionId::makerTags, |
131 | | unsignedLong, -1, printValue}, |
132 | | {0xa043, "ToneCurve4", N_("Tone Curve 4"), N_("Tone curve 4"), IfdId::samsung2Id, SectionId::makerTags, |
133 | | unsignedLong, -1, printValue}, |
134 | | // End of list marker |
135 | | {0xffff, "(UnknownSamsung2MakerNoteTag)", "(UnknownSamsung2MakerNoteTag)", N_("Unknown Samsung2MakerNote tag"), |
136 | | IfdId::samsung2Id, SectionId::makerTags, undefined, -1, printValue}, |
137 | | }; |
138 | | |
139 | 57.7k | const TagInfo* Samsung2MakerNote::tagList() { |
140 | 57.7k | return tagInfo_; |
141 | 57.7k | } |
142 | | |
143 | | //! PictureWizard Mode |
144 | | constexpr TagDetails samsungPwMode[] = { |
145 | | {0, N_("Standard")}, {1, N_("Vivid")}, {2, N_("Portrait")}, {3, N_("Landscape")}, |
146 | | {4, N_("Forest")}, {5, N_("Retro")}, {6, N_("Cool")}, {7, N_("Calm")}, |
147 | | {8, N_("Classic")}, {9, N_("Custom1")}, {10, N_("Custom2")}, {11, N_("Custom3")}, |
148 | | }; |
149 | | |
150 | | //! Print the PictureWizard Color tag value |
151 | 38 | static std::ostream& printPwColor(std::ostream& os, const Value& value, const ExifData*) { |
152 | 38 | if (value.count() != 1 || value.typeId() != unsignedShort) { |
153 | 0 | return os << value; |
154 | 0 | } |
155 | | // Special case where no color modification is done |
156 | 38 | if (value.toInt64() == 65535) { |
157 | 6 | return os << _("Neutral"); |
158 | 6 | } |
159 | | // Output seems to represent Hue in degrees |
160 | 32 | return os << value.toInt64(); |
161 | 38 | } |
162 | | |
163 | | //! Print the tag value minus 4 |
164 | 100 | static std::ostream& printValueMinus4(std::ostream& os, const Value& value, const ExifData*) { |
165 | 100 | if (value.count() != 1 || value.typeId() != unsignedShort) { |
166 | 0 | return os << value; |
167 | 0 | } |
168 | 100 | return os << value.toInt64(0) - 4; |
169 | 100 | } |
170 | | |
171 | | // Samsung PictureWizard Tag Info |
172 | | constexpr TagInfo Samsung2MakerNote::tagInfoPw_[] = { |
173 | | {0x0000, "Mode", N_("Mode"), N_("Mode"), IfdId::samsungPwId, SectionId::makerTags, unsignedShort, 1, |
174 | | EXV_PRINT_TAG(samsungPwMode)}, |
175 | | {0x0001, "Color", N_("Color"), N_("Color"), IfdId::samsungPwId, SectionId::makerTags, unsignedShort, 1, |
176 | | printPwColor}, |
177 | | {0x0002, "Saturation", N_("Saturation"), N_("Saturation"), IfdId::samsungPwId, SectionId::makerTags, unsignedShort, |
178 | | 1, printValueMinus4}, |
179 | | {0x0003, "Sharpness", N_("Sharpness"), N_("Sharpness"), IfdId::samsungPwId, SectionId::makerTags, unsignedShort, 1, |
180 | | printValueMinus4}, |
181 | | {0x0004, "Contrast", N_("Contrast"), N_("Contrast"), IfdId::samsungPwId, SectionId::makerTags, unsignedShort, 1, |
182 | | printValueMinus4}, |
183 | | // End of list marker |
184 | | {0xffff, "(UnknownSamsungPictureWizardTag)", "(UnknownSamsungPictureWizardTag)", |
185 | | N_("Unknown SamsungPictureWizard tag"), IfdId::samsungPwId, SectionId::makerTags, unsignedShort, 1, printValue}, |
186 | | }; |
187 | | |
188 | 81.0k | const TagInfo* Samsung2MakerNote::tagListPw() { |
189 | 81.0k | return tagInfoPw_; |
190 | 81.0k | } |
191 | | |
192 | | } // namespace Exiv2::Internal |