QCleaner - a noise-filter for Avisynth,
which examines pixel-movement

Date: May, 3rd 2004


QCleaner (QCleaner-20 / QCleaner-25) is a noise-filter, that examines pixelmovement in order to decide whether a pixel is to be considered as noise or not.

For now it is very very slow (see above), it doesn't smooth as much as other denoisers do (and doesn't improove compressibility as much), but it keeps a maximal amount of detail and contrast.

QCleaner is useful for better videos that are to be handled carefully. Even high-quality DV-material can possibly be improoved by this filter.

Restrictions:
Height and Width of the video must be devidable by 16 (only SSE-Version).
-------------------------------------------------------------------------------------------------------------
Parameter:

QCleaner(clip, temp_precision, motion_depth, method, spat_precision, spat_depth, threshold)

in detail:

temp_precision is the maximal difference between two areas to be considered as equal. 20 seems to be a good value. Less values result in less smoothing; higher values may lead to artifacts.
(default: 20)

motion_depth is the radius to search for pixel-motion. A value of 5 or 6 seems to me to be suitable, but it affects the working speed directly! On the other hand it has to be considered that even slow motion can lead to a position-change of 5 pixels (or more) per field.
The SSE-version of this filter has an automatic adaption of this parameter to the Contents of the Movie, what means: If a value of 5 is given to this filter it works with a maximum of 6.
(default: 5)

method means the following:
0 calculates each line in the frame.
1 calculates only 1 field per frame in an alternating manner (top field in Frame 0, bottom bield in frame 1, etc.)
2 like 1, but reverse field-order
(default: 0)

spat_precision is the maximal difference of a surrounding pixel to the actual pixel (intra frame) to consider it to be equal.
The spatial engine of this filter acts before the temporal does. That means, that a spatial corrected pixel is NOT examined by the temporal one. So the filter can be speed up by encreasing this value, but be careful, because it can lead to artifacts.
(default: 3)

spat_depth ist the minimal number of equal surrounding pixels (intra frame) to prevent the actual pixel from being smoothed.
(default: 5)

threshold is the maximal amount of change for each pixel. This ist only for security and can mostly be set to the maximum value (255).
(default: 255)
-------------------------------------------------------------------------------------------------------------
For interlaced material I suggest the following script:

        Bob().QCleaner(20,5,1).SeparateFields().SelectEvery(4,0,3)

(If only a green picture is seen you should either select the other fields ( SelectEvery(4,1,2) ) or change the method to 2: QCleaner(20,5,2). In doubt try out which solution results in the correct field order.)

Whith this script I achieve a speed of 1 frame per second (720x576 pixel; without SSE: 0,4 frames per second); method 0 is only half as fast and leads to the same result (quality). My computer is an AMD XP 2400.

It ist possible to put 2 instances of the filter in a chain (which indeed is a good idea), but in this case you have to choose method 0 for the first instance. This encreases compressabillity, but it is 3 times as slow as the script above.
If you are a perfectionist, you should choose small values for temp_precision (10 - 15) and spat_precision (2 - 3).

      Bob().QCleaner(20,5,0).QCleaner(20,5,1).SeparateFields().SelectEvery(4,0,3)

email: georg@gero-net.de