range banding revisited

Tentative and temporary ranging solution intended to soon be swapped out with a robust library.
Could you eventually discard the ranging code?
With the delayed update above, it should be good enough for now.