Skip to content

Commit b279420

Browse files
Sven NeumannSven Neumann
Sven Neumann
authored and
Sven Neumann
committed
Bug 568021 – Unused code in unsharp-mask.c
2009-01-17 Sven Neumann <[email protected]> Bug 568021 – Unused code in unsharp-mask.c * plug-ins/common/unsharp-mask.c: applied patch from Winston Chang that removes unused code. svn path=/trunk/; revision=27910
1 parent d2654f0 commit b279420

File tree

2 files changed

+11
-42
lines changed

2 files changed

+11
-42
lines changed

ChangeLog

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
2009-01-17 Sven Neumann <[email protected]>
2+
3+
Bug 568021 – Unused code in unsharp-mask.c
4+
5+
* plug-ins/common/unsharp-mask.c: applied patch from Winston Chang
6+
that removes unused code.
7+
18
2009-01-17 Sven Neumann <[email protected]>
29

310
Bug 568016 – Black pullout parameter of plug-in-newsprint has

plug-ins/common/unsharp-mask.c

+4-42
Original file line numberDiff line numberDiff line change
@@ -61,17 +61,14 @@ static void run (const gchar *name,
6161
gint *nreturn_vals,
6262
GimpParam **return_vals);
6363

64-
static void blur_line (const gdouble *ctable,
65-
const gdouble *cmatrix,
64+
static void blur_line (const gdouble *cmatrix,
6665
const gint cmatrix_length,
6766
const guchar *src,
6867
guchar *dest,
6968
const gint len,
7069
const gint bytes);
7170
static gint gen_convolve_matrix (gdouble std_dev,
7271
gdouble **cmatrix);
73-
static gdouble * gen_lookup_table (const gdouble *cmatrix,
74-
gint cmatrix_length);
7572
static void unsharp_region (GimpPixelRgn *srcPTR,
7673
GimpPixelRgn *dstPTR,
7774
gint bytes,
@@ -243,16 +240,14 @@ run (const gchar *name,
243240
* in the processing of the lines, at least to the blur_line function.
244241
*/
245242
static void
246-
blur_line (const gdouble *ctable,
247-
const gdouble *cmatrix,
243+
blur_line (const gdouble *cmatrix,
248244
const gint cmatrix_length,
249245
const guchar *src,
250246
guchar *dest,
251247
const gint len,
252248
const gint bytes)
253249
{
254250
const gdouble *cmatrix_p;
255-
const gdouble *ctable_p;
256251
const guchar *src_p;
257252
const guchar *src_p1;
258253
const gint cmatrix_middle = cmatrix_length / 2;
@@ -339,13 +334,11 @@ blur_line (const gdouble *ctable,
339334

340335
cmatrix_p = cmatrix;
341336
src_p1 = src_p;
342-
ctable_p = ctable;
343337

344338
for (j = 0; j < cmatrix_length; j++)
345339
{
346340
sum += cmatrix[j] * *src_p1;
347341
src_p1 += bytes;
348-
ctable_p += 256;
349342
}
350343

351344
src_p++;
@@ -431,7 +424,6 @@ unsharp_region (GimpPixelRgn *srcPR,
431424
gint height = y2 - y1;
432425
gdouble *cmatrix = NULL;
433426
gint cmatrix_length;
434-
gdouble *ctable;
435427
gint row, col;
436428
gint threshold = unsharp_params.threshold;
437429

@@ -442,9 +434,6 @@ unsharp_region (GimpPixelRgn *srcPR,
442434
and make sure it's smaller than each dimension */
443435
cmatrix_length = gen_convolve_matrix (radius, &cmatrix);
444436

445-
/* generate lookup table */
446-
ctable = gen_lookup_table (cmatrix, cmatrix_length);
447-
448437
/* allocate buffers */
449438
src = g_new (guchar, MAX (width, height) * bytes);
450439
dest = g_new (guchar, MAX (width, height) * bytes);
@@ -453,7 +442,7 @@ unsharp_region (GimpPixelRgn *srcPR,
453442
for (row = 0; row < height; row++)
454443
{
455444
gimp_pixel_rgn_get_row (srcPR, src, x1, y1 + row, width);
456-
blur_line (ctable, cmatrix, cmatrix_length, src, dest, width, bytes);
445+
blur_line (cmatrix, cmatrix_length, src, dest, width, bytes);
457446
gimp_pixel_rgn_set_row (destPR, dest, x1, y1 + row, width);
458447

459448
if (show_progress && row % 16 == 0)
@@ -464,7 +453,7 @@ unsharp_region (GimpPixelRgn *srcPR,
464453
for (col = 0; col < width; col++)
465454
{
466455
gimp_pixel_rgn_get_col (destPR, src, x1 + col, y1, height);
467-
blur_line (ctable, cmatrix, cmatrix_length, src, dest, height, bytes);
456+
blur_line (cmatrix, cmatrix_length, src, dest, height, bytes);
468457
gimp_pixel_rgn_set_col (destPR, dest, x1 + col, y1, height);
469458

470459
if (show_progress && col % 16 == 0)
@@ -516,7 +505,6 @@ unsharp_region (GimpPixelRgn *srcPR,
516505

517506
g_free (dest);
518507
g_free (src);
519-
g_free (ctable);
520508
g_free (cmatrix);
521509
}
522510

@@ -603,32 +591,6 @@ gen_convolve_matrix (gdouble radius,
603591
return matrix_length;
604592
}
605593

606-
/* ----------------------- gen_lookup_table ----------------------- */
607-
/* generates a lookup table for every possible product of 0-255 and
608-
each value in the convolution matrix. The returned array is
609-
indexed first by matrix position, then by input multiplicand (?)
610-
value.
611-
*/
612-
static gdouble *
613-
gen_lookup_table (const gdouble *cmatrix,
614-
gint cmatrix_length)
615-
{
616-
gdouble *lookup_table = g_new (gdouble, cmatrix_length * 256);
617-
gdouble *lookup_table_p = lookup_table;
618-
const gdouble *cmatrix_p = cmatrix;
619-
gint i, j;
620-
621-
for (i = 0; i < cmatrix_length; i++)
622-
{
623-
for (j = 0; j < 256; j++)
624-
*(lookup_table_p++) = *cmatrix_p * (gdouble) j;
625-
626-
cmatrix_p++;
627-
}
628-
629-
return lookup_table;
630-
}
631-
632594
static gboolean
633595
unsharp_mask_dialog (GimpDrawable *drawable)
634596
{

0 commit comments

Comments
 (0)