convi done

This commit is contained in:
John Cupitt 2016-07-01 15:11:17 +01:00
parent df81a6fe24
commit d2aeec56b5
2 changed files with 39 additions and 15 deletions

24
TODO
View File

@ -5,19 +5,19 @@
im = Vips.Image.identity() im = Vips.Image.identity()
self.assertTrue(im.hist_ismonotonic()) self.assertTrue(im.hist_ismonotonic())
john@mm-jcupitt5 ~/Desktop/pics $ more mono.mat $ more mono.mat
2 1 2 1 1 128
-1 1 -1 1
john@mm-jcupitt5 ~/Desktop/pics $ vips identity x.v
john@mm-jcupitt5 ~/Desktop/pics $ vips convi x.v x2.v mono.mat --vips-info vips identity x.v
--vips-novector
info: convi: using C path vips convi x.v x2.v mono.mat --vips-info --vips-novector
john@mm-jcupitt5 ~/Desktop/pics $ vips max x2.v vips min x2.v
1.000000 128.0
john@mm-jcupitt5 ~/Desktop/pics $ vips convi x.v x2.v mono.mat --vips-info
info: convi: using vector path vips convi x.v x2.v mono.mat --vips-info
john@mm-jcupitt5 ~/Desktop/pics $ vips max x2.v vips min x2.v
0.000000 0.0
should be 1.0 (0 for first pixel, 1 thereafter), instead it's 0 everywhere should be 1.0 (0 for first pixel, 1 thereafter), instead it's 0 everywhere

View File

@ -102,10 +102,10 @@
*/ */
/* /*
*/
#define DEBUG_PIXELS
#define DEBUG #define DEBUG
#define DEBUG_PIXELS
#define DEBUG_COMPILE #define DEBUG_COMPILE
*/
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> #include <config.h>
@ -422,7 +422,7 @@ vips_convi_compile_clip( VipsConvi *convi )
ASM3( "shrsw", "value", "value", c6 ); ASM3( "shrsw", "value", "value", c6 );
CONST( off, offset, 2 ); CONST( off, offset, 2 );
ASM3( "subw", "value", "value", off ); ASM3( "addw", "value", "value", off );
/* You'd think "convsuswb" (convert signed 16-bit to unsigned /* You'd think "convsuswb" (convert signed 16-bit to unsigned
* 8-bit with saturation) would be quicker, but it's a lot * 8-bit with saturation) would be quicker, but it's a lot
@ -515,6 +515,21 @@ vips_convi_generate_vector( VipsRegion *or,
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 );
#ifdef DEBUG_PIXELS
{
int h, v;
printf( "before convolve: x = %d, y = %d\n",
r->left, r->top + y );
for( v = 0; v < M->Ysize; v++ ) {
for( h = 0; h < M->Xsize; h++ )
printf( "%3d ", *VIPS_REGION_ADDR( ir,
r->left + h, r->top + y + v ) );
printf( "\n" );
}
}
#endif /*DEBUG_PIXELS*/
/* We run our n passes to generate this scanline. /* We run our n passes to generate this scanline.
*/ */
@ -531,9 +546,18 @@ vips_convi_generate_vector( VipsRegion *or,
VIPS_SWAP( signed short *, seq->t1, seq->t2 ); VIPS_SWAP( signed short *, seq->t1, seq->t2 );
} }
#ifdef DEBUG_PIXELS
printf( "before clip: %d\n", ((signed short *) seq->t1)[0] );
#endif /*DEBUG_PIXELS*/
vips_executor_set_array( &clip, convi->r, seq->t1 ); vips_executor_set_array( &clip, convi->r, seq->t1 );
vips_executor_set_destination( &clip, q ); vips_executor_set_destination( &clip, q );
vips_executor_run( &clip ); vips_executor_run( &clip );
#ifdef DEBUG_PIXELS
printf( "after clip: %d\n",
*VIPS_REGION_ADDR( or, r->left, r->top + y ) );
#endif /*DEBUG_PIXELS*/
} }
VIPS_GATE_STOP( "vips_convi_generate_vector: work" ); VIPS_GATE_STOP( "vips_convi_generate_vector: work" );