Author: post
Date: 2009-12-30 00:35:16 +0100 (Wed, 30 Dec 2009)
New Revision: 183
Modified:
RawSpeed/DngDecoderSlices.cpp
RawSpeed/IOException.h
RawSpeed/LJpegDecompressor.cpp
RawSpeed/NikonDecompressor.cpp
RawSpeed/PentaxDecompressor.cpp
RawSpeed/RawDecoder.cpp
Log:
Throw non-fatal exceptions, when error occurs while decoding. This may make it
possible to get corrupted images to give partial usable results.
Use fast 12 bit unpacker.
Modified: RawSpeed/DngDecoderSlices.cpp
===================================================================
--- RawSpeed/DngDecoderSlices.cpp 2009-12-27 15:27:39 UTC (rev 182)
+++ RawSpeed/DngDecoderSlices.cpp 2009-12-29 23:35:16 UTC (rev 183)
@@ -100,7 +100,7 @@
} catch (RawDecoderException err) {
setError(err.what());
} catch (IOException err) {
- setError("DngDecoderSlices::decodeSlice: IO error occurred, probably
attempted to read past end of file.");
+ setError("DngDecoderSlices::decodeSlice: IO error occurred.");
}
}
}
Modified: RawSpeed/IOException.h
===================================================================
--- RawSpeed/IOException.h 2009-12-27 15:27:39 UTC (rev 182)
+++ RawSpeed/IOException.h 2009-12-29 23:35:16 UTC (rev 183)
@@ -25,6 +25,9 @@
namespace RawSpeed {
+void ThrowIOE(const char* fmt, ...);
+
+
class IOException : public std::runtime_error
{
public:
Modified: RawSpeed/LJpegDecompressor.cpp
===================================================================
--- RawSpeed/LJpegDecompressor.cpp 2009-12-27 15:27:39 UTC (rev 182)
+++ RawSpeed/LJpegDecompressor.cpp 2009-12-29 23:35:16 UTC (rev 183)
@@ -567,7 +567,7 @@
*/
if (l > frame.prec || htbl->valptr[l] == 0xff) {
- ThrowRDE("Corrupt JPEG data: bad Huffman code:%u", l);
+ ThrowIOE("Corrupt JPEG data: bad Huffman code:%u", l);
} else {
rv = htbl->huffval[htbl->valptr[l] +
((int)(code - htbl->mincode[l]))];
@@ -583,7 +583,7 @@
// Ensure we have enough bits
if ((rv + l) > 24) {
if (rv > 16) // There is no values above 16 bits.
- ThrowRDE("Corrupt JPEG data: Too many bits requested.");
+ ThrowIOE("Corrupt JPEG data: Too many bits requested.");
else
bits->fill();
}
Modified: RawSpeed/NikonDecompressor.cpp
===================================================================
--- RawSpeed/NikonDecompressor.cpp 2009-12-27 15:27:39 UTC (rev 182)
+++ RawSpeed/NikonDecompressor.cpp 2009-12-29 23:35:16 UTC (rev 183)
@@ -124,7 +124,7 @@
pLeft1 += HuffDecodeNikon();
pLeft2 += HuffDecodeNikon();
if (pLeft1 < 0 || pLeft1 > 65535 || pLeft2 < 0 || pLeft2 > 65535)
- ThrowRDE("DecompressNikon: Image value out of range. Corrupt image.");
+ ThrowIOE("DecompressNikon: Image value out of range. Corrupt image.");
dest[x] = curve[pLeft1] | (curve[pLeft2] << 16);
}
}
@@ -178,7 +178,7 @@
}
if (l > 16) {
- ThrowRDE("Corrupt JPEG data: bad Huffman code:%u\n", l);
+ ThrowIOE("Corrupt JPEG data: bad Huffman code:%u\n", l);
} else {
rv = dctbl1->huffval[dctbl1->valptr[l] +
((int)(code - dctbl1->mincode[l]))];
Modified: RawSpeed/PentaxDecompressor.cpp
===================================================================
--- RawSpeed/PentaxDecompressor.cpp 2009-12-27 15:27:39 UTC (rev 182)
+++ RawSpeed/PentaxDecompressor.cpp 2009-12-29 23:35:16 UTC (rev 183)
@@ -140,7 +140,7 @@
*/
if (l > 12) {
- ThrowRDE("Corrupt JPEG data: bad Huffman code:%u\n", l);
+ ThrowIOE("Corrupt JPEG data: bad Huffman code:%u\n", l);
} else {
rv = dctbl1->huffval[dctbl1->valptr[l] +
((int)(code - dctbl1->mincode[l]))];
Modified: RawSpeed/RawDecoder.cpp
===================================================================
--- RawSpeed/RawDecoder.cpp 2009-12-27 15:27:39 UTC (rev 182)
+++ RawSpeed/RawDecoder.cpp 2009-12-29 23:35:16 UTC (rev 183)
@@ -77,6 +77,10 @@
input.getData(), inputPitch, w*mRaw->bpp, h - y);
return;
}
+ if (bitPerPixel == 12) {
+ Decode12BitRaw(input, w, h);
+ return;
+ }
BitPumpPlain bits(&input);
w *= cpp;
for (; y < h; y++) {
_______________________________________________
Rawstudio-commit mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-commit