5
0

tensura: s2: bd: vol1 edgefix and aa changes

This commit is contained in:
louis f 2021-06-01 21:11:26 -04:00
parent 5ca5bf799d
commit 427739112f
Signed by: louis
GPG Key ID: 44D7E1DE4E23D6F2
7 changed files with 111 additions and 38 deletions

View File

@ -1,14 +1,16 @@
import vapoursynth as vs
from tensura_common import TenSuraConfig, antialias, deband, denoise, descale, finalize, regrain
from tensura_common import TenSuraConfig, antialias, deband, denoise, descale, edgefix, finalize, regrain
from yt_common.automation import SelfRunner
from yt_common.chapters import Chapter
from yt_common.source import FileTrim, SimpleSource
from lvsfunc.mask import BoundingBox
from lvsfunc.misc import replace_ranges
from lvsfunc.types import Range
from typing import List
from typing import List, Tuple
import os
@ -28,19 +30,56 @@ CHAPTERS: List[Chapter] = [
Chapter("Next", 33926),
]
NOD3: List[Range] = [
(3885, 5948),
(33926, 34045),
]
AA_STRONG: List[Range] = [
(15605, 15772),
]
SANGNOM: List[Tuple[Range, List[BoundingBox]]] = [
((25514, 25515), [
BoundingBox((68, 0), (366, 622)),
]),
(25516, [
BoundingBox((126, 0), (340, 646)),
]),
(25517, [
BoundingBox((35, 0), (352, 617)),
]),
(25518, [
BoundingBox((84, 0), (353, 613)),
]),
(25519, [
BoundingBox((98, 0), (348, 642)),
]),
(25520, [
BoundingBox((70, 0), (351, 632)),
]),
(25521, [
BoundingBox((69, 0), (367, 616)),
]),
(25522, [
BoundingBox((84, 0), (367, 620)),
]),
((25523, 25780), [
BoundingBox((75, 0), (359, 615)),
]),
]
core = vs.core
def filter() -> vs.VideoNode:
src = SOURCE.source()
den = denoise(src)
ef = edgefix(src)
den = denoise(ef)
descaled = descale(den)
deb = deband(descaled)
aa = antialias(deb, strong=AA_STRONG)
deb = replace_ranges(deb, src, NOD3)
aa = antialias(deb, strong=AA_STRONG, sangnom=SANGNOM)
grain = regrain(aa)
final = finalize(grain)
src.set_output(1)

View File

@ -1,11 +1,12 @@
import vapoursynth as vs
from tensura_common import TenSuraConfig, antialias, deband, denoise, descale, finalize, regrain
from tensura_common import TenSuraConfig, antialias, deband, denoise, descale, edgefix, finalize, regrain
from yt_common.automation import SelfRunner
from yt_common.chapters import Chapter
from yt_common.source import FileTrim, SimpleSource
from lvsfunc.misc import replace_ranges
from lvsfunc.types import Range
from typing import List
@ -28,6 +29,10 @@ CHAPTERS: List[Chapter] = [
Chapter("Next", 33927),
]
NOD3: List[Range] = [
(33927, 34046),
]
AA_STRONG: List[Range] = [
]
@ -41,9 +46,11 @@ core = vs.core
def filter() -> vs.VideoNode:
src = SOURCE.source()
den = denoise(src)
ef = edgefix(src)
den = denoise(ef)
descaled = descale(den)
deb = deband(descaled, nuclear=DEBAND_NUCLEAR)
deb = replace_ranges(deb, src, NOD3)
aa = antialias(deb, strong=AA_STRONG)
grain = regrain(aa)
final = finalize(grain)

View File

