2xSaI: The advanced 2x Scale and Interpolation Engine

2xSaI is an algorithm for scaling images, developed by Derek Liauw Kie Fa. The code he made is distributed under GPL.

It's intended for use in emulators to scale the emulated machine's image in real time. This is done because most of these emulated things have really small screens, and using a bigger screen mode is often advisable. For example, Ultima VII uses 320x240 VGA mode, but Exult (the premier U7 runtime these days) allows you to easily double that and letterbox to 640x480, or use a 400x300 that gets doubled to 800x600 - screens larger than this are often considered cheating, though.

Formerly, emulators tended to scale image by just doubling pixels, which meant the image was pretty rough - the aliased edges were, ahem, aliased. 2xSaI, along with Eagle (the engine 2xSaI gets its ideas from) attempts to scale the image so that the picture looks better. The only problem with 2xSaI and related engines is that the picture can only be enlarged at multiples of two. But the result looks quite good - and, 2xSaI can be done programmatically, and it runs pretty fast with MMX optimizations.

This scaling method is based on pattern recognition - Edges of colored areas are replaced with a smoother edge.

2xSaI, along with its sister/variant methods (Super 2xSaI and Super Eagle) are used in open-sourced emulators. 2xSaI was originally developed for SNES9x. I was personally pretty surprised by the 2xSaI results in ZSNES, and of course, Exult makes Ultima VII look pretty damn good on modern display using these same methods.

(The home page of the system is at http://elektron.its.tudelft.nl/~dalikifa/ - regrettably this page doesn't go into the gruesome details on how the code works...)