]> granicus.if.org Git - libass/commitdiff
Don't forget to apply \be to the first/last row/column (again)
authorOleg Oshmyan <chortos@inbox.lv>
Wed, 12 Mar 2014 22:25:52 +0000 (22:25 +0000)
committerOleg Oshmyan <chortos@inbox.lv>
Tue, 10 Feb 2015 02:41:52 +0000 (04:41 +0200)
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

index 6f77a173c09921f46ac216cdada952b8ebe03148..19c472767feae0918e8a4f4520f7f6d2ea74b969 100644 (file)
@@ -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;
     }
 }