[gegl] transform-core and sampler: lint removal



commit d596cac647fd8488a344de7c459711b62f4dfabe
Author: Nicolas Robidoux <nrobidoux git gnome org>
Date:   Tue Dec 25 20:41:51 2012 -0500

    transform-core and sampler: lint removal

 gegl/buffer/gegl-sampler.c            |   17 +++---
 operations/transform/transform-core.c |   95 +++-----------------------------
 2 files changed, 18 insertions(+), 94 deletions(-)
---
diff --git a/gegl/buffer/gegl-sampler.c b/gegl/buffer/gegl-sampler.c
index f2194bd..515ea93 100644
--- a/gegl/buffer/gegl-sampler.c
+++ b/gegl/buffer/gegl-sampler.c
@@ -258,16 +258,17 @@ gegl_sampler_get_ptr (GeglSampler *const sampler,
        * into account that it is more likely that further access is to
        * the right or down of our currently requested
        * position. Consequently, we move the top left corner of the
-       * context_rect, leaving an elbow room there which is typically
-       * just a bit more in the vertical direction than in the
-       * horizontal direction, which is desirable because the buffers'
-       * scanlines are longer than they are tall, which means they are
-       * more likely to escape the buffer than the beginning of the
-       * next scanline.
+       * context_rect, which has the effect of leaving elbow room there.
        *
        * Note that transform-core now works hard to have scanlines go
-       * left to right in input space, and then tries to have further
-       * scanlines below instead of above.
+       * toward the interior of the buffer.
+       *
+       * For operations like resize and left-right and top-bottom
+       * reflections, there is no reason to add elbow room. This means
+       * that the following code will need to have a dual personality
+       * sooner or later. Eliminating the elbow room for such
+       * operations (and making tiles elongated rectangles) gives a
+       * big speedup.
        */
       fetch_rectangle.width  = maximum_width;
       fetch_rectangle.height = maximum_height;
diff --git a/operations/transform/transform-core.c b/operations/transform/transform-core.c
index 516372d..ba54d9f 100644
--- a/operations/transform/transform-core.c
+++ b/operations/transform/transform-core.c
@@ -127,28 +127,6 @@ op_transform_get_type (void)
   return g_define_type_id;
 }
 
