[cairo] rewriting libpixman

James Cloos cloos at jhcloos.com
Fri Mar 30 16:26:59 PDT 2007

>> The bit-copying "approximation" is exactly equivalent to
>> multiplying by 255 and dividing by 31.  There's no point in
>> implementing both -- stick with the bit copy, since it's more
>> efficient.

Jeff> (x << 3) | (x >> 2) is not equivalent to (255*x + 15)/31
Jeff> for x = {3, 7, 24, 28}

As I recall from doing some analysis during the float thread, that
should be multiplying by 256 and dividing by 31.  Ie, always multiply
by 2^${num_bits} and divide by ${Int_max} to get reversable conversions
well centered w/in the sample resolution(s).

James Cloos <cloos at jhcloos.com>         OpenPGP: 1024D/ED7DAEA6

More information about the cairo mailing list