Contents

Introduction

Features

Performance

Configuration

Installation

Requirements

Registration

License

Contact information


Introduction

SpotRemover

Version 3.2.01 (Jan. 03, 2003)

What is this filter for?

This filter performs smoothing of the video material in time.
That means it does no smoothing across neighboring pixels.

I think this is quite reasonable, because the main source of the video noise is the electrical/thermal oscillations in time.

The reason why there are still so many filters that smooth the video in 2D is because smoothing in time can result in a well-known effect of the motion blur. SpotRemover attempts to overcome this problem.

I should acknowledge that the idea of the smoothing routine is borrowed from the temporal smoother filter of Avery Lee. And I am grateful to him for the best program for processing video, the VirtualDub.

However, I have completely redesigned the algorithm and made it more flexible.

Besides the time smoothing, SpotRemover has several other functions.

After the smoothing, the intensity and/or color can be dynamically locked in order to help the subsequent MPEG compression. This is similar to what the PicFix filter does (made by Gabest). But in SpotRemover, this is implemented more precisely and results in no artifacts during a slow intensity change (like panning over the sky).

Next, SpotRemover can enhance colors (brightness, contrast, saturation, and color shifts) on the fly with no effect on the final processing speed.

And finally (and this is the main purpose of the filter), this filter removes spots and scratches, which are always present in the movies made from old films. As long as the movies are shot on the films, you always have these annoying little blots.

See also:

Features


Features

Besides its four main functions, SpotRemover has the following useful features:

  • Almost all parameters of the algorithm can be configured.

  • Full configuration can be saved and restored using VirtualDub's built-in commands (Load/Save processing settings). This also supports Job control for batch processing.

  • Support for script files to allow precise control over the spot detection.

  • High performance.

  • Comprehensive help system with context sensitive pop-up tips.


Performance

How about the processing speed ?

SpotRemover was programmed with the performance in mind.
Its core is written fully in assembly language and works only because of the MMX and SSE.
It was optimized for the Pentium III architecture and on my PIII-500 it does about 5 frames/second for a 640x480 frame size.

Some of the optimizations include:

1) Use of MMX and integer SSE extensions.

2) Minimal use of conditional jumps to avoid branch mispredictions. The core routine (smoothing, locking, spot detection, filtering, marking, and color adjustments) uses only about a dozen of jumps!

3) Compact allocation of data to minimize cache misses.

4) Instruction reordering and resizing to optimize the instruction fetching and decoding.

See also:

Requirements


Installation

1) Copy the files SpotRemover.dll and SpotRemover.chm to the VirtualDub's plugins folder.

2) Start VirtualDub.

3) Select the Filters command in Video menu, and click Add button.

4) Select SpotRemover from the list of filters.

5) If you need, adjust the configurable parameters.
A brief reference about any parameter is available if you click on the question mark on the configuration window title and then click on the parameter of interest, or just press the F1 key.
Click on the Help button for detailed instructions.

6) You can also use cropping to take out black areas at the edges, but keep in mind that SpotRemover will process only even frame dimensions.

See also:

Requirements


Requirements

SpotRemover requires VirtualDub v.1.4 or higher.

OS:
Windows 98 or higher, or Windows NT 4.0 or higher.

CPU:
Currently, the filter requires MMX and SSE (that means it will not work on Pentium II or below, sorry). If you really need to run SpotRemover on a CPU without SSE, let me know and I might consider replacing the SSE code with MMX instructions.

Memory:
To implement the time smoothing, SpotRemover allocates a huge buffer in memory, which typically takes about 20 Mb, but can be as large as 37 Mb. This means that you may experience serious performance problems if your PC has less than 64 Mb of physical RAM installed.

SpotRemover will work correctly only with even width and height of the input frame.


Configuration

Smoothing

Intensity locking

Color adjustments

Spot detection

Motion detection

Scripts

Other options


Smoothing parameters

Kernel width.

