2D Cleaner (Optimized)
(Version 0.7)

[Place this text file in the VirtualDub plugins directory to make it available via the Help button on the filter configuration dialog box. The computer must have an HTML browser, such as Internet Explorer or Netscape, available in its search path.]

Original Help Text by Jim Casaburi

This filter averages pixels in a configurable radius around a source pixel that are within a configurable threshold of the central pixel. This has the effect of blending low-level video noise while retaining sharp details.

The options available for the filter are a threshold value, a "show sharp edges" option, an interlaced option, and a configurable radius around the source pixel.

Threshold can be anywhere from 0 to 255, and defines the maximum difference between a source pixel and a surrounding pixel in which the program will attempt to average the source pixel with the surrounding pixels. Higher thresholds blend more. I highly recommend experimenting with different values to find the perfect match of removing noise and retaining details.

The Show sharp edges option, inspired by Donald Graft's equivalent feature in his Smart Deinterlacer, will show as black any pixel such that less than half of the pixels in its configured window (defined by configured radii) are included in the averaging (i.e., are within threshold of the center pixel). This is useful for being able to see what pixels are passing through the threshold without being blended (as much). Do NOT leave this option on when you are actually converting your files! (Note: this setting is NOT saved for batch operations or when you save processing settings, since this option is meant only for "debugging" one's settings.)

The Interlaced video option when checked processes the video as if it were interlaced. This means there is no attempt made to blend between even and odd scanlines. This keeps interlaced motion intact for those who are targeting full resolution interlaced video sources such as interlaced MPEG-2. If the video file you are dealing with is not interlaced do not enable this function.

The Radii options define the area around the source that will be considered by the filter. The bigger the radius, the better the noise reduction can be, however, the filter slows down geometrically the larger the radius is made. A radius of 1 pixel means that the filter is doing 3x3 filtering for every pixel. A radius of 5 pixels means that the filter is doing 11x11 filtering for every pixel.

Additional Notes by Jaan Kalda/Donald Graft

Warning! This version of the 2D Cleaner is optimized for, and will only work on, Athlon, PIII and P4, because it makes use of pmaxub and pminub instructions.

The filter now allows the radii to be set independently for the X and Y axes. This might be useful, for example, when your capture is set for half resolution in one axis. You can also set a radius of zero to disable blending for that axis (but you can't set both radii to 0). The settings for the radii must adhere to the following constraints:

  1. X and Y cannot both be 0.
  2. X <= 10 and Y <= 10.
  3. (2 * X + 1) * (2 * Y + 1) <= 121

There is one functional difference in the averaging compared to the original filter: a pixel will not be included into the averaging if any of its color components (RGB) is beyond the threshold. In the original filter, only the relevant color channel would not participate. (The original filter is arguably wrong in this regard, but it may have produced some gentle blending of features that could be useful for reducing mosquito noise when used as a pre-processor for DCT block-based encodings. It is recommended to use a gentle 3x3 blur for such applications.)

Important warning! Due to the way that this optimized filter uses global variables, you can place only one instance of it in the filter chain.

Finally, a help button was added and active filter preview was implemented.