Advertisement
alaestor

[mpv] autoshader.lua

Dec 14th, 2023
696
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.36 KB | None | 0 0
  1. function autoshader()
  2.     local height = tonumber(mp.get_property("height"))
  3.     if height >= 720 then -- Anime4K mode A (HQ)
  4.         print("Vertical resolution of", height, "(>= 720): Loading Anime4K mode A.")
  5.         mp.commandv("set", "glsl-shaders", "~~/shaders/Anime4K_Clamp_Highlights.glsl;~~/shaders/Anime4K_Restore_CNN_VL.glsl;~~/shaders/Anime4K_Upscale_CNN_x2_VL.glsl;~~/shaders/Anime4K_AutoDownscalePre_x2.glsl;~~/shaders/Anime4K_AutoDownscalePre_x4.glsl;~~/shaders/Anime4K_Upscale_CNN_x2_M.glsl")
  6.     elseif height >= 480 then --Anime4K mode B
  7.         print("Vertical resolution of", height, "(>= 480): Loading Anime4K mode B.")
  8.         mp.commandv("set", "glsl-shaders", "~~/shaders/Anime4K_Clamp_Highlights.glsl;~~/shaders/Anime4K_Restore_CNN_Soft_VL.glsl;~~/shaders/Anime4K_Upscale_CNN_x2_VL.glsl;~~/shaders/Anime4K_AutoDownscalePre_x2.glsl;~~/shaders/Anime4K_AutoDownscalePre_x4.glsl;~~/shaders/Anime4K_Upscale_CNN_x2_M.glsl")
  9.     else --Anime4K mode C
  10.         print("Vertical resolution of", height, "(< 480): Loading Anime4K mode C.")
  11.         mp.commandv("set", "glsl-shaders", "~~/shaders/Anime4K_Clamp_Highlights.glsl;~~/shaders/Anime4K_Upscale_Denoise_CNN_x2_VL.glsl;~~/shaders/Anime4K_AutoDownscalePre_x2.glsl;~~/shaders/Anime4K_AutoDownscalePre_x4.glsl;~~/shaders/Anime4K_Upscale_CNN_x2_M.glsl")
  12.     end
  13. end
  14.  
  15. mp.add_key_binding(nil, "autoshader", autoshader)
  16. mp.register_event("file-loaded", autoshader)
  17.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement