ADPCM: got rid of buggy overflow checks

This commit is contained in:
Trek H 2019-03-07 14:03:51 +10:30
parent 89ccf9eac7
commit 8642d1e087
1 changed files with 3 additions and 3 deletions

View File

@ -126,9 +126,9 @@ func (e *Encoder) encodeSample(sample int16) byte {
// adjust predicted sample based on calculated difference
if nib&8 != 0 {
e.pred = capAdd16(e.pred, -diff)
e.pred -= diff
} else {
e.pred = capAdd16(e.pred, diff)
e.pred += diff
}
e.index += indexTable[nib&7]
@ -164,7 +164,7 @@ func (d *Decoder) decodeSample(nibble byte) int16 {
}
// adjust predicted sample based on calculated difference
d.pred = capAdd16(d.pred, diff)
d.pred += diff
// adjust index into step size lookup table using nibble
d.index += indexTable[nibble]