PDA

View Full Version : Where to place a denoise filter


AgeOfPanic
31st October 2003, 15:59
I have been reading up for a couple of days now on the use of filters and Avisynth. I always wondered what the next step in encoding would be, after you set the parameters of the codec. Now I have a question. I would like to try a denoise filter on a movie with some noise, just to compare it to an untouched (not counting undot) source. I'm using Gknot to build an avs file and it automatically places the denoise filters after the resize. I read somewhere that this should be the other way around. First denoise, then resize.
I would like to hear your opinions about this subject.

(I'm currently trying out Convulsion 3D with (movieHQ) setting)

N_F
31st October 2003, 16:05
It's not really an important issue in most cases IMHO. Some say:

Before resize: "Better", but slower
After resize: "Worse", but faster

As I can't tell the difference myself I usually place it after the resizing as it is in fact a bit faster (as it doesn't have as large picture to work with).

ppera2
31st October 2003, 16:11
I always put noise filters before resize. It is especially important by bigger noise, so resize will get cleaner data, and work more accurate. Don't care much for lower speed - it's not race :D

Chainmax
31st October 2003, 16:57
According to Lindsey Dubb, denoising before IVTCing/Deinterlacing improves the accuracy of the IVTC/Deinterlace process a lot, so I'm starting to put it before everything else.

Boulder
31st October 2003, 17:10
Originally posted by Chainmax
According to Lindsey Dubb, denoising before IVTCing/Deinterlacing improves the accuracy of the IVTC/Deinterlace process a lot, so I'm starting to put it before everything else.

IMHO this is a Very Bad Idea. Lindsey's filters, however, should/might work. At least PeachSmoother knows how to handle interlaced material, but it is generally recommended that you don't process the video before you deinterlace or IVTC.

Chainmax
31st October 2003, 17:35
I always use some flavor of Dust for denoising. Should it go after IVTCing/Deinterlacing too?

Boulder
31st October 2003, 17:41
To be on the safe side, always IVTC or deinterlace first, preferably right after your AVISource, MPEG2Source or DirectShowSource line.

Besides, the Dust filters (except SpaceDust) are all temporal or spatio-temporal filters which means that special care must be taken when they are used with interlaced material. If you deinterlace/IVTC first, you don't have to worry about that.

N_F
31st October 2003, 17:45
You should be very careful about altering the picture before doing an IVTC/deinterlacing. This may well put decomb or whatever deinterlacer/IVTC you're using off and you may end up with interlaced artifacts or other stuff you don't want.

Chainmax
31st October 2003, 18:17
Well, joshyg2 recommended me to use this on a previous thread I posted:

separatefields()
spacedust()
weave()

