encyclopegia.org

Hqx (algorithm)

hqx ("high quality scale") is a set of 3 image upscaling algorithms developed by Maxim Stepin. The algorithms are hq2x, hq3x, and hq4x, which magnify by a factor of 2, 3, and 4 respectively. It was initially created in 2003 for the Super NES emulator ZSNES, and is used in emulators such as Nestopia, FCEUX, higan, and Snes9x.

hqx ("high quality scale") is a set of 3 image upscaling algorithms developed by Maxim Stepin. The algorithms are hq2x, hq3x, and hq4x, which magnify by a factor of 2, 3, and 4 respectively. It was initially created in 2003 for the Super NES emulator ZSNES, and is used in emulators such as Nestopia, FCEUX, higan, and Snes9x. ==Algorithm== The source image's pixels are iterated through from top-left to bottom-right. For each pixel, the surrounding 8 pixels are compared to the color of the source pixel. Shapes are detected by checking for pixels of similar color according to a YUV threshold. hqx uses the YUV color space to calculate color differences, so that differences in brightness are weighted higher in order to mimic human perception. This gives a total of 2^8 = 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 256-filter 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 on a MMX-capable CPU. In the source code, the interpolation data is represented as preprocessor macros to be inserted into switch case statements, and there is no source code leading to the generation of a lookup table. The author describes the process of generating a look-up table as: ... for each combination the most probable vector representation of the area has to be determined, with the idea of edges between the different colored areas of the image to be preserved, with the edge direction to be as close to a correct one as possible. That vector representation is then rasterised with higher (3x) resolution using anti-aliasing, and the result is stored in the lookup table. ==Implementations== The original algorithm has been ported to DevIL (but kept in the C language). Ports to Java and C# languages are available. These implementations expand the macros. A C++ port by byuu, the author of bsnes, which encodes the LUT in a space-efficient way. Byuu exploited the symmetry of patterns to make such an encoding, and wrote some notes on interpreting the original look up tables. libretro implements two families of shaders in Slang/HLSL, GLSL, and Cg: The hqx family, which is true hqx. As it runs on modern GPUs, lookup tables are substituted by textures. The textures were generated by interrogating a modified version of hqx for its switch/case. The scalehq family, which is frequently confused with hqx. It is not related to hqx, but is rather a generic upscaling-smoothing algorithm. hqx has also been implemented in ffmpeg for upscaling images and videos 2x, 3x, or 4x. An account of the production of the translation for ffmpeg is here and usage may be something like: ffmpeg -i %1 -filter_complex hqx=2 hqx2-%1 to produce a 2x image or video. ==See also== Image scaling Pixel-art scaling algorithms Pixel art ==References== ==External links== hq2x, hq3x, and hq4x at the Wayback Machine Port of original project using DevIL A command line tool and C library hqxSharp project a port of hqx with added support for transparency, custom tolerances and seamless tiling (C#) 2d image filter project at code.google.com including the hqx filters and more (C#) hqx-java project Arcnor project - a free Java port of hqxSharp with a demo of usage (Java) HqxCli-Java A command line tool that use the Arcnor implementation (Java) ffmpeg implementation story ffmpeg -i %1 -filter_complex hqx=2 hqx2-%1 to produce a 2x image or video.