As the smoothing is done in time, this is the width of the smoothing kernel in time. Can be any odd number from 5 to 15. (Other numbers are impossible because of the structure of the algorithm and the speed optimizations)
Smaller number saves the processing time. Higher number makes the smoothing more accurate (from the math point of view), but it does not smooth stronger and does not result in "motion blur". That is because this parameter means the maximal kernel width, while the actual kernel is dynamically reduced if a scene change is detected.
So, don't worry about blurred motion even if you set 15. Such an effect will appear if you set too high the smooth strength.
Set 13 or 15 for high noise video. Set 5 or 7 for faster processing or debugging with preview.

Intensity smooth strength.

The smoothing is made as the weighed average. That means, for a current pixel in time, its intensity is compared to the intensities of all the other pixels in the kernel. The smaller is the difference the more weight is assigned to the corresponding pixel. If all pixels have the same intensity difference with the current pixel then all of them are assigned the same weight.
The smoothing strength defines the effective width on intensity scale for the weights assignment.
If you process a video with high noise (e.g. VHS source), set this parameter to 9 or higher.
Do not set it too high, otherwise you may get the edges of moving objects blurred, particularly in low contrast scenes.

Correction for color smooth strength.

Color components of the pixel can be smoothed with a different strength than the intensity. I noticed that normally it is better to reduce the smooth strength for the color. You can achieve this by making this parameter negative.
Note that this number is not simply added to the "Intensity smooth strength".
If you use an even number for the "Intensity smooth strength" then the correction for color smoothing can not be less than -5 (-4 for MMX_only version).
Otherwise it can not be less than -10. This condition arises from the speed optimizations.


Color adjustments

Brightness, Contrast, Saturation.

These sliders allow for the corresponding adjustments without sacrificing of the processing speed.
That's because the parameters are embedded into the matrix for YUV->RGB transformation, so it does not matter for the speed whether you ask for color correction or not.

Note that the contrast slider affects the contrast of the intensity component only, while the color contrast is adjusted by Saturation slider.
Setting 100% will double the contrast/brightness/saturation, while setting -100% will halve the corresponding parameter.

Shift Red, Shift Blue.

The following table may help you understand how the color shifts work:

 |  | Shift Red
 |  | - | 0 | +
Shift Blue | - | Strong green | Soft green | Yellow
 | 0 | Bluish green | Neutral | Red
 | + | Light Blue | Purple | Pink

For example, you want to reduce the yellow tint in the source video, then you need to shift from the cell Yellow to Neutral. That is, you have to set Shift Red to negative and Shift Blue to positive.


Intensity locking

Max level to lock intensity.

After smoothing in time, the intensity is stabilized around a certain level. With this parameter, you can lock the intensity at that level suppressing any small variations in time. This greatly simplifies the subsequent MPEG compression resulting in smaller size of the compressed video. This parameter sets the maximal level of variation that allows the pixel intensity to be locked.
Set this to zero to disable this feature.
Typical range is 1...5. Too high values may blur moving objects with very low contrast.

Max level to lock color.

Defines the maximal level of color variation that allows the color components to become locked.

Debug locking.

If you check this option, the locked pixels will be highlighted.
Pixels with only locked intensity will have a fixed intensity of 80% (almost white) and unchanged color.
Pixels with only locked color will have pink color and unchanged intensity.
Fully locked pixels will be colored light pink.
This system helps finding the optimal intensity and color levels for locking and smoothing.
If only one color channel is locked then the pink tint will have only red or blue component respectively.


Spot detection

Level for spot detection.

This number defines a threshold of the intensity change for a pixel to be considered as a false intensity jump. If this happens then that pixel becomes a candidate for a spot, which will then be removed. The larger is this number, the smaller will be the spot detection sensitivity meaning that only very distinct spots will be detected.
Typical range is for this parameter is 20...35

Level for spot clearance.

When the spot is detected, the pixels on its perimeter are checked to be different enough from the intensity in the spot.
This parameter defines the threshold for such comparison. If the intensity difference is smaller than the threshold the pixel is counted as bad.
Normally this parameter is about 2/3 of Level for spot detection.
Set it lower for easier spot detection.

