gegl r1937 - in trunk: . operations/workshop



Author: neo
Date: Tue Jan 29 15:42:35 2008
New Revision: 1937
URL: http://svn.gnome.org/viewvc/gegl?rev=1937&view=rev

Log:
2008-01-29  Sven Neumann  <sven gimp org>

	* operations/workshop/hstack.c: define GEGL_CHANT_C_FILE to make
	it compile again.

	* operations/workshop/rawbayer-load.c (load_buffer): fixed string
	handling.

	* operations/workshop/box-max.c
	* operations/workshop/box-min.c
	* operations/workshop/c2g.c
	* operations/workshop/demosaic-bimedian.c
	* operations/workshop/demosaic-simple.c
	* operations/workshop/disc-percentile.c
	* operations/workshop/hstack.c
	* operations/workshop/kuwahara-max.c
	* operations/workshop/kuwahara-min.c
	* operations/workshop/kuwahara.c
	* operations/workshop/lens-correct.c
	* operations/workshop/line-profile.c
	* operations/workshop/max-envelope.c
	* operations/workshop/mblur.c
	* operations/workshop/min-envelope.c
	* operations/workshop/snn-percentile.c
	* operations/workshop/stress.c: use g_new() instead of g_malloc().


Modified:
   trunk/ChangeLog
   trunk/operations/workshop/box-max.c
   trunk/operations/workshop/box-min.c
   trunk/operations/workshop/c2g.c
   trunk/operations/workshop/demosaic-bimedian.c
   trunk/operations/workshop/demosaic-simple.c
   trunk/operations/workshop/disc-percentile.c
   trunk/operations/workshop/hstack.c
   trunk/operations/workshop/kuwahara-max.c
   trunk/operations/workshop/kuwahara-min.c
   trunk/operations/workshop/kuwahara.c
   trunk/operations/workshop/lens-correct.c
   trunk/operations/workshop/line-profile.c
   trunk/operations/workshop/max-envelope.c
   trunk/operations/workshop/mblur.c
   trunk/operations/workshop/min-envelope.c
   trunk/operations/workshop/rawbayer-load.c
   trunk/operations/workshop/snn-percentile.c
   trunk/operations/workshop/stress.c

Modified: trunk/operations/workshop/box-max.c
==============================================================================
--- trunk/operations/workshop/box-max.c	(original)
+++ trunk/operations/workshop/box-max.c	Tue Jan 29 15:42:35 2008
@@ -73,8 +73,8 @@
   gfloat *src_buf;
   gfloat *dst_buf;
 
-  src_buf = g_malloc0 (gegl_buffer_get_pixel_count (src) * 4 * 4);
-  dst_buf = g_malloc0 (gegl_buffer_get_pixel_count (dst) * 4 * 4);
+  src_buf = g_new0 (gfloat, gegl_buffer_get_pixel_count (src) * 4);
+  dst_buf = g_new0 (gfloat, gegl_buffer_get_pixel_count (dst) * 4);
 
   gegl_buffer_get (src, 1.0, NULL, babl_format ("RGBA float"), src_buf, GEGL_AUTO_ROWSTRIDE);
 
@@ -112,8 +112,8 @@
   gfloat *src_buf;
   gfloat *dst_buf;
 
-  src_buf = g_malloc0 (gegl_buffer_get_pixel_count (src) * 4 * 4);
-  dst_buf = g_malloc0 (gegl_buffer_get_pixel_count (dst) * 4 * 4);
+  src_buf = g_new0 (gfloat, gegl_buffer_get_pixel_count (src) * 4);
+  dst_buf = g_new0 (gfloat, gegl_buffer_get_pixel_count (dst) * 4);
 
   gegl_buffer_get (src, 1.0, NULL, babl_format ("RGBA float"), src_buf, GEGL_AUTO_ROWSTRIDE);
 

Modified: trunk/operations/workshop/box-min.c
==============================================================================
--- trunk/operations/workshop/box-min.c	(original)
+++ trunk/operations/workshop/box-min.c	Tue Jan 29 15:42:35 2008
@@ -73,8 +73,8 @@
   gfloat *src_buf;
   gfloat *dst_buf;
 
