summaryrefslogtreecommitdiff
path: root/rotord/src/image.h
diff options
context:
space:
mode:
authorComment <tim@gray.(none)>2013-12-08 10:55:03 +0000
committerComment <tim@gray.(none)>2013-12-08 10:55:03 +0000
commit1d05d2380bb4f1fd265aef55744f432af38b08aa (patch)
tree89c1c15497149951d4b99938ad932abde42eae14 /rotord/src/image.h
parente04516069c71a5a1e32e6a5fbf0eb5b86dcfc5a2 (diff)
switched signals to double and random to uint16
Diffstat (limited to 'rotord/src/image.h')
-rw-r--r--rotord/src/image.h20
1 files changed, 10 insertions, 10 deletions
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;i<w*h*3;i++){
other->RGBdata[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;i<w*h*3;i++){
other->RGBdata[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++) {