On Wednesday 23 July 2008 21:48:59 Chris Robinson wrote:
But extracting the mask offset and size from the actual mask takes a bit of time,
Extracting mask is called once or twice per channel conversion. I.e. in case of converting a8r8g8b8->a1r5g5b5 mask should be calculated only 8 times, no matter how big surface is. check mask_copy() routine for details. Optimizing this is pointless - converter performs much more per pixel operations - shifts, bitwise operations, etc, so you won't notice any difference.
and as it is, the table can't currently set a proper mask for anything over 32 bits (including the 16-bit-per-component unsigned integer types).
Yes, this isn't supported. But with current scheme of conversion, adding support for 16-bit-per-component surfaces would require operating on 64bit numbers or increasing number of per-pixel operations. I think per-pixel 64bit shifts on 32bit CPUs will be slower.
replacing masks with number of bits and shift will need additional work, since masks are probably used in other places. There will be also high chance of breaking entire table accidentally because of misprint.
If you don't like current functionality, to my opinion the best approach would be to modify it once my patch made it in repository.