Inputs having zero as both width and height were caught, but either one
alone caused a panic. This adds a test showing the old failing behavior
and adds a check for non-positive width/height. Since Resize doesn't
have an error return value, the behavior in this case is to return the
original image.
Fixes https://github.com/nfnt/resize/issues/52
These image types use premultiplied alpha values which are also used during the interpolation. If we'd use NRGBA, NRGBA64 as output, we'd have to reverse the premultiplication.
Fixes issue #31.
The color value of every pixel of the resized image is created from the YCbCr
colors of the input image. Therefore each of the three components have the same
sample rate. This is the 4:4:4 chroma subsampling and the output images are
now created accordingly.
This change sets the number of spawned goroutines to the GOMAXPROCS
value set by the user.
Using more goroutines than available execution threads is slightly
detrimental to performance (~0.5%), and prevents users of the library
from controlling the number of spawned goroutines.
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!
For each row the convolution kernel is evaluated at fixed positions around "u". By calculating these values once for each row, a huge speedup is achieved.
Filter kernels should yield Zero if they are evaluted outside their
intended size. Though filterModel.Interpolate doesn't do this by design,
it's better to include it anyways.
If both dimensions are given, always use those dimensions, avoiding roundoff
error.
If only one dimension is given, slightly prefer rounding the other dimension
up, to rounding it down.