diff --git a/ChangeLog b/ChangeLog index 32a4f5c7..b1407fd5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -20,6 +20,9 @@ - better support for bscale / bzero in fits images - deprecate vips_warn() / vips_info(); use g_warning() / g_info() instead - fix --vips-cache-max etc. +- add compute reordering, plus some new API to support it: + vips_reorder_margin_hint() and vips_reorder_prepare_many(), thanks + aferrero2707 8/12/16 started 8.4.5 - allow libgsf-1.14.26 to help centos, thanks tdiprima diff --git a/TODO b/TODO index b30851cb..458f2c59 100644 --- a/TODO +++ b/TODO @@ -1,9 +1,3 @@ -- use vips_reorder_prepare_many() elsewhere ... bandary, - -- add vips_reorder_margin_hint() elsewhere ... morph, local hist, - - - - not sure about utf8 error messages on win diff --git a/libvips/colour/colour.c b/libvips/colour/colour.c index ed5666a1..61988a89 100644 --- a/libvips/colour/colour.c +++ b/libvips/colour/colour.c @@ -234,9 +234,8 @@ vips_colour_gen( VipsRegion *or, int i, y; VipsPel *p[MAX_INPUT_IMAGES], *q; - for( i = 0; ir[i]; i++ ) - if( vips_region_prepare( ir[i], r ) ) - return( -1 ); + if( vips_reorder_prepare_many( or->im, ir, r ) ) + return( -1 ); VIPS_GATE_START( "vips_colour_gen: work" ); diff --git a/libvips/conversion/bandary.c b/libvips/conversion/bandary.c index 66b9ef5f..2f14b494 100644 --- a/libvips/conversion/bandary.c +++ b/libvips/conversion/bandary.c @@ -92,11 +92,10 @@ vips_bandary_gen( VipsRegion *or, void *seq, void *a, void *b, gboolean *stop ) VipsPel *p[MAX_INPUT_IMAGES], *q; int y, i; - for( i = 0; i < bandary->n; i++ ) { - if( vips_region_prepare( ir[i], r ) ) - return( -1 ); + if( vips_reorder_prepare_many( or->im, ir, r ) ) + return( -1 ); + for( i = 0; i < bandary->n; i++ ) p[i] = VIPS_REGION_ADDR( ir[i], r->left, r->top ); - } p[i] = NULL; q = VIPS_REGION_ADDR( or, r->left, r->top ); diff --git a/libvips/conversion/ifthenelse.c b/libvips/conversion/ifthenelse.c index eb5bb2b7..38a76bfd 100644 --- a/libvips/conversion/ifthenelse.c +++ b/libvips/conversion/ifthenelse.c @@ -283,6 +283,9 @@ vips_blend_gen( VipsRegion *or, void *seq, void *client1, void *client2, else { /* Mix of set and clear ... ask for both then and else parts * and interleave. + * + * We can't use vips_reorder_prepare_many() since we always + * want the c image first. */ if( vips_region_prepare( ir[0], r ) || vips_region_prepare( ir[1], r ) ) diff --git a/libvips/convolution/correlation.c b/libvips/convolution/correlation.c index 2abd96c2..31e4b187 100644 --- a/libvips/convolution/correlation.c +++ b/libvips/convolution/correlation.c @@ -125,6 +125,9 @@ vips_correlation_build( VipsObject *object ) correlation->in_ready, correlation ) ) return( -1 ); + vips_reorder_margin_hint( correlation->out, + correlation->ref->Xsize * correlation->ref->Ysize ); + return( 0 ); } diff --git a/libvips/convolution/sharpen.c b/libvips/convolution/sharpen.c index 6a260fbe..a95242fb 100644 --- a/libvips/convolution/sharpen.c +++ b/libvips/convolution/sharpen.c @@ -121,8 +121,7 @@ vips_sharpen_generate( VipsRegion *or, int x, y; - if( vips_region_prepare( in[0], r ) || - vips_region_prepare( in[1], r ) ) + if( vips_reorder_prepare_many( or->im, in, r ) ) return( -1 ); VIPS_GATE_START( "vips_sharpen_generate: work" ); diff --git a/libvips/deprecated/vips7compat.c b/libvips/deprecated/vips7compat.c index 10eec9d0..a3b6d954 100644 --- a/libvips/deprecated/vips7compat.c +++ b/libvips/deprecated/vips7compat.c @@ -649,12 +649,11 @@ process_region( VipsRegion *or, void *seq, void *a, void *b ) /* Prepare all input regions and make buffer pointers. */ - for( i = 0; ir[i]; i++ ) { - if( vips_region_prepare( ir[i], &or->valid ) ) - return( -1 ); + if( vips_reorder_prepare_many( or->im, ir, &or->valid ) ) + return( -1 ); + for( i = 0; ir[i]; i++ ) p[i] = (PEL *) VIPS_REGION_ADDR( ir[i], or->valid.left, or->valid.top ); - } p[i] = NULL; q = (PEL *) VIPS_REGION_ADDR( or, or->valid.left, or->valid.top ); diff --git a/libvips/histogram/hist_local.c b/libvips/histogram/hist_local.c index 59472ea2..f97cdead 100644 --- a/libvips/histogram/hist_local.c +++ b/libvips/histogram/hist_local.c @@ -280,6 +280,8 @@ vips_hist_local_build( VipsObject *object ) local->out->Xoffset = 0; local->out->Yoffset = 0; + vips_reorder_margin_hint( local->out, local->width * local->height ); + return( 0 ); } diff --git a/libvips/histogram/stdif.c b/libvips/histogram/stdif.c index da701555..92d3bdc2 100644 --- a/libvips/histogram/stdif.c +++ b/libvips/histogram/stdif.c @@ -272,6 +272,8 @@ vips_stdif_build( VipsObject *object ) stdif->out->Xoffset = 0; stdif->out->Yoffset = 0; + vips_reorder_margin_hint( stdif->out, stdif->width * stdif->height ); + return( 0 ); } diff --git a/libvips/morphology/morph.c b/libvips/morphology/morph.c index 47333e18..5b38d00e 100644 --- a/libvips/morphology/morph.c +++ b/libvips/morphology/morph.c @@ -120,6 +120,9 @@ vips_morph_build( VipsObject *object ) g_assert_not_reached(); } + vips_reorder_margin_hint( morph->out, + morph->M->Xsize * morph->M->Ysize ); + return( 0 ); } diff --git a/libvips/morphology/rank.c b/libvips/morphology/rank.c index 09bcebc6..fea8e211 100644 --- a/libvips/morphology/rank.c +++ b/libvips/morphology/rank.c @@ -391,6 +391,8 @@ vips_rank_build( VipsObject *object ) rank->out->Xoffset = 0; rank->out->Yoffset = 0; + vips_reorder_margin_hint( rank->out, rank->width * rank->height ); + return( 0 ); } diff --git a/libvips/resample/reduceh.cpp b/libvips/resample/reduceh.cpp index 52ec7d3d..b57c4fcc 100644 --- a/libvips/resample/reduceh.cpp +++ b/libvips/resample/reduceh.cpp @@ -540,6 +540,8 @@ vips_reduceh_build( VipsObject *object ) in, reduceh ) ) return( -1 ); + vips_reorder_margin_hint( resample->out, reduceh->n_point ); + return( 0 ); } diff --git a/libvips/resample/reducev.cpp b/libvips/resample/reducev.cpp index 63a03c43..3cf3d7f7 100644 --- a/libvips/resample/reducev.cpp +++ b/libvips/resample/reducev.cpp @@ -813,6 +813,8 @@ vips_reducev_raw( VipsReducev *reducev, VipsImage *in ) in, reducev ) ) return( -1 ); + vips_reorder_margin_hint( resample->out, reducev->n_point ); + return( 0 ); }