soifunc 0.14.1__tar.gz → 0.14.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {soifunc-0.14.1 → soifunc-0.14.2}/PKG-INFO +1 -1
- {soifunc-0.14.1 → soifunc-0.14.2}/pyproject.toml +1 -1
- {soifunc-0.14.1 → soifunc-0.14.2}/soifunc/__init__.py +1 -0
- {soifunc-0.14.1 → soifunc-0.14.2}/soifunc/deband.py +10 -7
- {soifunc-0.14.1 → soifunc-0.14.2}/soifunc/interpolate.py +1 -1
- soifunc-0.14.2/soifunc/subtitle.py +57 -0
- {soifunc-0.14.1 → soifunc-0.14.2}/LICENSE +0 -0
- {soifunc-0.14.1 → soifunc-0.14.2}/README.md +0 -0
- {soifunc-0.14.1 → soifunc-0.14.2}/soifunc/denoise.py +0 -0
- {soifunc-0.14.1 → soifunc-0.14.2}/soifunc/py.typed +0 -0
- {soifunc-0.14.1 → soifunc-0.14.2}/soifunc/resize.py +0 -0
|
@@ -17,14 +17,19 @@ __all__ = [
|
|
|
17
17
|
|
|
18
18
|
def retinex_deband(
|
|
19
19
|
clip: vs.VideoNode,
|
|
20
|
-
threshold: int,
|
|
20
|
+
threshold: int = 24,
|
|
21
21
|
showmask: bool = False,
|
|
22
22
|
) -> vs.VideoNode:
|
|
23
23
|
"""Debanding using contrast-adaptive edge masking.
|
|
24
24
|
|
|
25
25
|
Args:
|
|
26
26
|
clip: Input video (8-16bit YUV required).
|
|
27
|
-
threshold: Debanding strength (0-255).
|
|
27
|
+
threshold: Debanding strength (0-255). A reasonable range is around 16-64.
|
|
28
|
+
According to the original f3kdb documentation (https://f3kdb.readthedocs.io/en/stable/presets.html):
|
|
29
|
+
- Low = 32
|
|
30
|
+
- Medium = 48
|
|
31
|
+
- High = 64
|
|
32
|
+
- Very high = 80
|
|
28
33
|
showmask: If True, return edge mask instead of debanded clip.
|
|
29
34
|
|
|
30
35
|
Returns:
|
|
@@ -55,10 +60,8 @@ def retinex_deband(
|
|
|
55
60
|
if showmask:
|
|
56
61
|
return mask
|
|
57
62
|
|
|
58
|
-
# The
|
|
59
|
-
# to
|
|
60
|
-
#
|
|
61
|
-
# function was created. To keep this function compatible,
|
|
62
|
-
# we shift our threshold from 8-bit to 10-bit.
|
|
63
|
+
# The bitshift here is to adjust threshold values from neo_f3kdb's
|
|
64
|
+
# `scale=False` behavior to match vs-jetpack's `scale=True` behavior.
|
|
65
|
+
# It is not related to bit depth. The threshold value is independent of bit depth.
|
|
63
66
|
deband = f3k_deband(clip, thr=(threshold << 2))
|
|
64
67
|
return core.std.MaskedMerge(deband, clip, mask)
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
from vsaa import NNEDI3, based_aa, pre_aa
|
|
2
|
+
from vstools import ChromaLocation, ColorRange, Matrix, Primaries, Transfer, vs
|
|
3
|
+
|
|
4
|
+
from soifunc.resize import good_resize
|
|
5
|
+
|
|
6
|
+
__all__ = [
|
|
7
|
+
"based_imagesub",
|
|
8
|
+
]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def based_imagesub(clip: vs.VideoNode, sub_file: str) -> vs.VideoNode:
|
|
12
|
+
"""
|
|
13
|
+
ImageSub that performs anti-aliasing on only the subtitles.
|
|
14
|
+
|
|
15
|
+
:param clip: Video to add subtitles to
|
|
16
|
+
:type clip: vs.VideoNode
|
|
17
|
+
:param sub_file: Path to the image-based subtitles file
|
|
18
|
+
:type sub_file: str
|
|
19
|
+
:return: Subtitled video
|
|
20
|
+
:rtype: vs.VideoNode
|
|
21
|
+
"""
|
|
22
|
+
matrix = Matrix.from_video(clip)
|
|
23
|
+
primaries = Primaries.from_video(clip)
|
|
24
|
+
transfer = Transfer.from_video(clip)
|
|
25
|
+
range = ColorRange.from_video(clip)
|
|
26
|
+
sub = clip.sub.ImageFile(
|
|
27
|
+
file=sub_file,
|
|
28
|
+
blend=False,
|
|
29
|
+
)
|
|
30
|
+
sub = sub.resize.Spline36(
|
|
31
|
+
format=clip.format.id,
|
|
32
|
+
matrix=matrix,
|
|
33
|
+
primaries_in=primaries,
|
|
34
|
+
primaries=primaries,
|
|
35
|
+
transfer_in=transfer,
|
|
36
|
+
transfer=transfer,
|
|
37
|
+
range=range,
|
|
38
|
+
)
|
|
39
|
+
sub = good_resize(sub, clip.width, clip.height)
|
|
40
|
+
# Use NNEDI3 since ArtCNN isn't really designed for text
|
|
41
|
+
sub = based_aa(sub, prefilter=pre_aa, supersampler=NNEDI3)
|
|
42
|
+
|
|
43
|
+
mask = sub.std.PropToClip(prop="_Alpha")
|
|
44
|
+
mask_format = vs.core.query_video_format(
|
|
45
|
+
mask.format.color_family,
|
|
46
|
+
clip.format.sample_type,
|
|
47
|
+
clip.format.bits_per_sample,
|
|
48
|
+
mask.format.subsampling_w,
|
|
49
|
+
mask.format.subsampling_h,
|
|
50
|
+
)
|
|
51
|
+
mask = mask.resize.Spline36(
|
|
52
|
+
clip.width,
|
|
53
|
+
clip.height,
|
|
54
|
+
format=mask_format.id,
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
return vs.core.std.MaskedMerge(clipa=clip, clipb=sub, mask=mask)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|