Speed up LMS<->XYZ conversions by a factor of 20

Also gives a 2x speed boost to RGB<->XYZ. The slow ^ operation in
`rgb_compand` is the remaining bottleneck, but there's not an
easy way around that.

Note: this may be problematic once multithreading lands (the globals `tmp1`, `tmp2` are not thread-safe), so I'm going to not hit the merge button on this one without review. CC @StefanKarpinski.