Round sum values to the nearest integer in *_notab

This commit is contained in:
Kleis Auke Wolthuizen 2020-10-18 17:39:39 +02:00
parent 49d8051e22
commit fdc140e8e9
2 changed files with 12 additions and 4 deletions

View File

@ -281,8 +281,12 @@ reduceh_notab( VipsReduceh *reduceh,
vips_reduce_make_mask( cx, reduceh->kernel, reduceh->hshrink, x );
for( int z = 0; z < bands; z++ )
out[z] = reduce_sum<T, double>( in + z, bands, cx, n );
for( int z = 0; z < bands; z++ ) {
double sum;
sum = reduce_sum<T, double>( in + z, bands, cx, n );
out[z] = VIPS_ROUND_UINT( sum );
}
}
/* Tried a vector path (see reducev) but it was slower. The vectors for

View File

@ -511,8 +511,12 @@ reducev_notab( VipsReducev *reducev,
vips_reduce_make_mask( cy, reducev->kernel, reducev->vshrink, y );
for( int z = 0; z < ne; z++ )
out[z] = reduce_sum<T, double>( in + z, l1, cy, n );
for( int z = 0; z < ne; z++ ) {
double sum;
sum = reduce_sum<T, double>( in + z, l1, cy, n );
out[z] = VIPS_ROUND_UINT( sum );
}
}
static int