Browse Source

pripri: bd: all hail the debander

master
louis f 3 years ago
parent
commit
53aa19530f
Signed by: louis <louis@poweris.moe> GPG Key ID: 44D7E1DE4E23D6F2
16 changed files with 65 additions and 33 deletions
  1. +3
    -2
      Princess Principal/01/01.vpy
  2. +3
    -2
      Princess Principal/02/02.vpy
  3. +3
    -2
      Princess Principal/03/03.vpy
  4. +3
    -2
      Princess Principal/04/04.vpy
  5. +3
    -2
      Princess Principal/05/05.vpy
  6. +3
    -2
      Princess Principal/06/06.vpy
  7. +3
    -2
      Princess Principal/07/07.vpy
  8. +3
    -2
      Princess Principal/08/08.vpy
  9. +3
    -2
      Princess Principal/09/09.vpy
  10. +3
    -2
      Princess Principal/10/10.vpy
  11. +3
    -2
      Princess Principal/11/11.vpy
  12. +11
    -3
      Princess Principal/12/12.vpy
  13. +3
    -2
      Princess Principal/ncop/ncop.vpy
  14. +1
    -1
      Princess Principal/pripri_common/__init__.py
  15. +16
    -4
      Princess Principal/pripri_common/filter.py
  16. +1
    -1
      yt_common/yt_common/source.py

+ 3
- 2
Princess Principal/01/01.vpy View File

@@ -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)


+ 3
- 2
Princess Principal/02/02.vpy View File

@@ -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)


+ 3
- 2
Princess Principal/03/03.vpy View File

@@ -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)


+ 3
- 2
Princess Principal/04/04.vpy View File

@@ -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)


+ 3
- 2
Princess Principal/05/05.vpy View File

@@ -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)


+ 3
- 2
Princess Principal/06/06.vpy View File

@@ -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)


+ 3
- 2
Princess Principal/07/07.vpy View File

@@ -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)


+ 3
- 2
Princess Principal/08/08.vpy View File

@@ -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)


+ 3
- 2
Princess Principal/09/09.vpy View File

@@ -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)


+ 3
- 2
Princess Principal/10/10.vpy View File

@@ -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)


+ 3
- 2
Princess Principal/11/11.vpy View File

@@ -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)


+ 11
- 3
Princess Principal/12/12.vpy View File

@@ -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)])


+ 3
- 2
Princess Principal/ncop/ncop.vpy View File

@@ -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
- 1
Princess Principal/pripri_common/__init__.py View File

@@ -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

+ 16
- 4
Princess Principal/pripri_common/filter.py View File

@@ -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)


+ 1
- 1
yt_common/yt_common/source.py View File

@@ -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…
Cancel
Save