Antiflicker Filter for Virtual Dub - Version 2.0 [ Process phase ]

[Place this text file in the VirtualDub plugins directory]
© Alessandro Malanca - Jul / 2002


When video at one frame rate is projected and then recorded from the projection screen at a different frame rate, a temporal moire pattern, or flicker, is produced. This filter removes the flicker, thereby making this a viable process. For example, it becomes feasible to project 18 fps films and record them with a 25 fps PAL camcorder.

The filtering is realised using two different filters: DeflPrep e DeflProc.

The first filter DeflPrep is used to pr process the video and saves its work in a given file. The second DeflProc, opens the file prepared by DeflPrep and apply the corrections to the video.


Processing Phase

Here is the step-by-step process :

  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.
  3. 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.
  4. Use the VirtualDub timeline < button to rewind to the start of the clip.
  5. 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.
  6. You can change the parameters and see the resulting video without re-executing the processing phase.

Processing Parameters

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, setting the softening to 0 can disable this phase. I suggest you NOT to use it for interlaced sources because it doesn't care of fields.

Max Adaption:

This parameter 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 Me, Donald Graft and 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.


Filters for VirtualDub :
Donald Graft, March 30, 2002
(C) Copyright 2000-2002, All Rights Reserved
http://sauron.mordor.net/dgraft/index.html
This version has been reworked by :
Alessandro Malanca, June 19, 2002
(C) Copyright 2002-2004, All Rights Reserved