Matt Turner <matts...@gmail.com> writes: > Given a pixel with only the red component of these values, the results > are off-by-one. > > 0x03 -> 0x19 (0x18) > 0x07 -> 0x3A (0x39) > 0x18 -> 0xC5 (0xC6) > 0x1C -> 0xE6 (0xE7) > > (Same for blue, and green has many more cases) > > It uses > R8 = ( R5 * 527 + 23 ) >> 6; > G8 = ( G6 * 259 + 33 ) >> 6; > B8 = ( B5 * 527 + 23 ) >> 6; > > I don't guess there's a way to tweak this to produce the same results > we get from expand565, is there?
Maybe I'm missing something, but this certainly produces the correct result: r8 = (r5 * 8 + r5 / 4) = r5 * (8 + 0.25) = r5 * (32 + 1) / 4 = (r5 * 33) >> 2 and similar for green, where the result would be g8 = (g6 * 65) >> 4 Søren _______________________________________________ Pixman mailing list Pixman@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/pixman