Last active
July 14, 2023 00:58
-
-
Save hooke007/4f2e6f91d0a3f4a6515ee4e54fab375c to your computer and use it in GitHub Desktop.
[mpv-filter_vapoursynth] 图像放大
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Real-CUGAN 放大 | |
### 依赖: https://github.com/Kiyamou/VapourSynth-RealCUGAN-ncnn-Vulkan/releases/tag/r2 | |
import vapoursynth as vs | |
from vapoursynth import core | |
input = video_in | |
colorlv = input.get_frame(0).props._ColorRange | |
denoise_lv = -1 | |
scale_model = 2 | |
GPU = 0 | |
GPU_t = 2 | |
# 降噪强度 -1=不降噪 // 0 // 1 // 2 // 3 | |
# 放大模型 0=nose // 1=se // 2=pro | |
# 指定加速的显卡 | |
# 显卡使用的线程 | |
if input.width > 2560 and input.height > 2560 : | |
raise Warning("源分辨率超过限制的范围,已临时禁用该脚本。") | |
cut1 = input.resize.Bilinear(format=vs.RGBS, matrix_in_s="709") | |
cut2 = core.rcnv.RealCUGAN(clip=cut1, scale=2, noise=denoise_lv, model=scale_model, syncgap=0, gpu_id=GPU, gpu_thread=GPU_t) | |
output = cut2.resize.Bilinear(format=vs.YUV444P16, matrix_s="709", range=1 if colorlv==0 else None) | |
output.set_output() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment