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 1st September 2003, 04:54   #1  |  Link
stickboy
AviSynth Enthusiast
 
Join Date: Jul 2002
Location: California, U.S.
Posts: 1,268
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:
  • more general (I'm not aware of any filters other than Donald's that use defaults files)
  • less work for filter authors, since authors don't need to write parsing code
  • almost as easy for users, especially if users are given cookie-cutter templates
Anyhow, comments and feedback are appreciated. I'm not terribly happy with how complicated the preset examples look.[1]

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 [, ...]])
Edit:
[1] After several revisions, I'm happier now.
[2] See below.

Last edited by stickboy; 23rd July 2007 at 09:02.
stickboy is offline   Reply With Quote
Old 14th September 2003, 07:05   #2  |  Link
stickboy
AviSynth Enthusiast
 
Join Date: Jul 2002
Location: California, U.S.
Posts: 1,268
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.
stickboy is offline   Reply With Quote
Old 14th September 2003, 12:08   #3  |  Link
jorel
Guest
 
Posts: n/a
"....especially to novice users."

thanks stickboy, really cool.


i never knew about it!
  Reply With Quote
Old 15th September 2003, 01:09   #4  |  Link
Bidoche
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.
Bidoche is offline   Reply With Quote
Old 15th September 2003, 02:44   #5  |  Link
stickboy
AviSynth Enthusiast
 
Join Date: Jul 2002
Location: California, U.S.
Posts: 1,268
Is that a big problem? The same thing would happen with the internal Select function, right? Would it be better if I hacked together a lazy-evaluation system using strings and Eval?
stickboy is offline   Reply With Quote
Old 15th September 2003, 11:11   #6  |  Link
Bidoche
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.
Bidoche is offline   Reply With Quote
Old 2nd March 2004, 12:57   #7  |  Link
stickboy
AviSynth Enthusiast
 
Join Date: Jul 2002
Location: California, U.S.
Posts: 1,268
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.
stickboy is offline   Reply With Quote
Old 3rd March 2004, 05:23   #8  |  Link
hartford
Registered User
 
hartford's Avatar
 
Join Date: Nov 2003
Posts: 324
That's great.

Wish I had a clue.

:confused
hartford is offline   Reply With Quote
Old 3rd March 2004, 05:55   #9  |  Link
stickboy
AviSynth Enthusiast
 
Join Date: Jul 2002
Location: California, U.S.
Posts: 1,268
Is there anything in particular that's confusing you?
stickboy 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:36.


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