From 223cb023052dc4509e9bcee31139425cd7a7ea7b Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Fri, 29 Nov 2013 22:30:20 +0000 Subject: [PATCH] fix im_benchmark() --- TODO | 8 ++------ benchmark/benchmarkn.sh | 2 -- libvips/convolution/sharpen.c | 4 ++-- libvips/deprecated/vips7compat.c | 18 ++++++++++-------- 4 files changed, 14 insertions(+), 18 deletions(-) diff --git a/TODO b/TODO index 3d8b41dc..457f8520 100644 --- a/TODO +++ b/TODO @@ -1,9 +1,5 @@ -- fix im_benchmarkn - - (vips:16785): GLib-GObject-WARNING **: value "0.500000" of type - '\''gdouble'\'' is invalid or out of range for property '\''m1'\'' of - type '\''gdouble'\'' - LabQ2sRGB: coding '\''labq'\'' only +- some vips8 operators repack labq after processing ... new policy: accept any + format and never repack - seen some leaks from diff --git a/benchmark/benchmarkn.sh b/benchmark/benchmarkn.sh index 45d2b673..9fdbcff6 100755 --- a/benchmark/benchmarkn.sh +++ b/benchmark/benchmarkn.sh @@ -1,7 +1,5 @@ #!/bin/bash -set -x - uname -a gcc --version vips --version diff --git a/libvips/convolution/sharpen.c b/libvips/convolution/sharpen.c index 352ab620..a71f1973 100644 --- a/libvips/convolution/sharpen.c +++ b/libvips/convolution/sharpen.c @@ -359,14 +359,14 @@ vips_sharpen_class_init( VipsSharpenClass *class ) _( "Slope for flat areas" ), VIPS_ARGUMENT_OPTIONAL_INPUT, G_STRUCT_OFFSET( VipsSharpen, m1 ), - 1, 1000000, 1 ); + 0, 1000000, 1 ); VIPS_ARG_DOUBLE( class, "m2", 9, _( "m2" ), _( "Slope for jaggy areas" ), VIPS_ARGUMENT_OPTIONAL_INPUT, G_STRUCT_OFFSET( VipsSharpen, m2 ), - 1, 1000000, 2 ); + 0, 1000000, 2 ); } diff --git a/libvips/deprecated/vips7compat.c b/libvips/deprecated/vips7compat.c index 3cc1644a..d87a604f 100644 --- a/libvips/deprecated/vips7compat.c +++ b/libvips/deprecated/vips7compat.c @@ -2335,22 +2335,24 @@ im_sharpen( IMAGE *in, IMAGE *out, double x1, double y2, double y3, double m1, double m2 ) { - VipsImage *x; + VipsImage **t = (VipsImage **) + vips_object_local_array( VIPS_OBJECT( out ), 2 ); - if( vips_call( "sharpen", in, &x, + /* im_sharpen() always recoded as labq and im_benchmark() depends + * upon this behaviour. + */ + if( vips_call( "sharpen", in, &t[0], "radius", mask_size / 2, "x1", x1, "y2", y2, "y3", y3, "m1", m1, "m2", m2, - NULL ) ) + NULL ) || + vips_colourspace( t[0], &t[1], + VIPS_INTERPRETATION_LABQ, NULL ) || + vips_image_write( t[1], out ) ) return( -1 ); - if( im_copy( x, out ) ) { - g_object_unref( x ); - return( -1 ); - } - g_object_unref( x ); return( 0 ); }