hevc: optimize residual coding