(I'm going to use spacedust on my next rip). Would that take care of any possible problems?

AgeOfPanic
1st November 2003, 17:45
My .avs (created with Gknot)looks like this now. Does this mean the filter will be used?


# PLUGINS
LoadPlugin("C:\PROGRA~1\GORDIA~1\mpeg2dec3dg.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\undot.dll")
#LoadPlugin("C:\PROGRA~1\GORDIA~1\decomb.dll")
#LoadPlugin("C:\PROGRA~1\GORDIA~1\dgbob.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\Convolution3d.dll")
#LoadPlugin("C:\PROGRA~1\GORDIA~1\FluxSmooth.dll")
#LoadPlugin("C:\PROGRA~1\GORDIA~1\TomsMoComp.dll")
#LoadPlugin("C:\PROGRA~1\GORDIA~1\VSFilter.dll")
#LoadPlugin("C:\PROGRA~1\GORDIA~1\SimpleResize.dll")
#
# SOURCE
mpeg2source("D:\DVD\Projects\Terminator2_VTS_04_PGC1\Terminator2.d2v")
#
# TRIM
#trim(startframe,endframe)
#
# IVTC
#Telecide(order=1,guide=1).Decimate()
# or use
#IVTC(44,11,95)
#GreedyHMA(1,0,4,0,0,0,0,0)
#
# CROPPING
crop(2,70,714,436)
#
# DEINTERLACING (1)
#FieldDeinterlace()
#FieldDeinterlace(blend=false)
#TomsMoComp(1,5,1)
#
# DEINTERLACING (2)
#SeparateFields().SelectEven()
# or maybe
#DGBob(order=1,mode=0)
# DEINTERLACING (3) - special requests
#GreedyHMA(1,0,0,0,0,0,0,0)
#Telecide()
#SeparateFields()
#
#
Undot()
#
# DENOISING: choose one combination (or none)
# 1) little noise
#Temporalsoften(2,3,3,mode=2,scenechange=6)
#mergechroma(blur(1.3))
#FluxSmooth(5,7)
#
# 2) medium noise
#Temporalsoften(3,5,5,mode=2,scenechange=10)
Convolution3d("moviehq")
#FluxSmooth(7,7)
#
# 3) heavy noise
#Temporalsoften(4,8,8,mode=2,scenechange=10)
#Convolution3d("movielq")
#FluxSmooth(10,15)
#
# SUBTITLES
#VobSub("FileName")
#
# RESIZING
LanczosResize(672,288)
#
# BORDERS
#AddBorders(left,top,right,bottom)

#SelectRangeEvery(280,14)
#
# FOOL CCEnc
#empty = BlankClip()
#AudioDub(last,empty)

N_F
1st November 2003, 19:37
Yes, that script looks fine.

mf
1st November 2003, 21:49
Strange, I usually decimate at the end, so the denoisers and other stuff have more frames to work with.

AgeOfPanic
1st November 2003, 22:28
Thanks N_F, now I only have to wait till the version without filters is ready so I can start to compare. I should really stop encoding the entire movie every time ;) .

N_F
1st November 2003, 23:13
Originally posted by mf
Strange, I usually decimate at the end, so the denoisers and other stuff have more frames to work with.

Wouldn't this mean that your denoisers and other filters are working on frames that will in the end be discarded? Perhaps it could be of some use for temporal filters though, not sure about that.

mf
2nd November 2003, 11:33
Originally posted by N_F
Wouldn't this mean that your denoisers and other filters are working on frames that will in the end be discarded? Perhaps it could be of some use for temporal filters though, not sure about that.
It's indeed of use for temporal filters. Also, Decimate() might know better what frames to discard when the frames are all nice and clean.

Chainmax
2nd November 2003, 19:42
Again, would this:

separatefields()
spacedust()
weave()

