View Single Post
Old 18th April 2007, 22:39   #2  |  Link
gzarkadas
Registered User
 
gzarkadas's Avatar
 
Join Date: Sep 2005
Location: 100011110010001000001 10000011111111000001
Posts: 221
Just a thought (maybe wrong):

Since both filters are inside one dll, you can put the ColocKeyFrame data in an STL container (a map) and use child's address as the key. Because many ColorKeyFrame calls may be chained to a single clip, the value of the map should be a container also (a stack, a queue, a vector, a list,..., depending on how ColorInterpolation accesses the data).

ColocKeyFrame pseudocode:
Code:
your_type data = CalcData(child, keyframe);
size_t key = (size_t) child->p;
map<size_t, list<your_type>>::iterator it = global_map.find(key);
if (it == global_map.end()) {
    // first time; init value container
    global_map[key] = new list<your_type>(1, data); 
}
else {
    // not first time; add an element
    it->second.push_back(data);
}
ColocInterpolation pseudocode:
Code:
size_t key = (size_t) second_child->p;
map<size_t, list<your_type>>::iterator it = global_map.find(key);
if (it == global_map.end()) {
    // no values; handle error
    ...
}
else {
    // it->second contains the list with data; do your stuff
    ...
}
__________________
AVSLib, a free extension library for Avisynth. Current version: 1.1.0 (beta), 14/05/2007.
[ Home page | Download page ]
gzarkadas is offline   Reply With Quote