fix vector stuff

This commit is contained in:
John Cupitt 2010-11-05 10:52:29 +00:00
parent 3dfc8d8ee2
commit 526590d244
6 changed files with 41 additions and 42 deletions

15
TODO
View File

@ -1,12 +1,3 @@
- we need to have separate sources for scanlines and for other sources
name scanlines sources as "sl0" onwards
name regular sources as "s1" onwards
- nip2-7.22.3 on Windows is not adding the path you load from to the set of
paths to search, breaking demo2 for Hamish
@ -18,9 +9,13 @@
- try using a smaller norm factor in nip2 for sep conv gen there?
- Lan's c4_stats.ws is broken, I guess due to vector stuff
- how much time are we spending setting sources by name, profile!
- maybe im_draw_smudge() is too slow :-( also, we had a sanity failure with
it, argh

View File

@ -356,7 +356,8 @@ im__init_programs( VipsVector *vectors[IM_BANDFMT_LAST],
continue;
v = vectors[fmt] =
vips_vector_new_ds( "binary arith", osize, isize );
vips_vector_new( "binary arith", osize );
vips_vector_source_name( v, "s1", isize );
vips_vector_source_name( v, "s2", isize );
vips_vector_temporary( v, "t1", osize );

View File

@ -255,9 +255,7 @@ conv_compile_convolution_u8s16( Conv *conv )
return( -1 );
}
/* Start with a single source scanline, we add more as we need them.
*/
conv->convolve = v = vips_vector_new_ds( "conv", 2, 1 );
conv->convolve = v = vips_vector_new( "conv", 2 );
/* The value we fetch from the image, the product with the matrix
* value, the accumulated sum.
@ -356,7 +354,8 @@ conv_compile_scale_s16u8( Conv *conv )
mask->offset < SHRT_MIN )
return( -1 );
conv->clip = v = vips_vector_new_ds( "clip", 1, 2 );
conv->clip = v = vips_vector_new( "clip", 1 );
vips_vector_source_name( v, "s1", 2 );
TEMP( "t1", 2 );
TEMP( "t2", 2 );

View File

@ -104,7 +104,7 @@ gboolean vips_vector_get_enabled( void );
void vips_vector_set_enabled( gboolean enabled );
void vips_vector_free( VipsVector *vector );
VipsVector *vips_vector_new_ds( const char *name, int size1, int size2 );
VipsVector *vips_vector_new( const char *name, int dsize );
void vips_vector_constant( VipsVector *vector,
char *name, int value, int size );

View File

@ -51,6 +51,8 @@
#endif /*HAVE_CONFIG_H*/
#include <vips/intl.h>
#include <stdlib.h>
#include <vips/vips.h>
#include <vips/vector.h>
@ -105,7 +107,7 @@ vips_vector_free( VipsVector *vector )
}
VipsVector *
vips_vector_new_ds( const char *name, int size1, int size2 )
vips_vector_new( const char *name, int dsize )
{
VipsVector *vector;
int i;
@ -131,15 +133,15 @@ vips_vector_new_ds( const char *name, int size1, int size2 )
vector->compiled = FALSE;
#ifdef HAVE_ORC
vector->program = orc_program_new_ds( size1, size2 );
vector->program = orc_program_new();
/* We always make s1 / d1
/* We always make d1, our callers make either a single point source, or
* for area ops, a set of scanlines.
*/
vector->s[0] = orc_program_find_var_by_name( vector->program, "s1" );
vector->d1 = orc_program_find_var_by_name( vector->program, "d1" );
#endif /*HAVE_ORC*/
vector->n_source += 1;
vector->d1 = orc_program_add_destination( vector->program,
dsize, "d1" );
vector->n_destination += 1;
#endif /*HAVE_ORC*/
return( vector );
}
@ -256,8 +258,13 @@ vips_vector_full( VipsVector *vector )
*/
if( vector->n_constant > 16 - 2 )
return( TRUE );
if( vector->n_source + vector->n_scanline > 8 - 1 )
/* You can have 8 parameters, and d1 counts as one of them, so +1
* there.
*/
if( vector->n_source + vector->n_scanline + 1 > 7 )
return( TRUE );
if( vector->n_instruction > 50 )
return( TRUE );
@ -321,38 +328,35 @@ vips_executor_set_program( VipsExecutor *executor, VipsVector *vector, int n )
}
void
vips_executor_set_scanline( VipsExecutor *executor, REGION *ir, int x, int y )
vips_executor_set_array( VipsExecutor *executor, int var, void *value )
{
#ifdef HAVE_ORC
if( var != -1 )
orc_executor_set_array( &executor->executor, var, value );
#endif /*HAVE_ORC*/
}
void
vips_executor_set_scanline( VipsExecutor *executor, REGION *ir, int x, int y )
{
VipsVector *vector = executor->vector;
PEL *base = (PEL *) IM_REGION_ADDR( ir, x, y );
int lsk = IM_REGION_LSKIP( ir );
int i;
for( i = 0; i < vector->n_scanline; i++ )
orc_executor_set_array( &executor->executor,
for( i = 0; i < vector->n_scanline; i++ ) {
vips_executor_set_array( executor,
vector->sl[i], base + vector->line[i] * lsk );
#endif /*HAVE_ORC*/
}
}
void
vips_executor_set_destination( VipsExecutor *executor, void *value )
{
#ifdef HAVE_ORC
VipsVector *vector = executor->vector;
orc_executor_set_array( &executor->executor, vector->d1, value );
#endif /*HAVE_ORC*/
}
void
vips_executor_set_array( VipsExecutor *executor, int var, void *value )
{
#ifdef HAVE_ORC
if( var != -1 )
orc_executor_set_array( &executor->executor, var, value );
#endif /*HAVE_ORC*/
vips_executor_set_array( executor, vector->d1, value );
}
void

View File

@ -45,8 +45,8 @@
*/
/*
*/
#define DEBUG
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
@ -155,7 +155,7 @@ pass_compile_section( Morph *morph, int first, int *last )
morph->n_pass += 1;
pass->first = first;
pass->vector = v = vips_vector_new_ds( "morph", 1, 1 );
pass->vector = v = vips_vector_new( "morph", 1 );
/* The value we fetch from the image, the accumulated sum.
*/