Have a saner simple scaling filter
We currently offer two simple scaling filters:
- Sharp: nearest neighbor
- Smooth: bilinear interpolation
Both are very extreme and problematic in most cases.
Nearest Neighbor
While nearest neighbor preserves the sharpness of the pixels, at non-integer scales, it matches the in-between destination pixels to either comletely one of the source pixels or completely the other, effectively distording the pixels' sizes, which can be very visible in motion. In practice, scaling an image by 4.5 means that each line or row will be allocated 4 or 5 pixels.
Even on still images it can be pretty noticeable, e.g. see the eyes in the life icon:
Bilinear Interpolation
While bilinear interpolation correctly handles any scale, its destroys all details and is disgustingly blurry.
A Middle Ground
Ideally we want to have the sharp look of nearest neigbor as it preserves the original details, but we want to scale all pixels in an even way. An algorithm that works well is behaving like nearest neighbor for destination pixels which clearly match a source one, but behaving like bilinear for shared pixels. It can be easily (but inefficiently) computed by first scaling to the integer scale lower than the final scale with nearest neighbor (with a minimum scale of 1), then scaling that result to the final scale with bilinear interpolation. On integer scales, it will look exactly like nearest neighbor.
While it brings a tiny bit of blur, it mosty is sharp and preserves the details while scaling all pixels evenly, and looks really nice in motion. While this algorithm became very common and is considered a sane default to upscale low res games, it doesn't seem to have a common name.
Discussion
We discussed this on Matrix, here is what came out of it:
- @exalm doesn't mind having that algorithm as a defautl as long as nearest neigbor is still available as it has his preference.
- heftig (I don't know their name) prefers that new algorithm too, they also provided documentation about this algorithm as well as some scaling algorithm comparisons.
- I prefer that new algorithm as a default for low res games (less than 480 lines), starting from 480 lines I suspect bilinear interpolation is better.