public static void ApplyPredictor(byte[] uncompData, int predictor, int w, int h, int samplesPerPixel) { if (predictor != 2) return; int count; for (int j = 0; j < h; j++) { count = samplesPerPixel * (j * w + 1); for (int i = samplesPerPixel; i < w * samplesPerPixel; i++) { uncompData[count] += uncompData[count - samplesPerPixel]; count++; } } }