funcs ¶
Functions:
-
based_aa
–Perform based anti-aliasing on a video clip.
-
clamp_aa
–Clamp a strong aa to a weaker one for the purpose of reducing the stronger's artifacts.
-
pre_aa
–
PreAA ¶
PreAA(pre_aa: Callable[P, R])
Bases: Generic[P, R]
Class decorator that wraps the pre_aa function and extends its functionality.
It is not meant to be used directly.
Methods:
Source code
35 36 |
|
__call__ ¶
__call__(*args: args, **kwargs: kwargs) -> R
Source code
38 39 |
|
custom ¶
custom(
clip: VideoNode,
sharpen: VSFunctionNoArgs[VideoNode, VideoNode],
aa: Antialiaser,
planes: PlanesT = None,
**kwargs: Any
) -> VideoNode
Source code
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
|
based_aa ¶
based_aa(
clip: VideoNode,
rfactor: float = 2.0,
mask: VideoNode | EdgeDetectT | Literal[False] = Prewitt,
mask_thr: int = 60,
pscale: float = 0.0,
downscaler: ScalerT | None = None,
supersampler: ScalerT | Literal[False] = ArtCNN,
double_rate: bool = False,
antialiaser: Antialiaser | None = None,
prefilter: (
VideoNode
| VSFunctionNoArgs[VideoNode, ConstantFormatVideoNode]
| Literal[False]
) = False,
postfilter: (
VSFunctionNoArgs[VideoNode, ConstantFormatVideoNode]
| Literal[False]
| None
) = None,
show_mask: bool = False,
**aa_kwargs: Any
) -> VideoNode
Perform based anti-aliasing on a video clip.
This function works by super- or downsampling the clip and applying an antialiaser to that image. The result is then merged with the original clip using an edge mask, and it's limited to areas where the antialiaser was actually applied.
Sharp supersamplers will yield better results, so long as they do not introduce too much ringing. For downscalers, you will want to use a neutral kernel.
Parameters:
-
clip
¶VideoNode
) –Clip to process.
-
rfactor
¶float
, default:2.0
) –Resize factor for supersampling. Values above 1.0 are recommended. Lower values may be useful for particularly extremely aliased content. Values closer to 1.0 will perform faster at the cost of precision. This value must be greater than 0.0. Default: 2.0.
-
mask
¶VideoNode | EdgeDetectT | Literal[False]
, default:Prewitt
) –Edge detection mask or function to generate it. Default: Prewitt.
-
mask_thr
¶int
, default:60
) –Threshold for edge detection mask. Only used if an EdgeDetect class is passed to
mask
. Default: 60. -
pscale
¶float
, default:0.0
) –Scale factor for the supersample-downscale process change.
-
downscaler
¶ScalerT | None
, default:None
) –Scaler used for downscaling after anti-aliasing. This should ideally be a relatively sharp kernel that doesn't introduce too much haloing. If None, downscaler will be set to Box if the scale factor is an integer (after rounding), and Catrom otherwise. If rfactor is below 1.0, the downscaler will be used before antialiasing instead, and the supersampler will be used to scale the clip back to its original resolution. Default: None.
-
supersampler
¶ScalerT | Literal[False]
, default:ArtCNN
) –Scaler used for supersampling before anti-aliasing. If False, no supersampling is performed. If rfactor is below 1.0, the downscaler will be used before antialiasing instead, and the supersampler will be used to scale the clip back to its original resolution. The supersampler should ideally be fairly sharp without introducing too much ringing. Default: ArtCNN (R8F64).
-
double_rate
¶bool
, default:False
) –Whether to use double-rate antialiasing. If True, both fields will be processed separately, which may improve anti-aliasing strength at the cost of increased processing time and detail loss. Default: False.
-
antialiaser
¶Antialiaser | None
, default:None
) –Antialiaser used for anti-aliasing. If None, EEDI3 will be selected with these default settings: (alpha=0.125, beta=0.25, vthresh0=12, vthresh1=24, field=1).
-
prefilter
¶VideoNode | VSFunctionNoArgs[VideoNode, ConstantFormatVideoNode] | Literal[False]
, default:False
) –Prefilter to apply before anti-aliasing. Must be a VideoNode, a function that takes a VideoNode and returns a VideoNode, or False. Default: False.
-
postfilter
¶VSFunctionNoArgs[VideoNode, ConstantFormatVideoNode] | Literal[False] | None
, default:None
) –Postfilter to apply after anti-aliasing. Must be a function that takes a VideoNode and returns a VideoNode, or None. If None, applies a median-filtered bilateral smoother to clean halos created during antialiasing. Default: None.
-
show_mask
¶bool
, default:False
) –If True, returns the edge detection mask instead of the processed clip. Default: False
Returns:
-
VideoNode
–Anti-aliased clip or edge detection mask if show_mask is True.
Raises:
-
CustomValueError
–If rfactor is not above 0.0, or invalid prefilter/postfilter is passed.
Source code
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 |
|
clamp_aa ¶
clamp_aa(
clip: VideoNode,
strength: float = 1.0,
mthr: float = 0.25,
mask: VideoNode | EdgeDetectT | Literal[False] = False,
weak_aa: VideoNode | Antialiaser | None = None,
strong_aa: VideoNode | Antialiaser | None = None,
ref: VideoNode | None = None,
planes: PlanesT = 0,
) -> ConstantFormatVideoNode
Clamp a strong aa to a weaker one for the purpose of reducing the stronger's artifacts.
Parameters:
-
clip
¶VideoNode
) –Clip to process.
-
strength
¶float
, default:1.0
) –Set threshold strength for over/underflow value for clamping.
-
mthr
¶float
, default:0.25
) –Binarize threshold for the mask, float.
-
mask
¶VideoNode | EdgeDetectT | Literal[False]
, default:False
) –Clip to use for custom mask or an EdgeDetect to use custom masker.
-
weak_aa
¶VideoNode | Antialiaser | None
, default:None
) –Antialiaser for the weaker aa. Default is Nnedi3
-
strong_aa
¶VideoNode | Antialiaser | None
, default:None
) –Antialiaser for the stronger aa. Default is Eedi3
-
ref
¶VideoNode | None
, default:None
) –Reference clip for clamping.
Returns:
-
ConstantFormatVideoNode
–Antialiased clip.
Source code
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
|
pre_aa ¶
pre_aa(
clip: VideoNode,
radius: int = 1,
strength: int = 100,
aa: Antialiaser = Nnedi3(),
planes: PlanesT = None,
**kwargs: Any
) -> VideoNode
Source code
68 69 70 71 72 73 74 75 76 77 78 79 |
|