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. Domains: forum.doom9.org / forum.doom9.net / forum.doom9.se |
|
|
#1 | Link | |
|
Registered User
Join Date: Feb 2002
Location: Germany
Posts: 541
|
can a filter return a value to the script?
Hello,
is it possible, that a filter returns a value to a script? I'd like to code a keyframe-filter (with GUI) so you can set marks in the video (keyframes=KF). For every KF you can choose a filtersetting (=the value will be returned) example: i set two KF at frame 200 and 500 (clip is 1000f long): KF1: frame=200, filtersetting 1 KF2: frame=500, filtersetting 2 my script: Quote:
frame [000 - 199] stay untouched frame [200 - 499] get blured frame [500 - end] get sharper hanfrunz |
|
|
|
|
|
|
#2 | Link |
|
Retired AviSynth Dev ;)
![]() Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
|
ConditionalReader should do half of what you want.
ConditionalFilter should do the other half. Code:
v = Xsource()
blurred = blur(v,1.0)
sharpened = blur(v,-1.0)
conditionalfilter(v,blurred,v,"blurmode", "=", "1")
conditionalfilter(last,sharpened,last,"blurmode", "=", "2")
conditionalreader("blursettings.txt", "blurmode")
Code:
type int default 0 R 200 499 1 R 500 1499 2
__________________
Regards, sh0dan // VoxPod Last edited by sh0dan; 22nd March 2004 at 22:31. |
|
|
|
|
|
#5 | Link |
|
Registered User
Join Date: Feb 2002
Location: Germany
Posts: 541
|
yes of course it does, but will i see the changes immediately, when i shuttle through the video? Mmh is this done with my first idea? Or is it possible to put a avisynth-script in a filter (like in ffdshow)?
That would be interesting... |
|
|
|
|
|
#9 | Link |
|
Simply me
Join Date: Aug 2002
Location: Lancashire, England
Posts: 610
|
Have a look here
neuron2 invented a system for his Decomb package and I've also copied it for PFR to pass info to KernelDeInt. All code is available at our sites. regards Simon
__________________
http://www.geocities.com/siwalters_uk/fnews.html |
|
|
|
|
|
#10 | Link |
|
Avisynth 3.0 Developer
Join Date: Jan 2002
Location: France
Posts: 639
|
@Fizick
Neuron2 uses extra space in frame buffer to hold his own data, ... as a workaround for the lack of frame properties. It works fine as long as there is no filter between which may alter your metadata. (Filters are NOT required to leave the extra space alone, and in fact they often write on it) If that restriction is unacceptable to you, you can do it like this : (STL code) Code:
#include <map> //for map
#include <string> //for string
#include <utility> //for pair
class InterrogatedFilter
{
typedef std::map<pair<IScriptEnvironment *, std::string>, Clip *> InstanceMap;
static InstanceMap map_;
InterrogatedFilter(std::string const& identif, IScriptEnvironment *env)
{
map_[ std::make_pair(env, identif) ] = this; //reg self into map
}
~InterrogatedFilter()
{
for(InstanceMap::iterator it = map_.begin(); it != map_.end(); ++it )
if ( it->second == this )
{
map_.erase(it);
break;
}
//remove the entry corresponding to this from the instance map
}
static PClip FindInstance(std::string const& identif, IScriptEnvironment *env)
{
InstanceMap::iterator it = map_.find( std::make_pair(env, identif) );
return it != map.end() ? PClip(it->second) : PClip();
}
//Clip methods and interrogation methods ....
};//InterrogatedFilter
class InterrogatingFilter
{
//use InterrogatedFilter::FindInstance somewhere to fetch the (right) clip to interrogate...
//that means you must have the same identif value here to use
};
|
|
|
|
![]() |
|
|