Skip to content

Commit

Permalink
Rawspeed: NefDecoder::decodeRawInternal(): don't stack-allocate Nikon…
Browse files Browse the repository at this point in the history
…Decompressor.

Takes almost 140Kb.
  • Loading branch information
LebedevRI committed Oct 5, 2016
1 parent 6eb88ee commit 6eadbde
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/external/rawspeed/RawSpeed/NefDecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,17 +108,18 @@ RawImage NefDecoder::decodeRawInternal() {
}

try {
NikonDecompressor decompressor(mFile, mRaw);
decompressor.uncorrectedRawValues = uncorrectedRawValues;
NikonDecompressor* decompressor = new NikonDecompressor(mFile, mRaw);
decompressor->uncorrectedRawValues = uncorrectedRawValues;
ByteStream* metastream;
if (getHostEndianness() == data[0]->endian)
metastream = new ByteStream(meta->getData(), meta->count);
else
metastream = new ByteStreamSwap(meta->getData(), meta->count);

decompressor.DecompressNikon(metastream, width, height, bitPerPixel, offsets->getInt(), counts->getInt());
decompressor->DecompressNikon(metastream, width, height, bitPerPixel, offsets->getInt(), counts->getInt());

delete metastream;
delete decompressor;
} catch (IOException &e) {
mRaw->setError(e.what());
// Let's ignore it, it may have delivered somewhat useful data.
Expand Down

0 comments on commit 6eadbde

Please sign in to comment.