[gegl/soc-2011-ops] Added plasma op, different result



commit 37a905bde858d331bfd848ecab91e1ef4585ae8a
Author: Robert Sasu <sasu robert gmail com>
Date:   Thu Jun 23 13:30:54 2011 +0300

    Added plasma op, different result

 operations/workshop/plasma.c |   39 ++++++++++++++++++++++++++-------------
 1 files changed, 26 insertions(+), 13 deletions(-)
---
diff --git a/operations/workshop/plasma.c b/operations/workshop/plasma.c
index 139f124..9ccfe1f 100644
--- a/operations/workshop/plasma.c
+++ b/operations/workshop/plasma.c
@@ -35,15 +35,13 @@ gegl_chant_double (turbulance, _("Turbulance"), 0.1, 7.0, 2,
 
 #define GEGL_CHANT_C_FILE        "plasma.c"
 #define floats_per_pixel 4
-#define MANUAL_ROI_VAL 200 
+#define MANUAL_ROI_VAL 500 
 
 
 #include "gegl-chant.h"
 #include <math.h>
 #include <stdio.h>
 
-FILE *f;
-
 static void prepare (GeglOperation *operation)
 {
   gegl_operation_set_format (operation, "input", babl_format ("RGBA float"));
@@ -122,7 +120,9 @@ get_pixel (gfloat              *src_buf,
 {
   gint i, offset;
   offset = ((y - src->y) * src->width + x - src->x) * floats_per_pixel;
-  fprintf(f, "%d \n", offset);
+
+  if (src_buf == NULL) printf("NULL \n");
+
   for (i = 0; i < floats_per_pixel; i++)
       dst[i] = src_buf[offset++];
 
@@ -290,11 +290,6 @@ init_rect_buf (GeglBuffer    *input,
    roi->y      = y1;
    roi->width  = x2 - x1;
    roi->height = y2 - y1;
-
-   src_buf = g_new0 (gfloat, roi->width * roi->height * floats_per_pixel);
-   
-   gegl_buffer_get (input, 1.0, roi, babl_format ("RGBA float"), src_buf, 
-                    GEGL_AUTO_ROWSTRIDE);
 }
 
 
@@ -439,24 +434,44 @@ do_plasma_big (GeglBuffer *input,
         /*top-left*/
         src_buf = NULL;
         init_rect_buf (output, src_buf, &roi, x1, y1, xm, ym);
+     
+        src_buf = g_new0 (gfloat, (roi.width + 1) * (roi.height + 1) * floats_per_pixel);
+        gegl_buffer_get (input, 1.0, &roi, babl_format ("RGBA float"), src_buf, 
+                    GEGL_AUTO_ROWSTRIDE);
+
         do_plasma (src_buf, &roi, src_buf, &roi, x1, y1, xm, ym, depth - 1,
               scale_depth + 1, gr, op);
         gegl_buffer_set (output, &roi, babl_format ("RGBA float"), src_buf,
                         GEGL_AUTO_ROWSTRIDE);
         /*bottom-left*/
         init_rect_buf (output, src_buf, &roi, x1, ym, xm, y2);
+     
+        src_buf = g_new0 (gfloat, (roi.width + 1) * (roi.height + 1) * floats_per_pixel);
+        gegl_buffer_get (input, 1.0, &roi, babl_format ("RGBA float"), src_buf, 
+                    GEGL_AUTO_ROWSTRIDE);
+
         do_plasma (src_buf, &roi, src_buf, &roi, x1, ym, xm, y2, depth - 1,
                scale_depth + 1, gr, op);
         gegl_buffer_set (output, &roi, babl_format ("RGBA float"), src_buf,
                         GEGL_AUTO_ROWSTRIDE);
         /*top-right*/
         init_rect_buf (output, src_buf, &roi, xm, y1, x2, ym);
+     
+        src_buf = g_new0 (gfloat, (roi.width + 1) * (roi.height + 1) * floats_per_pixel);
+        gegl_buffer_get (input, 1.0, &roi, babl_format ("RGBA float"), src_buf, 
+                    GEGL_AUTO_ROWSTRIDE);
+
         do_plasma (src_buf, &roi, src_buf, &roi, xm, y1, x2, ym, depth - 1,
                scale_depth + 1, gr, op);
         gegl_buffer_set (output, &roi, babl_format ("RGBA float"), src_buf,
                         GEGL_AUTO_ROWSTRIDE);
         /*bottom-right*/
         init_rect_buf (output, src_buf, &roi, xm, ym, x2, y2); 
+     
+        src_buf = g_new0 (gfloat, (roi.width + 1) * (roi.height + 1) * floats_per_pixel);
+        gegl_buffer_get (input, 1.0, &roi, babl_format ("RGBA float"), src_buf, 
+                    GEGL_AUTO_ROWSTRIDE);
+
         toreturn = do_plasma (src_buf, &roi, src_buf, &roi, xm, ym, x2, y2, depth - 1,
                               scale_depth + 1, gr, op); 
         gegl_buffer_set (output, &roi, babl_format ("RGBA float"), src_buf,
@@ -521,13 +536,13 @@ process (GeglOperation       *operation,
   x = boundary.x + boundary.width;
   y = boundary.y + boundary.height;
 
-  do_plasma_big (input, output, boundary.x, boundary.y, x-1, y-1, -1,
+  do_plasma_big (output, output, boundary.x, boundary.y, x-1, y-1, -1,
                  0, gr, o);
    /*
     * Now we recurse through the images, going deeper each time
     */
   depth = 1;
-  while (!do_plasma_big (input, output, boundary.x, boundary.y, x-1, 
+  while (!do_plasma_big (output, output, boundary.x, boundary.y, x-1, 
                          y-1, depth, 0, gr, o))
           depth++;
 
@@ -558,8 +573,6 @@ gegl_chant_class_init (GeglChantClass *klass)
   GeglOperationClass       *operation_class;
   GeglOperationFilterClass *filter_class;
 
-  f=fopen("tryyy","w+t");
-
   operation_class = GEGL_OPERATION_CLASS (klass);
   filter_class    = GEGL_OPERATION_FILTER_CLASS (klass);
 



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