#include #include #include #include void applyGaussianBlur(void*, void*, int, int, float[3][3]); void print(void* _a, int h, int w); int main() { float inputImage[5][5] = { {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} }; float kernel[3][3] = { {1.0f/16, 2.0f/16, 1.0f/16}, {2.0f/16, 4.0f/16, 2.0f/16}, {1.0f/16, 2.0f/16, 1.0f/16} }; float outputImage[5][5] = {0}; clock_t start = clock(); applyGaussianBlur(inputImage, outputImage, 5, 5, kernel); clock_t end = clock(); printf("Time: %lf s\n", (double)(end-start) / CLOCKS_PER_SEC); print(outputImage, 5, 5); } void applyGaussianBlur(void* _src, void* _dst, int h, int w, float kernel[3][3]) { int i, j; float (*src)[w] = (float(*)[w])_src; float (*dst)[w] = (float(*)[w])_dst; for(i=1; i