Edge2x/3x scaler

So this week I added the Edge2x/3x scaler. It is the most complex scaler yet, producing the highest quality images and being the most cpu greedy.

It had some pretty ingenious heuristics to detect the entire source image, see exactly what pixels had changed and only update the relevant regions. Of course this was originally written years ago so this kind of hack is not necessary, and I have disabled it. On my laptop, everything seems smooth as long as it is compiled with optimization. Without, it is quite jerky (the compiler must be doing something right). However I am considering adding optional access to the old source image as part of the scaler api so all those hacks would not be necessary.

So here are some comparisons. Click to see larger versions.

Notice that the Edge2x scaler manages to anti alias almost every edge whereas the other scalers tend to miss some. In particular, look at the roundness of the coins and the features of Guybrush’s body.

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.

Images

I thought it was odd that a graphics focused project like mine would not have any images yet.

So among various invisible infrastructure changes I have made, I did add two new modes, Normal4x nearest neighbor scaling, and AdvMame4x scaling. They look nice if you have a high resolution monitor. I plan to add HQ4x too and I will post I similar screenshot.

Normal4x
AdvMame4x

 

Scaler Progress

The plugin system seems to be working well. It is now integrated with the GUI and configuration file. The naming scheme in the configuration file has changed slightly, but old values will be recognized and replaced. So if you had different settings for every game in your game library, they should all still work.

In addition, I added a 4x nearest neighbor scaler. It works fine except for some minor cursor issues which should be fixed when the cursor api gets changed. This means HQ4x and AdvMame4x will soon be available with very little added code.

Now I am in the process of removing quick hacks I made earlier. Then much of the scalers need to be changed to fully implement more pixel formats.