2xPM scaler

Digitall recently pointed me towards some old patches on the patch tracker for scalers. There I found an old patch for the 2xPM scaler. It is a high quality scaler similar to hq2x. It took a few minutes to copy some files around and to change some variable names, but adding it was painless at first. When I tried to use it, the quality did not look as good as the screenshots I had seen previously. In particular the pattern in the source image:

#|@|#
#|#|@
#|#|#

Would scale the center pixel to:

#|@
@|#

which made no sense and gave previously sharp edges strange dithering effects.

So I compared the patch to the reference implementation it was based on and realized a few mistakes had been made in the copy-paste. The patch was never accepted, so it was probably never checked too thoroughly.

After fixing that, picture quality improved dramatically. 2xPM is arguably better than hq2x. I have included some images that demonstrate the different scalers. The source image is great because it contains a lot of pixel art in different colors in a variety of configurations.