Author: post
Date: 2009-08-27 20:58:41 +0200 (Thu, 27 Aug 2009)
New Revision: 125

Modified:
   RawSpeed/ArwDecoder.cpp
   cameras.xml
Log:
Fixed and enabled Sony A500 and A700 support.

Modified: RawSpeed/ArwDecoder.cpp
===================================================================
--- RawSpeed/ArwDecoder.cpp     2009-08-27 18:47:01 UTC (rev 124)
+++ RawSpeed/ArwDecoder.cpp     2009-08-27 18:58:41 UTC (rev 125)
@@ -125,29 +125,30 @@
   guchar* data = mRaw->getData();
   guint pitch = mRaw->pitch;
   if (bpp == 8) {
-    gushort pix[16];
     BitPumpPlain bits(&input);
     for (guint y = 0; y < h; y++ ) {
       gushort* dest = (gushort*)&data[y*pitch];
       bits.setAbsoluteOffset((w*bpp*y)>>3); // Realign
-      for (guint x = 0; x < w-30; ) { // Process 32 pixels (16x2) per loop.
+      // Process 32 pixels (16x2) per loop.
+      for (guint x = 0; x < w-30; ) { 
         bits.checkPos();
         gint _max = bits.getBits(11);
         gint _min = bits.getBits(11);
         gint _imax = bits.getBits(4);
         gint _imin = bits.getBits(4);
-        guint sh;
-        for (sh=0; sh < 4 && 0x80 << sh <= _max-_min; sh++);
-        for (guint i=0; i < 16; i++) {
-          if      ((gint)i == _imax) pix[i] = _max;
-          else if ((gint)i == _imin) pix[i] = _min;
+        gint sh;
+        for (sh = 0; sh < 4 && 0x80 << sh <= _max-_min; sh++);
+        for (gint i = 0; i < 16; i++) {
+          gint p;
+          if (i == _imax) p = _max;
+          else if (i == _imin) p = _min;
           else {
-            pix[i] = (bits.getBits(7) << sh) + _min;
-            if (pix[i] > 0x7ff) pix[i] = 0x7ff;
+            p = (bits.getBits(7) << sh) + _min;
+            if (p > 0x7ff)
+              p = 0x7ff;
           }
+          dest[x+i*2] = curve[p << 1];
         }
-        for (guint i=0; i < 16; i++)
-          dest[x+i*2] = curve[pix[i] << 1] >> 1;
         x += x & 1 ? 31 : 1;  // Skip to next 32 pixels
       }
     }
@@ -165,9 +166,10 @@
       for(guint x =0 ; x < w; x+=2) {
         guint g1 = *in++;
         guint g2 = *in++;
-        dest[x] = curve[g1 | ((g2&0xf)<<8)];
+        // Shift up to match compressed precision
+        dest[x] = (g1 | ((g2&0xf)<<8)) << 2;  
         guint g3 = *in++;
-        dest[x+1] = curve[(g2>>2) | (g3<<4)];
+        dest[x+1] = ((g2>>4) | (g3<<4)) << 2;
       }
     }
     return;

Modified: cameras.xml
===================================================================
--- cameras.xml 2009-08-27 18:47:01 UTC (rev 124)
+++ cameras.xml 2009-08-27 18:58:41 UTC (rev 125)
@@ -793,7 +793,7 @@
     <Crop x="0" y="0" width="4599" height="3064"/>
     <Sensor black="0" white="4095"/>
   </Camera>
-  <Camera make="SONY" model="DSLR-A700" supported="no">
+  <Camera make="SONY" model="DSLR-A700" supported="yes">
     <CFA width="2" height="2">
       <Color x="1" y="1">BLUE</Color>
       <Color x="1" y="0">GREEN</Color>
@@ -801,9 +801,9 @@
       <Color x="0" y="0">RED</Color>
     </CFA>
     <Crop x="0" y="0" width="4288" height="2856"/>
-    <Sensor black="512" white="4095"/>
+    <Sensor black="520" white="16383"/>
   </Camera>
-  <Camera make="SONY" model="DSLR-A900" supported="no">
+  <Camera make="SONY" model="DSLR-A900" supported="yes">
     <CFA width="2" height="2">
       <Color x="0" y="0">RED</Color>
       <Color x="1" y="0">GREEN</Color>
@@ -811,6 +811,6 @@
       <Color x="1" y="1">BLUE</Color>
     </CFA>
     <Crop x="0" y="0" width="6080" height="4048"/>
-    <Sensor black="150" white="4095"/>
+    <Sensor black="520" white="16383"/>
   </Camera>
 </Cameras>


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

Reply via email to