[gegl/samplers] lohalo: add Knuth's floored division by 2



commit 77dcbc264545f712723d82b695256e64f77db95f
Author: Nicolas Robidoux <nicolas robidoux gmail com>
Date:   Wed Jun 22 17:04:29 2011 -0400

    lohalo: add Knuth's floored division by 2

 gegl/buffer/gegl-sampler-lohalo.c |   31 ++++++++++++++++++++++++++-----
 1 files changed, 26 insertions(+), 5 deletions(-)
---
diff --git a/gegl/buffer/gegl-sampler-lohalo.c b/gegl/buffer/gegl-sampler-lohalo.c
index 253afea..1547d1f 100644
--- a/gegl/buffer/gegl-sampler-lohalo.c
+++ b/gegl/buffer/gegl-sampler-lohalo.c
@@ -186,6 +186,12 @@
 
 
 /*
+ * A macro for Knuth's floored division:
+ */
+/* #define LOHALO_FLOORED_DIVISION(a,b) (((a) - ((a)<0 ? (b)-1 : 0)) / (b)) */
+#define LOHALO_FLOORED_DIVISION_BY_2(a) (((a) - ((a)>=0 ? 0 : 1)) / 2)
+
+/*
  * Convenience macro:
  */
 #define LOHALO_CALL_EWA_UPDATE(j,i) ewa_update ((j),            \
@@ -2072,7 +2078,7 @@ gegl_sampler_lohalo_get (      GeglSampler* restrict self,
 	     )
 	     {
 	       /*
-		* We don't need data outside of the level 0
+		* We don't need data outside of the mipmap level 0
 		* context_rect. Blend and ship out:
 		*/
 	       const gfloat beta = ( (gfloat) 1. - theta ) / total_weight;
@@ -2085,10 +2091,25 @@ gegl_sampler_lohalo_get (      GeglSampler* restrict self,
 	       return;
 	     }
 
-	  /*
-	   * We need higher mipmap level(s) because the ellipse is too
-	   * big.
-	   */
+	  {
+	    /*
+	     * We need higher mipmap level(s) because the ellipse is
+	     * too big.
+	     */
+
+	    /*
+	     * Find the nearest mipmap anchor pixel location:
+	     */
+	    gint const ix_1 = ix_0 % 2;
+
+	    /* gint I =  */
+	    
+	    /* do */
+	    /*   { */
+		
+	    /*   } while */
+          }
+
         }
       }
     }



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