vf_overlay: adopts FAST_DIV255 macro for calculating destination alpha
authorStefano Sabatini <stefasab@gmail.com>
Mon, 31 Oct 2011 10:32:11 +0000 (11:32 +0100)
committerStefano Sabatini <stefasab@gmail.com>
Wed, 2 Nov 2011 20:44:13 +0000 (21:44 +0100)
Ease readability, improve exactness.

libavfilter/vf_overlay.c

index 06967c2..6fa10ae 100644 (file)
@@ -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;
                 }