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

Method decodeRawInternal

src/librawspeed/decoders/PefDecoder.cpp:52–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50}
51
52RawImage PefDecoder::decodeRawInternal() {
53 const auto* raw = mRootIFD->getIFDWithTag(STRIPOFFSETS);
54
55 int compression = raw->getEntry(COMPRESSION)->getU32();
56
57 if (1 == compression || compression == 32773) {
58 decodeUncompressed(raw, BitOrder_MSB);
59 return mRaw;
60 }
61
62 if (65535 != compression)
63 ThrowRDE("Unsupported compression");
64
65 TiffEntry *offsets = raw->getEntry(STRIPOFFSETS);
66 TiffEntry *counts = raw->getEntry(STRIPBYTECOUNTS);
67
68 if (offsets->count != 1) {
69 ThrowRDE("Multiple Strips found: %u", offsets->count);
70 }
71 if (counts->count != offsets->count) {
72 ThrowRDE(
73 "Byte count number does not match strip size: count:%u, strips:%u ",
74 counts->count, offsets->count);
75 }
76 ByteStream bs(
77 DataBuffer(mFile->getSubView(offsets->getU32(), counts->getU32()),
78 Endianness::little));
79
80 uint32_t width = raw->getEntry(IMAGEWIDTH)->getU32();
81 uint32_t height = raw->getEntry(IMAGELENGTH)->getU32();
82
83 mRaw->dim = iPoint2D(width, height);
84
85 ByteStream* metaData = nullptr;
86 ByteStream stream;
87 if (getRootIFD()->hasEntryRecursive(static_cast<TiffTag>(0x220))) {
88 /* Attempt to read huffman table, if found in makernote */
89 TiffEntry* t = getRootIFD()->getEntryRecursive(static_cast<TiffTag>(0x220));
90 if (t->type != TIFF_UNDEFINED)
91 ThrowRDE("Unknown Huffman table type.");
92
93 stream = t->getData();
94 metaData = &stream;
95 }
96
97 PentaxDecompressor p(mRaw, metaData);
98 mRaw->createData();
99 p.decompress(bs);
100
101 return mRaw;
102}
103
104void PefDecoder::decodeMetaDataInternal(const CameraMetaData* meta) {
105 int iso = 0;

Callers

nothing calls this directly

Calls 11

getIFDWithTagMethod · 0.80
getSubViewMethod · 0.80
createDataMethod · 0.80
iPoint2DClass · 0.70
DataBufferClass · 0.50
getU32Method · 0.45
getEntryMethod · 0.45
hasEntryRecursiveMethod · 0.45
getEntryRecursiveMethod · 0.45
getDataMethod · 0.45
decompressMethod · 0.45

Tested by

no test coverage detected