Commit 6f0e96a4 authored by jm's avatar jm
Browse files

Merged a modified version of Jamey Hicks' C55 patch, fixed a

long-standing fixed-point wideband overflow. Replaced some 
"+" and "-" with ADD() and SUB().


git-svn-id: http://svn.xiph.org/trunk/speex@9076 0101bb08-14d6-0310-b084-bc0e0c8e3800
parent 10619de5
......@@ -59,6 +59,11 @@ AC_DEFINE_UNQUOTED(SPEEX_MINOR_VERSION, ${SPEEX_MINOR_VERSION}, [Version minor])
AC_DEFINE_UNQUOTED(SPEEX_MICRO_VERSION, ${SPEEX_MICRO_VERSION}, [Version micro])
AC_DEFINE_UNQUOTED(SPEEX_EXTRA_VERSION, "${SPEEX_EXTRA_VERSION}", [Version extra])
AC_ARG_ENABLE(wideband, [ --disable-wideband disable wideband codec],
[if test "$enableval" = no; then
AC_DEFINE([DISABLE_WIDEBAND], , [Disable wideband codec])
fi])
AC_ARG_ENABLE(valgrind, [ --enable-valgrind enable valgrind extra checks],
[if test "$enableval" = yes; then
AC_DEFINE([ENABLE_VALGRIND], , [Enable valgrind extra checks])
......@@ -95,6 +100,11 @@ AC_ARG_ENABLE(epic-48k, [ --enable-epic-48k enable support for Epic 4.8 k
AC_DEFINE([EPIC_48K], , [Enable support for Epic 4.8 kbps mode])
fi])
AC_ARG_ENABLE(ti-c55x, [ --enable-ti-c55x enable support for TI C55X DSP],
[if test "$enableval" = yes; then
AC_DEFINE([TI_C55X], , [Enable support for TI C55X DSP])
fi])
dnl Output the makefiles and version.h.
AC_OUTPUT([Makefile libspeex/Makefile src/Makefile doc/Makefile Speex.spec
......
......@@ -42,11 +42,11 @@ extern "C" {
/** Bit-packing data structure representing (part of) a bit-stream. */
typedef struct SpeexBits {
char *bytes; /**< "raw" data */
char *chars; /**< "raw" data */
int nbBits; /**< Total number of bits stored in the stream*/
int bytePtr; /**< Position of the byte "cursor" */
int bitPtr; /**< Position of the bit "cursor" within the current byte */
int owner; /**< Does the struct "own" the "raw" buffer (member "bytes") */
int charPtr; /**< Position of the byte "cursor" */
int bitPtr; /**< Position of the bit "cursor" within the current char */
int owner; /**< Does the struct "own" the "raw" buffer (member "chars") */
int overflow;/**< Set to one if we try to read past the valid data */
int buf_size;/**< Allocated size for buffer */
int reserved1; /**< Reserved for future use */
......
......@@ -43,26 +43,30 @@ extern "C" {
struct SpeexMode;
typedef signed long spx_int32_t;
#define SPEEX_HEADER_STRING_LENGTH 8
/** Maximum number of characters for encoding the Speex version number in the header */
#define SPEEX_HEADER_VERSION_LENGTH 20
/** Speex header info for file-based formats */
typedef struct SpeexHeader {
char speex_string[8]; /**< Identifies a Speex bit-stream, always set to "Speex " */
char speex_version[SPEEX_HEADER_VERSION_LENGTH]; /**< Speex version */
int speex_version_id; /**< Version for Speex (for checking compatibility) */
int header_size; /**< Total size of the header ( sizeof(SpeexHeader) ) */
int rate; /**< Sampling rate used */
int mode; /**< Mode used (0 for narrowband, 1 for wideband) */
int mode_bitstream_version; /**< Version ID of the bit-stream */
int nb_channels; /**< Number of channels encoded */
int bitrate; /**< Bit-rate used */
int frame_size; /**< Size of frames */
int vbr; /**< 1 for a VBR encoding, 0 otherwise */
int frames_per_packet; /**< Number of frames stored per Ogg packet */
int extra_headers; /**< Number of additional headers after the comments */
int reserved1; /**< Reserved for future use, must be zero */
int reserved2; /**< Reserved for future use, must be zero */
char speex_string[SPEEX_HEADER_STRING_LENGTH]; /**< Identifies a Speex bit-stream, always set to "Speex " */
char speex_version[SPEEX_HEADER_VERSION_LENGTH]; /**< Speex version */
spx_int32_t speex_version_id; /**< Version for Speex (for checking compatibility) */
spx_int32_t header_size; /**< Total size of the header ( sizeof(SpeexHeader) ) */
spx_int32_t rate; /**< Sampling rate used */
spx_int32_t mode; /**< Mode used (0 for narrowband, 1 for wideband) */
spx_int32_t mode_bitstream_version; /**< Version ID of the bit-stream */
spx_int32_t nb_channels; /**< Number of channels encoded */
spx_int32_t bitrate; /**< Bit-rate used */
spx_int32_t frame_size; /**< Size of frames */
spx_int32_t vbr; /**< 1 for a VBR encoding, 0 otherwise */
spx_int32_t frames_per_packet; /**< Number of frames stored per Ogg packet */
spx_int32_t extra_headers; /**< Number of additional headers after the comments */
spx_int32_t reserved1; /**< Reserved for future use, must be zero */
spx_int32_t reserved2; /**< Reserved for future use, must be zero */
} SpeexHeader;
/** Initializes a SpeexHeader using basic information */
......
......@@ -37,6 +37,10 @@
#define ABS(x) ((x) < 0 ? (-(x)) : (x))
/* FIXME: Should provide better detection */
/*typedef signed long spx_int32_t;*/
typedef unsigned long spx_uint32_t;
#ifdef FIXED_POINT
typedef signed short spx_word16_t;
......@@ -109,8 +113,8 @@ typedef float spx_word64_t;
#define SUB32(a,b) ((a)-(b))
#define ADD64(a,b) ((a)+(b))
#define MULT16_16_16(a,b) ((a)*(b))
#define MULT16_16(a,b) ((a)*(b))
#define MAC16_16(c,a,b) ((c)+(a)*(b))
#define MULT16_16(a,b) ((spx_word32_t)(a)*(spx_word32_t)(b))
#define MAC16_16(c,a,b) ((c)+(spx_word32_t)(a)*(spx_word32_t)(b))
#define MULT16_32_Q11(a,b) ((a)*(b))
#define MULT16_32_Q13(a,b) ((a)*(b))
......@@ -133,5 +137,19 @@ typedef float spx_word64_t;
#endif
#ifdef CONFIG_TI_C55X
/* 2 on TI C5x DSP */
#define BYTES_PER_CHAR 2
#define BITS_PER_CHAR 16
#define LOG2_BITS_PER_CHAR 4
#else
#define BYTES_PER_CHAR 1
#define BITS_PER_CHAR 8
#define LOG2_BITS_PER_CHAR 3
#endif
#endif
......@@ -40,16 +40,16 @@
#include "misc.h"
/** Maximum size of the bit-stream (for fixed-size allocation) */
#define MAX_BYTES_PER_FRAME 2000
#define MAX_BYTES_PER_FRAME (2000/BYTES_PER_CHAR)
void speex_bits_init(SpeexBits *bits)
{
bits->bytes = (char*)speex_alloc(MAX_BYTES_PER_FRAME);
bits->chars = (char*)speex_alloc(MAX_BYTES_PER_FRAME);
bits->buf_size = MAX_BYTES_PER_FRAME;
bits->bytes[0]=0;
bits->chars[0]=0;
bits->nbBits=0;
bits->bytePtr=0;
bits->charPtr=0;
bits->bitPtr=0;
bits->owner=1;
bits->overflow=0;
......@@ -57,12 +57,12 @@ void speex_bits_init(SpeexBits *bits)
void speex_bits_init_buffer(SpeexBits *bits, void *buff, int buf_size)
{
bits->bytes = (char*)buff;
bits->chars = (char*)buff;
bits->buf_size = buf_size;
bits->bytes[0]=0;
bits->chars[0]=0;
bits->nbBits=0;
bits->bytePtr=0;
bits->charPtr=0;
bits->bitPtr=0;
bits->owner=0;
bits->overflow=0;
......@@ -71,27 +71,27 @@ void speex_bits_init_buffer(SpeexBits *bits, void *buff, int buf_size)
void speex_bits_destroy(SpeexBits *bits)
{
if (bits->owner)
speex_free(bits->bytes);
speex_free(bits->chars);
/* Will do something once the allocation is dynamic */
}
void speex_bits_reset(SpeexBits *bits)
{
bits->bytes[0]=0;
bits->chars[0]=0;
bits->nbBits=0;
bits->bytePtr=0;
bits->charPtr=0;
bits->bitPtr=0;
bits->overflow=0;
}
void speex_bits_rewind(SpeexBits *bits)
{
bits->bytePtr=0;
bits->charPtr=0;
bits->bitPtr=0;
bits->overflow=0;
}
void speex_bits_read_from(SpeexBits *bits, char *bytes, int len)
void speex_bits_read_from(SpeexBits *bits, char *chars, int len)
{
int i;
if (len > bits->buf_size)
......@@ -99,11 +99,11 @@ void speex_bits_read_from(SpeexBits *bits, char *bytes, int len)
speex_warning_int("Packet if larger than allocated buffer: ", len);
if (bits->owner)
{
char *tmp = (char*)speex_realloc(bits->bytes, len);
char *tmp = (char*)speex_realloc(bits->chars, len);
if (tmp)
{
bits->buf_size=len;
bits->bytes=tmp;
bits->chars=tmp;
} else {
len=bits->buf_size;
speex_warning("Could not resize input buffer: truncating input");
......@@ -114,9 +114,9 @@ void speex_bits_read_from(SpeexBits *bits, char *bytes, int len)
}
}
for (i=0;i<len;i++)
bits->bytes[i]=bytes[i];
bits->chars[i]=chars[i];
bits->nbBits=len<<3;
bits->bytePtr=0;
bits->charPtr=0;
bits->bitPtr=0;
bits->overflow=0;
}
......@@ -124,104 +124,111 @@ void speex_bits_read_from(SpeexBits *bits, char *bytes, int len)
static void speex_bits_flush(SpeexBits *bits)
{
int i;
if (bits->bytePtr>0)
int nchars = ((bits->nbBits+BITS_PER_CHAR-1)>>LOG2_BITS_PER_CHAR);
if (bits->charPtr>0)
{
for (i=bits->bytePtr;i<((bits->nbBits+7)>>3);i++)
bits->bytes[i-bits->bytePtr]=bits->bytes[i];
for (i=bits->charPtr;i<nchars; i++)
bits->chars[i-bits->charPtr]=bits->chars[i];
}
bits->nbBits -= bits->bytePtr<<3;
bits->bytePtr=0;
bits->nbBits -= bits->charPtr<<LOG2_BITS_PER_CHAR;
bits->charPtr=0;
}
void speex_bits_read_whole_bytes(SpeexBits *bits, char *bytes, int len)
void speex_bits_read_whole_bytes(SpeexBits *bits, char *chars, int nbytes)
{
int i,pos;
int nchars = nbytes/BYTES_PER_CHAR;
if (((bits->nbBits+7)>>3)+len > bits->buf_size)
if (((bits->nbBits+BITS_PER_CHAR-1)>>LOG2_BITS_PER_CHAR)+nchars > bits->buf_size)
{
/* Packet is larger than allocated buffer */
if (bits->owner)
{
char *tmp = (char*)speex_realloc(bits->bytes, (bits->nbBits>>3)+len+1);
char *tmp = (char*)speex_realloc(bits->chars, (bits->nbBits>>LOG2_BITS_PER_CHAR)+nchars+1);
if (tmp)
{
bits->buf_size=(bits->nbBits>>3)+len+1;
bits->bytes=tmp;
bits->buf_size=(bits->nbBits>>LOG2_BITS_PER_CHAR)+nchars+1;
bits->chars=tmp;
} else {
len=bits->buf_size-(bits->nbBits>>3)-1;
nchars=bits->buf_size-(bits->nbBits>>LOG2_BITS_PER_CHAR)-1;
speex_warning("Could not resize input buffer: truncating input");
}
} else {
speex_warning("Do not own input buffer: truncating input");
len=bits->buf_size;
nchars=bits->buf_size;
}
}
speex_bits_flush(bits);
pos=bits->nbBits>>3;
for (i=0;i<len;i++)
bits->bytes[pos+i]=bytes[i];
bits->nbBits+=len<<3;
pos=bits->nbBits>>LOG2_BITS_PER_CHAR;
for (i=0;i<nchars;i++)
bits->chars[pos+i]=chars[i];
bits->nbBits+=nchars<<LOG2_BITS_PER_CHAR;
}
int speex_bits_write(SpeexBits *bits, char *bytes, int max_len)
int speex_bits_write(SpeexBits *bits, char *chars, int max_nbytes)
{
int i;
int bytePtr, bitPtr, nbBits;
int max_nchars = max_nbytes/BYTES_PER_CHAR;
int charPtr, bitPtr, nbBits;
/* Insert terminator, but save the data so we can put it back after */
bitPtr=bits->bitPtr;
bytePtr=bits->bytePtr;
charPtr=bits->charPtr;
nbBits=bits->nbBits;
speex_bits_insert_terminator(bits);
bits->bitPtr=bitPtr;
bits->bytePtr=bytePtr;
bits->charPtr=charPtr;
bits->nbBits=nbBits;
if (max_len > ((bits->nbBits+7)>>3))
max_len = ((bits->nbBits+7)>>3);
for (i=0;i<max_len;i++)
bytes[i]=bits->bytes[i];
return max_len;
if (max_nchars > ((bits->nbBits+BITS_PER_CHAR-1)>>LOG2_BITS_PER_CHAR))
max_nchars = ((bits->nbBits+BITS_PER_CHAR-1)>>LOG2_BITS_PER_CHAR);
#if BYTES_PER_CHAR==1
#define HTOLS(A) (A)
#else
#define HTOLS(A) ((((A) >> 8)&0xff)|(((A) & 0xff)<<8))
#endif
for (i=0;i<max_nchars;i++)
chars[i]=HTOLS(bits->chars[i]);
return max_nchars*BYTES_PER_CHAR;
}
int speex_bits_write_whole_bytes(SpeexBits *bits, char *bytes, int max_len)
int speex_bits_write_whole_bytes(SpeexBits *bits, char *chars, int max_nbytes)
{
int max_nchars = max_nbytes/BYTES_PER_CHAR;
int i;
if (max_len > ((bits->nbBits)>>3))
max_len = ((bits->nbBits)>>3);
for (i=0;i<max_len;i++)
bytes[i]=bits->bytes[i];
if (max_nchars > ((bits->nbBits)>>LOG2_BITS_PER_CHAR))
max_nchars = ((bits->nbBits)>>LOG2_BITS_PER_CHAR);
for (i=0;i<max_nchars;i++)
chars[i]=bits->chars[i];
if (bits->bitPtr>0)
bits->bytes[0]=bits->bytes[max_len];
bits->chars[0]=bits->chars[max_nchars];
else
bits->bytes[0]=0;
for (i=1;i<((bits->nbBits)>>3)+1;i++)
bits->bytes[i]=0;
bits->bytePtr=0;
bits->nbBits &= 7;
return max_len;
bits->chars[0]=0;
for (i=1;i<((bits->nbBits)>>LOG2_BITS_PER_CHAR)+1;i++)
bits->chars[i]=0;
bits->charPtr=0;
bits->nbBits &= (BITS_PER_CHAR-1);
return max_nchars*BYTES_PER_CHAR;
}
void speex_bits_pack(SpeexBits *bits, int data, int nbBits)
{
int i;
unsigned int d=data;
if (bits->bytePtr+((nbBits+bits->bitPtr)>>3) >= bits->buf_size)
if (bits->charPtr+((nbBits+bits->bitPtr)>>LOG2_BITS_PER_CHAR) >= bits->buf_size)
{
speex_warning("Buffer too small to pack bits");
if (bits->owner)
{
char *tmp = (char*)speex_realloc(bits->bytes, ((bits->buf_size+5)*3)>>1);
int new_nchars = ((bits->buf_size+5)*3)>>1;
char *tmp = (char*)speex_realloc(bits->chars, new_nchars);
if (tmp)
{
for (i=bits->buf_size;i<(((bits->buf_size+5)*3)>>1);i++)
tmp[i]=0;
bits->buf_size=((bits->buf_size+5)*3)>>1;
bits->bytes=tmp;
speex_memset_bytes(tmp, 0, new_nchars);
bits->buf_size=new_nchars;
bits->chars=tmp;
} else {
speex_warning("Could not resize input buffer: not packing");
return;
......@@ -236,14 +243,14 @@ void speex_bits_pack(SpeexBits *bits, int data, int nbBits)
{
int bit;
bit = (d>>(nbBits-1))&1;
bits->bytes[bits->bytePtr] |= bit<<(7-bits->bitPtr);
bits->chars[bits->charPtr] |= bit<<(7-bits->bitPtr);
bits->bitPtr++;
if (bits->bitPtr==8)
{
bits->bitPtr=0;
bits->bytePtr++;
bits->bytes[bits->bytePtr] = 0;
bits->charPtr++;
bits->chars[bits->charPtr] = 0;
}
bits->nbBits++;
nbBits--;
......@@ -264,19 +271,19 @@ int speex_bits_unpack_signed(SpeexBits *bits, int nbBits)
unsigned int speex_bits_unpack_unsigned(SpeexBits *bits, int nbBits)
{
unsigned int d=0;
if ((bits->bytePtr<<3)+bits->bitPtr+nbBits>bits->nbBits)
if ((bits->charPtr<<LOG2_BITS_PER_CHAR)+bits->bitPtr+nbBits>bits->nbBits)
bits->overflow=1;
if (bits->overflow)
return 0;
while(nbBits)
{
d<<=1;
d |= (bits->bytes[bits->bytePtr]>>(7-bits->bitPtr))&1;
d |= (bits->chars[bits->charPtr]>>(BITS_PER_CHAR-1 - bits->bitPtr))&1;
bits->bitPtr++;
if (bits->bitPtr==8)
if (bits->bitPtr==BITS_PER_CHAR)
{
bits->bitPtr=0;
bits->bytePtr++;
bits->charPtr++;
}
nbBits--;
}
......@@ -286,26 +293,26 @@ unsigned int speex_bits_unpack_unsigned(SpeexBits *bits, int nbBits)
unsigned int speex_bits_peek_unsigned(SpeexBits *bits, int nbBits)
{
unsigned int d=0;
int bitPtr, bytePtr;
char *bytes;
int bitPtr, charPtr;
char *chars;
if ((bits->bytePtr<<3)+bits->bitPtr+nbBits>bits->nbBits)
if ((bits->charPtr<<LOG2_BITS_PER_CHAR)+bits->bitPtr+nbBits>bits->nbBits)
bits->overflow=1;
if (bits->overflow)
return 0;
bitPtr=bits->bitPtr;
bytePtr=bits->bytePtr;
bytes = bits->bytes;
charPtr=bits->charPtr;
chars = bits->chars;
while(nbBits)
{
d<<=1;
d |= (bytes[bytePtr]>>(7-bitPtr))&1;
d |= (chars[charPtr]>>(BITS_PER_CHAR-1 - bitPtr))&1;
bitPtr++;
if (bitPtr==8)
if (bitPtr==BITS_PER_CHAR)
{
bitPtr=0;
bytePtr++;
charPtr++;
}
nbBits--;
}
......@@ -314,21 +321,21 @@ unsigned int speex_bits_peek_unsigned(SpeexBits *bits, int nbBits)
int speex_bits_peek(SpeexBits *bits)
{
if ((bits->bytePtr<<3)+bits->bitPtr+1>bits->nbBits)
if ((bits->charPtr<<LOG2_BITS_PER_CHAR)+bits->bitPtr+1>bits->nbBits)
bits->overflow=1;
if (bits->overflow)
return 0;
return (bits->bytes[bits->bytePtr]>>(7-bits->bitPtr))&1;
return (bits->chars[bits->charPtr]>>(BITS_PER_CHAR-1 - bits->bitPtr))&1;
}
void speex_bits_advance(SpeexBits *bits, int n)
{
if (((bits->bytePtr<<3)+bits->bitPtr+n>bits->nbBits) || bits->overflow){
if (((bits->charPtr<<LOG2_BITS_PER_CHAR)+bits->bitPtr+n>bits->nbBits) || bits->overflow){
bits->overflow=1;
return;
}
bits->bytePtr += (bits->bitPtr+n) >> 3; /*divide by 8*/
bits->bitPtr = (bits->bitPtr+n) & 7; /* modulo by 8*/
bits->charPtr += (bits->bitPtr+n) >> LOG2_BITS_PER_CHAR; /* divide by BITS_PER_CHAR */
bits->bitPtr = (bits->bitPtr+n) & (BITS_PER_CHAR-1); /* modulo by BITS_PER_CHAR */
}
int speex_bits_remaining(SpeexBits *bits)
......@@ -336,18 +343,18 @@ int speex_bits_remaining(SpeexBits *bits)
if (bits->overflow)
return -1;
else
return bits->nbBits-((bits->bytePtr<<3)+bits->bitPtr);
return bits->nbBits-((bits->charPtr<<LOG2_BITS_PER_CHAR)+bits->bitPtr);
}
int speex_bits_nbytes(SpeexBits *bits)
{
return ((bits->nbBits+7)>>3);
return ((bits->nbBits+BITS_PER_CHAR-1)>>LOG2_BITS_PER_CHAR);
}
void speex_bits_insert_terminator(SpeexBits *bits)
{
if (bits->bitPtr<7)
if (bits->bitPtr<BITS_PER_CHAR-1)
speex_bits_pack(bits, 0, 1);
while (bits->bitPtr<7)
while (bits->bitPtr<BITS_PER_CHAR-1)
speex_bits_pack(bits, 1, 1);
}
......@@ -168,10 +168,10 @@ int update_target
res = resp+rind*subvect_size;
if (sign>0)
for (m=0;m<subvect_size;m++)
t[subvect_size*i+m] -= res[m];
t[subvect_size*i+m] = SUB16(t[subvect_size*i+m], res[m]);
else
for (m=0;m<subvect_size;m++)
t[subvect_size*i+m] += res[m];
t[subvect_size*i+m] = ADD16(t[subvect_size*i+m], res[m]);
#ifdef FIXED_POINT
if (sign)
......@@ -217,7 +217,7 @@ int update_target
/* Update excitation */
/* FIXME: We could update the excitation directly above */
for (j=0;j<nsf;j++)
exc[j]+=e[j];
exc[j]=ADD32(exc[j],e[j]);
/* Update target: only update target if necessary */
if (update_target)
......@@ -226,7 +226,7 @@ int update_target
ALLOC(r2, nsf, spx_sig_t);
syn_percep_zero(e, ak, awk1, awk2, r2, nsf,p, stack);
for (j=0;j<nsf;j++)
target[j]-=r2[j];
target[j]=SUB32(target[j],r2[j]);
}
}
......@@ -393,10 +393,10 @@ int update_target
res = resp+rind*subvect_size;
if (sign>0)
for (m=0;m<subvect_size;m++)
t[subvect_size*i+m] -= res[m];
t[subvect_size*i+m] = SUB16(t[subvect_size*i+m], res[m]);
else
for (m=0;m<subvect_size;m++)
t[subvect_size*i+m] += res[m];
t[subvect_size*i+m] = ADD16(t[subvect_size*i+m], res[m]);
}
/*compute error (distance)*/
......@@ -512,14 +512,14 @@ int update_target
}
/* Update excitation */
for (j=0;j<nsf;j++)
exc[j]+=e[j];
exc[j]=ADD32(exc[j],e[j]);
/* Update target: only update target if necessary */
if (update_target)
{
syn_percep_zero(e, ak, awk1, awk2, r2, nsf,p, stack);
for (j=0;j<nsf;j++)
target[j]-=r2[j];
target[j]=SUB32(target[j],r2[j]);
}
}
......
......@@ -148,14 +148,14 @@ spx_word16_t compute_rms(const spx_sig_t *x, int len)
spx_word32_t sum2=0;
spx_word16_t tmp;
tmp = SHR(x[i],sig_shift);
sum2 += MULT16_16(tmp,tmp);
sum2 = MAC16_16(sum2,tmp,tmp);
tmp = SHR(x[i+1],sig_shift);
sum2 += MULT16_16(tmp,tmp);
sum2 = MAC16_16(sum2,tmp,tmp);
tmp = SHR(x[i+2],sig_shift);
sum2 += MULT16_16(tmp,tmp);
sum2 = MAC16_16(sum2,tmp,tmp);
tmp = SHR(x[i+3],sig_shift);
sum2 += MULT16_16(tmp,tmp);
sum += SHR(sum2,6);
sum2 = MAC16_16(sum2,tmp,tmp);
sum = ADD32(sum,SHR(sum2,6));
}
return SHR(SHL((spx_word32_t)spx_sqrt(1+DIV32(sum,len)),(sig_shift+3)),SIG_SHIFT);
......@@ -166,7 +166,7 @@ spx_word16_t compute_rms(const spx_sig_t *x, int len)
#else
int normalize16(const spx_sig_t *x, spx_word16_t *y, int max_scale, int len)
int normalize16(const spx_sig_t *x, spx_word16_t *y, spx_sig_t max_scale, int len)
{
int i;
spx_sig_t max_val=1;
......@@ -201,11 +201,9 @@ void filter_mem2(const spx_sig_t *x, const spx_coef_t *num, const spx_coef_t *de
for (i=0;i<N;i++)
{
int xh,xl,yh,yl;
xi=SATURATE(x[i],805306368);
yi = SATURATE(ADD32(xi, SHL(mem[0],2)),805306368);