Fixed overflow for sample value of 1

If sample value is 1, it should be encoded as 32767 not 32768