Author: post
Date: 2010-02-06 23:09:37 +0100 (Sat, 06 Feb 2010)
New Revision: 193

Modified:
   RawSpeed/BitPumpJPEG.cpp
   RawSpeed/BitPumpJPEG.h
   RawSpeed/BitPumpMSB.cpp
   RawSpeed/BitPumpMSB.h
   RawSpeed/RawSpeed.vcproj
Log:
- Don't use tables for bitmasks, but calculate them instead. Faster mostly on 
Atom platforms, but also allows more inlining.
- Update MSVC project files.

Modified: RawSpeed/BitPumpJPEG.cpp
===================================================================
--- RawSpeed/BitPumpJPEG.cpp    2010-02-06 16:08:56 UTC (rev 192)
+++ RawSpeed/BitPumpJPEG.cpp    2010-02-06 22:09:37 UTC (rev 193)
@@ -100,7 +100,7 @@
     fill();
   }
 
-  return ((mCurr >> (mLeft -= (nbits)))) & masks[nbits];
+  return ((mCurr >> (mLeft -= (nbits)))) & ((1 << nbits) - 1);
 }
 
 
@@ -114,7 +114,7 @@
   if (mLeft < nbits) {
     fill();
   }
-  return ((mCurr >> (mLeft - nbits))) & masks[nbits];
+  return ((mCurr >> (mLeft - nbits))) & ((1 << nbits) - 1);
 }
 
 
@@ -149,7 +149,7 @@
     if (off > size)
       throw IOException("Out of buffer read");
   }
-  return ((mCurr >> (mLeft -= (nbits)))) & masks[nbits];
+  return ((mCurr >> (mLeft -= (nbits)))) & ((1 << nbits) - 1);
 }
 
 

Modified: RawSpeed/BitPumpJPEG.h
===================================================================
--- RawSpeed/BitPumpJPEG.h      2010-02-06 16:08:56 UTC (rev 192)
+++ RawSpeed/BitPumpJPEG.h      2010-02-06 22:09:37 UTC (rev 193)
@@ -48,8 +48,8 @@
   guint getOffset() { return off-(mLeft>>3)+stuffed;}
   __inline guint getBitNoFill() {return (mCurr >> (--mLeft)) & 1;}
   __inline guint peekByteNoFill() {return ((mCurr >> (mLeft-8))) & 0xff; }
-  __inline guint peekBitsNoFill(guint nbits) {return ((mCurr >> 
(mLeft-nbits))) &masks[nbits]; }
-  __inline guint getBitsNoFill(guint nbits) {_ASSERTE(nbits<24);return ((mCurr 
>> (mLeft -= (nbits)))) & masks[nbits];}
+  __inline guint peekBitsNoFill(guint nbits) {return ((mCurr >> 
(mLeft-nbits))) & ((1 << nbits) - 1); }
+  __inline guint getBitsNoFill(guint nbits) { return ((mCurr >> (mLeft -= 
(nbits)))) & ((1 << nbits) - 1);}
   void fill();  // Fill the buffer with at least 24 bits
 
 

Modified: RawSpeed/BitPumpMSB.cpp
===================================================================
--- RawSpeed/BitPumpMSB.cpp     2010-02-06 16:08:56 UTC (rev 192)
+++ RawSpeed/BitPumpMSB.cpp     2010-02-06 22:09:37 UTC (rev 193)
@@ -67,7 +67,7 @@
       throw IOException("Out of buffer read");
   }
 
-  return ((mCurr >> (mLeft -= (nbits)))) & masks[nbits];
+  return ((mCurr >> (mLeft -= (nbits)))) & ((1 << nbits) - 1);
 }
 
 

Modified: RawSpeed/BitPumpMSB.h
===================================================================
--- RawSpeed/BitPumpMSB.h       2010-02-06 16:08:56 UTC (rev 192)
+++ RawSpeed/BitPumpMSB.h       2010-02-06 22:09:37 UTC (rev 193)
@@ -42,8 +42,8 @@
   __inline void checkPos()  { if (off>size) throw IOException("Out of buffer 
read");};        // Check if we have a valid position
   __inline guint getBitNoFill() {return (mCurr >> (--mLeft)) & 1;}
   __inline guint peekByteNoFill() {return ((mCurr >> (mLeft-8))) & 0xff; }
-  __inline guint getBitsNoFill(guint nbits) {return ((mCurr >> (mLeft -= 
(nbits)))) & masks[nbits];}
-  __inline guint peekBitsNoFill(guint nbits) {return ((mCurr >> 
(mLeft-nbits))) &masks[nbits]; }
+  __inline guint getBitsNoFill(guint nbits) {return ((mCurr >> (mLeft -= 
(nbits)))) & ((1 << nbits) - 1);}
+  __inline guint peekBitsNoFill(guint nbits) {return ((mCurr >> 
(mLeft-nbits))) & ((1 << nbits) - 1); }
 
   // Fill the buffer with at least 24 bits
   __inline void fill() {
@@ -71,7 +71,7 @@
       fill();
     }
 
-    return ((mCurr >> (mLeft -= (nbits)))) & masks[nbits];
+    return ((mCurr >> (mLeft -= (nbits)))) & ((1 << nbits) - 1);
   }
 
   __inline guint peekBit() {
@@ -88,7 +88,7 @@
       fill();
     }
 
-    return ((mCurr >> (mLeft - nbits))) & masks[nbits];
+    return ((mCurr >> (mLeft - nbits))) & ((1 << nbits) - 1);
   }
 
   __inline guint peekByte() {

Modified: RawSpeed/RawSpeed.vcproj
===================================================================
--- RawSpeed/RawSpeed.vcproj    2010-02-06 16:08:56 UTC (rev 192)
+++ RawSpeed/RawSpeed.vcproj    2010-02-06 22:09:37 UTC (rev 193)
@@ -198,46 +198,6 @@
                                >
                        </File>
                        <File
-                               RelativePath=".\rawstudio-plugin-api.cpp"
-                               >
-                               <FileConfiguration
-                                       Name="Debug|Win32"
-                                       ExcludedFromBuild="true"
-                                       >
-                                       <Tool
-                                               Name="VCCLCompilerTool"
-                                       />
-                               </FileConfiguration>
-                               <FileConfiguration
-                                       Name="Release|Win32"
-                                       ExcludedFromBuild="true"
-                                       >
-                                       <Tool
-                                               Name="VCCLCompilerTool"
-                                       />
-                               </FileConfiguration>
-                       </File>
-                       <File
-                               RelativePath=".\rawstudio-plugin.c"
-                               >
-                               <FileConfiguration
-                                       Name="Debug|Win32"
-                                       ExcludedFromBuild="true"
-                                       >
-                                       <Tool
-                                               Name="VCCLCompilerTool"
-                                       />
-                               </FileConfiguration>
-                               <FileConfiguration
-                                       Name="Release|Win32"
-                                       ExcludedFromBuild="true"
-                                       >
-                                       <Tool
-                                               Name="VCCLCompilerTool"
-                                       />
-                               </FileConfiguration>
-                       </File>
-                       <File
                                RelativePath=".\stdafx.cpp"
                                >
                                <FileConfiguration


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

Reply via email to