-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomb_pipe.py
52 lines (40 loc) · 1.66 KB
/
comb_pipe.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import sys
from ldzeug2.comb_consts import CombConsts
from ldzeug2.stdinsrc import streaming_out,ldproject_pipe
from ldzeug2.colordecoder import combyc_field_model,comb_color_cnn
from vstools import core, initialize_clip,vs,set_output,scale_value
from ldzeug2.utils import get_model_path
framesp,project = ldproject_pipe(sys.argv[1])
crpable = project.project["videoParameters"]["activeVideoStart"]
# I think this was for inference needs to be mod 4?
crpable_m4 = crpable % 4
crpable -= crpable_m4
import os
if "DEROT" in os.environ:
network_path = get_model_path("color_cnn_v2_derot.onnx")
else:
network_path = None
if "NTSC" in os.environ:
consts=CombConsts(False)
else:
consts=CombConsts(True)
if "TBC_BP" in os.environ:
from ldzeug2.colordecoder import *
from ldzeug2.colordecoder import *
import scipy.signal as sp
sm = StackableManager()
fltrr = sp.firwin(127,[4.5,5],fs=(315/88)*4,pass_zero="bandstop")
f2 = fltr_to_expr(sm.add_clip(framesp), fltrr)
framesp = sm.eval_v(f2)
framesp = framesp.std.Crop(crpable, project.project["videoParameters"]["fieldWidth"] - project.project["videoParameters"]["activeVideoEnd"], 40, 0)
#framesp = combyc_field_model(framesp)
framesp = comb_color_cnn(framesp,v2=False,network_path=network_path,consts=consts)
#import vsdenoise
#framesp = vsdenoise.MVTools(framesp).denoise(framesp)
#fldsp = framesp.std.SeparateFields()
#import vsdenoise
#framesp = vsdenoise.MVTools(fldsp).denoise(fldsp).std.DoubleWeave()[::2]
framesp = framesp.std.Crop(left=crpable_m4)
outnode = framesp.resize.Bicubic(format=vs.YUV444P16)
assert (outnode.width,outnode.height) == (760,486)
streaming_out(sys.stdout.buffer, outnode)