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

Large CPU hit after 1200p resize #134

Closed BlackPowerade closed 3 years ago

BlackPowerade commented 3 years ago

Describe the bug

Resizing the player window beyond ~1200h results in a massive CPU utilization spike with Anime4K enabled.

To Reproduce

Steps to reproduce the behavior:

  1. Load up 480p video
  2. Enable Anime4K
  3. Resize player beyond ~1200h

Expected behavior

Non-massive performance hit

Screenshots

Below Breakpoint:

general information below breakpoint Shaders below breakpoint system stats below breakpoint

Above Breakpoint:

general information above breakpoint shaders beyond breakpoint system stats above breakpoint

Desktop:

Additional context

From what I can tell this appears to be a copyback issue, as switching from nvdec-copy to nvdec significantly alleviated the problem. Not enough to fix it, still too much frame dropping. This issue is present on all renderers, with the same similar results where the non-copy version performs much better. I am not entirely sure where the breakpoint is, I could not get mpv to tell me the current window size. Best I can surmise is somewhere upwards of 1180ish. This looks like it may be related to https://github.com/mpv-player/mpv/issues/8613 and https://github.com/bloc97/Anime4K/issues/119

Current mpv.conf is as follows:

input-default-bindings = no
input-ar-delay = 500
input-ar-rate = 20
keep-open = yes
keep-open-pause = no
osd-duration = 2000
script-opts = osc-scalewindowed=1.5,osc-hidetimeout=2000,console-scale=1
screenshot-directory = '~~desktop/'
hwdec = nvdec-copy
# Editor
scale = spline36
screenshot-format = png
save-position-on-quit = yes
cscale = spline36
dscale = spline36
osd-playing-msg = '${display-width}'

[protocol.https]
osd-playing-msg = '${media-title}'
bloc97 commented 3 years ago

The mpv version might be too old. The latest Anime4K shaders will not work for versions previous to this update: https://github.com/mpv-player/mpv/commit/474ee003eddd278d871e7c1c760091b739880e8f

Try the latest nightly windows builds, they should not have this issue anymore.

BlackPowerade commented 3 years ago

Yep, that fixed it. Thanks for the quick response.