fbpx
Wikipedia

hqx


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,[1] and is used in emulators such as Nestopia, F. CEUXSnes9x., and Snes9x.

hqx
Developer(s)Maxim Stepin
Initial releaseJuly 25, 2003; 20 years ago (2003-07-25)
Stable release
1.1 / September 29, 2003; 20 years ago (2003-09-29)
Written inC++
TypePixel-art scaling algorithm
LicenseLGPL 2.1
Websitegimp.org

Algorithm edit

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 to order to mimic human perception.[2] This gives a total of   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.[2]

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.[2]

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:[2]

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

  • The original algorithm has been ported to DevIL (but kept in the C language).[2]
  • Ports to Java and C# languages are available. These implementations expand the macros.[3][4]
  • 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.[5]
  • libretro implements two families of shaders in Slang/HLSL, GLSL, and Cg:
    • The hqx family, which is true hqx.[6] As it runs on modern GPUs, lookup tables are substituted by textures.[7] 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.[8]
  • 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 edit

References edit

  1. ^ . 2013-12-05. Archived from the original on 2013-12-05. Retrieved 2023-02-12.
  2. ^ a b c d e Zemek, Cameron (6 May 2019). "hqx README (grom358 port)". {{cite journal}}: Cite journal requires |journal= (help)
  3. ^ Garcia, Edu (6 March 2019). "hqx-java". GitHub.
  4. ^ Tamschi. "hqxsharp". GitHub.
  5. ^ Byuu. Release announcement Accessed 2011-08-14. public domain implementation released on pastebin
  6. ^ "hqx". Libretro Docs.
  7. ^ Blok, Jules (12 April 2019). "hqx-shader". GitHub.
  8. ^ K, Hunter (20 June 2014). "Filthy Pants: A Computer Blog: True Hq2x Shader Comparison With xBR". Filthy Pants.

External links edit

  • , , and 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.

this, article, about, image, scaling, filter, files, binhex, high, quality, scale, image, upscaling, algorithms, developed, maxim, stepin, algorithms, hq2x, hq3x, hq4x, which, magnify, factor, respectively, initially, created, 2003, super, emulator, zsnes, use. This article is about image scaling filter For hqx files see BinHex 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 1 and is used in emulators such as Nestopia F CEUXSnes9x and Snes9x hqxDeveloper s Maxim StepinInitial releaseJuly 25 2003 20 years ago 2003 07 25 Stable release1 1 September 29 2003 20 years ago 2003 09 29 Written inC TypePixel art scaling algorithmLicenseLGPL 2 1Websitegimp org Contents 1 Algorithm 2 Implementations 3 See also 4 References 5 External linksAlgorithm editThe 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 to order to mimic human perception 2 This gives a total of 2 8 256 displaystyle 2 8 256 nbsp 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 2 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 2 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 2 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 nbsp Image enlarged 3 with nearest neighbor interpolation nbsp Image enlarged by 3 with hq3xImplementations editThe original algorithm has been ported to DevIL but kept in the C language 2 Ports to Java and C languages are available These implementations expand the macros 3 4 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 5 libretro implements two families of shaders in Slang HLSL GLSL and Cg The hqx family which is true hqx 6 As it runs on modern GPUs lookup tables are substituted by textures 7 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 8 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 editImage scaling Pixel art scaling algorithms Pixel artReferences edit HiEnd3D 2013 12 05 Archived from the original on 2013 12 05 Retrieved 2023 02 12 a b c d e Zemek Cameron 6 May 2019 hqx README grom358 port a href Template Cite journal html title Template Cite journal cite journal a Cite journal requires journal help Garcia Edu 6 March 2019 hqx java GitHub Tamschi hqxsharp GitHub Byuu Release announcement Accessed 2011 08 14 public domain implementation released on pastebin hqx Libretro Docs Blok Jules 12 April 2019 hqx shader GitHub K Hunter 20 June 2014 Filthy Pants A Computer Blog True Hq2x Shader Comparison With xBR Filthy Pants External links edithq2x 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 Retrieved from https en wikipedia org w index php title Hqx amp oldid 1215857501, wikipedia, wiki, book, books, library,

article

, read, download, free, free download, mp3, video, mp4, 3gp, jpg, jpeg, gif, png, picture, music, song, movie, book, game, games.