Also it gets rid of some mysterious magic numbers in code. Signed-off-by: Mans Rullgard <mans@mansr.com> (cherry picked from commit 187e23478bc5c066ff8eef562925471ac179644e)
Signed-off-by: Mans Rullgard <mans@mansr.com> (cherry picked from commit d08928bbea2b495596c2d3bc7df3cfb3e3b2b7e3)