hevc: various fixes -- align code with libav
Merge branch 'mp43' of https://github.com/OpenHEVC/openHEVC.git into mp43