summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Oshmyan <chortos@inbox.lv>2014-03-12 22:25:52 +0000
committerOleg Oshmyan <chortos@inbox.lv>2015-02-10 04:41:52 +0200
commitf23b9ed64bd4ccf249c686616dd3f51a69d285dc (patch)
tree256bb7bd61db864e0eb94688003dd11206820258
parent82a5bb2040ec63aec11043d5249bac68eed6632d (diff)
downloadlibass-f23b9ed64bd4ccf249c686616dd3f51a69d285dc.tar.bz2
libass-f23b9ed64bd4ccf249c686616dd3f51a69d285dc.tar.xz
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.
-rw-r--r--libass/ass_bitmap.c55
1 files 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;
}
}