diff options
Diffstat (limited to 'rotord')
| -rw-r--r-- | rotord/src/graph.cpp | 2 | ||||
| -rw-r--r-- | rotord/src/rotor.cpp | 12 | ||||
| -rw-r--r-- | rotord/src/rotor.h | 31 |
3 files changed, 30 insertions, 15 deletions
diff --git a/rotord/src/graph.cpp b/rotord/src/graph.cpp index a6ef7a8..8cf5950 100644 --- a/rotord/src/graph.cpp +++ b/rotord/src/graph.cpp @@ -237,7 +237,7 @@ bool Graph::video_render(const string &output_filename,const float framerate,int logger.information("Video_output: rendered "+output_filename+": in "+toString(mtime)+" seconds"); for (auto n:nodes) { - logger.information(n.second->type+" node "+n.first+" took "+toString(n.second->get_time_used())+" seconds"); + logger.information(n.second->type+" node '"+n.first+"' took "+toString(n.second->get_time_used())+" seconds"); } if (usingaudio) { diff --git a/rotord/src/rotor.cpp b/rotord/src/rotor.cpp index 9d76626..b1ef2b6 100644 --- a/rotord/src/rotor.cpp +++ b/rotord/src/rotor.cpp @@ -84,6 +84,12 @@ float Signal_input::get_time_used(){ } return 0.0f; } +float Signal_input::get_time_taken(){ + if (connection){ + return ((Signal_node*)connection)->time_taken; + } + return 0.0f; +} bool Signal_input::connect(Node* source) { connection=dynamic_cast<Signal_node*>(source); if (connection) return true; @@ -101,6 +107,12 @@ float Image_input::get_time_used(){ } return 0.0f; } +float Image_input::get_time_taken(){ + if (connection){ + return ((Image_node*)connection)->time_taken; + } + return 0.0f; +} bool Image_input::connect(Node* source) { connection=dynamic_cast<Image_node*>(source); if (connection) return true; 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 |
