Author: post
Date: 2011-03-19 18:17:11 +0100 (Sat, 19 Mar 2011)
New Revision: 342

Modified:
   RawSpeed/Common.h
   RawSpeed/RawDecoder.cpp
   RawSpeed/RawDecoder.h
Log:
Allow to specify uncompressed byte order, and move space trimming to Common 
functions.

Modified: RawSpeed/Common.h
===================================================================
--- RawSpeed/Common.h   2011-03-07 22:05:14 UTC (rev 341)
+++ RawSpeed/Common.h   2011-03-19 17:17:11 UTC (rev 342)
@@ -119,5 +119,19 @@
 }
 inline uint32 clampbits(int x, uint32 n) { uint32 _y_temp; if( (_y_temp=x>>n) 
) x = ~_y_temp >> (32-n); return x;}
 
+/* Remove all spaces at the end of a string */
 
+inline void TrimSpaces(string& str) {
+  // Trim Both leading and trailing spaces
+  size_t startpos = str.find_first_not_of(" \t"); // Find the first character 
position after excluding leading blank spaces
+  size_t endpos = str.find_last_not_of(" \t"); // Find the first character 
position from reverse af
+
+  // if all spaces or empty return an empty string
+  if ((string::npos == startpos) || (string::npos == endpos)) {
+    str = "";
+  } else
+    str = str.substr(startpos, endpos - startpos + 1);
+}
+
+
 } // namespace RawSpeed

Modified: RawSpeed/RawDecoder.cpp
===================================================================
--- RawSpeed/RawDecoder.cpp     2011-03-07 22:05:14 UTC (rev 341)
+++ RawSpeed/RawDecoder.cpp     2011-03-19 17:17:11 UTC (rev 342)
@@ -35,7 +35,7 @@
   errors.clear();
 }
 
-void RawDecoder::decodeUncompressed(TiffIFD *rawIFD) {
+void RawDecoder::decodeUncompressed(TiffIFD *rawIFD, bool MSBOrder) {
   uint32 nslices = rawIFD->getEntry(STRIPOFFSETS)->count;
   const uint32 *offsets = rawIFD->getEntry(STRIPOFFSETS)->getIntArray();
   const uint32 *counts = rawIFD->getEntry(STRIPBYTECOUNTS)->getIntArray();
@@ -78,7 +78,7 @@
     iPoint2D pos(0, offY);
     bitPerPixel = (int)((uint64)(slice.count * 8) / (slice.h * width));
     try {
-        readUncompressedRaw(in, size, pos, width*bitPerPixel / 8, bitPerPixel, 
true);
+      readUncompressedRaw(in, size, pos, width*bitPerPixel / 8, bitPerPixel, 
MSBOrder);
     } catch (RawDecoderException e) {
       if (i>0)
         errors.push_back(_strdup(e.what()));
@@ -234,19 +234,7 @@
 
 }
 
-void RawDecoder::TrimSpaces(string& str) {
-  // Trim Both leading and trailing spaces
-  size_t startpos = str.find_first_not_of(" \t"); // Find the first character 
position after excluding leading blank spaces
-  size_t endpos = str.find_last_not_of(" \t"); // Find the first character 
position from reverse af
 
-  // if all spaces or empty return an empty string
-  if ((string::npos == startpos) || (string::npos == endpos)) {
-    str = "";
-  } else
-    str = str.substr(startpos, endpos - startpos + 1);
-}
-
-
 void *RawDecoderDecodeThread(void *_this) {
   RawDecoderThread* me = (RawDecoderThread*)_this;
   try {

Modified: RawSpeed/RawDecoder.h
===================================================================
--- RawSpeed/RawDecoder.h       2011-03-07 22:05:14 UTC (rev 341)
+++ RawSpeed/RawDecoder.h       2011-03-19 17:17:11 UTC (rev 342)
@@ -117,11 +117,9 @@
   /* Faster version for unpacking 12 bit LSB data */
   void Decode12BitRaw(ByteStream &input, uint32 w, uint32 h);
 
-  /* Remove all spaces at the end of a string */
-  void TrimSpaces( string& str);
-
   /* Generic decompressor for uncompressed images */
-  void decodeUncompressed(TiffIFD *rawIFD);
+  /* MSBOrder: true -  bits are read from MSB (JPEG style) False: Read from 
LSB. */
+  void decodeUncompressed(TiffIFD *rawIFD, bool MSBOrder);
 
   /* The Raw input file to be decoded */
   FileMap *mFile; 


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

Reply via email to