gimp r27910 - in trunk: . plug-ins/common



Author: neo
Date: Sat Jan 17 16:05:13 2009
New Revision: 27910
URL: http://svn.gnome.org/viewvc/gimp?rev=27910&view=rev

Log:
2009-01-17  Sven Neumann  <sven gimp org>

	Bug 568021 â Unused code in unsharp-mask.c

	* plug-ins/common/unsharp-mask.c: applied patch from Winston 
Chang
	that removes unused code.



Modified:
   trunk/ChangeLog
   trunk/plug-ins/common/unsharp-mask.c

Modified: trunk/plug-ins/common/unsharp-mask.c
==============================================================================
--- trunk/plug-ins/common/unsharp-mask.c	(original)
+++ trunk/plug-ins/common/unsharp-mask.c	Sat Jan 17 16:05:13 2009
@@ -61,8 +61,7 @@
                         gint             *nreturn_vals,
                         GimpParam       **return_vals);
 
-static void      blur_line           (const gdouble  *ctable,
-                                      const gdouble  *cmatrix,
+static void      blur_line           (const gdouble  *cmatrix,
                                       const gint      cmatrix_length,
                                       const guchar   *src,
                                       guchar         *dest,
@@ -70,8 +69,6 @@
                                       const gint      bytes);
 static gint      gen_convolve_matrix (gdouble         std_dev,
                                       gdouble       **cmatrix);
-static gdouble * gen_lookup_table    (const gdouble  *cmatrix,
-                                      gint            cmatrix_length);
 static void      unsharp_region      (GimpPixelRgn   *srcPTR,
                                       GimpPixelRgn   *dstPTR,
                                       gint            bytes,
@@ -243,8 +240,7 @@
  * in the processing of the lines, at least to the blur_line function.
  */
 static void
-blur_line (const gdouble *ctable,
-           const gdouble *cmatrix,
+blur_line (const gdouble *cmatrix,
            const gint     cmatrix_length,
            const guchar  *src,
            guchar        *dest,
@@ -252,7 +248,6 @@
            const gint     bytes)
 {
   const gdouble *cmatrix_p;
-  const gdouble *ctable_p;
   const guchar  *src_p;
   const guchar  *src_p1;
   const gint     cmatrix_middle = cmatrix_length / 2;
@@ -339,13 +334,11 @@
 
               cmatrix_p = cmatrix;
               src_p1 = src_p;
-              ctable_p = ctable;
 
               for (j = 0; j < cmatrix_length; j++)
                 {
                   sum += cmatrix[j] * *src_p1;
                   src_p1 += bytes;
-                  ctable_p += 256;
                 }
 
               src_p++;
@@ -431,7 +424,6 @@
   gint     height  = y2 - y1;
   gdouble *cmatrix = NULL;
   gint     cmatrix_length;
-  gdouble *ctable;
   gint     row, col;
   gint     threshold = unsharp_params.threshold;
 
@@ -442,9 +434,6 @@
      and make sure it's smaller than each dimension */
   cmatrix_length = gen_convolve_matrix (radius, &cmatrix);
 
-  /* generate lookup table */
-  ctable = gen_lookup_table (cmatrix, cmatrix_length);
-
   /* allocate buffers */
   src  = g_new (guchar, MAX (width, height) * bytes);
   dest = g_new (guchar, MAX (width, height) * bytes);
@@ -453,7 +442,7 @@
   for (row = 0; row < height; row++)
     {
       gimp_pixel_rgn_get_row (srcPR, src, x1, y1 + row, width);
-      blur_line (ctable, cmatrix, cmatrix_length, src, dest, width, bytes);
+      blur_line (cmatrix, cmatrix_length, src, dest, width, bytes);
       gimp_pixel_rgn_set_row (destPR, dest, x1, y1 + row, width);
 
       if (show_progress && row % 16 == 0)
@@ -464,7 +453,7 @@
   for (col = 0; col < width; col++)
     {
       gimp_pixel_rgn_get_col (destPR, src, x1 + col, y1, height);
-      blur_line (ctable, cmatrix, cmatrix_length, src, dest, height, bytes);
+      blur_line (cmatrix, cmatrix_length, src, dest, height, bytes);
       gimp_pixel_rgn_set_col (destPR, dest, x1 + col, y1, height);
 
       if (show_progress && col % 16 == 0)
@@ -516,7 +505,6 @@
 
   g_free (dest);
   g_free (src);
-  g_free (ctable);
   g_free (cmatrix);
 }
 
@@ -603,32 +591,6 @@
   return matrix_length;
 }
 
-/* ----------------------- gen_lookup_table ----------------------- */
-/* generates a lookup table for every possible product of 0-255 and
-   each value in the convolution matrix.  The returned array is
-   indexed first by matrix position, then by input multiplicand (?)
-   value.
-*/
-static gdouble *
-gen_lookup_table (const gdouble *cmatrix,
-                  gint           cmatrix_length)
-{
-  gdouble       *lookup_table   = g_new (gdouble, cmatrix_length * 256);
-  gdouble       *lookup_table_p = lookup_table;
-  const gdouble *cmatrix_p      = cmatrix;
-  gint           i, j;
-
-  for (i = 0; i < cmatrix_length; i++)
-    {
-      for (j = 0; j < 256; j++)
-        *(lookup_table_p++) = *cmatrix_p * (gdouble) j;
-
-      cmatrix_p++;
-    }
-
-  return lookup_table;
-}
-
 static gboolean
 unsharp_mask_dialog (GimpDrawable *drawable)
 {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]