Upsample integral nearest neighour with zoom for accuracy.

This mirrors logic from sharp, allowing it to migrate to resize.

See https://github.com/lovell/sharp/issues/752
This commit is contained in:
Lovell Fuller 2017-10-03 19:44:31 +01:00
parent 808a54d23e
commit ea6d496484
1 changed files with 11 additions and 1 deletions

View File

@ -238,7 +238,17 @@ vips_resize_build( VipsObject *object )
return( -1 );
vips_object_local( object, interpolate );
if( hscale > 1.0 &&
if( resize->kernel == VIPS_KERNEL_NEAREST &&
hscale == VIPS_FLOOR( hscale ) &&
vscale == VIPS_FLOOR( vscale ) ) {
/* Fast, integral nearest neighbour enlargement
*/
if( vips_zoom( in, &t[4], VIPS_FLOOR( hscale ),
VIPS_FLOOR( vscale ), NULL ) )
return( -1 );
in = t[4];
}
else if( hscale > 1.0 &&
vscale > 1.0 ) {
g_info( "residual scale %g x %g", hscale, vscale );
if( vips_affine( in, &t[4],