Vapoursynth Weighted Resize: Difference between revisions
New filter page (via create-page on MediaWiki MCP Server) |
Update to current Hybrid behaviour; code as <pre> (via update-page on MediaWiki MCP Server) |
||
| Line 7: | Line 7: | ||
== What it does == | == What it does == | ||
''simple weight'' mixes the two results with one weight for all planes or with one weight per plane. ''BlindDehalo3 Masked'' builds an edge mask and takes the soft version only where the mask is white (edges, where ringing shows), while flat areas keep the sharp result. | ''simple weight'' mixes the two results with one weight for all planes or with one weight per plane. ''BlindDehalo3 Masked'' dehalos the soft version with BlindDeHalo3, builds an edge mask from it and takes the dehaloed soft version only where the mask is white (edges, where ringing shows), while flat areas keep the sharp result. | ||
== Settings == | == Settings == | ||
| Line 26: | Line 26: | ||
| Color family || – || YUV, RGB || YUV || Split mode: color family in which the planes are weighted. | | Color family || – || YUV, RGB || YUV || Split mode: color family in which the planes are weighted. | ||
|- | |- | ||
| Strength || – || 0 – 1000 || 125 || BlindDeHalo3 strength | | Strength || – || 0 – 1000 || 125 || BlindDeHalo3 strength of the dehaloed copy that the mask is built from and that is merged in. | ||
|- | |- | ||
| Mask || – || Sobel, EdgeMask (Kirsch), EdgeMask (Sobel fast), EdgeMask (Bloated), CartoonEdges, RobertsEdges, EdgeMask (Kirsch2) || Sobel || Edge detector for the mask. | | Mask || – || Sobel, EdgeMask (Kirsch), EdgeMask (Sobel fast), EdgeMask (Bloated), CartoonEdges, RobertsEdges, EdgeMask (Kirsch2) || Sobel || Edge detector for the mask. | ||
| Line 37: | Line 37: | ||
== Example == | == Example == | ||
Weighted with default settings and the default method NNEDI3, on a 10-bit YUV 4:2:0 source (640x356), resized to 1280x712: | Weighted with default settings and the default method NNEDI3, on a 10-bit YUV 4:2:0 source (640x356), resized to 1280x712: | ||
< | <pre> | ||
# Weighted resize - START | # Weighted resize - START | ||
clipSmoothed = clip | clipSmoothed = clip | ||
# Resizing using fmtconv - | # Resizing using fmtconv - linear | ||
clipSmoothed = core.fmtc.resample(clipSmoothed, kernel="linear", w=1280, h=712, interlaced=False, interlacedd=False) # resolution 1280x712 before YUV420P10 after YUV420P16 | clipSmoothed = core.fmtc.resample(clipSmoothed, kernel="linear", w=1280, h=712, interlaced=False, interlacedd=False) # resolution 1280x712 before YUV420P10 after YUV420P16 | ||
# resizing using ZNEDI3 | # resizing using ZNEDI3 | ||
| Line 48: | Line 48: | ||
clip = core.std.Merge(clipa=clipSmoothed, clipb=clip, weight=0.5) | clip = core.std.Merge(clipa=clipSmoothed, clipb=clip, weight=0.5) | ||
# Weighted resize - END | # Weighted resize - END | ||
</ | </pre> | ||
== How Hybrid calls it == | == How Hybrid calls it == | ||
* Before the main resize, a copy is resized with the base kernel to the target size (at field height when fields are filtered separately). | * Before the main resize, a copy is resized with the base kernel to the target size (at field height when fields are filtered separately). | ||
* simple weight: both clips are brought to a common format (in split mode the chosen color family) and merged; the base copy is the first clip, so weight 0 gives the base copy and 1 the main result. | * simple weight: both clips are brought to a common format (in split mode the chosen color family) and merged; the base copy is the first clip, so weight 0 gives the base copy and 1 the main result. | ||
* BlindDehalo3 Masked: BlindDeHalo3 (Hybrid's defaults with the chosen strength) runs on the base copy, the mask is built from | * BlindDehalo3 Masked: BlindDeHalo3 (Hybrid's defaults with the chosen strength) runs on the base copy, the mask is built from the luma of that dehaloed copy and optionally inverted, and the main result takes the dehaloed copy where the mask is white. Strength therefore changes both the mask and the picture that is merged in. | ||
* With [[Vapoursynth Stepped Resize|Stepped Resize]] the blend is applied after the final step. | * With [[Vapoursynth Stepped Resize|Stepped Resize]] the blend is applied after the final step. | ||
Latest revision as of 09:53, 16 November 2026
Weighted Resize makes a second, softer resize of the same frame with a classic kernel and blends it with the result of the selected resize method, either with fixed weights or guided by an edge mask. It tames ringing and oversharpening of sharp or neural upscalers.
Filtering → Vapoursynth → Frame → Resize