References

  1. HiEnd3D · retrieved 2023-02-11 · rev 1337863371
    Cite this reference

    MLA "HiEnd3D." 2023-02-11. https://web.archive.org/web/20131205091805/http://www.hiend3d.com/hq2x.html. Accessed 24 November 2026.

    Chicago "HiEnd3D." 2023-02-11. https://web.archive.org/web/20131205091805/http://www.hiend3d.com/hq2x.html.

    APA encyclopegia.org. (2023). HiEnd3D. Retrieved November 24, 2026, from https://web.archive.org/web/20131205091805/http://www.hiend3d.com/hq2x.html

  2. hqx-java · retrieved 2026-11-19 · rev 1337863371
    Cite this reference

    MLA "hqx-java." Garcia, Edu (6 March 2019). 2026-11-19. https://github.com/Arcnor/hqx-java/. Accessed 24 November 2026.

    Chicago "hqx-java." Garcia, Edu (6 March 2019). 2026-11-19. https://github.com/Arcnor/hqx-java/.

    APA Garcia, Edu (6 March 2019). (2026). hqx-java. Retrieved November 24, 2026, from https://github.com/Arcnor/hqx-java/

  3. hqxsharp · retrieved 2026-11-19 · rev 1337863371
    Cite this reference

    MLA "hqxsharp." Tamschi. 2026-11-19. https://github.com/Tamschi/hqxSharp. Accessed 24 November 2026.

    Chicago "hqxsharp." Tamschi. 2026-11-19. https://github.com/Tamschi/hqxSharp.

    APA Tamschi. (2026). hqxsharp. Retrieved November 24, 2026, from https://github.com/Tamschi/hqxSharp

  4. hqx · retrieved 2026-11-19 · rev 1337863371
    Cite this reference

    MLA "hqx." 2026-11-19. http://docs.libretro.com/shader/hqx/. Accessed 24 November 2026.

    Chicago "hqx." 2026-11-19. http://docs.libretro.com/shader/hqx/.

    APA encyclopegia.org. (2026). hqx. Retrieved November 24, 2026, from http://docs.libretro.com/shader/hqx/

  5. Filthy Pants: A Computer Blog: True Hq2x Shader Comparison With xBR · retrieved 2026-11-19 · rev 1337863371
    Cite this reference

    MLA "Filthy Pants: A Computer Blog: True Hq2x Shader Comparison With xBR." K, Hunter (20 June 2014). 2026-11-19. http://filthypants.blogspot.com/2014/06/true-hq2x-shader-comparison-with-xbr.html. Accessed 24 November 2026.

    Chicago "Filthy Pants: A Computer Blog: True Hq2x Shader Comparison With xBR." K, Hunter (20 June 2014). 2026-11-19. http://filthypants.blogspot.com/2014/06/true-hq2x-shader-comparison-with-xbr.html.

    APA K, Hunter (20 June 2014). (2026). Filthy Pants: A Computer Blog: True Hq2x Shader Comparison With xBR. Retrieved November 24, 2026, from http://filthypants.blogspot.com/2014/06/true-hq2x-shader-comparison-with-xbr.html

  6. Byuu. Release announcement Archived 2011-09-30 at the Wayback Machine Accessed 2011-08-14. public domain implementation released on pastebin Wikipedia revision 1337863371, retrieved 2026-11-20 · retrieved 2026-11-19 · rev 1337863371
    Cite this reference

    MLA "Byuu. Release announcement Archived 2011-09-30 at the Wayback Machine Accessed 2011-08-14. public domain implementation released on pastebin Wikipedia revision 1337863371, retrieved 2026-11-20." Byuu. 2026-11-19. http://nesdev.parodius.com/bbs/viewtopic.php?p=82770#82770. Accessed 24 November 2026.

    Chicago "Byuu. Release announcement Archived 2011-09-30 at the Wayback Machine Accessed 2011-08-14. public domain implementation released on pastebin Wikipedia revision 1337863371, retrieved 2026-11-20." Byuu. 2026-11-19. http://nesdev.parodius.com/bbs/viewtopic.php?p=82770#82770.

    APA Byuu. (2026). Byuu. Release announcement Archived 2011-09-30 at the Wayback Machine Accessed 2011-08-14. public domain implementation released on pastebin Wikipedia revision 1337863371, retrieved 2026-11-20. Retrieved November 24, 2026, from http://nesdev.parodius.com/bbs/viewtopic.php?p=82770#82770

  7. hqx README (grom358 port) · retrieved 2026-11-19 · rev 1337863371
    Cite this reference

    MLA "hqx README (grom358 port)." a b c d e Zemek, Cameron (6 May 2019). 2026-11-19. https://github.com/grom358/hqx/blob/master/README. Accessed 24 November 2026.

    Chicago "hqx README (grom358 port)." a b c d e Zemek, Cameron (6 May 2019). 2026-11-19. https://github.com/grom358/hqx/blob/master/README.

    APA a b c d e Zemek, Cameron (6 May 2019). (2026). hqx README (grom358 port). Retrieved November 24, 2026, from https://github.com/grom358/hqx/blob/master/README

  8. hqx-shader · retrieved 2026-11-19 · rev 1337863371
    Cite this reference

    MLA "hqx-shader." Blok, Jules (12 April 2019). 2026-11-19. https://github.com/Armada651/hqx-shader. Accessed 24 November 2026.

    Chicago "hqx-shader." Blok, Jules (12 April 2019). 2026-11-19. https://github.com/Armada651/hqx-shader.

    APA Blok, Jules (12 April 2019). (2026). hqx-shader. Retrieved November 24, 2026, from https://github.com/Armada651/hqx-shader

  9. HiEnd3D . · retrieved 2026-02-10 · rev 1337863371
    Cite this reference

    MLA "HiEnd3D ." 2026-02-10. https://en.wikipedia.org/w/index.php?oldid=1337863371. Accessed 24 November 2026.

    Chicago "HiEnd3D ." 2026-02-10. https://en.wikipedia.org/w/index.php?oldid=1337863371.

    APA encyclopegia.org. (2026). HiEnd3D . Retrieved November 24, 2026, from https://en.wikipedia.org/w/index.php?oldid=1337863371

  10. Zemek, Cameron. hqx README (grom358 port) . GitHub . 6 May 2019. · retrieved 2026-02-10 · rev 1337863371
    Cite this reference

    MLA "Zemek, Cameron. hqx README (grom358 port) . GitHub . 6 May 2019." Zemek, Cameron. 2026-02-10. https://en.wikipedia.org/w/index.php?oldid=1337863371. Accessed 24 November 2026.

    Chicago "Zemek, Cameron. hqx README (grom358 port) . GitHub . 6 May 2019." Zemek, Cameron. 2026-02-10. https://en.wikipedia.org/w/index.php?oldid=1337863371.

    APA Zemek, Cameron. (2026). Zemek, Cameron. hqx README (grom358 port) . GitHub . 6 May 2019. Retrieved November 24, 2026, from https://en.wikipedia.org/w/index.php?oldid=1337863371

  11. 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 256-filter lookup t . · retrieved 2026-02-10 · rev 1337863371
    Cite this reference

    MLA "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 256-filter lookup t ." The interpolation data in the lookup tables are constrained by the requirement that continuity of line segments must be. 2026-02-10. https://en.wikipedia.org/w/index.php?oldid=1337863371. Accessed 24 November 2026.

    Chicago "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 256-filter lookup t ." The interpolation data in the lookup tables are constrained by the requirement that continuity of line segments must be. 2026-02-10. https://en.wikipedia.org/w/index.php?oldid=1337863371.

    APA The interpolation data in the lookup tables are constrained by the requirement that continuity of line segments must be. (2026). 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 256-filter lookup t . Retrieved November 24, 2026, from https://en.wikipedia.org/w/index.php?oldid=1337863371

  12. hqxsharp . GitHub . · retrieved 2026-02-10 · rev 1337863371
    Cite this reference

    MLA "hqxsharp . GitHub ." hqxsharp. 2026-02-10. https://en.wikipedia.org/w/index.php?oldid=1337863371. Accessed 24 November 2026.

    Chicago "hqxsharp . GitHub ." hqxsharp. 2026-02-10. https://en.wikipedia.org/w/index.php?oldid=1337863371.

    APA hqxsharp. (2026). hqxsharp . GitHub . Retrieved November 24, 2026, from https://en.wikipedia.org/w/index.php?oldid=1337863371

  13. Byuu. [http://nesdev.parodius.com/bbs/viewtopic.php?p=82770#82770 Release announcement] Webarchive|url=https://web.archive.org/web/20110930163308/http://nesdev.parodius.com/bbs/viewtopic.php?p=82770 . · retrieved 2026-02-10 · rev 1337863371
    Cite this reference

    MLA "Byuu. [http://nesdev.parodius.com/bbs/viewtopic.php?p=82770#82770 Release announcement] Webarchive|url=https://web.archive.org/web/20110930163308/http://nesdev.parodius.com/bbs/viewtopic.php?p=82770 ." Byuu. 2026-02-10. https://en.wikipedia.org/w/index.php?oldid=1337863371. Accessed 24 November 2026.

    Chicago "Byuu. [http://nesdev.parodius.com/bbs/viewtopic.php?p=82770#82770 Release announcement] Webarchive|url=https://web.archive.org/web/20110930163308/http://nesdev.parodius.com/bbs/viewtopic.php?p=82770 ." Byuu. 2026-02-10. https://en.wikipedia.org/w/index.php?oldid=1337863371.

    APA Byuu. (2026). Byuu. [http://nesdev.parodius.com/bbs/viewtopic.php?p=82770#82770 Release announcement] Webarchive|url=https://web.archive.org/web/20110930163308/http://nesdev.parodius.com/bbs/viewtopic.php?p=82770 . Retrieved November 24, 2026, from https://en.wikipedia.org/w/index.php?oldid=1337863371

  14. hqx . Libretro Docs . · retrieved 2026-02-10 · rev 1337863371
    Cite this reference

    MLA "hqx . Libretro Docs ." hqx. 2026-02-10. https://en.wikipedia.org/w/index.php?oldid=1337863371. Accessed 24 November 2026.

    Chicago "hqx . Libretro Docs ." hqx. 2026-02-10. https://en.wikipedia.org/w/index.php?oldid=1337863371.

    APA hqx. (2026). hqx . Libretro Docs . Retrieved November 24, 2026, from https://en.wikipedia.org/w/index.php?oldid=1337863371

  15. Blok, Jules. hqx-shader . GitHub . 12 April 2019. · retrieved 2026-02-10 · rev 1337863371
    Cite this reference

    MLA "Blok, Jules. hqx-shader . GitHub . 12 April 2019." Blok, Jules. 2026-02-10. https://en.wikipedia.org/w/index.php?oldid=1337863371. Accessed 24 November 2026.

    Chicago "Blok, Jules. hqx-shader . GitHub . 12 April 2019." Blok, Jules. 2026-02-10. https://en.wikipedia.org/w/index.php?oldid=1337863371.

    APA Blok, Jules. (2026). Blok, Jules. hqx-shader . GitHub . 12 April 2019. Retrieved November 24, 2026, from https://en.wikipedia.org/w/index.php?oldid=1337863371

  16. K, Hunter. Filthy Pants: A Computer Blog: True Hq2x Shader Comparison With xBR . · retrieved 2026-02-10 · rev 1337863371
    Cite this reference

    MLA "K, Hunter. Filthy Pants: A Computer Blog: True Hq2x Shader Comparison With xBR ." K, Hunter. 2026-02-10. https://en.wikipedia.org/w/index.php?oldid=1337863371. Accessed 24 November 2026.

    Chicago "K, Hunter. Filthy Pants: A Computer Blog: True Hq2x Shader Comparison With xBR ." K, Hunter. 2026-02-10. https://en.wikipedia.org/w/index.php?oldid=1337863371.

    APA K, Hunter. (2026). K, Hunter. Filthy Pants: A Computer Blog: True Hq2x Shader Comparison With xBR . Retrieved November 24, 2026, from https://en.wikipedia.org/w/index.php?oldid=1337863371

Cite this article

MLA

"Hqx (algorithm)." encyclopegia.org, 2026, https://encyclopegia.org/wiki/hqx-algorithm. Accessed 24 November 2026.

Chicago

"Hqx (algorithm)." encyclopegia.org. Accessed November 24, 2026. https://encyclopegia.org/wiki/hqx-algorithm.

APA

encyclopegia.org. (2026). Hqx (algorithm). Retrieved November 24, 2026, from https://encyclopegia.org/wiki/hqx-algorithm

Accessed November 24, 2026 · CC BY-SA 4.0 · citation page · JSON

Related articles

Cappella (band)

enwiki · references available

GDSII

enwiki · references available

Geylang

enwiki · references available

Cattaraugus Creek

enwiki · references available

Svetlana Khorkina

enwiki · references available

Graham Fellows

enwiki · references available
CC BY-SA 4.0 · share-alike · https://en.wikipedia.org/w/index.php?oldid=1337863371 · 0.5 · snapshot enwiki-001337863371

Cite · JSON · Search

Related services and records

Services

  • Estate — measured countries, lanes and facts
  • Intel — live corroborated events
  • Legal — statutes, cases and citations
  • Encyclopedia — articles with inline sources
  • Space — launches, satellites and orbits
  • Search — federated search and reports
  • Pass — passport account and SSO
  • Corpora — read-only corpus origins
  • e01 — self-hosted corpora and tools

Text and metadata only; each target carries its own sources. Missing data is published as no-data, never estimated.