(I'm going to use spacedust on my next rip) take care of any problems that might arise from denoising before IVTCing/Deiterlacing?

Wilbert
2nd November 2003, 20:10
(I'm going to use spacedust on my next rip) take care of any problems that might arise from denoising before IVTCing/Deiterlacing?
Yes, this is fine!

Didée
2nd November 2003, 21:08
Chainmax:

It's technically OK, but you waste most of the power DUST has!
Space is only spatial, and in this domain, there is not much room for miracles. Dust's real magic only reveals when the temporal part plus Motion-Detection is active, speak: Pixie or Gold.

I'd suggest another spatial denoiser in the SeparateWeave-Sandwich, perhaps as simple as spatialsoften.
Then use PixieDust *after* the IVTC.

IMHO, no other filter reaches Dust's ratio of retained detail / compressability. Not even closely. (And yes, I AM aware of Dust's seldom thrown arteacts.)

Steady oh Steady, where have thou gone?

- Didée

AgeOfPanic
3rd November 2003, 00:15
Speaking of Dust. I wanted to try this filter to, because I heard so many good things about it. It seems however that I have trouble loading LoadPluginEx.dll into avisynth and I need that to run DustV5.dll. Does anybody have a solution for this already?

N_F
3rd November 2003, 00:21
You need to explain a bit more what your problem is when trying to use loadpluginex.dll.

You do know you need to load it manually? Putting it in Avisynth's plugin folder will give you all kind of problems.

You may also be forgetting to change the picture to YUY2, as Dust of course requires that.

AgeOfPanic
3rd November 2003, 11:22
When I wanted to post the script here I noticed that the path to the plugin was wrong. Sorry for the inconvenience (hope I spelled that right). Thanks for your help.

Edit: when I preview the avs now in MPC it shows a pink bar in the right side of the screen. I will post the script anyway. Maybe you see something wrong in it. As you can see I converted to YUY2 before the filter.

# PLUGINS
LoadPlugin("C:\PROGRA~1\GORDIA~1\mpeg2dec3dg.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\undot.dll")
LoadPlugin("C:\C:\Program Files\Gordian Knot\LoadPluginEx\LoadPluginEx.dll")
LoadPlugin("C:\Program Files\Gordian Knot\dustv5.dll")
#LoadPlugin("C:\PROGRA~1\GORDIA~1\decomb.dll")
#LoadPlugin("C:\PROGRA~1\GORDIA~1\dgbob.dll")
#LoadPlugin("C:\PROGRA~1\GORDIA~1\Convolution3d.dll")
#LoadPlugin("C:\PROGRA~1\GORDIA~1\FluxSmooth.dll")
#LoadPlugin("C:\PROGRA~1\GORDIA~1\TomsMoComp.dll")
#LoadPlugin("C:\PROGRA~1\GORDIA~1\VSFilter.dll")
#LoadPlugin("C:\PROGRA~1\GORDIA~1\SimpleResize.dll")
#
# SOURCE
mpeg2source("D:\DVD\Projects\Terminator2_VTS_04_PGC1\Terminator2.d2v")
#
# TRIM
#trim(startframe,endframe)
#
# IVTC
#Telecide(order=1,guide=1).Decimate()
# or use
#IVTC(44,11,95)
#GreedyHMA(1,0,4,0,0,0,0,0)
#
# CROPPING
crop(2,72,716,432)
#
# DEINTERLACING (1)
#FieldDeinterlace()
#FieldDeinterlace(blend=false)
#TomsMoComp(1,5,1)
#
# DEINTERLACING (2)
#SeparateFields().SelectEven()
# or maybe
#DGBob(order=1,mode=0)
# DEINTERLACING (3) - special requests
#GreedyHMA(1,0,0,0,0,0,0,0)
#Telecide()
#SeparateFields()
#
#
Undot()
ConvertToYUY2
PixieDust (5)
ConvertToYV12
#
# DENOISING: choose one combination (or none)
# 1) little noise
#Temporalsoften(2,3,3,mode=2,scenechange=6)
#mergechroma(blur(1.3))
#FluxSmooth(5,7)
#
# 2) medium noise
#Temporalsoften(3,5,5,mode=2,scenechange=10)
#Convolution3d("moviehq")
#FluxSmooth(7,7)
#
# 3) heavy noise
#Temporalsoften(4,8,8,mode=2,scenechange=10)
#Convolution3d("movielq")
#FluxSmooth(10,15)
#
# SUBTITLES
#VobSub("FileName")
#
# RESIZING
LanczosResize(640,272)
#
# BORDERS
#AddBorders(left,top,right,bottom)
#

Wilbert
3rd November 2003, 11:53
Solutions:

1) make the cropping mod 4

2) replace the crop and resize with

LanczosResize(640,272,2,72,716,432)

AgeOfPanic
3rd November 2003, 12:29
I don't understand what you mean with making the cropping mod 4.

After applying your second suggestion the script now looks like this:

