diff options
| -rw-r--r-- | rotord/src/rotor.h | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/rotord/src/rotor.h b/rotord/src/rotor.h index 05cff46..b2892de 100644 --- a/rotord/src/rotor.h +++ b/rotord/src/rotor.h @@ -114,6 +114,19 @@ inputs: [ ] + //threading strategy + //thread pool for frames= from a setting + exporter dispatches frames in order and releases threads on completion + seperate thread launched to compress each frame + this is the easiest part and can be done 1st + also decompression threads for video loaders can work 1 frame in advance + + + HOWEVER, anything that depends on the previous frame needs to wait on the previous frame + feedback and echo trails for instance + so there needs to be a hook for this + + -------------------------*/ @@ -418,6 +431,7 @@ namespace Rotor { } void reset(){ time_used=time_taken=0.0; + stored_frame=-1; init(); } double get_time_used(){ @@ -425,7 +439,8 @@ namespace Rotor { } double time_taken,time_used; protected: - struct timeval frame_time; + struct timeval frame_time; + int stored_frame; }; class Signal_node: public Node{ public: @@ -470,10 +485,13 @@ namespace Rotor { }; Image *get_image_output(const Frame_spec &frame) { for (auto i:image_inputs) i->reset_time_taken(); - update((Time_spec)frame); - image.setup(frame.w,frame.h); - Image *i=output(frame); - time_frame(); + if (frame.frame()!=stored_frame){ + update((Time_spec)frame); + image.setup(frame.w,frame.h); + i=output(frame); //an image node may choose to return another nodes frame + time_frame(); + stored_frame=frame.frame(); + } return i; } virtual Image *output(const Frame_spec &frame)=0; @@ -482,6 +500,7 @@ namespace Rotor { image.clear(); } Image image; + Image *i; void time_frame(){ struct timeval end_time; gettimeofday(&end_time, NULL); @@ -489,9 +508,6 @@ namespace Rotor { for (auto i:image_inputs) time_taken-=i->get_time_taken(); time_used+=time_taken; } - private: - double image_time; //? could be used to detect image reuse? - }; class LUT { LUT(){ |