-#if 0
-static void
-op_affine_sampler_init (OpTransform *self)
-{
-  GType                 desired_type;
-  GeglInterpolation     interpolation;
-
-  interpolation = gegl_buffer_interpolation_from_string (self->filter);
-  desired_type = gegl_sampler_type_from_interpolation (interpolation);
-
-  if (self->sampler != NULL &&
-      !G_TYPE_CHECK_INSTANCE_TYPE (self->sampler, desired_type))
-    {
-      self->sampler->buffer=NULL;
-      g_object_unref(self->sampler);
-      self->sampler = NULL;
-    }
-
-  self->sampler = op_affine_sampler (self);
-}
-#endif
-
 static void
 gegl_transform_prepare (GeglOperation *operation)
 {
@@ -211,7 +189,7 @@ op_transform_class_init (OpTransformClass *klass)
                                      FALSE,
                                      G_PARAM_CONSTRUCT | G_PARAM_READWRITE));
   /*
-   * Lanczos is gone. This is lint.
+   * Lanczos is gone. What follows is lint.
    */
   g_object_class_install_property (gobject_class, PROP_LANCZOS_WIDTH,
                                    g_param_spec_int (
@@ -331,8 +309,6 @@ gegl_transform_bounding_box (const gdouble *points,
                              GeglRectangle *output)
 {
   /*
-   * This function has changed behavior.
-   *
    * Take the points defined by consecutive pairs of gdoubles as
    * absolute positions, that is, positions in the coordinate system
    * with origin at the center of the pixel with index [0][0].
@@ -473,25 +449,15 @@ gegl_transform_get_bounding_box (GeglOperation *op)
   gint          i;
 
   /*
-   * transform_get_bounding_box has changed behavior.
-   *
-   * It now gets the bounding box of the forward mapped outer input
-   * pixel corners that correspond to the involved indices, where
-   * "bounding" is defined by output pixel areas. The output space
-   * indices of the bounding output pixels is returned.
+   * Gets the bounding box of the forward mapped outer input pixel
+   * corners that correspond to the involved indices, where "bounding"
+   * is defined by output pixel areas. The output space indices of the
+   * bounding output pixels is returned.
    *
    * Note: Don't forget that the boundary between two pixel areas is
    * "owned" by the pixel to the right/bottom.
    */
 
-#if 0
-  /*
-   * See comments below RE: why this is "commented" out.
-   */
-  GeglRectangle  context_rect;
-  GeglSampler   *sampler;
-#endif
-
   if (gegl_operation_source_get_bounding_box (op, "input"))
     in_rect = *gegl_operation_source_get_bounding_box (op, "input");
 
@@ -505,43 +471,6 @@ gegl_transform_get_bounding_box (GeglOperation *op)
       gegl_matrix3_is_identity (&matrix))
     return in_rect;
 
-#if 0
-  /*
-   * Commenting out the following (and the corresponding declarations
-   * above) is a major change.
-   *
-   * Motivation: transform_get_bounding_box propagates the in_rect
-   * "forward" into the output. There is no reason why the output
-   * should be enlarged by a sampler's context_rect: What the output
-   * "region" is, and what's needed to produce it, are two separate
-   * issues. It's not because a sampler needs lots of extra data that
-   * the output should be enlarged too.
-   */
-  sampler = gegl_buffer_sampler_new (NULL, babl_format("RaGaBaA float"),
-      gegl_sampler_type_from_string (transform->filter));
-  context_rect = *gegl_sampler_get_context_rect (sampler);
-  g_object_unref (sampler);
-
-  if (!gegl_transform_matrix3_allow_fast_translate (&matrix))
-    {
-      in_rect.x += context_rect.x;
-      in_rect.y += context_rect.y;
-      /*
-       * Does "- (gint) 1" interact badly with {*,*,0,0}?
-       */
-      in_rect.width  += context_rect.width  - (gint) 1 > (gint) 0
-                        ?
-                        context_rect.width  - (gint) 1
-                        :
-                        (gint) 0;
-      in_rect.height += context_rect.height - (gint) 1 > (gint) 0
-                        ?
-                        context_rect.height - (gint) 1
-                        :
-                        (gint) 0;
-    }
-#endif
-
   /*
    * Convert indices to absolute positions of the left and top outer
    * pixel corners.
@@ -584,8 +513,6 @@ gegl_transform_detect (GeglOperation *operation,
   gdouble      need_points [2];
 
   /*
-   * This function has changed behavior.
-   *
    * transform_detect figures out which pixel in the input most
    * closely corresponds to the pixel with index [x][y] in the output.
    * Ties are resolved toward the right and bottom.
@@ -631,10 +558,6 @@ gegl_transform_get_required_for_output (GeglOperation       *op,
   gdouble        need_points [8];
   gint           i;
 
-  /*
-   * This function has changed behavior.
-   */
-
   requested_rect = *region;
   sampler =
     gegl_buffer_sampler_new (NULL,
@@ -1059,10 +982,10 @@ transform_generic (GeglBuffer  *dest,
         (gint) 0;
 
       /*
-       * Now determine whether to flip in the horizontal
-       * direction. Done last because this is the most important one,
-       * and consequently we want to use the likely "initial scanline"
-       * to at least get that one about right.
+       * Determine whether to flip in the horizontal direction. Done
+       * last because this is the most important one, and consequently
+       * we want to use the likely "initial scanline" to at least get
+       * that one about right.
        */
       const gdouble u_start_x = bflip_y ? u_float_y : u_start_y;
       const gdouble v_start_x = bflip_y ? v_float_y : v_start_y;



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