|
| 1 | +from vapoursynth import core, VideoNode, GRAY, YUV, GRAY8, GRAYS |
| 2 | +import atomchtools as atf |
| 3 | +import fvsfunc as fvf |
| 4 | +import kagefunc as kg |
| 5 | +import havsfunc |
| 6 | +import mvsfunc as mvf |
| 7 | +import GradFun3 as gfa |
| 8 | +import insaneAA |
| 9 | + |
| 10 | +import cooldegrain |
| 11 | +import finedehalo as fd |
| 12 | +import HardAAp2 as hiaa |
| 13 | +import descale as dsc |
| 14 | +import psutil |
| 15 | +import regress |
| 16 | + |
| 17 | +p_handle = psutil.Process() |
| 18 | +p_handle.cpu_affinity([0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46]) |
| 19 | +core.num_threads = 24 |
| 20 | + |
| 21 | +def BokugaAishitaSubetenoKimie_denoise_deband(clip): |
| 22 | + clip16 = core.fmtc.bitdepth(clip, bits=16) |
| 23 | + clip_y = mvf.GetPlane(clip16, 0) |
| 24 | + pf = core.dfttest.DFTTest(clip_y, sigma=2, tbsize=3, opt=3) |
| 25 | + pf2 = core.dfttest.DFTTest(clip16, sigma=1, tbsize=3, opt=3, planes=[1,2]) |
| 26 | + den_y = cooldegrain.CoolDegrain(clip_y, tr=1, thsad=22, thsadc=0, bits=16, blksize=8, overlap=4, pf=pf) |
| 27 | + filtered = core.std.ShufflePlanes([den_y, clip16, clip16], [0,1,2], colorfamily=clip16.format.color_family) |
| 28 | + filtered = cooldegrain.CoolDegrain(filtered, tr=1, thsad=0, thsadc=18, bits=16, blksize=8, overlap=4, pf=pf2) |
| 29 | + db = core.placebo.Deband(filtered, planes = 1, threshold = 3.0, grain = 6, radius = 16) |
| 30 | + Mask = atf.retinex_edgemask(clip16, sigma=0.1, draft=False) |
| 31 | + Mask2 = core.std.Binarize(Mask, 9828,0) |
| 32 | + filtered1 = core.std.MaskedMerge(db, clip16, Mask2, planes=[0,1,2], first_plane=True) |
| 33 | + filtered2 = core.grain.Add(filtered1, var=0.2, uvar=0.2) |
| 34 | + filtered3 = core.std.ShufflePlanes([filtered2, filtered1, filtered1],[0,1,2], YUV) |
| 35 | + denoise_deband = core.fmtc.bitdepth(filtered3, bits=10) |
| 36 | + return denoise_deband |
| 37 | + |
| 38 | +core.max_cache_size = 120000 |
| 39 | +episode = core.dgdecodenv.DGSource(r'00009.dgi') |
| 40 | +denoise_deband = BokugaAishitaSubetenoKimie_denoise_deband(episode) |
| 41 | +denoise_deband.set_output() |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | + |
0 commit comments