C++ implementation of hq2x and hq3x scaling algorithms. This implementation was made using DOSBOX and hqxSharp as reference.
The hqx algorithms ("hq" stands for "high quality" and "x" stands for magnification) is a scaling algorithms created by Maxim Stepin and it's mostly used in emulators.
The algorithm description from Wikipedia:
First, the color of each of the 8 pixels around the source pixel is compared to the color of the source pixel. Shapes are detected by checking for pixels of similar color according to a threshold. This gives total of 28 = 256 combinations of similar or dissimilar neighbors. To expand the single pixel into a 2×2, 3×3, or 4×4 block of pixels, the arrangement of neighbors is looked up in a predefined table which contains the necessary interpolation patterns.
For more information, check out the archived version of the original Maxim Stepin website: HiEnd3D - Demos & Docs.
There are two "versions" of the HQx algorithm: one to produce a sharper output and another for a smoothed output. Check out the file HQx.cc
for more information.
Original test image:
Test image scaled by 2x (smoothed version):
Test image scaled by 3x (smoothed version):
Prince of Persia 1 screenshot:
Prince of Persia 1 screenshot scaled by 2x (sharper version):