mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-22 05:56:31 +00:00
videomixer: Don't do floating point math in the inner processing loop for I420 blending
This commit is contained in:
parent
b8c2ccce4e
commit
089d9d9dba
1 changed files with 4 additions and 1 deletions
|
@ -190,6 +190,7 @@ gst_i420_do_blend (guint8 * src, guint8 * dest,
|
||||||
gint dest_width, gdouble src_alpha)
|
gint dest_width, gdouble src_alpha)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
|
gint b_alpha;
|
||||||
|
|
||||||
/* If it's completely transparent... we just return */
|
/* If it's completely transparent... we just return */
|
||||||
if (G_UNLIKELY (src_alpha == 0.0)) {
|
if (G_UNLIKELY (src_alpha == 0.0)) {
|
||||||
|
@ -208,9 +209,11 @@ gst_i420_do_blend (guint8 * src, guint8 * dest,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
b_alpha = (gint) (src_alpha * 255);
|
||||||
|
|
||||||
for (i = 0; i < src_height; i++) {
|
for (i = 0; i < src_height; i++) {
|
||||||
for (j = 0; j < src_width; j++) {
|
for (j = 0; j < src_width; j++) {
|
||||||
*dest = src_alpha * (*src) + (1. - src_alpha) * (*dest);
|
*dest = (b_alpha * (*src) + (255 - b_alpha) * (*dest)) >> 16;
|
||||||
dest++;
|
dest++;
|
||||||
src++;
|
src++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue