source: josm/trunk/src/com/drew/metadata/exif/makernotes/OlympusRawDevelopmentMakernoteDescriptor.java@ 13061

Last change on this file since 13061 was 13061, checked in by Don-vip, 6 years ago

fix #15505 - update to metadata-extractor 2.10.1

  • Property svn:eol-style set to native
File size: 4.9 KB
Line 
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 */
21package com.drew.metadata.exif.makernotes;
22
23import com.drew.lang.annotations.NotNull;
24import com.drew.lang.annotations.Nullable;
25import com.drew.metadata.TagDescriptor;
26
27import static com.drew.metadata.exif.makernotes.OlympusRawDevelopmentMakernoteDirectory.*;
28
29/**
30 * Provides human-readable String representations of tag values stored in a {@link OlympusRawDevelopmentMakernoteDirectory}.
31 * <p>
32 * Some Description functions converted from Exiftool version 10.10 created by Phil Harvey
33 * http://www.sno.phy.queensu.ca/~phil/exiftool/
34 * lib\Image\ExifTool\Olympus.pm
35 *
36 * @author Kevin Mott https://github.com/kwhopper
37 * @author Drew Noakes https://drewnoakes.com
38 */
39@SuppressWarnings("WeakerAccess")
40public class OlympusRawDevelopmentMakernoteDescriptor extends TagDescriptor<OlympusRawDevelopmentMakernoteDirectory>
41{
42 public OlympusRawDevelopmentMakernoteDescriptor(@NotNull OlympusRawDevelopmentMakernoteDirectory directory)
43 {
44 super(directory);
45 }
46
47 @Override
48 @Nullable
49 public String getDescription(int tagType)
50 {
51 switch (tagType) {
52 case TagRawDevVersion:
53 return getRawDevVersionDescription();
54 case TagRawDevColorSpace:
55 return getRawDevColorSpaceDescription();
56 case TagRawDevEngine:
57 return getRawDevEngineDescription();
58 case TagRawDevNoiseReduction:
59 return getRawDevNoiseReductionDescription();
60 case TagRawDevEditStatus:
61 return getRawDevEditStatusDescription();
62 case TagRawDevSettings:
63 return getRawDevSettingsDescription();
64 default:
65 return super.getDescription(tagType);
66 }
67 }
68
69 @Nullable
70 public String getRawDevVersionDescription()
71 {
72 return getVersionBytesDescription(TagRawDevVersion, 4);
73 }
74
75 @Nullable
76 public String getRawDevColorSpaceDescription()
77 {
78 return getIndexedDescription(TagRawDevColorSpace,
79 "sRGB", "Adobe RGB", "Pro Photo RGB");
80 }
81
82 @Nullable
83 public String getRawDevEngineDescription()
84 {
85 return getIndexedDescription(TagRawDevEngine,
86 "High Speed", "High Function", "Advanced High Speed", "Advanced High Function");
87 }
88
89 @Nullable
90 public String getRawDevNoiseReductionDescription()
91 {
92 Integer value = _directory.getInteger(TagRawDevNoiseReduction);
93 if (value == null)
94 return null;
95
96 if (value == 0)
97 return "(none)";
98
99 StringBuilder sb = new StringBuilder();
100 int v = value;
101
102 if ((v & 1) != 0) sb.append("Noise Reduction, ");
103 if (((v >> 1) & 1) != 0) sb.append("Noise Filter, ");
104 if (((v >> 2) & 1) != 0) sb.append("Noise Filter (ISO Boost), ");
105
106 return sb.substring(0, sb.length() - 2);
107 }
108
109 @Nullable
110 public String getRawDevEditStatusDescription()
111 {
112 Integer value = _directory.getInteger(TagRawDevEditStatus);
113 if (value == null)
114 return null;
115
116 switch (value)
117 {
118 case 0:
119 return "Original";
120 case 1:
121 return "Edited (Landscape)";
122 case 6:
123 case 8:
124 return "Edited (Portrait)";
125 default:
126 return "Unknown (" + value + ")";
127 }
128 }
129
130 @Nullable
131 public String getRawDevSettingsDescription()
132 {
133 Integer value = _directory.getInteger(TagRawDevSettings);
134 if (value == null)
135 return null;
136
137 if (value == 0)
138 return "(none)";
139
140 StringBuilder sb = new StringBuilder();
141 int v = value;
142
143 if ((v & 1) != 0) sb.append("WB Color Temp, ");
144 if (((v >> 1) & 1) != 0) sb.append("WB Gray Point, ");
145 if (((v >> 2) & 1) != 0) sb.append("Saturation, ");
146 if (((v >> 3) & 1) != 0) sb.append("Contrast, ");
147 if (((v >> 4) & 1) != 0) sb.append("Sharpness, ");
148 if (((v >> 5) & 1) != 0) sb.append("Color Space, ");
149 if (((v >> 6) & 1) != 0) sb.append("High Function, ");
150 if (((v >> 7) & 1) != 0) sb.append("Noise Reduction, ");
151
152 return sb.substring(0, sb.length() - 2);
153 }
154
155}
Note: See TracBrowser for help on using the repository browser.