Vapoursynth Weighted Resize

From wiki.selur.net
Revision as of 09:01, 15 November 2026 by Selur (talk | contribs) (New filter page (via create-page on MediaWiki MCP Server))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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

Weighted Resize controls in Hybrid
Weighted Resize controls in Hybrid

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.

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 used on the copy the mask is built from.
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 - spline64
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 its luma or first plane and optionally inverted, and the main result takes the base copy where the mask is white. The blend uses the base copy without dehaloing, so Strength only changes the mask.
  • 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.

Sources