From 29eed7b2b5a271d0c46da6fa564d51ede4b39356 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Fri, 29 Nov 2013 23:20:32 +0000 Subject: [PATCH] remove repack code from affine just done in compat wrapper now --- TODO | 4 ---- libvips/deprecated/vips7compat.c | 25 ++++++++++++++++++------- libvips/resample/affine.c | 16 +--------------- 3 files changed, 19 insertions(+), 26 deletions(-) diff --git a/TODO b/TODO index 457f8520..3b339cb2 100644 --- a/TODO +++ b/TODO @@ -1,7 +1,3 @@ -- some vips8 operators repack labq after processing ... new policy: accept any - format and never repack - - - seen some leaks from vips dzsave --layout google wtc.jpg x diff --git a/libvips/deprecated/vips7compat.c b/libvips/deprecated/vips7compat.c index d87a604f..22bc3163 100644 --- a/libvips/deprecated/vips7compat.c +++ b/libvips/deprecated/vips7compat.c @@ -4241,14 +4241,22 @@ static int im__affinei( VipsImage *in, VipsImage *out, VipsInterpolate *interpolate, VipsTransformation *trn ) { - VipsImage *x; + VipsImage **t = (VipsImage **) + vips_object_local_array( VIPS_OBJECT( out ), 2 ); + VipsArea *oarea; + gboolean repack; oarea = (VipsArea *) vips_array_int_newv( 4, trn->oarea.left, trn->oarea.top, trn->oarea.width, trn->oarea.height ); - if( vips_affine( in, &x, + /* vips7 affine would repack labq and im_benchmark() depends upon + * this. + */ + repack = in->Coding == IM_CODING_LABQ; + + if( vips_affine( in, &t[0], trn->a, trn->b, trn->c, trn->d, "interpolate", interpolate, "oarea", oarea, @@ -4258,15 +4266,18 @@ im__affinei( VipsImage *in, VipsImage *out, vips_area_unref( oarea ); return( -1 ); } - vips_area_unref( oarea ); + in = t[0]; - if( im_copy( x, out ) ) { - g_object_unref( x ); - return( -1 ); + if( repack ) { + if( vips_colourspace( in, &t[1], + VIPS_INTERPRETATION_LABQ, NULL ) ) + return( -1 ); + in = t[1]; } - g_object_unref( x ); + if( vips_image_write( in, out ) ) + return( -1 ); return( 0 ); } diff --git a/libvips/resample/affine.c b/libvips/resample/affine.c index 61494661..a8988f3e 100644 --- a/libvips/resample/affine.c +++ b/libvips/resample/affine.c @@ -384,7 +384,6 @@ vips_affine_build( VipsObject *object ) vips_object_local_array( object, 4 ); VipsImage *in; - gboolean repack; VipsDemandStyle hint; int window_size; int window_offset; @@ -464,13 +463,11 @@ vips_affine_build( VipsObject *object ) return( -1 ); } - /* Unpack labq for processing ... we repack after, see below. + /* Unpack labq for processing. */ - repack = FALSE; if( in->Coding == VIPS_CODING_LABQ ) { if( vips_LabQ2LabS( in, &t[0], NULL ) ) return( -1 ); - repack = TRUE; in = t[0]; } @@ -505,17 +502,6 @@ vips_affine_build( VipsObject *object ) in, affine ) ) return( -1 ); - if( repack ) { - VipsImage *x; - - if( vips_LabS2LabQ( resample->out, &x, NULL ) ) - return( -1 ); - - VIPS_UNREF( resample->out ); - - resample->out = x; - } - /* Finally: can now set Xoffset/Yoffset. */ resample->out->Xoffset = affine->trn.odx - affine->trn.oarea.left;