Skip to content

Commit 0509dec

Browse files
committed
vs: 新增 ivtc_std
附带修正 nlmeans
1 parent f145006 commit 0509dec

File tree

3 files changed

+63
-23
lines changed

3 files changed

+63
-23
lines changed

portable_config/vs/ivtc_std.vpy

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
### 伪25或30帧的源转24帧
2+
3+
import vapoursynth as vs
4+
from vapoursynth import core
5+
6+
input = video_in
7+
fps_in = container_fps
8+
9+
############
10+
# 用户选项 #
11+
############
12+
13+
Ivtc_core = 1
14+
## <1|2> ivtc模式
15+
16+
if fps_in < 24.5 or fps_in > 32 :
17+
raise Exception("非限定源,已临时禁用该脚本。")
18+
19+
if Ivtc_core == 1 :
20+
if fps_in > 24 and fps_in < 26 :
21+
output = core.vivtc.VDecimate(clip=input, cycle=25)
22+
elif fps_in > 29 and fps_in < 31 :
23+
output = core.vivtc.VDecimate(clip=input, cycle=5)
24+
elif Ivtc_core == 2 :
25+
cut0 = core.std.AssumeFPS(clip=input, fpsnum=fps_in * 1000, fpsden=1000)
26+
cut1 = core.tivtc.TDecimate(clip=cut0, mode=7, rate=24 / 1.001)
27+
output = core.std.AssumeFPS(clip=cut1, fpsnum=24000, fpsden=1001)
28+
29+
output.set_output()

portable_config/vs/nlmeans_cuda.vpy

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Blur_mode = 2
1515
Frame_num = 1
1616
Radius_sw = 2
1717
Radius_snw = 2
18-
Strength = 3
18+
Strength = 3.0
1919
GPU = 0
2020
GPU_t = 2
2121
## <0|1|2> 分离模式。0为不使用
@@ -42,11 +42,11 @@ elif Blur_mode == 2 :
4242
if Blur_mode :
4343
diff = core.std.MakeDiff(clipa=cut0, clipb=blur)
4444
cut1 = core.nlm_cuda.NLMeans(clip=diff, d=Frame_num, a=Radius_sw, s=Radius_snw, h=Strength,
45-
channels="AUTO", wmode=2, wref=1, rclip=None, device_id=GPU, num_streams=GPU_t)
45+
channels="AUTO", wmode=2, wref=1.0, rclip=None, device_id=GPU, num_streams=GPU_t)
4646
merge = core.std.MergeDiff(clipa=blur, clipb=cut1)
4747
else :
4848
cut1 = core.nlm_cuda.NLMeans(clip=blur, d=Frame_num, a=Radius_sw, s=Radius_snw, h=Strength,
49-
channels="AUTO", wmode=2, wref=1, rclip=None, device_id=GPU, num_streams=GPU_t)
49+
channels="AUTO", wmode=2, wref=1.0, rclip=None, device_id=GPU, num_streams=GPU_t)
5050

5151
output = core.resize.Bilinear(clip=merge if Blur_mode else cut1, format=fmt_in)
5252

portable_config/vs/nlmeans_std.vpy

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ Nlm_core = 1
1616
Frame_num = 1
1717
Radius_sw = 2
1818
Radius_snw = 2
19-
Strength = 3
19+
Strength = 3.0
2020
GPU = 0
21-
## 分离模式 1=RemoveGrain // 2=Convolution
21+
## <0|1|2> 分离模式。0为不使用
2222
## 降噪核心 1=OpenCL // 2=cpu
2323
## 降噪帧数(整数)
2424
## 搜索窗口半径(整数)
@@ -28,23 +28,34 @@ GPU = 0
2828

2929
cut0 = core.resize.Bilinear(clip=input, format=vs.YUV444P16)
3030

31-
if Blur_mode == 1 :
32-
blur1 = core.rgvs.RemoveGrain(clip=cut0, mode=20)
33-
blur2 = core.rgvs.RemoveGrain(clip=blur1, mode=20)
34-
blur3 = core.rgvs.RemoveGrain(clip=blur2, mode=20)
35-
if Blur_mode == 2 :
36-
blur1 = core.std.Convolution(clip=cut0, matrix=[1, 1, 1, 1, 1, 1, 1, 1, 1])
37-
blur2 = core.std.Convolution(clip=blur1, matrix=[1, 1, 1, 1, 1, 1, 1, 1, 1])
38-
blur3 = core.std.Convolution(clip=blur2, matrix=[1, 1, 1, 1, 1, 1, 1, 1, 1])
39-
40-
diff = core.std.MakeDiff(clipa=cut0, clipb=blur3)
41-
42-
if Nlm_core == 1 :
43-
cut1 = core.knlm.KNLMeansCL(clip=diff, d=Frame_num, a=Radius_sw, s=Radius_snw, h=Strength, wmode=2, device_type="GPU", device_id=GPU)
44-
if Nlm_core == 2 :
45-
cut1 = core.nlm_ispc.NLMeans(clip=diff, d=Frame_num, a=Radius_sw, s=Radius_snw, h=Strength, wmode=2)
46-
47-
merge = core.std.MergeDiff(clipa=blur3, clipb=cut1)
48-
output = core.resize.Bilinear(clip=merge, format=fmt_in)
31+
if Blur_mode == 0 :
32+
blur = cut0
33+
elif Blur_mode == 1 :
34+
blur = core.rgvs.RemoveGrain(clip=cut0, mode=20)
35+
blur = core.rgvs.RemoveGrain(clip=blur, mode=20)
36+
blur = core.rgvs.RemoveGrain(clip=blur, mode=20)
37+
elif Blur_mode == 2 :
38+
blur = core.std.Convolution(clip=cut0, matrix=[1, 1, 1, 1, 1, 1, 1, 1, 1])
39+
blur = core.std.Convolution(clip=blur, matrix=[1, 1, 1, 1, 1, 1, 1, 1, 1])
40+
blur = core.std.Convolution(clip=blur, matrix=[1, 1, 1, 1, 1, 1, 1, 1, 1])
41+
42+
if Blur_mode :
43+
diff = core.std.MakeDiff(clipa=cut0, clipb=blur)
44+
if Nlm_core == 1 :
45+
cut1 = core.knlm.KNLMeansCL(clip=diff, d=Frame_num, a=Radius_sw, s=Radius_snw, h=Strength,
46+
channels="auto", wmode=2, wref=1.0, rclip=None, device_type="GPU", device_id=GPU)
47+
elif Nlm_core == 2 :
48+
cut1 = core.nlm_ispc.NLMeans(clip=diff, d=Frame_num, a=Radius_sw, s=Radius_snw, h=Strength,
49+
channels="AUTO", wmode=2, wref=1.0, rclip=None)
50+
merge = core.std.MergeDiff(clipa=blur, clipb=cut1)
51+
else :
52+
if Nlm_core == 1 :
53+
cut1 = core.knlm.KNLMeansCL(clip=blur, d=Frame_num, a=Radius_sw, s=Radius_snw, h=Strength,
54+
channels="auto", wmode=2, wref=1.0, rclip=None, device_type="GPU", device_id=GPU)
55+
elif Nlm_core == 2 :
56+
cut1 = core.nlm_ispc.NLMeans(clip=blur, d=Frame_num, a=Radius_sw, s=Radius_snw, h=Strength,
57+
channels="AUTO", wmode=2, wref=1.0, rclip=None)
58+
59+
output = core.resize.Bilinear(clip=merge if Blur_mode else cut1, format=fmt_in)
4960

5061
output.set_output()

0 commit comments

Comments
 (0)