summaryrefslogtreecommitdiffstats
path: root/access_mpcontext.h
diff options
context:
space:
mode:
authorUoti Urpala <uau@symbol.nonexistent.invalid>2008-07-23 01:47:30 +0300
committerUoti Urpala <uau@symbol.nonexistent.invalid>2008-07-23 02:05:55 +0300
commit4dab4347f5d7bb3642a2c5918fc29855f8f62482 (patch)
tree4f1f572dcd5cfee177658d28de3e1c3ce015dd65 /access_mpcontext.h
parent2d4656e070697cebe8cb66568b3e8dd8919b5eed (diff)
downloadmpv-4dab4347f5d7bb3642a2c5918fc29855f8f62482.tar.bz2
mpv-4dab4347f5d7bb3642a2c5918fc29855f8f62482.tar.xz
vf_ass: Optimize alpha multiply
The effect of alpha blending was calculated as color = orig_color * alpha / 255 where alpha and color range from 0 to 255. Change this to color = (orig_color * alpha + 255) / 256 where the "/ 256" can be expressed as a shift whereas the compiler would probably generate a multiply+shift for the original "/ 255". This formula gives a result that is too high by 1 for some inputs. However it gives the exact result if alpha is 0 or 255 which is probably the case where small errors would matter most.
Diffstat (limited to 'access_mpcontext.h')
0 files changed, 0 insertions, 0 deletions