Début du TP convolution. Pour l'instant uniquement lecture d'une vidéo.
[GPU.git] / WCudaMSE / Student_Cuda_Image / src / cpp / core / 06_Convolution / moo / device / ConvolutionDevice.cu
1 #include <iostream>
2 #include <stdio.h>
3 using namespace std;
4
5 #include "Indice2D.h"
6 #include "IndiceTools.h"
7 #include "cudaTools.h"
8 #include "Device.h"
9
10 #include "ConvolutionDevice.h"
11
12 __global__
13 void convolution(uchar4* ptrDevPixels, int w, int h, float t)
14     {
15     const int TID = Indice2D::tid();
16     const int NB_THREAD = Indice2D::nbThread();
17     const int WH = w * h;
18
19     uchar4 color;
20     color.w = 255; // Par défaut, l'image est opaque.
21
22     double x, y;
23     int pixelI, pixelJ;
24
25     int s = TID;
26     while (s < WH)
27         {
28         IndiceTools::toIJ(s, w, &pixelI, &pixelJ); // update (pixelI, pixelJ)
29
30         // (i,j) domaine écran.
31         // (x,y) domaine math.
32         // domaineMath.toXY(pixelI, pixelJ, &x, &y); // (i,j) -> (x,y).
33
34         // newtonMath.colorXY(&color, x, y);
35
36         ptrDevPixels[s] = color;
37
38         s += NB_THREAD;
39         }
40     }