Commit aa1bc80d77086d2d590f6a11d78c29a9eefa3ae8

Authored by David Mayerich
1 parent e3bdbcab

fixed the signed/unsigned problem with the convolution kernel

Showing 1 changed file with 5 additions and 5 deletions   Show diff stats
stim/cuda/conv2.cuh
@@ -17,7 +17,7 @@ namespace stim{ @@ -17,7 +17,7 @@ namespace stim{
17 17
18 18
19 //the radius of mask 19 //the radius of mask
20 - unsigned r = (M - 1)/2; 20 + int r = (M - 1)/2;
21 21
22 22
23 //calculate the 1D index for this thread 23 //calculate the 1D index for this thread
@@ -32,7 +32,7 @@ namespace stim{ @@ -32,7 +32,7 @@ namespace stim{
32 32
33 if(i < w && j < h){ 33 if(i < w && j < h){
34 34
35 - //copy[idx] = tex2D<float>(texObj, i, j); 35 + //copy[idx] = tex2D<float>(texObj, i+100, j+100);
36 //return; 36 //return;
37 37
38 //tex2D<float>(texObj, i, j); 38 //tex2D<float>(texObj, i, j);
@@ -49,12 +49,12 @@ namespace stim{ @@ -49,12 +49,12 @@ namespace stim{
49 for (int x = i - r; x <= i + r; x++){ 49 for (int x = i - r; x <= i + r; x++){
50 50
51 //idx to mask cordinates(xx, yy) 51 //idx to mask cordinates(xx, yy)
52 - unsigned int xx = x - (i - r);  
53 - unsigned int yy = y - (j - r); 52 + int xx = x - (i - r);
  53 + int yy = y - (j - r);
54 54
55 //T temp = img[y * w + x] * mask[yy * M + xx]; 55 //T temp = img[y * w + x] * mask[yy * M + xx];
56 //sum += img[y * w + x] * mask[yy * M + xx]; 56 //sum += img[y * w + x] * mask[yy * M + xx];
57 - sum += tex2D<T>(texObj, x-50, y+100) * mask[yy * M + xx]; 57 + sum += tex2D<T>(texObj, x, y) * 1.0;//mask[yy * M + xx];
58 } 58 }
59 } 59 }
60 copy[idx] = sum; 60 copy[idx] = sum;