@@ -61,17 +61,14 @@ static void run (const gchar *name,
61
61
gint * nreturn_vals ,
62
62
GimpParam * * return_vals );
63
63
64
- static void blur_line (const gdouble * ctable ,
65
- const gdouble * cmatrix ,
64
+ static void blur_line (const gdouble * cmatrix ,
66
65
const gint cmatrix_length ,
67
66
const guchar * src ,
68
67
guchar * dest ,
69
68
const gint len ,
70
69
const gint bytes );
71
70
static gint gen_convolve_matrix (gdouble std_dev ,
72
71
gdouble * * cmatrix );
73
- static gdouble * gen_lookup_table (const gdouble * cmatrix ,
74
- gint cmatrix_length );
75
72
static void unsharp_region (GimpPixelRgn * srcPTR ,
76
73
GimpPixelRgn * dstPTR ,
77
74
gint bytes ,
@@ -243,16 +240,14 @@ run (const gchar *name,
243
240
* in the processing of the lines, at least to the blur_line function.
244
241
*/
245
242
static void
246
- blur_line (const gdouble * ctable ,
247
- const gdouble * cmatrix ,
243
+ blur_line (const gdouble * cmatrix ,
248
244
const gint cmatrix_length ,
249
245
const guchar * src ,
250
246
guchar * dest ,
251
247
const gint len ,
252
248
const gint bytes )
253
249
{
254
250
const gdouble * cmatrix_p ;
255
- const gdouble * ctable_p ;
256
251
const guchar * src_p ;
257
252
const guchar * src_p1 ;
258
253
const gint cmatrix_middle = cmatrix_length / 2 ;
@@ -339,13 +334,11 @@ blur_line (const gdouble *ctable,
339
334
340
335
cmatrix_p = cmatrix ;
341
336
src_p1 = src_p ;
342
- ctable_p = ctable ;
343
337
344
338
for (j = 0 ; j < cmatrix_length ; j ++ )
345
339
{
346
340
sum += cmatrix [j ] * * src_p1 ;
347
341
src_p1 += bytes ;
348
- ctable_p += 256 ;
349
342
}
350
343
351
344
src_p ++ ;
@@ -431,7 +424,6 @@ unsharp_region (GimpPixelRgn *srcPR,
431
424
gint height = y2 - y1 ;
432
425
gdouble * cmatrix = NULL ;
433
426
gint cmatrix_length ;
434
- gdouble * ctable ;
435
427
gint row , col ;
436
428
gint threshold = unsharp_params .threshold ;
437
429
@@ -442,9 +434,6 @@ unsharp_region (GimpPixelRgn *srcPR,
442
434
and make sure it's smaller than each dimension */
443
435
cmatrix_length = gen_convolve_matrix (radius , & cmatrix );
444
436
445
- /* generate lookup table */
446
- ctable = gen_lookup_table (cmatrix , cmatrix_length );
447
-
448
437
/* allocate buffers */
449
438
src = g_new (guchar , MAX (width , height ) * bytes );
450
439
dest = g_new (guchar , MAX (width , height ) * bytes );
@@ -453,7 +442,7 @@ unsharp_region (GimpPixelRgn *srcPR,
453
442
for (row = 0 ; row < height ; row ++ )
454
443
{
455
444
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 );
457
446
gimp_pixel_rgn_set_row (destPR , dest , x1 , y1 + row , width );
458
447
459
448
if (show_progress && row % 16 == 0 )
@@ -464,7 +453,7 @@ unsharp_region (GimpPixelRgn *srcPR,
464
453
for (col = 0 ; col < width ; col ++ )
465
454
{
466
455
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 );
468
457
gimp_pixel_rgn_set_col (destPR , dest , x1 + col , y1 , height );
469
458
470
459
if (show_progress && col % 16 == 0 )
@@ -516,7 +505,6 @@ unsharp_region (GimpPixelRgn *srcPR,
516
505
517
506
g_free (dest );
518
507
g_free (src );
519
- g_free (ctable );
520
508
g_free (cmatrix );
521
509
}
522
510
@@ -603,32 +591,6 @@ gen_convolve_matrix (gdouble radius,
603
591
return matrix_length ;
604
592
}
605
593
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
-
632
594
static gboolean
633
595
unsharp_mask_dialog (GimpDrawable * drawable )
634
596
{
0 commit comments