[Rawstudio-commit] r977 - trunk/src

Anders Brander anders at brander.dk
Fri Dec 29 21:10:37 CET 2006


Author: abrander
Date: 2006-12-29 21:10:36 +0100 (Fri, 29 Dec 2006)
New Revision: 977

Modified:
   trunk/src/rs-render.c
Log:
Do correct rounding in unoptimized renderers.

Modified: trunk/src/rs-render.c
===================================================================
--- trunk/src/rs-render.c	2006-12-29 19:21:23 UTC (rev 976)
+++ trunk/src/rs-render.c	2006-12-29 20:10:36 UTC (rev 977)
@@ -147,9 +147,9 @@
 		srcoffset = y * in_rowstride;
 		for(x=0 ; x<width ; x++)
 		{
-			rr = (in[srcoffset+R]*pre_mul[R])>>7;
-			gg = (in[srcoffset+G]*pre_mul[G])>>7;
-			bb = (in[srcoffset+B]*pre_mul[B])>>7;
+			rr = (in[srcoffset+R]*pre_mul[R]+64)>>7;
+			gg = (in[srcoffset+G]*pre_mul[G]+64)>>7;
+			bb = (in[srcoffset+B]*pre_mul[B]+64)>>7;
 			_CLAMP65535_TRIPLET(rr,gg,bb);
 			r = (rr*photo->mati.coeff[0][0]
 				+ gg*photo->mati.coeff[0][1]
@@ -390,9 +390,9 @@
 		guchar *d = out + y * out_rowstride;
 		for(x=0 ; x<width ; x++)
 		{
-			rr = (in[srcoffset+R]*pre_mul[R])>>7;
-			gg = (in[srcoffset+G]*pre_mul[G])>>7;
-			bb = (in[srcoffset+B]*pre_mul[B])>>7;
+			rr = (in[srcoffset+R]*pre_mul[R]+64)>>7;
+			gg = (in[srcoffset+G]*pre_mul[G]+64)>>7;
+			bb = (in[srcoffset+B]*pre_mul[B]+64)>>7;
 			_CLAMP65535_TRIPLET(rr,gg,bb);
 			r = (rr*photo->mati.coeff[0][0]
 				+ gg*photo->mati.coeff[0][1]




More information about the Rawstudio-commit mailing list