MCPcopy Create free account
hub / github.com/darktable-org/rawspeed / decodeMetaDataInternal

Method decodeMetaDataInternal

src/librawspeed/decoders/KdcDecoder.cpp:125–165  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

123}
124
125void KdcDecoder::decodeMetaDataInternal(const CameraMetaData* meta) {
126 setMetaData(meta, "", 0);
127
128 // Try the kodak hidden IFD for WB
129 if (mRootIFD->hasEntryRecursive(KODAK_IFD2)) {
130 TiffEntry *ifdoffset = mRootIFD->getEntryRecursive(KODAK_IFD2);
131 try {
132 NORangesSet<Buffer> ifds;
133
134 TiffRootIFD kodakifd(nullptr, &ifds, ifdoffset->getRootIfdData(),
135 ifdoffset->getU32());
136
137 if (kodakifd.hasEntryRecursive(KODAK_KDC_WB)) {
138 TiffEntry *wb = kodakifd.getEntryRecursive(KODAK_KDC_WB);
139 if (wb->count == 3) {
140 mRaw->metadata.wbCoeffs[0] = wb->getFloat(0);
141 mRaw->metadata.wbCoeffs[1] = wb->getFloat(1);
142 mRaw->metadata.wbCoeffs[2] = wb->getFloat(2);
143 }
144 }
145 } catch (TiffParserException &e) {
146 mRaw->setError(e.what());
147 }
148 }
149
150 // Use the normal WB if available
151 if (mRootIFD->hasEntryRecursive(KODAKWB)) {
152 TiffEntry *wb = mRootIFD->getEntryRecursive(KODAKWB);
153 if (wb->count == 734 || wb->count == 1502) {
154 mRaw->metadata.wbCoeffs[0] =
155 static_cast<float>(((static_cast<uint16_t>(wb->getByte(148))) << 8) |
156 wb->getByte(149)) /
157 256.0F;
158 mRaw->metadata.wbCoeffs[1] = 1.0F;
159 mRaw->metadata.wbCoeffs[2] =
160 static_cast<float>(((static_cast<uint16_t>(wb->getByte(150))) << 8) |
161 wb->getByte(151)) /
162 256.0F;
163 }
164 }
165}
166
167} // namespace rawspeed

Callers

nothing calls this directly

Calls 6

setErrorMethod · 0.80
hasEntryRecursiveMethod · 0.45
getEntryRecursiveMethod · 0.45
getU32Method · 0.45
getFloatMethod · 0.45
getByteMethod · 0.45

Tested by

no test coverage detected