Floyd-Steinberg Error Diffusion
C implementation color/grayscale error diffusion
Replacing multiplications with adds and shifts
- 3*error = (error << 2) - error
- 5*error = (error << 2) + error
- 7*error = (error << 3) - error
- Can reuse (error << 2) calculation
Replace division by 16 with adds and shifts
- n >> 4 does not give right answer for negative n
- Add offset of 24-1 = 15 for negative n: (n + 15) >> 4
- Alternative is to work with |error |
Combine nested for loops into one for loop that can be pipelined by the C6x tools