[FFmpeg-devel] [PATCH] vf_overlay: adopts FAST_DIV255 macro for calculating destination alpha

Stefano Sabatini stefasab at gmail.com
Mon Oct 31 12:46:26 CET 2011


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

diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c
index 06967c2..6fa10ae 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;
                 }
-- 
1.7.4.1



More information about the ffmpeg-devel mailing list