From 0b3e9d5dc61bb705d93db1e87d78d8d5131905c6 Mon Sep 17 00:00:00 2001
From: Stefano Sabatini <stefasab@gmail.com>
Date: Mon, 31 Oct 2011 11:32:11 +0100
Subject: [PATCH] vf_overlay: adopts FAST_DIV255 macro for calculating
 destination alpha

Ease readability, improve exactness.
---
 libavfilter/vf_overlay.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c
index 06967c2db5b..6fa10aec8e5 100644
--- a/libavfilter/vf_overlay.c
+++ b/libavfilter/vf_overlay.c
@@ -452,7 +452,8 @@ static void blend_slice(AVFilterContext *ctx,
                         alpha = (alpha_v + alpha_h) >> 1;
                     } else
                         alpha = a[0];
-                    *d = (*d * (0xff - alpha) + *s++ * alpha + 128) >> 8;
+                    *d = FAST_DIV255(*d * (255 - alpha) + *s * alpha);
+                    s++;
                     d++;
                     a += 1 << hsub;
                 }
-- 
GitLab