Commit 7cdce8cb authored by Michael Niedermayer's avatar Michael Niedermayer

avfilter/vf_boxblur: factor rounder offset out

3322 -> 3204 cycles
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 1ac5abb1
...@@ -227,19 +227,21 @@ static inline void blur(uint8_t *dst, int dst_step, const uint8_t *src, int src_ ...@@ -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[x*src_step]<<1;
sum += src[radius*src_step]; sum += src[radius*src_step];
sum = sum*inv + (1<<15);
for (x = 0; x <= radius; x++) { for (x = 0; x <= radius; x++) {
sum += src[(radius+x)*src_step] - src[(radius-x)*src_step]; sum += (src[(radius+x)*src_step] - src[(radius-x)*src_step])*inv;
dst[x*dst_step] = (sum*inv + (1<<15))>>16; dst[x*dst_step] = sum>>16;
} }
for (; x < len-radius; x++) { for (; x < len-radius; x++) {
sum += src[(radius+x)*src_step] - src[(x-radius-1)*src_step]; sum += (src[(radius+x)*src_step] - src[(x-radius-1)*src_step])*inv;
dst[x*dst_step] = (sum*inv + (1<<15))>>16; dst[x*dst_step] = sum >>16;
} }
for (; x < len; x++) { for (; x < len; x++) {
sum += src[(2*len-radius-x-1)*src_step] - src[(x-radius-1)*src_step]; sum += (src[(2*len-radius-x-1)*src_step] - src[(x-radius-1)*src_step])*inv;
dst[x*dst_step] = (sum*inv + (1<<15))>>16; dst[x*dst_step] = sum>>16;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment