Commit be6df4d6 authored by Tristan Matthews's avatar Tristan Matthews

remove trailing whitespace

parent 6aab25cb
......@@ -86,7 +86,7 @@ int nb_decode(struct speex_decode_state *st, SpeexBits *bits, float *out)
mode = speex_bits_unpack_unsigned(bits, 4);
if (mode == 15)
return -1;
} while (mode > 8);
if (mode != 3) {
......@@ -108,7 +108,7 @@ int nb_decode(struct speex_decode_state *st, SpeexBits *bits, float *out)
for (i=0; i<NB_ORDER; i++)
st->old_qlsp[i] = qlsp[i];
}
/* Get global excitation gain */
qe = speex_bits_unpack_unsigned(bits, 5);
ol_gain = SIG_SCALING*exp(qe/3.5);
......@@ -130,14 +130,14 @@ int nb_decode(struct speex_decode_state *st, SpeexBits *bits, float *out)
NB_SUBFRAME_SIZE, bits, 0);
sanitize_values32(exc32, -32000, 32000, NB_SUBFRAME_SIZE);
/* Unquantize the innovation */
SPEEX_MEMSET(innov, 0, NB_SUBFRAME_SIZE);
/* Decode sub-frame gain correction */
q_energy = speex_bits_unpack_unsigned(bits, 1);
ener = exc_gain_quant_scal1[q_energy] * ol_gain;
/* Fixed codebook contribution */
split_cb_shape_sign_unquant(innov, bits);
......@@ -148,9 +148,9 @@ int nb_decode(struct speex_decode_state *st, SpeexBits *bits, float *out)
exc[i] = exc32[i] + innov[i];
}
}
SPEEX_COPY(out, &st->exc[-NB_SUBFRAME_SIZE], NB_FRAME_SIZE);
/* Loop on subframes */
for (sub=0; sub<4; sub++) {
const int offset = NB_SUBFRAME_SIZE*sub;
......@@ -173,7 +173,7 @@ int nb_decode(struct speex_decode_state *st, SpeexBits *bits, float *out)
for (i=0; i<NB_ORDER; i++)
st->interp_qlpc[i] = ak[i];
}
/* Store the LSPs for interpolation in the next frame */
for (i=0; i<NB_ORDER; i++)
st->old_qlsp[i] = qlsp[i];
......
......@@ -33,13 +33,13 @@ int main(int argc, char **argv)
speex_bits_init(&bits);
while (1)
{
/*Read the size encoded by sampleenc, this part will likely be
/*Read the size encoded by sampleenc, this part will likely be
different in your application*/
fread(&nbBytes, sizeof(int), 1, stdin);
fprintf (stderr, "nbBytes: %d\n", nbBytes);
if (feof(stdin))
break;
/*Read the "packet" encoded by sampleenc*/
fread(cbits, 1, nbBytes, stdin);
/*Copy the data into the bit-stream struct*/
......@@ -55,7 +55,7 @@ int main(int argc, char **argv)
/*Write the decoded audio to file*/
fwrite(out, sizeof(short), FRAME_SIZE, fout);
}
/*Destroy the decoder state*/
speex_decoder_destroy(state);
/*Destroy the bit-stream truct*/
......
......@@ -52,9 +52,9 @@ int main(int argc, char **argv)
fwrite(&nbBytes, sizeof(int), 1, stdout);
/*Write the compressed data*/
fwrite(cbits, 1, nbBytes, stdout);
}
/*Destroy the encoder state*/
speex_encoder_destroy(state);
/*Destroy the bit-packing struct*/
......
/* Copyright (C) 2002 Jean-Marc Valin
/* Copyright (C) 2002 Jean-Marc Valin
File: speex_bits.c
Handles bit packing/unpacking
......@@ -6,18 +6,18 @@
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
......@@ -79,7 +79,7 @@ EXPORT void speex_bits_set_bit_buffer(SpeexBits *bits, void *buff, int buf_size)
bits->charPtr=0;
bits->bitPtr=0;
bits->overflow=0;
}
EXPORT void speex_bits_destroy(SpeexBits *bits)
......
/* Copyright (C) 2002-2006 Jean-Marc Valin
/* Copyright (C) 2002-2006 Jean-Marc Valin
File: cb_search.c
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
......@@ -60,7 +60,7 @@ static void compute_weighted_codebook(const signed char *shape_cb, const spx_wor
for (i=0;i<shape_cb_size;i++)
{
spx_word16_t *res;
res = resp+i*subvect_size;
for (k=0;k<subvect_size;k++)
shape[k] = (spx_word16_t)shape_cb[i*subvect_size+k];
......@@ -131,7 +131,7 @@ int update_target
int best_index;
spx_word32_t best_dist;
int have_sign;
params = (const split_cb_params *) par;
subvect_size = params->subvect_size;
nb_subvect = params->nb_subvect;
......@@ -148,7 +148,7 @@ int update_target
#endif
ALLOC(t, nsf, spx_word16_t);
ALLOC(e, nsf, spx_sig_t);
/* FIXME: Do we still need to copy the target? */
SPEEX_COPY(t, target, nsf);
......@@ -164,9 +164,9 @@ int update_target
else
#endif /* DISABLE_WIDEBAND */
vq_nbest(x, resp2, subvect_size, shape_cb_size, E, 1, &best_index, &best_dist, stack);
speex_bits_pack(bits,best_index,params->shape_bits+have_sign);
{
int rind;
spx_word16_t *res;
......@@ -198,9 +198,9 @@ int update_target
for (j=0;j<subvect_size;j++)
e[subvect_size*i+j]=sign*0.03125*shape_cb[rind*subvect_size+j];
#endif
}
for (m=0;m<subvect_size;m++)
{
spx_word16_t g;
......@@ -212,7 +212,7 @@ int update_target
sign=-1;
rind-=shape_cb_size;
}
q=subvect_size-m;
#ifdef FIXED_POINT
g=sign*shape_cb[rind*subvect_size+m];
......@@ -227,7 +227,7 @@ int update_target
/* FIXME: We could update the excitation directly above */
for (j=0;j<nsf;j++)
exc[j]=ADD32(exc[j],e[j]);
/* Update target: only update target if necessary */
if (update_target)
{
......@@ -338,14 +338,14 @@ int update_target
ALLOC(best_ntarget, N, int);
ALLOC(ndist, N, spx_word32_t);
ALLOC(odist, N, spx_word32_t);
ALLOC(itmp, 2*N*nb_subvect, int);
for (i=0;i<N;i++)
{
nind[i]=itmp+2*i*nb_subvect;
oind[i]=itmp+(2*i+1)*nb_subvect;
}
SPEEX_COPY(t, target, nsf);
for (j=0;j<N;j++)
......@@ -356,14 +356,14 @@ int update_target
for (j=0;j<N;j++)
odist[j]=0;
/*For all subvectors*/
for (i=0;i<nb_subvect;i++)
{
/*"erase" nbest list*/
for (j=0;j<N;j++)
ndist[j]=VERY_LARGE32;
/* This is not strictly necessary, but it provides an additonal safety
/* This is not strictly necessary, but it provides an additonal safety
to prevent crashes in case something goes wrong in the previous
steps (e.g. NaNs) */
for (j=0;j<N;j++)
......@@ -393,7 +393,7 @@ int update_target
{
/* Compute total distance (including previous sub-vectors */
spx_word32_t err = ADD32(ADD32(odist[j],best_dist[k]),tener);
/*update n-best list*/
if (err<ndist[N-1])
{
......@@ -424,7 +424,7 @@ int update_target
/*previous target (we don't care what happened before*/
for (m=(i+1)*subvect_size;m<nsf;m++)
nt[j][m]=ot[best_ntarget[j]][m];
/* New code: update the rest of the target only if it's worth it */
for (m=0;m<subvect_size;m++)
{
......@@ -473,7 +473,7 @@ int update_target
ind[i]=nind[0][i];
speex_bits_pack(bits,ind[i],params->shape_bits+have_sign);
}
/* Put everything back together */
for (i=0;i<nb_subvect;i++)
{
......@@ -498,11 +498,11 @@ int update_target
for (j=0;j<subvect_size;j++)
e[subvect_size*i+j]=sign*0.03125*shape_cb[rind*subvect_size+j];
#endif
}
}
/* Update excitation */
for (j=0;j<nsf;j++)
exc[j]=ADD32(exc[j],e[j]);
/* Update target: only update target if necessary */
if (update_target)
{
......@@ -571,7 +571,7 @@ spx_int32_t *seed
}
#else
for (j=0;j<subvect_size;j++)
exc[subvect_size*i+j]+=s*0.03125*shape_cb[ind[i]*subvect_size+j];
exc[subvect_size*i+j]+=s*0.03125*shape_cb[ind[i]*subvect_size+j];
#endif
}
}
......
/* Copyright (C) 2002 Jean-Marc Valin
/* Copyright (C) 2002 Jean-Marc Valin
File: exc_10_16_table.c
Codebook for excitation in narrowband CELP mode (3200 bps)
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
......
/* Copyright (C) 2002 Jean-Marc Valin
/* Copyright (C) 2002 Jean-Marc Valin
File: exc_10_32_table.c
Codebook for excitation in narrowband CELP mode (4000 bps)
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
......
/* Copyright (C) 2002 Jean-Marc Valin
/* Copyright (C) 2002 Jean-Marc Valin
File: exc_20_32_table.c
Codebook for excitation in narrowband CELP mode (2000 bps)
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
......
/* Copyright (C) 2002 Jean-Marc Valin
/* Copyright (C) 2002 Jean-Marc Valin
File: exc_5_256_table.c
Codebook for excitation in narrowband CELP mode (12800 bps)
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
......
/* Copyright (C) 2002 Jean-Marc Valin
/* Copyright (C) 2002 Jean-Marc Valin
File: exc_5_64_table.c
Codebook for excitation in narrowband CELP mode (9600 bps)
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
......
/* Copyright (C) 2002 Jean-Marc Valin
/* Copyright (C) 2002 Jean-Marc Valin
File: exc_8_128_table.c
Codebook for excitation in narrowband CELP mode (7000 bps)
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
......
/* Copyright (C) 2005-2006 Jean-Marc Valin
/* Copyright (C) 2005-2006 Jean-Marc Valin
File: fftwrap.c
Wrapper for various FFTs
Wrapper for various FFTs
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
......@@ -62,7 +62,7 @@ static int maximize_range(spx_word16_t *in, spx_word16_t *out, spx_word16_t boun
for (i=0;i<len;i++)
{
out[i] = SHL16(in[i], shift);
}
}
return shift;
}
......@@ -270,7 +270,7 @@ void spx_fft(void *table, spx_word16_t *in, spx_word16_t *out)
out[i] = optr[i+1];
}
void spx_ifft(void *table, spx_word16_t *in, spx_word16_t *out)
void spx_ifft(void *table, spx_word16_t *in, spx_word16_t *out)
{
int i;
struct fftw_config *t = (struct fftw_config *) table;
......@@ -285,7 +285,7 @@ void spx_ifft(void *table, spx_word16_t *in, spx_word16_t *out)
iptr[N+1] = 0.0f;
fftwf_execute(t->ifft);
for(i=0;i<N;++i)
out[i] = optr[i];
}
......
/* Copyright (C) 2002-2006 Jean-Marc Valin
/* Copyright (C) 2002-2006 Jean-Marc Valin
File: filters.c
Various analysis/synthesis filters
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
......@@ -93,7 +93,7 @@ void highpass(const spx_word16_t *x, spx_word16_t *y, int len, int filtID, spx_m
const spx_word16_t *den, *num;
if (filtID>4)
filtID=4;
den = Pcoef[filtID]; num = Zcoef[filtID];
/*return;*/
for (i=0;i<len;i++)
......@@ -219,7 +219,7 @@ spx_word16_t compute_rms(const spx_sig_t *x, int len)
sum2 = MAC16_16(sum2,tmp,tmp);
sum = ADD32(sum,SHR32(sum2,6));
}
return EXTRACT16(PSHR32(SHL32(EXTEND32(spx_sqrt(DIV32(sum,len))),(sig_shift+3)),SIG_SHIFT));
}
#endif /* !defined (DISABLE_WIDEBAND) && !defined (DISABLE_ENCODER) */
......@@ -227,7 +227,7 @@ spx_word16_t compute_rms(const spx_sig_t *x, int len)
spx_word16_t compute_rms16(const spx_word16_t *x, int len)
{
int i;
spx_word16_t max_val=10;
spx_word16_t max_val=10;
for (i=0;i<len;i++)
{
......@@ -268,7 +268,7 @@ spx_word16_t compute_rms16(const spx_word16_t *x, int len)
sum2 = MAC16_16(sum2,SHL16(x[i+3],sig_shift),SHL16(x[i+3],sig_shift));
sum = ADD32(sum,SHR32(sum2,6));
}
return SHL16(spx_sqrt(DIV32(sum,len)),3-sig_shift);
return SHL16(spx_sqrt(DIV32(sum,len)),3-sig_shift);
}
}
......@@ -278,7 +278,7 @@ int normalize16(const spx_sig_t *x, spx_word16_t *y, spx_sig_t max_scale, int le
int i;
spx_sig_t max_val=1;
int sig_shift;
for (i=0;i<len;i++)
{
spx_sig_t tmp = x[i];
......@@ -297,7 +297,7 @@ int normalize16(const spx_sig_t *x, spx_word16_t *y, spx_sig_t max_scale, int le
for (i=0;i<len;i++)
y[i] = EXTRACT16(SHR32(x[i], sig_shift));
return sig_shift;
}
#endif
......@@ -420,7 +420,7 @@ void compute_impulse_response(const spx_coef_t *ak, const spx_coef_t *awk1, cons
VARDECL(spx_mem_t *mem2);
ALLOC(mem1, ord, spx_mem_t);
ALLOC(mem2, ord, spx_mem_t);
y[0] = LPC_SCALING;
for (i=0;i<ord;i++)
y[i+1] = awk1[i];
......@@ -454,7 +454,7 @@ void qmf_decomp(const spx_word16_t *xx, const spx_word16_t *aa, spx_word16_t *y1
VARDECL(spx_word16_t *a);
VARDECL(spx_word16_t *x);
spx_word16_t *x2;
ALLOC(a, M, spx_word16_t);
ALLOC(x, N+M-1, spx_word16_t);
x2=x+M-1;
......@@ -493,7 +493,7 @@ void qmf_synth(const spx_word16_t *x1, const spx_word16_t *x2, const spx_word16_
int M2, N2;
VARDECL(spx_word16_t *xx1);
VARDECL(spx_word16_t *xx2);
M2 = M>>1;
N2 = N>>1;
ALLOC(xx1, M2+N2, spx_word16_t);
......@@ -676,11 +676,11 @@ spx_word16_t comb_gain, /*gain of comb filter*/
char *stack
)
{
int i;
int i;
VARDECL(spx_word16_t *iexc);
spx_word16_t old_ener, new_ener;
int corr_pitch;
spx_word16_t iexc0_mag, iexc1_mag, exc_mag;
spx_word32_t corr0, corr1;
spx_word16_t gain0, gain1;
......@@ -696,7 +696,7 @@ char *stack
int nol_pitch[6];
spx_word16_t nol_pitch_coef[6];
spx_word16_t ol_pitch_coef;
open_loop_nbest_pitch(exc, 20, 120, nsf,
open_loop_nbest_pitch(exc, 20, 120, nsf,
nol_pitch, nol_pitch_coef, 6, stack);
corr_pitch=nol_pitch[0];
ol_pitch_coef = nol_pitch_coef[0];
......@@ -704,11 +704,11 @@ char *stack