Avisynth: New Avisynth DCT-Based Filter - digitalFAQ.com Forums [Archives]
 digitalFAQ.com Forums [Archives] Avisynth: New Avisynth DCT-Based Filter

#1
11-25-2002, 05:30 PM
 SansGrip Free Member Join Date: Nov 2002 Location: Ontario, Canada Posts: 1,135 Thanks: 0 Thanked 0 Times in 0 Posts
Tom Barry just released an experimental version of a filter that does a discrete cosine transform on the data before filtering. This should allow smoothing to be done only in certain frequency ranges.

Sounds very promising -- take a look at this Doom9 thread.

@kwag:

Theoretically this could target mosquito noise fairly precisely. Edit: Though possibly not as precisely as a full-blown FFT.
Someday, 12:01 PM
 Site Staff / Ad Manager Join Date: Dec 2002 Posts: 42 Thanks: ∞ Thanked 42 Times in 42 Posts
#2
11-25-2002, 08:14 PM
 black prince Free Member Join Date: Jul 2002 Posts: 1,224 Thanks: 0 Thanked 0 Times in 0 Posts
Hi SansGrip,

SansGrip wrote:
Quote:
 Tom Barry just released an experimental version of a filter that does a discrete cosine transform on the data before filtering. This should allow smoothing to be done only in certain frequency ranges. Sounds very promising -- take a look at this Doom9 thread. @kwag: Theoretically this could target mosquito noise fairly precisely. Edit: Though possibly not as precisely as a full-blown FFT.
I saw this post earlier and found it interesting and realized you
were still working wavelets (GFR). This could further the knowledge
to solve Gibbs effect. This filter is written using avisynth 2.5 experimental.
There is nothing available for avisynth 2.07. I don't know whether both
avisynths will work loaded at the same time. If these test filters were
being created for avisynth 2.07, more testers could evaluation them.

-black prince
#3
11-25-2002, 08:50 PM
 SansGrip Free Member Join Date: Nov 2002 Location: Ontario, Canada Posts: 1,135 Thanks: 0 Thanked 0 Times in 0 Posts
Quote:
 Originally Posted by black prince I saw this post earlier and found it interesting and realized you were still working wavelets (GFR). This could further the knowledge to solve Gibbs effect.
They're really very similar concepts -- Tom's filter transforms the spatial data into the frequency domain, whereas a wavelet filter would transform it into the wavelet domain. Both approaches allow modification of the data in ways impossible (or exceptionally difficult) simply through manipulation of pixel values.

Quote:
 Originally Posted by black prince This filter is written using avisynth 2.5 experimental. There is nothing available for avisynth 2.07.
I know Tom used the DCT/iDCT code from XViD, which means the transformation is probably done in YV12 space. It would be very hard to convert that part of the code to YUY2.

Quote:
 Originally Posted by black prince I don't know whether both avisynths will work loaded at the same time.
They sure will. Simply download 2.5 and install it into a directory somewhere. DO NOT copy the new DLL into your system folder or you will overwrite 2.07.

Get hold of the 2.5 filters you want to use, and copy those DLLs into the same directory that Avisynth 2.5 is in. Any .avs scripts you make IN THAT FOLDER will use 2.5 and the 2.5 filters instead of 2.07 and the 2.07 filters.

You can then use a script like:

Code:
LoadPlugin("mpeg2dec3.dll")
Mpeg2Source("path\to\d2v")
# other filters
DctFilter(...)
If you're sending this into XViD or DivX 5 via VirtualDub you can get specially modified versions of XViD and VirtualDub that will work with YV12 data. If you're not, you'll need to add a ConvertToYUY2() as the last line of the script. If you normally convert to RGB at the end, you'll need to do that AFTER the ConvertToYUY2() line, because currently ConvertToRGB() will not work with YV12 data.

It's not an ideal setup, but at least you can play with the new filters without harming your existing install .
#4
11-25-2002, 10:00 PM
 kwag Free Member Join Date: Apr 2002 Location: Puerto Rico, USA Posts: 13,537 Thanks: 0 Thanked 0 Times in 0 Posts
Quote:
 Originally Posted by SansGrip @kwag: Theoretically this could target mosquito noise fairly precisely. Edit: Though possibly not as precisely as a full-blown FFT.
This looks good. Took a look at your sample .jpeg at doom9, and looks better than the original. BTW: Where's the link to AviSynth 2.5 ??

-kwag
#5
11-26-2002, 09:02 AM
 KingTuk Free Member Join Date: Nov 2002 Posts: 107 Thanks: 0 Thanked 0 Times in 0 Posts
here is AviSynth 2.5

http://cultact-server.novi.dk/kpo/av...nth_alpha.html
#6
11-26-2002, 09:18 AM
 kwag Free Member Join Date: Apr 2002 Location: Puerto Rico, USA Posts: 13,537 Thanks: 0 Thanked 0 Times in 0 Posts
Quote:
 Originally Posted by KingTuk here is AviSynth 2.5 http://cultact-server.novi.dk/kpo/av...nth_alpha.html
Thanks KingTuk

