more legible/a bit faster

This commit is contained in:
Nicolas Robidoux 2009-03-18 03:42:19 +00:00
parent d88da2a63e
commit cb7991be06
1 changed files with 26 additions and 21 deletions

View File

@ -1,7 +1,7 @@
/* nohalo level 1 interpolator
*
* Hacked for vips by J. Cupitt, 20/1/09
* Tweaks by N. Robidoux and J. Cupitt 3/09
* Tweaks by N. Robidoux and J. Cupitt 4-17/3/09
*
* 16/3/09
* - rename as nohalo1
@ -467,44 +467,49 @@ nohalo1( const double uno_two,
{ \
T* restrict out = (T *) pout; \
\
const int relative_y_is_down = ( relative_y >= 0. ); \
const int relative_x_is_rite = ( relative_x >= 0. ); \
const int relative_y_is_down = ( relative_y >= 0. ); \
\
const int sign_of_relative_y = 2 * relative_y_is_down - 1; \
const int sign_of_relative_x = 2 * relative_x_is_rite - 1; \
const int sign_of_relative_y = 2 * relative_y_is_down - 1; \
\
const int corner_reflection_shift = \
relative_y_is_down * lskip + relative_x_is_rite * bands; \
relative_x_is_rite * bands + relative_y_is_down * lskip; \
\
const int shift_1_row = sign_of_relative_y * lskip; \
const int shift_1_pixel = sign_of_relative_x * bands; \
const int shift_back_1_pixel = sign_of_relative_x * bands; \
const int shift_back_1_row = sign_of_relative_y * lskip; \
\
const T* restrict in = ( (T *) pin ) + corner_reflection_shift; \
\
const int uno_two_shift = shift_1_row; \
const int uno_thr_shift = shift_1_row - shift_1_pixel; \
\
const int dos_one_shift = shift_1_pixel; \
const int dos_two_shift = 0; \
const int dos_thr_shift = -shift_1_pixel; \
const int shift_forw_1_pixel = -shift_back_1_pixel; \
const int shift_forw_1_row = -shift_back_1_row; \
\
const double w = ( 2 * sign_of_relative_x ) * relative_x; \
const double z = ( 2 * sign_of_relative_y ) * relative_y; \
\
const int dos_fou_shift = 2 * dos_thr_shift; \
const int shift_forw_2_pixel = 2 * shift_forw_1_pixel; \
const int shift_forw_2_row = 2 * shift_forw_1_row; \
\
const int uno_two_shift = shift_back_1_row; \
const int uno_thr_shift = shift_forw_1_pixel + shift_back_1_row; \
\
const double x = 1. - w; \
\
const int tre_one_shift = dos_one_shift - shift_1_row; \
const int tre_two_shift = -shift_1_row; \
const int tre_thr_shift = dos_thr_shift - shift_1_row; \
const int tre_fou_shift = dos_fou_shift - shift_1_row; \
\
const double w_times_z = w * z; \
\
const int dos_one_shift = shift_back_1_pixel; \
const int dos_two_shift = 0; \
const int dos_thr_shift = shift_forw_1_pixel; \
const int dos_fou_shift = shift_forw_2_pixel; \
\
const int tre_one_shift = shift_back_1_pixel + shift_forw_1_row; \
const int tre_two_shift = shift_forw_1_row; \
const int tre_thr_shift = shift_forw_1_pixel + shift_forw_1_row; \
const int tre_fou_shift = shift_forw_2_pixel + shift_forw_1_row; \
\
const double x_times_z = x * z; \
\
const int qua_two_shift = tre_two_shift - shift_1_row; \
const int qua_thr_shift = tre_thr_shift - shift_1_row; \
const int qua_two_shift = shift_forw_2_row; \
const int qua_thr_shift = shift_forw_1_pixel + shift_forw_2_row; \
\
const double w_times_y_over_4 = .25 * ( w - w_times_z ); \
const double x_times_z_over_4 = .25 * x_times_z; \