[MPlayer-cvslog] r28223 - trunk/spudec.c
reimar
subversion at mplayerhq.hu
Thu Jan 1 12:33:46 CET 2009
Author: reimar
Date: Thu Jan 1 12:33:46 2009
New Revision: 28223
Log:
Simplify and comment spudec bilinear scaling code
Modified:
trunk/spudec.c
Modified: trunk/spudec.c
==============================================================================
--- trunk/spudec.c Thu Jan 1 12:23:32 2009 (r28222)
+++ trunk/spudec.c Thu Jan 1 12:33:46 2009 (r28223)
@@ -737,9 +737,10 @@ static void scale_image(int x, int y, sc
spu->scaled_image[scaled] = (color[0] * scale[0] + color[1] * scale[1] + color[2] * scale[2] + color[3] * scale[3])>>24;
spu->scaled_aimage[scaled] = (scale[0] + scale[1] + scale[2] + scale[3]) >> 16;
if (spu->scaled_aimage[scaled]){
- spu->scaled_aimage[scaled] = 256 - spu->scaled_aimage[scaled];
- if(spu->scaled_aimage[scaled] + spu->scaled_image[scaled] > 255)
- spu->scaled_image[scaled] = 256 - spu->scaled_aimage[scaled];
+ // ensure that MPlayer's simplified alpha-blending can not overflow
+ spu->scaled_image[scaled] = FFMIN(spu->scaled_image[scaled], spu->scaled_aimage[scaled]);
+ // convert to MPlayer-style alpha
+ spu->scaled_aimage[scaled] = -spu->scaled_aimage[scaled];
}
}
More information about the MPlayer-cvslog
mailing list