Smart Smoother High Quality

V 2.11
Plugin for Avery Lee's Virtual Dub by Klaus Post.

Introduction:

This filter performs smoothing on video material to eliminate noise and MPEG artefacts. This filter makes it possible to blur out noise and still retain a fair amount of detail. Rewritten on basis of Smart Smooth 1.1 by Donald Graft. This implementation has been made to supplement the original Smart Smoother by producing better results on ordinary video.

Download:

[Download binaries] v2.11 (Athlon MMX optimized)
[Download binaries] v2.11 (K6-III, P3, P4 MMX version)
[Download binaries] v2.11 (No MMX version)
[Download source code] v2.11 (MSVC 6 + preprocessor pack 5).

Installation:

Virtual Dub / NanDub

Unzip (Using WinZip, WinRar or Windows Commander) into the plugin directory of your Virtual Dub / Nandub installation. Then the filter will show up in the filters menu.

AviSynth

Use the VirtualDub Filters Import File. If you know how to use AviSynth, you'll know how to use this :)
For a more updated version it might be necessary to search Doom9's forums.

If you won't be bothered by getting this script here is a sample script (thanks Acaila):

##########################################
# Smart Smoother HiQ by Klaus Post, v2.1 #
#                                        #
# diameter (3-13, odd),                  #
# threshold (1-200), amount (1-254)      #
# difference (0-50)                      #
# mode = "average" or "weighted"         #
# weighted_difference = weigh with diff. #
##########################################

function VD_SmartSmoothHiQ(clip, int "diameter", int "threshold", int "amount", string "mode",
   \  bool "grayscale", bool "weighted_difference", int "maintain_diffweight")

{
  LoadVirtualdubPlugin(VirtualDub_plugin_directory+"\SmoothHiQ.vdf", "_VD_SmartSmoothHiQ")
  mode = default(mode, "weighted")
  mode = (mode=="average") ? 0 : (mode=="weighted") ? 1 : -1 
  Assert(mode>=0, """VD_SmartSmoothHiQ: "mode" parameter must be "average" or "weighted"""")
  return clip._VD_SmartSmoothHiQ(default(diameter,5), default(threshold,50), 0, default(amount,254),
   \  mode, default(grayscale,false)?1:0, default(weighted_difference,true)?1:0, default(maintain_diffweight,0))
}

# example:
# ConvertToRGB()
# VD_SmartSmoothHiQ(5,50,254,"weighted")
# ConvertToYUY2()

How it works:

The filter settings looks like this:
The GUI

The filter works in two modes, that performs the same tasks. You have to define a diameter on which the filter operates. The bigger the diameter the bigger is the areas that may be blurred. Bigger diameters usually means better results - but at the cost of speed. 5 or 7 is recommended.

You also have to define a threshold. The threshold is an indication of how close the color of the pixels must be to be blended together. If the difference between the pixels are bigger that the threshold, they will not influence eachother. The threshold can be tested in either seperate colors or greyscale. In most cases you should use use color (by not enabling grayscale). But if your source has bad colors (from VHS or similar), you can use this mode to blend different colors better. Color and Greyscale tests are equally fast - color perhaps even very slightly faster.

The filter processes the pixels in a diamond shape, to avoid blurring areas that are not connected.
The window around a pixel P
The window (diameter:5) around a pixel P. The arrows show how the filter progresses. If the pixel with the arrow doesn't clear the threshold the filter will not progress beyond it.

Furthermore in pixels are weighed by distance to the current pixel in Weighed average mode. The further the tested pixel is away from the current pixel the less influence it has on the current pixel.
The window around a pixel P
How much influence the pixels have in Weighed Average mode in a 5 diameter window.

Average Pixels:

Works almost similar to Donald Graft's Smart Smoother, except from the diamond check (described above) that should prevent some color blending on big diameters. Great for cartoons since it creates very evenly colored areas.

An example:
Original image Processed image
In this example all MPEG artifacts are removed while still retaining a clear image.

This mode has a Weighed with difference option, that preserved more structure. The theory behind this mode is, that even if a pixel passes under the threshold it will have less influence on the current pixel, depending on how close it is to reaching the threshold. This preserves more structure, while still smoothing out more evenly colored pixels.

Weighed with difference can be varied by using the Maintain Diffweight slider. This slider turns off "Weighted with difference" when the difference is below this threshold. This makes it possible to heavily blur soft noise on evenly colored surfaces.

Weighed average

Weighed average is more aimed at video sources - trying to provide a better solution for video sources. There are several new thing in this mode. First of all the blur does not produce even-colored surfaces. This happens since the actual pixel is less influenced by pixels far away. The further away the pixel - the less influence - even though it passes the threshold. This will ensure that shading (from one color to another) will be much more smooth that simple averaging.

There is two additional options. Most important is Weighed with difference. This mode adds a further weighing into the equation. The closer the color of the pixel is to the current one, the more it will be blended into the current pixel. That also means that the closer the difference is to the threshold, the less influence will it have on the current pixel. That means that almost identical pixels (usually due to noise/quantization errors) are blended much more (and thereby reduced) than pixels with greater differences. Weighed with difference has almost no perfomance impact.

An Example:
Original image Processed image
Weighed with difference - Threshold 30 - Diameter 7. Amount 254.

The second option available in this mode is Amount. It controls how much influence the filter maximum may have. This can be used for letter greater amount of detail do through while still maintaining a big threshold. A value of 128 ensures that the original pixel will always have at least 50% influence on the final pixel. This also has no impact on performance.

There is an option to Visualize Blur (thanks to Leuf for the idea), that shows how much the different parts of the image is blurred. This is very excellent for adjusting parameters.

An Example:
Original Picture Visualized blur
In pure white areas, the image is blurred to its maximum. In black areas there is no blurring at all.

Comparison:

This is an example to show the differences between the filter modes. Please note that the result is excaggerated - and that the filter is capable of increasing or decreasing the amount it blurs in all modes.
Original image
Original image

Average pixels
Average Pixels

Average pixels & Weighed with difference
Average Pixels & Weighed with difference

Weighed average
Weighed average

Weighed average & Weighed with difference
Weighed average & Weighed with difference

Notes:

Todo:

(Not ordered by importance - mail me if you have other requests or feel one area needs to have my full attention.)

History:

V2.11

V2.1

V2.01

V2.0

V1.1

V1.0

Download older versions:

[Download binaries] v2.01 (Athlon MMX optimized) (contains known bug)
[Download binaries] v2.01 (K6-III, P3, P4 MMX version) (contains known bug)
[Download binaries] v2.01 (No MMX version)
[Download source code] v2.0 (MSVC 6 + preprocessor pack 5). (contains known bug)

v1.1

[Download binaries] v1.1
[Download source code] v1.1

Other

Special thanks to Thomas Daniel for excellent feedback and help!

Also thanks to: Leuf, dividee, Acaila, TT, _Outpinged, -h, poopety poop, Rudolf Groß, Tøsen, VIC, Christian Senft, Avery Lee & Donald Graft for help, support, suggestions and other stuff this couldn't have been done without.

Contact

Contact Klaus Post at kp@interact.dk for bugs, suggestions, comments, etc...

New versions of the filter should be downloadable from Donald Graft's filter page.