summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Oshmyan <chortos@inbox.lv>2017-02-03 19:05:05 +0200
committerOleg Oshmyan <chortos@inbox.lv>2020-10-18 05:01:31 +0300
commit59349a70589f3cd97a608fee67da5d27b9944242 (patch)
treef6e71c0f53ba4055c5954702ecdaa4365fcc712a
parent815aae8308e177767ac9196bb60eb07fa588b392 (diff)
downloadlibass-59349a70589f3cd97a608fee67da5d27b9944242.tar.bz2
libass-59349a70589f3cd97a608fee67da5d27b9944242.tar.xz
mult_alpha: round the product
For what it's worth, VSFilter does this too, and our mult_alpha now gives the same results as the corresponding code in VSFilter for all possible inputs.
-rw-r--r--libass/ass_parse.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libass/ass_parse.c b/libass/ass_parse.c
index 3456410..56a02be 100644
--- a/libass/ass_parse.c
+++ b/libass/ass_parse.c
@@ -181,7 +181,7 @@ inline void change_alpha(uint32_t *var, int32_t new, double pwr)
*/
inline uint32_t mult_alpha(uint32_t a, uint32_t b)
{
- return a - (uint64_t) a * b / 0xFF + b;
+ return a - ((uint64_t) a * b + 0x7F) / 0xFF + b;
}
/**