summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rotord/Makefile2
-rwxr-xr-xrotord/rotor.h35
2 files changed, 20 insertions, 17 deletions
diff --git a/rotord/Makefile b/rotord/Makefile
index 245a0dd..d2546e0 100644
--- a/rotord/Makefile
+++ b/rotord/Makefile
@@ -9,7 +9,7 @@ MY_CFLAGS = -fpermissive -std=c++11
# -I ../ffmpeg
# The linker options.libgstaasinklibgstaasink.so
-MY_LIBS = -lPocoNet -lPocoXML -lPocoUtil -lPocoFoundation -lvamp-hostsdk -lsndfile -L /usr/local/lib -lswscale -lavcodec -lavformat -lavfilter -lavdevice -lavutil -lgstvideo-0.10 -lgstbase-0.10 -lgstreamer-0.10 -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lxml2 -lglib-2.0 -lgstapp-0.10
+MY_LIBS = -lPocoNet -lPocoXML -lPocoUtil -lPocoFoundation -lvamp-hostsdk -lsndfile -L /usr/local/lib -lswscale -lavcodec -lavformat -lavfilter -lavdevice -lavutil
#MY_LIBS = -lPocoNet -lPocoXML -lPocoUtil -lPocoFoundation -lvamp-hostsdk -lsndfile -L /usr/local/lib -lswscale -lavcodec -lavformat -lavfilter -lavdevice -lavutil $(shell pkg-config gstreamer-0.10 gstreamer-video-0.10 gstreamer-base-0.10 --libs)
# -lgstreamer-0.10 -lgstreamer-video-0.10 -lgstreamer-base-0.10 -lglib-2.0 -lgstapp-0.10
#MY_LIBS = ../libavcodec/ffmpeg/libavcodec/libavcodec.a ../libavcodec/ffmpeg/libavutil/libavutil.a ../libavcodec/ffmpeg/libavformat/libavformat.a ../libavcodec/ffmpeg/libavfilter/libavfilter.a ../libavcodec/ffmpeg/libavdevice/libavdevice.a -lPocoNet -lPocoXML -lPocoUtil -lPocoFoundation -lvamp-hostsdk
diff --git a/rotord/rotor.h b/rotord/rotor.h
index c38a83f..fe0f7d9 100755
--- a/rotord/rotor.h
+++ b/rotord/rotor.h
@@ -128,7 +128,8 @@ namespace Rotor {
class Frame_spec: public Time_spec{
public:
Frame_spec(float _time,float _framerate,float _duration,int _w,int _h){ time=_time; framerate=_framerate; duration=_duration; w=_w; h=_h;};
- Frame_spec(int _frame,float _framerate,float _duration,int _w,int _h){ time=((float)_frame)/_framerate; Frame_spec(time,_framerate,_duration,_w,_h);};
+ Frame_spec(int _frame,float _framerate,float _duration,int _w,int _h){ time=((float)_frame)/_framerate; framerate=_framerate; duration=_duration; w=_w; h=_h;};
+ //Frame_spec(time,_framerate,_duration,_w,_h);};
//float time; //this hould probably be implemented with a num/denom scheme eventually for accuracy
//float framerate;
@@ -769,7 +770,7 @@ namespace Rotor {
Echo_trails(){};
Echo_trails(map<string,string> &settings) {
base_settings(settings);
- duration=find_setting(settings,"duration",1.0f);
+ //duration=find_setting(settings,"duration",1.0f);
number=find_setting(settings,"number",1);
fadeto=find_setting(settings,"fadeto",1.0f);
levels_settings(settings);
@@ -798,16 +799,18 @@ namespace Rotor {
images.clear();
lastframe=-1;
//calculate frame interval
- interval=(int)(((duration/number)*frame.framerate)+0.5);
- total=interval*number;
+ //interval=(int)(((duration/number)*frame.framerate)+0.5);
+ //total=interval*number;
}
int thisframe=frame.frame();
//iterate cache and throw out any obsolete frames
auto i = std::begin(images);
while (i != std::end(images)) {
// check if the image is in the range we need
- if (thisframe-(*i).first>total||thisframe-(*i).first<0)
+ if (thisframe-(*i).first>number||thisframe-(*i).first<0) {
+ delete (*i).second;
i = images.erase(i);
+ }
else
++i;
}
@@ -822,28 +825,28 @@ namespace Rotor {
//copy incoming image **writable
image->free();
image=(((Image_node*)image_inputs[0]->connection)->get_output(frame))->clone();
- for (int i=0;i<number;i++){
+ for (int i=1;i<number;i++){
//check echo frame isn't at negative time
- int absframe=thisframe-(i*interval);
+ int absframe=thisframe-i;
if (absframe>-1){
//check if image is in the cache
if (images.find(absframe)==images.end()){
- //cerr<<"Rotor: preparing image ("<<image->w<<"x"<<image->h<<")"<<endl;
-
- images[absframe]=new Image(image->w,image->h);
- //cerr<<"Rotor: prepared image ("<<images[absframe].w<<"x"<<images[absframe].h<<")"<<endl;
-
+ images[absframe]=new Image(frame.w,frame.h);
Frame_spec wanted=Frame_spec(absframe,frame.framerate,frame.duration,frame.w,frame.h);
- apply_LUT(*(((Image_node*)image_inputs[0]->connection)->get_output(wanted)),*images[absframe]);
+ apply_LUT(*(((Image_node*)image_inputs[0]->connection)->get_output(wanted)),*(images[absframe]));
}
//cerr<<"Rotor: about to apply image ("<<images[absframe].w<<"x"<<images[absframe].h<<")"<<endl;
- if (fless(fadeto,1.0f)){
- Image *temp=*images[absframe]*((float)number/((fadeto*number)+((1.0-fadeto)*i)));
+ if (fless(1.0f,fadeto)){
+ float amount=((((float)number-i)/number)*(1.0f-fadeto))+(1.0f-fadeto);
+ Image *temp=*images[absframe]*amount;
if (mode<0.5) (*image)+=*temp;
else (*image)=image->add_wrap(*temp);
delete temp;
}
- else (*image)+=*images[absframe];
+ else {
+ if (mode<0.5) (*image)+=*(images[absframe]);
+ else (*image)=image->add_wrap(*(images[absframe]));
+ }
}
}
//for (int i=0;i<frame.w*frame.h*3;i++){