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. |
1st September 2003, 04:54 | #1 | Link |
AviSynth Enthusiast
Join Date: Jul 2002
Location: California, U.S.
Posts: 1,267
|
Making your own default values or presets to filters
I wrote a simplistic article on avisynth.org about writing wrapper functions to specify your own default values or presets to filters.
Yes, it's nothing new, but I don't think it's conceptually obvious to everyone, especially to novice users. I know there's already the filter.def system in use for user-specified default values, but I think that wrapper functions are:
On a side note, I wish there were a version of Select that operated on strings[2]: Code:
SelectByString(string s, string keyA, itemA [, string keyB, itemB [, ...]]) [1] After several revisions, I'm happier now. [2] See below. Last edited by stickboy; 23rd July 2007 at 09:02. |
14th September 2003, 07:05 | #2 | Link |
AviSynth Enthusiast
Join Date: Jul 2002
Location: California, U.S.
Posts: 1,267
|
If anyone cares, I wrote my own SelectByString function, implemented as an AviSynth C plug-in.
Edit: No longer an AviSynth C plug-in. Last edited by stickboy; 11th April 2004 at 09:54. |
15th September 2003, 01:09 | #4 | Link |
Avisynth 3.0 Developer
Join Date: Jan 2002
Location: France
Posts: 639
|
Your solution implies creating clips for each path.
Whereas there may be no (reasonable) alternative at the time being, it appears to me that what you really need is a switch construct. Maybe switch in 3.0 then. |
15th September 2003, 11:11 | #6 | Link |
Avisynth 3.0 Developer
Join Date: Jan 2002
Location: France
Posts: 639
|
It all depends of the filters used, some may allocate big chunks of memory for buffering or initialize lookup tables or...
Better to avoid creating them for nothing then. But don't try to avoid it at all costs. Being aware of the problem may be sufficient. Last edited by Bidoche; 15th September 2003 at 11:16. |
2nd March 2004, 12:57 | #7 | Link |
AviSynth Enthusiast
Join Date: Jul 2002
Location: California, U.S.
Posts: 1,267
|
I'm kind of confused about what's going on with AviSynth C and its transition to the stdcall convention, so I finally got myself access to Visual C++ and compiled an MSVC++ version of my SelectByString plug-in.
SelectByString 0.2.0 is now up. I also rewrote the documentation and examples. It's about as basic as an AviSynth plug-in can be, but let me know if there are any bugs, suggestions, or usage questions. Based on Bidoche's concerns about creating clips for each branch, I've changed my examples to "thunk" values via strings. (Are there any pitfalls to this?) The other advantage to returning strings is that strings are easily abusable in AviSynth. I've updated the Wrapper functions page to demonstrate some of the evil things you can do with strings, linebreaks, and Eval. Here's a snippet: Code:
# We can get Eval to assign multiple variables at once # by putting linebreaks in our strings. Evil! s = SelectByString(preset, \ "default", "r = 4 L = 4 ch = 8 sc = 15 m = 2", \ "sh0dan-soft", "r = 2 L = 3 ch = 3 sc = 6 m = 2", \ "sh0dan-medium", "r = 3 L = 5 ch = 5 sc = 10 m = 2", \ "sh0dan-heavy", "r = 4 L = 8 ch = 8 sc = 10 m = 2") Eval(s) Last edited by stickboy; 23rd July 2007 at 09:02. |
|
|