Fix TV levels tilesheet processing

Somehow I ended up with the wrong formula for range scaling.
Add test case for levels parameter
Add scripts and reference data for levels test