From 1d05d2380bb4f1fd265aef55744f432af38b08aa Mon Sep 17 00:00:00 2001 From: Comment Date: Sun, 8 Dec 2013 10:55:03 +0000 Subject: switched signals to double and random to uint16 --- rotord/src/image.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'rotord/src/image.h') diff --git a/rotord/src/image.h b/rotord/src/image.h index 68aea09..0f089d1 100644 --- a/rotord/src/image.h +++ b/rotord/src/image.h @@ -14,15 +14,15 @@ namespace Rotor { multiply[i]=new uint8_t[256]; for (int j=0;j<256;j++){ add[i][j]=(uint8_t)min(i+j,0xFF); - multiply[i][j]=(uint8_t)((((float)i)/255.0f)*(((float)j)/255.0f)*255.0f); + multiply[i][j]=(uint8_t)((((double)i)/255.0)*(((double)j)/255.0)*255.0); } } mono_weights=new uint8_t*[3]; - float weights[3]={0.2989, 0.5870, 0.1140}; + double weights[3]={0.2989, 0.5870, 0.1140}; for (int i=0;i<3;i++) { mono_weights[i]=new uint8_t[256]; for (int j=0;j<256;j++){ - mono_weights[i][j]=(uint8_t)(((float)j)*weights[i]); + mono_weights[i][j]=(uint8_t)(((double)j)*weights[i]); } } } @@ -173,7 +173,7 @@ namespace Rotor { //scalar operations allocate a new image. //maybe this could not be the case if the data is owned by this image? //need to look into auto_ptr - Image & operator*=(const float &amount) { + Image & operator*=(const double &amount) { uint8_t *LUT=new uint8_t[256]; for (int i=0;i<256;i++) { LUT[i]=(uint8_t)min(0xFF,max(0,(int)(i*amount))); @@ -185,7 +185,7 @@ namespace Rotor { delete[] LUT; return *this; } - Image * operator*(const float &amount) { + Image * operator*(const double &amount) { Image *other=new Image(w,h); uint8_t *LUT=new uint8_t[256]; for (int i=0;i<256;i++) { @@ -197,11 +197,11 @@ namespace Rotor { delete[] LUT; return other; } - Image * operator+(const float &amount) { + Image * operator+(const double &amount) { Image *other=new Image(w,h); uint8_t *LUT=new uint8_t[256]; for (int i=0;i<256;i++) { - LUT[i]=(uint8_t)min(0xFF,max(0,(int)(i+(amount*255.0f)))); + LUT[i]=(uint8_t)min(0xFF,max(0,(int)(i+(amount*255.0)))); } for (int i=0;iRGBdata[i]=LUT[RGBdata[i]]; @@ -209,11 +209,11 @@ namespace Rotor { delete[] LUT; return other; } - Image * operator-(const float &amount) { + Image * operator-(const double &amount) { Image *other=new Image(w,h); uint8_t *LUT=new uint8_t[256]; for (int i=0;i<256;i++) { - LUT[i]=(uint8_t)min(0xFF,max(0,(int)(i-(amount*255.0f)))); + LUT[i]=(uint8_t)min(0xFF,max(0,(int)(i-(amount*255.0)))); } for (int i=0;iRGBdata[i]=LUT[RGBdata[i]]; @@ -221,7 +221,7 @@ namespace Rotor { delete[] LUT; return other; } - Image * operator/(const float &amount) { + Image * operator/(const double &amount) { Image *other=new Image(w,h); uint8_t *LUT=new uint8_t[256]; for (int i=0;i<256;i++) { -- cgit v1.2.3