Hqx
Encyclopedia
In image processing
Image processing
In electrical engineering and computer science, image processing is any form of signal processing for which the input is an image, such as a photograph or video frame; the output of image processing may be either an image or, a set of characteristics or parameters related to the image...

, hqx ("hq" stands for "high quality" and "x" stands for magnification) is one of the pixel art scaling algorithms developed by Maxim Stepin, used in emulator
Emulator
In computing, an emulator is hardware or software or both that duplicates the functions of a first computer system in a different second computer system, so that the behavior of the second system closely resembles the behavior of the first system...

s such as Nestopia
Nestopia
Nestopia is an open source NES/Famicom emulator designed to emulate the NES hardware as accurately as possible. Originally for Windows only, Nestopia has been ported to the Mac OS X and Linux operating systems.-Features:...

, bsnes
Bsnes
bsnes is a free SNES emulator for Linux, Mac OS X, and Windows which aims to emulate the original SNES hardware as accurately as possible. As such, bsnes is a low-level emulator.-Background:...

, ZSNES
ZSNES
ZSNES is a free software SNES emulator written mostly in x86 assembly with official ports for Linux, MS-DOS, Mac OS X, Windows and an unofficial port for Xbox.-Background:...

, Snes9x
Snes9x
Snes9x is an SNES emulator written in C++ with official ports for Linux, Microsoft Windows, Mac OS X, the PSP and Android.-Background:Development of Snes9x began in July 1997 when Snes96's Gary Henderson and Snes97's Jerremy Koot merged their respective emulators to create Snes9x. Since then,...

, FCE Ultra
FCE Ultra
FCEUX is an open source Nintendo Entertainment System and Family Computer Disk System emulator. It is a merger of various forks of FCE Ultra.-Multiplayer support:...

 and many more. There are 3 hqx filters: hq2x, hq3x, and hq4x, which magnify by factor of 2, 3, and 4 respectively. For other magnification factors, this filter is used with nearest-neighbor scaling. AGS
Adventure Game Studio
Adventure Game Studio is a free software development tool that is primarily used to create graphical adventure games. It is aimed at intermediate-level game designers, and combines an Integrated development environment for setting up most aspects of the game with a scripting language to process...

 supports hq2x and hq3x scaling filters.



Algorithm

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 pixel
Pixel
In digital imaging, a pixel, or pel, is a single point in a raster image, or the smallest addressable screen element in a display device; it is the smallest unit of picture that can be represented or controlled....

s 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.

The interpolation data in the lookup tables are constrained by the requirement that continuity of line segments must be preserved, while optimizing for smoothness. Generating these lookup tables is relatively slow, and is the major source of complexity in the algorithm: the render stage is very simple and fast, and designed to be capable of being performed in real time.

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK