Vapoursynth LGhost

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

LGhost reduces ghosts: faint shifted copies of the picture or of its edges, typical of analog captures from VHS or TV. Several ghosts can be removed in one pass.

Filtering → Vapoursynth → DeHalo

LGhost controls in Hybrid
LGhost controls in Hybrid

What it does

Each ghost is described by a mode, a horizontal shift and an intensity. The filter adds a weighted, horizontally shifted copy of the image (or of its horizontal gradient) to cancel the ghost. Processing is per row, horizontal only.

In Hybrid the ghosts form a list: set Mode, Shift and Intensity and press Add to append an entry; Up, Down, Remove and Clear manage the list. All entries are passed in one call, in list order. With an empty list the filter is skipped.

Requirements

  • Windows or Linux; the plugin is not available on macOS.

Settings

Control Parameter Range / values Hybrid default Meaning
Mode mode edge, luminance, rising edge, falling edge edge Ghost type: edge = shifted horizontal gradient; luminance = shifted copy of the pixel values; rising/falling edge = only positive/negative gradients.
Shift shift −32768 – 32768 0 Horizontal offset of the ghost in pixels; positive = ghost to the right. Must not be 0 except in luminance mode, and must be smaller than the width of every processed plane.
Intensity intensity −128 – 127 0 Strength as intensity/128; positive adds, negative subtracts. Must not be 0, so set it before pressing Add.
Planes planes all, chroma only, luma only luma only Planes that are filtered; one setting for the whole list.

Example

One ghost entry (mode 2, shift 4, intensity 50) on a 10-bit YUV 4:2:0 source; without entries the filter is skipped:

clip = core.lghost.LGhost(clip, mode=[2], shift=[4], intensity=[50])

How Hybrid calls it

  • LGhost works on all YUV and RGB formats (8–16-bit integer, 32-bit float) without conversion.
  • Mode, shift and intensity are written as lists with one value per entry; Planes is always written.
  • Entries whose shift is not smaller than the narrowest processed plane (chroma is narrower with subsampling) are left out with a comment in the script; if no entry remains, the filter is skipped.
  • No bit-depth scaling is needed: intensity is a relative weight at every bit depth.
  • LGhost also offers the common options (Masked, ApplyOnlyTo, Merge, OnRegion, Gimmick).

Background

The plugin

VapourSynth-LGhost reduces luminance and edge ghosts (ringing). The three lists must have the same length. Without a planes setting the plugin filters only the first plane of YUV and Gray clips and all planes of RGB; unprocessed planes are copied. It has C, SSE2, AVX2 and AVX-512 code paths, chosen automatically. The README's example removes four ghosts at once: two luminance ghosts at +4 and +7 pixels and two edge ghosts at −4 and −7.

Sources