1 __global__ void kernel_convoSepShx8pH(unsigned char *output, int j_dim, int r)
5 float outval0=0.0, outval1=0.0, outval2=0.0, outval3=0.0, outval4=0.0, outval5=0.0, outval6=0.0, outval7=0.0 ;
6 int bdimX = blockDim.x<<3 ;
7 int tidX = threadIdx.x<<3 ;
9 // coordonnees absolues du point de base
10 int j = (__umul24(blockIdx.x,blockDim.x) + threadIdx.x)<<3 ;
11 int i = __umul24( blockIdx.y, blockDim.y) + threadIdx.y ;
12 int j0= __umul24(blockIdx.x,blockDim.x)<<3 ;
13 int idx = __umul24(i,j_dim) + j ; // indice dans l'image
17 int idrow = threadIdx.y*(bdimX+k-1) ;
19 extern __shared__ unsigned char roi8p[];
23 roi8p[ idrow + tidX +p ] = tex2D(tex_img_inc, j-r+p , i) ;
26 if ( threadIdx.x < r ) //...ou plutot ce qu'il en manque
28 roi8p[ idrow + bdimX + threadIdx.x ] = tex2D( tex_img_inc, j0-r +bdimX+threadIdx.x , i ) ;
29 roi8p[ idrow + bdimX + threadIdx.x +r ] = tex2D( tex_img_inc, j0 +bdimX+threadIdx.x , i ) ;
34 // calculs de convolution
36 for (jc=0 ; jc<k ; jc++)
38 int baseRoi = idrow + tidX +jc ;
39 float valMask = mask[ jc ] ;
40 outval0 += valMask*roi8p[ baseRoi ] ;
41 outval1 += valMask*roi8p[ baseRoi +1 ] ;
42 outval2 += valMask*roi8p[ baseRoi +2 ] ;
43 outval3 += valMask*roi8p[ baseRoi +3 ] ;
44 outval4 += valMask*roi8p[ baseRoi +4 ] ;
45 outval5 += valMask*roi8p[ baseRoi +5 ] ;
46 outval6 += valMask*roi8p[ baseRoi +6 ] ;
47 outval7 += valMask*roi8p[ baseRoi +7 ] ;
50 // 1 pixel par thread --> global mem
51 output[ idx ] = outval0 ;
52 output[ idx+1 ] = outval1 ;
53 output[ idx+2 ] = outval2 ;
54 output[ idx+3 ] = outval3 ;
55 output[ idx+4 ] = outval4 ;
56 output[ idx+5 ] = outval5 ;
57 output[ idx+6 ] = outval6 ;
58 output[ idx+7 ] = outval7 ;