Giter Site home page Giter Site logo

slanterns-fork / anime4k Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bloc97/anime4k

0.0 2.0 0.0 520.01 MB

A High-Quality Real Time Upscaler for Anime Video

License: MIT License

HLSL 14.20% Java 20.63% GLSL 45.71% HTML 1.15% CSS 0.14% JavaScript 17.95% Batchfile 0.14% Shell 0.09%

anime4k's Introduction

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 4K upscaling category, the fastest at achieving 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

Notice

We understand that this algorithm is far from perfect, and are working towards a hybrid approach (using Machine Learning) to improve Anime4K.

The greatest difficulties encountered right now are caused by these issues that other media does not suffer from:

  • Lack of ground truth (No True 4K Anime)
  • Few true 1080p anime (Even some anime mastered at 1080p have sprites that were downsampled)
  • Non-1080p anime are upsampled to 1080p using simple algorithms, resulting in a blurry 1080p image. Our algorithm has to detect this. (Main reason why waifu2x does not work well on anime)
  • UV channels of anime are subsampled (4:2:0), which means the color channels of 1080p anime are in fact 540p, thus there is a lack of 1080p ground truth for the UV channels.
  • Simulating H.264/H.265 compression artifacts (for analysis and denoising) is not trivial and is relatively time-consuming.
  • Due to the workflow of animation studios and their lack of time/budget, resampling artifacts of individual sprites are present in many modern anime.
  • Speed (preferably real-time) is paramount, since we do not want to re-encode video each time the algorithm improves. There is also less risk of permanently altering original content.
  • So on...

However, we still believe by shrinking the size of VDSR or FSRCNN and using an hybrid approach we can achieve good results.
Stay tuned for more info!

v1.0 Release Candidate 2

Improved speed.

Performance is back on par with v0.9 Beta, with only insignificant loss in quality compared to v1.0 RC1. (3ms on RX Vega 64)

Two more versions are included for less powerful GPUs.

  • Anime4K_Fast (1.5ms)
  • Anime4K_UltraFast (1ms) (For potato PCs)

ComparisonRC Please view in full size on a 4K display for a correct 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

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

HLSL Usage Instructions (MPC-BE with madVR)

This implementation is only for Windows.

This implementation is also outdated, the latest version is developped on GLSL.

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

Java Usage Instructions (Standalone)

This implementation is outdated, the latest version is developped on GLSL.

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

Projects that use Anime4K

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]).

How does it actually actually work?

There's an excellent write-up by shi-yan that describes the (original v0.9) algorithm in detail (in fact better than in the preprint), with interactive sliders. See for yourself! https://epiphany.pub/@shi-yan/anime4k

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 than <x>

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.

Note for those who think this is not a 'upscaling' algorithm.

Explanation

TL;DR

Sharpening, De-Blurring and Super-Resolution are equivalent.
Anime4K can de-blur, and is equivalent to a SR algorithm.
A Super-Resolution algorithm can do upscaling.
Thus, Anime4K is an upscaling algorithm.

anime4k's People

Contributors

azhao12345 avatar bloc97 avatar bradybromley avatar dextrosere avatar greywing3 avatar importtaste avatar k4yt3x avatar lukad avatar mrstandu33 avatar neurowhai avatar piroton avatar rjworks avatar slagrave avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.