[gegl] transform-core.c: hoist Matrix3 operations out of the affine while loop



commit 471d2b8d9c433f259c5fd0a734fdad45f8666fa3
Author: Nicolas Robidoux <nrobidoux git gnome org>
Date:   Sun Dec 9 12:27:37 2012 -0500

    transform-core.c: hoist Matrix3 operations out of the affine while loop

 operations/transform/transform-core.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/operations/transform/transform-core.c b/operations/transform/transform-core.c
index 1dc2d20..b85cc48 100644
--- a/operations/transform/transform-core.c
+++ b/operations/transform/transform-core.c
@@ -894,15 +894,15 @@ transform_affine (GeglBuffer  *dest,
    * Jacobian matrix alone.
    */
 
+  gegl_matrix3_copy_into (&inverse, matrix);
+  gegl_matrix3_invert (&inverse);
+
   while (gegl_buffer_iterator_next (i))
     {
       GeglRectangle *roi = &i->roi[0];
 
       dest_buf = (gfloat *)i->data[0];
 
-      gegl_matrix3_copy_into (&inverse, matrix);
-      gegl_matrix3_invert (&inverse);
-
       /*
        * Set the inverse_jacobian matrix (a.k.a. scale) for samplers
        * that support it. The inverse jacobian will be "flipped" if
@@ -915,6 +915,11 @@ transform_affine (GeglBuffer  *dest,
        * matters, irrespective of orientation ("left-hand" VS
        * "right-hand") issues.
        */
+      /*
+       * For reasons that are mysterious (to Nicolas), hoisting the
+       * following setting of inverse_jacobian values out of the while
+       * loop changes the results of doing affine transformations.
+       */
       inverse_jacobian.coeff [0][0] = inverse.coeff [0][0];
       inverse_jacobian.coeff [0][1] = inverse.coeff [0][1];
       inverse_jacobian.coeff [1][0] = inverse.coeff [1][0];



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