-kwag
#7
11-26-2002, 10:17 AM
 SansGrip Free Member Join Date: Nov 2002 Location: Ontario, Canada Posts: 1,135 Thanks: 0 Thanked 0 Times in 0 Posts
Quote:
 Originally Posted by kwag This looks good. Took a look at your sample .jpeg at doom9, and looks better than the original.
If you read further into the thread you'll see that in 2.5 StackVertical -- for whatever reason -- reverses the order of the clips. What I thought was the sharpened, better-looking version is actually the original, and the blurred version is after DctFilter.

That said, iago is reporting compressibility gains of up to 30% without very noticible degredation in picture quality!
#8
11-26-2002, 11:37 AM
 kwag Free Member Join Date: Apr 2002 Location: Puerto Rico, USA Posts: 13,537 Thanks: 0 Thanked 0 Times in 0 Posts
Quote:
Originally Posted by SansGrip
Quote:
 Originally Posted by kwag This looks good. Took a look at your sample .jpeg at doom9, and looks better than the original.
If you read further into the thread you'll see that in 2.5 StackVertical -- for whatever reason -- reverses the order of the clips. What I thought was the sharpened, better-looking version is actually the original, and the blurred version is after DctFilter.
It was too good to be true
Quote:
 That said, iago is reporting compressibility gains of up to 30% without very noticible degredation in picture quality!
Oh yeah! that sounds good, 234 minutes ( 180 + 30% ) on one CD-R (reduced quality) LBR and 156 minutes ( 120 + 30% ) for the regular 120 minute templates I have to do some test encodes

-kwag
#9
11-26-2002, 02:41 PM
 Boulder Free Member Join Date: Sep 2002 Location: Lahti, Finland Posts: 1,652 Thanks: 0 Thanked 0 Times in 0 Posts
I can't use v2.07 and 2.5a on the same computer. I did just as SansGrip said but no good. If 2.07 is in the system folder, it says "there's no function called ConvertToYV12" (I have to convert my YUY2 capture to YV12) .

Edit: and I can't seem to be able to open the avs script in TMPGEnc with 2.5a. Despite the line ConvertToRGB24(), TMPGEnc just crashes.

OS is WinXP, if this is of any use.
#10
11-26-2002, 03:24 PM
 SansGrip Free Member Join Date: Nov 2002 Location: Ontario, Canada Posts: 1,135 Thanks: 0 Thanked 0 Times in 0 Posts
Quote:
 Originally Posted by Boulder I can't use v2.07 and 2.5a on the same computer. I did just as SansGrip said but no good. If 2.07 is in the system folder, it says "there's no function called ConvertToYV12" (I have to convert my YUY2 capture to YV12) .
When Windows looks for "avisynth.dll" it looks first in the current directory, only moving to other places (such as your system folder) if it doesn't find it. This means only avs scripts in the same folder as the 2.5 dll will use that version. All others will use 2.07.

Quote:
 Originally Posted by Boulder Edit: and I can't seem to be able to open the avs script in TMPGEnc with 2.5a. Despite the line ConvertToRGB24(), TMPGEnc just crashes.
You'll need to make sure that TMPGEnc is using the 2.5 directory as its working directory, otherwise it'll load the 2.07 dll and crash. To do this you could either copy TMPGEnc and all its files into that directory too, or you could make a new shortcut to it, and edit the working/current directory entry in the shortcut properties.
#11
11-26-2002, 04:51 PM
 Boulder Free Member Join Date: Sep 2002 Location: Lahti, Finland Posts: 1,652 Thanks: 0 Thanked 0 Times in 0 Posts
Quote:
 Originally Posted by SansGrip When Windows looks for "avisynth.dll" it looks first in the current directory, only moving to other places (such as your system folder) if it doesn't find it. This means only avs scripts in the same folder as the 2.5 dll will use that version. All others will use 2.07. You'll need to make sure that TMPGEnc is using the 2.5 directory as its working directory, otherwise it'll load the 2.07 dll and crash. To do this you could either copy TMPGEnc and all its files into that directory too, or you could make a new shortcut to it, and edit the working/current directory entry in the shortcut properties.

The script was in the same directory.. VDubMod should probably be pointing to the very same directory just as TMPGEnc. That would make some sense. I'll have to experiment with this as I think that most plugin authors will end up writing only 2.5 plugins - and I can't live without your latest plugins!
#12
11-26-2002, 05:42 PM
 SansGrip Free Member Join Date: Nov 2002 Location: Ontario, Canada Posts: 1,135 Thanks: 0 Thanked 0 Times in 0 Posts
Quote:
 Originally Posted by Boulder The script was in the same directory..
That's strange, then. If the script is in the same directory as the 2.5 dll and the 2.5 filters you want to use, you should be able to double-click the script and watch it in WMP. If that doesn't work then something strange is going on.

Quote:
 Originally Posted by Boulder I'll have to experiment with this as I think that most plugin authors will end up writing only 2.5 plugins
It's not that there's much difference writing 2.5 filters as 2.07 filters, at least as far as YUY2 goes. In fact, pretty much all a plugin writer has to do is recompile the filter using the new 2.5 Avisynth header file.

