Author: post
Date: 2009-08-09 15:55:00 +0200 (Sun, 09 Aug 2009)
New Revision: 103

Modified:
   RawSpeed/DngDecoder.cpp
   RawSpeed/RawDecoder.cpp
   RawSpeed/TiffIFD.cpp
   RawSpeed/TiffIFD.h
   RawSpeed/TiffIFDBE.cpp
Log:
- Properly detect endianness on uncompressed DNGs.

Modified: RawSpeed/DngDecoder.cpp
===================================================================
--- RawSpeed/DngDecoder.cpp     2009-08-09 13:35:53 UTC (rev 102)
+++ RawSpeed/DngDecoder.cpp     2009-08-09 13:55:00 UTC (rev 103)
@@ -187,7 +187,8 @@
           ByteStream in(mFile->getData(slice.offset),slice.count);
           iPoint2D size(width,slice.h);
           iPoint2D pos(0,slice.offsetY);
-          readUncompressedRaw(in,size,pos,width*bps/8,bps,true);
+          gboolean big_endian = (mRootIFD->endian == big);
+          readUncompressedRaw(in,size,pos,width*bps/8,bps,big_endian);
         }
 
       } catch (TiffParserException) {

Modified: RawSpeed/RawDecoder.cpp
===================================================================
--- RawSpeed/RawDecoder.cpp     2009-08-09 13:35:53 UTC (rev 102)
+++ RawSpeed/RawDecoder.cpp     2009-08-09 13:55:00 UTC (rev 103)
@@ -37,7 +37,6 @@
 void RawDecoder::readUncompressedRaw(ByteStream &input, iPoint2D& size, 
iPoint2D& offset, int inputPitch, int bitPerPixel, gboolean MSBOrder) {
   guchar* data = mRaw->getData();
   guint outPitch = mRaw->pitch;
-  const guchar *in = input.getData();
   guint w = size.x;
   guint h = size.y;
   guint cpp = mRaw->getCpp();
@@ -71,6 +70,11 @@
 
   } else {
 
+    if (bitPerPixel==16)  {
+      BitBlt(&data[offset.x*sizeof(gushort)*cpp+y*outPitch],outPitch,
+        input.getData(),inputPitch,w*mRaw->bpp,h-y);
+      return;
+    }
     BitPumpPlain bits(&input);
     w *= cpp;
     for (; y < h; y++) {

Modified: RawSpeed/TiffIFD.cpp
===================================================================
--- RawSpeed/TiffIFD.cpp        2009-08-09 13:35:53 UTC (rev 102)
+++ RawSpeed/TiffIFD.cpp        2009-08-09 13:55:00 UTC (rev 103)
@@ -30,12 +30,14 @@
 
 TiffIFD::TiffIFD() {
   nextIFD = 0;
+  endian = little;
 }
 
 TiffIFD::TiffIFD(FileMap* f, guint offset) 
 {
   guint size = f->getSize();
   guint entries;
+  endian = big;
 
   entries = *(unsigned short*)f->getData(offset);    // Directory entries in 
this IFD
 

Modified: RawSpeed/TiffIFD.h
===================================================================
--- RawSpeed/TiffIFD.h  2009-08-09 13:35:53 UTC (rev 102)
+++ RawSpeed/TiffIFD.h  2009-08-09 13:55:00 UTC (rev 103)
@@ -41,6 +41,7 @@
   vector<TiffIFD*> getIFDsWithTag(TiffTag tag);
   TiffEntry* getEntry(TiffTag tag);
   bool hasEntry(TiffTag tag);
+  Endianness endian;
 protected:
   gint nextIFD;
 };

Modified: RawSpeed/TiffIFDBE.cpp
===================================================================
--- RawSpeed/TiffIFDBE.cpp      2009-08-09 13:35:53 UTC (rev 102)
+++ RawSpeed/TiffIFDBE.cpp      2009-08-09 13:55:00 UTC (rev 103)
@@ -24,10 +24,12 @@
 */
 
 TiffIFDBE::TiffIFDBE() {
+  endian = big;
 }
 
 TiffIFDBE::TiffIFDBE(FileMap* f, guint offset)
 {
+  endian = big;
   int entries;
 
    const unsigned char* data = f->getData(offset);


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

Reply via email to