Vapoursynth Deblock

From wiki.selur.net
Jump to navigation Jump to search

Deblock removes blocking artifacts with the in-loop deblocking filter of H.264, applied as a post-process. Its strength is controlled by a quantizer value, like the one an H.264 encoder would use.

Filtering → Vapoursynth → DeBlock

Deblock controls in Hybrid
Deblock controls in Hybrid

What it does

The edges of the 4×4 blocks are smoothed. Whether an edge counts as a blocking edge and how strongly it is smoothed depend on Quant and the two offsets: higher values find more edges and smooth them more. Planes that are not selected are copied unchanged.

Settings

Control Parameter Range / values Hybrid default Meaning
Quant quant 0 – 60 25 Quantizer the deblocking is based on; higher means stronger deblocking.
Offset (A) aoffset -60 – 60 0 Shifts the threshold that decides what counts as a blocking edge; higher values deblock more edges.
Offset (B) boffset -60 – 60 0 Shifts both the detection and the strength; higher values deblock more strongly.
Planes planes all, luma only, chroma only all Planes that are processed.

The plugin limits each offset to the range −quant … 60 − quant, so larger values have no further effect. When quant + offset is below 16, nothing is filtered.

Example

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

# applying deblocking using Deblock
clip = core.deblock.Deblock(clip)

How Hybrid calls it

  • Deblock works on YUV with 8–16-bit integer or 32-bit float samples; other formats are converted to YUV first.
  • Quant and the offsets are only written when they differ from the defaults; the values are not scaled to the bit depth.
  • Deblock also offers the common options (Masked, ApplyOnlyTo, Merge, OnRegion, Gimmick).

Background

VapourSynth-Deblock

The plugin is a port of the AviSynth Deblock filter (Manao, Fizick): Deblock(clip, quant=25, aoffset=0, boffset=0, planes=[0, 1, 2], opt=0). It accepts every constant format with 8–16-bit integer or 32-bit float samples, pads frames that are not mod 8 internally and has C and SSE4.1 code paths (opt).

AviSynth

The AviSynth Deblock plugin has the same parameters (quant, aOffset, bOffset) and the same rule that nothing is filtered below quant + offset = 16; newer AviSynth+ builds also have planes.

Sources