@ -1,11 +1,12 @@
import vapoursynth as vs
from tensura_common import TenSuraConfig, antialias, deband, denoise, descale, finalize, regrain
from tensura_common import TenSuraConfig, antialias, deband, denoise, descale, edgefix, finalize, regrain
from yt_common.automation import SelfRunner
from yt_common.chapters import Chapter
from yt_common.source import FileTrim, SimpleSource
from lvsfunc.misc import replace_ranges
from lvsfunc.types import Range
from typing import List
@ -28,6 +29,11 @@ CHAPTERS: List[Chapter] = [
Chapter("Next", 33926),
]
NOD3: List[Range] = [
(8023, 8205),
(33926, 34045),
]
AA_STRONG: List[Range] = [
(3084, 3125),
]
@ -40,9 +46,11 @@ core = vs.core
def filter() -> vs.VideoNode:
src = SOURCE.source()
den = denoise(src)
ef = edgefix(src)
den = denoise(ef)
descaled = descale(den)
deb = deband(descaled, nuclear=DEBAND_NUCLEAR)
deb = replace_ranges(deb, src, NOD3)
aa = antialias(deb, strong=AA_STRONG)
grain = regrain(aa)
final = finalize(grain)

View File

@ -1,14 +1,16 @@
import vapoursynth as vs
from tensura_common import TenSuraConfig, antialias, deband, denoise, descale, finalize, regrain
from tensura_common import TenSuraConfig, antialias, deband, denoise, descale, edgefix, finalize, regrain
from yt_common.automation import SelfRunner
from yt_common.chapters import Chapter
from yt_common.source import FileTrim, SimpleSource
from lvsfunc.mask import BoundingBox
from lvsfunc.misc import replace_ranges
from lvsfunc.types import Range
from typing import List
from typing import List, Tuple
import os
@ -28,9 +30,19 @@ CHAPTERS: List[Chapter] = [
Chapter("Next", 33925),
]
NOD3: List[Range] = [
(33925, 34044),
]
AA_STRONG: List[Range] = [
(6038, 6117),
(7301, 7348),
(18676, 18927),
(19734, 19835),
(30806, 31045),
]
SANGNOM: List[Tuple[Range, List[BoundingBox]]] = [
]
DEBAND_NUCLEAR: List[Range] = [
@ -41,10 +53,12 @@ core = vs.core
def filter() -> vs.VideoNode:
src = SOURCE.source()
den = denoise(src)
ef = edgefix(src)
den = denoise(ef)
descaled = descale(den)
deb = deband(descaled, nuclear=DEBAND_NUCLEAR)
aa = antialias(deb, strong=AA_STRONG)
deb = replace_ranges(deb, src, NOD3)
aa = antialias(deb, strong=AA_STRONG, sangnom=SANGNOM)
grain = regrain(aa)
final = finalize(grain)
src.set_output(1)

View File

@ -7,6 +7,7 @@ from yt_common.chapters import Chapter
from yt_common.source import FileTrim, SimpleSource
from lvsfunc.mask import BoundingBox
from lvsfunc.misc import replace_ranges
from lvsfunc.types import Range
from typing import List, Tuple
@ -29,6 +30,10 @@ CHAPTERS: List[Chapter] = [
Chapter("Next", 33928),
]
NOD3: List[Range] = [
(33928, 34047),
]
AA_STRONG: List[Range] = [
]
@ -53,20 +58,16 @@ SANGNOM: List[Tuple[Range, List[BoundingBox]]] = [
DEBAND_NUCLEAR: List[Range] = [
]
EDGEFIX: List[Range] = [
(0, 2085),
(4245, 31769),
]
core = vs.core
def filter() -> vs.VideoNode:
src = SOURCE.source()
ef = edgefix(src, EDGEFIX)
ef = edgefix(src)
den = denoise(ef)
descaled = descale(den)
deb = deband(descaled, nuclear=DEBAND_NUCLEAR)
deb = replace_ranges(deb, src, NOD3)
aa = antialias(deb, strong=AA_STRONG, sangnom=SANGNOM)
grain = regrain(aa)
final = finalize(grain)

View File

@ -7,6 +7,7 @@ from yt_common.chapters import Chapter
from yt_common.source import FileTrim, SimpleSource
from lvsfunc.mask import BoundingBox
from lvsfunc.misc import replace_ranges
from lvsfunc.types import Range
from typing import List, Tuple
@ -28,6 +29,12 @@ CHAPTERS: List[Chapter] = [
Chapter("Next", 33927),
]
NOD3: List[Range] = [
(8552, 8779),
(28796, 29188),
(33927, 34046),
]
AA_STRONG: List[Range] = [
(11640, 11685),
(12437, 12488),
@ -59,18 +66,16 @@ SANGNOM: List[Tuple[Range, List[BoundingBox]]] = [
DEBAND_NUCLEAR: List[Range] = [
]
EDGEFIX: List[Range] = [
]
core = vs.core
def filter() -> vs.VideoNode:
src = SOURCE.source()
ef = edgefix(src, EDGEFIX)
ef = edgefix(src)
den = denoise(ef)
descaled = descale(den)
deb = deband(descaled, nuclear=DEBAND_NUCLEAR)
deb = replace_ranges(deb, src, NOD3)
aa = antialias(deb, strong=AA_STRONG, sangnom=SANGNOM)
grain = regrain(aa)
final = finalize(grain)

View File

@ -34,9 +34,9 @@ def _fsrlineart(clip: vs.VideoNode, width: int, height: int) -> vs.VideoNode:
return core.std.MaskedMerge(nn.resize.Bicubic(width, height, filter_param_a=0, filter_param_b=1/2), fsr, mask)
def edgefix(clip: vs.VideoNode, ranges: Optional[List[Range]] = None) -> vs.VideoNode:
def edgefix(clip: vs.VideoNode) -> vs.VideoNode:
bb: vs.VideoNode = bbmod(clip, top=1, bottom=1, left=1, right=1, blur=500)
return replace_ranges(clip, bb, ranges or [])
return bb
def descale(clip: vs.VideoNode) -> vs.VideoNode:
@ -55,26 +55,25 @@ def deband(clip: vs.VideoNode, strong: Optional[List[Range]] = None,
nuclear: Optional[List[Range]] = None) -> vs.VideoNode:
dmask = detail_mask(clip)
deb = dumb3kdb(clip, radius=16, threshold=30)
debs = dumb3kdb(clip, radius=24, threshold=60)
deb = replace_ranges(deb, debs, strong or [])
debn = core.std.ShufflePlanes([
core.std.MaskedMerge(
if strong:
debs = dumb3kdb(clip, radius=24, threshold=60)
deb = replace_ranges(deb, debs, strong or [])
if nuclear:
debn = core.std.ShufflePlanes([
f3kbilateral(clip.std.ShufflePlanes(planes=0, colorfamily=vs.GRAY), y=60),
clip.std.ShufflePlanes(planes=0, colorfamily=vs.GRAY),
detail_mask(clip)
),
deb
], planes=[0, 1, 2], colorfamily=vs.YUV)
deb = replace_ranges(deb, debn, nuclear or [])
deb
], planes=[0, 1, 2], colorfamily=vs.YUV)
deb = replace_ranges(deb, debn, nuclear or [])
return core.std.MaskedMerge(deb, clip, dmask)
def antialias(clip: vs.VideoNode, strong: List[Range],
def antialias(clip: vs.VideoNode, strong: Optional[List[Range]] = None,
sangnom: Optional[List[Tuple[Range, List[BoundingBox]]]] = None) -> vs.VideoNode:
clamp = sraa_clamp(clip, mask=mask_strong)
sraa_13 = upscaled_sraa(clip, rfactor=1.3)
sraa_13 = core.std.MaskedMerge(clip, sraa_13, mask_strong(sraa_13))
clamp = replace_ranges(clamp, sraa_13, strong)
if strong or sangnom:
sraa_13 = upscaled_sraa(clip, rfactor=1.3)
sraa_13 = core.std.MaskedMerge(clip, sraa_13, mask_strong(sraa_13))
clamp = replace_ranges(clamp, sraa_13, strong or [])
if sangnom:
sn = upscaled_sraa(sraa_13, aafun=lambda c: c.sangnom.SangNom())
sn = core.std.MaskedMerge(sraa_13, sn, mask_strong(sn))