Avisynth TFM

From wiki.selur.net
Revision as of 23:09, 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

TFM is the field matcher of the TIVTC plugin. Used here on its own, it rebuilds progressive frames from telecined or field-shifted material without removing frames.

Filtering → Avisynth → Frame → Misc

TFM controls in Hybrid
TFM controls in Hybrid

What it does

For every frame TFM chooses the field pairing that gives a progressive picture. Frames that stay combed can be deinterlaced afterwards (post-processing). Frame count and frame rate stay unchanged; to reach 24p, add a decimation step such as TIVTC. Hybrid switches TFM on automatically, together with sRestore, for some field-shifted sources.

Requirements

CPU only. The OpenCL option needs an OpenCL-capable graphics card.

Settings

Control Parameter Values Hybrid default Meaning
TFM – on/off off Enables the filter.
Mode mode 0–7 (eight entries) 1 0: 2-way match, safest and fastest. 1: 2-way match, third match on combed frames. 2: like 1 with the same field order. 3: also a 4th/5th match if still combed. 4: 3-way match. 5: 3-way with 4th/5th match, slowest and most aggressive. 6: like 2 with extra matches if still combed. 7: 2-way with field switching based on previous matches (needs linear access).
PP PP 0–7 6 Post-processing of combed frames. 0 none, 1 only flag combed frames, 2 blend, 3 cubic, 4 modified ELA, 5 motion-adaptive blend, 6 motion-adaptive cubic, 7 motion-adaptive modified ELA.
FM Speed slow slow, normal, slower, slowest slower Speed of the field matching; slower is more careful.
MChroma mChroma on/off on Use chroma in the match decision.
Deinterlacer clip2 inner, QTGMC (fast/medium/slow/Very Slow), NNEDI3, Yadif, BWDIF, EEDI3 inner Deinterlacer for combed frames. inner is TFM's own. The others are run on the clip at double rate and passed to TFM as second clip.
OpenCL – on/off off Use NNEDI3CL / EEDI3CL instead of the CPU versions; close to but not identical with the CPU result. Only available when an OpenCL device is found.
OpenCL device – 0–15 0 Device used when OpenCL is on.

Example

Default settings on a 10-bit YUV 4:2:0 source; no conversion is needed:

TFM().AssumeFrameBased()

How Hybrid calls it

  • TFM is called as TFM(...).AssumeFrameBased(); mode, PP, slow and mChroma are only written when they differ from the defaults. Afterwards the script treats the clip as progressive. Interlaced input is accepted.
  • The other deinterlacers load their own plugins and are passed as clip2.
  • The filter has no control for mthresh and uses the plugin default (5) for the motion-adaptive PP modes.
  • Frame width and height must be even. Hybrid works on YV12, YV16, YV24 or YV411 (with Yadif as deinterlacer only YV12) at 8 bit, adding conversions where necessary.
  • TFM also offers the common options and can be added to the filter queue several times.

Background

TFM comes from TIVTC by tritical; Hybrid uses pinterf's maintained build (TIVTC 1.0.32). Field order is taken from the clip, not from a setting. Hybrid does not offer order, field, cthresh, MI and most other TFM parameters. The Doom9 thread "TDeint and TIVTC" is the original discussion.

See also: Vapoursynth TFM, TIVTC

Sources