Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 26th September 2004, 20:29   #1  |  Link
Fizick
AviSynth plugger
 
Fizick's Avatar
 
Join Date: Nov 2003
Location: Russia
Posts: 2,183
DeFreq plugin - Interference frequency remover

I have 2 bad TV channels in my internal analog TV-tuner.

Now I make and release beta version of DeFreq plugin - Interference frequency remover

DeFreq spatial filter removes some frequencies from video frames.
It can be used for removal of interference frequency noise (regular inclined strips) from some TV capturing, and also for additional blurring.


Defreq uses Fast Fourier Transform method for frequency selecting an removing.
It is a spatial filter, and works as follows:
1) get frequency spectrum by forward FFT transform of frame image;
2) search some defined spectrum window (windows) for local maximum (extremum, most intense frequency);
3) remove frequencies at this sharp maximum from spectrum;
4) optional remove highest frequencies by low pass filter (for blurring, smoothing);
5) get output frame by inverse FFT transform of cleaned spectrum.

Defreq uses fast external FFTW library version 3 (http://www.fftw.org)
as Windows binary DLL (compiled with gcc under MinGW by Alessio Massaro),
which support for threads and have AMD K7 (3dNow!) support in addition to SSE/SSE2.
It may be downloaded from ftp://ftp.fftw.org/pub/fftw/fftw3win32mingw.zip
You MUST put FFTW3.DLL file from this package to some directory in path (for example, C:\WINNT).

Defreq will NOT work without it!

Try and post report!
__________________
My Avisynth plugins are now at http://avisynth.org.ru and mirror at http://avisynth.nl/users/fizick
I usually do not provide a technical support in private messages.
Fizick is offline   Reply With Quote
Old 26th September 2004, 21:28   #2  |  Link
scharfis_brain
brainless
 
scharfis_brain's Avatar
 
Join Date: Mar 2003
Location: Germany
Posts: 3,605
could you provide some before/after shots?

I do not have TV-reception (I do not pay the fee for our crappy, blocky anlogue cable-TV) here, so I cannot test myself
__________________
Don't forget the 'c'!

Don't PM me for technical support, please.
scharfis_brain is offline   Reply With Quote
Old 27th September 2004, 06:17   #3  |  Link
Mug Funky
interlace this!
 
Mug Funky's Avatar
 
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,547
sorry, i can't see the link with the plugin? i've got fftw3.dll, but no defreq?

[edit]

never, mind. that "www" button is quite small

[edit 2]

hmm... it's killing virtualdub on load. fftw3.dll is in c:\winnt\system32, and defreq is being autoloaded.

i'm on a p3 733. could it be a cpu optimization problem?

[edit 3]

works fine when i manually load it... strange. the spectrograms are really pretty

hmm.... this is a REALLY sensitive comb-detector. all you need to is look for anything but noise in the middle bit of the spectrogram and you can be sure it's combing - it's a really distinct effect. i wonder if this could be used for anything?
__________________
sucking the life out of your videos since 2004

Last edited by Mug Funky; 27th September 2004 at 06:53.
Mug Funky is offline   Reply With Quote
Old 27th September 2004, 06:20   #4  |  Link
JuanC
Registered User
 
Join Date: May 2002
Posts: 220
Quote:
Originally posted by scharfis_brain
could you provide some before/after shots?
You can see them at his WWW site.

@Fizick: I can't seem to download the plugin. Could there b a problem at your site?

EDIT: I got it now, I think there was something wrong in my browser. Thanks.

Last edited by JuanC; 27th September 2004 at 06:32.
JuanC is offline   Reply With Quote
Old 27th September 2004, 09:50   #5  |  Link
kingmob
Registered User
 
Join Date: Jun 2004
Location: Netherlands
Posts: 129
Ah, i was thinking about this a few weeks ago, but i had no clue as how to program the Fourier Transforms . I will try this out, sounds absolutely great.

[edit]Works great atm. Might be handy to work it out as a VDmod-filter. That would be easier with the tweaking. At the end you can always specify the paramaters in avisynth.

Last edited by kingmob; 27th September 2004 at 10:21.
kingmob is offline   Reply With Quote
Old 27th September 2004, 11:36   #6  |  Link
Mug Funky
interlace this!
 
Mug Funky's Avatar
 
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,547
hmm. an avisynth GUI would be useful here? maybe "show=true" or an apropriately named parameter could trigger a GUI for tweaking.

also, how are things like FFT size set? this would be a useful thing to play with (to make lowpasses have steeper or gentler rolloffs).
__________________
sucking the life out of your videos since 2004
Mug Funky is offline   Reply With Quote
Old 27th September 2004, 19:12   #7  |  Link
Fizick
AviSynth plugger
 
Fizick's Avatar
 
Join Date: Nov 2003
Location: Russia
Posts: 2,183
Mug Funky,
1)Defreq is autoloaded well for my Athlon.
Can anybody else test this on P3, P4 ?

