Avisynth DeSpot

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

DeSpot removes dust, dirt and dropouts that show up on a single frame of a film transfer. It is a plugin that works on the temporal neighbours of each frame.

Filtering → Avisynth → Artifacts

DeSpot controls in Hybrid
DeSpot controls in Hybrid

What it does

A pixel becomes a spot candidate when it is brighter or darker than the same place in both the previous and the next frame. Candidates are grown into spots. Spots that are too large, or that touch moving areas, are kept. All other spots are replaced with content from the neighbour frames.

In Median mode the filter does not look for spots. It replaces every static pixel with the temporal median of three frames. This is stronger, but it can soften fine detail.

Typical uses:

  • Remove dust and small blotches from scanned film.
  • Use Show to see what is detected and tune the thresholds on a short sample.

Detection and removal work on luma only. Chroma changes only with Color correction or the highlight display. The first and last frame pass unchanged.

Settings

Control Parameter Range Hybrid default Meaning
General
Mode median Spot removing, Median mode Spot removing Spot removing detects and replaces spots. Median mode replaces every static pixel by the temporal median. The spot settings are only active in Spot removing mode.
Motion detection motpn on/off on On compares previous to next frame. Off compares previous to current and current to next.
Scene mscene 0–100 40 If more than this percentage of the frame moves, nothing is removed in that frame.
Motion thresh mthres 0–255 16 Luma difference that counts as motion. Should be larger than the second difference value.
Motion width / height mwidth / mheight 0–32000 7 / 5 Minimum size of a moving area.
Motion erode merode 0–100 33 Percentage of a moving area that must contain motion pixels.
Show show none, highlight, motion map none Tuning display. Highlight paints the spots and brightens motion. Motion map shows removed spots (255), spots kept due to motion (159), motion (95) and the rest (0).
Mark mark_v 0–255 255 Brightness of the highlight. Its value modulo 3 picks pink, green or grey chroma. Only active with highlight.
Show chroma show_chroma on/off off Shows the chroma planes in the motion map. Only active with motion map.
Spot removing
Difference P1 / P2 p1 / p2 0–255 24 / 12 P1 starts a spot, P2 lets neighbouring pixels join it. Values use the 8-bit scale at every bit depth.
max Dimensions w/h pwidth / pheight 0–32000 16 / 5 Spots larger than this are kept.
ranked ranked on/off on Compares against the minimum and maximum of three pixels in the previous and next frame (six points) instead of two points.
Remove sign any spots and outliers, only light spots and outliers, only light spots, only dark spots and outliers, only dark spots and any outliers any spots and outliers Which kind of spots are removed.
Limit min/max minpts / maxpts 0–10000000 0 / 0 Minimum and maximum number of pixels per spot. 0 means no limit.
Relative p1percent 0–100 10 Minimum percentage of high-contrast pixels in a spot.
Dilate dilate 0–1000 1 Grows the detected spots before they are replaced.
fit luma fitluma on/off off Adjusts the luma of the replacement to the surroundings.
Blur blur 0–4 1 Blur used for the replacement.
Temporal smooth tsmooth 0–255 0 Temporal smoothing of the replacement. 0 is off, 4–8 are useful values.
Segment removing method seg 0–2 2 0 removes spot pixels that do not overlap motion (strongest). 1 removes line segments. 2 removes whole spots (safest).
Color correction color on/off off Sets chroma at removed spots to the mean of three frames.

Example

Default settings on a 10-bit YUV 4:2:0 source. DeSpot accepts the format directly, so Hybrid adds no conversion:

# despotting using DeSpot
DeSpot(median=false,interlaced=false)

How Hybrid calls it

  • Hybrid loads despot.dll and calls DeSpot().
  • The plugin accepts planar YUV at 8–16 bit (4:2:0, 4:2:2, 4:4:4), YV411 and grey. Other formats (RGB, YUY2, float) are converted first.
  • Parameters are only written when they differ from the default. interlaced is always written (true when the scan type is not progressive); interlaced input is processed field by field.
  • Spot removing mode writes median=false and the changed spot parameters. Median mode writes median=true and only the motion and show parameters.
  • mark_v is only written with Show set to highlight, show_chroma only with motion map.
  • The filter uses the frames n−2 to n+2 and runs on the CPU.
  • DeSpot also offers the common options and can be added to the filter queue several times.

Background

This DeSpot is a port of Fizick's DeSpot 3.6.3 (version 3.7.0). It builds on Kevin Atkinson's conditional temporal median. One binary serves AviSynth and VapourSynth. Hybrid's defaults equal the plugin defaults. Hybrid does not offer the multi-pass count of the VapourSynth page, nor the parameters for an external mask, an output file, motion compensation and the maximum spot sizes.

See also: Vapoursynth DeSpot

Sources

  • DeSpot (README)
  • Hybrid's tooltips
  • The AviSynth+ documentation does not cover DeSpot.