[MPlayer-cvslog] r28834 - in trunk/libass: ass_bitmap.c ass_bitmap.h ass_render.c
Reimar Döffinger
Reimar.Doeffinger at gmx.de
Fri Mar 6 10:11:19 CET 2009
On Fri, Mar 06, 2009 at 02:17:06AM +0100, greg wrote:
> -int glyph_to_bitmap(ass_synth_priv_t* priv, ass_synth_priv_t* priv_blur,
> +/**
> + * \brief Blur with [[1,2,1]. [2,4,2], [1,2,1]] kernel
> + * This blur is the same as the one employed by vsfilter.
> + */
> +static void be_blur(unsigned char *buf, int w, int h) {
> + unsigned int x, y;
> + unsigned int old_sum, new_sum;
> +
> + for (y=0; y<h; y++) {
> + old_sum = 2 * buf[0];
That is wrong, it must be buf[y*w], same for y-interpolation but it must
be buf[x] there. I'd consider using pointer arithmetic though, like
uint8_t *p = buf + y*w;
uint8_t *p_end = p + w - 1;
for (; p < p_end; p++) {
new_sum = p[0] + p[1];
p[0] = ...
}
> + for (x=0; x<w-1; x++) {
> + new_sum = buf[y*w+x] + buf[y*w+x+1];
> + buf[y*w+x] = (old_sum + new_sum) >> 2;
> + old_sum = new_sum;
> + }
missing the right border, e.g. (to be symmetric with left border):
buf[y*w+x] = (old_sum + 2*buf[y*w+x]) >> 2;
(x == w - 1 here, feel free to explicitly write w-1, I just considered
using x more readable).
Same for the lower border of course.
All this brings me to the point: you should send new versions of patches
under discussion first, not commit directly.
More information about the MPlayer-cvslog
mailing list