void vips_executor_set_destination( VipsExecutor *executor, void *value ) { VipsVector *vector = executor->vector; vips_executor_set_array( executor, vector->d1, value ); }
/* The vector codepath. */ static int morph_vector_gen( REGION *or, void *vseq, void *a, void *b ) { MorphSequence *seq = (MorphSequence *) vseq; Morph *morph = (Morph *) b; INTMASK *mask = morph->mask; REGION *ir = seq->ir; Rect *r = &or->valid; int sz = IM_REGION_N_ELEMENTS( or ); Rect s; int y, j; VipsExecutor executor[MAX_PASS]; /* Prepare the section of the input image we need. A little larger * than the section of the output image we are producing. */ s = *r; s.width += mask->xsize - 1; s.height += mask->ysize - 1; if( im_prepare( ir, &s ) ) return( -1 ); #ifdef DEBUG printf( "morph_vector_gen: preparing %dx%d@%dx%d pixels\n", s.width, s.height, s.left, s.top ); #endif /*DEBUG*/ for( j = 0; j < morph->n_pass; j++ ) vips_executor_set_program( &executor[j], morph->pass[j].vector, sz ); for( y = 0; y < r->height; y++ ) { for( j = 0; j < morph->n_pass; j++ ) { void *d; /* The last pass goes to the output image, * intermediate passes go to t2. */ if( j == morph->n_pass - 1 ) d = IM_REGION_ADDR( or, r->left, r->top + y ); else d = seq->t2; vips_executor_set_scanline( &executor[j], ir, r->left, r->top + y ); vips_executor_set_array( &executor[j], morph->pass[j].r, seq->t1 ); vips_executor_set_destination( &executor[j], d ); vips_executor_run( &executor[j] ); IM_SWAP( void *, seq->t1, seq->t2 ); } } return( 0 ); }
void vips_executor_set_scanline( VipsExecutor *executor, VipsRegion *ir, int x, int y ) { VipsVector *vector = executor->vector; VipsPel *base = VIPS_REGION_ADDR( ir, x, y ); int lsk = VIPS_REGION_LSKIP( ir ); int i; for( i = 0; i < vector->n_scanline; i++ ) vips_executor_set_array( executor, vector->sl[i], base + vector->line[i] * lsk ); }