# CROPPING
#crop(2,72,716,432)
#
# DEINTERLACING (1)
#FieldDeinterlace()
#FieldDeinterlace(blend=false)
#TomsMoComp(1,5,1)
#
# DEINTERLACING (2)
#SeparateFields().SelectEven()
# or maybe
#DGBob(order=1,mode=0)
# DEINTERLACING (3) - special requests
#GreedyHMA(1,0,0,0,0,0,0,0)
#Telecide()
#SeparateFields()
#
#
Undot()
ConvertToYUY2
PixieDust (5)
ConvertToYV12
#
# DENOISING: choose one combination (or none)
# 1) little noise
#Temporalsoften(2,3,3,mode=2,scenechange=6)
#mergechroma(blur(1.3))
#FluxSmooth(5,7)
#
# 2) medium noise
#Temporalsoften(3,5,5,mode=2,scenechange=10)
#Convolution3d("moviehq")
#FluxSmooth(7,7)
#
# 3) heavy noise
#Temporalsoften(4,8,8,mode=2,scenechange=10)
#Convolution3d("movielq")
#FluxSmooth(10,15)
#
# SUBTITLES
#VobSub("FileName")
#
# RESIZING
LanczosResize(640,272,2,72,716,432)
#
# BORDERS
#AddBorders(left,top,right,bottom)
#
This works, the pink bar is gone. Doesn't this give a different result as when using crop and resize?

Wilbert
3rd November 2003, 13:17
Doesn't this give a different result as when using crop and resize?
The end result is the same.

I don't understand what you mean with making the cropping mod 4.
What I meant was replace the crop line with (where the crops are a multiple of 4, because they should be if source is YV12):

crop(4,72,716,432)

But this is a bit less accurate as the second method.

Chainmax
3rd November 2003, 18:07
Originally posted by Didée:
It's technically OK, but you waste most of the power DUST has!
Space is only spatial, and in this domain, there is not much room for miracles. Dust's real magic only reveals when the temporal part plus Motion-Detection is active, speak: Pixie or Gold.

I'd suggest another spatial denoiser in the SeparateWeave-Sandwich, perhaps as simple as spatialsoften.
Then use PixieDust *after* the IVTC.

Well, I'm going to use a DVD source (my Simpsons 1st Season DVDs), do you really think it needs more than Spacedust()? I want something fast and since Dust is one of the denoisers that get the most praise around here I don't want to use anything else. In any case, I can still use a Pixiedust before deinterlacing, right? According to Doom9's capture guide, I only have to use something like:

SeparateFields()
even = SelectEven(last).Pixiedust(limit=3)
odd = SelectOdd(last).Pixiedust(limit=3)
Interleave(even, odd)
Weave()

IMHO, no other filter reaches Dust's ratio of retained detail / compressability. Not even closely. (And yes, I AM aware of Dust's seldom thrown arteacts.)

Steady oh Steady, where have thou gone?
I wish he had released Dust's source when he left...:(.

AgeOfPanic
3rd November 2003, 19:13
Thank you Wilbert (of moet ik dank je wel zeggen :) ). I will give the filter a try and compare it to Convolution3D and Fluxsmooth.

Wilbert
3rd November 2003, 22:16
@Chainmax,

The script itself is fine. But dust is very slow. To my knowledge people use smoothers on anime, like SmoothHiQ, 2D_Cleaner, etc.

But I have no experience with anime, so maybe other people can give some comments ...

@AgeOfPanic,

You are welcome :)

Boulder
4th November 2003, 16:14
Originally posted by Chainmax

SeparateFields()
even = SelectEven(last).Pixiedust(limit=3)
odd = SelectOdd(last).Pixiedust(limit=3)
Interleave(even, odd)
Weave()


Unfortunately you can't use any of the Dust filters in more than one place in your script. There's a small workaround to this restriction, I just don't remember the correct procedure at the moment:o

mf
4th November 2003, 17:21
Originally posted by Boulder
There's a small workaround to this restriction, I just don't remember the correct procedure at the moment:o
There most certainly is. Just use this:
SeparateFields()
seperated = last
StackHorizontal(SelectEven(seperated), SelectOdd(seperated))
Pixiedust(limit=3)
dusted = last
dusted.Crop(0, 0, -seperated.width, -0)
even = last
dusted.Crop(seperated.width, 0, -0, -0)
odd = last
Interleave(even, odd)
Weave()

