avcodec/sonic: move version to the context

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
avcodec/sonic: add larger version and minor_version fields with version >= 2

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
sonic: Switch to rangecoder

significantly improves compression rate

This also bumps version to 2 and drops support for version 0/1
If someone used version 0/1 despite their experimental status then support
for these can and should be added back

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
hevc: avoid some unnecessary differences with libav

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
hevc: Correctly set time_base

- Try reading the time_base information from the VPS too, not just the VUI
- Only set time_base when an SPS is activated, not when it's decoded.
- Reduce the fraction before setting it.
- Don't set anything if the fraction is invalid (because the VUI is not
  present or because the encoded value is invalid).

Conflicts:
	libavcodec/hevc_ps.c

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>