-  src_buf = g_malloc0 (gegl_buffer_get_pixel_count (src) * 4 * 4);
-  dst_buf = g_malloc0 (gegl_buffer_get_pixel_count (dst) * 4 * 4);
+  src_buf = g_new0 (gfloat, gegl_buffer_get_pixel_count (src) * 4);
+  dst_buf = g_new0 (gfloat, gegl_buffer_get_pixel_count (dst) * 4);
 
   gegl_buffer_get (src, 1.0, NULL, babl_format ("RGBA float"), src_buf, GEGL_AUTO_ROWSTRIDE);
 
@@ -112,8 +112,8 @@
   gfloat *src_buf;
   gfloat *dst_buf;
 
-  src_buf = g_malloc0 (gegl_buffer_get_pixel_count (src) * 4 * 4);
-  dst_buf = g_malloc0 (gegl_buffer_get_pixel_count (dst) * 4 * 4);
+  src_buf = g_new0 (gfloat, gegl_buffer_get_pixel_count (src) * 4);
+  dst_buf = g_new0 (gfloat, gegl_buffer_get_pixel_count (dst) * 4);
 
   gegl_buffer_get (src, 1.0, NULL, babl_format ("RGBA float"), src_buf, GEGL_AUTO_ROWSTRIDE);
 

Modified: trunk/operations/workshop/c2g.c
==============================================================================
--- trunk/operations/workshop/c2g.c	(original)
+++ trunk/operations/workshop/c2g.c	Tue Jan 29 15:42:35 2008
@@ -91,8 +91,8 @@
   gfloat *src_buf;
   gfloat *dst_buf;
 
-  src_buf = g_malloc0 (gegl_buffer_get_pixel_count (src) * 4 * 4);
-  dst_buf = g_malloc0 (gegl_buffer_get_pixel_count (dst) * 4 * 4);
+  src_buf = g_new0 (gfloat, gegl_buffer_get_pixel_count (src) * 4);
+  dst_buf = g_new0 (gfloat, gegl_buffer_get_pixel_count (dst) * 4);
 
   gegl_buffer_get (src, 1.0, NULL, babl_format ("RGBA float"), src_buf, GEGL_AUTO_ROWSTRIDE);
   for (y=radius; y<gegl_buffer_get_height (dst)-radius; y++)

Modified: trunk/operations/workshop/demosaic-bimedian.c
==============================================================================
--- trunk/operations/workshop/demosaic-bimedian.c	(original)
+++ trunk/operations/workshop/demosaic-bimedian.c	Tue Jan 29 15:42:35 2008
@@ -84,8 +84,8 @@
   gfloat *src_buf;
   gfloat *dst_buf;
 
-  src_buf = g_malloc0 (gegl_buffer_get_pixel_count (src) * 4);
-  dst_buf = g_malloc0 (gegl_buffer_get_pixel_count (dst) * 4 * 3);
+  src_buf = g_new0 (gfloat, gegl_buffer_get_pixel_count (src));
+  dst_buf = g_new0 (gfloat, gegl_buffer_get_pixel_count (dst) * 3);
 
   gegl_buffer_get (src, 1.0, NULL, babl_format ("Y float"), src_buf,
            GEGL_AUTO_ROWSTRIDE);

Modified: trunk/operations/workshop/demosaic-simple.c
==============================================================================
--- trunk/operations/workshop/demosaic-simple.c	(original)
+++ trunk/operations/workshop/demosaic-simple.c	Tue Jan 29 15:42:35 2008
@@ -38,8 +38,8 @@
   gfloat *src_buf;
   gfloat *dst_buf;
 
-  src_buf = g_malloc0 (gegl_buffer_get_pixel_count (src) * 4);
-  dst_buf = g_malloc0 (gegl_buffer_get_pixel_count (dst) * 4 * 3);
+  src_buf = g_new0 (gfloat, gegl_buffer_get_pixel_count (src));
+  dst_buf = g_new0 (gfloat, gegl_buffer_get_pixel_count (dst) * 3);
 
   gegl_buffer_get (src, 1.0, NULL, babl_format ("Y float"), src_buf, GEGL_AUTO_ROWSTRIDE);
 

Modified: trunk/operations/workshop/disc-percentile.c
==============================================================================
--- trunk/operations/workshop/disc-percentile.c	(original)
+++ trunk/operations/workshop/disc-percentile.c	Tue Jan 29 15:42:35 2008
@@ -127,8 +127,8 @@
   gfloat *dst_buf;
 
 
