Author: post
Date: 2013-03-17 13:24:18 +0100 (Sun, 17 Mar 2013)
New Revision: 522

Modified:
   RawSpeed/ArwDecoder.cpp
   RawSpeed/ArwDecoder.h
Log:
Sony decoder: Adjust for uncompressed scale difference while upscaling colors - 
this gives better dithering on 12 bit uncompressed images.

Modified: RawSpeed/ArwDecoder.cpp
===================================================================
--- RawSpeed/ArwDecoder.cpp     2013-03-17 11:10:53 UTC (rev 521)
+++ RawSpeed/ArwDecoder.cpp     2013-03-17 12:24:18 UTC (rev 522)
@@ -26,7 +26,7 @@
 
 ArwDecoder::ArwDecoder(TiffIFD *rootIFD, FileMap* file) :
     RawDecoder(file), mRootIFD(rootIFD) {
-
+  mShiftDownScale = 0;
 }
 
 ArwDecoder::~ArwDecoder(void) {
@@ -166,12 +166,13 @@
       for (uint32 x = 0 ; x < w; x += 2) {
         uint32 g1 = *in++;
         uint32 g2 = *in++;
-        // Shift up to match compressed precision
-        dest[x] = (g1 | ((g2 & 0xf) << 8)) << 2;
+        dest[x] = (g1 | ((g2 & 0xf) << 8));
         uint32 g3 = *in++;
-        dest[x+1] = ((g2 >> 4) | (g3 << 4)) << 2;
+        dest[x+1] = ((g2 >> 4) | (g3 << 4));
       }
     }
+    // Shift scales, since black and white are the same as compressed precision
+    mShiftDownScale = 2;
     return;
   }
   ThrowRDE("Unsupported bit depth");
@@ -205,6 +206,8 @@
     iso = mRootIFD->getEntryRecursive(ISOSPEEDRATINGS)->getInt();
 
   setMetaData(meta, make, model, "", iso);
+  mRaw->whitePoint >>= mShiftDownScale;
+  mRaw->blackLevel >>= mShiftDownScale;
 }
 
 /* Since ARW2 compressed images have predictable offsets, we decode them 
threaded */

Modified: RawSpeed/ArwDecoder.h
===================================================================
--- RawSpeed/ArwDecoder.h       2013-03-17 11:10:53 UTC (rev 521)
+++ RawSpeed/ArwDecoder.h       2013-03-17 12:24:18 UTC (rev 522)
@@ -45,6 +45,7 @@
   TiffIFD *mRootIFD;
   uint32 curve[0x4001];
   ByteStream *in;
+  int mShiftDownScale;
 };
 
 } // namespace RawSpeed


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

Reply via email to