Skip to content
/ Anime4K Public
forked from bloc97/Anime4K

A High-Quality Real Time Upscaler for Anime Video

License

Notifications You must be signed in to change notification settings

siknet/Anime4K

 
 

Repository files navigation

Anime4K

Anime4K is a state-of-the-art*, open-source, high-quality real-time anime upscaling algorithm that can be implemented in any programming language.

Thumbnail Image

State of the art* as of August 2019 in the real time anime upscaling category, the fastest at acheiving reasonable quality. We do not claim this is a superior quality general purpose SISR algorithm compared to machine learning approaches.

Disclaimer: All art assets used are for demonstration and educational purposes. All rights are reserved to their original owners. If you (as a person or a company) own the art and do not wish it to be associated with this project, please contact us at [email protected] and we will gladly take it down.

Comparison

v1.0 Release Candidate

Reduced texture loss, aliasing and banding in Anime4K v1.0 RC at the cost of performance. It now takes 6ms. +2ms for line detection and +1ms for line targeted FXAA.

What's new:

  • A line detection algorithm.
  • Gradient maximization is only applied near lines using the line detector, instead of indiscriminately affecting the entire image. This has the effect of ignoring textures and out of focus elements.
  • Finally, one iteration of targeted FXAA is applied on the lines using the line detector to reduce aliasing.

ComparisonRC ComparisonRC ComparisonRC ComparisonRC

HLSL Usage Instructions (MPC-BE with madVR)

This implementation is only for Windows.

Note for developers: For performance, the HLSL shaders use the Alpha channel to store the gradient, you might need to make a backup of the the alpha channel before applying these shaders and restore it after if your rendering engine uses the alpha channel for other purposes. (In MPC-BE's case, it gets ignored.)

GLSL Usage Instructions (MPV)

This implementation is cross platform.

Note for developers: For performance, the GLSL shaders use the POSTKERNEL texture to store the gradient, you might need to make a backup of the the POSTKERNEL texture before applying these shaders and restore it after if your other shaders or rendering engine uses the POSTKERNEL texture for other purposes. (In MPV's case, it gets ignored.)

Java Usage Instructions (Standalone)

Click on the link above to read Java version installation and usage instructions.

Pseudo-Preprint Preview

B. Peng
August 2019

Ad perpetuam memoriam of all who perished in the Kyoto Animation arson attack.

Table of Contents

Abstract

We present a state-of-the-art high-quality real-time SISR algorithm designed to work with japanese animation and cartoons that is extremely fast (~3ms with Vega 64 GPU), temporally coherent, simple to implement (~100 lines of code), yet very effective. We find it surprising that this method is not currently used 'en masse', since the intuition leading us to this algorithm is very straightforward.
Remarkably, the proposed method does not use any machine-learning or statistical approach, and is tailored to content that puts importance to well defined lines/edges while tolerates a sacrifice of the finer textures. The proposed algorithm can be quickly described as an iterative algorithm that treats color information as a heightmap and 'pushes' pixels towards probable edges using gradient-ascent. This is very likely what learning-based approaches are already doing under the hood (eg. VDSR[1], waifu2x[2]).

FAQ

Why not just use waifu2x

waifu2x is too slow for real time applications.

Why not just use madVR with NGU

NGU is proprietary, this algorithm is licensed under MIT.

How does FSRCNNX compare to this

Since it performs poorly (perceptually, for anime) compared to other algorithms, it was left out of our visual comparisons.

ComparisonRC

Note: FSRCNNX was not specifically trained/designed for anime. It is however a good general-purpose SISR algorithm for video.

Where are the PSNR/SSIM metrics

There are no ground truths of 4K anime.

Why not do PSNR/SSIM on 480p->720p upscaling

Story Time

Comparing PSNR/SSIM on 480p->720p upscales does not prove and is not a good indicator of 1080p->2160p upscaling quality. (Eg. poor performance of waifu2x on 1080p anime) 480p anime images have a lot of high frequency information (lines might be thinner than 1 pixel), while 1080p anime images have a lot of redundant information. 1080p->2160p upscaling on anime is thus objectively easier than 480p->720p.

I think the results are worse

Surely some people like sharper edges, some like softer ones. Do try it yourself on a few anime before reaching a definite conclusion. People tend to prefer sharper edges. Also, seeing the comparisons on a 1080p screen is not representative of the final results on a 4K screen, the pixel density and sharpness of the final image is simply not comparable.

About

A High-Quality Real Time Upscaler for Anime Video

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 28.1%
  • GLSL 26.4%
  • JavaScript 24.4%
  • HLSL 19.3%
  • HTML 1.6%
  • CSS 0.2%