Required perimeter clearance.

This factor defines a relative amount of bad pixels in the perimeter.
Spots without perimeter clearance are ignored.
Can be from 0 to 32.
Zero means absolute perimeter clearance, without bad pixels.
Set it higher for easier detection of spots over uneven backgrounds.

Spot fullness factor.

The larger is this number, the more pixels with intensity jumps are required in the spot. Smaller values allow for thin spots like scratches, hairs etc. If you process cartoons set this number higher than 20; otherwise some thin lines of the video contents may become identified as spots.
Can be from 0 to 32.


Motion detection

Motion distances X, Y.

These parameters specify the threshold distances (horizontal and vertical) between two detected spots from two adjacent frames. If these spots are closer than the threshold, then the pair (and the subsequent spots, if any) will be identified as a moving object.
The history of the spot's motion can have single missing frames, where the spot was not detected.
The distance are specified as a percentage of the frame size.
Set these distances smaller if you often have two spots from two subsequent frames that appear rather close to each other. This will make the spot removal easier.
Set them higher if you process cartoons and expect to have high motion scenes.

Motion table size X, Y.

Motion table is an additional mechanism that prevents the removal of spots being parts of moving objects. The spot removal is inhibited in areas of the image with a fast variation of the average intensity.
The frame is divided on a table of cells with X columns and Y rows, and the average intensity in each cell is monitored in time.
The motion table can have no more than 24 columns and 18 rows.

Motion table threshold.

If the change of the average intensity in a cell of the motion table exceeds this threshold then that cell is flagged as a cell with motion, and all spots in that cell will be ignored (i.e. not removed).
Set it higher to reduce motion sensitivity and remove more spots.


Script files

SpotRemover accepts script files to allow manual control of the spot detection and/or removal. The format of the script file is very simple. Each line of the file can be in the form of

Frame Mode X1 X2 Y1 Y2

or

FromFrame-ToFrame Mode X1 X2 Y1 Y2

where
Frame is the ordinal number of the processed frame of the input video file, assuming the first frame number in the file to be 0. (i.e. the number you see in the VirtualDub's status line)
FromFrame-ToFrame defines a range of frames which are to be processed with the same parameters.
X1 X2 Y1 Y2 define a rectangle within the frame to process. X=0, Y=0 point is in the lower left corner of the screen.
Mode can be one of the following:
P | forces removal of a spot with coordinates (X1,X2,Y1,Y2) by replacing its contents with the data of the Previous frame; has higher priority than the motion table;
N | same but the data are taken from the Next frame;
M | defines a rectangle with Motion and thus disables spot removal within that area; has lower priority than P- and N-modes;
C | all detected spots are Cleared because this disables spot filtering with motion detection, perimeter clearance and spot fullness; has higher priority than M-mode. X1 X2 Y1 Y2 are ignored (if any).
The following modes have effect from this frame forward:
L | Set the Motion Table Threshold two times Lower. X1 X2 Y1 Y2 are ignored (if any).
H | Set the Motion Table Threshold two times Higher. X1 X2 Y1 Y2 are ignored (if any).
B | Change Brightness controls (see example below). Accepts from 1 to 5 parameters. Controls that correspond to the missing parameters are not changed. The changes take place two frames earlier than specified.
S | Change Spot detection controls (see example below). Accepts from 1 to 5 parameters. Controls that correspond to the missing parameters are not changed.

Examples:

120-131 c | Clear all detected spots in all frames from 120 to 131
135-136 m 0 50 0 50 | Force Motion and keep all detected spots on frames 135,136 in the rectangle (0,50,0,50)
137 p 10 30 20 40 | Copy data from the rectangle (10,30,20,40) on frame 136 to the same rectangle on frame 137
138 p 10 30 20 40 | Copy data from frame 137 (i.e. those from frame 136) to the same rectangle on frame 138
138 n 50 50 70 60 | Copy data from frame 139 to the frame 138
138 b +15 -5 +10 0 7 | will increase brightness by 15, will reduce contrast by 5, will increase saturation by 10, will not change Shift Red and will increase Shift Blue by 7. Changes take place since frame 136.
141-160 b -5 | will decrease brightness by 5%, for each frame from 139 to 158 (fade out effect)
138 s 26 16 5 6 10 | will set new parameters for spot removal: Level for spot detection = 26, Level for spot clearance = 16, Required perimeter clearance = 5, Motion table threshold = 6, Spot fullness factor = 10. Changes take place since frame 138.

Note:

A frame number can be repeated on several subsequent lines with same or different modes. In this case, however, the C-mode should precede the others (if any).

The frame numbers in your script file are also good for processing a part of you movie.

Script file is always read forward. If you need to step back in your source file when previewing the output (i.e. pressing Alt-LeftArrow) make sure you reset the filter by opening the "Filters" dialog.

Limitations:

  • Higher frame numbers must not precede the lower ones.
  • Frame ranges must not overlap.
  • It is not recommended to use the N-mode (take from Next) for two or more subsequent frames and the same X1 X2 Y1 Y2. That means you can not replace data on the frame iwith data from the frame i+2.


Other options

Debug spot removal

If you check this option, the spots will not be removed but enclosed in rectangles. Red rectangles mark the spots that are subject for removal. Blue rectangles mark the spots that were detected but identified as moving objects. Those spots that were detected but have no perimeter clearance or area fullness are not marked.
Also, this mode will highlight those cells from the motion table where the motion threshold is exceeded.

Preview

When using the Preview button, keep in mind that there is a large time lag between the input frame and the output. It equals ( Kernel-1)/2+5 frames.
Note, that the time lag does not affect the sync to audio in the output file.


Registration

Why register?

SpotRemover is distributed as shareware (See License Agreement). You can use it for evaluation purposes only, during unlimited time period.

However, I encourage you to register and can give 5 reasons why:

1) You will reward my efforts in programming and optimizing this filter.

