mirror of https://bitbucket.org/ausocean/av.git
ADPCM: removed capAdd16 no longer used
This commit is contained in:
parent
4c64761f98
commit
d9baabdf02
|
@ -36,7 +36,6 @@ import (
|
|||
"bytes"
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"math"
|
||||
)
|
||||
|
||||
// Encoder is used to encode to ADPCM from PCM data.
|
||||
|
@ -182,19 +181,6 @@ func (d *Decoder) decodeSample(nibble byte) int16 {
|
|||
return d.pred
|
||||
}
|
||||
|
||||
// capAdd16 adds two int16s together and caps at max/min int16 instead of overflowing
|
||||
func capAdd16(a, b int16) int16 {
|
||||
c := int32(a) + int32(b)
|
||||
switch {
|
||||
case c < math.MinInt16:
|
||||
return math.MinInt16
|
||||
case c > math.MaxInt16:
|
||||
return math.MaxInt16
|
||||
default:
|
||||
return int16(c)
|
||||
}
|
||||
}
|
||||
|
||||
// calcHead sets the state for the encoder by running the first sample through
|
||||
// the encoder, and writing the first sample
|
||||
func (e *Encoder) calcHead(sample []byte) error {
|
||||
|
|
Loading…
Reference in New Issue