flood direct path fixed

but still too slow
This commit is contained in:
John Cupitt 2014-02-14 13:55:55 +00:00
parent 3277e26e65
commit c5a48effa2
3 changed files with 20 additions and 18 deletions

16
TODO
View File

@ -1,10 +1,6 @@
- add a direct route to flood for label_regions, delay speeding up operation
dispatch for now, seems like a large job
- break vipsflood into a separate struct we can use directly
a direct path can also avoid things like vector_to_ink, which involve
running a pipeline to generate a single pixel
almost working
same for draw_mask
- it was quick ..
@ -14,9 +10,13 @@
user 0m0.173s
sys 0m0.031s
now incredibly slow
best now:
$ time vips labelregions babe.jpg x.v
real 0m3.951s
user 0m3.940s
sys 0m0.032s
can we speed up function dispatch at all?
- ink to vec etc. should work for complex .. output or accept a double-length
vector

View File

@ -548,6 +548,9 @@ vips__draw_flood_direct( VipsImage *image, VipsImage *test,
}
((VipsDraw *) flood)->image = image;
g_object_ref( image );
((VipsDraw *) flood)->lsize = VIPS_IMAGE_SIZEOF_LINE( image );
((VipsDraw *) flood)->psize = VIPS_IMAGE_SIZEOF_PEL( image );
if( !(((VipsDrawink *) flood)->pixel_ink = VIPS_ARRAY( flood,
VIPS_IMAGE_SIZEOF_PEL( image ), VipsPel )) ) {
@ -556,12 +559,16 @@ vips__draw_flood_direct( VipsImage *image, VipsImage *test,
}
*((int *) (((VipsDrawink *) flood)->pixel_ink)) = serial;
flood->x = x;
flood->y = y;
flood->test = test;
g_object_ref( test );
flood->equal = TRUE;
flood->tsize = VIPS_IMAGE_SIZEOF_PEL( test );
flood->left = flood->x;
flood->top = flood->y;
flood->right = flood->x;
flood->bottom = flood->y;
flood->left = x;
flood->top = y;
flood->right = x;
flood->bottom = y;
flood->in = buffer_build();
flood->out = buffer_build();

View File

@ -88,12 +88,7 @@ vips_labelregions_build( VipsObject *object )
for( y = 0; y < t[1]->Ysize; y++ ) {
for( x = 0; x < t[1]->Xsize; x++ ) {
if( !m[x] ) {
/*
if( vips_draw_flood1( t[1], serial, x, y,
"test", in,
"equal", TRUE,
NULL ) )
return( -1 );
/* Use a direct path for speed.
*/
if( vips__draw_flood_direct( t[1], in,
serial, x, y ) )