2) You will get free upgrades for the same major version.

3) You will get the technical support.

4) You will get the fully functional version.

5) And it's cheap and quick. The registration fee is only $20 and is easily processed on secure web server of

Pay me securely with your Visa, MasterCard, Discover, or American Express card through PayPal!
or Kagi - Premiere e-commerce service established in 1994

How to register

See also:

Full version vs Shareware


How to register

You need to do just 3 quick steps.

1) Click on the About button and copy your Registration Key to clipboard.

2) Send me an E-mail with your Registration Key in the subject line.

3) Go to
PayPal - Recognized transaction processor with over 20 million members worldwide
and pay $20 (U.S.) to konstant@freeshell.org 		or You can purchase SpotRemover from
Kagi - Premiere e-commerce service established in 1994

As soon as I receive your payment notification from PayPal or Kagi, I will send you the full version by E-mail.

If you can not (or would not) use PayPal nor Kagi, please contact me so that I can find another way of payment.

See also:

Full version vs Shareware

Registration


Full version versus Shareware

Shareware | Full version
24 spots per frame | 96 spots per frame
Limited length of processed video | No limitation
Limited configuration controls | Full control
No script file support | Script file support
Standard performance | More speed optimizations
Limited documentation | Expanded documentation
No technical support | Technical support by E-mail and Free upgrades for the same major version

See also: Registration


License Agreement

1. SpotRemover is a shareware program product, as described in this license agreement.

2. The unregistered version of SpotRemover may be freely distributed provided that distribution package is not modified. No person or company may charge a fee for the distribution SpotRemover without written permission from the copyright holder.

3. The author, Konstantin Khlopenkov, exclusively owns all copyrights to SpotRemover. Anyone may use this software for evaluation purposes only, during unlimited time period. If you wish to use SpotRemover for any other purpose, you must register.

4. Once registered, the user is granted a non-exclusive license to use SpotRemover on one computer, for any legal purpose, at a time. The registered SpotRemover software may not be rented or leased, but may be permanently transferred to another computer. In this case you have to contact the author in order to update your registration information. The registered SpotRemover software is not a subject for any kind of refund.

