pripri: bd: all hail the debander
This commit is contained in:
parent
92b1b98219
commit
53aa19530f
@ -1,6 +1,6 @@
|
||||
import vapoursynth as vs
|
||||
|
||||
from pripri_common import PriPriConfig, edgefix, denoise, descale, antialias, regrain, scenefilter_ed, finalize
|
||||
from pripri_common import PriPriConfig, edgefix, denoise, descale, deband, antialias, regrain, scenefilter_ed, finalize
|
||||
|
||||
from yt_common.automation import SelfRunner
|
||||
from yt_common.source import FileTrim, SimpleSource
|
||||
@ -26,7 +26,8 @@ def filter() -> vs.VideoNode:
|
||||
ef = edgefix(src)
|
||||
den = denoise(ef)
|
||||
rescale = descale(den)
|
||||
aa = antialias(rescale)
|
||||
deb = deband(rescale)
|
||||
aa = antialias(deb)
|
||||
grain = regrain(aa)
|
||||
ed = scenefilter_ed(grain, src, ED)
|
||||
final = finalize(ed)
|
||||
|
@ -1,6 +1,6 @@
|
||||
import vapoursynth as vs
|
||||
|
||||
from pripri_common import PriPriConfig, edgefix, denoise, descale, antialias, regrain, scenefilter_ed, finalize
|
||||
from pripri_common import PriPriConfig, edgefix, denoise, descale, deband, antialias, regrain, scenefilter_ed, finalize
|
||||
|
||||
from yt_common.automation import SelfRunner
|
||||
from yt_common.source import FileTrim, SimpleSource
|
||||
@ -26,7 +26,8 @@ def filter() -> vs.VideoNode:
|
||||
ef = edgefix(src)
|
||||
den = denoise(ef)
|
||||
rescale = descale(den)
|
||||
aa = antialias(rescale)
|
||||
deb = deband(rescale)
|
||||
aa = antialias(deb)
|
||||
grain = regrain(aa)
|
||||
ed = scenefilter_ed(grain, src, ED)
|
||||
final = finalize(ed)
|
||||
|
@ -1,6 +1,6 @@
|
||||
import vapoursynth as vs
|
||||
|
||||
from pripri_common import PriPriConfig, edgefix, denoise, descale, antialias, regrain, scenefilter_ed, finalize
|
||||
from pripri_common import PriPriConfig, edgefix, denoise, descale, deband, antialias, regrain, scenefilter_ed, finalize
|
||||
|
||||
from yt_common.automation import SelfRunner
|
||||
from yt_common.source import FileTrim, SimpleSource
|
||||
@ -26,7 +26,8 @@ def filter() -> vs.VideoNode:
|
||||
ef = edgefix(src)
|
||||
den = denoise(ef)
|
||||
rescale = descale(den)
|
||||
aa = antialias(rescale)
|
||||
deb = deband(rescale)
|
||||
aa = antialias(deb)
|
||||
grain = regrain(aa)
|
||||
ed = scenefilter_ed(grain, src, ED)
|
||||
final = finalize(ed)
|
||||
|
@ -1,6 +1,6 @@
|
||||
import vapoursynth as vs
|
||||
|
||||
from pripri_common import PriPriConfig, edgefix, denoise, descale, antialias, regrain, scenefilter_ed, finalize
|
||||
from pripri_common import PriPriConfig, edgefix, denoise, descale, deband, antialias, regrain, scenefilter_ed, finalize
|
||||
|
||||
from yt_common.automation import SelfRunner
|
||||
from yt_common.source import FileTrim, SimpleSource
|
||||
@ -26,7 +26,8 @@ def filter() -> vs.VideoNode:
|
||||
ef = edgefix(src)
|
||||
den = denoise(ef)
|
||||
rescale = descale(den)
|
||||
aa = antialias(rescale)
|
||||
deb = deband(rescale)
|
||||
aa = antialias(deb)
|
||||
grain = regrain(aa)
|
||||
ed = scenefilter_ed(grain, src, ED)
|
||||
final = finalize(ed)
|
||||
|
@ -1,6 +1,6 @@
|
||||
import vapoursynth as vs
|
||||
|
||||
from pripri_common import PriPriConfig, edgefix, denoise, descale, antialias, regrain, scenefilter_ed, finalize
|
||||
from pripri_common import PriPriConfig, edgefix, denoise, descale, deband, antialias, regrain, scenefilter_ed, finalize
|
||||
|
||||
from yt_common.automation import SelfRunner
|
||||
from yt_common.source import FileTrim, SimpleSource
|
||||
@ -26,7 +26,8 @@ def filter() -> vs.VideoNode:
|
||||
ef = edgefix(src)
|
||||
den = denoise(ef)
|
||||
rescale = descale(den)
|
||||
aa = antialias(rescale)
|
||||
deb = deband(rescale)
|
||||
aa = antialias(deb)
|
||||
grain = regrain(aa)
|
||||
ed = scenefilter_ed(grain, src, ED)
|
||||
final = finalize(ed)
|
||||
|
@ -1,6 +1,6 @@
|
||||
import vapoursynth as vs
|
||||
|
||||
from pripri_common import PriPriConfig, edgefix, denoise, descale, antialias, regrain, scenefilter_ed, finalize
|
||||
from pripri_common import PriPriConfig, edgefix, denoise, descale, deband, antialias, regrain, scenefilter_ed, finalize
|
||||
|
||||
from yt_common.automation import SelfRunner
|
||||
from yt_common.source import FileTrim, SimpleSource
|
||||
@ -26,7 +26,8 @@ def filter() -> vs.VideoNode:
|
||||
ef = edgefix(src)
|
||||
den = denoise(ef)
|
||||
rescale = descale(den)
|
||||
aa = antialias(rescale)
|
||||
deb = deband(rescale)
|
||||
aa = antialias(deb)
|
||||
grain = regrain(aa)
|
||||
ed = scenefilter_ed(grain, src, ED)
|
||||
final = finalize(ed)
|
||||
|
@ -1,6 +1,6 @@
|
||||
import vapoursynth as vs
|
||||
|
||||
from pripri_common import PriPriConfig, edgefix, denoise, descale, antialias, regrain, scenefilter_ed, finalize
|
||||
from pripri_common import PriPriConfig, edgefix, denoise, descale, deband, antialias, regrain, scenefilter_ed, finalize
|
||||
|
||||
from yt_common.automation import SelfRunner
|
||||
from yt_common.source import FileTrim, SimpleSource
|
||||
@ -30,7 +30,8 @@ def filter() -> vs.VideoNode:
|
||||
rescale = descale(den)
|
||||
rescalem = descale(den, mask=True)
|
||||
rescale = replace_ranges(rescale, rescalem, [(31722, 34767)])
|
||||
aa = antialias(rescale)
|
||||
deb = deband(rescale)
|
||||
aa = antialias(deb)
|
||||
grain = regrain(aa)
|
||||
ed = scenefilter_ed(grain, src, ED)
|
||||
final = finalize(ed)
|
||||
|
@ -1,6 +1,6 @@
|
||||
import vapoursynth as vs
|
||||
|
||||
from pripri_common import PriPriConfig, edgefix, denoise, descale, antialias, regrain, scenefilter_ed, finalize
|
||||
from pripri_common import PriPriConfig, edgefix, denoise, descale, deband, antialias, regrain, scenefilter_ed, finalize
|
||||
|
||||
from yt_common.automation import SelfRunner
|
||||
from yt_common.source import FileTrim, SimpleSource
|
||||
@ -26,7 +26,8 @@ def filter() -> vs.VideoNode:
|
||||
ef = edgefix(src)
|
||||
den = denoise(ef)
|
||||
rescale = descale(den)
|
||||
aa = antialias(rescale)
|
||||
deb = deband(rescale)
|
||||
aa = antialias(deb)
|
||||
grain = regrain(aa)
|
||||
ed = scenefilter_ed(grain, src, ED)
|
||||
final = finalize(ed)
|
||||
|
@ -1,6 +1,6 @@
|
||||
import vapoursynth as vs
|
||||
|
||||
from pripri_common import PriPriConfig, edgefix, denoise, descale, antialias, regrain, scenefilter_ed, finalize
|
||||
from pripri_common import PriPriConfig, edgefix, denoise, descale, deband, antialias, regrain, scenefilter_ed, finalize
|
||||
|
||||
from yt_common.automation import SelfRunner
|
||||
from yt_common.source import FileTrim, SimpleSource
|
||||
@ -26,7 +26,8 @@ def filter() -> vs.VideoNode:
|
||||
ef = edgefix(src)
|
||||
den = denoise(ef)
|
||||
rescale = descale(den)
|
||||
aa = antialias(rescale)
|
||||
deb = deband(rescale)
|
||||
aa = antialias(deb)
|
||||
grain = regrain(aa)
|
||||
ed = scenefilter_ed(grain, src, ED)
|
||||
final = finalize(ed)
|
||||
|
@ -1,6 +1,6 @@
|
||||
import vapoursynth as vs
|
||||
|
||||
from pripri_common import PriPriConfig, edgefix, denoise, descale, antialias, regrain, scenefilter_ed, finalize
|
||||
from pripri_common import PriPriConfig, edgefix, denoise, descale, deband, antialias, regrain, scenefilter_ed, finalize
|
||||
|
||||
from yt_common.automation import SelfRunner
|
||||
from yt_common.source import FileTrim, SimpleSource
|
||||
@ -26,7 +26,8 @@ def filter() -> vs.VideoNode:
|
||||
ef = edgefix(src)
|
||||
den = denoise(ef)
|
||||
rescale = descale(den)
|
||||
aa = antialias(rescale)
|
||||
deb = deband(rescale)
|
||||
aa = antialias(deb)
|
||||
grain = regrain(aa)
|
||||
ed = scenefilter_ed(grain, src, ED)
|
||||
final = finalize(ed)
|
||||
|
@ -1,6 +1,6 @@
|
||||
import vapoursynth as vs
|
||||
|
||||
from pripri_common import PriPriConfig, edgefix, denoise, descale, antialias, regrain, scenefilter_ed, finalize
|
||||
from pripri_common import PriPriConfig, edgefix, denoise, descale, deband, antialias, regrain, scenefilter_ed, finalize
|
||||
|
||||
from yt_common.automation import SelfRunner
|
||||
from yt_common.source import FileTrim, SimpleSource
|
||||
@ -26,7 +26,8 @@ def filter() -> vs.VideoNode:
|
||||
ef = edgefix(src)
|
||||
den = denoise(ef)
|
||||
rescale = descale(den)
|
||||
aa = antialias(rescale)
|
||||
deb = deband(rescale)
|
||||
aa = antialias(deb)
|
||||
grain = regrain(aa)
|
||||
ed = scenefilter_ed(grain, src, ED)
|
||||
final = finalize(ed)
|
||||
|
@ -1,13 +1,14 @@
|
||||
import vapoursynth as vs
|
||||
|
||||
from pripri_common import PriPriConfig, edgefix, denoise, descale, antialias, regrain, scenefilter_ed, finalize
|
||||
from pripri_common import PriPriConfig, edgefix, denoise, descale, deband, antialias, regrain, scenefilter_ed, finalize
|
||||
|
||||
from yt_common.automation import SelfRunner
|
||||
from yt_common.source import FileTrim, SimpleSource
|
||||
|
||||
from lvsfunc.misc import replace_ranges
|
||||
from lvsfunc.types import Range
|
||||
|
||||
from typing import Optional
|
||||
from typing import List, Optional
|
||||
|
||||
import os
|
||||
|
||||
@ -20,6 +21,12 @@ SOURCE: SimpleSource = SimpleSource(
|
||||
)
|
||||
ED: Optional[int] = None
|
||||
|
||||
DEBAND_STRONG: List[Range] = [
|
||||
(32710, 32757),
|
||||
(33104, 33388),
|
||||
(34406, 34534),
|
||||
]
|
||||
|
||||
|
||||
def filter() -> vs.VideoNode:
|
||||
src = SOURCE.source()
|
||||
@ -28,7 +35,8 @@ def filter() -> vs.VideoNode:
|
||||
ef = edgefix(src)
|
||||
den = denoise(ef)
|
||||
rescale = descale(den)
|
||||
aa = antialias(rescale)
|
||||
deb = deband(rescale, strong=DEBAND_STRONG)
|
||||
aa = antialias(deb)
|
||||
grain = regrain(aa)
|
||||
ed = scenefilter_ed(grain, src, ED)
|
||||
cr = replace_ranges(ed, src, [(29971, 32128)])
|
||||
|
@ -1,6 +1,6 @@
|
||||
import vapoursynth as vs
|
||||
|
||||
from pripri_common import PriPriConfig, edgefix, denoise, descale, antialias, regrain, finalize
|
||||
from pripri_common import PriPriConfig, edgefix, denoise, descale, deband, antialias, regrain, finalize
|
||||
|
||||
from yt_common.automation import SelfRunner
|
||||
from yt_common.source import FileTrim, SimpleSource
|
||||
@ -21,7 +21,8 @@ def filter() -> vs.VideoNode:
|
||||
ef = edgefix(src)
|
||||
den = denoise(ef)
|
||||
rescale = descale(den)
|
||||
aa = antialias(rescale)
|
||||
deb = deband(rescale)
|
||||
aa = antialias(deb)
|
||||
grain = regrain(aa)
|
||||
final = finalize(grain)
|
||||
src.set_output(1)
|
||||
|
@ -1,3 +1,3 @@
|
||||
from .config import PriPriConfig # noqa: F401
|
||||
from .filter import edgefix, denoise, descale, antialias, regrain, scenefilter_ed, finalize # noqa: F401
|
||||
from .filter import edgefix, denoise, descale, deband, antialias, regrain, scenefilter_ed, finalize # noqa: F401
|
||||
from . import filter # noqa: F401
|
||||
|
@ -1,7 +1,7 @@
|
||||
import vapoursynth as vs
|
||||
import os
|
||||
|
||||
from typing import Any, Dict, Optional
|
||||
from typing import Any, Dict, List, Optional
|
||||
|
||||
from yt_common.antialiasing import sraa_clamp, mask_strong
|
||||
from yt_common.data import FSRCNNX
|
||||
@ -11,9 +11,11 @@ from awsmfunc import bbmod
|
||||
from kagefunc import retinex_edgemask
|
||||
from lvsfunc.denoise import bm3d
|
||||
from lvsfunc.kernels import Bicubic, Kernel
|
||||
from lvsfunc.mask import detail_mask
|
||||
from lvsfunc.misc import replace_ranges, scale_thresh
|
||||
from lvsfunc.scale import descale as ldescale
|
||||
from vardefunc import fsrcnnx_upscale, diff_creditless_mask
|
||||
from lvsfunc.types import Range
|
||||
from vardefunc import fsrcnnx_upscale, diff_creditless_mask, dumb3kdb
|
||||
from vsutil import depth
|
||||
from vsutil import Range as CRange
|
||||
|
||||
@ -28,8 +30,11 @@ def edgefix(clip: vs.VideoNode) -> vs.VideoNode:
|
||||
return bb
|
||||
|
||||
|
||||
def denoise(clip: vs.VideoNode) -> vs.VideoNode:
|
||||
return bm3d(clip, sigma=0.75, radius=1)
|
||||
def denoise(clip: vs.VideoNode, sigma: float = 0.75, h: float = 0.4) -> vs.VideoNode:
|
||||
return core.std.ShufflePlanes([
|
||||
bm3d(core.std.ShufflePlanes(clip, planes=0, colorfamily=vs.GRAY), sigma=sigma, radius=1),
|
||||
clip.knlm.KNLMeansCL(d=3, a=1, h=h)
|
||||
], planes=[0, 1, 2], colorfamily=vs.YUV)
|
||||
|
||||
|
||||
def _nnedi3_double(clip: vs.VideoNode) -> vs.VideoNode:
|
||||
@ -55,6 +60,13 @@ def descale(clip: vs.VideoNode, kernel: Kernel = Bicubic(b=0, c=1/2), mask: bool
|
||||
else depth(ldescale(clip, height=720, kernel=kernel, upscaler=_fsrlineart, mask=None), 16)
|
||||
|
||||
|
||||
def deband(clip: vs.VideoNode, strong: Optional[List[Range]] = None) -> vs.VideoNode:
|
||||
mask = detail_mask(clip)
|
||||
deband = core.std.MaskedMerge(dumb3kdb(clip, radius=16, threshold=40), clip, mask)
|
||||
deband_strong = core.std.MaskedMerge(dumb3kdb(clip, radius=16, threshold=50), clip, mask)
|
||||
return replace_ranges(deband, deband_strong, strong or [])
|
||||
|
||||
|
||||
def antialias(clip: vs.VideoNode) -> vs.VideoNode:
|
||||
def _sraa_pp_dehalo(sraa: vs.VideoNode) -> vs.VideoNode:
|
||||
sraa = MaskedDHA(sraa, rx=2.4, darkstr=0.1, brightstr=0.75)
|
||||
|
@ -85,7 +85,7 @@ class SimpleSource(FileSource):
|
||||
return self.src
|
||||
|
||||
def source(self) -> vs.VideoNode:
|
||||
return depth(core.std.Splice([s.apply_trim(self._open(s.path)) for s in self.src]), 16)
|
||||
return core.std.Splice([s.apply_trim(self._open(s.path)) for s in self.src])
|
||||
|
||||
|
||||
class DehardsubFileFinder(FileSource):
|
||||
|
Loading…
x
Reference in New Issue
Block a user