[Rawstudio-commit] r3487 - trunk/plugins/demosaic

Klaus Post klauspost at gmail.com
Sun Aug 8 16:49:36 CEST 2010


Author: post
Date: 2010-08-08 16:49:36 +0200 (Sun, 08 Aug 2010)
New Revision: 3487

Modified:
   trunk/plugins/demosaic/demosaic.c
Log:
Avoid 2 multiplies by 3 when looking up pixel values in demosaic.

Modified: trunk/plugins/demosaic/demosaic.c
===================================================================
--- trunk/plugins/demosaic/demosaic.c	2010-08-08 14:36:00 UTC (rev 3486)
+++ trunk/plugins/demosaic/demosaic.c	2010-08-08 14:49:36 UTC (rev 3487)
@@ -399,6 +399,7 @@
   int row, col, c, d;
 	int diffA, diffB, guessA, guessB;
 	int p = image->pitch;
+	int p3 = p*3;
   gushort (*pix)[4];
 
   {
@@ -420,8 +421,8 @@
 	diffB = ( ABS(pix[-2*p][c] - pix[ 0][c]) +
 		    ABS(pix[ 2*p][c] - pix[ 0][c]) +
 		    ABS(pix[  -p][1] - pix[ p][1]) ) * 3 +
-		  ( ABS(pix[ 3*p][1] - pix[ p][1]) +
-		    ABS(pix[-3*p][1] - pix[-p][1]) ) * 2;
+		  ( ABS(pix[ p3][1] - pix[ p][1]) +
+		    ABS(pix[-p3][1] - pix[-p][1]) ) * 2;
 
 		if (diffA > diffB)
 			pix[0][1] = ULIM(guessB >> 2, pix[p][1], pix[-p][1]);




More information about the Rawstudio-commit mailing list