summaryrefslogtreecommitdiff
path: root/rotord/src/rotor.h
diff options
context:
space:
mode:
Diffstat (limited to 'rotord/src/rotor.h')
-rw-r--r--rotord/src/rotor.h31
1 files changed, 17 insertions, 14 deletions
diff --git a/rotord/src/rotor.h b/rotord/src/rotor.h
index c86eae8..bebb0e2 100644
--- a/rotord/src/rotor.h
+++ b/rotord/src/rotor.h
@@ -187,6 +187,7 @@ namespace Rotor {
string description;
string title;
virtual float get_time_used()=0;
+ virtual float get_time_taken()=0;
};
class Image_input: public Input{
public:
@@ -197,6 +198,7 @@ namespace Rotor {
};
Image* get(const Frame_spec& time);
float get_time_used();
+ float get_time_taken();
};
class Signal_input: public Input{
public:
@@ -207,6 +209,7 @@ namespace Rotor {
};
float get(const Time_spec& time);
float get_time_used();
+ float get_time_taken();
};
class Parameter: public Signal_input{
public:
@@ -364,16 +367,16 @@ namespace Rotor {
if (parameters.find(key)!=parameters.end()) parameters[key]->value=toFloat(value);
};
void reset_timer(){
- time_used=0.0f;
+ time_taken=0.0f;
}
void time_frame(){
struct timeval end_time;
gettimeofday(&end_time, NULL);
- time_used+=((end_time.tv_sec-frame_time.tv_sec) + (end_time.tv_usec-frame_time.tv_usec)/1000000.0);
+ time_taken+=((end_time.tv_sec-frame_time.tv_sec) + (end_time.tv_usec-frame_time.tv_usec)/1000000.0);
}
virtual float get_time_used()=0;
+ float time_taken;
protected:
- float time_used;
struct timeval frame_time;
};
class Signal_node: public Node{
@@ -390,8 +393,9 @@ namespace Rotor {
};
virtual const float output(const Time_spec &time) { return 0.0f; };
float get_time_used(){
- float t=time_used;
- for (auto i:inputs) t-=i->get_time_used();
+ float t=time_taken;
+ for (auto i:inputs) t-=i->get_time_taken();
+ for (auto p:parameters) t-=p.second->get_time_taken();
return t;
}
};
@@ -405,8 +409,8 @@ namespace Rotor {
image_inputs.push_back(new Image_input(_desc,_title,_connect));
};
Image *get_image_output(const Frame_spec &frame) {
- image.setup(frame.w,frame.h);
update((Time_spec)frame);
+ image.setup(frame.w,frame.h);
Image *i=output(frame);
time_frame();
return i;
@@ -414,9 +418,10 @@ namespace Rotor {
virtual Image *output(const Frame_spec &frame)=0;
Image image;
float get_time_used(){
- float t=time_used;
- for (auto i:inputs) t-=i->get_time_used();
- for (auto i:image_inputs) t-=i->get_time_used();
+ float t=time_taken;
+ for (auto i:inputs) t-=i->get_time_taken();
+ for (auto p:parameters) t-=p.second->get_time_taken();
+ for (auto i:image_inputs) t-=i->get_time_taken();
return t;
}
private:
@@ -882,9 +887,7 @@ namespace Rotor {
return nullptr;
}
Video_bank* clone(map<string,string> &_settings) { return new Video_bank(_settings);};
- ~Video_bank(){
-
- };
+ ~Video_bank(){};
private:
int clip_loaded;
float segment_start;
@@ -947,11 +950,11 @@ namespace Rotor {
amount = 1.0f-((track_time-end_peak)/(end_silence-end_peak));
}
}
- if (amount<(1.0f/254.0f)){
+ if (amount<(1.0f/256.0f)){
image.clear();
}
image=(*in);
- if (amount<1.0f){
+ if (amount<(255.0f/256.0f)){
image*=amount;
}
//seems to be outputting correctly but not saving frames