-  src_buf = g_malloc0 (gegl_buffer_get_pixel_count (src) * 4 * 4);
-  dst_buf = g_malloc0 (gegl_buffer_get_pixel_count (dst) * 4 * 4);
+  src_buf = g_new0 (gfloat, gegl_buffer_get_pixel_count (src) * 4);
+  dst_buf = g_new0 (gfloat, gegl_buffer_get_pixel_count (dst) * 4);
 
   gegl_buffer_get (src, 1.0, NULL, babl_format ("RGBA float"), src_buf, GEGL_AUTO_ROWSTRIDE);
 

Modified: trunk/operations/workshop/hstack.c
==============================================================================
--- trunk/operations/workshop/hstack.c	(original)
+++ trunk/operations/workshop/hstack.c	Tue Jan 29 15:42:35 2008
@@ -23,7 +23,7 @@
 #else
 
 #define GEGL_CHANT_TYPE_COMPOSER
-//#define GEGL_CHANT_C_FILE       "hstack.c"
+#define GEGL_CHANT_C_FILE       "hstack.c"
 
 #include "gegl-chant.h"
 #include <math.h>
@@ -118,8 +118,8 @@
   temp_aux = gegl_buffer_create_sub_buffer (aux, result);
 
     {
-      gfloat *buf = g_malloc0 (result->width * result->height * 4 * 4);
-      gfloat *bufB = g_malloc0 (result->width * result->height * 4 * 4);
+      gfloat *buf  = g_new0 (gfloat, result->width * result->height * 4);
+      gfloat *bufB = g_new0 (gfloat, result->width * result->height * 4);
 
       gegl_buffer_get (temp_in, 1.0, NULL, babl_format ("RGBA float"), buf, GEGL_AUTO_ROWSTRIDE);
       gegl_buffer_get (temp_aux, 1.0, NULL, babl_format ("RGBA float"), bufB, GEGL_AUTO_ROWSTRIDE);

Modified: trunk/operations/workshop/kuwahara-max.c
==============================================================================
--- trunk/operations/workshop/kuwahara-max.c	(original)
+++ trunk/operations/workshop/kuwahara-max.c	Tue Jan 29 15:42:35 2008
@@ -88,8 +88,8 @@
   gfloat *src_buf;
   gfloat *dst_buf;
 
-  src_buf = g_malloc0 (gegl_buffer_get_pixel_count (src) * 4 * 4);
-  dst_buf = g_malloc0 (gegl_buffer_get_pixel_count (dst) * 4 * 4);
+  src_buf = g_new0 (gfloat, gegl_buffer_get_pixel_count (src) * 4);
+  dst_buf = g_new0 (gfloat, gegl_buffer_get_pixel_count (dst) * 4);
 
   gegl_buffer_get (src, 1.0, NULL, babl_format ("RGBA float"), src_buf, GEGL_AUTO_ROWSTRIDE);
 

Modified: trunk/operations/workshop/kuwahara-min.c
==============================================================================
--- trunk/operations/workshop/kuwahara-min.c	(original)
+++ trunk/operations/workshop/kuwahara-min.c	Tue Jan 29 15:42:35 2008
@@ -88,8 +88,8 @@
   gfloat *src_buf;
   gfloat *dst_buf;
 
-  src_buf = g_malloc0 (gegl_buffer_get_pixel_count (src) * 4 * 4);
-  dst_buf = g_malloc0 (gegl_buffer_get_pixel_count (dst) * 4 * 4);
+  src_buf = g_new0 (gfloat, gegl_buffer_get_pixel_count (src) * 4);
+  dst_buf = g_new0 (gfloat, gegl_buffer_get_pixel_count (dst) * 4);
 
   gegl_buffer_get (src, 1.0, NULL, babl_format ("RGBA float"), src_buf, GEGL_AUTO_ROWSTRIDE);
 

Modified: trunk/operations/workshop/kuwahara.c
==============================================================================
--- trunk/operations/workshop/kuwahara.c	(original)
+++ trunk/operations/workshop/kuwahara.c	Tue Jan 29 15:42:35 2008
@@ -88,8 +88,8 @@
   gfloat *src_buf;
   gfloat *dst_buf;
 
-  src_buf = g_malloc0 (gegl_buffer_get_pixel_count (src) * 4 * 4);
-  dst_buf = g_malloc0 (gegl_buffer_get_pixel_count (dst) * 4 * 4);
+  src_buf = g_new0 (gfloat, gegl_buffer_get_pixel_count (src) * 4);
+  dst_buf = g_new0 (gfloat, gegl_buffer_get_pixel_count (dst) * 4);
 
   gegl_buffer_get (src, 1.0, NULL, babl_format ("RGBA float"), src_buf, GEGL_AUTO_ROWSTRIDE);
 

Modified: trunk/operations/workshop/lens-correct.c
==============================================================================
--- trunk/operations/workshop/lens-correct.c	(original)
+++ trunk/operations/workshop/lens-correct.c	Tue Jan 29 15:42:35 2008
@@ -227,11 +227,11 @@
   }
 
   /* Get src pixels. */
