}
protected void applySmoothing(SimpleImage pImg, int pSmoothingAmount) {
int width = pImg.getImageWidth();
int height = pImg.getImageHeight();
Pixel pixel = new Pixel();
for (int k = 0; k < pSmoothingAmount; k++) {
for (int i = 1; i < (height - 1); i++) {
/* process pixels 2..width-1 */
for (int j = 1; j < (width - 1); j++) {
pixel.setARGBValue(pImg.getARGBValue(j, i - 1));
int r1 = pixel.r;
int g1 = pixel.g;
int b1 = pixel.b;
pixel.setARGBValue(pImg.getARGBValue(j + 1, i));
int r2 = pixel.r;
int g2 = pixel.g;
int b2 = pixel.b;
pixel.setARGBValue(pImg.getARGBValue(j, i + 1));
int r3 = pixel.r;
int g3 = pixel.g;
int b3 = pixel.b;
pixel.setARGBValue(pImg.getARGBValue(j, i));
int r = pixel.r;
int g = pixel.g;
int b = pixel.b;
int av1 = (r1 + g1 + b1);