3 ms·
I'm not sure what you mean by rounding error. The whole point of error diffusion is that any errors are propagated so that they average out. I've coded Floyd-S
by mark-r 7y ago
I'm not sure what you mean by rounding error. The whole point of error diffusion is that any errors are propagated so that they average out. I've coded Floyd-Steinberg many times myself, and the only problem I ever had was when my outputs didn't include 0% and 100% leaving the error to build without correction.
- vanderZwan 7y agoI basically mean clipping the diffused error - for example if I propagate a positive error to a pixel that is already white, and don't propagate that error again to the next pixels. In the linked notebook, I use a separate error array made out of Int32 values (which is probably overkill, Int16 would suffice) and postpone division until the last moment. It's a small detail but it makes a significant difference in the hybrid output.
- mark-r 7y agoError is error, it would never have occurred to me to clip it. I can see how that would make a big difference.
- vanderZwan 7y agoMe neither, but it doesn't even have to be a conscious choice! Let's you want to implement an in-place algorithm to save memory (which I'm presume was a realistic trade-off to consider back in the early eighties), and your inputs are single bytes for each channel, then your only option is to do saturating arithmetic. Clipping just falls out of that as a side-effect.