Optimizations and palette support.

This optimization makes decoding 10-12x faster. Mainly the ColorInfo is removed and unnecessary object creations and function calls are streamlined. Should be pretty readable still.