SetMemoryMax(1024) NCED = LWLibavVideoSource("I:\[Encode-Ready]\Soredemo\NC-ED.m2ts").trim(24, 2181) LWLibavVideoSource("I:\[Encode-Ready]\Soredemo\Ep01.m2ts") Source = last Pre_Clip = Source.ColorYUV(autoGain=true, gamma_Y=100) # making the pre-clip ( for denoiser ) to calculate vectors from; a = 0.45 # The smaller, the greater the protection ( in this case no need to go down further than 0.45 ); sa = String (a) sd = String (Pow (219*256, 1 - 1.0/a)) LinesMask = mt_lutxy(source, source.mt_expand_rec(8).mt_inpand_rec(4), "y x - 4 - 128 *").removegrain(4).mt_expand_rec(3).removegrain_rec(3, 20) PanAA = mt_merge(QTGMC(inputType=1, EZDenoise=0, sharpness=0, thsad1=1000, thsad2=50), LinesMask, u=2, v=2) # Trying to fix temporal aliasing on pannings ReplaceFramesSimple(PanAA, mappings="[6820 7147]") #2 dfttestMC(pp=Pre_Clip, mc=2, sigma=1.25, search=5, lsb=true) # Denoise with 16-bit output ( prolly need to play around with sigma a bit ); Dither_lut16("x 4096 - 0 max "+sd+" / "+sa+" ^", y=3, u=2, v=2) # Direct; denoise = last GradFun3(debug=0, thr=0.3, thrC=0.6, radius=6, radiusC=12, elast=1.3, elastC=1.6, mask=2, thr_det=2, smode=1, lsb_in=true, lsb=true) # Debanding without additional masking ( with chroma being debanded more aggressively ); ######################################################### SCENE-FILTERING ######################################################### msk = Source.tcolormask("$1A140A", tolerance=28).removegrain_rec(2, 20) debandStrong = dither_merge16_8(last, denoise.GradFun3(debug=0, thr=0.8, thrC=1, radius=16, radiusC=16, elast=1.6, elastC=2, mask=2, thr_det=3, smode=1, lsb_in=true, lsb=true), msk, luma=true) ReplaceFramesSimple(debandStrong, mappings="[3932 3949] [4010 4045]") #1 ################################################################################################################################### Dither_lut16("x 1 "+sa+" / ^ "+sd+" * 4096 +", y=3, u=2, v=2) # Inverse; HiAA(lsb_in=true, aa="eedi3+sangnom2", sharp=true, cs_limit=false, cs_strength=120, lsb_out=true) # AA with contra-sharpening ( eedi3+sangnom ); DitherPost(mode=6, ampn=1, staticnoise=true) # Dithering to 8-bit output; fixed = last fixed trim(0, 30449)+Fix_ED(source, nced, fixed, start=30450, end=32607)+trim(32608, 0) function Fix_ED ( clip source, clip nc, clip fixed_nc, int "start", int "end" ) { source = source.trim(start, end) diff_less = mt_lutxy(source, nc, "x y -", u=3, v=3) diff_more = mt_lutxy(source, nc, "y x -", u=3, v=3) diff_mask = diff_less.mt_lutxy(diff_more, "x 1 - y 1 - max 15 *", u=3, v=3).mt_inflate(u=3, v=3) mt_merge(fixed_nc.trim(start, end), nc, diff_mask, u=3, v=3).mt_lutxy(diff_less, "x y +", u=3, v=3).mt_lutxy(diff_more, "x y -", u=3, v=3) #~ average(source, 1, nc, -1, fixed_nc, 1) }