2)A common type of filter to use in frequency domain filtering is a Butterworth frequency filter. I use it as low pass filter.

But for sharp interference, Defreq02 simply (blindy) set 12 pixels around extemum to 0.

Now I prepare Defreq03 with adaptive frequency region size and degree of amplitude decreasing.

3) What is "Avisynth GUI" ?

As more far "to do", i think about mask using.
The draft mask may be produced by "show" mode, saved as image file, edited by Photoshop, and loaded as as frequency filter.
But it will be slow, and now i am not needed in it.

kingmob,
do you want to program the "VDmod-filter" ?
BTW, RGB is not appropriate space.


Can anybody test DeFreq for color interference?
I have not such bad TV sources
May be VHS ?
__________________
My Avisynth plugins are now at http://avisynth.org.ru and mirror at http://avisynth.nl/users/fizick
I usually do not provide a technical support in private messages.
Fizick is offline   Reply With Quote
Old 28th September 2004, 15:17   #8  |  Link
Mug Funky
interlace this!
 
Mug Funky's Avatar
 
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,547
avisynth plugins (i think C only) can have GUIs that flash up when the script is run. i don't know exactly how it works, but a search for "GUIsample" will give you plenty to go on

your plugin is C++, so you might not have the option.
__________________
sucking the life out of your videos since 2004
Mug Funky is offline   Reply With Quote
Old 28th September 2004, 20:13   #9  |  Link
Fizick
AviSynth plugger
 
Fizick's Avatar
 
Join Date: Nov 2003
Location: Russia
Posts: 2,183
I hate (and do not know how) any visual control programming
Any buttons nor with C, nor C++, nor FORTRAN.

More questions?
Now I try make v.0.4 with not absolute, but relative (to image size)frequency input.
__________________
My Avisynth plugins are now at http://avisynth.org.ru and mirror at http://avisynth.nl/users/fizick
I usually do not provide a technical support in private messages.
Fizick is offline   Reply With Quote
Old 29th September 2004, 04:04   #10  |  Link
JuanC
Registered User
 
Join Date: May 2002
Posts: 220
Quote:
Originally posted by Fizick
1)Defreq is autoloaded well for my Athlon.
Can anybody else test this on P3, P4 ?
I'm on a P4/1.6Ghz. I'm trying DeFreq on a noisy analog TV capture (NTSC 720x480, 29.97 fps, mpeg2 @9mbps). When not separating fields, I have no "vdub disappearing" problems, but as my clips are captured interlaced (I IVTC them afterwards)...

(I use WinXp, fftw3.dll is at \windows\system32)

So, when separating fields, 720x240, 59.94 fps, AND using show & info parameters, sometimes (when using "inappropriate" values for fx/fy ???) DeFreq is making VdubMod disappear when auto loading, and when manually loading, VDubMod disappears after advancing a few frames.

Here's my script:
Code:
SetMemoryMax(192)
LoadPlugin("G:\Program Files\AviSynth 2.5\plugins\Test\DeFreq.dll")

video1=DGdecode_mpeg2source("test1.d2v")
audio1=	WAVSource("test1.WAV")
video1a=AudioDub(video1, audio1) 

#AssumeTFF().SeparateFields()
Return DeFreq(fx=68,fy=-75,show=true,info=true)
#Weave()...
JuanC is offline   Reply With Quote
Old 30th September 2004, 05:13   #11  |  Link
Fizick
AviSynth plugger
 
