Author: post
Date: 2010-07-05 23:56:16 +0200 (Mon, 05 Jul 2010)
New Revision: 251

Modified:
   RawSpeed/NefDecoder.cpp
   RawSpeed/NikonDecompressor.cpp
   RawSpeed/NikonDecompressor.h
Log:
More fix for Nikon.

Modified: RawSpeed/NefDecoder.cpp
===================================================================
--- RawSpeed/NefDecoder.cpp     2010-07-05 21:27:53 UTC (rev 250)
+++ RawSpeed/NefDecoder.cpp     2010-07-05 21:56:16 UTC (rev 251)
@@ -112,13 +112,15 @@
     NikonDecompressor decompressor(mFile, mRaw);
 
     // Nikon is JPEG (Big Endian) byte order
+    ByteStream* metastream;
     if (getHostEndianness() == big)
-      decompressor.DecompressNikon(ByteStream(meta->getData(), meta->count), 
-                                   width, height, bitPerPixel, 
offsets->getInt(), counts->getInt());
+      metastream = new ByteStream(meta->getData(), meta->count);
     else
-      decompressor.DecompressNikon(ByteStreamSwap(meta->getData(), 
meta->count), 
-                                   width, height, bitPerPixel, 
offsets->getInt(), counts->getInt());
+      metastream = new ByteStreamSwap(meta->getData(), meta->count);
 
+    decompressor.DecompressNikon(metastream, width, height, bitPerPixel, 
offsets->getInt(), counts->getInt());
+
+    delete metastream;
   } catch (IOException e) {
     errors.push_back(_strdup(e.what()));
     // Let's ignore it, it may have delivered somewhat useful data.

Modified: RawSpeed/NikonDecompressor.cpp
===================================================================
--- RawSpeed/NikonDecompressor.cpp      2010-07-05 21:27:53 UTC (rev 250)
+++ RawSpeed/NikonDecompressor.cpp      2010-07-05 21:56:16 UTC (rev 251)
@@ -53,9 +53,9 @@
   createHuffmanTable(dctbl1);
 }
 
-void NikonDecompressor::DecompressNikon(ByteStream metadata, uint32 w, uint32 
h, uint32 bitsPS, uint32 offset, uint32 size) {
-  uint32 v0 = metadata.getByte();
-  uint32 v1 = metadata.getByte();
+void NikonDecompressor::DecompressNikon(ByteStream *metadata, uint32 w, uint32 
h, uint32 bitsPS, uint32 offset, uint32 size) {
+  uint32 v0 = metadata->getByte();
+  uint32 v1 = metadata->getByte();
   uint32 huffSelect = 0;
   uint32 split = 0;
   int pUp1[2];
@@ -65,32 +65,32 @@
   _RPT2(0, "Nef version v0:%u, v1:%u\n", v0, v1);
 
   if (v0 == 73 || v1 == 88)
-    metadata.skipBytes(2110);
+    metadata->skipBytes(2110);
 
   if (v0 == 70) huffSelect = 2;
   if (bitsPS == 14) huffSelect += 3;
 
-  pUp1[0] = metadata.getShort();
-  pUp1[1] = metadata.getShort();
-  pUp2[0] = metadata.getShort();
-  pUp2[1] = metadata.getShort();
+  pUp1[0] = metadata->getShort();
+  pUp1[1] = metadata->getShort();
+  pUp2[0] = metadata->getShort();
+  pUp2[1] = metadata->getShort();
 
   uint32 _max = 1 << bitsPS & 0x7fff;
   uint32 step = 0;
-  uint32 csize = metadata.getShort();
+  uint32 csize = metadata->getShort();
   if (csize  > 1)
     step = _max / (csize - 1);
   if (v0 == 68 && v1 == 32 && step > 0) {
     for (uint32 i = 0; i < csize; i++)
-      curve[i*step] = metadata.getShort();
+      curve[i*step] = metadata->getShort();
     for (uint32 i = 0; i < _max; i++)
       curve[i] = (curve[i-i%step] * (step - i % step) +
                   curve[i-i%step+step] * (i % step)) / step;
-    metadata.setAbsoluteOffset(562);
-    split = metadata.getShort();
+    metadata->setAbsoluteOffset(562);
+    split = metadata->getShort();
   } else if (v0 != 70 && csize <= 0x4001) {
     for (uint32 i = 0; i < csize; i++) {
-      curve[i] = metadata.getShort();
+      curve[i] = metadata->getShort();
     }
     _max = csize;
   }

Modified: RawSpeed/NikonDecompressor.h
===================================================================
--- RawSpeed/NikonDecompressor.h        2010-07-05 21:27:53 UTC (rev 250)
+++ RawSpeed/NikonDecompressor.h        2010-07-05 21:56:16 UTC (rev 251)
@@ -32,7 +32,7 @@
   NikonDecompressor(FileMap* file, RawImage img );
 public:
   virtual ~NikonDecompressor(void);
-  void DecompressNikon(ByteStream meta, uint32 w, uint32 h, uint32 bitsPS, 
uint32 offset, uint32 size);
+  void DecompressNikon(ByteStream *meta, uint32 w, uint32 h, uint32 bitsPS, 
uint32 offset, uint32 size);
 private:
   void initTable(uint32 huffSelect);
   int HuffDecodeNikon();


_______________________________________________
Rawstudio-commit mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-commit

Reply via email to