Avisynth amDCT

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

amDCT ("adaptive multipurpose DCT") is a block-based DCT filter by Jim Conklin. It reduces blocking and mosquito-type artifacts and can also sharpen, expand the local range and treat bright or dark regions separately.

Filtering → Avisynth → DeBlock

amDCT controls in Hybrid
amDCT controls in Hybrid

What it does

amDCT transforms 8×8 blocks with a DCT, quantizes and dequantizes them, and does this over several shifted block grids. The results are combined adaptively per frame, block and pixel. Besides smoothing (Smoothing group) it can sharpen wide or thin features, expand the local range (Long Range Expansion), remove noise in bright areas and process dark detail separately. High settings are slow.

With Quant 0 the smoothing is off and only the other enabled operations run.

Settings

Control Parameter Range Hybrid default Meaning
General
Adapt adapt 0–31 0 Maximum adaptation strength; 0 turns adaptation off.
Shift shift 0–5 3 Number of shifted grids: 0 (debug), 4, 8, 16, 32 or 64 versions. More is smoother and slower.
Quality quality 1–6 3 Speed versus quality. 1: no adaptivity. 2: fast adaptivity. 3: slower, higher-quality adaptivity with presmoothing. 4: sharpening, expanding and smoothing each run in their own pass. 5 and 6 are further quality steps.
nCPU ncpu 1–4 1 Number of CPU threads used by the filter.
Smoothing
Quant quant 0–31 1 Minimum smoothing value; 0 turns smoothing off.
Matrix matrix 1–8 1 Smoothing matrix (strength plus horizontal/vertical emphasis); ignored by QType 2 and 4.
QType qtype 1–4 1 Quantization type: 1 MPEG intra, 2 H.263 intra, 3 MPEG inter, 4 H.263 inter, ordered by deblocking strength.
Sharpening
W pos sharpWpos 5–7 5 DCT column used for wide features (5 larger, 7 smaller).
T pos sharpTpos 5–7 7 DCT column used for thin features. It cannot be lower than W pos: raising W pos raises T pos, and lowering T pos lowers W pos.
Sharp W sharpWAmt 0–31 0 Sharpening amount for wide features.
Sharp T sharpTAmt 0–31 0 Sharpening amount for thin features.
Bright noise removal
Start brightStart 0–255 255 Luma value from which the extra smoothing starts, up to 255.
Amount brightAmt 0–31 0 Strength of the extra smoothing in bright areas.
Long Range Expansion expand 0–31 0 Strength of the local range expansion.
Dark Detail
Start darkStart 0–255 0 Luma value up to which dark detail is treated.
Amount darkAmt 0–31 0 Strength of the dark detail processing. According to the original manual it is only effective when smoothing is used and neither expanding nor sharpening.
Other
Prefetch PreFetch −1–64 0 Number of threads for an added PreFetch call: 0 adds none, −1 uses the number of threads set for Hybrid's multi-threading, n adds PreFetch(n).

Example

Default settings on a 10-bit YUV 4:2:0 source. Hybrid converts to 8 bit before the filter and back to 10 bit afterwards:

# Converting from 10 to 8bit for AmDCT
ConvertBits(8)
# deblocking using amDCT
amDCT(quality=3,quant=1)
# Converting from 8 to 10bit for encoder
ConvertBits(10)

How Hybrid calls it

  • Hybrid loads amDCT.dll. The plugin only works on 8-bit planar YUV or gray (YV12, YV16, YV24, Y8), with width and height multiples of 8 and at least 16×16. Hybrid converts other formats, including YUY2 and YV411, and other bit depths, and converts back afterwards.
  • Frames are padded to a multiple of 16 for speed and cropped afterwards.
  • A parameter is written when it differs from the plugin default, so Quality 3 and Quant 1 appear in the call, while Quality 2 and Quant 0 are not written.
  • Prefetch is not an amDCT parameter; it adds a PreFetch line before the call.
  • Interlaced input is not supported.
  • amDCT also offers the common options and can be added to the filter queue several times.

Background

  • amDCT is an AviSynth plugin by Jim Conklin. The plugin requires sharpTPos to be 0 or at least sharpWPos.
  • The plugin also has the parameters showMask and T2, QType values 11–14 and legacy clip arguments, which Hybrid does not offer.
  • The plugin's own default for quant is 0, so a call without arguments changes nothing.

Sources

  • amDCT filter site
  • The AviSynth+ documentation does not cover amDCT.
  • Hybrid's tooltips