Skip to content

Commit

Permalink
fixed-point cleanup, removed some warnings
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.xiph.org/trunk/speex@9098 0101bb08-14d6-0310-b084-bc0e0c8e3800
  • Loading branch information
jmvalin committed Mar 30, 2005
1 parent 01ac4b3 commit ea52aea
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 25 deletions.
12 changes: 6 additions & 6 deletions libspeex/ltp.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,8 @@ int cdbk_offset
spx_word16_t gain[3];
spx_word64_t err;

ltp_params *params;
params = (ltp_params*) par;
const ltp_params *params;
params = (const ltp_params*) par;
gain_cdbk_size = 1<<params->gain_bits;
gain_cdbk = params->gain_cdbk + 3*gain_cdbk_size*cdbk_offset;
ALLOC(tmp, 3*nsf, spx_sig_t);
Expand Down Expand Up @@ -540,7 +540,7 @@ int cdbk_offset
int best_pitch=0;
spx_word64_t err, best_err=-1;
int N;
ltp_params *params;
const ltp_params *params;
VARDECL(int *nbest);

N=complexity;
Expand All @@ -550,7 +550,7 @@ int cdbk_offset
N=1;

ALLOC(nbest, N, int);
params = (ltp_params*) par;
params = (const ltp_params*) par;

if (end<start)
{
Expand Down Expand Up @@ -622,9 +622,9 @@ int cdbk_offset
spx_word16_t gain[3];
const signed char *gain_cdbk;
int gain_cdbk_size;
ltp_params *params;
const ltp_params *params;

params = (ltp_params*) par;
params = (const ltp_params*) par;
gain_cdbk_size = 1<<params->gain_bits;
gain_cdbk = params->gain_cdbk + 3*gain_cdbk_size*cdbk_offset;

Expand Down
6 changes: 3 additions & 3 deletions libspeex/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,18 +163,18 @@ void *speex_move (void *dest, void *src, int n)
return memmove(dest,src,n);
}

void speex_error(char *str)
void speex_error(const char *str)
{
fprintf (stderr, "Fatal error: %s\n", str);
exit(1);
}

void speex_warning(char *str)
void speex_warning(const char *str)
{
fprintf (stderr, "warning: %s\n", str);
}

void speex_warning_int(char *str, int val)
void speex_warning_int(const char *str, int val)
{
fprintf (stderr, "warning: %s %d\n", str, val);
}
Expand Down
6 changes: 3 additions & 3 deletions libspeex/misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ void *speex_move (void *dest, void *src, int n);
void speex_memcpy_bytes(char *dst, char *src, int nbytes);
void speex_memset_bytes(char *dst, char src, int nbytes);

void speex_error(char *str);
void speex_error(const char *str);

void speex_warning(char *str);
void speex_warning(const char *str);

void speex_warning_int(char *str, int val);
void speex_warning_int(const char *str, int val);

void speex_rand_vec(float std, spx_sig_t *data, int len);

Expand Down
2 changes: 1 addition & 1 deletion libspeex/modes.c
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ int speex_mode_query(const SpeexMode *mode, int request, void *ptr)
return mode->query(mode->mode, request, ptr);
}

const SpeexMode * const speex_lib_get_mode (int mode)
const SpeexMode * speex_lib_get_mode (int mode)
{
#ifdef EPIC_48K
if (mode == SPEEX_MODEID_NB_48K) return &speex_nb_48k_mode;
Expand Down
2 changes: 1 addition & 1 deletion libspeex/nb_celp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1293,7 +1293,7 @@ int nb_decode(void *state, SpeexBits *bits, void *vout)
float lsp_dist=0, fact;
for (i=0;i<st->lpcSize;i++)
lsp_dist += fabs(st->old_qlsp[i] - st->qlsp[i]);
lsp_dist /= LSP_SCALING*LSP_SCALING;
lsp_dist /= LSP_SCALING;
fact = .6*exp(-.2*lsp_dist);
for (i=0;i<2*st->lpcSize;i++)
st->mem_sp[i] = (spx_mem_t)(st->mem_sp[i]*fact);
Expand Down
12 changes: 6 additions & 6 deletions libspeex/quant_lsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ static int lsp_quant(spx_word16_t *x, const signed char *cdbk, int nbVec, int nb
}

for (j=0;j<nbDim;j++)
x[j] -= SHL((spx_word16_t)cdbk[best_id*nbDim+j],5);
x[j] = SUB16(x[j],SHL((spx_word16_t)cdbk[best_id*nbDim+j],5));

return best_id;
}
Expand Down Expand Up @@ -144,7 +144,7 @@ static int lsp_weight_quant(spx_word16_t *x, spx_word16_t *weight, const signed
}

