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

Method decodeMetaDataInternal

src/librawspeed/decoders/OrfDecoder.cpp:213–280  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

211}
212
213void OrfDecoder::decodeMetaDataInternal(const CameraMetaData* meta) {
214 int iso = 0;
215
216 if (mRootIFD->hasEntryRecursive(ISOSPEEDRATINGS))
217 iso = mRootIFD->getEntryRecursive(ISOSPEEDRATINGS)->getU32();
218
219 parseCFA();
220
221 setMetaData(meta, "", iso);
222
223 if (mRootIFD->hasEntryRecursive(OLYMPUSREDMULTIPLIER) &&
224 mRootIFD->hasEntryRecursive(OLYMPUSBLUEMULTIPLIER)) {
225 mRaw->metadata.wbCoeffs[0] = static_cast<float>(
226 mRootIFD->getEntryRecursive(OLYMPUSREDMULTIPLIER)->getU16());
227 mRaw->metadata.wbCoeffs[1] = 256.0F;
228 mRaw->metadata.wbCoeffs[2] = static_cast<float>(
229 mRootIFD->getEntryRecursive(OLYMPUSBLUEMULTIPLIER)->getU16());
230 } else if (mRootIFD->hasEntryRecursive(OLYMPUSIMAGEPROCESSING)) {
231 // Newer cameras process the Image Processing SubIFD in the makernote
232 TiffEntry* img_entry = mRootIFD->getEntryRecursive(OLYMPUSIMAGEPROCESSING);
233 // get makernote ifd with containing Buffer
234 NORangesSet<Buffer> ifds;
235
236 TiffRootIFD image_processing(nullptr, &ifds, img_entry->getRootIfdData(),
237 img_entry->getU32());
238
239 // Get the WB
240 if (image_processing.hasEntry(static_cast<TiffTag>(0x0100))) {
241 TiffEntry* wb = image_processing.getEntry(static_cast<TiffTag>(0x0100));
242 if (wb->count == 2 || wb->count == 4) {
243 mRaw->metadata.wbCoeffs[0] = wb->getFloat(0);
244 mRaw->metadata.wbCoeffs[1] = 256.0F;
245 mRaw->metadata.wbCoeffs[2] = wb->getFloat(1);
246 }
247 }
248
249 // Get the black levels
250 if (image_processing.hasEntry(static_cast<TiffTag>(0x0600))) {
251 TiffEntry* blackEntry =
252 image_processing.getEntry(static_cast<TiffTag>(0x0600));
253 // Order is assumed to be RGGB
254 if (blackEntry->count == 4) {
255 for (int i = 0; i < 4; i++) {
256 auto c = mRaw->cfa.getColorAt(i & 1, i >> 1);
257 int j;
258 switch (c) {
259 case CFA_RED:
260 j = 0;
261 break;
262 case CFA_GREEN:
263 j = i < 2 ? 1 : 2;
264 break;
265 case CFA_BLUE:
266 j = 3;
267 break;
268 default:
269 ThrowRDE("Unexpected CFA color: %u", c);
270 }

Callers

nothing calls this directly

Calls 8

getColorAtMethod · 0.80
hasEntryRecursiveMethod · 0.45
getU32Method · 0.45
getEntryRecursiveMethod · 0.45
getU16Method · 0.45
hasEntryMethod · 0.45
getEntryMethod · 0.45
getFloatMethod · 0.45

Tested by

no test coverage detected