From f23b9ed64bd4ccf249c686616dd3f51a69d285dc Mon Sep 17 00:00:00 2001 From: Oleg Oshmyan Date: Wed, 12 Mar 2014 22:25:52 +0000 Subject: Don't forget to apply \be to the first/last row/column (again) The implementation of \be was changed to xy-VSFilter's, which (like VSFilter's) reads but does not write out the first/last row/column. --- libass/ass_bitmap.c | 55 +++++++++++++++++++++++++---------------------------- 1 file changed, 26 insertions(+), 29 deletions(-) diff --git a/libass/ass_bitmap.c b/libass/ass_bitmap.c index 6f77a17..19c4727 100644 --- a/libass/ass_bitmap.c +++ b/libass/ass_bitmap.c @@ -649,49 +649,35 @@ void be_blur_c(uint8_t *buf, intptr_t w, unsigned char *src, *dst; memset(col_pix_buf, 0, w * sizeof(unsigned short)); memset(col_sum_buf, 0, w * sizeof(unsigned short)); - { - y = 0; - src=buf+y*stride; + y = 0; - x = 2; - old_pix = src[x-1]; - old_sum = old_pix + src[x-2]; - for ( ; x < w; x++) { - temp1 = src[x]; - temp2 = old_pix + temp1; - old_pix = temp1; - temp1 = old_sum + temp2; - old_sum = temp2; - col_pix_buf[x] = temp1; - } - } { - y = 1; src=buf+y*stride; - x = 2; + x = 1; old_pix = src[x-1]; - old_sum = old_pix + src[x-2]; + old_sum = old_pix; for ( ; x < w; x++) { temp1 = src[x]; temp2 = old_pix + temp1; old_pix = temp1; temp1 = old_sum + temp2; old_sum = temp2; - - temp2 = col_pix_buf[x] + temp1; - col_pix_buf[x] = temp1; - col_sum_buf[x] = temp2; + col_pix_buf[x-1] = temp1; + col_sum_buf[x-1] = temp1; } + temp1 = old_sum + old_pix; + col_pix_buf[x-1] = temp1; + col_sum_buf[x-1] = temp1; } - for (y = 2; y < h; y++) { + for (y++; y < h; y++) { src=buf+y*stride; dst=buf+(y-1)*stride; - x = 2; + x = 1; old_pix = src[x-1]; - old_sum = old_pix + src[x-2]; + old_sum = old_pix; for ( ; x < w; x++) { temp1 = src[x]; temp2 = old_pix + temp1; @@ -699,11 +685,22 @@ void be_blur_c(uint8_t *buf, intptr_t w, temp1 = old_sum + temp2; old_sum = temp2; - temp2 = col_pix_buf[x] + temp1; - col_pix_buf[x] = temp1; - dst[x-1] = (col_sum_buf[x] + temp2) >> 4; - col_sum_buf[x] = temp2; + temp2 = col_pix_buf[x-1] + temp1; + col_pix_buf[x-1] = temp1; + dst[x-1] = (col_sum_buf[x-1] + temp2) >> 4; + col_sum_buf[x-1] = temp2; } + temp1 = old_sum + old_pix; + temp2 = col_pix_buf[x-1] + temp1; + col_pix_buf[x-1] = temp1; + dst[x-1] = (col_sum_buf[x-1] + temp2) >> 4; + col_sum_buf[x-1] = temp2; + } + + { + dst=buf+(y-1)*stride; + for (x = 0; x < w; x++) + dst[x] = (col_sum_buf[x] + col_pix_buf[x]) >> 4; } } -- cgit v1.2.3