Wrote an inline round+clamp+cast-to-uchar and used it late.

Basically, kept everything as double as long as possible, then
converted to unsigned char at the last minute.

Modest performance gain over the int implementation.