diff options
| author | Tim Redfern <tim@eclectronics.org> | 2014-02-07 13:24:00 +0000 |
|---|---|---|
| committer | Tim Redfern <tim@eclectronics.org> | 2014-02-07 13:24:00 +0000 |
| commit | 22fd121880876005d312827a6a35c9f41c292bb2 (patch) | |
| tree | f7527a3ae626b8a5915da2a0a91e20a7958593cd /rotord | |
| parent | 775dc6bcc5f5c23319bb92315140c154a79fe6f8 (diff) | |
curiouser and curiouser
Diffstat (limited to 'rotord')
| -rw-r--r-- | rotord/Makefile | 2 | ||||
| -rw-r--r-- | rotord/src/cvimage.cpp | 14 | ||||
| -rw-r--r-- | rotord/src/cvimage.h | 4 | ||||
| -rw-r--r-- | rotord/src/rotor.h | 10 |
4 files changed, 17 insertions, 13 deletions
diff --git a/rotord/Makefile b/rotord/Makefile index 5fc7dac..dcf2a9f 100644 --- a/rotord/Makefile +++ b/rotord/Makefile @@ -5,7 +5,7 @@ #MY_CFLAGS = -fpermissive -std=c++11 -Wno-error -I /opt/gstreamer-sdk/include/gstreamer-0.10/ -I /opt/gstreamer-sdk/include/glib-2.0 -I /opt/gstreamer-sdk/lib/glib-2.0/include -I /opt/gstreamer-sdk/include/libxml2 $(shell pkg-config gstreamer-0.10 gstreamer-video-0.10 gstreamer-base-0.10 --cflags) #MY_CFLAGS = -Wswitch -fpermissive -std=c++11 -I /usr/include/librsvg-2.0/librsvg -I /usr/include/glib-2.0 -I /usr/lib/x86_64-linux-gnu/glib-2.0/include -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/opencv -I /usr/include/cairo -I /usr/include/jsoncpp #-Wno-error $(shell pkg-config gstreamer-0.10 gstreamer-video-0.10 gstreamer-base-0.10 --cflags) -MY_CFLAGS = -Wswitch -fpermissive -std=c++11 `pkg-config --cflags --libs gtk+-2.0` -I /usr/include/librsvg-2.0/librsvg -I /usr/include/opencv -I /usr/include/cairo -I /usr/include/jsoncpp +MY_CFLAGS = -g -Wswitch -fpermissive -std=c++11 `pkg-config --cflags --libs gtk+-2.0` -I /usr/include/librsvg-2.0/librsvg -I /usr/include/opencv -I /usr/include/cairo -I /usr/include/jsoncpp # -I ../ffmpeg diff --git a/rotord/src/cvimage.cpp b/rotord/src/cvimage.cpp index 21e4e2f..b255848 100644 --- a/rotord/src/cvimage.cpp +++ b/rotord/src/cvimage.cpp @@ -176,11 +176,13 @@ namespace Rotor { } Image & Image::operator=(const Image &other) { //can be optimised? was trying to use other.data.clone() - setup(other.w,other.h); - //for (int i=0;i<h*w*3;i++) { - // rgb.data[i]=other.rgb.data[i]; - //} - memcpy(rgb.data,other.rgb.data,h*w*3); //saves ~2.4 ms copying a 640x360 image + if (setup(other.w,other.h)){ + //for (int i=0;i<h*w*3;i++) { + // rgb.data[i]=other.rgb.data[i]; + //} + memcpy(rgb.data,other.rgb.data,h*w*3); //saves ~2.4 ms copying a 640x360 image + + } return *this; } //channel rearrangement @@ -245,6 +247,6 @@ namespace Rotor { cv::resize(rgb,mip,cv::Size(nw,nh),0,0,cv::INTER_AREA ); mipmaps[level]=mip; return mipmaps[level]; - + } } diff --git a/rotord/src/cvimage.h b/rotord/src/cvimage.h index bc9c13d..d3f824c 100644 --- a/rotord/src/cvimage.h +++ b/rotord/src/cvimage.h @@ -175,7 +175,7 @@ namespace Rotor { // Mat::Mat(int rows, int cols, int type, void* data, size_t step=AUTO_STEP) rgb=cv::Mat(_h,_w,CV_8UC3,pRGBdata,(_w*3)+linepadding); //std::cerr<<"created cv::Mat with step= "<<rgb.step<<",should be "<<((_w*3)+linepadding)<<std::endl; - + RGBdata=rgb.data; //can move to use the bare pointer eventually ownsRGBdata=false; //will not be necessary w=_w; @@ -299,4 +299,4 @@ namespace Rotor { }; } -#endif
\ No newline at end of file +#endif diff --git a/rotord/src/rotor.h b/rotord/src/rotor.h index eb8dce9..a7cdbdc 100644 --- a/rotord/src/rotor.h +++ b/rotord/src/rotor.h @@ -933,6 +933,7 @@ namespace Rotor { return false; } bool get_frame(double wanted,const Frame_spec &frame){ + wanted=max(0.0,wanted); if (attributes["frame_mode"]->intVal==VIDEOFRAMES_blend){ if (((int)wanted)!=lastframe){ //get a new pair of frames possibly by switching the next one @@ -966,8 +967,9 @@ namespace Rotor { Poco::Logger& logger = Poco::Logger::get(Log_name); logger.error("Video_loader failed to seek frame "+toString(wanted)+" of "+attributes["filename"]->value); - if (image.w>0) return ℑ //just return the previous frame if possible - else return nullptr; + //if (image.w>0) return true; //just return the previous frame if possible + //else + return false; } image.setup_fromRGB(frame.w,frame.h,players[clip_loaded].frame->Data[0],players[clip_loaded].frame->Linesize[0]-(frame.w*3)); } @@ -996,7 +998,7 @@ namespace Rotor { players.resize(attributes["filenames"]->vals.size()); ph=seg==0?ph:fmod(ph,seg); if (clip_loaded!=wv){ - if (load(wv)) { + if (load(wv)) { //always checks if loading is succesful clip_loaded=wv; isLoaded=true; } @@ -1005,7 +1007,7 @@ namespace Rotor { // clip_loaded=-1; //} } - if (isLoaded){ + if (isLoaded){ //always checks if loading is succesful int wanted=0.0; int thisframe=((Time_spec)frame).frame(); double clipframerate=(parameters["framerate"]->value==0.0?players[clip_loaded].get_framerate():parameters["framerate"]->value); |
