diff options
| author | Comment <tim@gray.(none)> | 2013-12-08 10:55:03 +0000 |
|---|---|---|
| committer | Comment <tim@gray.(none)> | 2013-12-08 10:55:03 +0000 |
| commit | 1d05d2380bb4f1fd265aef55744f432af38b08aa (patch) | |
| tree | 89c1c15497149951d4b99938ad932abde42eae14 /rotord/src/nodes_channels.h | |
| parent | e04516069c71a5a1e32e6a5fbf0eb5b86dcfc5a2 (diff) | |
switched signals to double and random to uint16
Diffstat (limited to 'rotord/src/nodes_channels.h')
| -rw-r--r-- | rotord/src/nodes_channels.h | 108 |
1 files changed, 54 insertions, 54 deletions
diff --git a/rotord/src/nodes_channels.h b/rotord/src/nodes_channels.h index 20fc86c..4782e00 100644 --- a/rotord/src/nodes_channels.h +++ b/rotord/src/nodes_channels.h @@ -8,7 +8,7 @@ namespace Rotor { public: Invert(){ create_image_input("Image to invert","Image input"); - create_parameter("invert","number","Invert when greater than 0.0","Negative",1.0f,0.0f,1.0f); + create_parameter("invert","number","Invert when greater than 0.0","Negative",1.0,0.0,1.0); title="Negative"; description="Inverts the input picture"; NODEID="8676c25c-2d09-11e3-80a7-db36c774523c"; @@ -21,7 +21,7 @@ namespace Rotor { Image *output(const Frame_spec &frame){ Image *in=image_inputs[0]->get(frame); if (in) { - if (parameters["invert"]->value>0.0f){ + if (parameters["invert"]->value>0.0){ for (int i=0;i<in->w*in->h*3;i++) { image.RGBdata[i]=255-in->RGBdata[i]; } @@ -77,7 +77,7 @@ namespace Rotor { Blend(){ create_image_input("image input 1","Image input 1"); create_image_input("image input 2","Image input 2"); - create_parameter("amount","number","amount to blend input 2","Blend amount",0.5f,0.0f,1.0f); + create_parameter("amount","number","amount to blend input 2","Blend amount",0.5f,0.0,1.0); create_attribute("mode","Blend mode","Blend mode","blend",{"blend","screen","multiply","alpha","wrap","xor","overlay","min","max"}); title ="Blend"; description="Blend images in various modes"; @@ -121,7 +121,7 @@ namespace Rotor { break; case BLEND_blend: //has to be last because of initialser of *in? go figure - image*=(1.0f-parameters["amount"]->value); + image*=(1.0-parameters["amount"]->value); /* //problem here with leak //opencv handles not being released Image *in=(*in2)*parameters["amount"]->value; @@ -152,7 +152,7 @@ namespace Rotor { public: Image_arithmetic(){ create_image_input("image input","Image input"); - create_parameter("value","number","Value or signal for operation","Value",1.0f); + create_parameter("value","number","Value or signal for operation","Value",1.0); create_attribute("operator","operator for image","Operator","+",{"+","-","*","/"}); title="Image arithmetic"; description="Performs arithmetic on an image with a signal or value"; @@ -225,17 +225,17 @@ namespace Rotor { Difference_matte(){ create_image_input("image input","Image input"); create_image_input("background input","Background input"); - create_parameter("threshold","number","Difference threshold","Threshold",0.2f,0.0f,1.0f); - create_parameter("feather","number","Feather width","Feather",0.1f,0.0f,1.0f); - create_parameter("weight_h","number","H component weight","Weight H",0.5f,0.0f,1.0f); - create_parameter("weight_s","number","S component weight","Weight S",0.5f,0.0f,1.0f); - create_parameter("weight_v","number","V component weight","Weight V",0.5f,0.0f,1.0f); - create_parameter("blursize","number","Blur size","Blur size",2.0f,0.0f,10.0f); + create_parameter("threshold","number","Difference threshold","Threshold",0.2f,0.0,1.0); + create_parameter("feather","number","Feather width","Feather",0.1f,0.0,1.0); + create_parameter("weight_h","number","H component weight","Weight H",0.5f,0.0,1.0); + create_parameter("weight_s","number","S component weight","Weight S",0.5f,0.0,1.0); + create_parameter("weight_v","number","V component weight","Weight V",0.5f,0.0,1.0); + create_parameter("blursize","number","Blur size","Blur size",2.0,0.0,10.0); create_attribute("mode","Output {image|alpha}","output mode","alpha",{"image","alpha"}); title="Difference matte"; description="Create an alpha channel using a background reference picture"; LUT=nullptr; - NODEID="4db4d2c8-2d0a-11e3-b08b-7fb00f8c562a"; + NODEID="4db4d2c8-2d0a-11e3-b08b-7fb.08c562a"; }; Difference_matte(map<string,string> &settings):Difference_matte() { base_settings(settings); @@ -269,8 +269,8 @@ namespace Rotor { //get euclidean distance in HSV space int dist,d; - float weights[3] = {parameters["weight_h"]->value,parameters["weight_s"]->value,parameters["weight_v"]->value}; - float weight_total=255.0f/pow(pow(weights[0]*255,2)+pow(weights[1]*255,2)+pow(weights[2]*255,2),0.5); + double weights[3] = {parameters["weight_h"]->value,parameters["weight_s"]->value,parameters["weight_v"]->value}; + double weight_total=255.0/pow(pow(weights[0]*255,2)+pow(weights[1]*255,2)+pow(weights[2]*255,2),0.5); for (int i=0;i<frame.w*frame.h;i++){ dist=0; @@ -278,7 +278,7 @@ namespace Rotor { d=((int)hsv1.data[i*3+j])-((int)hsv2.data[i*3+j]); dist+=(d*d)*weights[j]; } - uint8_t id=(uint8_t)(sqrt((float)dist)*weight_total); + uint8_t id=(uint8_t)(sqrt((double)dist)*weight_total); mask.data[i]=id; } @@ -290,7 +290,7 @@ namespace Rotor { d=((int)hsv1.data[i*3+j])-((int)hsv2.data[i*3+j]); dist+=(abs(d))*weights[j]; } - uint8_t id=(uint8_t)(((float)dist)/weight_total); + uint8_t id=(uint8_t)(((double)dist)/weight_total); m=LUT[id]; mask.data[i]=m; } @@ -329,10 +329,10 @@ namespace Rotor { //cerr<<"generating LUT: threshold "<<parameters["threshold"]->value<<", feather "<<parameters["feather"]->value<<endl; if (LUT) delete[] LUT; LUT=new uint8_t[256]; - float minf=max(0.0f,parameters["threshold"]->value-(parameters["feather"]->value*0.5f)); - float maxf=min(1.0f,parameters["threshold"]->value+(parameters["feather"]->value*0.5f)); + double minf=max(0.0,parameters["threshold"]->value-(parameters["feather"]->value*0.5f)); + double maxf=min(1.0,parameters["threshold"]->value+(parameters["feather"]->value*0.5f)); for (int i=0;i<256;i++){ - LUT[i]=(uint8_t)(min(1.0f,max(0.0f,((((float)i)/255.0f)-minf)/(maxf-minf)))*255.0f); + LUT[i]=(uint8_t)(min(1.0,max(0.0,((((double)i)/255.0)-minf)/(maxf-minf)))*255.0); // cerr<<((int)LUT[i])<<" "; } //cerr<<endl; @@ -346,11 +346,11 @@ namespace Rotor { public: Luma_levels(){ create_image_input("image input","Image input"); - 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.0,0.0,1.0); + create_parameter("white_in","number","input white point","Input white point",1.0,0.0,1.0); + create_parameter("gamma","number","gamma level","Gamma",1.0,0.0,10.0); + create_parameter("black_out","number","output black point","Output black point",0.0,0.0,1.0); + create_parameter("white_out","number","output white point","Output white point",1.0,0.0,1.0); title="Luma levels"; description="Remap luma values of image"; LUT=nullptr; @@ -364,9 +364,9 @@ namespace Rotor { //can check here if anything has changed if (LUT) delete[] LUT; LUT=new unsigned char[256]; - float fltmax=(255.0f/256.0f); + double fltmax=(255.0/256.0); 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); + LUT[i]=(unsigned char)(((pow(min(fltmax,max(0.0,(((((double)i)/256.0)-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.0); } } void apply_LUT(const Image& in){ @@ -418,9 +418,9 @@ namespace Rotor { public: 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","Fadout amount",1.0f,0.0f,1.0f); - create_parameter("interval","number","number of frames between echoes","",1.0f,0.0f,1.0f); + create_parameter("number","number","number of echoes","Number echoes",25.0); + create_parameter("fadeto","number","amount that echoes fade out","Fadout amount",1.0,0.0,1.0); + create_parameter("interval","number","number of frames between echoes","",1.0,0.0,1.0); create_attribute("mode","blend mode for echoes","Blend mode","screen",{"screen","wrap","min","max"}); title="Echo trails"; description="Draw trail frames additively that fade off over time"; @@ -478,9 +478,9 @@ namespace Rotor { if (in2) apply_LUT(*(in2),*(images[absframe])); else images[absframe]->clear(); } - if (fless(1.0f,parameters["fadeto"]->value)){ - float fadetime=((float)i)/((float)duration); //0 to 1 - float amount=1.0f-(fadetime*(1.0f-parameters["fadeto"]->value)); + if (fless(1.0,parameters["fadeto"]->value)){ + double fadetime=((double)i)/((double)duration); //0 to 1 + double amount=1.0-(fadetime*(1.0-parameters["fadeto"]->value)); Image *temp=*images[absframe]*amount; if (attributes["mode"]->value=="screen") { image+=*temp; @@ -529,21 +529,21 @@ namespace Rotor { public: RGB_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.01f,10.0f); - create_parameter("red_black_out","number","Red output black point","Red output black point",0.0f,0.0f,1.0f); - create_parameter("red_white_out","number","Red output white point","Red output white point",1.0f,0.0f,1.0f); - create_parameter("green_black_in","number","Green input black point","Green input black point",0.0f,0.0f,1.0f); - create_parameter("green_white_in","number","Green input white point","Green input white point",1.0f,0.0f,1.0f); - create_parameter("green_gamma","number","Green gamma level","Green gamma",1.0f,0.01f,10.0f); - create_parameter("green_black_out","number","Green output black point","Green output black point",0.0f,0.0f,1.0f); - create_parameter("green_white_out","number","Green output white point","Green output white point",1.0f,0.0f,1.0f); - create_parameter("blue_black_in","number","Blue input black point","Blue input black point",0.0f,0.0f,1.0f); - create_parameter("blue_white_in","number","Blue input white point","Blue input white point",1.0f,0.0f,1.0f); - create_parameter("blue_gamma","number","Blue gamma level","Blue gamma",1.0f,0.01f,10.0f); - create_parameter("blue_black_out","number","Blue output black point","Blue output black point",0.0f,0.0f,1.0f); - create_parameter("blue_white_out","number","Blue output white point","Blue output white point",1.0f,0.0f,1.0f); + create_parameter("red_black_in","number","Red input black-point","Red input black-point",0.0,0.0,1.0); + create_parameter("red_white_in","number","Red input white-point","Red input white-point",1.0,0.0,1.0); + create_parameter("red_gamma","number","Red gamma level","Red gamma",1.0,0.01f,10.0); + create_parameter("red_black_out","number","Red output black point","Red output black point",0.0,0.0,1.0); + create_parameter("red_white_out","number","Red output white point","Red output white point",1.0,0.0,1.0); + create_parameter("green_black_in","number","Green input black point","Green input black point",0.0,0.0,1.0); + create_parameter("green_white_in","number","Green input white point","Green input white point",1.0,0.0,1.0); + create_parameter("green_gamma","number","Green gamma level","Green gamma",1.0,0.01f,10.0); + create_parameter("green_black_out","number","Green output black point","Green output black point",0.0,0.0,1.0); + create_parameter("green_white_out","number","Green output white point","Green output white point",1.0,0.0,1.0); + create_parameter("blue_black_in","number","Blue input black point","Blue input black point",0.0,0.0,1.0); + create_parameter("blue_white_in","number","Blue input white point","Blue input white point",1.0,0.0,1.0); + create_parameter("blue_gamma","number","Blue gamma level","Blue gamma",1.0,0.01f,10.0); + create_parameter("blue_black_out","number","Blue output black point","Blue output black point",0.0,0.0,1.0); + create_parameter("blue_white_out","number","Blue output white point","Blue output white point",1.0,0.0,1.0); title="RGB levels"; description="Remap RGB values of image"; LUT=nullptr; @@ -572,20 +572,20 @@ namespace Rotor { for (int i=0;i<3;i++){ LUT[i]=new unsigned char[256]; } - float fltmax=(255.0f/256.0f); + double fltmax=(255.0/256.0); for (int i=0;i<256;i++){ LUT[0][i]=(unsigned char)(((\ - pow(min(fltmax,max(0.0f,(((((float)i)/256.0f)-parameters["red_black_in"]->value)/(parameters["red_white_in"]->value-parameters["red_black_in"]->value))))\ + pow(min(fltmax,max(0.0,(((((double)i)/256.0)-parameters["red_black_in"]->value)/(parameters["red_white_in"]->value-parameters["red_black_in"]->value))))\ ,(1.0/parameters["red_gamma"]->value))\ - *(parameters["red_white_out"]->value-parameters["red_black_out"]->value))+parameters["red_black_out"]->value)*255.0f); + *(parameters["red_white_out"]->value-parameters["red_black_out"]->value))+parameters["red_black_out"]->value)*255.0); LUT[1][i]=(unsigned char)(((\ - pow(min(fltmax,max(0.0f,(((((float)i)/256.0f)-parameters["green_black_in"]->value)/(parameters["green_white_in"]->value-parameters["green_black_in"]->value))))\ + pow(min(fltmax,max(0.0,(((((double)i)/256.0)-parameters["green_black_in"]->value)/(parameters["green_white_in"]->value-parameters["green_black_in"]->value))))\ ,(1.0/parameters["green_gamma"]->value))\ - *(parameters["green_white_out"]->value-parameters["green_black_out"]->value))+parameters["green_black_out"]->value)*255.0f); + *(parameters["green_white_out"]->value-parameters["green_black_out"]->value))+parameters["green_black_out"]->value)*255.0); LUT[2][i]=(unsigned char)(((\ - pow(min(fltmax,max(0.0f,(((((float)i)/256.0f)-parameters["blue_black_in"]->value)/(parameters["blue_white_in"]->value-parameters["blue_black_in"]->value))))\ + pow(min(fltmax,max(0.0,(((((double)i)/256.0)-parameters["blue_black_in"]->value)/(parameters["blue_white_in"]->value-parameters["blue_black_in"]->value))))\ ,(1.0/parameters["blue_gamma"]->value))\ - *(parameters["blue_white_out"]->value-parameters["blue_black_out"]->value))+parameters["blue_black_out"]->value)*255.0f); + *(parameters["blue_white_out"]->value-parameters["blue_black_out"]->value))+parameters["blue_black_out"]->value)*255.0); } } void apply_LUT(const Image& in){ |
