Increased performance by 30% for RGBA and 45% for Gray images, minor
performance increase for 16-bit images.
The start offset calculated by createWeights are stored in a slice and
passed to the resize functions to prevent duplication of effort.
This is a complete rewrite! The tight scaling loop needs data locality for optimal performance. The old version used lots of pointer redirections to access image data which was bad for data locality. By providing the complete loop for each image type, this problem is solved. Unfortunately this increases code duplication but the result should be worth it: I could measure a ~6x speed-up for certain test cases!