mirror of https://bitbucket.org/ausocean/av.git
adpcm: added function for calculating number of adpcm bytes output per given pcm bytes
This commit is contained in:
parent
a9b1891bbb
commit
c089980175
|
@ -390,3 +390,10 @@ func (d *decoder) Write(inAdpcm []byte) (int, error) {
|
|||
|
||||
return n, nil
|
||||
}
|
||||
|
||||
// BytesOutput will return the number of adpcm bytes that will be generated for the given pcm data
|
||||
func BytesOutput(pcm int) int {
|
||||
// for X pcm bytes, 2 bytes are left uncompressed, the rest is compressed by a factor of 4
|
||||
// and a start index and padding byte are added.
|
||||
return (pcm-2)/4 + 2 + 1 + 1
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue