1 | /*
|
---|
2 | * Copyright 2002-2015 Drew Noakes
|
---|
3 | *
|
---|
4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
---|
5 | * you may not use this file except in compliance with the License.
|
---|
6 | * You may obtain a copy of the License at
|
---|
7 | *
|
---|
8 | * http://www.apache.org/licenses/LICENSE-2.0
|
---|
9 | *
|
---|
10 | * Unless required by applicable law or agreed to in writing, software
|
---|
11 | * distributed under the License is distributed on an "AS IS" BASIS,
|
---|
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
13 | * See the License for the specific language governing permissions and
|
---|
14 | * limitations under the License.
|
---|
15 | *
|
---|
16 | * More information about this project is available at:
|
---|
17 | *
|
---|
18 | * https://drewnoakes.com/code/exif/
|
---|
19 | * https://github.com/drewnoakes/metadata-extractor
|
---|
20 | */
|
---|
21 | package com.drew.metadata.exif.makernotes;
|
---|
22 |
|
---|
23 | import com.drew.lang.Rational;
|
---|
24 | import com.drew.lang.annotations.NotNull;
|
---|
25 | import com.drew.lang.annotations.Nullable;
|
---|
26 | import com.drew.metadata.TagDescriptor;
|
---|
27 |
|
---|
28 | import java.text.DecimalFormat;
|
---|
29 | import java.util.HashMap;
|
---|
30 |
|
---|
31 | import static com.drew.metadata.exif.makernotes.OlympusCameraSettingsMakernoteDirectory.*;
|
---|
32 |
|
---|
33 | /**
|
---|
34 | * Provides human-readable String representations of tag values stored in a {@link OlympusCameraSettingsMakernoteDirectory}.
|
---|
35 | * <p>
|
---|
36 | * Some Description functions and the Extender and Lens types lists converted from Exiftool version 10.10 created by Phil Harvey
|
---|
37 | * http://www.sno.phy.queensu.ca/~phil/exiftool/
|
---|
38 | * lib\Image\ExifTool\Olympus.pm
|
---|
39 | *
|
---|
40 | * @author Kevin Mott https://github.com/kwhopper
|
---|
41 | * @author Drew Noakes https://drewnoakes.com
|
---|
42 | */
|
---|
43 | @SuppressWarnings("WeakerAccess")
|
---|
44 | public class OlympusCameraSettingsMakernoteDescriptor extends TagDescriptor<OlympusCameraSettingsMakernoteDirectory>
|
---|
45 | {
|
---|
46 | public OlympusCameraSettingsMakernoteDescriptor(@NotNull OlympusCameraSettingsMakernoteDirectory directory)
|
---|
47 | {
|
---|
48 | super(directory);
|
---|
49 | }
|
---|
50 |
|
---|
51 | @Override
|
---|
52 | @Nullable
|
---|
53 | public String getDescription(int tagType)
|
---|
54 | {
|
---|
55 | switch (tagType) {
|
---|
56 | case TagCameraSettingsVersion:
|
---|
57 | return getCameraSettingsVersionDescription();
|
---|
58 | case TagPreviewImageValid:
|
---|
59 | return getPreviewImageValidDescription();
|
---|
60 |
|
---|
61 | case TagExposureMode:
|
---|
62 | return getExposureModeDescription();
|
---|
63 | case TagAeLock:
|
---|
64 | return getAeLockDescription();
|
---|
65 | case TagMeteringMode:
|
---|
66 | return getMeteringModeDescription();
|
---|
67 | case TagExposureShift:
|
---|
68 | return getExposureShiftDescription();
|
---|
69 | case TagNdFilter:
|
---|
70 | return getNdFilterDescription();
|
---|
71 |
|
---|
72 | case TagMacroMode:
|
---|
73 | return getMacroModeDescription();
|
---|
74 | case TagFocusMode:
|
---|
75 | return getFocusModeDescription();
|
---|
76 | case TagFocusProcess:
|
---|
77 | return getFocusProcessDescription();
|
---|
78 | case TagAfSearch:
|
---|
79 | return getAfSearchDescription();
|
---|
80 | case TagAfAreas:
|
---|
81 | return getAfAreasDescription();
|
---|
82 | case TagAfPointSelected:
|
---|
83 | return getAfPointSelectedDescription();
|
---|
84 | case TagAfFineTune:
|
---|
85 | return getAfFineTuneDescription();
|
---|
86 |
|
---|
87 | case TagFlashMode:
|
---|
88 | return getFlashModeDescription();
|
---|
89 | case TagFlashRemoteControl:
|
---|
90 | return getFlashRemoteControlDescription();
|
---|
91 | case TagFlashControlMode:
|
---|
92 | return getFlashControlModeDescription();
|
---|
93 | case TagFlashIntensity:
|
---|
94 | return getFlashIntensityDescription();
|
---|
95 | case TagManualFlashStrength:
|
---|
96 | return getManualFlashStrengthDescription();
|
---|
97 |
|
---|
98 | case TagWhiteBalance2:
|
---|
99 | return getWhiteBalance2Description();
|
---|
100 | case TagWhiteBalanceTemperature:
|
---|
101 | return getWhiteBalanceTemperatureDescription();
|
---|
102 | case TagCustomSaturation:
|
---|
103 | return getCustomSaturationDescription();
|
---|
104 | case TagModifiedSaturation:
|
---|
105 | return getModifiedSaturationDescription();
|
---|
106 | case TagContrastSetting:
|
---|
107 | return getContrastSettingDescription();
|
---|
108 | case TagSharpnessSetting:
|
---|
109 | return getSharpnessSettingDescription();
|
---|
110 | case TagColorSpace:
|
---|
111 | return getColorSpaceDescription();
|
---|
112 | case TagSceneMode:
|
---|
113 | return getSceneModeDescription();
|
---|
114 | case TagNoiseReduction:
|
---|
115 | return getNoiseReductionDescription();
|
---|
116 | case TagDistortionCorrection:
|
---|
117 | return getDistortionCorrectionDescription();
|
---|
118 | case TagShadingCompensation:
|
---|
119 | return getShadingCompensationDescription();
|
---|
120 | case TagGradation:
|
---|
121 | return getGradationDescription();
|
---|
122 | case TagPictureMode:
|
---|
123 | return getPictureModeDescription();
|
---|
124 | case TagPictureModeSaturation:
|
---|
125 | return getPictureModeSaturationDescription();
|
---|
126 | case TagPictureModeContrast:
|
---|
127 | return getPictureModeContrastDescription();
|
---|
128 | case TagPictureModeSharpness:
|
---|
129 | return getPictureModeSharpnessDescription();
|
---|
130 | case TagPictureModeBWFilter:
|
---|
131 | return getPictureModeBWFilterDescription();
|
---|
132 | case TagPictureModeTone:
|
---|
133 | return getPictureModeToneDescription();
|
---|
134 | case TagNoiseFilter:
|
---|
135 | return getNoiseFilterDescription();
|
---|
136 | case TagArtFilter:
|
---|
137 | return getArtFilterDescription();
|
---|
138 | case TagMagicFilter:
|
---|
139 | return getMagicFilterDescription();
|
---|
140 | case TagPictureModeEffect:
|
---|
141 | return getPictureModeEffectDescription();
|
---|
142 | case TagToneLevel:
|
---|
143 | return getToneLevelDescription();
|
---|
144 | case TagArtFilterEffect:
|
---|
145 | return getArtFilterEffectDescription();
|
---|
146 | case TagColorCreatorEffect:
|
---|
147 | return getColorCreatorEffectDescription();
|
---|
148 |
|
---|
149 | case TagDriveMode:
|
---|
150 | return getDriveModeDescription();
|
---|
151 | case TagPanoramaMode:
|
---|
152 | return getPanoramaModeDescription();
|
---|
153 | case TagImageQuality2:
|
---|
154 | return getImageQuality2Description();
|
---|
155 | case TagImageStabilization:
|
---|
156 | return getImageStabilizationDescription();
|
---|
157 |
|
---|
158 | case TagStackedImage:
|
---|
159 | return getStackedImageDescription();
|
---|
160 |
|
---|
161 | case TagManometerPressure:
|
---|
162 | return getManometerPressureDescription();
|
---|
163 | case TagManometerReading:
|
---|
164 | return getManometerReadingDescription();
|
---|
165 | case TagExtendedWBDetect:
|
---|
166 | return getExtendedWBDetectDescription();
|
---|
167 | case TagRollAngle:
|
---|
168 | return getRollAngleDescription();
|
---|
169 | case TagPitchAngle:
|
---|
170 | return getPitchAngleDescription();
|
---|
171 | case TagDateTimeUtc:
|
---|
172 | return getDateTimeUTCDescription();
|
---|
173 |
|
---|
174 | default:
|
---|
175 | return super.getDescription(tagType);
|
---|
176 | }
|
---|
177 | }
|
---|
178 |
|
---|
179 | @Nullable
|
---|
180 | public String getCameraSettingsVersionDescription()
|
---|
181 | {
|
---|
182 | return getVersionBytesDescription(TagCameraSettingsVersion, 4);
|
---|
183 | }
|
---|
184 |
|
---|
185 | @Nullable
|
---|
186 | public String getPreviewImageValidDescription()
|
---|
187 | {
|
---|
188 | return getIndexedDescription(TagPreviewImageValid,
|
---|
189 | "No", "Yes");
|
---|
190 | }
|
---|
191 |
|
---|
192 | @Nullable
|
---|
193 | public String getExposureModeDescription()
|
---|
194 | {
|
---|
195 | return getIndexedDescription(TagExposureMode, 1,
|
---|
196 | "Manual", "Program", "Aperture-priority AE", "Shutter speed priority", "Program-shift");
|
---|
197 | }
|
---|
198 |
|
---|
199 | @Nullable
|
---|
200 | public String getAeLockDescription()
|
---|
201 | {
|
---|
202 | return getIndexedDescription(TagAeLock,
|
---|
203 | "Off", "On");
|
---|
204 | }
|
---|
205 |
|
---|
206 | @Nullable
|
---|
207 | public String getMeteringModeDescription()
|
---|
208 | {
|
---|
209 | Integer value = _directory.getInteger(TagMeteringMode);
|
---|
210 | if (value == null)
|
---|
211 | return null;
|
---|
212 |
|
---|
213 | switch (value) {
|
---|
214 | case 2:
|
---|
215 | return "Center-weighted average";
|
---|
216 | case 3:
|
---|
217 | return "Spot";
|
---|
218 | case 5:
|
---|
219 | return "ESP";
|
---|
220 | case 261:
|
---|
221 | return "Pattern+AF";
|
---|
222 | case 515:
|
---|
223 | return "Spot+Highlight control";
|
---|
224 | case 1027:
|
---|
225 | return "Spot+Shadow control";
|
---|
226 | default:
|
---|
227 | return "Unknown (" + value + ")";
|
---|
228 | }
|
---|
229 | }
|
---|
230 |
|
---|
231 | @Nullable
|
---|
232 | public String getExposureShiftDescription()
|
---|
233 | {
|
---|
234 | return getRationalOrDoubleString(TagExposureShift);
|
---|
235 | }
|
---|
236 |
|
---|
237 | @Nullable
|
---|
238 | public String getNdFilterDescription()
|
---|
239 | {
|
---|
240 | return getIndexedDescription(TagNdFilter, "Off", "On");
|
---|
241 | }
|
---|
242 |
|
---|
243 | @Nullable
|
---|
244 | public String getMacroModeDescription()
|
---|
245 | {
|
---|
246 | return getIndexedDescription(TagMacroMode, "Off", "On", "Super Macro");
|
---|
247 | }
|
---|
248 |
|
---|
249 | @Nullable
|
---|
250 | public String getFocusModeDescription()
|
---|
251 | {
|
---|
252 | int[] values = _directory.getIntArray(TagFocusMode);
|
---|
253 | if (values == null) {
|
---|
254 | // check if it's only one value long also
|
---|
255 | Integer value = _directory.getInteger(TagFocusMode);
|
---|
256 | if (value == null)
|
---|
257 | return null;
|
---|
258 |
|
---|
259 | values = new int[]{value};
|
---|
260 | }
|
---|
261 |
|
---|
262 | if (values.length == 0)
|
---|
263 | return null;
|
---|
264 |
|
---|
265 | StringBuilder sb = new StringBuilder();
|
---|
266 | switch (values[0]) {
|
---|
267 | case 0:
|
---|
268 | sb.append("Single AF");
|
---|
269 | break;
|
---|
270 | case 1:
|
---|
271 | sb.append("Sequential shooting AF");
|
---|
272 | break;
|
---|
273 | case 2:
|
---|
274 | sb.append("Continuous AF");
|
---|
275 | break;
|
---|
276 | case 3:
|
---|
277 | sb.append("Multi AF");
|
---|
278 | break;
|
---|
279 | case 4:
|
---|
280 | sb.append("Face detect");
|
---|
281 | break;
|
---|
282 | case 10:
|
---|
283 | sb.append("MF");
|
---|
284 | break;
|
---|
285 | default:
|
---|
286 | sb.append("Unknown (" + values[0] + ")");
|
---|
287 | break;
|
---|
288 | }
|
---|
289 |
|
---|
290 | if (values.length > 1) {
|
---|
291 | sb.append("; ");
|
---|
292 | int value1 = values[1];
|
---|
293 |
|
---|
294 | if (value1 == 0) {
|
---|
295 | sb.append("(none)");
|
---|
296 | } else {
|
---|
297 | if (( value1 & 1) > 0) sb.append("S-AF, ");
|
---|
298 | if (((value1 >> 2) & 1) > 0) sb.append("C-AF, ");
|
---|
299 | if (((value1 >> 4) & 1) > 0) sb.append("MF, ");
|
---|
300 | if (((value1 >> 5) & 1) > 0) sb.append("Face detect, ");
|
---|
301 | if (((value1 >> 6) & 1) > 0) sb.append("Imager AF, ");
|
---|
302 | if (((value1 >> 7) & 1) > 0) sb.append("Live View Magnification Frame, ");
|
---|
303 | if (((value1 >> 8) & 1) > 0) sb.append("AF sensor, ");
|
---|
304 |
|
---|
305 | sb.setLength(sb.length() - 2);
|
---|
306 | }
|
---|
307 | }
|
---|
308 |
|
---|
309 | return sb.toString();
|
---|
310 | }
|
---|
311 |
|
---|
312 | @Nullable
|
---|
313 | public String getFocusProcessDescription()
|
---|
314 | {
|
---|
315 | int[] values = _directory.getIntArray(TagFocusProcess);
|
---|
316 | if (values == null) {
|
---|
317 | // check if it's only one value long also
|
---|
318 | Integer value = _directory.getInteger(TagFocusProcess);
|
---|
319 | if (value == null)
|
---|
320 | return null;
|
---|
321 |
|
---|
322 | values = new int[]{value};
|
---|
323 | }
|
---|
324 |
|
---|
325 | if (values.length == 0)
|
---|
326 | return null;
|
---|
327 |
|
---|
328 | StringBuilder sb = new StringBuilder();
|
---|
329 |
|
---|
330 | switch (values[0]) {
|
---|
331 | case 0:
|
---|
332 | sb.append("AF not used");
|
---|
333 | break;
|
---|
334 | case 1:
|
---|
335 | sb.append("AF used");
|
---|
336 | break;
|
---|
337 | default:
|
---|
338 | sb.append("Unknown (" + values[0] + ")");
|
---|
339 | break;
|
---|
340 | }
|
---|
341 |
|
---|
342 | if (values.length > 1)
|
---|
343 | sb.append("; " + values[1]);
|
---|
344 |
|
---|
345 | return sb.toString();
|
---|
346 | }
|
---|
347 |
|
---|
348 | @Nullable
|
---|
349 | public String getAfSearchDescription()
|
---|
350 | {
|
---|
351 | return getIndexedDescription(TagAfSearch, "Not Ready", "Ready");
|
---|
352 | }
|
---|
353 |
|
---|
354 | /// <summary>
|
---|
355 | /// coordinates range from 0 to 255
|
---|
356 | /// </summary>
|
---|
357 | /// <returns></returns>
|
---|
358 | @Nullable
|
---|
359 | public String getAfAreasDescription()
|
---|
360 | {
|
---|
361 | Object obj = _directory.getObject(TagAfAreas);
|
---|
362 | if (obj == null || !(obj instanceof long[]))
|
---|
363 | return null;
|
---|
364 |
|
---|
365 | StringBuilder sb = new StringBuilder();
|
---|
366 | for (long point : (long[]) obj) {
|
---|
367 | if (point == 0L)
|
---|
368 | continue;
|
---|
369 | if (sb.length() != 0)
|
---|
370 | sb.append(", ");
|
---|
371 |
|
---|
372 | if (point == 0x36794285L)
|
---|
373 | sb.append("Left ");
|
---|
374 | else if (point == 0x79798585L)
|
---|
375 | sb.append("Center ");
|
---|
376 | else if (point == 0xBD79C985L)
|
---|
377 | sb.append("Right ");
|
---|
378 |
|
---|
379 | sb.append(String.format("(%d/255,%d/255)-(%d/255,%d/255)",
|
---|
380 | (point >> 24) & 0xFF,
|
---|
381 | (point >> 16) & 0xFF,
|
---|
382 | (point >> 8) & 0xFF,
|
---|
383 | point & 0xFF));
|
---|
384 | }
|
---|
385 |
|
---|
386 | return sb.length() == 0 ? null : sb.toString();
|
---|
387 | }
|
---|
388 |
|
---|
389 | /// <summary>
|
---|
390 | /// coordinates expressed as a percent
|
---|
391 | /// </summary>
|
---|
392 | /// <returns></returns>
|
---|
393 | @Nullable
|
---|
394 | public String getAfPointSelectedDescription()
|
---|
395 | {
|
---|
396 | Rational[] values = _directory.getRationalArray(TagAfPointSelected);
|
---|
397 | if (values == null)
|
---|
398 | return "n/a";
|
---|
399 |
|
---|
400 | if (values.length < 4)
|
---|
401 | return null;
|
---|
402 |
|
---|
403 | int index = 0;
|
---|
404 | if (values.length == 5 && values[0].longValue() == 0)
|
---|
405 | index = 1;
|
---|
406 |
|
---|
407 | int p1 = (int)(values[index].doubleValue() * 100);
|
---|
408 | int p2 = (int)(values[index + 1].doubleValue() * 100);
|
---|
409 | int p3 = (int)(values[index + 2].doubleValue() * 100);
|
---|
410 | int p4 = (int)(values[index + 3].doubleValue() * 100);
|
---|
411 |
|
---|
412 | if(p1 + p2 + p3 + p4 == 0)
|
---|
413 | return "n/a";
|
---|
414 |
|
---|
415 | return String.format("(%d%%,%d%%) (%d%%,%d%%)", p1, p2, p3, p4);
|
---|
416 | }
|
---|
417 |
|
---|
418 | @Nullable
|
---|
419 | public String getAfFineTuneDescription()
|
---|
420 | {
|
---|
421 | return getIndexedDescription(TagAfFineTune, "Off", "On");
|
---|
422 | }
|
---|
423 |
|
---|
424 | @Nullable
|
---|
425 | public String getFlashModeDescription()
|
---|
426 | {
|
---|
427 | Integer value = _directory.getInteger(TagFlashMode);
|
---|
428 | if (value == null)
|
---|
429 | return null;
|
---|
430 |
|
---|
431 | if (value == 0)
|
---|
432 | return "Off";
|
---|
433 |
|
---|
434 | StringBuilder sb = new StringBuilder();
|
---|
435 | int v = value;
|
---|
436 |
|
---|
437 | if (( v & 1) != 0) sb.append("On, ");
|
---|
438 | if (((v >> 1) & 1) != 0) sb.append("Fill-in, ");
|
---|
439 | if (((v >> 2) & 1) != 0) sb.append("Red-eye, ");
|
---|
440 | if (((v >> 3) & 1) != 0) sb.append("Slow-sync, ");
|
---|
441 | if (((v >> 4) & 1) != 0) sb.append("Forced On, ");
|
---|
442 | if (((v >> 5) & 1) != 0) sb.append("2nd Curtain, ");
|
---|
443 |
|
---|
444 | return sb.substring(0, sb.length() - 2);
|
---|
445 | }
|
---|
446 |
|
---|
447 | @Nullable
|
---|
448 | public String getFlashRemoteControlDescription()
|
---|
449 | {
|
---|
450 | Integer value = _directory.getInteger(TagFlashRemoteControl);
|
---|
451 | if (value == null)
|
---|
452 | return null;
|
---|
453 |
|
---|
454 | switch (value) {
|
---|
455 | case 0:
|
---|
456 | return "Off";
|
---|
457 | case 0x01:
|
---|
458 | return "Channel 1, Low";
|
---|
459 | case 0x02:
|
---|
460 | return "Channel 2, Low";
|
---|
461 | case 0x03:
|
---|
462 | return "Channel 3, Low";
|
---|
463 | case 0x04:
|
---|
464 | return "Channel 4, Low";
|
---|
465 | case 0x09:
|
---|
466 | return "Channel 1, Mid";
|
---|
467 | case 0x0a:
|
---|
468 | return "Channel 2, Mid";
|
---|
469 | case 0x0b:
|
---|
470 | return "Channel 3, Mid";
|
---|
471 | case 0x0c:
|
---|
472 | return "Channel 4, Mid";
|
---|
473 | case 0x11:
|
---|
474 | return "Channel 1, High";
|
---|
475 | case 0x12:
|
---|
476 | return "Channel 2, High";
|
---|
477 | case 0x13:
|
---|
478 | return "Channel 3, High";
|
---|
479 | case 0x14:
|
---|
480 | return "Channel 4, High";
|
---|
481 |
|
---|
482 | default:
|
---|
483 | return "Unknown (" + value + ")";
|
---|
484 | }
|
---|
485 | }
|
---|
486 |
|
---|
487 | /// <summary>
|
---|
488 | /// 3 or 4 values
|
---|
489 | /// </summary>
|
---|
490 | /// <returns></returns>
|
---|
491 | @Nullable
|
---|
492 | public String getFlashControlModeDescription()
|
---|
493 | {
|
---|
494 | int[] values = _directory.getIntArray(TagFlashControlMode);
|
---|
495 | if (values == null)
|
---|
496 | return null;
|
---|
497 |
|
---|
498 | if (values.length == 0)
|
---|
499 | return null;
|
---|
500 |
|
---|
501 | StringBuilder sb = new StringBuilder();
|
---|
502 |
|
---|
503 | switch (values[0]) {
|
---|
504 | case 0:
|
---|
505 | sb.append("Off");
|
---|
506 | break;
|
---|
507 | case 3:
|
---|
508 | sb.append("TTL");
|
---|
509 | break;
|
---|
510 | case 4:
|
---|
511 | sb.append("Auto");
|
---|
512 | break;
|
---|
513 | case 5:
|
---|
514 | sb.append("Manual");
|
---|
515 | break;
|
---|
516 | default:
|
---|
517 | sb.append("Unknown (").append(values[0]).append(")");
|
---|
518 | break;
|
---|
519 | }
|
---|
520 |
|
---|
521 | for (int i = 1; i < values.length; i++)
|
---|
522 | sb.append("; ").append(values[i]);
|
---|
523 |
|
---|
524 | return sb.toString();
|
---|
525 | }
|
---|
526 |
|
---|
527 | /// <summary>
|
---|
528 | /// 3 or 4 values
|
---|
529 | /// </summary>
|
---|
530 | /// <returns></returns>
|
---|
531 | @Nullable
|
---|
532 | public String getFlashIntensityDescription()
|
---|
533 | {
|
---|
534 | Rational[] values = _directory.getRationalArray(TagFlashIntensity);
|
---|
535 | if (values == null || values.length == 0)
|
---|
536 | return null;
|
---|
537 |
|
---|
538 | if (values.length == 3) {
|
---|
539 | if (values[0].getDenominator() == 0 && values[1].getDenominator() == 0 && values[2].getDenominator() == 0)
|
---|
540 | return "n/a";
|
---|
541 | } else if (values.length == 4) {
|
---|
542 | if (values[0].getDenominator() == 0 && values[1].getDenominator() == 0 && values[2].getDenominator() == 0 && values[3].getDenominator() == 0)
|
---|
543 | return "n/a (x4)";
|
---|
544 | }
|
---|
545 |
|
---|
546 | StringBuilder sb = new StringBuilder();
|
---|
547 | for (Rational t : values)
|
---|
548 | sb.append(t).append(", ");
|
---|
549 |
|
---|
550 | return sb.substring(0, sb.length() - 2);
|
---|
551 | }
|
---|
552 |
|
---|
553 | @Nullable
|
---|
554 | public String getManualFlashStrengthDescription()
|
---|
555 | {
|
---|
556 | Rational[] values = _directory.getRationalArray(TagManualFlashStrength);
|
---|
557 | if (values == null || values.length == 0)
|
---|
558 | return "n/a";
|
---|
559 |
|
---|
560 | if (values.length == 3) {
|
---|
561 | if (values[0].getDenominator() == 0 && values[1].getDenominator() == 0 && values[2].getDenominator() == 0)
|
---|
562 | return "n/a";
|
---|
563 | } else if (values.length == 4) {
|
---|
564 | if (values[0].getDenominator() == 0 && values[1].getDenominator() == 0 && values[2].getDenominator() == 0 && values[3].getDenominator() == 0)
|
---|
565 | return "n/a (x4)";
|
---|
566 | }
|
---|
567 |
|
---|
568 | StringBuilder sb = new StringBuilder();
|
---|
569 | for (Rational t : values)
|
---|
570 | sb.append(t).append(", ");
|
---|
571 |
|
---|
572 | return sb.substring(0, sb.length() - 2);
|
---|
573 | }
|
---|
574 |
|
---|
575 | @Nullable
|
---|
576 | public String getWhiteBalance2Description()
|
---|
577 | {
|
---|
578 | Integer value = _directory.getInteger(TagWhiteBalance2);
|
---|
579 | if (value == null)
|
---|
580 | return null;
|
---|
581 |
|
---|
582 | switch (value) {
|
---|
583 | case 0:
|
---|
584 | return "Auto";
|
---|
585 | case 1:
|
---|
586 | return "Auto (Keep Warm Color Off)";
|
---|
587 | case 16:
|
---|
588 | return "7500K (Fine Weather with Shade)";
|
---|
589 | case 17:
|
---|
590 | return "6000K (Cloudy)";
|
---|
591 | case 18:
|
---|
592 | return "5300K (Fine Weather)";
|
---|
593 | case 20:
|
---|
594 | return "3000K (Tungsten light)";
|
---|
595 | case 21:
|
---|
596 | return "3600K (Tungsten light-like)";
|
---|
597 | case 22:
|
---|
598 | return "Auto Setup";
|
---|
599 | case 23:
|
---|
600 | return "5500K (Flash)";
|
---|
601 | case 33:
|
---|
602 | return "6600K (Daylight fluorescent)";
|
---|
603 | case 34:
|
---|
604 | return "4500K (Neutral white fluorescent)";
|
---|
605 | case 35:
|
---|
606 | return "4000K (Cool white fluorescent)";
|
---|
607 | case 36:
|
---|
608 | return "White Fluorescent";
|
---|
609 | case 48:
|
---|
610 | return "3600K (Tungsten light-like)";
|
---|
611 | case 67:
|
---|
612 | return "Underwater";
|
---|
613 | case 256:
|
---|
614 | return "One Touch WB 1";
|
---|
615 | case 257:
|
---|
616 | return "One Touch WB 2";
|
---|
617 | case 258:
|
---|
618 | return "One Touch WB 3";
|
---|
619 | case 259:
|
---|
620 | return "One Touch WB 4";
|
---|
621 | case 512:
|
---|
622 | return "Custom WB 1";
|
---|
623 | case 513:
|
---|
624 | return "Custom WB 2";
|
---|
625 | case 514:
|
---|
626 | return "Custom WB 3";
|
---|
627 | case 515:
|
---|
628 | return "Custom WB 4";
|
---|
629 | default:
|
---|
630 | return "Unknown (" + value + ")";
|
---|
631 | }
|
---|
632 | }
|
---|
633 |
|
---|
634 | @Nullable
|
---|
635 | public String getWhiteBalanceTemperatureDescription()
|
---|
636 | {
|
---|
637 | Integer value = _directory.getInteger(TagWhiteBalanceTemperature);
|
---|
638 | if (value == null)
|
---|
639 | return null;
|
---|
640 | if (value == 0)
|
---|
641 | return "Auto";
|
---|
642 | return value.toString();
|
---|
643 | }
|
---|
644 |
|
---|
645 | @Nullable
|
---|
646 | public String getCustomSaturationDescription()
|
---|
647 | {
|
---|
648 | // TODO: if model is /^E-1\b/ then
|
---|
649 | // $a-=$b; $c-=$b;
|
---|
650 | // return "CS$a (min CS0, max CS$c)"
|
---|
651 | return getValueMinMaxDescription(TagCustomSaturation);
|
---|
652 | }
|
---|
653 |
|
---|
654 | @Nullable
|
---|
655 | public String getModifiedSaturationDescription()
|
---|
656 | {
|
---|
657 | return getIndexedDescription(TagModifiedSaturation,
|
---|
658 | "Off", "CM1 (Red Enhance)", "CM2 (Green Enhance)", "CM3 (Blue Enhance)", "CM4 (Skin Tones)");
|
---|
659 | }
|
---|
660 |
|
---|
661 | @Nullable
|
---|
662 | public String getContrastSettingDescription()
|
---|
663 | {
|
---|
664 | return getValueMinMaxDescription(TagContrastSetting);
|
---|
665 | }
|
---|
666 |
|
---|
667 | @Nullable
|
---|
668 | public String getSharpnessSettingDescription()
|
---|
669 | {
|
---|
670 | return getValueMinMaxDescription(TagSharpnessSetting);
|
---|
671 | }
|
---|
672 |
|
---|
673 | @Nullable
|
---|
674 | public String getColorSpaceDescription()
|
---|
675 | {
|
---|
676 | return getIndexedDescription(TagColorSpace,
|
---|
677 | "sRGB", "Adobe RGB", "Pro Photo RGB");
|
---|
678 | }
|
---|
679 |
|
---|
680 | @Nullable
|
---|
681 | public String getSceneModeDescription()
|
---|
682 | {
|
---|
683 | Integer value = _directory.getInteger(TagSceneMode);
|
---|
684 | if (value == null)
|
---|
685 | return null;
|
---|
686 |
|
---|
687 | switch (value) {
|
---|
688 | case 0:
|
---|
689 | return "Standard";
|
---|
690 | case 6:
|
---|
691 | return "Auto";
|
---|
692 | case 7:
|
---|
693 | return "Sport";
|
---|
694 | case 8:
|
---|
695 | return "Portrait";
|
---|
696 | case 9:
|
---|
697 | return "Landscape+Portrait";
|
---|
698 | case 10:
|
---|
699 | return "Landscape";
|
---|
700 | case 11:
|
---|
701 | return "Night Scene";
|
---|
702 | case 12:
|
---|
703 | return "Self Portrait";
|
---|
704 | case 13:
|
---|
705 | return "Panorama";
|
---|
706 | case 14:
|
---|
707 | return "2 in 1";
|
---|
708 | case 15:
|
---|
709 | return "Movie";
|
---|
710 | case 16:
|
---|
711 | return "Landscape+Portrait";
|
---|
712 | case 17:
|
---|
713 | return "Night+Portrait";
|
---|
714 | case 18:
|
---|
715 | return "Indoor";
|
---|
716 | case 19:
|
---|
717 | return "Fireworks";
|
---|
718 | case 20:
|
---|
719 | return "Sunset";
|
---|
720 | case 21:
|
---|
721 | return "Beauty Skin";
|
---|
722 | case 22:
|
---|
723 | return "Macro";
|
---|
724 | case 23:
|
---|
725 | return "Super Macro";
|
---|
726 | case 24:
|
---|
727 | return "Food";
|
---|
728 | case 25:
|
---|
729 | return "Documents";
|
---|
730 | case 26:
|
---|
731 | return "Museum";
|
---|
732 | case 27:
|
---|
733 | return "Shoot & Select";
|
---|
734 | case 28:
|
---|
735 | return "Beach & Snow";
|
---|
736 | case 29:
|
---|
737 | return "Self Portrait+Timer";
|
---|
738 | case 30:
|
---|
739 | return "Candle";
|
---|
740 | case 31:
|
---|
741 | return "Available Light";
|
---|
742 | case 32:
|
---|
743 | return "Behind Glass";
|
---|
744 | case 33:
|
---|
745 | return "My Mode";
|
---|
746 | case 34:
|
---|
747 | return "Pet";
|
---|
748 | case 35:
|
---|
749 | return "Underwater Wide1";
|
---|
750 | case 36:
|
---|
751 | return "Underwater Macro";
|
---|
752 | case 37:
|
---|
753 | return "Shoot & Select1";
|
---|
754 | case 38:
|
---|
755 | return "Shoot & Select2";
|
---|
756 | case 39:
|
---|
757 | return "High Key";
|
---|
758 | case 40:
|
---|
759 | return "Digital Image Stabilization";
|
---|
760 | case 41:
|
---|
761 | return "Auction";
|
---|
762 | case 42:
|
---|
763 | return "Beach";
|
---|
764 | case 43:
|
---|
765 | return "Snow";
|
---|
766 | case 44:
|
---|
767 | return "Underwater Wide2";
|
---|
768 | case 45:
|
---|
769 | return "Low Key";
|
---|
770 | case 46:
|
---|
771 | return "Children";
|
---|
772 | case 47:
|
---|
773 | return "Vivid";
|
---|
774 | case 48:
|
---|
775 | return "Nature Macro";
|
---|
776 | case 49:
|
---|
777 | return "Underwater Snapshot";
|
---|
778 | case 50:
|
---|
779 | return "Shooting Guide";
|
---|
780 | case 54:
|
---|
781 | return "Face Portrait";
|
---|
782 | case 57:
|
---|
783 | return "Bulb";
|
---|
784 | case 59:
|
---|
785 | return "Smile Shot";
|
---|
786 | case 60:
|
---|
787 | return "Quick Shutter";
|
---|
788 | case 63:
|
---|
789 | return "Slow Shutter";
|
---|
790 | case 64:
|
---|
791 | return "Bird Watching";
|
---|
792 | case 65:
|
---|
793 | return "Multiple Exposure";
|
---|
794 | case 66:
|
---|
795 | return "e-Portrait";
|
---|
796 | case 67:
|
---|
797 | return "Soft Background Shot";
|
---|
798 | case 142:
|
---|
799 | return "Hand-held Starlight";
|
---|
800 | case 154:
|
---|
801 | return "HDR";
|
---|
802 | default:
|
---|
803 | return "Unknown (" + value + ")";
|
---|
804 | }
|
---|
805 | }
|
---|
806 |
|
---|
807 | @Nullable
|
---|
808 | public String getNoiseReductionDescription()
|
---|
809 | {
|
---|
810 | Integer value = _directory.getInteger(TagNoiseReduction);
|
---|
811 | if (value == null)
|
---|
812 | return null;
|
---|
813 |
|
---|
814 | if (value == 0)
|
---|
815 | return "(none)";
|
---|
816 |
|
---|
817 | StringBuilder sb = new StringBuilder();
|
---|
818 | int v = value;
|
---|
819 |
|
---|
820 | if ((v & 1) != 0) sb.append("Noise Reduction, ");
|
---|
821 | if (((v >> 1) & 1) != 0) sb.append("Noise Filter, ");
|
---|
822 | if (((v >> 2) & 1) != 0) sb.append("Noise Filter (ISO Boost), ");
|
---|
823 | if (((v >> 3) & 1) != 0) sb.append("Auto, ");
|
---|
824 |
|
---|
825 | return sb.length() != 0
|
---|
826 | ? sb.substring(0, sb.length() - 2)
|
---|
827 | : "(none)";
|
---|
828 | }
|
---|
829 |
|
---|
830 | @Nullable
|
---|
831 | public String getDistortionCorrectionDescription()
|
---|
832 | {
|
---|
833 | return getIndexedDescription(TagDistortionCorrection, "Off", "On");
|
---|
834 | }
|
---|
835 |
|
---|
836 | @Nullable
|
---|
837 | public String getShadingCompensationDescription()
|
---|
838 | {
|
---|
839 | return getIndexedDescription(TagShadingCompensation, "Off", "On");
|
---|
840 | }
|
---|
841 |
|
---|
842 | /// <summary>
|
---|
843 | /// 3 or 4 values
|
---|
844 | /// </summary>
|
---|
845 | /// <returns></returns>
|
---|
846 | @Nullable
|
---|
847 | public String getGradationDescription()
|
---|
848 | {
|
---|
849 | int[] values = _directory.getIntArray(TagGradation);
|
---|
850 | if (values == null || values.length < 3)
|
---|
851 | return null;
|
---|
852 |
|
---|
853 | String join = String.format("%d %d %d", values[0], values[1], values[2]);
|
---|
854 |
|
---|
855 | String ret;
|
---|
856 | if (join.equals("0 0 0")) {
|
---|
857 | ret = "n/a";
|
---|
858 | } else if (join.equals("-1 -1 1")) {
|
---|
859 | ret = "Low Key";
|
---|
860 | } else if (join.equals("0 -1 1")) {
|
---|
861 | ret = "Normal";
|
---|
862 | } else if (join.equals("1 -1 1")) {
|
---|
863 | ret = "High Key";
|
---|
864 | } else {
|
---|
865 | ret = "Unknown (" + join + ")";
|
---|
866 | }
|
---|
867 |
|
---|
868 | if (values.length > 3) {
|
---|
869 | if (values[3] == 0)
|
---|
870 | ret += "; User-Selected";
|
---|
871 | else if (values[3] == 1)
|
---|
872 | ret += "; Auto-Override";
|
---|
873 | }
|
---|
874 |
|
---|
875 | return ret;
|
---|
876 | }
|
---|
877 |
|
---|
878 | /// <summary>
|
---|
879 | /// 1 or 2 values
|
---|
880 | /// </summary>
|
---|
881 | /// <returns></returns>
|
---|
882 | @Nullable
|
---|
883 | public String getPictureModeDescription()
|
---|
884 | {
|
---|
885 | int[] values = _directory.getIntArray(TagPictureMode);
|
---|
886 | if (values == null) {
|
---|
887 | // check if it's only one value long also
|
---|
888 | Integer value = _directory.getInteger(TagNoiseReduction);
|
---|
889 | if (value == null)
|
---|
890 | return null;
|
---|
891 |
|
---|
892 | values = new int[]{value};
|
---|
893 | }
|
---|
894 |
|
---|
895 | if (values.length == 0)
|
---|
896 | return null;
|
---|
897 |
|
---|
898 | StringBuilder sb = new StringBuilder();
|
---|
899 | switch (values[0]) {
|
---|
900 | case 1:
|
---|
901 | sb.append("Vivid");
|
---|
902 | break;
|
---|
903 | case 2:
|
---|
904 | sb.append("Natural");
|
---|
905 | break;
|
---|
906 | case 3:
|
---|
907 | sb.append("Muted");
|
---|
908 | break;
|
---|
909 | case 4:
|
---|
910 | sb.append("Portrait");
|
---|
911 | break;
|
---|
912 | case 5:
|
---|
913 | sb.append("i-Enhance");
|
---|
914 | break;
|
---|
915 | case 256:
|
---|
916 | sb.append("Monotone");
|
---|
917 | break;
|
---|
918 | case 512:
|
---|
919 | sb.append("Sepia");
|
---|
920 | break;
|
---|
921 | default:
|
---|
922 | sb.append("Unknown (").append(values[0]).append(")");
|
---|
923 | break;
|
---|
924 | }
|
---|
925 |
|
---|
926 | if (values.length > 1)
|
---|
927 | sb.append("; ").append(values[1]);
|
---|
928 |
|
---|
929 | return sb.toString();
|
---|
930 | }
|
---|
931 |
|
---|
932 | @Nullable
|
---|
933 | public String getPictureModeSaturationDescription()
|
---|
934 | {
|
---|
935 | return getValueMinMaxDescription(TagPictureModeSaturation);
|
---|
936 | }
|
---|
937 |
|
---|
938 | @Nullable
|
---|
939 | public String getPictureModeContrastDescription()
|
---|
940 | {
|
---|
941 | return getValueMinMaxDescription(TagPictureModeContrast);
|
---|
942 | }
|
---|
943 |
|
---|
944 | @Nullable
|
---|
945 | public String getPictureModeSharpnessDescription()
|
---|
946 | {
|
---|
947 | return getValueMinMaxDescription(TagPictureModeSharpness);
|
---|
948 | }
|
---|
949 |
|
---|
950 | @Nullable
|
---|
951 | public String getPictureModeBWFilterDescription()
|
---|
952 | {
|
---|
953 | return getIndexedDescription(TagPictureModeBWFilter,
|
---|
954 | "n/a", "Neutral", "Yellow", "Orange", "Red", "Green");
|
---|
955 | }
|
---|
956 |
|
---|
957 | @Nullable
|
---|
958 | public String getPictureModeToneDescription()
|
---|
959 | {
|
---|
960 | return getIndexedDescription(TagPictureModeTone,
|
---|
961 | "n/a", "Neutral", "Sepia", "Blue", "Purple", "Green");
|
---|
962 | }
|
---|
963 |
|
---|
964 | @Nullable
|
---|
965 | public String getNoiseFilterDescription()
|
---|
966 | {
|
---|
967 | int[] values = _directory.getIntArray(TagNoiseFilter);
|
---|
968 | if (values == null)
|
---|
969 | return null;
|
---|
970 |
|
---|
971 | String join = String.format("%d %d %d", values[0], values[1], values[2]);
|
---|
972 |
|
---|
973 | if (join.equals("0 0 0"))
|
---|
974 | return "n/a";
|
---|
975 | if (join.equals("-2 -2 1"))
|
---|
976 | return "Off";
|
---|
977 | if (join.equals("-1 -2 1"))
|
---|
978 | return "Low";
|
---|
979 | if (join.equals("0 -2 1"))
|
---|
980 | return "Standard";
|
---|
981 | if (join.equals("1 -2 1"))
|
---|
982 | return "High";
|
---|
983 | return "Unknown (" + join + ")";
|
---|
984 | }
|
---|
985 |
|
---|
986 | @Nullable
|
---|
987 | public String getArtFilterDescription()
|
---|
988 | {
|
---|
989 | return getFiltersDescription(TagArtFilter);
|
---|
990 | }
|
---|
991 |
|
---|
992 | @Nullable
|
---|
993 | public String getMagicFilterDescription()
|
---|
994 | {
|
---|
995 | return getFiltersDescription(TagMagicFilter);
|
---|
996 | }
|
---|
997 |
|
---|
998 | @Nullable
|
---|
999 | public String getPictureModeEffectDescription()
|
---|
1000 | {
|
---|
1001 | int[] values = _directory.getIntArray(TagPictureModeEffect);
|
---|
1002 | if (values == null)
|
---|
1003 | return null;
|
---|
1004 |
|
---|
1005 | String key = String.format("%d %d %d", values[0], values[1], values[2]);
|
---|
1006 | if (key.equals("0 0 0"))
|
---|
1007 | return "n/a";
|
---|
1008 | if (key.equals("-1 -1 1"))
|
---|
1009 | return "Low";
|
---|
1010 | if (key.equals("0 -1 1"))
|
---|
1011 | return "Standard";
|
---|
1012 | if (key.equals("1 -1 1"))
|
---|
1013 | return "High";
|
---|
1014 | return "Unknown (" + key + ")";
|
---|
1015 | }
|
---|
1016 |
|
---|
1017 | @Nullable
|
---|
1018 | public String getToneLevelDescription()
|
---|
1019 | {
|
---|
1020 | int[] values = _directory.getIntArray(TagToneLevel);
|
---|
1021 | if (values == null || values.length == 0)
|
---|
1022 | return null;
|
---|
1023 |
|
---|
1024 | StringBuilder sb = new StringBuilder();
|
---|
1025 | for (int i = 0; i < values.length; i++) {
|
---|
1026 | if (i == 0 || i == 4 || i == 8 || i == 12 || i == 16 || i == 20 || i == 24)
|
---|
1027 | sb.append(_toneLevelType.get(values[i])).append("; ");
|
---|
1028 | else
|
---|
1029 | sb.append(values[i]).append("; ");
|
---|
1030 | }
|
---|
1031 |
|
---|
1032 | return sb.substring(0, sb.length() - 2);
|
---|
1033 | }
|
---|
1034 |
|
---|
1035 | @Nullable
|
---|
1036 | public String getArtFilterEffectDescription()
|
---|
1037 | {
|
---|
1038 | int[] values = _directory.getIntArray(TagArtFilterEffect);
|
---|
1039 | if (values == null)
|
---|
1040 | return null;
|
---|
1041 |
|
---|
1042 | StringBuilder sb = new StringBuilder();
|
---|
1043 | for (int i = 0; i < values.length; i++) {
|
---|
1044 | if (i == 0) {
|
---|
1045 | sb.append((_filters.containsKey(values[i]) ? _filters.get(values[i]) : "[unknown]")).append("; ");
|
---|
1046 | } else if (i == 3) {
|
---|
1047 | sb.append("Partial Color ").append(values[i]).append("; ");
|
---|
1048 | } else if (i == 4) {
|
---|
1049 | switch (values[i]) {
|
---|
1050 | case 0x0000:
|
---|
1051 | sb.append("No Effect");
|
---|
1052 | break;
|
---|
1053 | case 0x8010:
|
---|
1054 | sb.append("Star Light");
|
---|
1055 | break;
|
---|
1056 | case 0x8020:
|
---|
1057 | sb.append("Pin Hole");
|
---|
1058 | break;
|
---|
1059 | case 0x8030:
|
---|
1060 | sb.append("Frame");
|
---|
1061 | break;
|
---|
1062 | case 0x8040:
|
---|
1063 | sb.append("Soft Focus");
|
---|
1064 | break;
|
---|
1065 | case 0x8050:
|
---|
1066 | sb.append("White Edge");
|
---|
1067 | break;
|
---|
1068 | case 0x8060:
|
---|
1069 | sb.append("B&W");
|
---|
1070 | break;
|
---|
1071 | default:
|
---|
1072 | sb.append("Unknown (").append(values[i]).append(")");
|
---|
1073 | break;
|
---|
1074 | }
|
---|
1075 | sb.append("; ");
|
---|
1076 | } else if (i == 6) {
|
---|
1077 | switch (values[i]) {
|
---|
1078 | case 0:
|
---|
1079 | sb.append("No Color Filter");
|
---|
1080 | break;
|
---|
1081 | case 1:
|
---|
1082 | sb.append("Yellow Color Filter");
|
---|
1083 | break;
|
---|
1084 | case 2:
|
---|
1085 | sb.append("Orange Color Filter");
|
---|
1086 | break;
|
---|
1087 | case 3:
|
---|
1088 | sb.append("Red Color Filter");
|
---|
1089 | break;
|
---|
1090 | case 4:
|
---|
1091 | sb.append("Green Color Filter");
|
---|
1092 | break;
|
---|
1093 | default:
|
---|
1094 | sb.append("Unknown (").append(values[i]).append(")");
|
---|
1095 | break;
|
---|
1096 | }
|
---|
1097 | sb.append("; ");
|
---|
1098 | } else {
|
---|
1099 | sb.append(values[i]).append("; ");
|
---|
1100 | }
|
---|
1101 | }
|
---|
1102 |
|
---|
1103 | return sb.substring(0, sb.length() - 2);
|
---|
1104 | }
|
---|
1105 |
|
---|
1106 | @Nullable
|
---|
1107 | public String getColorCreatorEffectDescription()
|
---|
1108 | {
|
---|
1109 | int[] values = _directory.getIntArray(TagColorCreatorEffect);
|
---|
1110 | if (values == null)
|
---|
1111 | return null;
|
---|
1112 |
|
---|
1113 | StringBuilder sb = new StringBuilder();
|
---|
1114 | for (int i = 0; i < values.length; i++) {
|
---|
1115 | if (i == 0) {
|
---|
1116 | sb.append("Color ").append(values[i]).append("; ");
|
---|
1117 | } else if (i == 3) {
|
---|
1118 | sb.append("Strength ").append(values[i]).append("; ");
|
---|
1119 | } else {
|
---|
1120 | sb.append(values[i]).append("; ");
|
---|
1121 | }
|
---|
1122 | }
|
---|
1123 |
|
---|
1124 | return sb.substring(0, sb.length() - 2);
|
---|
1125 | }
|
---|
1126 |
|
---|
1127 | /// <summary>
|
---|
1128 | /// 2 or 3 numbers: 1. Mode, 2. Shot number, 3. Mode bits
|
---|
1129 | /// </summary>
|
---|
1130 | /// <returns></returns>
|
---|
1131 | @Nullable
|
---|
1132 | public String getDriveModeDescription()
|
---|
1133 | {
|
---|
1134 | int[] values = _directory.getIntArray(TagDriveMode);
|
---|
1135 | if (values == null)
|
---|
1136 | return null;
|
---|
1137 |
|
---|
1138 | if (values.length == 0 || values[0] == 0)
|
---|
1139 | return "Single Shot";
|
---|
1140 |
|
---|
1141 | StringBuilder a = new StringBuilder();
|
---|
1142 |
|
---|
1143 | if (values[0] == 5 && values.length >= 3) {
|
---|
1144 | int c = values[2];
|
---|
1145 | if (( c & 1) > 0) a.append("AE");
|
---|
1146 | if (((c >> 1) & 1) > 0) a.append("WB");
|
---|
1147 | if (((c >> 2) & 1) > 0) a.append("FL");
|
---|
1148 | if (((c >> 3) & 1) > 0) a.append("MF");
|
---|
1149 | if (((c >> 6) & 1) > 0) a.append("Focus");
|
---|
1150 |
|
---|
1151 | a.append(" Bracketing");
|
---|
1152 | } else {
|
---|
1153 | switch (values[0]) {
|
---|
1154 | case 1:
|
---|
1155 | a.append("Continuous Shooting");
|
---|
1156 | break;
|
---|
1157 | case 2:
|
---|
1158 | a.append("Exposure Bracketing");
|
---|
1159 | break;
|
---|
1160 | case 3:
|
---|
1161 | a.append("White Balance Bracketing");
|
---|
1162 | break;
|
---|
1163 | case 4:
|
---|
1164 | a.append("Exposure+WB Bracketing");
|
---|
1165 | break;
|
---|
1166 | default:
|
---|
1167 | a.append("Unknown (").append(values[0]).append(")");
|
---|
1168 | break;
|
---|
1169 | }
|
---|
1170 | }
|
---|
1171 |
|
---|
1172 | a.append(", Shot ").append(values[1]);
|
---|
1173 |
|
---|
1174 | return a.toString();
|
---|
1175 | }
|
---|
1176 |
|
---|
1177 | /// <summary>
|
---|
1178 | /// 2 numbers: 1. Mode, 2. Shot number
|
---|
1179 | /// </summary>
|
---|
1180 | /// <returns></returns>
|
---|
1181 | @Nullable
|
---|
1182 | public String getPanoramaModeDescription()
|
---|
1183 | {
|
---|
1184 | int[] values = _directory.getIntArray(TagPanoramaMode);
|
---|
1185 | if (values == null)
|
---|
1186 | return null;
|
---|
1187 |
|
---|
1188 | if (values.length == 0 || values[0] == 0)
|
---|
1189 | return "Off";
|
---|
1190 |
|
---|
1191 | String a;
|
---|
1192 | switch (values[0]) {
|
---|
1193 | case 1:
|
---|
1194 | a = "Left to Right";
|
---|
1195 | break;
|
---|
1196 | case 2:
|
---|
1197 | a = "Right to Left";
|
---|
1198 | break;
|
---|
1199 | case 3:
|
---|
1200 | a = "Bottom to Top";
|
---|
1201 | break;
|
---|
1202 | case 4:
|
---|
1203 | a = "Top to Bottom";
|
---|
1204 | break;
|
---|
1205 | default:
|
---|
1206 | a = "Unknown (" + values[0] + ")";
|
---|
1207 | break;
|
---|
1208 | }
|
---|
1209 |
|
---|
1210 | return String.format("%s, Shot %d", a, values[1]);
|
---|
1211 | }
|
---|
1212 |
|
---|
1213 | @Nullable
|
---|
1214 | public String getImageQuality2Description()
|
---|
1215 | {
|
---|
1216 | return getIndexedDescription(TagImageQuality2, 1,
|
---|
1217 | "SQ", "HQ", "SHQ", "RAW", "SQ (5)");
|
---|
1218 | }
|
---|
1219 |
|
---|
1220 | @Nullable
|
---|
1221 | public String getImageStabilizationDescription()
|
---|
1222 | {
|
---|
1223 | return getIndexedDescription(TagImageStabilization,
|
---|
1224 | "Off", "On, Mode 1", "On, Mode 2", "On, Mode 3", "On, Mode 4");
|
---|
1225 | }
|
---|
1226 |
|
---|
1227 | @Nullable
|
---|
1228 | public String getStackedImageDescription()
|
---|
1229 | {
|
---|
1230 | int[] values = _directory.getIntArray(TagStackedImage);
|
---|
1231 | if (values == null || values.length < 2)
|
---|
1232 | return null;
|
---|
1233 |
|
---|
1234 | int v1 = values[0];
|
---|
1235 | int v2 = values[1];
|
---|
1236 |
|
---|
1237 | if (v1 == 0 && v2 == 0)
|
---|
1238 | return "No";
|
---|
1239 | if (v1 == 9 && v2 == 8)
|
---|
1240 | return "Focus-stacked (8 images)";
|
---|
1241 |
|
---|
1242 | return String.format("Unknown (%d %d)", v1, v2);
|
---|
1243 | }
|
---|
1244 |
|
---|
1245 | /// <remarks>
|
---|
1246 | /// TODO: need better image examples to test this function
|
---|
1247 | /// </remarks>
|
---|
1248 | /// <returns></returns>
|
---|
1249 | @Nullable
|
---|
1250 | public String getManometerPressureDescription()
|
---|
1251 | {
|
---|
1252 | Integer value = _directory.getInteger(TagManometerPressure);
|
---|
1253 | if (value == null)
|
---|
1254 | return null;
|
---|
1255 |
|
---|
1256 | return String.format("%s kPa", new DecimalFormat("#.##").format(value / 10.0));
|
---|
1257 | }
|
---|
1258 |
|
---|
1259 | /// <remarks>
|
---|
1260 | /// TODO: need better image examples to test this function
|
---|
1261 | /// </remarks>
|
---|
1262 | /// <returns></returns>
|
---|
1263 | @Nullable
|
---|
1264 | public String getManometerReadingDescription()
|
---|
1265 | {
|
---|
1266 | int[] values = _directory.getIntArray(TagManometerReading);
|
---|
1267 | if (values == null || values.length < 2)
|
---|
1268 | return null;
|
---|
1269 |
|
---|
1270 | DecimalFormat format = new DecimalFormat("#.##");
|
---|
1271 | return String.format("%s m, %s ft",
|
---|
1272 | format.format(values[0] / 10.0),
|
---|
1273 | format.format(values[1] / 10.0));
|
---|
1274 | }
|
---|
1275 |
|
---|
1276 | @Nullable
|
---|
1277 | public String getExtendedWBDetectDescription()
|
---|
1278 | {
|
---|
1279 | return getIndexedDescription(TagExtendedWBDetect, "Off", "On");
|
---|
1280 | }
|
---|
1281 |
|
---|
1282 | /// <summary>
|
---|
1283 | /// converted to degrees of clockwise camera rotation
|
---|
1284 | /// </summary>
|
---|
1285 | /// <remarks>
|
---|
1286 | /// TODO: need better image examples to test this function
|
---|
1287 | /// </remarks>
|
---|
1288 | /// <returns></returns>
|
---|
1289 | @Nullable
|
---|
1290 | public String getRollAngleDescription()
|
---|
1291 | {
|
---|
1292 | int[] values = _directory.getIntArray(TagRollAngle);
|
---|
1293 | if (values == null || values.length < 2)
|
---|
1294 | return null;
|
---|
1295 |
|
---|
1296 | String ret = values[0] != 0
|
---|
1297 | ? Double.toString(-values[0] / 10.0)
|
---|
1298 | : "n/a";
|
---|
1299 |
|
---|
1300 | return String.format("%s %d", ret, values[1]);
|
---|
1301 | }
|
---|
1302 |
|
---|
1303 | /// <summary>
|
---|
1304 | /// converted to degrees of upward camera tilt
|
---|
1305 | /// </summary>
|
---|
1306 | /// <remarks>
|
---|
1307 | /// TODO: need better image examples to test this function
|
---|
1308 | /// </remarks>
|
---|
1309 | /// <returns></returns>
|
---|
1310 | @Nullable
|
---|
1311 | public String getPitchAngleDescription()
|
---|
1312 | {
|
---|
1313 | int[] values = _directory.getIntArray(TagPitchAngle);
|
---|
1314 | if (values == null || values.length < 2)
|
---|
1315 | return null;
|
---|
1316 |
|
---|
1317 | // (second value is 0 if level gauge is off)
|
---|
1318 | String ret = values[0] != 0
|
---|
1319 | ? Double.toString(values[0] / 10.0)
|
---|
1320 | : "n/a";
|
---|
1321 |
|
---|
1322 | return String.format("%s %d", ret, values[1]);
|
---|
1323 | }
|
---|
1324 |
|
---|
1325 | @Nullable
|
---|
1326 | public String getDateTimeUTCDescription()
|
---|
1327 | {
|
---|
1328 | Object value = _directory.getObject(TagDateTimeUtc);
|
---|
1329 | if (value == null)
|
---|
1330 | return null;
|
---|
1331 | return value.toString();
|
---|
1332 | }
|
---|
1333 |
|
---|
1334 | @Nullable
|
---|
1335 | private String getValueMinMaxDescription(int tagId)
|
---|
1336 | {
|
---|
1337 | int[] values = _directory.getIntArray(tagId);
|
---|
1338 | if (values == null || values.length < 3)
|
---|
1339 | return null;
|
---|
1340 |
|
---|
1341 | return String.format("%d (min %d, max %d)", values[0], values[1], values[2]);
|
---|
1342 | }
|
---|
1343 |
|
---|
1344 | @Nullable
|
---|
1345 | private String getFiltersDescription(int tagId)
|
---|
1346 | {
|
---|
1347 | int[] values = _directory.getIntArray(tagId);
|
---|
1348 | if (values == null || values.length == 0)
|
---|
1349 | return null;
|
---|
1350 |
|
---|
1351 | StringBuilder sb = new StringBuilder();
|
---|
1352 | for (int i = 0; i < values.length; i++) {
|
---|
1353 | if (i == 0)
|
---|
1354 | sb.append(_filters.containsKey(values[i]) ? _filters.get(values[i]) : "[unknown]");
|
---|
1355 | else
|
---|
1356 | sb.append(values[i]);
|
---|
1357 | sb.append("; ");
|
---|
1358 | }
|
---|
1359 |
|
---|
1360 | return sb.substring(0, sb.length() - 2);
|
---|
1361 | }
|
---|
1362 |
|
---|
1363 | private static final HashMap<Integer, String> _toneLevelType = new HashMap<Integer, String>();
|
---|
1364 | // ArtFilter, ArtFilterEffect and MagicFilter values
|
---|
1365 | private static final HashMap<Integer, String> _filters = new HashMap<Integer, String>();
|
---|
1366 |
|
---|
1367 | static {
|
---|
1368 | _filters.put(0, "Off");
|
---|
1369 | _filters.put(1, "Soft Focus");
|
---|
1370 | _filters.put(2, "Pop Art");
|
---|
1371 | _filters.put(3, "Pale & Light Color");
|
---|
1372 | _filters.put(4, "Light Tone");
|
---|
1373 | _filters.put(5, "Pin Hole");
|
---|
1374 | _filters.put(6, "Grainy Film");
|
---|
1375 | _filters.put(9, "Diorama");
|
---|
1376 | _filters.put(10, "Cross Process");
|
---|
1377 | _filters.put(12, "Fish Eye");
|
---|
1378 | _filters.put(13, "Drawing");
|
---|
1379 | _filters.put(14, "Gentle Sepia");
|
---|
1380 | _filters.put(15, "Pale & Light Color II");
|
---|
1381 | _filters.put(16, "Pop Art II");
|
---|
1382 | _filters.put(17, "Pin Hole II");
|
---|
1383 | _filters.put(18, "Pin Hole III");
|
---|
1384 | _filters.put(19, "Grainy Film II");
|
---|
1385 | _filters.put(20, "Dramatic Tone");
|
---|
1386 | _filters.put(21, "Punk");
|
---|
1387 | _filters.put(22, "Soft Focus 2");
|
---|
1388 | _filters.put(23, "Sparkle");
|
---|
1389 | _filters.put(24, "Watercolor");
|
---|
1390 | _filters.put(25, "Key Line");
|
---|
1391 | _filters.put(26, "Key Line II");
|
---|
1392 | _filters.put(27, "Miniature");
|
---|
1393 | _filters.put(28, "Reflection");
|
---|
1394 | _filters.put(29, "Fragmented");
|
---|
1395 | _filters.put(31, "Cross Process II");
|
---|
1396 | _filters.put(32, "Dramatic Tone II");
|
---|
1397 | _filters.put(33, "Watercolor I");
|
---|
1398 | _filters.put(34, "Watercolor II");
|
---|
1399 | _filters.put(35, "Diorama II");
|
---|
1400 | _filters.put(36, "Vintage");
|
---|
1401 | _filters.put(37, "Vintage II");
|
---|
1402 | _filters.put(38, "Vintage III");
|
---|
1403 | _filters.put(39, "Partial Color");
|
---|
1404 | _filters.put(40, "Partial Color II");
|
---|
1405 | _filters.put(41, "Partial Color III");
|
---|
1406 |
|
---|
1407 | _toneLevelType.put(0, "0");
|
---|
1408 | _toneLevelType.put(-31999, "Highlights ");
|
---|
1409 | _toneLevelType.put(-31998, "Shadows ");
|
---|
1410 | _toneLevelType.put(-31997, "Midtones ");
|
---|
1411 | }
|
---|
1412 | }
|
---|