diff --git a/ChangeLog b/ChangeLog index 6c8fbcbf..083c278b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,7 @@ - remove fading stuff from im_render() -- cleaner and simpler - configure spots support for "restrict" - reset dcm:display-range on magick read to help DICOM +- saner im_buildlut() behaviour 3/3/09 started 7.17.2 - im_magick2vips.c: allow funky bit depths, like 14 (thanks Mikkel) diff --git a/libsrc/histograms_lut/im_buildlut.c b/libsrc/histograms_lut/im_buildlut.c index 7654d5c9..cae08991 100644 --- a/libsrc/histograms_lut/im_buildlut.c +++ b/libsrc/histograms_lut/im_buildlut.c @@ -1,18 +1,14 @@ /* @(#) Build a LUT from a set of x/y points. Eg. if input is * @(#) - * @(#) 12 100 - * @(#) 14 110 - * @(#) 18 120 + * @(#) 0 0 + * @(#) 255 100 * @(#) * @(#) we generate * @(#) - * @(#) 100 (12) - * @(#) 105 - * @(#) 110 - * @(#) 112.5 - * @(#) 115 - * @(#) 117.5 - * @(#) 120 (18) + * @(#) 0 0 + * @(#) 1 0.4 + * @(#) .. etc. linear interpolation + * @(#) 255 100 * @(#) * @(#) The x/y points don't need to be sorted: we do that. You can have * @(#) several Ys ... each becomes a band in the output LUT. @@ -21,6 +17,8 @@ * - from im_invertlut() * 9/10/06 * - don't output x values + * 18/3/09 + * - saner limit and rounding behaviour */ /* @@ -141,7 +139,7 @@ build_state( State *state, DOUBLEMASK *input ) if( v > xhigh ) xhigh = v; } - state->lut_size = xhigh - xlow; + state->lut_size = xhigh - xlow + 1; if( state->lut_size < 1 ) { im_error( "im_buildlut", "%s", _( "x range too small" ) ); @@ -202,7 +200,7 @@ buildlut( State *state, IMAGE *output ) const int dx = x2 - x1; const double dy = y2 - y1; - for( i = 0; i < dx; i++, x += xsize - 1 ) + for( i = 0; i <= dx; i++, x += xsize - 1 ) odata[x] = y1 + i * dy / dx; } diff --git a/libsrc/resample/snohalo1.cpp b/libsrc/resample/snohalo1.cpp index 3670b9ce..34432b45 100644 --- a/libsrc/resample/snohalo1.cpp +++ b/libsrc/resample/snohalo1.cpp @@ -501,8 +501,6 @@ vips_interpolate_snohalo1_interpolate( VipsInterpolate* restrict interpolate, double absolute_x, double absolute_y ) { - VipsInterpolateSnohalo1Class *snohalo1_class = - VIPS_INTERPOLATE_SNOHALO1_GET_CLASS( interpolate ); VipsInterpolateSnohalo1 *snohalo1 = VIPS_INTERPOLATE_SNOHALO1( interpolate ); /* diff --git a/man/im_buildlut.3 b/man/im_buildlut.3 index 22809486..86cddc3d 100644 --- a/man/im_buildlut.3 +++ b/man/im_buildlut.3 @@ -13,18 +13,19 @@ im_buildlut( DOUBLEMASK *input, IMAGE *output ) constructs a LUT, interpolating a set of x/y points. Interpolation is strictly piecewise linear. For example, if the input is: - 12 100 - 14 110 - 18 120 + 0 0 + 128 20 + 255 100 we generate - 100 (12) - 105 - 110 - 112.5 - 115 - 117.5 (17) + 0 0 + 1 0.01 + .. etc. linear interpolation + 128 20 + 129 20.5 + .. etc. linear interpolation + 255 100 the x axis (12 .. 17) is implied. The x/y points don't need to be sorted: we do that. You can have several Ys ... each becomes a band in the