for (j=0;j<nbDim;j++)
x[j] -= SHL((spx_word16_t)cdbk[best_id*nbDim+j],5);
x[j] = SUB16(x[j],SHL((spx_word16_t)cdbk[best_id*nbDim+j],5));
return best_id;
}

Expand All @@ -161,7 +161,7 @@ void lsp_quant_nb(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits)
compute_quant_weights(qlsp, quant_weight, order);

for (i=0;i<order;i++)
qlsp[i]-=LSP_LINEAR(i);
qlsp[i]=SUB16(qlsp[i],LSP_LINEAR(i));

#ifndef FIXED_POINT
for (i=0;i<order;i++)
Expand Down Expand Up @@ -244,7 +244,7 @@ void lsp_quant_lbr(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits)
compute_quant_weights(qlsp, quant_weight, order);

for (i=0;i<order;i++)
qlsp[i]-=LSP_LINEAR(i);
qlsp[i]=SUB16(qlsp[i],LSP_LINEAR(i));
#ifndef FIXED_POINT
for (i=0;i<order;i++)
qlsp[i]=qlsp[i]*LSP_SCALE;
Expand Down Expand Up @@ -330,7 +330,7 @@ void lsp_quant_high(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits)
}*/

for (i=0;i<order;i++)
qlsp[i]-=LSP_LINEAR_HIGH(i);
qlsp[i]=SUB16(qlsp[i],LSP_LINEAR_HIGH(i));
#ifndef FIXED_POINT
for (i=0;i<order;i++)
qlsp[i] = qlsp[i]*LSP_SCALE;
Expand Down Expand Up @@ -394,7 +394,7 @@ void lsp_quant_48k(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits)
compute_quant_weights(qlsp, quant_weight, order);

for (i=0;i<order;i++)
qlsp[i]-=LSP_SCALING*(.25*i+.3125);
qlsp[i]=SUB16(qlsp[i],LSP_SCALING*(.25*i+.3125));
#ifndef FIXED_POINT
for (i=0;i<order;i++)
qlsp[i] = qlsp[i]*LSP_SCALE;
Expand Down
6 changes: 3 additions & 3 deletions libspeex/sb_celp.c
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ int sb_encode(void *state, void *vin, SpeexBits *bits)
fir_mem_up(st->high, h1, st->y1, st->full_frame_size, QMF_ORDER, st->g1_mem, stack);

for (i=0;i<st->full_frame_size;i++)
in[i]=2*(st->y0[i]-st->y1[i]) / SIG_SCALING;
in[i]=SHR(st->y0[i]-st->y1[i], SIG_SHIFT-1);
#endif

if (dtx)
Expand Down Expand Up @@ -761,7 +761,7 @@ int sb_encode(void *state, void *vin, SpeexBits *bits)
fir_mem_up(st->high, h1, st->y1, st->full_frame_size, QMF_ORDER, st->g1_mem, stack);

for (i=0;i<st->full_frame_size;i++)
in[i]=2*(st->y0[i]-st->y1[i]) / SIG_SCALING;
in[i]=SHR(st->y0[i]-st->y1[i], SIG_SHIFT-1);
#endif
for (i=0;i<st->lpcSize;i++)
st->old_lsp[i] = st->lsp[i];
Expand Down Expand Up @@ -953,7 +953,7 @@ int sb_decode(void *state, SpeexBits *bits, void *vout)
ret = speex_decode_native(st->st_low, bits, low);

for (i=0;i<st->frame_size;i++)
st->x0d[i] = low[i]*SIG_SCALING;
st->x0d[i] = SHL((spx_sig_t)low[i], SIG_SHIFT);
}

speex_decoder_ctl(st->st_low, SPEEX_GET_DTX_STATUS, &dtx);
Expand Down
4 changes: 2 additions & 2 deletions libspeex/speex_header.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ typedef struct SpeexHeader {
void speex_init_header(SpeexHeader *header, int rate, int nb_channels, const SpeexMode *m)
{
int i;
char *h="Speex ";
const char *h="Speex ";
/*
strncpy(header->speex_string, "Speex ", 8);
strncpy(header->speex_version, SPEEX_VERSION, SPEEX_HEADER_VERSION_LENGTH-1);
Expand Down Expand Up @@ -129,7 +129,7 @@ SpeexHeader *speex_packet_to_header(char *packet, int size)
{
int i;
SpeexHeader *le_header;
char *h = "Speex ";
const char *h = "Speex ";
for (i=0;i<8;i++)
if (packet[i]!=h[i])
{
Expand Down

0 comments on commit ea52aea

Please sign in to comment.