[gegl] cosmetic



commit f40e9eab92db47270e443676ca79730edcfb2a25
Author: Nicolas Robidoux <nrobidoux git gnome org>
Date:   Fri Dec 21 20:49:54 2012 -0500

    cosmetic

 gegl/buffer/gegl-sampler-lohalo.c |  375 +++++++++++++++++++------------------
 1 files changed, 189 insertions(+), 186 deletions(-)
---
diff --git a/gegl/buffer/gegl-sampler-lohalo.c b/gegl/buffer/gegl-sampler-lohalo.c
index 7ab94b4..baa89e1 100644
--- a/gegl/buffer/gegl-sampler-lohalo.c
+++ b/gegl/buffer/gegl-sampler-lohalo.c
@@ -424,7 +424,11 @@ gegl_sampler_lohalo_class_init (GeglSamplerLohaloClass *klass)
 #define LOHALO_OFFSET_6 LOHALO_OFFSET_MIPMAP
 #define LOHALO_SIZE_6   LOHALO_SIZE_MIPMAP
 
-#define LOHALO_OFFSET_7 ((GEGL_SAMPLER_MAXIMUM_HEIGHT-1)/2)
+/*
+ * We don't go all out to allow for rounding error in positioning
+ * computation.
+ */
+#define LOHALO_OFFSET_7 (GEGL_SAMPLER_MAXIMUM_HEIGHT/2-2)
 #define LOHALO_SIZE_7   (1+2*LOHALO_SIZE_6)
 
 /*
@@ -826,7 +830,6 @@ nohalo_subdivision (const gfloat           uno_two,
   const gfloat dos_two_x = LOHALO_MINMOD( d_dos_twothr, d_dos_onetwo,
                                           d_dos_twothr_sq,
                                           d_dos_onetwo_times_twothr );
-
   const gfloat dos_two_y = LOHALO_MINMOD( d_dostre_two, d_unodos_two,
                                           d_dostre_two_sq,
                                           d_unodos_times_dostre_two );
@@ -2443,202 +2446,202 @@ gegl_sampler_lohalo_get (      GeglSampler*    restrict  self,
                 LOHALO_MIPMAP_EWA_UPDATE(1)
 
                 {
-		/*
-		 * Second mipmap level.
-		 */
+                /*
+                 * Second mipmap level.
+                 */
                 const gint odd_ix_1 = ix_1 % 2;
