/* listing 1: Un-optimized code to perform general image filtering Blurs a monochrome 8 bit image in "src" of dimensions src_w x src_h, outputs to dst using a filter kernel in ker which must be a 2D float array of size [2*k+1][2*k+1] */ void DoBlur(UBYTE *src, int src_w, int src_h, UBYTE *dst, float *ker, int k) { if (k<0) { memcpy(dst,src,src_w*src_h); // deal with degenerate kernel sizes return; } for (int y=0;y=0 && x2=0 && y2255) total=255; *dst++=UBYTE(total); } } }