(a)
for (uint16 pixelY = 0; pixelY < rectHeight; pixelY++)
{
   for (uint16 pixelX = 0; pixelX < rectWidth; pixelX++)
   {
      pixel++;   // Pointer to current pixel
      // Code to blur the current pixel
   }
   pixel += (dataRowBytes - rectWidth);
}

(b)
for (uint16 pixelY = 0; pixelY < rectHeight; pixelY++)
{
   for (uint16 pixelX = 0; pixelX < rectWidth; pixelX++)
   {
      pixelOffset = (pixelX * columnBytes + pixelY * rowBytes);
      // Code to blur the current pixel
   }
}

Example 2: (a) Looping over the image pixels; (b) removing the induction.

Back to Article