Merge branch 'master' of github.com:jcupitt/libvips

This commit is contained in:
John Cupitt 2015-11-24 14:54:29 +00:00
commit d42caca820
7 changed files with 38 additions and 15 deletions

10
TODO
View File

@ -1,11 +1,5 @@
- easy to get a segv with Nicolas's interpolators, argh
just with float images?
try to_polar workspace, set LBB, zoom in and scroll around a bit
- get some brightly coloured spots with nohalo / vsqbs on wobble.ws ... very
odd, the interpolation shouldn't change between bands
- still not happy about float->int mask conversion in im_vips2mask.c

View File

@ -408,6 +408,17 @@ vips_interpolate_bicubic_interpolate( VipsInterpolate *interpolate,
const int bands = in->im->Bands;
const int lskip = VIPS_REGION_LSKIP( in );
g_assert( ix - 1 >= in->valid.left );
g_assert( iy - 1 >= in->valid.top );
g_assert( ix + 2 < VIPS_RECT_RIGHT( &in->valid ) );
g_assert( iy + 2 < VIPS_RECT_BOTTOM( &in->valid ) );
/* Confirm that absolute_x and absolute_y are >= 1, because of
* window_offset.
*/
g_assert( x >= 1.0 );
g_assert( y >= 1.0 );
#ifdef DEBUG
printf( "vips_interpolate_bicubic_interpolate: %g %g\n", x, y );
printf( "\tleft=%d, top=%d, width=%d, height=%d\n",

View File

@ -513,6 +513,11 @@ vips_interpolate_bilinear_interpolate( VipsInterpolate *interpolate,
int z;
g_assert( (int) x >= in->valid.left );
g_assert( (int) y >= in->valid.top );
g_assert( (int) x + 1 < VIPS_RECT_RIGHT( &in->valid ) );
g_assert( (int) y + 1 < VIPS_RECT_BOTTOM( &in->valid ) );
SWITCH_INTERPOLATE( in->im->BandFmt,
BILINEAR_INT, BILINEAR_FLOAT );
}

View File

@ -800,6 +800,11 @@ vips_interpolate_lbb_interpolate( VipsInterpolate* restrict interpolate,
vips_band_format_iscomplex( in->im->BandFmt ) ?
2 * actual_bands : actual_bands;
g_assert( ix - 1 >= in->valid.left );
g_assert( iy - 1 >= in->valid.top );
g_assert( ix + 2 < VIPS_RECT_RIGHT( &in->valid ) );
g_assert( iy + 2 < VIPS_RECT_BOTTOM( &in->valid ) );
/* Confirm that absolute_x and absolute_y are >= 1, see above.
*/
g_assert( absolute_x >= 1.0 );

View File

@ -189,7 +189,7 @@ vips_mapim_region_minmax( VipsRegion *region, VipsRect *r, VipsRect *bounds )
for( z = 0; z < ps; z++ ) \
q[z] = 0; \
} \
else \
else \
interpolate( mapim->interpolate, q, ir[0], \
px + window_offset, py + window_offset ); \
\
@ -244,8 +244,6 @@ vips_mapim_gen( VipsRegion *or, void *seq, void *a, void *b, gboolean *stop )
*/
bounds.width += window_size - 1;
bounds.height += window_size - 1;
bounds.left -= window_offset;
bounds.height -= window_offset;
/* Clip against the source image.
*/

View File

@ -1493,8 +1493,8 @@ vips_interpolate_nohalo_interpolate( VipsInterpolate* restrict interpolate,
*
* It's 2 not 0 since we ask for a window_offset of 2 at the bottom.
*/
const int ix = (int) (absolute_x + 0.5);
const int iy = (int) (absolute_y + 0.5);
const int ix = (int) absolute_x;
const int iy = (int) absolute_y;
/*
* Move the pointer to (the first band of) the top/left pixel of the
@ -1521,6 +1521,11 @@ vips_interpolate_nohalo_interpolate( VipsInterpolate* restrict interpolate,
vips_band_format_iscomplex( in->im->BandFmt ) ?
2 * actual_bands : actual_bands;
g_assert( ix - 2 >= in->valid.left );
g_assert( iy - 2 >= in->valid.top );
g_assert( ix + 2 < VIPS_RECT_RIGHT( &in->valid ) );
g_assert( iy + 2 < VIPS_RECT_BOTTOM( &in->valid ) );
/* Confirm that absolute_x and absolute_y are >= 2, see above.
*/
g_assert( absolute_x >= 2.0 );

View File

@ -313,8 +313,8 @@ vips_interpolate_vsqbs_interpolate( VipsInterpolate* restrict interpolate,
*
* It's 1 not 0 since we ask for a window_offset of 1 at the bottom.
*/
const int ix = (int) (absolute_x + 0.5);
const int iy = (int) (absolute_y + 0.5);
const int ix = (int) absolute_x;
const int iy = (int) absolute_y;
/*
* Move the pointer to (the first band of) the top/left pixel of the
@ -341,6 +341,11 @@ vips_interpolate_vsqbs_interpolate( VipsInterpolate* restrict interpolate,
vips_band_format_iscomplex( in->im->BandFmt ) ?
2 * actual_bands : actual_bands;
g_assert( ix - 1 >= in->valid.left );
g_assert( iy - 1 >= in->valid.top );
g_assert( ix + 1 < VIPS_RECT_RIGHT( &in->valid ) );
g_assert( iy + 1 < VIPS_RECT_BOTTOM( &in->valid ) );
/* Confirm that absolute_x and absolute_y are >= 1, see above.
*/
g_assert( absolute_x >= 1.0 );