What it does
simple weight mixes the two results with one weight for all planes or with one weight per plane. BlindDehalo3 Masked dehalos the soft version with BlindDeHalo3, builds an edge mask from it and takes the dehaloed soft version only where the mask is white (edges, where ringing shows), while flat areas keep the sharp result.
Settings
The options are available with Resizer and Weighted ticked on the Resizer page.
| Control | Parameter | Range / values | Hybrid default | Meaning |
|---|---|---|---|---|
| Base resizer | kernel | point, rect, linear, cubic, lanczos, blackman, blackmanminlobe, spline36, spline64, spline144, spline, gauss, sinc | linear | fmtconv kernel of the soft copy (spline144 = spline with 6 taps). |
| Method | – | simple weight, BlindDehalo3 Masked | simple weight | How the two resizes are combined. |
| Mode | – | all, split | all | simple weight: one weight for all planes, or one per plane. |
| Weight | weight | 0 – 1 | 0.5 | 0 = base resizer only, 1 = selected method only, 0.5 = half each. |
| Weight 1/2/3 | weight | 0 – 1 each | 0.5 | Per-plane weights in split mode. |
| Color family | – | YUV, RGB | YUV | Split mode: color family in which the planes are weighted. |
| Strength | – | 0 – 1000 | 125 | BlindDeHalo3 strength of the dehaloed copy that the mask is built from and that is merged in. |
| Mask | – | Sobel, EdgeMask (Kirsch), EdgeMask (Sobel fast), EdgeMask (Bloated), CartoonEdges, RobertsEdges, EdgeMask (Kirsch2) | Sobel | Edge detector for the mask. |
| Invert | – | on/off | off | Inverts the mask. |
| Show mask | – | on/off | off | Outputs the mask instead of the result, for checking in the preview. |
Example
Weighted with default settings and the default method NNEDI3, on a 10-bit YUV 4:2:0 source (640x356), resized to 1280x712:
# Weighted resize - START
clipSmoothed = clip
# Resizing using fmtconv - linear
clipSmoothed = core.fmtc.resample(clipSmoothed, kernel="linear", w=1280, h=712, interlaced=False, interlacedd=False) # resolution 1280x712 before YUV420P10 after YUV420P16
# resizing using ZNEDI3
# current: 640x356 target: 1280x712
clip = edi_rpow2.nnedi3_rpow2(clip, rfactor=2, qual=2, tools={'nnedi3': 'znedi3'}) # 1280x712
clipSmoothed = core.resize.Bicubic(clip=clipSmoothed, format=vs.YUV420P10, dither_type="error_diffusion")
clip = core.std.Merge(clipa=clipSmoothed, clipb=clip, weight=0.5)
# Weighted resize - END
How Hybrid calls it
- Before the main resize, a copy is resized with the base kernel to the target size (at field height when fields are filtered separately).
- simple weight: both clips are brought to a common format (in split mode the chosen color family) and merged; the base copy is the first clip, so weight 0 gives the base copy and 1 the main result.
- BlindDehalo3 Masked: BlindDeHalo3 (Hybrid's defaults with the chosen strength) runs on the base copy, the mask is built from the luma of that dehaloed copy and optionally inverted, and the main result takes the dehaloed copy where the mask is white. Strength therefore changes both the mask and the picture that is merged in.
- With Stepped Resize the blend is applied after the final step.
Background
Merge
VapourSynth's Merge accepts weights from 0 to 1 only and needs two clips of the same format and size; one weight applies to all planes, a list gives one weight per plane. MaskedMerge takes the second clip where the mask is white and the first where it is black.