Scintilla's Guide to AVISynth Postprocessing Filters: Spatio-Temporal Smoothers
DeGrainMedian -
FFT3DFilter -
GoldDust -
HQDN3D -
LRemoveDust -
PixieDust
(
Home -
Spatial Smoothers -
Temporal Smoothers -
Sharpeners - Dealing with Dot Crawl -
Dealing with Rainbows
)
Intro
So, you've got your spatial smoothers, which denoise/smooth among the pixels in individual frames (smoothing across the
plane).
Then you've got your temporal smoothers, which smooth out differences between pixels in different frames (smoothing
across time). And then you've got spatio-temporal denoisers, which are basically a little from Column A and a little from
Column B: they do denoising/smoothing across both time AND space (therefore 3 dimensions). And why not? They can often
be highly effective.
DeGrainMedian
Meant ostensibly for grain removal but also useful for general denoising.
Type: Plugin
Found in file: DeGrainMedian.dll
Author: Fizick
Homepage:
http://avisynth.org.ru/degrain/degrainmedian.html
Colorspaces: YUY2 or YV12
Interlacing: Interlaced or progressive
Speed: Fast! (190+ fps)
Defaults: DeGrainMedian(limitY=4, limitUV=6, mode=1, interlaced=false)
Parameters:
- limitY (0-255) determines the maximum amount by which DeGrainMedian may change a pixel's luma value. If the luma
would have been changed by more than this value, it is changed by exactly this value instead. Higher values will increase
the strength of the denoising (but going too high may cause overblurring).
- limitUV (0-255) determines the maximum amount by which DeGrainMedian may change a pixel's chroma value.
Everything just said about limitY also applies here.
- mode (0-5) determines the filter's operation mode; all you need to know about it is that higher values will
weaken the smoothing. The higher you set mode, the higher you can usually safely set limitY and
limitUV.
- interlaced (true/false) should be set to true if your source is interlaced.
Usage notes:
- DeGrainMedian should be applied before other denoisers.
- DeGrainMedian can be stacked twice to good effect if the limits are low enough.
- limitUV can usually be safely set to higher values than limitY.
- If DeGrainMedian is oversmoothing your image, try a higher value of mode; if that doesn't work, reduce your
limitY and/or limitUV.
- Obviously, if your source is interlaced, be sure to set interlaced=true.
Back to top
FFT3DFilter
A denoiser that makes use of the Fast Fourier Transform (FFT). It can also be used for limited sharpening.
Type: Plugin
Found in file: FFT3DFilter.dll
Author: Fizick
Homepage:
http://avisynth.org.ru/fft3dfilter/fft3dfilter.html
Colorspaces: YUY2 or YV12
Interlacing: Progressive or interlaced
Speed: Slow (14 fps at default settings)
Defaults: FFT3DFilter(sigma=2.0, plane=0, bw=48, bh=48, bt=3, ow=16, oh=16, sharpen=0,
interlaced=false)
Parameters:
- sigma (any float > 0 ) indicates the noise level of the video. Increasing this value will strengthen the
denoising but may introduce oversmoothing or gridding artifacts.
- plane (0-4) determines what color planes the filter should process:
- plane=0 processes only the luma.
- plane=1 processes only the U chroma channel (the blue offset).
- plane=2 processes only the V chroma channel (the red offset).
- plane=3 processes both chroma channels.
- plane=4 processes all three channels (luma and chroma).
- bw and bh (any positive integers) determine the width and height respectively of the blocks to be used
for the transforms. Lowering these values will speed up the filter but may make gridding artifacts more likely; raising
them may improve denoising but will slow down the filter. Setting these too high or too low may make the filter useless;
Fizick recommends values from about 32 to 64.
- bt (-1 to 4) determines the nature of the temporal element of the filtering:
- bt=-1 does sharpening only without denoising, 2D only. (If you use this mode, make sure to specify
a value for the sharpen parameter; otherwise the filter will do nothing.)
- bt=0 does Kalman filtering that takes into account all previous frames, allowing for stronger noise
reduction than the Wiener modes.
- bt=1 does 2D Wiener filtering (spatial only).
- bt=2 does 3D Wiener filtering taking into account the previous frame.
- bt=3 does 3D Wiener filtering taking into account the previous frame and the next frame.
- bt=4 does 3D Wiener filtering taking into account the two previous frames and the next frame.
- ow and oh (any positive integers less than half of bw and bh respectively)
determine the overlap width and height for each block. Larger values will reduce gridding/blockiness/ringing but will
slow down the filter.
- sharpen (any float?) determines sharpening strength; by default this is set to 0, for no sharpening at all.
Fizick recommends values of about 0.3 to 1.0 if you want to sharpen; anything higher than about 2 is probably a bad idea.
Negative values will actually have the opposite effect, softening your edges (somewhat similar to UnFilter's behaviour).
- interlaced (true/false) should be set to true if your source video is interlaced.
Usage notes:
- If you encounter gridding artifacts, then try one or more of the following:
- Increase ow and/or oh
- Increase bw and/or bh
- Decrease sigma
- FFT3DFilter can also do sharpening in conjunction with denoising; if you wish to do so, set sharpen to something
higher than 0 (but keep in mind that this will counteract your compression gains somewhat).
If you only want it to do sharpening (no denoising), then set bt=-1 as well.
- Of course, if you encounter oversmoothing, then reduce sigma.
... Geez. Is there anything this filter can't do? On top of general denoising, it also combats mosquito noise and even removes dirt and spots. It's kind of like VagueDenoiser, except it uses the Fast Fourier Transform instead of
wavelet transforms and it works in 3D instead of just the spatial domain. This also means that even if you overdo the
smoothing, the effect usually isn't too bad -- an overdone FFT3DFilter is more of a blur than a washing-out (as opposed to,
say, Deen). Heck, on top of the denoising, it can even sharpen your image if you want.
I originally didn't think I would be posting any comparison frames on this page, but I found one for which the effect
was so striking that I simply had to. It's from Fushigi Yuugi: Eikou Den, episode 1, as filtered with
FFT3DFilter(sigma=3,bw=32,bh=32,ow=16,oh=16,plane=4)
(hover your mouse over the image to see the filtered version):
I think you'll agree that the difference is quite stunning; pick almost any mosquito noise on the original frame -- there's
plenty to choose from -- and watch it disappear in the filtered frame. Higher sigma values will pound the noise even
further into the ground, but often at the cost of harming other scenes by softening details.
Back to top
GoldDust
The "heavier" spatio-temporal filter from the Dust family, meant for maximum noise removal.
Type: Plugin
Found in file: DustV5.dll
Author: Steady
Homepage: None
Colorspaces: RGB24, RGB32, or YUY2 (note: NO YV12 SUPPORT)
Interlacing: Progressive only (I believe)
Speed: Slow to very slow (8-16 fps at default settings, depending on scene changes, crossfades, etc.)
Defaults: GoldDust(limit=8)
Parameters:
- limit (1-??) determines the maximum amount GoldDust can change each pixel by; if a pixel would have been changed by
more than this value, it is changed by exactly this value instead. Raising this value will
increase the strength of the smoothing (but may hurt details).
Usage notes:
- IMPORTANT: The Dust filters do NOT support YV12. This is because they were written for AVISynth 2.0.x, which
was incapable of working in the YV12 colorspace; a version for AVISynth 2.5.x was never coded.
If you try to feed GoldDust YV12 input, your application will suddenly quit without warning. Always convert to YUY2 first.
- IMPORTANT: The Dust filters do not autoload. Again, this is because they were written for AVISynth 2.0.x and
not 2.5.x.
To use them, you first have to load a plugin called LoadPluginEx2.dll (in a separate directory from your default
plugins directory, because it will break autoloading otherwise); I've taken care of this for you in an autoloading .AVSI
helper script. Then you manually load DustV5.dll by putting the following line before calling the filter:
LoadPlugin("C:\avs25\plugins\DustV5.dll") (of course, replace the path given
with the path to your AVISynth plugins directory).
- IMPORTANT: Do not call the Dust filters more than once in one script. This also means that if you use GoldDust
in a
script, you can't use SpaceDust, FaeryDust, or PixieDust in that same script.
- GoldDust should probably be used after cropping and resizing, but I'm not sure about this.
GoldDust is the "heavier", "not really very developed yet" filter from the Dust family of filters,
coded by Steady for AVISynth 2.0.x (a version for 2.5.x was never released).
All I know about its theory of operation is that it uses some kind of motion compensation.
According to Steady, it should provide the maximum noise removal of any of the Dust filters. It can certainly provide
some VERY handsome compressibility gains (some of the best I've seen from any single filter),
but this often will come at the expense of some details. However, such loss
can often be mitigated through use of the Repair filter, and in such a manner
as this:
input=last.ConvertToYV12()
LoadPlugin("C:\avs25\plugins\DustV5.dll")
ConvertToYUY2().GoldDust().ConvertToYV12()
Repair(last,input)
Repair is a very handy filter; the idea is to restore details to a filtered clip from the original while keeping the noise
filtered out. It really proves its usefulness with denoisers as strong as GoldDust, and the end result can often be very
nice indeed.
The number one complaint about the Dust filters is blockiness; Repair may help some with this, but if you
get this problem and you can't alleviate it, then you should probably switch to a different filter.
Back to top
HQDN3D
A 3D denoiser that targets high-frequency noise.
Type: Plugin
Found in file: hqdn3d.dll
Author: Loren Merritt after Daniel Moreno
Homepage:
http://akuvian.org/src/avisynth/hqdn3d/
Colorspaces: YV12 only
Interlacing: Progressive only (at least, it shouldn't be nearly as effective on field-based footage)
Speed: Average (65+ fps at default settings)
Defaults: HQDN3D(ls=4.0, cs=3.0, lt=6.0, ct=4.5)
Parameters:
- ls and cs (0-255 float) are the strengths of the spatial filtering on the luma and chroma respectively.
Increasing these values will improve the smoothing but may overblur; anything above about 10 is probably not a good idea.
- lt and ct (0-255 float) are the strengths of the temporal filtering on the luma and chroma respectively.
Increasing these values will improve the smoothing but may cause ghosting; anything above about 13 is probably not
a good idea.
Usage notes:
- If your image looks oversmoothed (watch especially for chroma bleeding!), reduce ls and cs;
if you notice ghosting/frame blending, reduce lt and ct. That's all there is to it.
HQDN3D stands for "High Quality Denoiser in 3D";
it claims to perform a "3-way low-pass filter" (which probably means some kind of wave transform is involved),
aimed at killing noise while keeping blending artifacts low. However, how well it succeeds at this depends on your
source and your settings; it seems to do better when the details are strong (by that I mean dark, well-defined edges).
It is a rather good denoiser and does not suffer from the blocking problems of PixieDust, which is reason enough to
give it a look. Also, it's faster than PixieDust, FFT3DFilter, Deen, etc. There's not much else to say about it.
Back to top
LRemoveDust
A scripted denoiser that uses the power of Kassandro's filters (RemoveGrain et al.).
Type: Script function
Requires: RemoveGrain (any one of the four DLLs), Repair (ditto), SSETools (ditto)
Author: Didée, using Kassandro's filters
Homepage:
http://forum.doom9.org/showthread.php?s=&threadid=79751&pagenumber=5 is probably your best bet.
Colorspaces: YV12 only (Actually, there's a YUY2 version, but I'm not going to talk about it because
getting it to work right can be a pain. If you can work it, then more power to you.)
Interlacing: Progressive only (at least, it shouldn't be nearly as effective on field-based footage)
Speed: FAST! (250+ fps in most scenes, at default settings)
Defaults: LRemoveDust_YV12(clmode=17, limit=2)
Parameters:
- clmode (0-18) determines what mode to use for the call to RemoveGrain in the script; I list all 18 modes
here, and I'm not going to do it again. Don't use modes 13-16 for this.
- limit (0-???) determines the limit parameter to use for the call to LimitChange in the script; I have no idea
what this does, because I don't know where to get documentation for LimitChange (it's not included in the RemoveGrain
documentation, unfortunately). It probably limits how much each pixel can be changed by the function, but don't quote me.
Thankfully, the default value of 2 seems to work well enough.
Usage notes:
LRemoveDust, as far as I can tell, stands for "Limited RemoveDust", Didée's modification of Kassandro's original
RemoveDust script (found in the RemoveGrain documentation); it works by:
- Applying Clense [sic], basically a version of RemoveDirt (not to be confused with RemoveGrain) that offers
NO protection against artifacts.
- Fixing the artifacts from the first step with Repair.
- Applying RemoveGrain to the repaired video.
- Applying LimitChange to the result (compared to the original input video); I believe this simply limits how
much each pixel can change from the original to the final result, hence the "limited" part of the name.
While it may not have motion compensation capabilities like the Dust filters do, LRemoveDust is still an excellent
3D denoiser. It's also one of the fastest (due to Kassandro optimizing his filters to hell and back), and it seems to
retain plenty of detail. In addition, it does not suffer from the blocking problems of PixieDust. I highly recommend it.
Back to top
PixieDust
The spatio-temporal filter from the Dust family meant for maximum compression.
Type: Plugin
Found in file: DustV5.dll
Author: Steady
Homepage: None
Colorspaces: RGB24, RGB32, or YUY2 (note: NO YV12 SUPPORT)
Interlacing: Progressive only (I believe)
Speed: Very slow (4-9 fps at default settings, depending on scene changes, crossfades, etc.)
Defaults: PixieDust(limit=5)
Parameters:
- limit (1-8?) determines the maximum amount PixieDust can change each pixel by; if a pixel would have been
changed by more than this value, it is changed by exactly this value instead. Raising this value will
increase the strength of the smoothing (but may hurt details).
Usage notes:
- IMPORTANT: The Dust filters do NOT support YV12. This is because they were written for AVISynth 2.0.x, which
was incapable of working in the YV12 colorspace; a version for AVISynth 2.5.x was never coded.
If you try to feed PixieDust YV12 input, your application will suddenly quit without warning. Always convert to YUY2 first.
- IMPORTANT: The Dust filters do not autoload. Again, this is because they were written for AVISynth 2.0.x and
not 2.5.x.
To use them, you first have to load a plugin called LoadPluginEx2.dll (in a separate directory from your default
plugins directory, because it will break autoloading otherwise); I've taken care of this for you in an autoloading .AVSI
helper script. Then you manually load DustV5.dll by putting the following line before calling the filter:
LoadPlugin("C:\avs25\plugins\DustV5.dll") (of course, replace the path given
with the path to your AVISynth plugins directory).
- IMPORTANT: Do not call the Dust filters more than once in one script. This also means that if you use PixieDust
in a
script, you can't use SpaceDust, FaeryDust, or GoldDust in that same script.
- PixieDust should probably be used after cropping and resizing, but I'm not sure about this.
This is it. This is the standard, the spatio-temporal compression monster to which all others were compared for a long time.
If you're really desperate to get your AMV packed into the smallest file possible, you should not ignore this filter.
As with the other Dusts (except SpaceDust), all I know about its theory of operation is that it uses some kind of
motion compensation.
According to Steady, it should provide the maximum compression gains of any of the Dust filters; it certainly does usually
provide awesome compressibility gains. Its two major downsides (for both of which it is notorious) are its painfully
slow speed and the blocky noise it often causes. However, such blockiness
can often be mitigated through use of the Repair filter, and in such a manner
as this:
input=last.ConvertToYV12()
LoadPlugin("C:\avs25\plugins\DustV5.dll")
ConvertToYUY2().PixieDust().ConvertToYV12()
Repair(last,input)
Repair is a very handy filter; the idea is to restore details to a filtered clip from the original while keeping the noise
filtered out. Though with PixieDust you usually have to worry more about introducing blocks than about killing details,
it turns out Repair can also help with the blocks.
Something to watch out for: Here you can find a screenshot from my FLCL
video "My Evil Alien" after having been run through PixieDust. This frame is taken from the middle of a fade in from
black; it's on such fades to/from black that I usually find PixieDust to cause the most blocking. I mean, look at the sky.
Uuuuugly. But on the plus side, the file size is nice and low.
Back to top
Home -
Spatial Smoothers -
Temporal Smoothers -
Sharpeners - Dealing with Dot Crawl -
Dealing with Rainbows
Last updated on 3/20/08
Questions? Comments? Concerns? Contact Scintilla
Fight Spam! Click Here!