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:
parent
1ac5abb1d0
commit
7cdce8cb55
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user