private static void DecodeAverageFilter(byte[] curr, byte[] prev,
int count, int bpp)
{
int raw, priorPixel, priorRow;
for (int i = 0; i < bpp; i++) {
raw = curr[i] & 0xff;
priorRow = prev[i] & 0xff;
curr[i] = (byte)(raw + priorRow/2);
}
for (int i = bpp; i < count; i++) {
raw = curr[i] & 0xff;
priorPixel = curr[i - bpp] & 0xff;
priorRow = prev[i] & 0xff;
curr[i] = (byte)(raw + (priorPixel + priorRow)/2);
}
}