| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
#ifndef IMAGE_DENOISING_H |
| 29 |
#define IMAGE_DENOISING_H |
| 30 |
|
| 31 |
typedef unsigned int TColor; |
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
#define KNN_WINDOW_RADIUS 3 |
| 37 |
#define NLM_WINDOW_RADIUS 3 |
| 38 |
#define NLM_BLOCK_RADIUS 3 |
| 39 |
#define KNN_WINDOW_AREA \ |
| 40 |
((2 * KNN_WINDOW_RADIUS + 1) * (2 * KNN_WINDOW_RADIUS + 1)) |
| 41 |
#define NLM_WINDOW_AREA \ |
| 42 |
((2 * NLM_WINDOW_RADIUS + 1) * (2 * NLM_WINDOW_RADIUS + 1)) |
| 43 |
#define INV_KNN_WINDOW_AREA (1.0f / (float)KNN_WINDOW_AREA) |
| 44 |
#define INV_NLM_WINDOW_AREA (1.0f / (float)NLM_WINDOW_AREA) |
| 45 |
|
| 46 |
#define KNN_WEIGHT_THRESHOLD 0.02f |
| 47 |
#define KNN_LERP_THRESHOLD 0.79f |
| 48 |
#define NLM_WEIGHT_THRESHOLD 0.10f |
| 49 |
#define NLM_LERP_THRESHOLD 0.10f |
| 50 |
|
| 51 |
#define BLOCKDIM_X 8 |
| 52 |
#define BLOCKDIM_Y 8 |
| 53 |
|
| 54 |
#ifndef MAX |
| 55 |
#define MAX(a, b) ((a < b) ? b : a) |
| 56 |
#endif |
| 57 |
#ifndef MIN |
| 58 |
#define MIN(a, b) ((a < b) ? a : b) |
| 59 |
#endif |
| 60 |
|
| 61 |
|
| 62 |
extern "C" void LoadBMPFile(uchar4 **dst, int *width, int *height, |
| 63 |
const char *name); |
| 64 |
|
| 65 |
|
| 66 |
extern "C" cudaTextureObject_t texImage; |
| 67 |
|
| 68 |
extern "C" cudaError_t CUDA_MallocArray(uchar4 **h_Src, int imageW, int imageH); |
| 69 |
extern "C" cudaError_t CUDA_FreeArray(); |
| 70 |
|
| 71 |
|
| 72 |
extern "C" void cuda_Copy(TColor *d_dst, int imageW, int imageH, |
| 73 |
cudaTextureObject_t texImage); |
| 74 |
extern "C" void cuda_KNN(TColor *d_dst, int imageW, int imageH, float Noise, |
| 75 |
float lerpC, cudaTextureObject_t texImage); |
| 76 |
extern "C" void cuda_KNNdiag(TColor *d_dst, int imageW, int imageH, float Noise, |
| 77 |
float lerpC, cudaTextureObject_t texImage); |
| 78 |
extern "C" void cuda_NLM(TColor *d_dst, int imageW, int imageH, float Noise, |
| 79 |
float lerpC, cudaTextureObject_t texImage); |
| 80 |
extern "C" void cuda_NLMdiag(TColor *d_dst, int imageW, int imageH, float Noise, |
| 81 |
float lerpC, cudaTextureObject_t texImage); |
| 82 |
|
| 83 |
extern "C" void cuda_NLM2(TColor *d_dst, int imageW, int imageH, float Noise, |
| 84 |
float LerpC, cudaTextureObject_t texImage); |
| 85 |
extern "C" void cuda_NLM2diag(TColor *d_dst, int imageW, int imageH, |
| 86 |
float Noise, float LerpC, |
| 87 |
cudaTextureObject_t texImage); |
| 88 |
|
| 89 |
#endif |