Update of /cvsroot/ufraw/ufraw
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv13440
Modified Files:
ufraw_ufraw.c
Log Message:
Use OpenMP reduction construct for hot pixel count. Patch by Frank van
Maarseveen.
Index: ufraw_ufraw.c
===================================================================
RCS file: /cvsroot/ufraw/ufraw/ufraw_ufraw.c,v
retrieving revision 1.194
retrieving revision 1.195
diff -u -d -r1.194 -r1.195
--- ufraw_ufraw.c 12 Oct 2009 02:16:22 -0000 1.194
+++ ufraw_ufraw.c 15 Oct 2009 11:30:12 -0000 1.195
@@ -908,17 +908,14 @@
*
* Reasonable values for uf->conf->hotpixel are in the range 0.5-10.
*
- * OpenMP notes
- * ------------
- * The hot pixel count is updated atomically but this is merely for proof
- * of concept: objdump -Sd shows a "lock addl $0x1,0x1f4(%edx) sequence.
- * The algorithm uses pixel values from previous and next row anyway and
- * whether or not pixels are marked makes a difference already.
+ * Note that the algorithm uses pixel values from previous (processed) and
+ * next (unprocessed) row and whether or not pixels are marked makes a
+ * difference for the hot pixel count.
*/
static void ufraw_shave_hotpixels(ufraw_data *uf, dcraw_image_type *img,
int width, int height, int colors, unsigned rgbMax)
{
- int w, h, c, i;
+ int w, h, c, i, count;
unsigned delta, t, v, hi;
dcraw_image_type *p;
@@ -926,9 +923,11 @@
if (uf->conf->hotpixel <= 0.0)
return;
delta = rgbMax / (uf->conf->hotpixel + 1.0);
+ count = 0;
#ifdef _OPENMP
#pragma omp parallel for schedule(static,64) default(none) \
shared(uf,img,width,height,colors,rgbMax,delta) \
+ reduction(+:count) \
private(h,p,w,c,t,v,hi,i)
#endif
for (h = 1; h < height - 1; ++h) {
@@ -970,13 +969,11 @@
memcpy(p[i], p[0], sizeof (p[i]));
}
p[0][c] = hi;
-#ifdef _OPENMP
-#pragma omp atomic
-#endif
- ++uf->hotpixels;
+ ++count;
}
}
}
+ uf->hotpixels = count;
}
#endif
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
ufraw-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ufraw-cvs