diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2009-01-01 11:33:46 +0000 |
---|---|---|
committer | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2009-01-01 11:33:46 +0000 |
commit | 2641f962467dde8af5b972eadb078b0a353099fc (patch) | |
tree | b999675b6138e3f079c486f34acff40db77a446f /spudec.c | |
parent | 0b806e47982f437bae6f1f5360177ab2332dd9c4 (diff) | |
download | mpv-2641f962467dde8af5b972eadb078b0a353099fc.tar.bz2 mpv-2641f962467dde8af5b972eadb078b0a353099fc.tar.xz |
Simplify and comment spudec bilinear scaling code
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28223 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'spudec.c')
-rw-r--r-- | spudec.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -737,9 +737,10 @@ static void scale_image(int x, int y, scale_pixel* table_x, scale_pixel* table_y 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]; } } |