diff --git a/pyebsdindex/opencl/clnlpar.cl b/pyebsdindex/opencl/clnlpar.cl index a93e5ed..3c56b53 100644 --- a/pyebsdindex/opencl/clnlpar.cl +++ b/pyebsdindex/opencl/clnlpar.cl @@ -187,8 +187,8 @@ __kernel void normd( const long nrow = get_global_size(1); const long indx_xy = x+y*ncol; - long i, j; - long indx_j, indx_ij, count; + long i, j, q; + long indx_j, indx_ij; long nnn = (2*sr+1) * (2*sr+1); @@ -197,7 +197,6 @@ __kernel void normd( //printf("%f", sigma_xy); float sigma_ij, nn, dd; - count = 0; for(j=y-nn; j<=y+nn; ++j){ indx_j = (j >= 0) ? (j): abs(j); @@ -205,9 +204,7 @@ __kernel void normd( indx_j = ncol * indx_j; for(i=x-nn; i<=x+nn; ++i){ - dd = d[count+nnn*indx_xy]; - nn = n[count+nnn*indx_xy]; - if (nn > 1e-3){ + indx_ij = (i >= 0) ? (i): abs(i); indx_ij = (indx_ij < ncol) ? (indx_ij): ncol - (indx_ij -ncol +1); indx_ij = (indx_ij + indx_j); @@ -215,12 +212,18 @@ __kernel void normd( sigma_ij *= sigma_ij; sigma_ij = sigma_ij + sigma_xy; - dd -= nn*sigma_ij; - dd /= (sigma_ij * sqrt(2.0*nn)); - //printf("%f\n", dd) ; - d[count+nnn*indx_xy] = dd; + for(q=0;q 1e-3){ + dd -= nn*sigma_ij; + dd /= (sigma_ij * sqrt(2.0*nn)); + //printf("%f\n", dd) ; + d[q+nnn*indx_xy] = dd; + } + } - count += 1; + } }