[Rawstudio-commit] rawspeed r54 - RawSpeed

Klaus Post klauspost at gmail.com
Sun Feb 8 11:35:28 CET 2009


Author: post
Date: 2009-02-08 11:35:27 +0100 (Sun, 08 Feb 2009)
New Revision: 54

Modified:
   RawSpeed/Common.h
   RawSpeed/rawstudio-plugin-api.cpp
Log:
- Clamp input pixels after black level and scale correction

Modified: RawSpeed/Common.h
===================================================================
--- RawSpeed/Common.h	2009-02-01 13:29:17 UTC (rev 53)
+++ RawSpeed/Common.h	2009-02-08 10:35:27 UTC (rev 54)
@@ -71,7 +71,6 @@
 inline int lmax(int p0, int p1) {
   return p0 - ((p0 - p1) & ((p0 - p1) >> 31));
 }
-#define CLAMPBITS(x,n) { guint32 _y_temp; if( _y_temp=x>>n ) x = ~_y_temp >> (32-n);}
 
 
 
@@ -109,3 +108,5 @@
 typedef gint64            goffset;
 #endif // __unix__
 
+inline guint clampbits(gint x, guint n) { guint32 _y_temp; if( _y_temp=x>>n ) x = ~_y_temp >> (32-n); return x;}
+

Modified: RawSpeed/rawstudio-plugin-api.cpp
===================================================================
--- RawSpeed/rawstudio-plugin-api.cpp	2009-02-01 13:29:17 UTC (rev 53)
+++ RawSpeed/rawstudio-plugin-api.cpp	2009-02-08 10:35:27 UTC (rev 54)
@@ -91,7 +91,7 @@
 				gushort *pixel = GET_PIXEL(image, 0, row);
 				for(col=0;col<image->w*cpp;col++)
 				{
-					*pixel = (*pixel-black)<<shift;
+					*pixel =  clampbits(((gint)*pixel-black)<<shift,16);
 					pixel++;
 				}
 			}




More information about the Rawstudio-commit mailing list