Author: post
Date: 2012-10-17 18:14:37 +0200 (Wed, 17 Oct 2012)
New Revision: 485

Modified:
   RawSpeed/NefDecoder.cpp
Log:
Support for more Nikon idiocy.

Modified: RawSpeed/NefDecoder.cpp
===================================================================
--- RawSpeed/NefDecoder.cpp     2012-10-16 20:48:14 UTC (rev 484)
+++ RawSpeed/NefDecoder.cpp     2012-10-17 16:14:37 UTC (rev 485)
@@ -28,7 +28,7 @@
 
 NefDecoder::NefDecoder(TiffIFD *rootIFD, FileMap* file) :
     RawDecoder(file), mRootIFD(rootIFD) {
-  decoderVersion = 4;
+  decoderVersion = 5;
 }
 
 NefDecoder::~NefDecoder(void) {
@@ -63,7 +63,7 @@
     }
   }
 
-  if (compression == 1) {
+  if (compression == 1 || (hints.find(string("force_uncompressed")) != 
hints.end())) {
     DecodeUncompressed();
     return mRaw;
   }
@@ -196,6 +196,16 @@
   if (bitPerPixel == 14 && width*slices[0].h*2 == slices[0].count)
     bitPerPixel = 16; // D3
 
+  if(hints.find("real_bpp") != hints.end()) {
+    stringstream convert(hints.find("real_bpp")->second);
+    convert >> bitPerPixel;
+  }
+
+  bool bitorder = true;
+  map<string,string>::iterator msb_hint = hints.find("msb_override");
+  if (msb_hint != hints.end())
+    bitorder = (0 == (msb_hint->second).compare("true"));
+
   offY = 0;
   for (uint32 i = 0; i < slices.size(); i++) {
     NefSlice slice = slices[i];
@@ -208,7 +218,7 @@
       else if (hints.find(string("coolpixsplit")) != hints.end())
         readCoolpixSplitRaw(in, size, pos, width*bitPerPixel / 8);
       else
-        readUncompressedRaw(in, size, pos, width*bitPerPixel / 8, bitPerPixel, 
true);
+        readUncompressedRaw(in, size, pos, width*bitPerPixel / 8, bitPerPixel, 
bitorder);
     } catch (RawDecoderException e) {
       if (i>0)
         mRaw->setError(e.what());


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

Reply via email to