Skip to content

Upscale Shaders

bloc97 edited this page Jul 21, 2020 · 26 revisions

Example (Original / Processed)

Files

Anime4K_Upscale_CNN_M_x2.glsl
Anime4K_Upscale_CNN_L_x2.glsl
Anime4K_Upscale_CNN_UL_x2.glsl
Anime4K_Upscale_DTD_x2.glsl
Anime4K_Upscale_DoG_x2.glsl
Anime4K_Upscale_Original_x2.glsl

Description

Performs super-resolution. Doubles image size with the expectation that the low resolution image is artifact-free. (I.e. No noise, blur or any other degradation.) Different variants of upscaling shaders can be stacked for x4 or even x8 upscaling.

The recommended version to use for videos smaller than 1080p is Anime4K_Upscale_CNN_L_x2.glsl for mid/high end GPUs and Anime4K_Upscale_CNN_M_x2.glsl for less powerful GPUs. Only use Anime4K_Upscale_CNN_UL_x2.glsl if you have a very high end GPU like Vega 64 or RTX 2080.

An alternative for 1080p media can be Anime4K_Upscale_DTD_x2.glsl. This shader is less accurate than CNN variants, but provides higher perceptual quality. CNN shaders can be excessive and borderline useless when used on 1080p anime, except when the anime has significant sub-pixel detail, such as some modern feature film animations.

Related shaders

Upscale+Deblur Shaders
Upscale+Denoise Shaders
DTD Shader

Special considerations

Any degradation remaining on the image will be amplified. It is better to use other shaders first to reduce noise or blur.

CNN_M and CNN_L variants also introduces small amounts of checkerboard artifacts due to the pixelshuffle layer and the low parameter count. This is usually unnoticeable under live conditions.

As this shader doubles the image size and quadruples the number of pixels, other shaders placed after this will be at least 4x slower than if it were to be placed before.

Anime4K_Auto_Downscale_Pre_x4.glsl can be used between the first pass and the second pass of upscaling for 1440p/4K monitors. This shader downscales the intermediate image so that the second upscaling pass does not upscale beyond your screen size and waste processing power.

mpv does not support activating the same shader twice. It is recommended to use different variants for larger upscales, with the slowest/highest quality variant running first. Copying and renaming the shader works, but due to an unknown cause, the shaders will run significantly slower. Thus it is highly recommended to use different variants.

As higher resolution anime (E.g. 1080p) have less sub-pixel detail, it is possible to use low quality variants such as Anime4K_Upscale_DoG_x2.glsl and Anime4K_Upscale_Original_x2.glsl for better speed without compromising much quality. The CNN upscalers are best at upscaling sub-pixel detail, and they are usually overkill for 1080p->4K upscaling, especially if a previous upscaling pass was used (eg. 720p->1080p then 1080p->4K). Anime4K_Upscale_DTD_x2.glsl can also be a good alternative if you prefer thinner and higher contrast lines.

Clone this wiki locally