__global__ void kernel_convoSepShx8pH(unsigned char *output, int j_dim, int r) { int ic, jc, p; int k = 2*r+1 ; 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 ; int bdimX = blockDim.x<<3 ; int tidX = threadIdx.x<<3 ; // coordonnees absolues du point de base int j = (__umul24(blockIdx.x,blockDim.x) + threadIdx.x)<<3 ; int i = __umul24( blockIdx.y, blockDim.y) + threadIdx.y ; int j0= __umul24(blockIdx.x,blockDim.x)<<3 ; int idx = __umul24(i,j_dim) + j ; // indice dans l'image // chargement en smem int idrow = threadIdx.y*(bdimX+k-1) ; extern __shared__ unsigned char roi8p[]; // bloc 0 (a gauche) for (p=0; p<8; p++) roi8p[ idrow + tidX +p ] = tex2D(tex_img_inc, j-r+p , i) ; // a droite if ( threadIdx.x < r ) //...ou plutot ce qu'il en manque { roi8p[ idrow + bdimX + threadIdx.x ] = tex2D( tex_img_inc, j0-r +bdimX+threadIdx.x , i ) ; roi8p[ idrow + bdimX + threadIdx.x +r ] = tex2D( tex_img_inc, j0 +bdimX+threadIdx.x , i ) ; } __syncthreads(); // calculs de convolution // passe horizontale for (jc=0 ; jc global mem output[ idx ] = outval0 ; output[ idx+1 ] = outval1 ; output[ idx+2 ] = outval2 ; output[ idx+3 ] = outval3 ; output[ idx+4 ] = outval4 ; output[ idx+5 ] = outval5 ; output[ idx+6 ] = outval6 ; output[ idx+7 ] = outval7 ; }