nearest0neighbor now rounds to nearest
before it just truncated x/y downs, now it rounds to nearest ... this removes a 0.5 shift compared to the other interpolators thanks Nicolas
This commit is contained in:
parent
ea19e964be
commit
ffb34c943c
@ -1,6 +1,8 @@
|
||||
19/3/12 started 7.29.0
|
||||
- better PNG alpha handling
|
||||
- sanity-check PNG read geometry
|
||||
- nearest-neighbor interpolation rounds coordinates to nearest instead of
|
||||
rounding down (thanks Nicolas)
|
||||
|
||||
13/3/12 started 7.28.2
|
||||
- xres/yres tiffsave args were broken
|
||||
|
@ -331,15 +331,12 @@ static void
|
||||
vips_interpolate_nearest_interpolate( VipsInterpolate *interpolate,
|
||||
void *out, REGION *in, double x, double y )
|
||||
{
|
||||
/* Pel size and line size.
|
||||
*/
|
||||
const int ps = IM_IMAGE_SIZEOF_PEL( in->im );
|
||||
|
||||
/* Top left corner we interpolate from. We know x/y are always
|
||||
* positive, so we can just (int) them.
|
||||
/* We know x/y are always positive, so we can just (int) them.
|
||||
*/
|
||||
const int xi = (int) x;
|
||||
const int yi = (int) y;
|
||||
const int xi = (int) (x + 0.5);
|
||||
const int yi = (int) (y + 0.5);
|
||||
|
||||
const VipsPel *p = IM_REGION_ADDR( in, xi, yi );
|
||||
VipsPel *q = (VipsPel *) out;
|
||||
|
Loading…
Reference in New Issue
Block a user