Author: post
Date: 2012-09-15 12:19:16 +0200 (Sat, 15 Sep 2012)
New Revision: 455

Modified:
   RawSpeed/Cr2Decoder.cpp
Log:
Add option to invert applied WB on Canon mRaw/sRAW & Read hints/decoder version 
from sRaw1 if subsampled.

Modified: RawSpeed/Cr2Decoder.cpp
===================================================================
--- RawSpeed/Cr2Decoder.cpp     2012-09-15 08:47:56 UTC (rev 454)
+++ RawSpeed/Cr2Decoder.cpp     2012-09-15 10:19:16 UTC (rev 455)
@@ -28,7 +28,7 @@
 
 Cr2Decoder::Cr2Decoder(TiffIFD *rootIFD, FileMap* file) :
     RawDecoder(file), mRootIFD(rootIFD) {
-  decoderVersion = 1;
+  decoderVersion = 2;
 }
 
 Cr2Decoder::~Cr2Decoder(void) {
@@ -142,6 +142,20 @@
     ThrowRDE("CR2 Support: Make name not found");
   string make = data[0]->getEntry(MAKE)->getString();
   string model = data[0]->getEntry(MODEL)->getString();
+  data = mRootIFD->getIFDsWithTag((TiffTag)0xc5d8);
+
+  if (data.empty())
+    ThrowRDE("CR2 Decoder: No image data found");
+
+  TiffIFD* raw = data[0];
+
+  if (raw->hasEntry((TiffTag)0xc6c5)) {
+    ushort16 ss = raw->getEntry((TiffTag)0xc6c5)->getInt();
+    if (ss == 4) {
+      this->checkCameraSupported(meta, make, model, "sRaw1");
+      return;
+    }
+  }
   this->checkCameraSupported(meta, make, model, "");
 }
 
@@ -197,6 +211,11 @@
   sraw_coeffs[1] = (wb_data[1] + wb_data[2] + 1) >> 1;
   sraw_coeffs[2] = wb_data[3];
 
+  if (hints.find("invert_sraw_wb") != hints.end()) {
+    sraw_coeffs[0] = (int)(1024.0f/((float)sraw_coeffs[0]/1024.0f));
+    sraw_coeffs[2] = (int)(1024.0f/((float)sraw_coeffs[2]/1024.0f));
+  }
+
   /* Determine sRaw coefficients */
   bool isOldSraw = hints.find("sraw_40d") != hints.end();
   bool isNewSraw = hints.find("sraw_new") != hints.end();


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

Reply via email to