Log in

View Full Version : Wilbert, how do your VirtualDub functions work?


FredThompson
16th July 2003, 04:28
I'm looking at what you've created for Valentim Batista's Smart Smoother and trying to use it as a model for his Pops VirtualDub filter.

As an example:

LoadVirtualdubPlugin(VirtualDub_plugin_directory+"\shadowsmoother07.vdf", "_VD_ShadowSmoother")
return clip._VD_ShadowSmoother(default(threshold,4), default(strength,15), default(difference,2),
\ default(pixellock,false)?1:0, default(noiselock,false)?1:0, default(postsmooth,false)?1:0)

OK, there is no checkbox called "pixellock" in the configuration window for Shadow Smoother. There IS something labelled, "Pixel Locking." Would this mean the Pops setting for "Color Tolerance" could be called "colortolerance?"

Here's what I've coded but I'm not sure it's correct. Would you please look this over and let me know if it looks proper?

Here are the relevant lines from a VirtualDub vcf of the defaults:

VirtualDub.video.filters.Add("pops (0.1)");
VirtualDub.video.filters.instance[0].Config(12,64,192,12,48,1,4689095);

As a second question, is there a way to define the legal range for an int such that attempting to pass an invalid one will generate a script error?

(darn space filter is making this harder to read. :mad: )

###########################################
# Pops by Valentim Batista, v0.1 #
# threshold (0-20) d=8 #
# black level (0-128) d=64 #
# white level (0-128) d=192 #
# color tolerance (0-24) d=12 #
# maximum pop width (0-128) d=48 #
# stability window (frames) (5-8) d=7 #
# denoise (T/F) d=T #
# debug (T/F) d=F #
###########################################

function VD_Pops(clip clip, \
int "threshold", \
int "blacklevel", \
int "whitelevel", \
int "colortolerance", \
int "maximumpopwidth", \
int "stabilitywindow", \
bool "denoise", \
bool "debug" )
{
LoadVirtualdubPlugin(VirtualDub_plugin_directory+"\pops01.vdf", "_VD_Pops")

return clip._VD_Pops(default(threshold,8), \
default(blacklevel,64), \
default(whitelevel,192), \
default(colortolerance,12), \
default(maximumpopwidth,48), \
default(stabilitywindow,7), \
default(pixellock,true)?1:0, \
default(debug,false)?1:0)
}

# example:
# ConvertToRGB()
# VD_Pops()
# ConvertToYUY2()

Wilbert
16th July 2003, 15:32
OK, there is no checkbox called "pixellock" in the configuration window for Shadow Smoother. There IS something labelled, "Pixel Locking." Would this mean the Pops setting for "Color Tolerance" could be called "colortolerance?"
How you call it doesn't matter. colortolerance is fine, Color Tolerance is also fine, as long as people recognize it :)

As a second question, is there a way to define the legal range for an int such that attempting to pass an invalid one will generate a script error?
This should be possible using Assert. For example: Assert(0<=x<=2) If that doesn't work: (Assert(x>=0) && Assert(x<=2))

As for your script. Could you give a link to this vdub filter, so that I can check it?

FredThompson
16th July 2003, 16:18
The script is on http://www.geocities.com/fredthompson6

All the pops stuff is commented out and the script itself is quite ugly. It's still a developmental shell.

I'm aware of the large number of colorspace conversions. Those are there because I was playing with filter order and location. It was easier to put a conversion before each filtering step than to try to figure out why the script would die. After I'm satisfied with the basic results colorspace will be fixed. It's actually a bit of a problem as the source is NTSC DV, VirtualDub Filters require RGB and one of the main areas requires YV12.

Acaila
16th July 2003, 16:38
I may not be understanding your intentions correctly, if so please excuse me :). And the link you gave doesn't work, so I can't check your intentions there.

There is no need to write an (often complicated) script for a VirtualDub filter to be able to use the filter in Avisynth. All you need to do is the following:
- Go to http://www.avisynth.org/~warpenterprises/ and download the "WarpSharp Package"
- Place LoadPluginEx.dll in your Avisynth directory
- Open VirtualDubMod
- Load (only) the plugin that you need and configure it as you like
- Press CRTL-S to save the settings to a file
- Add to your avisynth script:
LoadPlugin("xxx\LoadPluginEx.dll")
LoadPlugin("xxx\VirtualDubMod\Plugins\plugin_name.vdf")
ConvertToYUY2() or ConvertToRGB() (or whatever you need)
plugin_name("settings_file.vcf")
ConvertToYV12()

Where 'plugin_name' is the name of the plugin and 'settings_file' is the file you saved the settings to.

sh0dan
16th July 2003, 17:02
Why do you use LoadPlugInEx?

I'm probably missing something here, but it isn't needed to load vdub plugins.

FredThompson
16th July 2003, 17:05
GeoCities has a bandwidth limit per hour. It was exceeded when you tried to view the page.

The script has other components and is somewhat awkward right now because I'm still playing with organization. Unfortunately, the colorspace is pretty corrupted but I was working more on properly getting rid of 4:1:1 artifacts and near-black swim. The design idea is it is better to use many different light filterings than one heavy one. Sort of like the way an archaeologist uses many light brushings to remove dirt instead of a shovel.

That's not really important, it's just to let you know why the script is so big and awkward. I was playing with the order of filtering. For example, is it better to smooth near-blacks before or after VHS chroma filtering? Is that better field-oriented or framed for interlaced source? Those are what I was working on most recently.

Something is wrong and I can no longer replicate Xesdeeni's 4:1:1 correction so I decided to stop and let my brain rest for a while.

Wilbert
16th July 2003, 17:20
There is no need to write an (often complicated) script for a VirtualDub filter to be able to use the filter in Avisynth.
True, but the advantage is that you have to do it once.

There's no need to use LoadPluginEx.dll for that. But I don't remember how to load the vcf directly. Something like:

LoadVirtualdubPlugin("xxx\VirtualDubMod\Plugins\pops01.vdf", "pops")
ConvertToRGB()
pops("settings_file.vcf")
ConvertToYV12()

but then differently :confused:

Acaila
16th July 2003, 17:41
sh0dan originally wrote:
I'm probably missing something here, but it isn't needed to load vdub plugins.No apparently I was missing something. Namely that there is a LoadVirtualDubPlugin() command, didn't know that. Thanks :).