Fizick's Avatar
 
Join Date: Nov 2003
Location: Russia
Posts: 2,183
JuanC, Mug Funky,
It worked OK for me,
but now I changed something (with logarithm) in new version:

Defreq version 0.4, 30 September 2004 - change fx,fy,dx,dy,cutx,cuty parameters to (float) percent of FFT size

Try.

Hallo, anybody is here?
__________________
My Avisynth plugins are now at http://avisynth.org.ru and mirror at http://avisynth.nl/users/fizick
I usually do not provide a technical support in private messages.
Fizick is offline   Reply With Quote
Old 30th September 2004, 07:28   #12  |  Link
Mug Funky
interlace this!
 
Mug Funky's Avatar
 
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,547
hmm... the filtered result seems to come out strange. like the low frequencies have been replaced with black (rather like a diffuse glow filter set to subtract rather than add).

here's my setting:

defreq(fy=-40,fx=1,sharp=96)

[edit]

this only seems to happen after playing 1 or 2 frames. it doesn't seem to happen at all if you step-through the frames.

[edit 2]

just for fun, here's a nice "soft focus" effect
Code:
soft=last.defreq(cutx=5,cuty=5,plane=0).defreq(cutx=10,cuty=10,plane=1).defreq(cutx=10,cuty=10,plane=2)
overlay(last,soft,opacity=0.5)
it'd be nice to have 3 plane parameters, rather like masktools has (y=3,u=3,v=3 or something similar). this would save a little typing.
__________________
sucking the life out of your videos since 2004

Last edited by Mug Funky; 30th September 2004 at 07:39.
Mug Funky is offline   Reply With Quote
Old 30th September 2004, 21:23   #13  |  Link
Fizick
AviSynth plugger
 
Fizick's Avatar
 
Join Date: Nov 2003
Location: Russia
Posts: 2,183
Version 0.4.1, 01 October 2004 - fixed bug with init
__________________
My Avisynth plugins are now at http://avisynth.org.ru and mirror at http://avisynth.nl/users/fizick
I usually do not provide a technical support in private messages.
Fizick is offline   Reply With Quote
Old 1st October 2004, 05:48   #14  |  Link
JuanC
Registered User
 
Join Date: May 2002
Posts: 220
Fizick, thanks alot for the new version 0.4.1. I tried it:

I keep getting VDubMod "vanishing" problems on my P4, but you've narrowed the conditions to make the problem happen (it wasn't unadecuate values for fx or fy, now they're easier to undestand and use). Here's the problem: Every time I use the show=true parameter VDmod will vanish just when advancing 1 frame. Note: If I don't use the "show=true" parameter, VDMod won't vanish even after scrubbing the positional slider for a while.

Also, there is an oddity: Using the following script:
Code:
SetMemoryMax(192)
LoadPlugin("G:\Program Files\AviSynth 2.5\plugins\Test\DeFreq.dll")

video1=DGdecode_mpeg2source("test1.d2v")
audio1=	WAVSource("test1.WAV")
video1a=AudioDub(video1, audio1) 

MyBlack=BlankClip(video1a, length=30).assumeTFF()
AlignedSplice(MyBlack, video1a)