Didée
4th November 2003, 17:22
The workaround(s):

either use the UnFoldFields plugin, or use e.g. Kevin's ibob to process as 50fps and re-weave it again afterwards.

- Didée, in a hurry

Boulder
4th November 2003, 17:35
Originally posted by Didée


either use the UnFoldFields plugin..



This brings up a question I've always wanted to ask. (I assume that Simon's ViewFields/UnViewFields operates like UnFoldFields/FoldFields)

Won't the smoother be distracted when it processes the area where the edge of the two fields is close? If the spatial radius is large, won't it use information from both fields and mess up the result? The same goes to temporal filtering.

For example, I unfold the fields of a 704x576 frame so that the top field fills vertically the first 288 pixels of the frame and the bottom field gets the rest. I use a spatio-temporal smoother (Convolution3d/Deen etc.) When it operates near the center of the frame, it takes information from both the top and bottom field, right?

Is it just a thing you'll have to accept with UnFoldFields/FoldFields?

Chainmax
4th November 2003, 21:51
mf, Didée: thanks for the suggestions :).

Originally posted by Wilbert:
The script itself is fine. But dust is very slow. To my knowledge people use smoothers on anime, like SmoothHiQ, 2D_Cleaner, etc.

Well, I already have MipSmooth at the end of the script for smoothing and block removal. The Simpsons 1st Season DVD I'm going to rip is very badly mastered but it isn't too noisy. According to the readme, Spacedust is much faster than any other of Dust's flavors and since it comes from Dust's package I guess it's pretty effective too.

Si
5th November 2003, 00:26
Won't the smoother be distracted when it processes the area where the edge of the two fields is close?

Yes.

However, edges/borders of clips are not normally considered important as your eyes don't tend to look there during normal viewing.

Also the distortions caused are dispersed when unfolding/unviewing the fields.
regards
Simon
PS I made UnViewFields because I didn't like the bias towards BFF that unfolding gives in VirtualDub (In all other respects I bow to the master himself :) )

regards
Simon

stickboy
20th November 2003, 19:17
Originally posted by Boulder
Won't the smoother be distracted when it processes the area where the edge of the two fields is close?The "flip" argument in my UnfoldFieldsVertical/FoldFieldsVertical (http://forum.doom9.org/showthread.php?s=&threadid=59029) functions is intended to mitigate that problem somewhat.

North2Polaris
21st November 2003, 04:52
Originally posted by mf
There most certainly is. Just use this:
SeparateFields()
seperated = last
StackHorizontal(SelectEven(seperated), SelectOdd(seperated))
Pixiedust(limit=3)
dusted = last
dusted.Crop(0, 0, -seperated.width, -0)
even = last
dusted.Crop(seperated.width, 0, -0, -0)
odd = last
Interleave(even, odd)
Weave()

I decided to give this script a try on a DV AVI and got an an unexpected result. Please note the lines in image at the link below. These lines are present in most but not all of the frames. I don't see this with the UnfoldFieldsVertical/FoldFieldsVertical method.

http://home.earthlink.net/~mcartter/sitebuildercontent/sitebuilderpictures/test.jpg

I used the following script:

LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\Reinterpolate\ReInterpolate411.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\Warpsharp\LoadPluginEx.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\dustv5.dll")
AVISource("D:\test.avi")
FixBrokenChromaUpsampling()
ReInterpolate411()

SeparateFields()
seperated = last
StackHorizontal(SelectEven(seperated), SelectOdd(seperated))
Pixiedust(limit=3)
dusted = last
dusted.Crop(0, 0, -seperated.width, -0)
even = last
dusted.Crop(seperated.width, 0, -0, -0)
odd = last
Interleave(even, odd)
Weave()

Any suggestions as to where the problem is?

Thanks.