Avoid warnings about converting from int to bool

MSVC used to warn about this.
Add a cast when converting from int64_t to float

This avoids a warning when building with MSVC.
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
Merge pull request #1477 from mstorsjo/avoid-msvc-warnings

Avoid warnings when building with MSVC