mirror of
https://github.com/mpv-player/mpv
synced 2025-01-16 12:02:39 +00:00
This is a simple patch to change the alpha blending code in bmovl to use
integers instead of floating point. It speeds it up by about 400% meaning that it's now possible to apply alpha blending to a whole 1024x768 image on my 1266MHz PIII. Jonas Jensen <jbj@knef.dk> git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@9111 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
a7e9bac132
commit
8755d76ce2
@ -395,11 +395,20 @@ put_image(struct vf_instance_s* vf, mp_image_t* mpi){
|
||||
dmpi->planes[2][pos] = vf->priv->bitmap.v[pos];
|
||||
}
|
||||
} else { // Alphablended pixel
|
||||
dmpi->planes[0][pos] = (dmpi->planes[0][pos]*(1.0-(alpha/255.0))) + (vf->priv->bitmap.y[pos]*(alpha/255.0));
|
||||
dmpi->planes[0][pos] =
|
||||
((255 - alpha) * (int)dmpi->planes[0][pos] +
|
||||
alpha * (int)vf->priv->bitmap.y[pos]) >> 8;
|
||||
|
||||
if ((ypos%2) && (xpos%2)) {
|
||||
pos = ( (ypos/2) * dmpi->stride[1] ) + (xpos/2);
|
||||
dmpi->planes[1][pos] = (dmpi->planes[1][pos]*(1.0-(alpha/255.0))) + (vf->priv->bitmap.u[pos]*(alpha/255.0));
|
||||
dmpi->planes[2][pos] = (dmpi->planes[2][pos]*(1.0-(alpha/255.0))) + (vf->priv->bitmap.v[pos]*(alpha/255.0));
|
||||
|
||||
dmpi->planes[1][pos] =
|
||||
((255 - alpha) * (int)dmpi->planes[1][pos] +
|
||||
alpha * (int)vf->priv->bitmap.u[pos]) >> 8;
|
||||
|
||||
dmpi->planes[2][pos] =
|
||||
((255 - alpha) * (int)dmpi->planes[2][pos] +
|
||||
alpha * (int)vf->priv->bitmap.v[pos]) >> 8;
|
||||
}
|
||||
}
|
||||
} // for xpos
|
||||
|
Loading…
Reference in New Issue
Block a user