git switch working

This commit is contained in:
John Cupitt 2019-08-02 20:19:28 +01:00
parent 0a51ca96c9
commit 42cdc8177c

@ -69,12 +69,12 @@ vips_switch_gen( VipsRegion *or, void *seq, void *a, void *b,
VipsRegion *index = ar[swit->n]; VipsRegion *index = ar[swit->n];
int x, y, i, j; int x, y, i, j;
VipsPel *ip; VipsPel * restrict ip;
VipsPel *q; VipsPel * restrict q;
size_t ils; size_t ils;
size_t qls; size_t qls;
int hist[256]; int hist[256];
VipsPel *p[256]; VipsPel * restrict p[256];
size_t ls[256]; size_t ls[256];
size_t ps; size_t ps;
@ -112,10 +112,10 @@ vips_switch_gen( VipsRegion *or, void *seq, void *a, void *b,
for( y = 0; y < r->height; y++ ) { for( y = 0; y < r->height; y++ ) {
i = 0; i = 0;
for( x = 0; x < r->width; x++ ) { for( x = 0; x < r->width; x++ ) {
int v = ip[x]; VipsPel * restrict pv = p[ip[x]];
for( j = 0; j < ps; j++ ) { for( j = 0; j < ps; j++ ) {
q[i] = p[v][i]; q[i] = pv[i];
i += 1; i += 1;
} }
} }
@ -187,6 +187,7 @@ vips_switch_build( VipsObject *object )
* that to the end of the set of images for sizealike. * that to the end of the set of images for sizealike.
*/ */
band[swit->n] = in; band[swit->n] = in;
g_object_ref( in );
if( vips__formatalike_vec( lut, format, swit->n ) || if( vips__formatalike_vec( lut, format, swit->n ) ||
vips__bandalike_vec( class->nickname, vips__bandalike_vec( class->nickname,
format, band, swit->n, 1 ) || format, band, swit->n, 1 ) ||