From 47dec2610f189d2b9ce5117a5d2f3559513ad0eb Mon Sep 17 00:00:00 2001 From: Nicolas Robidoux Date: Fri, 27 Mar 2009 01:26:06 +0000 Subject: [PATCH] slightly shorter nohalo1 and snohalo1 --- libsrc/resample/nohalo1.cpp | 25 +++++++++----------- libsrc/resample/snohalo1.cpp | 45 +++++++++++++++++------------------- 2 files changed, 32 insertions(+), 38 deletions(-) diff --git a/libsrc/resample/nohalo1.cpp b/libsrc/resample/nohalo1.cpp index 96dc60a2..e379983e 100644 --- a/libsrc/resample/nohalo1.cpp +++ b/libsrc/resample/nohalo1.cpp @@ -422,27 +422,24 @@ nohalo1( const double uno_two, * Compute the "diagonal" (at the boundary between thrr input * pixel areas) double resolution pixel value: */ - const double piece_of_eight_times_dostre_twothr = - four_times_dos_twothr - + - four_times_dostre_two - + - 2. * deux_thr_plus_deux_dos; - const double eight_times_dostre_twothr = FAST_MINMOD( deux_tre, prem_tre, deux_prem_tre, deux_prem_minus_deux_deux_tre ) + + + 2. * deux_thr_plus_deux_dos - FAST_MINMOD( deux_tre, troi_tre, deux_troi_tre, deux_troi_minus_deux_deux_tre ) + + four_times_dos_twothr + + FAST_MINMOD( deux_thr, prem_thr, deux_prem_thr, deux_prem_minus_deux_deux_thr ) + + + four_times_dostre_two - FAST_MINMOD( deux_thr, troi_thr, deux_troi_thr, - deux_troi_minus_deux_deux_thr ) - + - piece_of_eight_times_dostre_twothr; + deux_troi_minus_deux_deux_thr ); /* * Return the first newly computed double density values: @@ -588,10 +585,10 @@ vips_interpolate_nohalo1_interpolate( VipsInterpolate* restrict interpolate, * position of the center of the convex hull of the 2x2 block of * closest pixels. Similarly for y. Range of values: [-.5,.5). */ - const int iy = FAST_PSEUDO_FLOOR (absolute_y); - const double relative_y = absolute_y_minus_half - iy; - const int ix = FAST_PSEUDO_FLOOR (absolute_x); - const double relative_x = absolute_x_minus_half - ix; + const int iy = FAST_PSEUDO_FLOOR (absolute_y); + const double relative_y = absolute_y_minus_half - iy; + const int ix = FAST_PSEUDO_FLOOR (absolute_x); + const double relative_x = absolute_x_minus_half - ix; /* * Move the pointer to (the first band of) the top/left pixel of the diff --git a/libsrc/resample/snohalo1.cpp b/libsrc/resample/snohalo1.cpp index 34432b45..ea90e634 100644 --- a/libsrc/resample/snohalo1.cpp +++ b/libsrc/resample/snohalo1.cpp @@ -305,11 +305,11 @@ snohalo1( const double blur, const double four_times_dos_twothr = FAST_MINMOD( deux_dos, prem_dos, deux_prem_dos, deux_prem_minus_deux_deux_dos ) + + + 2. * dos_two_plus_dos_thr - FAST_MINMOD( deux_dos, troi_dos, deux_troi_dos, - deux_troi_minus_deux_deux_dos ) - + - 2. * dos_two_plus_dos_thr; + deux_troi_minus_deux_deux_dos ); /* * Compute the needed "down" double resolution pixel value: @@ -317,37 +317,34 @@ snohalo1( const double blur, const double four_times_dostre_two = FAST_MINMOD( deux_two, prem_two, deux_prem_two, deux_prem_minus_deux_deux_two ) + + + 2. * dos_two_plus_tre_two - FAST_MINMOD( deux_two, troi_two, deux_troi_two, - deux_troi_minus_deux_deux_two ) - + - 2. * dos_two_plus_tre_two; + deux_troi_minus_deux_deux_two ); /* * Compute the "diagonal" (at the boundary between thrr input * pixel areas) double resolution pixel value: */ - const double piece_of_eight_times_dostre_twothr = - four_times_dos_twothr - + - four_times_dostre_two - + - 2. * deux_thr_plus_deux_dos; - const double eight_times_dostre_twothr = FAST_MINMOD( deux_tre, prem_tre, deux_prem_tre, deux_prem_minus_deux_deux_tre ) + + + 2. * deux_thr_plus_deux_dos - FAST_MINMOD( deux_tre, troi_tre, deux_troi_tre, deux_troi_minus_deux_deux_tre ) + + four_times_dos_twothr + + FAST_MINMOD( deux_thr, prem_thr, deux_prem_thr, deux_prem_minus_deux_deux_thr ) + + + four_times_dostre_two - FAST_MINMOD( deux_thr, troi_thr, deux_troi_thr, - deux_troi_minus_deux_deux_thr ) - + - piece_of_eight_times_dostre_twothr; + deux_troi_minus_deux_deux_thr ); /* * Return the first newly computed double density values: @@ -524,9 +521,9 @@ vips_interpolate_snohalo1_interpolate( VipsInterpolate* restrict interpolate, * position of the center of the convex hull of the 2x2 block of * closest pixels. Similarly for y. Range of values: [-.5,.5). */ - const int iy = FAST_PSEUDO_FLOOR (absolute_y); + const int iy = FAST_PSEUDO_FLOOR (absolute_y); const double relative_y = absolute_y_minus_half - iy; - const int ix = FAST_PSEUDO_FLOOR (absolute_x); + const int ix = FAST_PSEUDO_FLOOR (absolute_x); const double relative_x = absolute_x_minus_half - ix; /* @@ -544,12 +541,12 @@ vips_interpolate_snohalo1_interpolate( VipsInterpolate* restrict interpolate, #define CALL( T, inter ) \ snohalo1_ ## inter( out, \ - p, \ - bands, \ - lskip, \ - snohalo1->blur, \ - relative_x, \ - relative_y ); + p, \ + bands, \ + lskip, \ + snohalo1->blur, \ + relative_x, \ + relative_y ); switch( in->im->BandFmt ) { case IM_BANDFMT_UCHAR: