bloc97 / Anime4K

A High-Quality Real Time Upscaler for Anime Video
https://bloc97.github.io/Anime4K/
MIT License
18.3k stars 1.35k forks source link

[Question] AutoDownscalePre purpose #154

Closed Katzenwerfer closed 2 years ago

Katzenwerfer commented 2 years ago

What exactly does the AutoDownscalePre shaders do? Do they downscale the image in any set resolution? (even if the viewport res is native to the media) Is it comparable to SSimDownscaler in any way?

hooke007 commented 2 years ago

just a simple way to avoid the final upscaling beyond the target res.

https://github.com/bloc97/Anime4K/blob/e6c0064069f15d3a772ca00d8ea0c51a6522cbe0/glsl/Upscale/Anime4K_AutoDownscalePre_x4.glsl#L30-L31

bloc97 commented 2 years ago

For AutoDownscalePre_x4, it downscales the image to half the screen resolution if necessary (resolution after upscaling is larger). For AutoDownscalePre_x2, it downscales the image to the screen resolution if necessary.

Katzenwerfer commented 2 years ago

So if I understand correctly, those would only apply if those conditions are met, respectively

bloc97 commented 2 years ago

Yes, and they only downscale to either half the screen resolution or to the screen resolution when the condition is met. Most of the time, those two shaders do nothing, but for example, 720p on a 4K screen would go like this: 720p -> x2 upscale -> 1440p -> AutoDownscalePre_x4 -> 1080p -> x2 upscale -> 2160p

Without AutoDownscalePre_x4, it would be: 720p -> x2 upscale -> 1440p -> x2 upscale -> 2880p -> mpv downscale -> 2160p

Most GPUs would not be able to handle 1440p -> 2880p upscaling, and if you put shaders after upscaling, working on 2880p images (5120x2880) is 1.7x slower than 4K (3840x2160) and has almost no benefit in visual quality when viewed from a reasonable distance.