Vapoursynth MDering: Difference between revisions

From wiki.selur.net
Jump to navigation Jump to search
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 22: Line 22:
== Example ==
== Example ==
Default settings on a 10-bit YUV 4:2:0 source (640x356):
Default settings on a 10-bit YUV 4:2:0 source (640x356):
<syntaxhighlight lang="python">
<pre>
# deringing using MDering
# deringing using MDering
clip = dering.mdering(clip, tools={'expr': 'akarin', 'median': 'zsmooth'})
clip = dering.mdering(clip, tools={'expr': 'akarin', 'median': 'zsmooth'})
</syntaxhighlight>
</pre>


== How Hybrid calls it ==
== How Hybrid calls it ==

Latest revision as of 09:50, 16 November 2026

MDering is a small, fast remover for the light, bright ringing that DCT-based compression (JPEG, MPEG) leaves next to sharp edges.

Filtering → Vapoursynth → DeRing

MDering controls in Hybrid
MDering controls in Hybrid

What it does

MDering is a fast special case of a thresholded MinBlur. It compares a light and a stronger MinBlur of the picture and replaces a pixel only where both agree within Threshold and the result is not brighter than the source. So only the bright side of ringing is pulled down. Flat and textured areas can lose some detail; masking (see the common options) helps.

Settings

Control Parameter Range / values Hybrid default Meaning
Threshold thr 0 – 255 2 Largest difference between the two MinBlur results (8-bit scale) at which a pixel is replaced; higher changes more pixels.
Tools: Expr – akarin, cranexpr, std akarin (std without AVX2) Expression backend; akarin needs a CPU with AVX2.
Tools: Median – zsmooth, std zsmooth Implementation of the median steps.

Example

Default settings on a 10-bit YUV 4:2:0 source (640x356):

# deringing using MDering
clip = dering.mdering(clip, tools={'expr': 'akarin', 'median': 'zsmooth'})

How Hybrid calls it

  • MDering works on 8–16-bit integer YUV clips; other formats are converted first.
  • Threshold stays on the 8-bit scale; the script scales it to the bit depth (2 at 8 bit becomes 8 at 10 bit).
  • Above 12 bit the 5×5 median is computed at 12 bit and the result is limited against the source.
  • Threshold is only written when it differs from the default.
  • MDering also offers the common options (Masked, ApplyOnlyTo, Merge, OnRegion, Gimmick).

Background

Origin

MDering comes from muvsfunc (WolframRhodium), where it is documented only in the function itself: a TMinBlur with radius 1 that filters only the bright part, for speed, and that needs post-processing to limit damage to flat and textured areas.

Sources