View Full Version : Porting internal filters from VirtualDub?
k0r0n4
26th July 2003, 06:23
I am interested in porting certain internal filters from VirtualDub to AviSynth, namely the "Box Blur" filter and other relatively simple filters. I do, however, have a few questions before I begin.
#1: Is it possible/worthwhile? I have been browsing through VirtualDub's source, and I have found it rather difficult to locate the internal filters. However, even if I found the filters, would it make sense to use them, or are VDub's filters very different from AviSynth's filters? Would it make more sense just to start from scratch?
#2: Would it have the same functionality as most of AviSynth's other filters? For example, could you use it in conjunction with the "Animate" filter?
#3: Does this filter already exist for AviSynth? I've looked around at many other sites hosting AviSynth filters, and haven't found anything similar to this particular one. Am I missing it somewhere?
Richard Berg
26th July 2003, 06:33
#1 -- It's quite possible. VDub filters have a lot of extra callbacks to support the GUI; most of the work isn't dealing with the algorithm, merely stripping away unneeded code. Once you've done so, the API is pretty similar.
#2 -- yes
#3 -- I haven't looked at the code for Box Blur, but if it's just a simple 3x3 kernel then Blur (http://www.avisynth.org/index.php?page=Blur) should suffice.
k0r0n4
26th July 2003, 07:17
Alright, sound great. Oh, and the only reason I am specifically interested in the "Box blur" filter is for lots and LOTS of blur, where the 3x3 kernel just won't suffice. For instance, if you wanted to "Fade out" a scene by making it seem as though it went out of focus. I tried using multiple blur filters like he suggested, but found them to either: A) Really slow down the film (when run at real-time) due to processing required, or B)Not give enough blur. In either case, the script was sloppy, very long, and inefficient. Since the "Box blur" appears to be VERY fast and efficient when used in VDub, it appears to be the perfect filter to port, especially if API is so similar.
Many thanks,
k0r0n4 (Korona)
cheap-red-wine
26th July 2003, 12:38
Correct. Repeated blurs with the Avisynth filters give only a better and better approximation of a Gaussian blur with a fixed width. The box blur is needed, because it supports large radii. The VirtualDub code will of course support RGB32 only, so you'll have some development work to do if you want other color spaces. I may port it if I get some spare moments, because I have needed it as well. An intermediate step would be to convert the filter to an external VirtualDub plugin (which is easy) and then load it using LoadVirtualDubPlugin().
Kurosu
26th July 2003, 20:22
Most smoothers with high enough thresholds and radius (provided they have one, like deen) could provide a bigger kernel, although not exactly doing what they are expected to do, as they will most probably preserve edges.
Didée
27th July 2003, 00:22
If it's only for some fadings, you could also do
BilinearResize(SMALL_SIZE).BilinearResize(ORIGINAL_SIZE)
And if you want to have the effect itself fading, put that into an Animate(...). Et voilà!
- Didée
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.