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

Stefano Sabatini git at videolan.org
Wed Nov 2 21:50:00 CET 2011


ffmpeg | branch: master | Stefano Sabatini <stefasab at gmail.com> | Mon Oct 31 11:32:11 2011 +0100| [0b3e9d5dc61bb705d93db1e87d78d8d5131905c6] | committer: Stefano Sabatini

vf_overlay: adopts FAST_DIV255 macro for calculating destination alpha

Ease readability, improve exactness.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0b3e9d5dc61bb705d93db1e87d78d8d5131905c6
---

 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;
                 }



More information about the ffmpeg-cvslog mailing list