Antiflicker Filter for Virtual Dub
Version A.2.0 reworked by :

Alessandro Malanca, June 02, 2002
(C) Copyright 2002-2004, All Rights Reserved

[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 a program called Notepad available in
its search path.]


PROCESSING Phase :
-----------------

1. Load the processing filter.

2. Specify the file you have just create in prepare mode. You will se your 
previous setup, and a suggested windows size to apply.

7. Set the windows parameters and the adjusting thresold. If you set the 
Display Correction button youwill see on the video pane the values applied 
for the correction. Obviously you must disable when saving the output video.

8. Use the VirtualDub timeline |< button to rewind to the start of the clip.

9. Play the video to see the filtered result. You can rewind and replay if you
want, or rewind and then Save AVI. You can also freely move around on the
timeline in "Process video" mode.

10. You can change the parameters and see the resulting video without re-executing
the processing phase.


The following options are available:
------------------------------------


Suggested window size:
this is a suggestion for the processing phase, it is calculated during prepare 
phase and stored in the file.

Open...: 
this is the input file for the correction process. It must have been previously 
saved in a prepare phase.

Window size: 
This is the size of the moving average of frame luminance values.
This produces the luminance value that frames are adjusted to. The idea is that
you want it as small as possible while still removing flicker. Ideally, it is 
equal to the number of frames that one flicker peirod spans. For example, if 
the video frame rate is 25 fps and the flicker is at 7 fps (example of 18 fps 
shot at 25 fps; 25 -18 = 7), then one flicker period is 25/7 = 3.57 frames. 
We want our window to exactly cover an integral number of flicker cycles. 
So a good choice here would be a window size of 7 (~ 2 * 3.57). You can always 
set a long window size if in doubt, but doing so will spread out luminance 
changes in the clip. A window size of 25 is a good general-purpose compromise.

Softening: 
This is the threshold for the final temporal softening phase. Often, the
physical process that creates the flicker also creates within-frame illumination 
changes, causing adjacent frames to differ. This softening phase greatly reduces 
this effect. A higher number causes greater temporal softening but can leave motion 
trails. If the physical process does not produce within-frame changes, this phase 
can be disabled by setting the softening to 0.

Max Adaption: 
This parameters is used to disable the averaging process when the
luminance scene changes goes above a given thresold. Suppose you set it to 10%,
if the luminance gap between to subsequent frames (or fields) is above 10%, 
the averaging process is disabled.

Display Correction values: 
if you check this, you will see the value of the correction for each frame 
( or field ).


Technical notes. 
----------------
The first phase of the filter simply save an indicator of the global luminance
for each frame or field (for interlaced video).
The second phase of the filter performs a moving average over the video and 
rescales the pixels in the frames to approach this average. It applies a 
temporal softening too.

Thanks to Niels Basjes for suggesting the creation of this filter, providing
test files, and giving valuable feedback. The final temporal softening phase
is adapted from code by Steven Don. Thanks to Jeff Gonion for valuable
theoretical discussions on digital filtering. 


This version has been reworked by :

Alessandro Malanca, June 02, 2002
(C) Copyright 2002-2004, All Rights Reserved
http://web.tiscali.it/minomala/index.htm

Filters for VirtualDub

Donald Graft, March 30, 2002
(C) Copyright 2000-2002, All Rights Reserved
http://sauron.mordor.net/dgraft/index.html