add validation of slice parameters instead of assert
Merge pull request #1478 from sijchen/after_review61

[Encoder] add validation of slice parameters instead of assert