forked from len0rd/rockbox
Upgrade to libspeex 1.2beta2. Very minor performance increase (0.6% on coldfire).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13461 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
8970055ec1
commit
df6f2f9a3c
36 changed files with 626 additions and 302 deletions
|
@ -67,6 +67,20 @@ void speex_bits_init_buffer(SpeexBits *bits, void *buff, int buf_size)
|
|||
speex_bits_reset(bits);
|
||||
}
|
||||
|
||||
void speex_bits_set_bit_buffer(SpeexBits *bits, void *buff, int buf_size)
|
||||
{
|
||||
bits->chars = (char*)buff;
|
||||
bits->buf_size = buf_size;
|
||||
|
||||
bits->owner=0;
|
||||
|
||||
bits->nbBits=buf_size<<LOG2_BITS_PER_CHAR;
|
||||
bits->charPtr=0;
|
||||
bits->bitPtr=0;
|
||||
bits->overflow=0;
|
||||
|
||||
}
|
||||
|
||||
void speex_bits_destroy(SpeexBits *bits)
|
||||
{
|
||||
if (bits->owner)
|
||||
|
@ -97,7 +111,7 @@ void speex_bits_read_from(SpeexBits *bits, char *chars, int len)
|
|||
int nchars = len / BYTES_PER_CHAR;
|
||||
if (nchars > bits->buf_size)
|
||||
{
|
||||
speex_warning_int("Packet is larger than allocated buffer: ", len);
|
||||
speex_notify("Packet is larger than allocated buffer");
|
||||
if (bits->owner)
|
||||
{
|
||||
char *tmp = (char*)speex_realloc(bits->chars, nchars);
|
||||
|
@ -110,7 +124,7 @@ void speex_bits_read_from(SpeexBits *bits, char *chars, int len)
|
|||
speex_warning("Could not resize input buffer: truncating input");
|
||||
}
|
||||
} else {
|
||||
speex_warning("Do not own input buffer: truncating input");
|
||||
speex_warning("Do not own input buffer: truncating oversize input");
|
||||
nchars=bits->buf_size;
|
||||
}
|
||||
}
|
||||
|
@ -159,10 +173,10 @@ void speex_bits_read_whole_bytes(SpeexBits *bits, char *chars, int nbytes)
|
|||
bits->chars=tmp;
|
||||
} else {
|
||||
nchars=bits->buf_size-(bits->nbBits>>LOG2_BITS_PER_CHAR)-1;
|
||||
speex_warning("Could not resize input buffer: truncating input");
|
||||
speex_warning("Could not resize input buffer: truncating oversize input");
|
||||
}
|
||||
} else {
|
||||
speex_warning("Do not own input buffer: truncating input");
|
||||
speex_warning("Do not own input buffer: truncating oversize input");
|
||||
nchars=bits->buf_size;
|
||||
}
|
||||
}
|
||||
|
@ -223,7 +237,7 @@ void speex_bits_pack(SpeexBits *bits, int data, int nbBits)
|
|||
|
||||
if (bits->charPtr+((nbBits+bits->bitPtr)>>LOG2_BITS_PER_CHAR) >= bits->buf_size)
|
||||
{
|
||||
speex_warning("Buffer too small to pack bits");
|
||||
speex_notify("Buffer too small to pack bits");
|
||||
if (bits->owner)
|
||||
{
|
||||
int new_nchars = ((bits->buf_size+5)*3)>>1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue