summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Oshmyan <chortos@inbox.lv>2015-02-10 00:26:59 +0200
committerOleg Oshmyan <chortos@inbox.lv>2015-02-10 04:42:58 +0200
commit6a07f564857d02d55b3549380ce033f532c14efc (patch)
treebc30559c8e78a915709bdc91a1a5940c88d96bce
parente55955084f66971f6a268e0d0641da1f132fa979 (diff)
downloadlibass-6a07f564857d02d55b3549380ce033f532c14efc.tar.bz2
libass-6a07f564857d02d55b3549380ce033f532c14efc.tar.xz
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.
-rw-r--r--libass/ass_bitmap.c11
1 files changed, 5 insertions, 6 deletions
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;
{