convsep calls convasep when it can

This commit is contained in:
John Cupitt 2016-07-09 19:20:33 +01:00
parent e30bdadfb8
commit 036bd0bb4b
2 changed files with 29 additions and 13 deletions

2
TODO
View File

@ -1,3 +1,5 @@
- convasep does not handle offset correctly
- test new clip stuff?
- add more webp tests to py suite

View File

@ -63,6 +63,8 @@ vips_convsep_build( VipsObject *object )
VipsImage **t = (VipsImage **)
vips_object_local_array( object, 3 );
VipsImage *in;
g_object_set( convsep, "out", vips_image_new(), NULL );
if( VIPS_OBJECT_CLASS( vips_convsep_parent_class )->build( object ) )
@ -71,20 +73,32 @@ vips_convsep_build( VipsObject *object )
if( vips_check_separable( class->nickname, convolution->M ) )
return( -1 );
if( vips_rot( convolution->M, &t[0], VIPS_ANGLE_D90, NULL ) ||
vips_conv( convolution->in, &t[1], convolution->M,
"precision", convsep->precision,
"layers", convsep->layers,
"cluster", convsep->cluster,
NULL ) ||
vips_conv( t[1], &t[2], t[0],
"precision", convsep->precision,
"layers", convsep->layers,
"cluster", convsep->cluster,
NULL ) )
return( -1 );
in = convolution->in;
if( vips_image_write( t[2], convolution->out ) )
if( convsep->precision == VIPS_PRECISION_APPROXIMATE ) {
if( vips_convasep( convolution->in, &t[0], convolution->M,
"layers", convsep->layers,
NULL ) )
return( -1 );
in = t[0];
}
else {
if( vips_rot( convolution->M, &t[0], VIPS_ANGLE_D90, NULL ) ||
vips_conv( convolution->in, &t[1], convolution->M,
"precision", convsep->precision,
"layers", convsep->layers,
"cluster", convsep->cluster,
NULL ) ||
vips_conv( t[1], &t[2], t[0],
"precision", convsep->precision,
"layers", convsep->layers,
"cluster", convsep->cluster,
NULL ) )
return( -1 );
in = t[2];
}
if( vips_image_write( in, convolution->out ) )
return( -1 );
return( 0 );