]> granicus.if.org Git - libass/commitdiff
Make \be animatable
authorOleg Oshmyan <chortos@inbox.lv>
Wed, 30 Apr 2014 23:32:50 +0000 (00:32 +0100)
committerOleg Oshmyan <chortos@inbox.lv>
Mon, 12 May 2014 01:24:07 +0000 (02:24 +0100)
VSFilter has supported this since version 2.39.

Use the raw floating-point value of the \be argument in the animation
formula, like xy-VSFilter has done since version 3.0.0.45 (404301a3).

libass/ass_parse.c

index c5729551d39cb69cfdc9cdd68bb290ad374bdbf8..b8c2547698972826a838e6d49f28c4abc81d1698 100644 (file)
@@ -730,8 +730,11 @@ char *parse_tag(ASS_Renderer *render_priv, char *p, double pwr)
         } else
             reset_render_context(render_priv, NULL);
     } else if (mystrcmp(&p, "be")) {
-        int val;
-        if (mystrtoi(&p, &val)) {
+        double dval;
+        if (mystrtod(&p, &dval)) {
+            int val;
+            // VSFilter always adds +0.5, even if the value is negative
+            val = (int) (render_priv->state.be * (1 - pwr) + dval * pwr + 0.5);
             // Clamp to a safe upper limit, since high values need excessive CPU
             val = (val < 0) ? 0 : val;
             val = (val > MAX_BE) ? MAX_BE : val;