tiny conv improvements

- we were still using the im_aconv() wrapper, oops
- add gate and pixel count markup
This commit is contained in:
John Cupitt 2016-09-30 07:37:57 +01:00
parent b559a4dc00
commit db90f9f271
3 changed files with 25 additions and 18 deletions

View File

@ -102,17 +102,12 @@ vips_conv_build( VipsObject *object )
break; break;
case VIPS_PRECISION_APPROXIMATE: case VIPS_PRECISION_APPROXIMATE:
{ if( vips_conva( in, &t[1], convolution->M,
DOUBLEMASK *dmsk; "layers", conv->layers,
"cluster", conv->cluster,
if( !(dmsk = im_vips2mask( convolution->M, class->nickname )) || NULL ) ||
!im_local_dmask( convolution->out, dmsk ) ) vips_image_write( t[1], convolution->out ) )
return( -1 ); return( -1 );
if( im_aconv( in, convolution->out, dmsk,
conv->layers, conv->cluster ) )
return( -1 );
}
break; break;
default: default:

View File

@ -223,6 +223,8 @@ vips_convf_gen( REGION *or, void *vseq, void *a, void *b, gboolean *stop )
} }
} }
VIPS_GATE_START( "vips_convf_gen: work" );
for( y = to; y < bo; y++ ) { for( y = to; y < bo; y++ ) {
/* Init pts for this line of PELs. /* Init pts for this line of PELs.
*/ */
@ -270,6 +272,10 @@ vips_convf_gen( REGION *or, void *vseq, void *a, void *b, gboolean *stop )
} }
} }
VIPS_GATE_STOP( "vips_convf_gen: work" );
VIPS_COUNT_PIXELS( or, "vips_convf_gen" );
return( 0 ); return( 0 );
} }

View File

@ -473,7 +473,7 @@ vips_convi_compile( VipsConvi *convi, VipsImage *in )
} }
static int static int
vips_convi_generate_vector( VipsRegion *or, vips_convi_gen_vector( VipsRegion *or,
void *vseq, void *a, void *b, gboolean *stop ) void *vseq, void *a, void *b, gboolean *stop )
{ {
VipsConviSequence *seq = (VipsConviSequence *) vseq; VipsConviSequence *seq = (VipsConviSequence *) vseq;
@ -491,7 +491,7 @@ vips_convi_generate_vector( VipsRegion *or,
VipsExecutor clip; VipsExecutor clip;
#ifdef DEBUG_PIXELS #ifdef DEBUG_PIXELS
printf( "vips_convi_generate_vector: generating %d x %d at %d x %d\n", printf( "vips_convi_gen_vector: generating %d x %d at %d x %d\n",
r->width, r->height, r->left, r->top ); r->width, r->height, r->left, r->top );
#endif /*DEBUG_PIXELS*/ #endif /*DEBUG_PIXELS*/
@ -509,7 +509,7 @@ vips_convi_generate_vector( VipsRegion *or,
convi->pass[i].vector, ne ); convi->pass[i].vector, ne );
vips_executor_set_program( &clip, convi->vector, ne ); vips_executor_set_program( &clip, convi->vector, ne );
VIPS_GATE_START( "vips_convi_generate_vector: work" ); VIPS_GATE_START( "vips_convi_gen_vector: work" );
for( y = 0; y < r->height; y ++ ) { for( y = 0; y < r->height; y ++ ) {
VipsPel *q = VIPS_REGION_ADDR( or, r->left, r->top + y ); VipsPel *q = VIPS_REGION_ADDR( or, r->left, r->top + y );
@ -558,9 +558,9 @@ vips_convi_generate_vector( VipsRegion *or,
#endif /*DEBUG_PIXELS*/ #endif /*DEBUG_PIXELS*/
} }
VIPS_GATE_STOP( "vips_convi_generate_vector: work" ); VIPS_GATE_STOP( "vips_convi_gen_vector: work" );
VIPS_COUNT_PIXELS( or, "vips_convi_generate_vector" ); VIPS_COUNT_PIXELS( or, "vips_convi_gen_vector" );
return( 0 ); return( 0 );
} }
@ -646,7 +646,7 @@ G_STMT_START { \
/* Convolve! /* Convolve!
*/ */
static int static int
vips_convi_generate( VipsRegion *or, vips_convi_gen( VipsRegion *or,
void *vseq, void *a, void *b, gboolean *stop ) void *vseq, void *a, void *b, gboolean *stop )
{ {
VipsConviSequence *seq = (VipsConviSequence *) vseq; VipsConviSequence *seq = (VipsConviSequence *) vseq;
@ -696,6 +696,8 @@ vips_convi_generate( VipsRegion *or,
} }
} }
VIPS_GATE_START( "vips_convi_gen: work" );
for( y = to; y < bo; y++ ) { for( y = to; y < bo; y++ ) {
/* Init pts for this line of PELs. /* Init pts for this line of PELs.
*/ */
@ -743,6 +745,10 @@ vips_convi_generate( VipsRegion *or,
} }
} }
VIPS_GATE_STOP( "vips_convi_gen: work" );
VIPS_COUNT_PIXELS( or, "vips_convi_gen" );
return( 0 ); return( 0 );
} }
@ -934,7 +940,7 @@ vips_convi_build( VipsObject *object )
if( (convi->fixed = VIPS_ARRAY( object, n_point, int )) && if( (convi->fixed = VIPS_ARRAY( object, n_point, int )) &&
!intize_to_fixed_point( M, convi->fixed ) && !intize_to_fixed_point( M, convi->fixed ) &&
!vips_convi_compile( convi, in ) ) { !vips_convi_compile( convi, in ) ) {
generate = vips_convi_generate_vector; generate = vips_convi_gen_vector;
vips_info( class->nickname, "using vector path" ); vips_info( class->nickname, "using vector path" );
} }
else else
@ -973,7 +979,7 @@ vips_convi_build( VipsObject *object )
convi->nnz = 1; convi->nnz = 1;
} }
generate = vips_convi_generate; generate = vips_convi_gen;
vips_info( class->nickname, "using C path" ); vips_info( class->nickname, "using C path" );
} }