|
From: Stephan A. <sup...@gm...> - 2004-06-17 19:16:30
|
Hi Maxim, as a curious thing, there is virtually no difference if I use >> 8 or / 255. I have double checked. I'm on Pentium-M, maybe divisions are not that expensive there?!? As it turns out, my worst case blending (0 < top and bottom alpha < 255) is much much slower than my usual case (bottom alpha == 255). So I'm really looking for an optimization of this piece of code: t[1..3] top color on 0..25500 ta top alpha on 0..255 b[1..3] bottom color on 0..25500 ba bottom alpha on 0..255 d[1..3] resulting color on 0..255 da resulting alpha on 0..255 uint8 alphaRest = 255 - ta; uint32 alphaTemp = (65025 - alphaRest * (255 - ba)); uint32 alphaDest = ba * alphaRest; uint32 alphaSrc = 255 * ta; *d1 = kInverseGammaTable[(b1 * alphaDest + t1 * alphaSrc) / alphaTemp]; *d2 = kInverseGammaTable[(b2 * alphaDest + t2 * alphaSrc) / alphaTemp]; *d3 = kInverseGammaTable[(b3 * alphaDest + t3 * alphaSrc) / alphaTemp]; *da = alphaTemp / 255; Best regards, -Stephan |