Vapoursynth DPID

From wiki.selur.net
Revision as of 09:48, 16 November 2026 by Selur (talk | contribs) (Update to current Hybrid behaviour; code as <pre> (via update-page on MediaWiki MCP Server))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

DPID (detail-preserving image downscaling) is a downscaler that keeps small, visually important details such as thin lines and specks, even at large reduction factors. Hybrid uses it only for downscaling; for upscaling a fallback kernel takes over.

Filtering → Vapoursynth → Frame → Resize

DPID controls in Hybrid
DPID controls in Hybrid

What it does

Each output pixel is a weighted average of the source pixels it covers. Source pixels that differ more from their local average get more weight, so fine detail that a normal kernel would average away stays visible. Lambda controls how strongly this weighting acts.

Settings

Tick Resizer in the Resizer page and pick DPID as method.

Control Parameter Range / values Hybrid default Meaning
Lambda lambda 0 – 10 1 Weighting power: 0 acts like a box filter, higher values favor the most distinct pixels.
Read chroma location read_chromaloc on/off on Uses the chroma location stored in the frame properties.
Shift (horizontal) src_left on/off, -32768 – 32768 per plane off, 0 Horizontal shift of each plane, in source pixels.
Shift (vertical) src_top on/off, -32768 – 32768 per plane off, 0 Vertical shift of each plane, in source pixels.
Fallback kernel point, rect, linear, cubic, lanczos, blackman, blackmanminlobe, spline36, spline64, spline144, spline, gauss, sinc spline64 fmtconv kernel used when the target is larger than the source in either dimension.

Example

Default settings on a 10-bit YUV 4:2:0 source (640x356), downscaled to 320x178:

# Resizing: 640x356 -> 320x178
clip = core.dpid.Dpid(clip, width=320, height=178) # 320x178

How Hybrid calls it

  • DPID scales to the target size of the Crop/Resize tab; separately filtered fields get half the target height.
  • Same size: skipped. Width or height larger than the current size: DPID is not used, fmtconv resizes with the Fallback kernel.
  • RGB, YUV and gray in 8–16-bit integer or float are accepted without conversion.
  • Lambda is written when it is not 1, Read chroma location only when off, the shifts only when their checkbox is ticked.
  • The Lower resolution before resize option of the Resizer page can also use DPID, with the plugin defaults.

Background

VapourSynth-dpid

The plugin implements the detail-preserving downscaler for VapourSynth and is meant especially for large factors. The shift values are given per plane; the last value is repeated for the remaining planes. The plugin's separate DpidRaw function, which Hybrid does not use, also has a planes option.

Sources