AssumeTFF().SeparateFields()
Return DeFreq(fx=50,fy=80,show=true,info=true)
#Return Weave()
Vdub will show the first 60 frames (0-59) without "vanishing", displaying "DeFreq Peaks: x=0.0 y=0.0 sharp=-1.$", then it will show the first original video clip frame (#60) displaying "normal" DeFreq info with it, but if I try to move to the next frame (#61), VDMod will "vanish".

Hope this report helps any way.
JuanC is offline   Reply With Quote
Old 1st October 2004, 12:34   #15  |  Link
Mug Funky
interlace this!
 
Mug Funky's Avatar
 
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,547
tanks, muchly for the new version. i haven't found any bugs yet (the strange too-dark frames thing is solved it seems).

the lowpassing gives a very pleasant effect - gentle rolloff of highs, so there's still a bit left.
__________________
sucking the life out of your videos since 2004
Mug Funky is offline   Reply With Quote
Old 2nd October 2004, 01:00   #16  |  Link
Fizick
AviSynth plugger
 
Fizick's Avatar
 
Join Date: Nov 2003
Location: Russia
Posts: 2,183
JuanC,
thanks fo report!
I found and fixed problem for pure black "DeFreq Peaks: x=0.0 y=0.0 sharp=-1.$"
But not with Defreq 0.4.1 not new 0.5, my VDUBMod do not "vanish".
I try almost your script:
Code:
setmemorymax(128)
loadplugin("defreq.dll")
avisource("i:\polos2.avi")
video1a=converttoyv12()

MyBlack=BlankClip(video1a, length=30).assumeTFF()
AlignedSplice(MyBlack, video1a)
AssumeTFF().SeparateFields()
Return DeFreq(fx=50,fy=80,show=true,info=true)
Try new released version 0.5.

I wonder, why somebody else do not post anything (my counter show about 100 dounloads of this buggy filter).

Mug Funky,
I like FFT smoothing too.
I do not want make processing of 3 color planes for the present (and probably in future). They are processed independently.


BTW, you can see spectrum before and after Defreq with help of two more Defreqs (for test)

before=defreq(show=true)
after=defreq(cutx=10,cuty=10).defreq(show=true)
interleave(before,after)

Probably, we can test some other denoising filters this way.

before=defreq(show=true)
after=vaguedenoiser.defreq(show=true)
interleave(before,after)

But I use in defreq variable (adaptive) scale for spectrum show,
from min to max (with logarifm).
May be fixed scale will be better for it.


P.S. I will absent some days because of Internet payment overdraft.
__________________
My Avisynth plugins are now at http://avisynth.org.ru and mirror at http://avisynth.nl/users/fizick
I usually do not provide a technical support in private messages.
Fizick is offline   Reply With Quote
Old 9th October 2004, 00:40   #17  |  Link
Fizick
AviSynth plugger
 
Fizick's Avatar
 
Join Date: Nov 2003
Location: Russia
Posts: 2,183
Version 0.5.1, 07 October 2004 - more fast processing of frames which are not needed in cleaning,
source released under GPL.
__________________
My Avisynth plugins are now at http://avisynth.org.ru and mirror at http://avisynth.nl/users/fizick
I usually do not provide a technical support in private messages.
Fizick is offline   Reply With Quote
Old 9th October 2004, 01:19   #18  |  Link
EpheMeroN
EphMan
 
Join Date: May 2004
Posts: 737
Your plugins are on your WWW yes? What is your URL exactly? Call me stupid :-) but I cannot find it.
EpheMeroN is offline   Reply With Quote
Old 9th October 2004, 01:46   #19  |  Link
JuanC
Registered User
 
Join Date: May 2002
Posts: 220
clicking on the WWW icon under his post will take you to http://bag.hotmail.ru/
JuanC is offline   Reply With Quote
Old 17th October 2004, 05:12   #20  |  Link
Unobtanium
Registered User
 
Join Date: Sep 2003
Posts: 2
Fizick

I'm testing version 0.5.1 of the filter on a Type-1 DV clip that I captured off-air. The spectrum shows multiple peaks but only one is listed in the info.
Your screen cap photo part 2 gives info on two peaks; is there a way that I can get Defreq to list the X and Y values of the other peaks that appear in the spectrum?

Since you are seeking feedback, some of the following information may be of value to you:

2.6 GHz Pentium 4C (Northwood)
Running at 3.12 GHz
Hyperthreading Enabled
AGP/PCI bus 66/33 MHz
Windows 2000 SP4 environment
1024 MEG of Corsair PC3200 RAM not overclocked
ABIT IC7 MAX3 Motherboard

I have not experienced any stability problems with DeFreq. I am currently viewing the clips with Media Player Classic. I haven't tried VDub or VDubMod yet.

Thank you for making DeFreq available. I think that it will be enormously useful once I learn how to use it effectively.
__________________
Unobtanium
Unobtanium is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 00:09.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2017, vBulletin Solutions Inc.