Author: post
Date: 2012-10-12 13:18:47 +0200 (Fri, 12 Oct 2012)
New Revision: 478

Modified:
   RawSpeed/NikonDecompressor.cpp
   RawSpeed/NikonDecompressor.h
Log:
Use 16 bit values for Nikon lookup table, for greater chance of L1 cache hits.

Modified: RawSpeed/NikonDecompressor.cpp
===================================================================
--- RawSpeed/NikonDecompressor.cpp      2012-10-09 12:23:37 UTC (rev 477)
+++ RawSpeed/NikonDecompressor.cpp      2012-10-12 11:18:47 UTC (rev 478)
@@ -99,7 +99,7 @@
   mRaw->whitePoint = curve[_max-1];
   mRaw->blackLevel = curve[0];
 
-  uint32 top = mRaw->whitePoint;
+  ushort16 top = mRaw->whitePoint;
   for (int i = _max; i < 0x8000; i++)
     curve[i] = top;
 
@@ -122,12 +122,12 @@
     pUp2[y&1] += HuffDecodeNikon();
     pLeft1 = pUp1[y&1];
     pLeft2 = pUp2[y&1];
-    dest[0] = curve[pLeft1&0x7fff] | (curve[pLeft2&0x7fff] << 16);
+    dest[0] = curve[pLeft1&0x7fff] | ((uint32)curve[pLeft2&0x7fff] << 16);
     for (x = 1; x < cw; x++) {
       bits->checkPos();
       pLeft1 += HuffDecodeNikon();
       pLeft2 += HuffDecodeNikon();
-      dest[x] = curve[pLeft1&0x7fff] | (curve[pLeft2&0x7fff] << 16);
+      dest[x] = curve[pLeft1&0x7fff] | ((uint32)curve[pLeft2&0x7fff] << 16);
     }
   }
 }

Modified: RawSpeed/NikonDecompressor.h
===================================================================
--- RawSpeed/NikonDecompressor.h        2012-10-09 12:23:37 UTC (rev 477)
+++ RawSpeed/NikonDecompressor.h        2012-10-12 11:18:47 UTC (rev 478)
@@ -38,7 +38,7 @@
 private:
   void initTable(uint32 huffSelect);
   int HuffDecodeNikon();
-  uint32 curve[0x8000];
+  ushort16 curve[0x8000];
   BitPumpMSB *bits;
 };
 


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

Reply via email to