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

Method decodeRawInternal

src/librawspeed/decoders/KdcDecoder.cpp:83–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81}
82
83RawImage KdcDecoder::decodeRawInternal() {
84 if (!mRootIFD->hasEntryRecursive(COMPRESSION))
85 ThrowRDE("Couldn't find compression setting");
86
87 auto compression = mRootIFD->getEntryRecursive(COMPRESSION)->getU32();
88 if (7 != compression)
89 ThrowRDE("Unsupported compression %d", compression);
90
91 TiffEntry* ifdoffset = mRootIFD->getEntryRecursive(KODAK_IFD2);
92 if (!ifdoffset)
93 ThrowRDE("Couldn't find the Kodak IFD offset");
94
95 NORangesSet<Buffer> ifds;
96
97 assert(ifdoffset != nullptr);
98 TiffRootIFD kodakifd(nullptr, &ifds, ifdoffset->getRootIfdData(),
99 ifdoffset->getU32());
100
101 uint32_t width = 0;
102 uint32_t height = 0;
103 TiffEntry* ew = kodakifd.getEntryRecursive(KODAK_KDC_SENSOR_WIDTH);
104 TiffEntry* eh = kodakifd.getEntryRecursive(KODAK_KDC_SENSOR_HEIGHT);
105 if (ew && eh) {
106 width = ew->getU32();
107 height = eh->getU32();
108 } else
109 ThrowRDE("Unable to retrieve image size");
110
111 mRaw->dim = iPoint2D(width, height);
112
113 const Buffer inputBuffer = KdcDecoder::getInputBuffer();
114
115 mRaw->createData();
116
117 UncompressedDecompressor u(
118 ByteStream(DataBuffer(inputBuffer, Endianness::little)), mRaw);
119
120 u.decode12BitRaw<Endianness::big>(width, height);
121
122 return mRaw;
123}
124
125void KdcDecoder::decodeMetaDataInternal(const CameraMetaData* meta) {
126 setMetaData(meta, "", 0);

Callers

nothing calls this directly

Calls 7

createDataMethod · 0.80
iPoint2DClass · 0.70
ByteStreamClass · 0.70
DataBufferClass · 0.50
hasEntryRecursiveMethod · 0.45
getU32Method · 0.45
getEntryRecursiveMethod · 0.45

Tested by

no test coverage detected