Jump to content

Hqx

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by 141.211.250.131 (talk) at 17:58, 17 November 2009 (Algorithm). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

In image processing, 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 emulators such as Nestopia, bsnes, ZSNES, Snes9x, FCE Ultra 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.

Image enlarged 3× with the nearest neighbor interpolation
Image enlarged in size by 3× with hq3x algorithm


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 pixels of similar color, according to some threshold. This gives total of 28 = 256 combinations of similar or dissimilar neighbors. To expand the single pixel into a 2x2, 3x3 or 4x4 block of pixels the arrangement of neighbors is looked up in a predefined table that contains the necessary algorithms.