1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avfilter/vf_boxblur: factor rounder offset out

3322 -> 3204 cycles

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2014-12-21 00:54:36 +01:00
parent 1ac5abb1d0
commit 7cdce8cb55

View File

@ -227,19 +227,21 @@ static inline void blur(uint8_t *dst, int dst_step, const uint8_t *src, int src_
sum += src[x*src_step]<<1;
sum += src[radius*src_step];
sum = sum*inv + (1<<15);
for (x = 0; x <= radius; x++) {
sum += src[(radius+x)*src_step] - src[(radius-x)*src_step];
dst[x*dst_step] = (sum*inv + (1<<15))>>16;
sum += (src[(radius+x)*src_step] - src[(radius-x)*src_step])*inv;
dst[x*dst_step] = sum>>16;
}
for (; x < len-radius; x++) {
sum += src[(radius+x)*src_step] - src[(x-radius-1)*src_step];
dst[x*dst_step] = (sum*inv + (1<<15))>>16;
sum += (src[(radius+x)*src_step] - src[(x-radius-1)*src_step])*inv;
dst[x*dst_step] = sum >>16;
}
for (; x < len; x++) {
sum += src[(2*len-radius-x-1)*src_step] - src[(x-radius-1)*src_step];
dst[x*dst_step] = (sum*inv + (1<<15))>>16;
sum += (src[(2*len-radius-x-1)*src_step] - src[(x-radius-1)*src_step])*inv;
dst[x*dst_step] = sum>>16;
}
}