fix rounding in region shrink

we were not rounding int averages to nearest, thanks beaudet

see https://github.com/jcupitt/libvips/issues/659
This commit is contained in:
John Cupitt 2017-05-18 20:36:20 +01:00
parent 8c8b71d935
commit 846e4209f9
1 changed files with 2 additions and 2 deletions

View File

@ -1149,7 +1149,7 @@ vips_region_shrink_labpack( VipsRegion *from, VipsRegion *to, VipsRect *target )
int b = sp[2] + sp[6] +
sp[ls + 2] + sp[ls + 6];
q[0] = l >> 2;
q[0] = (l + 2) >> 2;
q[1] = a >> 2;
q[2] = b >> 2;
q[3] = 0;
@ -1170,7 +1170,7 @@ vips_region_shrink_labpack( VipsRegion *from, VipsRegion *to, VipsRect *target )
int tot = tp[z] + tp[z + nb] + \
tp1[z] + tp1[z + nb]; \
\
tq[z] = tot >> 2; \
tq[z] = (tot + 2) >> 2; \
} \
\
/* Move on two pels in input. \