X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/book_gpu.git/blobdiff_plain/1b27427d56ddc474598ea928b11c31bcaf3f1e12..d74981733767eca78dbbe5be810b9b2e239e8aee:/BookGPU/Chapters/chapter3/code/kernMedianRegTri9.cu~?ds=inline diff --git a/BookGPU/Chapters/chapter3/code/kernMedianRegTri9.cu~ b/BookGPU/Chapters/chapter3/code/kernMedianRegTri9.cu~ index cd173eb..363b181 100755 --- a/BookGPU/Chapters/chapter3/code/kernMedianRegTri9.cu~ +++ b/BookGPU/Chapters/chapter3/code/kernMedianRegTri9.cu~ @@ -1,19 +1,11 @@ -__global__ void kernel_Median3RegTri9( short *output, int i_dim, int j_dim) +__global__ void kernel_Median3RegTri9( short *output, + int i_dim, int j_dim) { - - // coordonnees absolues du point int j = __mul24(blockIdx.x,blockDim.x) + threadIdx.x ; int i = __mul24(blockIdx.y,blockDim.y) + threadIdx.y ; - - /************************************************************************** - * tri(s) - **************************************************************************/ - int a0, a1, a2, a3, a4, a5, a6, a7, a8 ; + int a0, a1, a2, a3, a4, a5, a6, a7, a8 ; // 1 register per pixel - /******************************************************************************** - * affectation des valeurs - ********************************************************************************/ - a0 = tex2D(tex_img_ins, j-1, i-1) ; + a0 = tex2D(tex_img_ins, j-1, i-1) ; // fetching values a1 = tex2D(tex_img_ins, j , i-1) ; a2 = tex2D(tex_img_ins, j+1, i-1) ; a3 = tex2D(tex_img_ins, j-1, i) ; @@ -23,10 +15,7 @@ __global__ void kernel_Median3RegTri9( short *output, int i_dim, int j_dim) a7 = tex2D(tex_img_ins, j , i+1) ; a8 = tex2D(tex_img_ins, j+1, i+1) ; - //tri selection - bubTriReg9(&a0, &a1, &a2, &a3, &a4, &a5, &a6, &a7, &a8); + bubReg9(&a0,&a1,&a2,&a3,&a4,&a5,&a6,&a7,&a8); // bubble sort - //median au milieu ! - output[ __mul24(i, j_dim) +j ] = a4 ; - -} + output[ __mul24(i, j_dim) +j ] = a4 ; // median at the middle + }