Commit f5a2b3d3 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann
Browse files

plug-ins/common/deinterlace.c plug-ins/common/despeckle.c

2005-03-11  Sven Neumann  <sven@gimp.org>

	* plug-ins/common/deinterlace.c
	* plug-ins/common/despeckle.c
	* plug-ins/common/laplace.c
	* plug-ins/common/neon.c
	* plug-ins/common/sobel.c
	* plug-ins/common/dog.c: update progress less frequently.
parent 98341a1f
2005-03-11 Sven Neumann <sven@gimp.org>
* plug-ins/common/deinterlace.c
* plug-ins/common/despeckle.c
* plug-ins/common/laplace.c
* plug-ins/common/neon.c
* plug-ins/common/sobel.c
* plug-ins/common/dog.c: update progress less frequently.
2005-03-11 Sven Neumann <sven@gimp.org>
* plug-ins/common/despeckle.c: minor cleanup, inline
......
......@@ -274,7 +274,7 @@ deinterlace (GimpDrawable *drawable,
{
gimp_pixel_rgn_set_row (&destPR, dest, x1, row, width);
if ((row % 5) == 0)
if ((row % 20) == 0)
gimp_progress_update ((double) row / (double) (height));
}
}
......
/*
* "$Id$"
*
* Despeckle (adaptive median) filter for The GIMP -- an image manipulation
* program
*
......@@ -52,7 +50,7 @@
#define update_toggle (despeckle_vals[4]) /* Update the preview? */
#define VALUE_SWAP(a,b) { register gdouble t = (a); (a) = (b); (b) = t; }
#define POINTER_SWAP(a,b) { register guchar* t = (a); (a) = (b); (b) = t; }
#define POINTER_SWAP(a,b) { register guchar *t = (a); (a) = (b); (b) = t; }
......@@ -615,7 +613,8 @@ despeckle_median (guchar *src,
guchar **buf;
guchar *ibuf;
guchar *pixel;
gdouble prog, maxprog;
guint progress;
guint max_progress;
if (!preview)
{
......@@ -623,8 +622,8 @@ despeckle_median (guchar *src,
gimp_progress_update (0.0);
}
maxprog = width * height;
prog = 0;
progress = 0;
max_progress = width * height;
diameter = (2 * radius) + 1;
box = SQR (diameter);
......@@ -637,17 +636,19 @@ despeckle_median (guchar *src,
{
hist0 = 0;
hist255 = 0;
if (x >= radius && y >= radius &&
x + radius < width && y + radius < height)
if (x >= radius && x + radius < width &&
y >= radius && y + radius < height)
{
/* Make sure Svm is ininialized to a sufficient large value */
med = -1;
for (jh = x - radius; jh <= x + radius; jh++)
{
for (jv = y-radius, pos1 = 0; jv <= y+radius; jv++)
for (jv = y - radius, pos1 = 0; jv <= y + radius; jv++)
{
pos2 = (jh + (jv * width)) * bpp;
if (src[pos2] > black_level && src[pos2] < white_level)
{
med++;
......@@ -705,10 +706,10 @@ despeckle_median (guchar *src,
}
}
prog += height;
progress += height;
if (!preview && x % 5 == 0)
gimp_progress_update (prog / maxprog);
if (!preview && x % 20 == 0)
gimp_progress_update ((gdouble) progress / (gdouble) max_progress);
}
if (!preview)
......
......@@ -682,7 +682,7 @@ gauss_rle (GimpDrawable *drawable,
TRUE, TRUE);
progress = 0.0;
max_progress = 2 * width * height * radius;
max_progress = 2 * width * height;
/* First the vertical pass */
radius = fabs (radius) + 1.0;
......@@ -757,10 +757,10 @@ gauss_rle (GimpDrawable *drawable,
if (show_progress)
{
progress += height * radius;
progress += height;
if ((col % 5) == 0)
gimp_progress_update (0.5 * (pass + progress / max_progress));
if ((col % 20) == 0)
gimp_progress_update (0.5 * (pass + (progress / max_progress)));
}
}
......@@ -826,10 +826,10 @@ gauss_rle (GimpDrawable *drawable,
if (show_progress)
{
progress += width * radius;
progress += width;
if ((row % 5) == 0)
gimp_progress_update (0.5 * (pass + progress / max_progress));
if ((row % 20) == 0)
gimp_progress_update (0.5 * (pass + (progress / max_progress)));
}
}
......
......@@ -282,7 +282,7 @@ laplace (GimpDrawable *drawable)
cr = nr;
nr = tmp;
if ((row % 5) == 0)
if ((row % 20) == 0)
gimp_progress_update ((gdouble) row / (gdouble) (y2 - y1));
}
......@@ -347,7 +347,7 @@ laplace (GimpDrawable *drawable)
cr = nr;
nr = tmp;
if ((row % 5) == 0)
if ((row % 20) == 0)
gimp_progress_update ((gdouble) row / (gdouble) (y2 - y1));
}
......
......@@ -381,7 +381,8 @@ neon (GimpDrawable *drawable,
gimp_pixel_rgn_set_col (&dest_rgn, dest, col + x1, y1, (y2 - y1));
progress += height * radius;
if ((col % 5) == 0)
if ((col % 20) == 0)
gimp_progress_update ((double) progress / (double) max_progress);
}
}
......@@ -470,7 +471,7 @@ neon (GimpDrawable *drawable,
gimp_pixel_rgn_set_row (&dest_rgn, dest, x1, row + y1, (x2 - x1));
progress += width * radius;
if ((row % 5) == 0)
if ((row % 20) == 0)
gimp_progress_update ((double) progress / (double) max_progress);
}
}
......
......@@ -449,7 +449,7 @@ sobel (GimpDrawable *drawable,
{
gimp_pixel_rgn_set_row (&destPR, dest, x1, row, width);
if ((row % 5) == 0)
if ((row % 20) == 0)
gimp_progress_update ((double) row / (double) (y2 - y1));
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment