This commit is contained in:
John Cupitt 2009-03-18 16:47:17 +00:00
parent 42827cac86
commit 150cabd6c0
4 changed files with 21 additions and 23 deletions

View File

@ -3,6 +3,7 @@
- remove fading stuff from im_render() -- cleaner and simpler - remove fading stuff from im_render() -- cleaner and simpler
- configure spots support for "restrict" - configure spots support for "restrict"
- reset dcm:display-range on magick read to help DICOM - reset dcm:display-range on magick read to help DICOM
- saner im_buildlut() behaviour
3/3/09 started 7.17.2 3/3/09 started 7.17.2
- im_magick2vips.c: allow funky bit depths, like 14 (thanks Mikkel) - im_magick2vips.c: allow funky bit depths, like 14 (thanks Mikkel)

View File

@ -1,18 +1,14 @@
/* @(#) Build a LUT from a set of x/y points. Eg. if input is /* @(#) Build a LUT from a set of x/y points. Eg. if input is
* @(#) * @(#)
* @(#) 12 100 * @(#) 0 0
* @(#) 14 110 * @(#) 255 100
* @(#) 18 120
* @(#) * @(#)
* @(#) we generate * @(#) we generate
* @(#) * @(#)
* @(#) 100 (12) * @(#) 0 0
* @(#) 105 * @(#) 1 0.4
* @(#) 110 * @(#) .. etc. linear interpolation
* @(#) 112.5 * @(#) 255 100
* @(#) 115
* @(#) 117.5
* @(#) 120 (18)
* @(#) * @(#)
* @(#) The x/y points don't need to be sorted: we do that. You can have * @(#) 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. * @(#) several Ys ... each becomes a band in the output LUT.
@ -21,6 +17,8 @@
* - from im_invertlut() * - from im_invertlut()
* 9/10/06 * 9/10/06
* - don't output x values * - 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 ) if( v > xhigh )
xhigh = v; xhigh = v;
} }
state->lut_size = xhigh - xlow; state->lut_size = xhigh - xlow + 1;
if( state->lut_size < 1 ) { if( state->lut_size < 1 ) {
im_error( "im_buildlut", "%s", _( "x range too small" ) ); im_error( "im_buildlut", "%s", _( "x range too small" ) );
@ -202,7 +200,7 @@ buildlut( State *state, IMAGE *output )
const int dx = x2 - x1; const int dx = x2 - x1;
const double dy = y2 - y1; 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; odata[x] = y1 + i * dy / dx;
} }

View File

@ -501,8 +501,6 @@ vips_interpolate_snohalo1_interpolate( VipsInterpolate* restrict interpolate,
double absolute_x, double absolute_x,
double absolute_y ) double absolute_y )
{ {
VipsInterpolateSnohalo1Class *snohalo1_class =
VIPS_INTERPOLATE_SNOHALO1_GET_CLASS( interpolate );
VipsInterpolateSnohalo1 *snohalo1 = VipsInterpolateSnohalo1 *snohalo1 =
VIPS_INTERPOLATE_SNOHALO1( interpolate ); VIPS_INTERPOLATE_SNOHALO1( interpolate );
/* /*

View File

@ -13,18 +13,19 @@ im_buildlut( DOUBLEMASK *input, IMAGE *output )
constructs a LUT, interpolating a set of x/y points. Interpolation is strictly constructs a LUT, interpolating a set of x/y points. Interpolation is strictly
piecewise linear. For example, if the input is: piecewise linear. For example, if the input is:
12 100 0 0
14 110 128 20
18 120 255 100
we generate we generate
100 (12) 0 0
105 1 0.01
110 .. etc. linear interpolation
112.5 128 20
115 129 20.5
117.5 (17) .. etc. linear interpolation
255 100
the x axis (12 .. 17) is implied. The x/y points don't need to be 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 sorted: we do that. You can have several Ys ... each becomes a band in the