vsdirty 0.1.0__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.
vsdirty-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 PingWer, Mhanz3500
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
vsdirty-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,174 @@
1
+ Metadata-Version: 2.4
2
+ Name: vsdirty
3
+ Version: 0.1.0
4
+ Summary: VapourSynth wrappers for denoising, masking and edge fixing
5
+ Author: PingWer, Mhanz3500
6
+ Project-URL: Homepage, https://github.com/r74mi/vs-dirty
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Python: >=3.10
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: vapoursynth>=70
14
+ Requires-Dist: vstools
15
+ Requires-Dist: vsjetpack==1.1.0
16
+ Dynamic: license-file
17
+
18
+ # vs-dirty
19
+
20
+ A collection of VapourSynth wrappers and utility functions focused on advanced denoising, masking, and edge fixing.
21
+
22
+ ## Installation
23
+
24
+ You can install `vsdirty` via pip:
25
+
26
+ ```bash
27
+ pip install vsdirty
28
+ ```
29
+
30
+ Or build from source:
31
+
32
+ ```bash
33
+ git clone https://github.com/r74mi/vs-dirty.git
34
+ cd vs-dirty
35
+ pip install .
36
+ ```
37
+
38
+ ## Dependencies
39
+
40
+ This package relies on several external VapourSynth plugins. Ensure these are installed and available in your VapourSynth plugins folder.
41
+
42
+ | Plugin | URL |
43
+ | :--- | :--- |
44
+ | **fmtc** | [GitLab](https://gitlab.com/EleonoreMizo/fmtconv/) |
45
+ | **akarin** | [GitHub](https://github.com/AkarinVS/vapoursynth-plugin) |
46
+ | **cas** | [GitHub](https://github.com/HomeOfVapourSynthEvolution/VapourSynth-CAS) |
47
+ | **bore** | [GitHub](https://github.com/OpusGang/bore) |
48
+ | **mvtools** | [GitHub](https://github.com/dubhater/vapoursynth-mvtools) |
49
+ | **BM3DCuda** | [GitHub](https://github.com/WolframRhodium/VapourSynth-BM3DCUDA) |
50
+ | **nlm-cuda** | [GitHub](https://github.com/AmusementClub/vs-nlm-cuda) |
51
+ | **vsmlrt** | [GitHub](https://github.com/AmusementClub/vs-mlrt) |
52
+
53
+ ## `adenoise`
54
+
55
+ Designed specifically for film content, this intensive adaptive denoiser removes noise while carefully preserving fine textures and small elements. It combines `mc_degrain` (luma), `NLMeans`/`CBM3D` (chroma), and `BM3D` (luma), all modulated by adaptive masking.
56
+
57
+ **Presets:**
58
+ - `scan65mm` (Light)
59
+ - `scan35mm` (Medium)
60
+ - `scan16mm` (Heavy)
61
+ - `scan8mm` (Very Heavy)
62
+ - `digital` (Optimized for digital sources)
63
+ - `default` (Generic)
64
+
65
+ **Parameters:**
66
+
67
+ ```python
68
+ adenoise.default(clip: vs.VideoNode,
69
+ thsad: int = 500,
70
+ tr: int = 2,
71
+ sigma: float = 6,
72
+ luma_mask_weaken: float = 0.75,
73
+ luma_mask_thr: float = 0.196,
74
+ chroma_denoise: float | tuple[float, str] = [1.0, "nlm"],
75
+ precision: bool = True,
76
+ chroma_masking: bool = False,
77
+ show_mask: int = 0,
78
+ luma_over_texture: float = 0.4,
79
+ kwargs_flatmask: dict = {})
80
+ ```
81
+
82
+ - `clip`: Clip to process (YUV or GRAY 16bit, if not will be internally converted in 16bit).
83
+ - `thsad`: Thsad for mc_degrain (luma denoise strength and chroma ref).
84
+ Recommended values: 300-800
85
+ - `tr`: Temporal radius for temporal consistency across al the filter involved.
86
+ Recommended values: 2-3 (1 means no temporal denoise).
87
+ - `sigma`: Sigma for BM3D (luma denoise strength).
88
+ Recommended values: 1-5.
89
+ - `luma_mask_weaken`: Controls how much dark spots should be denoised. Lower values mean stronger overall denoise.
90
+ Recommended values: 0.6-0.9
91
+ - `luma_mask_thr`: Threshold that determines what is considered bright and what is dark in the luma mask.
92
+ Recommended values: 0.15-0.25
93
+ - `chroma_denoise`: Denoiser strength and type for chroma. NLMeans/CBM3D/ArtCNN.
94
+ Reccomended strength values: 0.5-2. If not given, 1.0 is used (or none for ArtCNN).
95
+ Accepted denoiser types: "nlm", "cbm3d", "artcnn". If not given, nlm is used.
96
+ - `precision`: If True, a flat mask is created to enhance the denoise strenght on flat areas avoiding textured area (95% accuracy).
97
+ - `chroma_masking`: If True, enables specific chroma masking for U/V planes.
98
+ - `show_mask`: 1 = Show the first luma mask, 2 = Show the textured luma mask, 3 = Show the complete luma mask, 4 = Show the Chroma U Plane mask (if chroma_masking = True), 5 = Show the Chroma V Plane mask (if chroma_masking = True). Any other value returns the denoised clip.
99
+ - `luma_over_texture`: Multiplier for the luma mask in precision mode. Lower value means more importance to textured areas, higher value means more importance to luma levels.
100
+ Accepted values: 0.0-1.0
101
+ - `kwargs_flatmask`: Additional arguments for flatmask creation.
102
+ dict values (check `hd_flatmask`'s docstring for more info):
103
+ - `sigma1`: This value should be decided based on the details level of the clip and how much grain and noise is present. Usually 1 for really textured clip, 2-3 for a normal clip, 4-5 for a clip with strong noise or grain.
104
+ - `texture_strength`: Texture strength for mask (0-inf). Values above 1 decrese the strength of the texture in the mask, lower values increase it. The max value is theoretical infinite, but there is no gain after some point.
105
+ - `edges_strength`: Edges strength for mask (0-1). Basic multiplier for edges strength.
106
+
107
+ - `return`: 16bit denoised clip. If show_mask is 1, 2, 3, 4 or 5, returns a tuple (denoised_clip, mask).
108
+
109
+ **Usage:**
110
+
111
+ ```python
112
+ from vsdirty import adenoise
113
+
114
+ # Apply default adaptive denoising
115
+ denoised = adenoise.scan16mm(clip)
116
+ ```
117
+
118
+
119
+ ## `bore`
120
+
121
+ A powerful edge cleaner (dirty line fixer) that processes borders at their native resolution to avoid scaling artifacts.
122
+
123
+ ```python
124
+ from vsdirty import bore
125
+
126
+ # Fix dirty lines: Top=1px, Bottom=1px, Left=2px, Right=2px
127
+ clean = bore(clip, ythickness=[1, 1, 2, 2])
128
+ ```
129
+
130
+ ## `msaa2x`
131
+
132
+ An antialiaser based on ArtCNN that targets specific edges to reduce aliasing without blurring textures.
133
+
134
+ ```python
135
+ from vsdirty import adfunc
136
+
137
+ # Apply antialiasing
138
+ aa_clip = adfunc.msaa2x(clip)
139
+ ```
140
+
141
+ ## `advanced_edgemask`
142
+
143
+ Generates a high-quality edge mask by combining Retinex preprocessing with multiple edge detectors (Kirsch, Sobel) to capture faint and complex edges.
144
+
145
+ ```python
146
+ from vsdirty import admask
147
+
148
+ emask = admask.advanced_edgemask(clip, luma_scaling=10)
149
+ ```
150
+
151
+ ## `hd_flatmask`
152
+
153
+ A specialized mask for flat areas, useful for protecting textures or targeting specific flat regions for filtering.
154
+
155
+ ```python
156
+ from vsdirty import admask
157
+
158
+ flat_mask = admask.hd_flatmask(clip)
159
+ ```
160
+
161
+ ## `diff_and_swap`
162
+
163
+ A utility to repair damaged frames in a "base" clip using a "correction" clip. It compares frames and swaps them if the difference exceeds a threshold.
164
+
165
+ ```python
166
+ from vsdirty import adutils
167
+
168
+ # automated patching
169
+ repaired, _ = adutils.diff_and_swap(correction_clip, base_clip, thr=30000)
170
+ ```
171
+
172
+ ## License
173
+
174
+ MIT License
@@ -0,0 +1,157 @@
1
+ # vs-dirty
2
+
3
+ A collection of VapourSynth wrappers and utility functions focused on advanced denoising, masking, and edge fixing.
4
+
5
+ ## Installation
6
+
7
+ You can install `vsdirty` via pip:
8
+
9
+ ```bash
10
+ pip install vsdirty
11
+ ```
12
+
13
+ Or build from source:
14
+
15
+ ```bash
16
+ git clone https://github.com/r74mi/vs-dirty.git
17
+ cd vs-dirty
18
+ pip install .
19
+ ```
20
+
21
+ ## Dependencies
22
+
23
+ This package relies on several external VapourSynth plugins. Ensure these are installed and available in your VapourSynth plugins folder.
24
+
25
+ | Plugin | URL |
26
+ | :--- | :--- |
27
+ | **fmtc** | [GitLab](https://gitlab.com/EleonoreMizo/fmtconv/) |
28
+ | **akarin** | [GitHub](https://github.com/AkarinVS/vapoursynth-plugin) |
29
+ | **cas** | [GitHub](https://github.com/HomeOfVapourSynthEvolution/VapourSynth-CAS) |
30
+ | **bore** | [GitHub](https://github.com/OpusGang/bore) |
31
+ | **mvtools** | [GitHub](https://github.com/dubhater/vapoursynth-mvtools) |
32
+ | **BM3DCuda** | [GitHub](https://github.com/WolframRhodium/VapourSynth-BM3DCUDA) |
33
+ | **nlm-cuda** | [GitHub](https://github.com/AmusementClub/vs-nlm-cuda) |
34
+ | **vsmlrt** | [GitHub](https://github.com/AmusementClub/vs-mlrt) |
35
+
36
+ ## `adenoise`
37
+
38
+ Designed specifically for film content, this intensive adaptive denoiser removes noise while carefully preserving fine textures and small elements. It combines `mc_degrain` (luma), `NLMeans`/`CBM3D` (chroma), and `BM3D` (luma), all modulated by adaptive masking.
39
+
40
+ **Presets:**
41
+ - `scan65mm` (Light)
42
+ - `scan35mm` (Medium)
43
+ - `scan16mm` (Heavy)
44
+ - `scan8mm` (Very Heavy)
45
+ - `digital` (Optimized for digital sources)
46
+ - `default` (Generic)
47
+
48
+ **Parameters:**
49
+
50
+ ```python
51
+ adenoise.default(clip: vs.VideoNode,
52
+ thsad: int = 500,
53
+ tr: int = 2,
54
+ sigma: float = 6,
55
+ luma_mask_weaken: float = 0.75,
56
+ luma_mask_thr: float = 0.196,
57
+ chroma_denoise: float | tuple[float, str] = [1.0, "nlm"],
58
+ precision: bool = True,
59
+ chroma_masking: bool = False,
60
+ show_mask: int = 0,
61
+ luma_over_texture: float = 0.4,
62
+ kwargs_flatmask: dict = {})
63
+ ```
64
+
65
+ - `clip`: Clip to process (YUV or GRAY 16bit, if not will be internally converted in 16bit).
66
+ - `thsad`: Thsad for mc_degrain (luma denoise strength and chroma ref).
67
+ Recommended values: 300-800
68
+ - `tr`: Temporal radius for temporal consistency across al the filter involved.
69
+ Recommended values: 2-3 (1 means no temporal denoise).
70
+ - `sigma`: Sigma for BM3D (luma denoise strength).
71
+ Recommended values: 1-5.
72
+ - `luma_mask_weaken`: Controls how much dark spots should be denoised. Lower values mean stronger overall denoise.
73
+ Recommended values: 0.6-0.9
74
+ - `luma_mask_thr`: Threshold that determines what is considered bright and what is dark in the luma mask.
75
+ Recommended values: 0.15-0.25
76
+ - `chroma_denoise`: Denoiser strength and type for chroma. NLMeans/CBM3D/ArtCNN.
77
+ Reccomended strength values: 0.5-2. If not given, 1.0 is used (or none for ArtCNN).
78
+ Accepted denoiser types: "nlm", "cbm3d", "artcnn". If not given, nlm is used.
79
+ - `precision`: If True, a flat mask is created to enhance the denoise strenght on flat areas avoiding textured area (95% accuracy).
80
+ - `chroma_masking`: If True, enables specific chroma masking for U/V planes.
81
+ - `show_mask`: 1 = Show the first luma mask, 2 = Show the textured luma mask, 3 = Show the complete luma mask, 4 = Show the Chroma U Plane mask (if chroma_masking = True), 5 = Show the Chroma V Plane mask (if chroma_masking = True). Any other value returns the denoised clip.
82
+ - `luma_over_texture`: Multiplier for the luma mask in precision mode. Lower value means more importance to textured areas, higher value means more importance to luma levels.
83
+ Accepted values: 0.0-1.0
84
+ - `kwargs_flatmask`: Additional arguments for flatmask creation.
85
+ dict values (check `hd_flatmask`'s docstring for more info):
86
+ - `sigma1`: This value should be decided based on the details level of the clip and how much grain and noise is present. Usually 1 for really textured clip, 2-3 for a normal clip, 4-5 for a clip with strong noise or grain.
87
+ - `texture_strength`: Texture strength for mask (0-inf). Values above 1 decrese the strength of the texture in the mask, lower values increase it. The max value is theoretical infinite, but there is no gain after some point.
88
+ - `edges_strength`: Edges strength for mask (0-1). Basic multiplier for edges strength.
89
+
90
+ - `return`: 16bit denoised clip. If show_mask is 1, 2, 3, 4 or 5, returns a tuple (denoised_clip, mask).
91
+
92
+ **Usage:**
93
+
94
+ ```python
95
+ from vsdirty import adenoise
96
+
97
+ # Apply default adaptive denoising
98
+ denoised = adenoise.scan16mm(clip)
99
+ ```
100
+
101
+
102
+ ## `bore`
103
+
104
+ A powerful edge cleaner (dirty line fixer) that processes borders at their native resolution to avoid scaling artifacts.
105
+
106
+ ```python
107
+ from vsdirty import bore
108
+
109
+ # Fix dirty lines: Top=1px, Bottom=1px, Left=2px, Right=2px
110
+ clean = bore(clip, ythickness=[1, 1, 2, 2])
111
+ ```
112
+
113
+ ## `msaa2x`
114
+
115
+ An antialiaser based on ArtCNN that targets specific edges to reduce aliasing without blurring textures.
116
+
117
+ ```python
118
+ from vsdirty import adfunc
119
+
120
+ # Apply antialiasing
121
+ aa_clip = adfunc.msaa2x(clip)
122
+ ```
123
+
124
+ ## `advanced_edgemask`
125
+
126
+ Generates a high-quality edge mask by combining Retinex preprocessing with multiple edge detectors (Kirsch, Sobel) to capture faint and complex edges.
127
+
128
+ ```python
129
+ from vsdirty import admask
130
+
131
+ emask = admask.advanced_edgemask(clip, luma_scaling=10)
132
+ ```
133
+
134
+ ## `hd_flatmask`
135
+
136
+ A specialized mask for flat areas, useful for protecting textures or targeting specific flat regions for filtering.
137
+
138
+ ```python
139
+ from vsdirty import admask
140
+
141
+ flat_mask = admask.hd_flatmask(clip)
142
+ ```
143
+
144
+ ## `diff_and_swap`
145
+
146
+ A utility to repair damaged frames in a "base" clip using a "correction" clip. It compares frames and swaps them if the difference exceeds a threshold.
147
+
148
+ ```python
149
+ from vsdirty import adutils
150
+
151
+ # automated patching
152
+ repaired, _ = adutils.diff_and_swap(correction_clip, base_clip, thr=30000)
153
+ ```
154
+
155
+ ## License
156
+
157
+ MIT License
@@ -0,0 +1,27 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "vsdirty"
7
+ version = "0.1.0"
8
+ description = "VapourSynth wrappers for denoising, masking and edge fixing"
9
+ readme = "README.md"
10
+ authors = [{ name = "PingWer" }, { name = "Mhanz3500" }]
11
+ requires-python = ">=3.10"
12
+ dependencies = [
13
+ "vapoursynth>=70",
14
+ "vstools",
15
+ "vsjetpack==1.1.0",
16
+ ]
17
+ classifiers = [
18
+ "Programming Language :: Python :: 3",
19
+ "License :: OSI Approved :: MIT License",
20
+ "Operating System :: OS Independent",
21
+ ]
22
+
23
+ [project.urls]
24
+ Homepage = "https://github.com/r74mi/vs-dirty"
25
+
26
+ [tool.setuptools.packages.find]
27
+ include = ["vsdirty*"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,8 @@
1
+ """
2
+ Tools made by PingWer74 and Man3500 for adaptive denoise, masks and other stuff.
3
+ """
4
+
5
+ from .adfunc import *
6
+ from .admask import *
7
+ from .adutils import *
8
+ from .dirtyfixer import *