mask ¶
Functions:
-
descale_detail_mask
–Mask non-native resolution detail to prevent detail loss and artifacting.
-
descale_error_mask
–Create an error mask from the original and rescaled clip.
descale_detail_mask ¶
descale_detail_mask(
clip: VideoNode,
rescaled: VideoNode,
thr: float = 0.05,
inflate: int = 2,
xxpand: tuple[int, int] = (4, 0),
) -> ConstantFormatVideoNode
Mask non-native resolution detail to prevent detail loss and artifacting.
Descaling without masking is very dangerous, as descaling FHD material often leads to heavy artifacting and fine detail loss.
Parameters:
-
clip
¶VideoNode
) –Original clip.
-
rescaled
¶VideoNode
) –Clip rescaled using the presumed native kernel.
-
thr
¶float
, default:0.05
) –Binarizing threshold. Lower will catch more. Assumes float bitdepth input. Default: 0.05.
-
inflate
¶int
, default:2
) –Amount of times to
inflate
the mask. Default: 2. -
xxpand
¶tuple[int, int]
, default:(4, 0)
) –Amount of times to
Maximum
the clip by. The firstMaximum
is done before inflating, the second after. Default: 4 times pre-inflating, 0 times post-inflating.
Returns:
-
ConstantFormatVideoNode
–Mask containing all the native FHD detail.
Source code in vsscale/mask.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
|
descale_error_mask ¶
descale_error_mask(
clip: VideoNode,
rescaled: VideoNode,
thr: float | list[float] = 0.038,
expands: int | tuple[int, int, int] = (2, 2, 3),
blur: int | float = 3,
bwbias: int = 1,
tr: int = 0,
) -> ConstantFormatVideoNode
Create an error mask from the original and rescaled clip.
Parameters:
-
clip
¶VideoNode
) –Original clip.
-
rescaled
¶VideoNode
) –Rescaled clip.
-
thr
¶float | list[float]
, default:0.038
) –Threshold of the minimum difference.
-
expands
¶int | tuple[int, int, int]
, default:(2, 2, 3)
) –Iterations of mask expand at each step (diff, expand, binarize).
-
blur
¶int | float
, default:3
) –How much to blur the clip. If int, it will be a box_blur, else gauss_blur.
-
bwbias
¶int
, default:1
) –Calculate a bias with the clip's chroma.
-
tr
¶int
, default:0
) –Make the error mask temporally stable with a temporal radius.
Returns:
-
ConstantFormatVideoNode
–Descale error mask.
Source code in vsscale/mask.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 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 |
|