5. To register you must follow the registration procedure as described in the registration section.

6. SpotRemover IS DISTRIBUTED "AS IS". NO WARRANTY OF ANY KIND IS EXPRESSED OR IMPLIED. YOU USE AT YOUR OWN RISK. THE AUTHOR WILL NOT BE LIABLE FOR DATA LOSS, DAMAGES, LOSS OF PROFITS OR ANY OTHER KIND OF LOSS WHILE USING OR MISUSING THIS SOFTWARE.

7. You may not use, copy, emulate, clone, rent, lease, sell, modify, decompose, disassemble, otherwise reverse engineer, or transfer the licensed program, or any subset of the licensed program, except as provided for in this agreement. Any such unauthorized use shall result in immediate and automatic termination of this license and may result in criminal and/or civil prosecution.

8. Installing and using SpotRemover means that you accept the terms and conditions in this license.

9. If you do not agree with the terms of this license you must delete SpotRemover files from your storage devices and stop using this product.

Thank you for using SpotRemover.

Konstantin Khlopenkov

© 2002 Konstantin Khlopenkov. All rights reserved.
http://konstant.freeshell.org
konstant@freeshell.org


Contact information

Konstantin Khlopenkov

www | http://konstant.freeshell.org
E-mail | konstant@freeshell.org (or khlopenkov@hotmail.com)


.topic 10024
Click here for Version and
Registration information

.topic 10017
Click here to locate you script file

.topic 10010
Turns on/off marking spots to be removed
with red color and moving spots with blue.
Also, cells with high motion are highlighted.

.topic 10001
Adjusts brightness, contrast, or saturation.
Processing speed is not affected.
The "contrast" slider adjust intensity contrast
while "saturation" means color contrast.

.topic 10002
Adjusts color shifts.
See main Help for details.

.topic 10019
Set it negative to reduce the strength
of smoothing for color components.

.topic 10011
Maximal horizontal shift for a spot
to be identified as a moving object.
Set it higher for high motion in cartoons.
Lower number will remove more spots.
Measured as percentage of frame size.

.topic 10012
Maximal vertical shift for a spot
to be identified as a moving object.
Set it higher for high motion in cartoons.
Lower number will remove more spots.
Measured as percentage of frame size.

.topic 10004
You won't regret clicking
on this useful button!

.topic 10020
A higher number will smooth more noise.
Affects both intensity and color components.
Set to 9 or higher for VHS source.

.topic 10005
Width of the smoothing kernel in time.
Higher number will smooth more accurately
but takes more time. Has almost no effect
on the strength of smoothing.

.topic 10006
Minimal difference between intensity in
the spot and a pixel on the perimeter for
the latter to fulfil the perimeter clearance.
Set it lower for easier spot detection.

.topic 10008
Maximal level of color variation that
allows color components to become locked.
Zero will disable color locking.

.topic 10009
Maximal level of intensity variation that
allows pixel intensity to become locked.
Zero will disable intensity locking.

.topic 10023
Turns on/off highlighting of locked pixels
for debugging purposes.

.topic 10007
Level of intensity jump for a pixel
to be identified as a pixel in spot.
Set it smaller for easier spot detection.

.topic 10013
Intensity threshold for a cell to
become flagged as a cell with motion,
suppressing the spot removal.
Set it higher to decrease motion
sensitivity and remove more spots.

.topic 10014
Ratio of "bad" pixels in the perimeter.
Set it higher for easier spot detection.
Zero will require absolute perimeter
clearance, without "bad" pixels.

.topic 10015
When using "Preview", remember about
the large time lag. (See main Help for details)

.topic 10016
Click on this button to restore the
default values for all parameters.

.topic 10018
Type in the name of your
script file with full path here.
Leave empty if not used.

.topic 10003
Larger number will require thick round spots.
Set it smaller to remove scratches, hairs etc.
Should be over 20 when processing cartoons.

.topic 10021
Amount of columns in the motion table.
Can range from 1 to 24

.topic 10022
Amount of rows in the motion table.
Can range from 1 to 18.