-  src_buf = g_malloc0 (gegl_buffer_get_pixel_count (src) * 4 * 3);
+  src_buf = g_new0 (gfloat, gegl_buffer_get_pixel_count (src) * 3);
   gegl_buffer_get (src, 1.0, NULL, babl_format ("RGB float"), src_buf, GEGL_AUTO_ROWSTRIDE);
 
   /* Get buffer in which to place dst pixels. */
-  dst_buf = g_malloc0 (gegl_buffer_get_pixel_count (dst) * 4 * 3);
+  dst_buf = g_new0 (gfloat, gegl_buffer_get_pixel_count (dst) * 3);
 
   /* Compute each dst pixel in turn and store into dst buffer. */
   ccm[0] = &oip->red;

Modified: trunk/operations/workshop/line-profile.c
==============================================================================
--- trunk/operations/workshop/line-profile.c	(original)
+++ trunk/operations/workshop/line-profile.c	Tue Jan 29 15:42:35 2008
@@ -63,7 +63,7 @@
   }
 
   {
-    guchar  *buf = g_malloc0 (width * height * 4);
+    guchar  *buf = g_new0 (guchar, width * height * 4);
     cairo_t *cr;
 
     cairo_surface_t *surface = cairo_image_surface_create_for_data (buf, CAIRO_FORMAT_ARGB32, width, height, width * 4);

Modified: trunk/operations/workshop/max-envelope.c
==============================================================================
--- trunk/operations/workshop/max-envelope.c	(original)
+++ trunk/operations/workshop/max-envelope.c	Tue Jan 29 15:42:35 2008
@@ -46,8 +46,8 @@
   gfloat *src_buf;
   gfloat *dst_buf;
 
-  src_buf = g_malloc0 (gegl_buffer_get_pixel_count (src) * 4 * 4);
-  dst_buf = g_malloc0 (gegl_buffer_get_pixel_count (dst) * 4 * 4);
+  src_buf = g_new0 (gfloat, gegl_buffer_get_pixel_count (src) * 4);
+  dst_buf = g_new0 (gfloat, gegl_buffer_get_pixel_count (dst) * 4);
 
   gegl_buffer_get (src, 1.0, NULL, babl_format ("RGBA float"), src_buf, GEGL_AUTO_ROWSTRIDE);
 

Modified: trunk/operations/workshop/mblur.c
==============================================================================
--- trunk/operations/workshop/mblur.c	(original)
+++ trunk/operations/workshop/mblur.c	Tue Jan 29 15:42:35 2008
@@ -79,10 +79,9 @@
       temp_in = gegl_buffer_create_sub_buffer (input, result);
 
       {
-        gint pixels  = result->width*result->height;
-        gint bufsize = pixels*4*sizeof(gfloat);
-        gfloat *buf = g_malloc(bufsize);
-        gfloat *acc = g_malloc(bufsize);
+        gint pixels = result->width * result->height;
+        gfloat *buf = g_new (gfloat, pixels * 4);
+        gfloat *acc = g_new (gfloat, pixels * 4);
         gfloat dampness;
         gint i;
         gegl_buffer_get (p->acc, 1.0, result, babl_format ("RGBA float"), acc, GEGL_AUTO_ROWSTRIDE);

Modified: trunk/operations/workshop/min-envelope.c
==============================================================================
--- trunk/operations/workshop/min-envelope.c	(original)
+++ trunk/operations/workshop/min-envelope.c	Tue Jan 29 15:42:35 2008
@@ -46,8 +46,8 @@
   gfloat *src_buf;
   gfloat *dst_buf;
 
-  src_buf = g_malloc0 (gegl_buffer_get_pixel_count (src) * 4 * 4);
-  dst_buf = g_malloc0 (gegl_buffer_get_pixel_count (dst) * 4 * 4);
+  src_buf = g_new0 (gfloat, gegl_buffer_get_pixel_count (src) * 4);
+  dst_buf = g_new0 (gfloat, gegl_buffer_get_pixel_count (dst) * 4);
 
   gegl_buffer_get (src, 1.0, NULL, babl_format ("RGBA float"), src_buf, GEGL_AUTO_ROWSTRIDE);
 

Modified: trunk/operations/workshop/rawbayer-load.c
==============================================================================
--- trunk/operations/workshop/rawbayer-load.c	(original)
+++ trunk/operations/workshop/rawbayer-load.c	Tue Jan 29 15:42:35 2008
@@ -86,15 +86,12 @@
       gint width, height, val_max;
       char newline;
 
-      command = g_malloc (strlen (op_raw_load->path) + 128);
-      if (!command)
-        return;
-      sprintf (command, "dcraw -j -d -4 -c '%s'\n", op_raw_load->path);
+      command = g_strdup_printf ("dcraw -j -d -4 -c '%s'\n", op_raw_load->path);
       pfp = popen (command, PIPE_MODE);
-      free (command);
+      g_free (command);
 
       if (fscanf (pfp, "P6 %d %d %d %c",
-         &width, &height, &val_max, &newline) != 4)
+                  &width, &height, &val_max, &newline) != 4)
         {
           pclose (pfp);
           g_warning ("not able to aquire raw data");
@@ -102,11 +99,11 @@
         }
 
       {
-        GeglRectangle extent = {0,0,width,height};
+        GeglRectangle extent = { 0, 0, width, height };
         op_raw_load->priv = (void*)gegl_buffer_new (&extent, babl_format ("Y u16"));
       }
          {
-           guchar *buf=g_malloc (width * height * 3 * 2);
+           guchar *buf = g_new (guchar, width * height * 3 * 2);
            fread (buf, 1, width * height * 3 * 2, pfp);
            if(strstr (op_raw_load->path, "rawbayerS")){
              gint i;

Modified: trunk/operations/workshop/snn-percentile.c
==============================================================================
--- trunk/operations/workshop/snn-percentile.c	(original)
+++ trunk/operations/workshop/snn-percentile.c	Tue Jan 29 15:42:35 2008
@@ -143,8 +143,8 @@
   gfloat *dst_buf;
   RankList list = {0};
 
-  src_buf = g_malloc0 (gegl_buffer_get_pixel_count (src) * 4 * 4);
-  dst_buf = g_malloc0 (gegl_buffer_get_pixel_count (dst) * 4 * 4);
+  src_buf = g_new0 (gfloat, gegl_buffer_get_pixel_count (src) * 4);
+  dst_buf = g_new0 (gfloat, gegl_buffer_get_pixel_count (dst) * 4);
 
   gegl_buffer_get (src, 1.0, NULL, babl_format ("RGBA float"), src_buf, GEGL_AUTO_ROWSTRIDE);
 

Modified: trunk/operations/workshop/stress.c
==============================================================================
--- trunk/operations/workshop/stress.c	(original)
+++ trunk/operations/workshop/stress.c	Tue Jan 29 15:42:35 2008
@@ -53,8 +53,8 @@
   gfloat *src_buf;
   gfloat *dst_buf;
 
-  src_buf = g_malloc0 (gegl_buffer_get_pixel_count (src) * 4 * 4);
-  dst_buf = g_malloc0 (gegl_buffer_get_pixel_count (dst) * 4 * 4);
+  src_buf = g_new0 (gfloat, gegl_buffer_get_pixel_count (src) * 4);
+  dst_buf = g_new0 (gfloat, gegl_buffer_get_pixel_count (dst) * 4);
 
   gegl_buffer_get (src, 1.0, NULL, babl_format ("RGBA float"), src_buf, GEGL_AUTO_ROWSTRIDE);
 



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