-		const gint odd_iy_1 = iy_1 % 2;
-		LOHALO_FIND_CLOSEST_LOCATIONS(1,2)
+                const gint odd_iy_1 = iy_1 % 2;
+                LOHALO_FIND_CLOSEST_LOCATIONS(1,2)
                 if (( x_1 - bounding_box_half_width  < closest_left_2 ) ||
-		    ( x_1 + bounding_box_half_width  > closest_rite_2 ) ||
-		    ( y_1 - bounding_box_half_height < closest_top_2  ) ||
-		    ( y_1 + bounding_box_half_height > closest_bot_2  ))
-		  {
+                    ( x_1 + bounding_box_half_width  > closest_rite_2 ) ||
+                    ( y_1 - bounding_box_half_height < closest_top_2  ) ||
+                    ( y_1 + bounding_box_half_height > closest_bot_2  ))
+                  {
                   const gint ix_2 = LOHALO_FLOORED_DIVISION_BY_2(ix_1);
                   const gint iy_2 = LOHALO_FLOORED_DIVISION_BY_2(iy_1);
                   const gfloat* restrict input_bptr_2 =
-		    (gfloat*) gegl_sampler_get_from_mipmap (self,
-							    ix_2,
-							    iy_2,
-							    (gint) 2,
-							    repeat_mode);
-		  const gfloat x_2 =
-		    x_1 + (gfloat) ( 2 * ( ix_1 - 2 * ix_2 ) - 1 );
-		  const gfloat y_2 =
-		    y_1 + (gfloat) ( 2 * ( iy_1 - 2 * iy_2 ) - 1 );
-		  LOHALO_FIND_CLOSEST_INDICES(1,2)
+                    (gfloat*) gegl_sampler_get_from_mipmap (self,
+                                                            ix_2,
+                                                            iy_2,
+                                                            (gint) 2,
+                                                            repeat_mode);
+                  const gfloat x_2 =
+                    x_1 + (gfloat) ( 2 * ( ix_1 - 2 * ix_2 ) - 1 );
+                  const gfloat y_2 =
+                    y_1 + (gfloat) ( 2 * ( iy_1 - 2 * iy_2 ) - 1 );
+                  LOHALO_FIND_CLOSEST_INDICES(1,2)
                   LOHALO_FIND_FARTHEST_INDICES(2)
                   LOHALO_MIPMAP_EWA_UPDATE(2)
-		      
-		  {
-		  /*
-		   * Third mipmap level.
-		   */
-		  const gint odd_ix_2 = ix_2 % 2;
-		  const gint odd_iy_2 = iy_2 % 2;
-		  LOHALO_FIND_CLOSEST_LOCATIONS(2,3)
-		  if (( x_2 - bounding_box_half_width  < closest_left_3 ) ||
-		      ( x_2 + bounding_box_half_width  > closest_rite_3 ) ||
-		      ( y_2 - bounding_box_half_height < closest_top_3  ) ||
-		      ( y_2 + bounding_box_half_height > closest_bot_3  ))
-		    {
-		    const gint ix_3 =
-		      LOHALO_FLOORED_DIVISION_BY_2(ix_2);
-		    const gint iy_3 =
-		      LOHALO_FLOORED_DIVISION_BY_2(iy_2);
-		    const gfloat* restrict input_bptr_3 =
-		      (gfloat*) gegl_sampler_get_from_mipmap (self,
-							      ix_3,
-							      iy_3,
-							      (gint) 3,
-							      repeat_mode);
-		    const gfloat x_3 =
-		      x_2 + (gfloat) ( 2 * ( ix_2 - 2 * ix_3 ) - 1 );
-		    const gfloat y_3 =
-		      y_2 + (gfloat) ( 2 * ( iy_2 - 2 * iy_3 ) - 1 );
-		    LOHALO_FIND_CLOSEST_INDICES(2,3)
+
+                  {
+                  /*
+                   * Third mipmap level.
+                   */
+                  const gint odd_ix_2 = ix_2 % 2;
+                  const gint odd_iy_2 = iy_2 % 2;
+                  LOHALO_FIND_CLOSEST_LOCATIONS(2,3)
+                  if (( x_2 - bounding_box_half_width  < closest_left_3 ) ||
+                      ( x_2 + bounding_box_half_width  > closest_rite_3 ) ||
+                      ( y_2 - bounding_box_half_height < closest_top_3  ) ||
+                      ( y_2 + bounding_box_half_height > closest_bot_3  ))
+                    {
+                    const gint ix_3 =
+                      LOHALO_FLOORED_DIVISION_BY_2(ix_2);
+                    const gint iy_3 =
+                      LOHALO_FLOORED_DIVISION_BY_2(iy_2);
+                    const gfloat* restrict input_bptr_3 =
+                      (gfloat*) gegl_sampler_get_from_mipmap (self,
+                                                              ix_3,
+                                                              iy_3,
+                                                              (gint) 3,
+                                                              repeat_mode);
+                    const gfloat x_3 =
+                      x_2 + (gfloat) ( 2 * ( ix_2 - 2 * ix_3 ) - 1 );
+                    const gfloat y_3 =
+                      y_2 + (gfloat) ( 2 * ( iy_2 - 2 * iy_3 ) - 1 );
+                    LOHALO_FIND_CLOSEST_INDICES(2,3)
                     LOHALO_FIND_FARTHEST_INDICES(3)
                     LOHALO_MIPMAP_EWA_UPDATE(3)
 
-		    {  
-		    /*
-		     * Fourth mipmap level.
-		     */
-		    const gint odd_ix_3 = ix_3 % 2;
-		    const gint odd_iy_3 = iy_3 % 2;
-		    LOHALO_FIND_CLOSEST_LOCATIONS(3,4)
-		    if (( x_3 - bounding_box_half_width  < closest_left_4 ) ||
-			( x_3 + bounding_box_half_width  > closest_rite_4 ) ||
-			( y_3 - bounding_box_half_height < closest_top_4  ) ||
-			( y_3 + bounding_box_half_height > closest_bot_4  ))
-		      {
-		      const gint ix_4 =
-			LOHALO_FLOORED_DIVISION_BY_2(ix_3);
-		      const gint iy_4 =
-			LOHALO_FLOORED_DIVISION_BY_2(iy_3);
-		      const gfloat* restrict input_bptr_4 =
-			(gfloat*) gegl_sampler_get_from_mipmap (self,
-								ix_4,
-								iy_4,
-								(gint) 4,
-								repeat_mode);
-		      const gfloat x_4 =
-			x_3 + (gfloat) ( 2 * ( ix_3 - 2 * ix_4 ) - 1 );
-		      const gfloat y_4 =
-			y_3 + (gfloat) ( 2 * ( iy_3 - 2 * iy_4 ) - 1 );
-		      LOHALO_FIND_CLOSEST_INDICES(3,4)
-		      LOHALO_FIND_FARTHEST_INDICES(4)
-		      LOHALO_MIPMAP_EWA_UPDATE(4)
-
-		      {
-		      /*
-		       * Fifth mipmap level.
-		       */
-		      const gint odd_ix_4 = ix_4 % 2;
-		      const gint odd_iy_4 = iy_4 % 2;
-		      LOHALO_FIND_CLOSEST_LOCATIONS(4,5)
-		      if (( x_4 - bounding_box_half_width  < closest_left_5 ) ||
-			  ( x_4 + bounding_box_half_width  > closest_rite_5 ) ||
-			  ( y_4 - bounding_box_half_height < closest_top_5  ) ||
-			  ( y_4 + bounding_box_half_height > closest_bot_5  ))
-			{
-			const gint ix_5 =
-			  LOHALO_FLOORED_DIVISION_BY_2(ix_4);
-			const gint iy_5 =
-			  LOHALO_FLOORED_DIVISION_BY_2(iy_4);
-			const gfloat* restrict input_bptr_5 =
-			  (gfloat*) gegl_sampler_get_from_mipmap (self,
-								  ix_5,
-								  iy_5,
-								  (gint) 5,
-								  repeat_mode);
-			const gfloat x_5 =
-			  x_4 + (gfloat) ( 2 * ( ix_4 - 2 * ix_5 ) - 1 );
-			const gfloat y_5 =
-			  y_4 + (gfloat) ( 2 * ( iy_4 - 2 * iy_5 ) - 1 );
-			LOHALO_FIND_CLOSEST_INDICES(4,5)
-			LOHALO_FIND_FARTHEST_INDICES(5)
-			LOHALO_MIPMAP_EWA_UPDATE(5)
-
-			{
-			/*
-			 * Sixth mipmap level.
-			 */
-			const gint odd_ix_5 = ix_5 % 2;
-			const gint odd_iy_5 = iy_5 % 2;
-			LOHALO_FIND_CLOSEST_LOCATIONS(5,6)
-			if (( x_5 - bounding_box_half_width
-			      < closest_left_6 ) ||
-			    ( x_5 + bounding_box_half_width
-			      > closest_rite_6 ) ||
-			    ( y_5 - bounding_box_half_height
-			      < closest_top_6  ) ||
-			    ( y_5 + bounding_box_half_height
-			      > closest_bot_6  ))
-			  {
-			  const gint ix_6 = LOHALO_FLOORED_DIVISION_BY_2(ix_5);
-			  const gint iy_6 = LOHALO_FLOORED_DIVISION_BY_2(iy_5);
-			  const gfloat* restrict input_bptr_6 = (gfloat*)
-			    gegl_sampler_get_from_mipmap (self,
-							  ix_6,
-							  iy_6,
-							  (gint) 6,
-							  repeat_mode);
-			  const gfloat x_6 =
-			    x_5 + (gfloat) ( 2 * ( ix_5 - 2 * ix_6 ) - 1 );
-			  const gfloat y_6 =
-			    y_5 + (gfloat) ( 2 * ( iy_5 - 2 * iy_6 ) - 1 );
-			  LOHALO_FIND_CLOSEST_INDICES(5,6)
-			  LOHALO_FIND_FARTHEST_INDICES(6)
-			  LOHALO_MIPMAP_EWA_UPDATE(6)
-
-			  {
-			  /*
-			   * Seventh mipmap level (eight if counted
-			   * from zero = straight up).
-			   */
-			  const gint odd_ix_6 = ix_6 % 2;
-			  const gint odd_iy_6 = iy_6 % 2;
-			  LOHALO_FIND_CLOSEST_LOCATIONS(6,7)
-			  if (( x_6 - bounding_box_half_width
-				< closest_left_7 ) ||
-			      ( x_6 + bounding_box_half_width
-				> closest_rite_7 ) ||
-			      ( y_6 - bounding_box_half_height
-				< closest_top_7  ) ||
-			      ( y_6 + bounding_box_half_height
-				> closest_bot_7  ))
-			    {
+                    {
+                    /*
+                     * Fourth mipmap level.
+                     */
+                    const gint odd_ix_3 = ix_3 % 2;
+                    const gint odd_iy_3 = iy_3 % 2;
+                    LOHALO_FIND_CLOSEST_LOCATIONS(3,4)
+                    if (( x_3 - bounding_box_half_width  < closest_left_4 ) ||
+                        ( x_3 + bounding_box_half_width  > closest_rite_4 ) ||
+                        ( y_3 - bounding_box_half_height < closest_top_4  ) ||
+                        ( y_3 + bounding_box_half_height > closest_bot_4  ))
+                      {
+                      const gint ix_4 =
+                        LOHALO_FLOORED_DIVISION_BY_2(ix_3);
+                      const gint iy_4 =
+                        LOHALO_FLOORED_DIVISION_BY_2(iy_3);
+                      const gfloat* restrict input_bptr_4 =
+                        (gfloat*) gegl_sampler_get_from_mipmap (self,
+                                                                ix_4,
+                                                                iy_4,
+                                                                (gint) 4,
+                                                                repeat_mode);
+                      const gfloat x_4 =
+                        x_3 + (gfloat) ( 2 * ( ix_3 - 2 * ix_4 ) - 1 );
+                      const gfloat y_4 =
+                        y_3 + (gfloat) ( 2 * ( iy_3 - 2 * iy_4 ) - 1 );
+                      LOHALO_FIND_CLOSEST_INDICES(3,4)
+                      LOHALO_FIND_FARTHEST_INDICES(4)
+                      LOHALO_MIPMAP_EWA_UPDATE(4)
+
+                      {
+                      /*
+                       * Fifth mipmap level.
+                       */
+                      const gint odd_ix_4 = ix_4 % 2;
+                      const gint odd_iy_4 = iy_4 % 2;
+                      LOHALO_FIND_CLOSEST_LOCATIONS(4,5)
+                      if (( x_4 - bounding_box_half_width  < closest_left_5 ) ||
+                          ( x_4 + bounding_box_half_width  > closest_rite_5 ) ||
+                          ( y_4 - bounding_box_half_height < closest_top_5  ) ||
+                          ( y_4 + bounding_box_half_height > closest_bot_5  ))
+                        {
+                        const gint ix_5 =
+                          LOHALO_FLOORED_DIVISION_BY_2(ix_4);
+                        const gint iy_5 =
+                          LOHALO_FLOORED_DIVISION_BY_2(iy_4);
+                        const gfloat* restrict input_bptr_5 =
+                          (gfloat*) gegl_sampler_get_from_mipmap (self,
+                                                                  ix_5,
+                                                                  iy_5,
+                                                                  (gint) 5,
+                                                                  repeat_mode);
+                        const gfloat x_5 =
+                          x_4 + (gfloat) ( 2 * ( ix_4 - 2 * ix_5 ) - 1 );
+                        const gfloat y_5 =
+                          y_4 + (gfloat) ( 2 * ( iy_4 - 2 * iy_5 ) - 1 );
+                        LOHALO_FIND_CLOSEST_INDICES(4,5)
+                        LOHALO_FIND_FARTHEST_INDICES(5)
+                        LOHALO_MIPMAP_EWA_UPDATE(5)
+
+                        {
+                        /*
+                         * Sixth mipmap level.
+                         */
+                        const gint odd_ix_5 = ix_5 % 2;
+                        const gint odd_iy_5 = iy_5 % 2;
+                        LOHALO_FIND_CLOSEST_LOCATIONS(5,6)
+                        if (( x_5 - bounding_box_half_width
+                              < closest_left_6 ) ||
+                            ( x_5 + bounding_box_half_width
+                              > closest_rite_6 ) ||
+                            ( y_5 - bounding_box_half_height
+                              < closest_top_6  ) ||
+                            ( y_5 + bounding_box_half_height
+                              > closest_bot_6  ))
+                          {
+                          const gint ix_6 = LOHALO_FLOORED_DIVISION_BY_2(ix_5);
+                          const gint iy_6 = LOHALO_FLOORED_DIVISION_BY_2(iy_5);
+                          const gfloat* restrict input_bptr_6 = (gfloat*)
+                            gegl_sampler_get_from_mipmap (self,
+                                                          ix_6,
+                                                          iy_6,
+                                                          (gint) 6,
+                                                          repeat_mode);
+                          const gfloat x_6 =
+                            x_5 + (gfloat) ( 2 * ( ix_5 - 2 * ix_6 ) - 1 );
+                          const gfloat y_6 =
+                            y_5 + (gfloat) ( 2 * ( iy_5 - 2 * iy_6 ) - 1 );
+                          LOHALO_FIND_CLOSEST_INDICES(5,6)
+                          LOHALO_FIND_FARTHEST_INDICES(6)
+                          LOHALO_MIPMAP_EWA_UPDATE(6)
+
+                          {
+                          /*
+                           * Seventh mipmap level (eight if counted
+                           * from zero = straight up).
+                           */
+                          const gint odd_ix_6 = ix_6 % 2;
+                          const gint odd_iy_6 = iy_6 % 2;
+                          LOHALO_FIND_CLOSEST_LOCATIONS(6,7)
+                          if (( x_6 - bounding_box_half_width
+                                < closest_left_7 ) ||
+                              ( x_6 + bounding_box_half_width
+                                > closest_rite_7 ) ||
+                              ( y_6 - bounding_box_half_height
+                                < closest_top_7  ) ||
+                              ( y_6 + bounding_box_half_height
+                                > closest_bot_7  ))
+                            {
                             const gint ix_7 =
-			      LOHALO_FLOORED_DIVISION_BY_2(ix_6);
-			    const gint iy_7 =
-			      LOHALO_FLOORED_DIVISION_BY_2(iy_6);
-			    const gfloat* restrict input_bptr_7 = (gfloat*)
-			      gegl_sampler_get_from_mipmap (self,
-							    ix_7,
-							    iy_7,
-							    (gint) 7,
-							    repeat_mode);
-			    const gfloat x_7 =
-			      x_6 + (gfloat) ( 2 * ( ix_6 - 2 * ix_7 ) - 1 );
-			    const gfloat y_7 =
-			      y_6 + (gfloat) ( 2 * ( iy_6 - 2 * iy_7 ) - 1 );
-			    LOHALO_FIND_CLOSEST_INDICES(6,7)
-			    LOHALO_FIND_FARTHEST_INDICES(7)
+                              LOHALO_FLOORED_DIVISION_BY_2(ix_6);
+                            const gint iy_7 =
+                              LOHALO_FLOORED_DIVISION_BY_2(iy_6);
+                            const gfloat* restrict input_bptr_7 = (gfloat*)
+                              gegl_sampler_get_from_mipmap (self,
+                                                            ix_7,
+                                                            iy_7,
+                                                            (gint) 7,
+                                                            repeat_mode);
+                            const gfloat x_7 =
+                              x_6 + (gfloat) ( 2 * ( ix_6 - 2 * ix_7 ) - 1 );
+                            const gfloat y_7 =
+                              y_6 + (gfloat) ( 2 * ( iy_6 - 2 * iy_7 ) - 1 );
+                            LOHALO_FIND_CLOSEST_INDICES(6,7)
+                            LOHALO_FIND_FARTHEST_INDICES(7)
                             LOHALO_MIPMAP_EWA_UPDATE(7)
-			    }
-			  }
-			  }
-			}
-			}
-		      }
-		      }
-		    }
-		    }
-		  }
-		  }
-		}
-	      }
+                            }
+                          }
+                          }
+                        }
+                        }
+                      }
+                      }
+                    }
+                    }
+                  }
+                  }
+                }
+              }
 
             {
               /*



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