5
0

Compare commits

...

1 Commits

Author SHA1 Message Date
974a11efb4
tanteidan: tv: 04 small deband scenefilter
not like it fucking matters because mpv's debander destroys it anyway
2021-05-07 13:36:16 -04:00
2 changed files with 12 additions and 2 deletions

View File

@ -5,11 +5,13 @@ from tanteidan_common import (PrettyConfig, PrettySource, antialias, deband,
wd_scenefilter) wd_scenefilter)
from yt_common.automation import SelfRunner from yt_common.automation import SelfRunner
from yt_common.denoise import bm3d
from yt_common.source import waka_replace from yt_common.source import waka_replace
from typing import List, Optional from typing import List, Optional
from lvsfunc.dehardsub import HardsubSign, HardsubSignFade, HardsubMask, bounded_dehardsub from lvsfunc.dehardsub import HardsubSign, HardsubSignFade, HardsubMask, bounded_dehardsub
from lvsfunc.misc import replace_ranges
from lvsfunc.types import Range from lvsfunc.types import Range
import os import os
@ -86,6 +88,11 @@ AA_NONE: List[Range] = TITLECARDS + [ # chapter 2 title cards are insanely deta
(20821, 21039), (20821, 21039),
] ]
STUPID_DENOISE: List[Range] = [
(11435, 11626),
(12026, 12115),
]
def filter_basic() -> vs.VideoNode: def filter_basic() -> vs.VideoNode:
wakas, ref = SOURCE.source() wakas, ref = SOURCE.source()
@ -94,6 +101,8 @@ def filter_basic() -> vs.VideoNode:
waka, wakas = waka_replace(waka, wakas[1:], WAKA_REPLACE) waka, wakas = waka_replace(waka, wakas[1:], WAKA_REPLACE)
src = bounded_dehardsub(waka, ref, SIGNS_RU, wakas) src = bounded_dehardsub(waka, ref, SIGNS_RU, wakas)
src.set_output(1) src.set_output(1)
core.ffms2.Source("./tanteidan_04_premux.mkv").set_output(2)
core.ffms2.Source("./tanteidan_04_premux_nopatch1.mkv").set_output(3)
return src return src
@ -101,6 +110,7 @@ def filter() -> vs.VideoNode:
src = filter_basic() src = filter_basic()
den = denoise(src) den = denoise(src)
deb = deband(den) deb = deband(den)
deb = replace_ranges(deb, bm3d(src, sigma=4, radius=1), STUPID_DENOISE)
aa = antialias(deb, stronger=AA_STRONGER, strong=AA_STRONG, weak=AA_WEAK, noaa=AA_NONE) aa = antialias(deb, stronger=AA_STRONGER, strong=AA_STRONG, weak=AA_WEAK, noaa=AA_NONE)
scenefilter = stupid_op_scenefilter(aa, deb, OP) scenefilter = stupid_op_scenefilter(aa, deb, OP)
if WELCOMING_DAYS is not None: if WELCOMING_DAYS is not None:

View File

@ -22,12 +22,12 @@ def bm3d(clip: vs.VideoNode, matrix_s: str = "709", sigma: Union[float, List[flo
def to_fullgray(clip: vs.VideoNode) -> vs.VideoNode: def to_fullgray(clip: vs.VideoNode) -> vs.VideoNode:
return get_y(clip).resize.Point(format=vs.GRAYS, range_in=Range.LIMITED, range=Range.FULL) return get_y(clip).resize.Point(format=vs.GRAYS, range_in=Range.LIMITED, range=Range.FULL)
sigmal = [sigma] * 3 if isinstance(sigma, float) else sigma + [sigma[-1]]*(3-len(sigma)) sigmal = [sigma] * 3 if not isinstance(sigma, list) else sigma + [sigma[-1]]*(3-len(sigma))
sigmal = [sigmal[0], 0, 0] if isGray else sigmal sigmal = [sigmal[0], 0, 0] if isGray else sigmal
isGray = True if sigmal[1] == 0 and sigmal[2] == 0 else isGray isGray = True if sigmal[1] == 0 and sigmal[2] == 0 else isGray
if len(sigmal) != 3: if len(sigmal) != 3:
raise ValueError("bm3d: 'invalid number of sigma parameters supplied'") raise ValueError("bm3d: 'invalid number of sigma parameters supplied'")
radiusl = [0, 0] if radius is None else [radius] * 2 if isinstance(radius, int) \ radiusl = [0, 0] if radius is None else [radius] * 2 if not isinstance(radius, list) \
else radius + [radius[-1]]*(2-len(radius)) else radius + [radius[-1]]*(2-len(radius))
if len(radiusl) != 2: if len(radiusl) != 2:
raise ValueError("bm3d: 'invalid number or radius parameters supplied'") raise ValueError("bm3d: 'invalid number or radius parameters supplied'")