The big difference is that 2.5 supports YV12, and it's generally much easier to make filters that operate on YV12 than on YUY2 (though there are some caveats). They also generally run faster, sometimes as much as 25-30%.

Since it was decided that supporting YV12 would be a good idea (and it is), I look forward to the day when everyone is using 2.5 and YV12 and I won't have to write two versions of everything, which is a major pain in the neck .
#13
11-27-2002, 04:08 AM
 Boulder Free Member Join Date: Sep 2002 Location: Lahti, Finland Posts: 1,652 Thanks: 0 Thanked 0 Times in 0 Posts
Quote:
 Originally Posted by SansGrip Since it was decided that supporting YV12 would be a good idea (and it is), I look forward to the day when everyone is using 2.5 and YV12 and I won't have to write two versions of everything, which is a major pain in the neck .
I completely agree. As it's possible to use 2.5 with YUY2, there's really no need for the older one when 2.5 is considered non-alpha or -beta. The only thing that bugs me is that some 2.5 filters, for example Convolution3d, want YV12 data so I'll have to convert to YV12 if I want to use them.
#14
11-27-2002, 04:55 PM
 SansGrip Free Member Join Date: Nov 2002 Location: Ontario, Canada Posts: 1,135 Thanks: 0 Thanked 0 Times in 0 Posts
Here's a present for y'all .
#15
11-29-2002, 12:49 PM
 SansGrip Free Member Join Date: Nov 2002 Location: Ontario, Canada Posts: 1,135 Thanks: 0 Thanked 0 Times in 0 Posts
What, no-one's tried it yet??
#16
11-29-2002, 01:22 PM
 Boulder Free Member Join Date: Sep 2002 Location: Lahti, Finland Posts: 1,652 Thanks: 0 Thanked 0 Times in 0 Posts
I experimented shortly with Tom's original AVS2.5 version. It seems that the filter messes up permanent subtitles quite easily. As we here in Finland have non-Finnish programs subtitled and I use permanent subs in VCDs, it is a problem I'll have to solve before taking it into everyday use. I could live without subtitles but my wife couldn't - now what can you say to that

Unfortunately I haven't had the time to experiment with different parms, but I think I'll try to do that tomorrow. If you happen to have any tips, I'm all ears.
#17
12-02-2002, 04:49 AM
 Graal_CPM Free Member Join Date: Jun 2002 Location: Paris, France Posts: 54 Thanks: 0 Thanked 0 Times in 0 Posts
Hi Boulder!

You can try to put permanent subs command at the very end of your avisynth script .

Thanx SansGrip's AviSynth 2.0.X version, I have done few testings with dctfilter myself and it is very promising. Right now, here is the kinda "production script", I use to encode in PAL 352x288 with KVCD LBR :

BilinearResize
FluxSmooth()
BB_Resolution = 352*288
BB_StrengthConstant = 352 * 240 * 20 # Base strength
StrengthValue = round(BB_StrengthConstant / BB_Resolution)
Blockbuster( method="noise", detail_min=1, detail_max=10, variance=1 )
Blockbuster( method="sharpen", detail_min=20, detail_max=90, strength=StrengthValue )
DctFilter(1,1,1,1,1,1,.5,0)
VobSub
LegalClip()

Quality is fine with Q around 35. I should try this with KVCDx3.

Cheers.

Edit : maybe you were you talking about permanent subs *already* burned into the movie, like on some hudge trailers you can find around the internet?
#18
12-02-2002, 06:16 AM
 Boulder Free Member Join Date: Sep 2002 Location: Lahti, Finland Posts: 1,652 Thanks: 0 Thanked 0 Times in 0 Posts
Thanks for the tip, Graal_CPM. I was just about to report that in the AVS2.0x version of the filter, the permanent subs are not affected!However, it could be that I've done something differently, so I'll have to test the AVS2.5 version again.

Compression seems to increase nicely without a loss of details with light settings
#19
12-06-2002, 06:47 AM
 jp Free Member Join Date: May 2002 Posts: 6 Thanks: 0 Thanked 0 Times in 0 Posts
I can't access www.jungleweb.net from Portugal.
Where else can I get the DCT filter 2.0x ?
I'm willing to try it because with the reduction of Max GOP in the last templates it's very dificult to put 1 film in 1 CD at 352*576.

JP

caldas_lopes@clix.pt
#20
12-06-2002, 08:52 AM
 fozzieb Free Member Join Date: Sep 2002 Location: Scotland Posts: 46 Thanks: 0 Thanked 0 Times in 0 Posts
I cant access it either, it must be down

 Similar Threads Thread Thread Starter Forum Replies Last Post Prodater64 Audio Conversion 2 12-27-2005 03:17 PM supermule Avisynth Scripting 1 10-23-2005 08:06 AM marcellus Avisynth Scripting 3 04-21-2004 01:00 PM nighthawk Avisynth Scripting 3 01-31-2004 12:24 PM black prince Avisynth Scripting 6 11-28-2002 08:51 AM