diff options
| author | Tim Redfern <tim@eclectronics.org> | 2013-08-16 14:52:13 +0100 |
|---|---|---|
| committer | Tim Redfern <tim@eclectronics.org> | 2013-08-16 14:52:13 +0100 |
| commit | 5084f2e72df92416254905811af99f6e419de0cf (patch) | |
| tree | a78214a32c41942a544841b328df1276186c8bf1 | |
| parent | 10f50e4a6b8cbe83cf8c9bee238afe93a5958053 (diff) | |
fix command string issue on video load
| -rw-r--r-- | rotord/src/rendercontext.cpp | 26 | ||||
| -rwxr-xr-x | rotord/src/rotor.h | 71 |
2 files changed, 78 insertions, 19 deletions
diff --git a/rotord/src/rendercontext.cpp b/rotord/src/rendercontext.cpp index 4825b96..0737b2d 100644 --- a/rotord/src/rendercontext.cpp +++ b/rotord/src/rendercontext.cpp @@ -62,8 +62,8 @@ void Render_context::session_command(const Session_command& command,xmlIO& XML,H s+=c; s+=" "; } - cerr<<"uid:"<<command.uid<<" method:"<<command.method<<" id:"<<command.id\ - <<" commands:"<<s<<"body:"<<command.body<<endl; + //cerr<<"uid:"<<command.uid<<" method:"<<command.method<<" id:"<<command.id\ + //<<" commands:"<<s<<"body:"<<command.body<<endl; Logger& logger = Logger::get("Rotor"); status=HTTPResponse::HTTP_BAD_REQUEST; //error by default @@ -177,8 +177,8 @@ void Render_context::session_command(const Session_command& command,xmlIO& XML,H if (audio_loaded) { add_queue(Session_task(command.uid,ANALYSE_AUDIO)); status=HTTPResponse::HTTP_OK; - logger.information("Starting audio analysis for graph: "+command.id); - XML.addValue("status","Starting audio analysis for graph: "+command.id); + logger.information("Starting audio analysis for graph: "+command.commands[0]); + XML.addValue("status","Starting audio analysis for graph: "+command.commands[0]); } } else { @@ -197,8 +197,8 @@ void Render_context::session_command(const Session_command& command,xmlIO& XML,H if (audio_loaded) { add_queue(Session_task(command.uid,ANALYSE_AUDIO)); status=HTTPResponse::HTTP_OK; - logger.information("Starting audio analysis for graph: "+command.id); - XML.addValue("status","Starting audio analysis for graph: "+command.id); + logger.information("Starting audio analysis for graph: "+command.commands[0]); + XML.addValue("status","Starting audio analysis for graph: "+command.commands[0]); } } else { @@ -209,8 +209,8 @@ void Render_context::session_command(const Session_command& command,xmlIO& XML,H } else { status=HTTPResponse::HTTP_NOT_FOUND; - logger.error("ERROR: "+command.id+" not found"); - XML.addValue("error",command.id+" not found"); + logger.error("ERROR: "+command.commands[0]+" not found"); + XML.addValue("error",command.commands[0]+" not found"); } } } @@ -263,17 +263,17 @@ void Render_context::session_command(const Session_command& command,xmlIO& XML,H //check file exists Poco::File f=Poco::File(video_filename); if (f.exists()) { - if (load_video(command.id,video_filename)) { + if (load_video(command.commands[2],video_filename)) { //pass to worker thread ??if engine is ready?? ??what if engine has finished but results aren't read?? //DUMMY RESPONSE status=HTTPResponse::HTTP_OK; - logger.information("Succesfully loaded "+command.body+" into video node "+command.id); - XML.addValue("status","Succesfully loaded "+command.body+" into video node "+command.id); + logger.information("Succesfully loaded "+command.body+" into video node "+command.commands[2]); + XML.addValue("status","Succesfully loaded "+command.body+" into video node "+command.commands[2]); } else { status=HTTPResponse::HTTP_INTERNAL_SERVER_ERROR; - logger.error("ERROR: could not load "+command.body+" into video node "+command.id); - XML.addValue("error","could not load "+command.body+" into video node "+command.id); + logger.error("ERROR: could not load "+command.body+" into video node "+command.commands[2]); + XML.addValue("error","could not load "+command.body+" into video node "+command.commands[2]); } } else { diff --git a/rotord/src/rotor.h b/rotord/src/rotor.h index e1d4c9e..0d46bdc 100755 --- a/rotord/src/rotor.h +++ b/rotord/src/rotor.h @@ -385,7 +385,7 @@ namespace Rotor { Signal_greyscale(){ create_signal_input("Signal","Signal input"); title="Signal greyscale"; - description="Renders signal level (0..1) as greyscale background"; + description="Renders signal level as greyscale background"; }; Signal_greyscale(map<string,string> &settings):Signal_greyscale() { base_settings(settings); @@ -456,11 +456,11 @@ namespace Rotor { public: Luma_levels(){ create_image_input("image input","Image input"); - create_parameter("black_in","number","input black point (0..1)","Input black point",0.0f,0.0f,1.0f); - create_parameter("white_in","number","input white point (0..1)","Input white point",1.0f,0.0f,1.0f); + create_parameter("black_in","number","input black point","Input black point",0.0f,0.0f,1.0f); + create_parameter("white_in","number","input white point","Input white point",1.0f,0.0f,1.0f); create_parameter("gamma","number","gamma level","Gamma",1.0f,0.0f,10.0f); - create_parameter("black_out","number","output black point (0..1)","Output black point",0.0f,0.0f,1.0f); - create_parameter("white_out","number","output white point (0..1)","Output white point",1.0f,0.0f,1.0f); + create_parameter("black_out","number","output black point","Output black point",0.0f,0.0f,1.0f); + create_parameter("white_out","number","output white point","Output white point",1.0f,0.0f,1.0f); title="Luma levels"; description="Remap luma values of image"; LUT=nullptr; @@ -528,7 +528,7 @@ namespace Rotor { Echo_trails(){ //calls base class constructor first create_parameter("number","number","number of echoes","Number echoes",25.0f); - create_parameter("fadeto","number","amount that echoes fade out (0..1)","Fadout amount",1.0f,0.0f,1.0f); + create_parameter("fadeto","number","amount that echoes fade out","Fadout amount",1.0f,0.0f,1.0f); create_attribute("mode","blend mode for echoes","Blend mode","screen",{"screen","wrap"}); title="Echo trails"; description="Draw trail frames additively that fade off over time"; @@ -614,6 +614,65 @@ namespace Rotor { int interval,total,lastframe; //number of frames between displayed echoes unordered_map<int,Image*> images; }; + /* + class RGB_levels: public Image_node { + public: + Luma_levels(){ + create_image_input("image input","Image input"); + create_parameter("red_black_in","number","Red input black-point","Red input black-point",0.0f,0.0f,1.0f); + create_parameter("red_white_in","number","Red input white-point","Red input white-point",1.0f,0.0f,1.0f); + create_parameter("red gamma","number","red gamma level","Red gamma",1.0f,0.0f,10.0f); + create_parameter("red_black_out","number","output black point","Output black point",0.0f,0.0f,1.0f); + create_parameter("red_white_out","number","output white point","Output white point",1.0f,0.0f,1.0f); + create_parameter("black_in","number","input black point","Input black point",0.0f,0.0f,1.0f); + create_parameter("white_in","number","input white point","Input white point",1.0f,0.0f,1.0f); + create_parameter("gamma","number","gamma level","Gamma",1.0f,0.0f,10.0f); + create_parameter("black_out","number","output black point","Output black point",0.0f,0.0f,1.0f); + create_parameter("white_out","number","output white point","Output white point",1.0f,0.0f,1.0f); + create_parameter("black_in","number","input black point","Input black point",0.0f,0.0f,1.0f); + create_parameter("white_in","number","input white point","Input white point",1.0f,0.0f,1.0f); + create_parameter("gamma","number","gamma level","Gamma",1.0f,0.0f,10.0f); + create_parameter("black_out","number","output black point","Output black point",0.0f,0.0f,1.0f); + create_parameter("white_out","number","output white point","Output white point",1.0f,0.0f,1.0f); + title="Luma levels"; + description="Remap luma values of image"; + LUT=nullptr; + }; + Luma_levels(map<string,string> &settings):Luma_levels() { + base_settings(settings); + } + ~Luma_levels(){if (LUT) { delete[] LUT;} }; + void generate_LUT(){ + //can check here if anything has changed + if (LUT) delete[] LUT; + LUT=new unsigned char[256]; + float fltmax=(255.0f/256.0f); + for (int i=0;i<256;i++){ + LUT[i]=(unsigned char)(((pow(min(fltmax,max(0.0f,(((((float)i)/256.0f)-parameters["black_in"]->value)/(parameters["white_in"]->value-parameters["black_in"]->value)))),(1.0/parameters["gamma"]->value))*(parameters["white_out"]->value-parameters["black_out"]->value))+parameters["black_out"]->value)*255.0f); + } + } + void apply_LUT(const Image& in){ + apply_LUT(in,image); + } + void apply_LUT(const Image& in,Image &out){ //facility to apply to other images for inherited classes + out.setup(in.w,in.h); + for (int i=0;i<out.w*out.h*3;i++){ + out.RGBdata[i]=LUT[in.RGBdata[i]]; + } + } + Image *output(const Frame_spec &frame){ + Image *in=image_inputs[0]->get(frame); + if (in){ + generate_LUT(); + apply_LUT(*in); + } + return ℑ + } + Luma_levels* clone(map<string,string> &_settings) { return new Luma_levels(_settings);}; + protected: + unsigned char *LUT; + }; + */ #define BLEND_blend 1 #define BLEND_screen 2 #define BLEND_multiply 3 |
