Create separate types in optimizer for palette index, penalty.
Optimize: Support images with >=2^16-1 distinct colors.

This requires that the optimizer use image buffers that aren't
16-bit pixels. But switching overall to 32-bit pixels is expensive
by about 33%-50% more for large images, so compile the optimizer
twice, once for 16-bit pixels and once for 32-bit pixels.
To 1.84.