Vapoursynth Deblock QED

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

Deblock_QED is Didée's "quantizer-estimated" deblocking: it combines a normal and a strong Deblock so that block borders are cleaned thoroughly while the inside of the blocks is only touched as much as needed. It adapts better to sources with varying blockiness than a single Deblock.

Filtering → Vapoursynth → DeBlock

Deblock_QED controls in Hybrid
Deblock_QED controls in Hybrid

What it does

  1. Deblock runs twice: once normal (Edge quantizer, Border offsets) and once strong (Inner quantizer, Block offsets).
  2. On the 8×8 block borders the full change of the normal pass is used.
  3. Inside the blocks only a DCT-lowpassed version of the strong pass's change is used, so the block interiors are smoothed without losing detail.
  4. Chroma is handled by the chosen Chroma method.

Settings

Control Parameter Range / values Hybrid default Meaning
Edge quant1 2 – 60 24 Quantizer of the normal Deblock used for the block borders.
Inner quant2 2 – 60 26 Quantizer of the strong Deblock used for the block interiors.
Border (first value) aOff1 1 – 10 1 Border strength: halfway sensitivity, halfway strength modifier.
Border (second value) bOff1 1 – 10 2 Border sensitivity to detect blocking.
Block (first value) aOff2 1 – 10 1 Block interior strength: halfway sensitivity, halfway strength modifier.
Block (second value) bOff2 1 – 10 2 Block interior sensitivity to detect blocking.
Chroma uv use proposed method, no chroma deblocking, chroma from the normal Deblock, chroma from the strong Deblock use proposed method How chroma is deblocked: the same border/interior method as luma (3), not at all (2, fastest), or directly with the normal (1) or strong (−1) Deblock.
Tools: Expr tools akarin, cranexpr, std akarin (std without AVX2) Expression evaluator.
Tools: DCTFilter tools zsmooth, oxidctf, dctf zsmooth Plugin used for the DCT lowpass.

Example

Default settings on a 10-bit YUV 4:2:0 source:

# applying deblocking using Deblock_QED
clip = deblock.Deblock_QED(clip, tools={'expr': 'akarin', 'dctfilter': 'zsmooth'})

How Hybrid calls it

  • Deblock_QED works on YUV and gray clips with 8–16-bit integer or float samples; other formats are converted first.
  • The quantizers, offsets and the chroma method are only written when they differ from the defaults; the Tools choice is always written.
  • Deblock_QED also offers the common options (Masked, ApplyOnlyTo, Merge, OnRegion, Gimmick).

Background

The script

The function is a port of Didée's AviSynth Deblock_QED (via havsfunc) with the same parameter names and defaults. It pads the clip to mod 8 (mod 16 for the DCT step) and crops it back afterwards. If a chosen tool is not available, it falls back to the next one (akarin → cranexpr → std, oxidctf → zsmooth → dctf).

AviSynth

Deblock_QED was written for AviSynth (later as Deblock_QED_MT2); it uses the AviSynth Deblock and DCTFilter plugins with the same parameters.

Sources