From: Oleg Oshmyan Date: Mon, 9 Feb 2015 22:26:59 +0000 (+0200) Subject: Use correct types in be_blur_c X-Git-Tag: 0.12.3~4^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6a07f564857d02d55b3549380ce033f532c14efc;p=libass Use correct types in be_blur_c Also fix a related sort-of-bug: a multiple of sizeof(uint16_t) was being added to a pointer that already pointed to uint16_t. This was not causing any harm given enough space in the buffer. Fixing the above also lets us combine the two memsets. --- diff --git a/libass/ass_bitmap.c b/libass/ass_bitmap.c index 286f904..609404f 100644 --- a/libass/ass_bitmap.c +++ b/libass/ass_bitmap.c @@ -651,7 +651,7 @@ void ass_gauss_blur(unsigned char *buffer, unsigned *tmp2, } /** - * \brief Blur with [[1,2,1]. [2,4,2], [1,2,1]] kernel + * \brief Blur with [[1,2,1], [2,4,2], [1,2,1]] kernel * This blur is the same as the one employed by vsfilter. * Pure C implementation. */ @@ -659,12 +659,11 @@ void be_blur_c(uint8_t *buf, intptr_t w, intptr_t h, intptr_t stride, uint16_t *tmp) { - unsigned short *col_pix_buf = tmp; - unsigned short *col_sum_buf = tmp + w * sizeof(unsigned short); + uint16_t *col_pix_buf = tmp; + uint16_t *col_sum_buf = tmp + w; unsigned x, y, old_pix, old_sum, temp1, temp2; - unsigned char *src, *dst; - memset(col_pix_buf, 0, w * sizeof(unsigned short)); - memset(col_sum_buf, 0, w * sizeof(unsigned short)); + uint8_t *src, *dst; + memset(tmp, 0, sizeof(uint16_t) * w * 2); y = 0; {