Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/xiph/speex.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Matthews <tmatth@videolan.org>2015-04-01 19:35:06 +0300
committerTristan Matthews <tmatth@videolan.org>2015-04-01 19:38:11 +0300
commitbe6df4d61427c04b6609205fab079a1e6a05cb69 (patch)
tree61bf03be2ae52ae7da052828e083e6b94f5f42c6
parent6aab25cb90f373c27f36901d4d9ed510919d2ea4 (diff)
remove trailing whitespace
-rw-r--r--doc/nb_celp.c14
-rw-r--r--doc/sampledec.c6
-rw-r--r--doc/sampleenc.c4
-rw-r--r--libspeex/bits.c12
-rw-r--r--libspeex/cb_search.c48
-rw-r--r--libspeex/exc_10_16_table.c10
-rw-r--r--libspeex/exc_10_32_table.c10
-rw-r--r--libspeex/exc_20_32_table.c10
-rw-r--r--libspeex/exc_5_256_table.c10
-rw-r--r--libspeex/exc_5_64_table.c10
-rw-r--r--libspeex/exc_8_128_table.c10
-rw-r--r--libspeex/fftwrap.c18
-rw-r--r--libspeex/filters.c52
-rw-r--r--libspeex/gain_table.c6
-rw-r--r--libspeex/gain_table_lbr.c6
-rw-r--r--libspeex/hexc_10_32_table.c74
-rw-r--r--libspeex/hexc_table.c266
-rw-r--r--libspeex/high_lsp_tables.c8
-rw-r--r--libspeex/kiss_fft.c40
-rw-r--r--libspeex/kiss_fftr.c38
-rw-r--r--libspeex/lpc.c30
-rw-r--r--libspeex/lsp.c32
-rw-r--r--libspeex/lsp_tables_nb.c6
-rw-r--r--libspeex/ltp.c58
-rw-r--r--libspeex/modes.c10
-rw-r--r--libspeex/modes_wb.c10
-rw-r--r--libspeex/nb_celp.c180
-rw-r--r--libspeex/quant_lsp.c28
-rw-r--r--libspeex/sb_celp.c118
-rw-r--r--libspeex/smallft.c16
-rw-r--r--libspeex/speex.c12
-rw-r--r--libspeex/speex_callbacks.c10
-rw-r--r--libspeex/speex_header.c24
-rw-r--r--libspeex/stereo.c40
-rw-r--r--libspeex/testenc.c2
-rw-r--r--libspeex/testenc_uwb.c4
-rw-r--r--libspeex/testenc_wb.c4
-rw-r--r--libspeex/vbr.c24
-rw-r--r--libspeex/vorbis_psy.c112
-rw-r--r--libspeex/vq.c8
-rw-r--r--libspeex/window.c58
-rw-r--r--speexclient/alsa_device.c32
-rw-r--r--speexclient/speex_jitter_buffer.c4
-rw-r--r--speexclient/speexclient.c50
-rw-r--r--ti/config.h12
-rw-r--r--ti/testenc-TI-C5x.c32
-rw-r--r--ti/testenc-TI-C64x.c26
-rw-r--r--tmv/config.h28
48 files changed, 811 insertions, 811 deletions
diff --git a/doc/nb_celp.c b/doc/nb_celp.c
index 90bda10..50d5ffa 100644
--- a/doc/nb_celp.c
+++ b/doc/nb_celp.c
@@ -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];
diff --git a/doc/sampledec.c b/doc/sampledec.c
index 2878c47..8e89e12 100644
--- a/doc/sampledec.c
+++ b/doc/sampledec.c
@@ -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*/
diff --git a/doc/sampleenc.c b/doc/sampleenc.c
index d508181..a0ec8b6 100644
--- a/doc/sampleenc.c
+++ b/doc/sampleenc.c
@@ -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*/
diff --git a/libspeex/bits.c b/libspeex/bits.c
index 94c280a..2d782a2 100644
--- a/libspeex/bits.c
+++ b/libspeex/bits.c
@@ -1,4 +1,4 @@
-/* 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)
diff --git a/libspeex/cb_search.c b/libspeex/cb_search.c
index 26c2329..7f5649e 100644
--- a/libspeex/cb_search.c
+++ b/libspeex/cb_search.c
@@ -1,21 +1,21 @@
-/* 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
}
}
diff --git a/libspeex/exc_10_16_table.c b/libspeex/exc_10_16_table.c
index 98ae357..f75ba30 100644
--- a/libspeex/exc_10_16_table.c
+++ b/libspeex/exc_10_16_table.c
@@ -1,22 +1,22 @@
-/* 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
diff --git a/libspeex/exc_10_32_table.c b/libspeex/exc_10_32_table.c
index 1ee56a2..89425f0 100644
--- a/libspeex/exc_10_32_table.c
+++ b/libspeex/exc_10_32_table.c
@@ -1,22 +1,22 @@
-/* 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
diff --git a/libspeex/exc_20_32_table.c b/libspeex/exc_20_32_table.c
index e4098b8..f7b3032 100644
--- a/libspeex/exc_20_32_table.c
+++ b/libspeex/exc_20_32_table.c
@@ -1,22 +1,22 @@
-/* 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
diff --git a/libspeex/exc_5_256_table.c b/libspeex/exc_5_256_table.c
index 4137996..169b628 100644
--- a/libspeex/exc_5_256_table.c
+++ b/libspeex/exc_5_256_table.c
@@ -1,22 +1,22 @@
-/* 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
diff --git a/libspeex/exc_5_64_table.c b/libspeex/exc_5_64_table.c
index 2c66d51..6d2ae2b 100644
--- a/libspeex/exc_5_64_table.c
+++ b/libspeex/exc_5_64_table.c
@@ -1,22 +1,22 @@
-/* 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
diff --git a/libspeex/exc_8_128_table.c b/libspeex/exc_8_128_table.c
index 17ee64b..fd05890 100644
--- a/libspeex/exc_8_128_table.c
+++ b/libspeex/exc_8_128_table.c
@@ -1,22 +1,22 @@
-/* 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
diff --git a/libspeex/fftwrap.c b/libspeex/fftwrap.c
index a14b1e4..4573479 100644
--- a/libspeex/fftwrap.c
+++ b/libspeex/fftwrap.c
@@ -1,23 +1,23 @@
-/* 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];
}
diff --git a/libspeex/filters.c b/libspeex/filters.c
index 79f6546..5e1e45e 100644
--- a/libspeex/filters.c
+++ b/libspeex/filters.c
@@ -1,22 +1,22 @@
-/* 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
for (i=1;i<6;i++)
{
#ifdef FIXED_POINT
- if ((nol_pitch_coef[i]>MULT16_16_Q15(nol_pitch_coef[0],19661)) &&
+ if ((nol_pitch_coef[i]>MULT16_16_Q15(nol_pitch_coef[0],19661)) &&
#else
- if ((nol_pitch_coef[i]>.6*nol_pitch_coef[0]) &&
+ if ((nol_pitch_coef[i]>.6*nol_pitch_coef[0]) &&
#endif
- (ABS(2*nol_pitch[i]-corr_pitch)<=2 || ABS(3*nol_pitch[i]-corr_pitch)<=3 ||
+ (ABS(2*nol_pitch[i]-corr_pitch)<=2 || ABS(3*nol_pitch[i]-corr_pitch)<=3 ||
ABS(4*nol_pitch[i]-corr_pitch)<=4 || ABS(5*nol_pitch[i]-corr_pitch)<=5))
{
corr_pitch = nol_pitch[i];
@@ -717,9 +717,9 @@ char *stack
#else
corr_pitch = pitch;
#endif
-
+
ALLOC(iexc, 2*nsf, spx_word16_t);
-
+
interp_pitch(exc, iexc, corr_pitch, 80);
if (corr_pitch>max_pitch)
interp_pitch(exc, iexc+nsf, 2*corr_pitch, 80);
@@ -744,7 +744,7 @@ char *stack
}
#endif
/*interp_pitch(exc, iexc+2*nsf, 2*corr_pitch, 80);*/
-
+
/*printf ("%d %d %f\n", pitch, corr_pitch, max_corr*ener_1);*/
iexc0_mag = spx_sqrt(1000+inner_prod(iexc,iexc,nsf));
iexc1_mag = spx_sqrt(1000+inner_prod(iexc+nsf,iexc+nsf,nsf));
@@ -781,7 +781,7 @@ char *stack
c1 = .4*comb_gain+.07;
c2 = .5+1.72*(c1-.07);
#endif
- } else
+ } else
{
c1=c2=0;
}
@@ -811,7 +811,7 @@ char *stack
/* FIXME: compute_rms16 is currently not quite accurate enough (but close) */
new_ener = compute_rms16(new_exc, nsf);
old_ener = compute_rms16(exc, nsf);
-
+
if (old_ener < 1)
old_ener = 1;
if (new_ener < 1)
@@ -819,7 +819,7 @@ char *stack
if (old_ener > new_ener)
old_ener = new_ener;
ngain = PDIV32_16(SHL32(EXTEND32(old_ener),14),new_ener);
-
+
for (i=0;i<nsf;i++)
new_exc[i] = MULT16_16_Q14(ngain, new_exc[i]);
#ifdef FIXED_POINT
diff --git a/libspeex/gain_table.c b/libspeex/gain_table.c
index 00b8244..63dc6e7 100644
--- a/libspeex/gain_table.c
+++ b/libspeex/gain_table.c
@@ -1,13 +1,13 @@
-/* Copyright (C) 2002 Jean-Marc Valin
+/* Copyright (C) 2002 Jean-Marc Valin
File: gain_table.c
Codebook for 3-tap pitch prediction gain (128 entries)
-
+
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
+ this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
diff --git a/libspeex/gain_table_lbr.c b/libspeex/gain_table_lbr.c
index 3c1c3db..be464f3 100644
--- a/libspeex/gain_table_lbr.c
+++ b/libspeex/gain_table_lbr.c
@@ -1,13 +1,13 @@
-/* Copyright (C) 2002 Jean-Marc Valin
+/* Copyright (C) 2002 Jean-Marc Valin
File: gain_table_lbr.c
Codebook for 3-tap pitch prediction gain (32 entries)
-
+
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
+ this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
diff --git a/libspeex/hexc_10_32_table.c b/libspeex/hexc_10_32_table.c
index 8dd408f..1c7f285 100644
--- a/libspeex/hexc_10_32_table.c
+++ b/libspeex/hexc_10_32_table.c
@@ -1,22 +1,22 @@
-/* Copyright (C) 2002 Jean-Marc Valin
+/* Copyright (C) 2002 Jean-Marc Valin
File: hexc_10_32_table.c
Codebook for high-band excitation in SB-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
@@ -31,36 +31,36 @@
*/
const signed char hexc_10_32_table[320] = {
--3, -2, -1, 0, -4, 5, 35, -40, -9, 13,
--44, 5, -27, -1, -7, 6, -11, 7, -8, 7,
-19, -14, 15, -4, 9, -10, 10, -8, 10, -9,
--1, 1, 0, 0, 2, 5, -18, 22, -53, 50,
-1, -23, 50, -36, 15, 3, -13, 14, -10, 6,
-1, 5, -3, 4, -2, 5, -32, 25, 5, -2,
--1, -4, 1, 11, -29, 26, -6, -15, 30, -18,
-0, 15, -17, 40, -41, 3, 9, -2, -2, 3,
--3, -1, -5, 2, 21, -6, -16, -21, 23, 2,
-60, 15, 16, -16, -9, 14, 9, -1, 7, -9,
-0, 1, 1, 0, -1, -6, 17, -28, 54, -45,
--1, 1, -1, -6, -6, 2, 11, 26, -29, -2,
-46, -21, 34, 12, -23, 32, -23, 16, -10, 3,
-66, 19, -20, 24, 7, 11, -3, 0, -3, -1,
--50, -46, 2, -18, -3, 4, -1, -2, 3, -3,
--19, 41, -36, 9, 11, -24, 21, -16, 9, -3,
--25, -3, 10, 18, -9, -2, -5, -1, -5, 6,
--4, -3, 2, -26, 21, -19, 35, -15, 7, -13,
-17, -19, 39, -43, 48, -31, 16, -9, 7, -2,
--5, 3, -4, 9, -19, 27, -55, 63, -35, 10,
-26, -44, -2, 9, 4, 1, -6, 8, -9, 5,
--8, -1, -3, -16, 45, -42, 5, 15, -16, 10,
-0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
--16, 24, -55, 47, -38, 27, -19, 7, -3, 1,
-16, 27, 20, -19, 18, 5, -7, 1, -5, 2,
--6, 8, -22, 0, -3, -3, 8, -1, 7, -8,
-1, -3, 5, 0, 17, -48, 58, -52, 29, -7,
--2, 3, -10, 6, -26, 58, -31, 1, -6, 3,
-93, -29, 39, 3, 17, 5, 6, -1, -1, -1,
-27, 13, 10, 19, -7, -34, 12, 10, -4, 9,
--76, 9, 8, -28, -2, -11, 2, -1, 3, 1,
--83, 38, -39, 4, -16, -6, -2, -5, 5, -2,
+-3, -2, -1, 0, -4, 5, 35, -40, -9, 13,
+-44, 5, -27, -1, -7, 6, -11, 7, -8, 7,
+19, -14, 15, -4, 9, -10, 10, -8, 10, -9,
+-1, 1, 0, 0, 2, 5, -18, 22, -53, 50,
+1, -23, 50, -36, 15, 3, -13, 14, -10, 6,
+1, 5, -3, 4, -2, 5, -32, 25, 5, -2,
+-1, -4, 1, 11, -29, 26, -6, -15, 30, -18,
+0, 15, -17, 40, -41, 3, 9, -2, -2, 3,
+-3, -1, -5, 2, 21, -6, -16, -21, 23, 2,
+60, 15, 16, -16, -9, 14, 9, -1, 7, -9,
+0, 1, 1, 0, -1, -6, 17, -28, 54, -45,
+-1, 1, -1, -6, -6, 2, 11, 26, -29, -2,
+46, -21, 34, 12, -23, 32, -23, 16, -10, 3,
+66, 19, -20, 24, 7, 11, -3, 0, -3, -1,
+-50, -46, 2, -18, -3, 4, -1, -2, 3, -3,
+-19, 41, -36, 9, 11, -24, 21, -16, 9, -3,
+-25, -3, 10, 18, -9, -2, -5, -1, -5, 6,
+-4, -3, 2, -26, 21, -19, 35, -15, 7, -13,
+17, -19, 39, -43, 48, -31, 16, -9, 7, -2,
+-5, 3, -4, 9, -19, 27, -55, 63, -35, 10,
+26, -44, -2, 9, 4, 1, -6, 8, -9, 5,
+-8, -1, -3, -16, 45, -42, 5, 15, -16, 10,
+0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+-16, 24, -55, 47, -38, 27, -19, 7, -3, 1,
+16, 27, 20, -19, 18, 5, -7, 1, -5, 2,
+-6, 8, -22, 0, -3, -3, 8, -1, 7, -8,
+1, -3, 5, 0, 17, -48, 58, -52, 29, -7,
+-2, 3, -10, 6, -26, 58, -31, 1, -6, 3,
+93, -29, 39, 3, 17, 5, 6, -1, -1, -1,
+27, 13, 10, 19, -7, -34, 12, 10, -4, 9,
+-76, 9, 8, -28, -2, -11, 2, -1, 3, 1,
+-83, 38, -39, 4, -16, -6, -2, -5, 5, -2,
};
diff --git a/libspeex/hexc_table.c b/libspeex/hexc_table.c
index 268408a..6e36069 100644
--- a/libspeex/hexc_table.c
+++ b/libspeex/hexc_table.c
@@ -1,22 +1,22 @@
-/* Copyright (C) 2002 Jean-Marc Valin
+/* Copyright (C) 2002 Jean-Marc Valin
File: hexc_table.c
Codebook for high-band excitation in SB-CELP mode (8000 bps with sign)
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
@@ -31,132 +31,132 @@
*/
const signed char hexc_table[1024] = {
--24, 21, -20, 5, -5, -7, 14, -10,
-2, -27, 16, -20, 0, -32, 26, 19,
-8, -11, -41, 31, 28, -27, -32, 34,
-42, 34, -17, 22, -10, 13, -29, 18,
--12, -26, -24, 11, 22, 5, -5, -5,
-54, -68, -43, 57, -25, 24, 4, 4,
-26, -8, -12, -17, 54, 30, -45, 1,
-10, -15, 18, -41, 11, 68, -67, 37,
--16, -24, -16, 38, -22, 6, -29, 30,
-66, -27, 5, 7, -16, 13, 2, -12,
--7, -3, -20, 36, 4, -28, 9, 3,
-32, 48, 26, 39, 3, 0, 7, -21,
--13, 5, -82, -7, 73, -20, 34, -9,
--5, 1, -1, 10, -5, -10, -1, 9,
-1, -9, 10, 0, -14, 11, -1, -2,
--1, 11, 20, 96, -81, -22, -12, -9,
--58, 9, 24, -30, 26, -35, 27, -12,
-13, -18, 56, -59, 15, -7, 23, -15,
--1, 6, -25, 14, -22, -20, 47, -11,
-16, 2, 38, -23, -19, -30, -9, 40,
--11, 5, 4, -6, 8, 26, -21, -11,
-127, 4, 1, 6, -9, 2, -7, -2,
--3, 7, -5, 10, -19, 7, -106, 91,
--3, 9, -4, 21, -8, 26, -80, 8,
-1, -2, -10, -17, -17, -27, 32, 71,
-6, -29, 11, -23, 54, -38, 29, -22,
-39, 87, -31, -12, -20, 3, -2, -2,
-2, 20, 0, -1, -35, 27, 9, -6,
--12, 3, -12, -6, 13, 1, 14, -22,
--59, -15, -17, -25, 13, -7, 7, 3,
-0, 1, -7, 6, -3, 61, -37, -23,
--23, -29, 38, -31, 27, 1, -8, 2,
--27, 23, -26, 36, -34, 5, 24, -24,
--6, 7, 3, -59, 78, -62, 44, -16,
-1, 6, 0, 17, 8, 45, 0, -110,
-6, 14, -2, 32, -77, -56, 62, -3,
-3, -13, 4, -16, 102, -15, -36, -1,
-9, -113, 6, 23, 0, 9, 9, 5,
--8, -1, -14, 5, -12, 121, -53, -27,
--8, -9, 22, -13, 3, 2, -3, 1,
--2, -71, 95, 38, -19, 15, -16, -5,
-71, 10, 2, -32, -13, -5, 15, -1,
--2, -14, -85, 30, 29, 6, 3, 2,
-0, 0, 0, 0, 0, 0, 0, 0,
-2, -65, -56, -9, 18, 18, 23, -14,
--2, 0, 12, -29, 26, -12, 1, 2,
--12, -64, 90, -6, 4, 1, 5, -5,
--110, -3, -31, 22, -29, 9, 0, 8,
--40, -5, 21, -5, -5, 13, 10, -18,
-40, 1, 35, -20, 30, -28, 11, -6,
-19, 7, 14, 18, -64, 9, -6, 16,
-51, 68, 8, 16, 12, -8, 0, -9,
-20, -22, 25, 7, -4, -13, 41, -35,
-93, -18, -54, 11, -1, 1, -9, 4,
--66, 66, -31, 20, -22, 25, -23, 11,
-10, 9, 19, 15, 11, -5, -31, -10,
--23, -28, -6, -6, -3, -4, 5, 3,
--28, 22, -11, -42, 25, -25, -16, 41,
-34, 47, -6, 2, 42, -19, -22, 5,
--39, 32, 6, -35, 22, 17, -30, 8,
--26, -11, -11, 3, -12, 33, 33, -37,
-21, -1, 6, -4, 3, 0, -5, 5,
-12, -12, 57, 27, -61, -3, 20, -17,
-2, 0, 4, 0, -2, -33, -58, 81,
--23, 39, -10, -5, 2, 6, -7, 5,
-4, -3, -2, -13, -23, -72, 107, 15,
--5, 0, -7, -3, -6, 5, -4, 15,
-47, 12, -31, 25, -16, 8, 22, -25,
--62, -56, -18, 14, 28, 12, 2, -11,
-74, -66, 41, -20, -7, 16, -20, 16,
--8, 0, -16, 4, -19, 92, 12, -59,
--14, -39, 49, -25, -16, 23, -27, 19,
--3, -33, 19, 85, -29, 6, -7, -10,
-16, -7, -12, 1, -6, 2, 4, -2,
-64, 10, -25, 41, -2, -31, 15, 0,
-110, 50, 69, 35, 28, 19, -10, 2,
--43, -49, -56, -15, -16, 10, 3, 12,
--1, -8, 1, 26, -12, -1, 7, -11,
--27, 41, 25, 1, -11, -18, 22, -7,
--1, -47, -8, 23, -3, -17, -7, 18,
--125, 59, -5, 3, 18, 1, 2, 3,
-27, -35, 65, -53, 50, -46, 37, -21,
--28, 7, 14, -37, -5, -5, 12, 5,
--8, 78, -19, 21, -6, -16, 8, -7,
-5, 2, 7, 2, 10, -6, 12, -60,
-44, 11, -36, -32, 31, 0, 2, -2,
-2, 1, -3, 7, -10, 17, -21, 10,
-6, -2, 19, -2, 59, -38, -86, 38,
-8, -41, -30, -45, -33, 7, 15, 28,
-29, -7, 24, -40, 7, 7, 5, -2,
-9, 24, -23, -18, 6, -29, 30, 2,
-28, 49, -11, -46, 10, 43, -13, -9,
--1, -3, -7, -7, -17, -6, 97, -33,
--21, 3, 5, 1, 12, -43, -8, 28,
-7, -43, -7, 17, -20, 19, -1, 2,
--13, 9, 54, 34, 9, -28, -11, -9,
--17, 110, -59, 44, -26, 0, 3, -12,
--47, 73, -34, -43, 38, -33, 16, -5,
--46, -4, -6, -2, -25, 19, -29, 28,
--13, 5, 14, 27, -40, -43, 4, 32,
--13, -2, -35, -4, 112, -42, 9, -12,
-37, -28, 17, 14, -19, 35, -39, 23,
-3, -14, -1, -57, -5, 94, -9, 3,
--39, 5, 30, -10, -32, 42, -13, -14,
--97, -63, 30, -9, 1, -7, 12, 5,
-20, 17, -9, -36, -30, 25, 47, -9,
--15, 12, -22, 98, -8, -50, 15, -27,
-21, -16, -11, 2, 12, -10, 10, -3,
-33, 36, -96, 0, -17, 31, -9, 9,
-3, -20, 13, -11, 8, -4, 10, -10,
-9, 1, 112, -70, -27, 5, -21, 2,
--57, -3, -29, 10, 19, -21, 21, -10,
--66, -3, 91, -35, 30, -12, 0, -7,
-59, -28, 26, 2, 14, -18, 1, 1,
-11, 17, 20, -54, -59, 27, 4, 29,
-32, 5, 19, 12, -4, 1, 7, -10,
-5, -2, 10, 0, 23, -5, 28, -104,
-46, 11, 16, 3, 29, 1, -8, -14,
-1, 7, -50, 88, -62, 26, 8, -17,
--14, 50, 0, 32, -12, -3, -27, 18,
--8, -5, 8, 3, -20, -11, 37, -12,
-9, 33, 46, -101, -1, -4, 1, 6,
--1, 28, -42, -15, 16, 5, -1, -2,
--55, 85, 38, -9, -4, 11, -2, -9,
--6, 3, -20, -10, -77, 89, 24, -3,
--104, -57, -26, -31, -20, -6, -9, 14,
-20, -23, 46, -15, -31, 28, 1, -15,
--2, 6, -2, 31, 45, -76, 23, -25,
+-24, 21, -20, 5, -5, -7, 14, -10,
+2, -27, 16, -20, 0, -32, 26, 19,
+8, -11, -41, 31, 28, -27, -32, 34,
+42, 34, -17, 22, -10, 13, -29, 18,
+-12, -26, -24, 11, 22, 5, -5, -5,
+54, -68, -43, 57, -25, 24, 4, 4,
+26, -8, -12, -17, 54, 30, -45, 1,
+10, -15, 18, -41, 11, 68, -67, 37,
+-16, -24, -16, 38, -22, 6, -29, 30,
+66, -27, 5, 7, -16, 13, 2, -12,
+-7, -3, -20, 36, 4, -28, 9, 3,
+32, 48, 26, 39, 3, 0, 7, -21,
+-13, 5, -82, -7, 73, -20, 34, -9,
+-5, 1, -1, 10, -5, -10, -1, 9,
+1, -9, 10, 0, -14, 11, -1, -2,
+-1, 11, 20, 96, -81, -22, -12, -9,
+-58, 9, 24, -30, 26, -35, 27, -12,
+13, -18, 56, -59, 15, -7, 23, -15,
+-1, 6, -25, 14, -22, -20, 47, -11,
+16, 2, 38, -23, -19, -30, -9, 40,
+-11, 5, 4, -6, 8, 26, -21, -11,
+127, 4, 1, 6, -9, 2, -7, -2,
+-3, 7, -5, 10, -19, 7, -106, 91,
+-3, 9, -4, 21, -8, 26, -80, 8,
+1, -2, -10, -17, -17, -27, 32, 71,
+6, -29, 11, -23, 54, -38, 29, -22,
+39, 87, -31, -12, -20, 3, -2, -2,
+2, 20, 0, -1, -35, 27, 9, -6,
+-12, 3, -12, -6, 13, 1, 14, -22,
+-59, -15, -17, -25, 13, -7, 7, 3,
+0, 1, -7, 6, -3, 61, -37, -23,
+-23, -29, 38, -31, 27, 1, -8, 2,
+-27, 23, -26, 36, -34, 5, 24, -24,
+-6, 7, 3, -59, 78, -62, 44, -16,
+1, 6, 0, 17, 8, 45, 0, -110,
+6, 14, -2, 32, -77, -56, 62, -3,
+3, -13, 4, -16, 102, -15, -36, -1,
+9, -113, 6, 23, 0, 9, 9, 5,
+-8, -1, -14, 5, -12, 121, -53, -27,
+-8, -9, 22, -13, 3, 2, -3, 1,
+-2, -71, 95, 38, -19, 15, -16, -5,
+71, 10, 2, -32, -13, -5, 15, -1,
+-2, -14, -85, 30, 29, 6, 3, 2,
+0, 0, 0, 0, 0, 0, 0, 0,
+2, -65, -56, -9, 18, 18, 23, -14,
+-2, 0, 12, -29, 26, -12, 1, 2,
+-12, -64, 90, -6, 4, 1, 5, -5,
+-110, -3, -31, 22, -29, 9, 0, 8,
+-40, -5, 21, -5, -5, 13, 10, -18,
+40, 1, 35, -20, 30, -28, 11, -6,
+19, 7, 14, 18, -64, 9, -6, 16,
+51, 68, 8, 16, 12, -8, 0, -9,
+20, -22, 25, 7, -4, -13, 41, -35,
+93, -18, -54, 11, -1, 1, -9, 4,
+-66, 66, -31, 20, -22, 25, -23, 11,
+10, 9, 19, 15, 11, -5, -31, -10,
+-23, -28, -6, -6, -3, -4, 5, 3,
+-28, 22, -11, -42, 25, -25, -16, 41,
+34, 47, -6, 2, 42, -19, -22, 5,
+-39, 32, 6, -35, 22, 17, -30, 8,
+-26, -11, -11, 3, -12, 33, 33, -37,
+21, -1, 6, -4, 3, 0, -5, 5,
+12, -12, 57, 27, -61, -3, 20, -17,
+2, 0, 4, 0, -2, -33, -58, 81,
+-23, 39, -10, -5, 2, 6, -7, 5,
+4, -3, -2, -13, -23, -72, 107, 15,
+-5, 0, -7, -3, -6, 5, -4, 15,
+47, 12, -31, 25, -16, 8, 22, -25,
+-62, -56, -18, 14, 28, 12, 2, -11,
+74, -66, 41, -20, -7, 16, -20, 16,
+-8, 0, -16, 4, -19, 92, 12, -59,
+-14, -39, 49, -25, -16, 23, -27, 19,
+-3, -33, 19, 85, -29, 6, -7, -10,
+16, -7, -12, 1, -6, 2, 4, -2,
+64, 10, -25, 41, -2, -31, 15, 0,
+110, 50, 69, 35, 28, 19, -10, 2,
+-43, -49, -56, -15, -16, 10, 3, 12,
+-1, -8, 1, 26, -12, -1, 7, -11,
+-27, 41, 25, 1, -11, -18, 22, -7,
+-1, -47, -8, 23, -3, -17, -7, 18,
+-125, 59, -5, 3, 18, 1, 2, 3,
+27, -35, 65, -53, 50, -46, 37, -21,
+-28, 7, 14, -37, -5, -5, 12, 5,
+-8, 78, -19, 21, -6, -16, 8, -7,
+5, 2, 7, 2, 10, -6, 12, -60,
+44, 11, -36, -32, 31, 0, 2, -2,
+2, 1, -3, 7, -10, 17, -21, 10,
+6, -2, 19, -2, 59, -38, -86, 38,
+8, -41, -30, -45, -33, 7, 15, 28,
+29, -7, 24, -40, 7, 7, 5, -2,
+9, 24, -23, -18, 6, -29, 30, 2,
+28, 49, -11, -46, 10, 43, -13, -9,
+-1, -3, -7, -7, -17, -6, 97, -33,
+-21, 3, 5, 1, 12, -43, -8, 28,
+7, -43, -7, 17, -20, 19, -1, 2,
+-13, 9, 54, 34, 9, -28, -11, -9,
+-17, 110, -59, 44, -26, 0, 3, -12,
+-47, 73, -34, -43, 38, -33, 16, -5,
+-46, -4, -6, -2, -25, 19, -29, 28,
+-13, 5, 14, 27, -40, -43, 4, 32,
+-13, -2, -35, -4, 112, -42, 9, -12,
+37, -28, 17, 14, -19, 35, -39, 23,
+3, -14, -1, -57, -5, 94, -9, 3,
+-39, 5, 30, -10, -32, 42, -13, -14,
+-97, -63, 30, -9, 1, -7, 12, 5,
+20, 17, -9, -36, -30, 25, 47, -9,
+-15, 12, -22, 98, -8, -50, 15, -27,
+21, -16, -11, 2, 12, -10, 10, -3,
+33, 36, -96, 0, -17, 31, -9, 9,
+3, -20, 13, -11, 8, -4, 10, -10,
+9, 1, 112, -70, -27, 5, -21, 2,
+-57, -3, -29, 10, 19, -21, 21, -10,
+-66, -3, 91, -35, 30, -12, 0, -7,
+59, -28, 26, 2, 14, -18, 1, 1,
+11, 17, 20, -54, -59, 27, 4, 29,
+32, 5, 19, 12, -4, 1, 7, -10,
+5, -2, 10, 0, 23, -5, 28, -104,
+46, 11, 16, 3, 29, 1, -8, -14,
+1, 7, -50, 88, -62, 26, 8, -17,
+-14, 50, 0, 32, -12, -3, -27, 18,
+-8, -5, 8, 3, -20, -11, 37, -12,
+9, 33, 46, -101, -1, -4, 1, 6,
+-1, 28, -42, -15, 16, 5, -1, -2,
+-55, 85, 38, -9, -4, 11, -2, -9,
+-6, 3, -20, -10, -77, 89, 24, -3,
+-104, -57, -26, -31, -20, -6, -9, 14,
+20, -23, 46, -15, -31, 28, 1, -15,
+-2, 6, -2, 31, 45, -76, 23, -25,
};
diff --git a/libspeex/high_lsp_tables.c b/libspeex/high_lsp_tables.c
index e82e875..732c8b5 100644
--- a/libspeex/high_lsp_tables.c
+++ b/libspeex/high_lsp_tables.c
@@ -1,13 +1,13 @@
-/* Copyright (C) 2002 Jean-Marc Valin
+/* Copyright (C) 2002 Jean-Marc Valin
File: high_lsp_tables.c
Codebooks for high-band LSPs in SB-CELP mode
-
+
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
+ this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
@@ -28,7 +28,7 @@
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
-
+
const signed char high_lsp_cdbk[512]={
39,12,-14,-20,-29,-61,-67,-76,
-32,-71,-67,68,77,46,34,5,
diff --git a/libspeex/kiss_fft.c b/libspeex/kiss_fft.c
index 6778281..285e557 100644
--- a/libspeex/kiss_fft.c
+++ b/libspeex/kiss_fft.c
@@ -110,7 +110,7 @@ static void kf_bfly4(
C_MUL(scratch[0],Fout[m] , *tw1 );
C_MUL(scratch[1],Fout[m2] , *tw2 );
C_MUL(scratch[2],Fout[m3] , *tw3 );
-
+
C_SUB( scratch[5] , *Fout, scratch[1] );
C_ADDTO(*Fout, scratch[1]);
C_ADD( scratch[3] , scratch[0] , scratch[2] );
@@ -120,7 +120,7 @@ static void kf_bfly4(
tw2 += fstride*2;
tw3 += fstride*3;
C_ADDTO( *Fout , scratch[3] );
-
+
Fout[m].r = scratch[5].r - scratch[4].i;
Fout[m].i = scratch[5].i + scratch[4].r;
Fout[m3].r = scratch[5].r + scratch[4].i;
@@ -140,7 +140,7 @@ static void kf_bfly4(
C_MUL4(scratch[0],Fout[m] , *tw1 );
C_MUL4(scratch[1],Fout[m2] , *tw2 );
C_MUL4(scratch[2],Fout[m3] , *tw3 );
-
+
Fout->r = PSHR16(Fout->r, 2);
Fout->i = PSHR16(Fout->i, 2);
C_SUB( scratch[5] , *Fout, scratch[1] );
@@ -154,7 +154,7 @@ static void kf_bfly4(
tw2 += fstride*2;
tw3 += fstride*3;
C_ADDTO( *Fout , scratch[3] );
-
+
Fout[m].r = scratch[5].r + scratch[4].i;
Fout[m].i = scratch[5].i - scratch[4].r;
Fout[m3].r = scratch[5].r - scratch[4].i;
@@ -292,7 +292,7 @@ static void kf_bfly_generic(
/*CHECKBUF(scratchbuf,nscratchbuf,p);*/
if (p>17)
speex_fatal("KissFFT: max radix supported is 17");
-
+
for ( u=0; u<m; ++u ) {
k=u;
for ( q1=0 ; q1<p ; ++q1 ) {
@@ -317,7 +317,7 @@ static void kf_bfly_generic(
}
}
}
-
+
static
void kf_shuffle(
kiss_fft_cpx * Fout,
@@ -330,7 +330,7 @@ void kf_shuffle(
{
const int p=*factors++; /* the radix */
const int m=*factors++; /* stage's fft length/p */
-
+
/*printf ("fft %d %d %d %d %d %d\n", p*m, m, p, s2, fstride*in_stride, N);*/
if (m==1)
{
@@ -392,14 +392,14 @@ void kf_work(
switch (p) {
case 2: kf_bfly2(Fout,fstride,st,m); break;
- case 3: kf_bfly3(Fout,fstride,st,m); break;
+ case 3: kf_bfly3(Fout,fstride,st,m); break;
case 4: kf_bfly4(Fout,fstride,st,m); break;
- case 5: kf_bfly5(Fout,fstride,st,m); break;
+ case 5: kf_bfly5(Fout,fstride,st,m); break;
default: kf_bfly_generic(Fout,fstride,st,m,p); break;
}
#else
/*printf ("fft %d %d %d %d %d %d %d\n", p*m, m, p, s2, fstride*in_stride, N, m2);*/
- if (m==1)
+ if (m==1)
{
/*for (i=0;i<N;i++)
{
@@ -416,24 +416,24 @@ void kf_work(
kf_work( Fout , f, fstride*p, in_stride, factors,st, N*p, fstride*in_stride, m);
}
-
-
-
+
+
+
switch (p) {
case 2: kf_bfly2(Fout,fstride,st,m, N, m2); break;
- case 3: for (i=0;i<N;i++){Fout=Fout_beg+i*m2; kf_bfly3(Fout,fstride,st,m);} break;
+ case 3: for (i=0;i<N;i++){Fout=Fout_beg+i*m2; kf_bfly3(Fout,fstride,st,m);} break;
case 4: kf_bfly4(Fout,fstride,st,m, N, m2); break;
- case 5: for (i=0;i<N;i++){Fout=Fout_beg+i*m2; kf_bfly5(Fout,fstride,st,m);} break;
+ case 5: for (i=0;i<N;i++){Fout=Fout_beg+i*m2; kf_bfly5(Fout,fstride,st,m);} break;
default: for (i=0;i<N;i++){Fout=Fout_beg+i*m2; kf_bfly_generic(Fout,fstride,st,m,p);} break;
- }
+ }
#endif
}
/* facbuf is populated by p1,m1,p2,m2, ...
- where
+ where
p[i] * m[i] = m[i-1]
m0 = n */
-static
+static
void kf_factor(int n,int * facbuf)
{
int p=4;
@@ -501,10 +501,10 @@ kiss_fft_cfg kiss_fft_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem
-
+
void kiss_fft_stride(kiss_fft_cfg st,const kiss_fft_cpx *fin,kiss_fft_cpx *fout,int in_stride)
{
- if (fin == fout)
+ if (fin == fout)
{
speex_fatal("In-place FFT not supported");
/*CHECKBUF(tmpbuf,ntmpbuf,st->nfft);
diff --git a/libspeex/kiss_fftr.c b/libspeex/kiss_fftr.c
index f6275b8..827e0b1 100644
--- a/libspeex/kiss_fftr.c
+++ b/libspeex/kiss_fftr.c
@@ -24,9 +24,9 @@ struct kiss_fftr_state{
kiss_fft_cfg substate;
kiss_fft_cpx * tmpbuf;
kiss_fft_cpx * super_twiddles;
-#ifdef USE_SIMD
+#ifdef USE_SIMD
long pad;
-#endif
+#endif
};
kiss_fftr_cfg kiss_fftr_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem)
@@ -96,12 +96,12 @@ void kiss_fftr(kiss_fftr_cfg st,const kiss_fft_scalar *timedata,kiss_fft_cpx *fr
* contains the sum of the even-numbered elements of the input time sequence
* The imag part is the sum of the odd-numbered elements
*
- * The sum of tdc.r and tdc.i is the sum of the input time sequence.
+ * The sum of tdc.r and tdc.i is the sum of the input time sequence.
* yielding DC of input time sequence
- * The difference of tdc.r - tdc.i is the sum of the input (dot product) [1,-1,1,-1...
+ * The difference of tdc.r - tdc.i is the sum of the input (dot product) [1,-1,1,-1...
* yielding Nyquist bin of input time sequence
*/
-
+
tdc.r = st->tmpbuf[0].r;
tdc.i = st->tmpbuf[0].i;
C_FIXDIV(tdc,2);
@@ -109,14 +109,14 @@ void kiss_fftr(kiss_fftr_cfg st,const kiss_fft_scalar *timedata,kiss_fft_cpx *fr
CHECK_OVERFLOW_OP(tdc.r ,-, tdc.i);
freqdata[0].r = tdc.r + tdc.i;
freqdata[ncfft].r = tdc.r - tdc.i;
-#ifdef USE_SIMD
+#ifdef USE_SIMD
freqdata[ncfft].i = freqdata[0].i = _mm_set1_ps(0);
#else
freqdata[ncfft].i = freqdata[0].i = 0;
#endif
for ( k=1;k <= ncfft/2 ; ++k ) {
- fpk = st->tmpbuf[k];
+ fpk = st->tmpbuf[k];
fpnk.r = st->tmpbuf[ncfft-k].r;
fpnk.i = - st->tmpbuf[ncfft-k].i;
C_FIXDIV(fpk,2);
@@ -161,7 +161,7 @@ void kiss_fftri(kiss_fftr_cfg st,const kiss_fft_cpx *freqdata, kiss_fft_scalar *
C_MUL (fok, tmp, st->super_twiddles[k]);
C_ADD (st->tmpbuf[k], fek, fok);
C_SUB (st->tmpbuf[ncfft - k], fek, fok);
-#ifdef USE_SIMD
+#ifdef USE_SIMD
st->tmpbuf[ncfft - k].i *= _mm_set1_ps(-1.0);
#else
st->tmpbuf[ncfft - k].i *= -1;
@@ -189,12 +189,12 @@ void kiss_fftr2(kiss_fftr_cfg st,const kiss_fft_scalar *timedata,kiss_fft_scalar
* contains the sum of the even-numbered elements of the input time sequence
* The imag part is the sum of the odd-numbered elements
*
- * The sum of tdc.r and tdc.i is the sum of the input time sequence.
+ * The sum of tdc.r and tdc.i is the sum of the input time sequence.
* yielding DC of input time sequence
- * The difference of tdc.r - tdc.i is the sum of the input (dot product) [1,-1,1,-1...
+ * The difference of tdc.r - tdc.i is the sum of the input (dot product) [1,-1,1,-1...
* yielding Nyquist bin of input time sequence
*/
-
+
tdc.r = st->tmpbuf[0].r;
tdc.i = st->tmpbuf[0].i;
C_FIXDIV(tdc,2);
@@ -205,7 +205,7 @@ void kiss_fftr2(kiss_fftr_cfg st,const kiss_fft_scalar *timedata,kiss_fft_scalar
for ( k=1;k <= ncfft/2 ; ++k )
{
- /*fpk = st->tmpbuf[k];
+ /*fpk = st->tmpbuf[k];
fpnk.r = st->tmpbuf[ncfft-k].r;
fpnk.i = - st->tmpbuf[ncfft-k].i;
C_FIXDIV(fpk,2);
@@ -213,7 +213,7 @@ void kiss_fftr2(kiss_fftr_cfg st,const kiss_fft_scalar *timedata,kiss_fft_scalar
C_ADD( f1k, fpk , fpnk );
C_SUB( f2k, fpk , fpnk );
-
+
C_MUL( tw , f2k , st->super_twiddles[k]);
freqdata[2*k-1] = HALF_OF(f1k.r + tw.r);
@@ -226,7 +226,7 @@ void kiss_fftr2(kiss_fftr_cfg st,const kiss_fft_scalar *timedata,kiss_fft_scalar
f1k.i = PSHR32(SUB32(EXTEND32(st->tmpbuf[k].i), EXTEND32(st->tmpbuf[ncfft-k].i)),1);
f2k.r = PSHR32(SUB32(EXTEND32(st->tmpbuf[k].r), EXTEND32(st->tmpbuf[ncfft-k].r)),1);
f2k.i = SHR32(ADD32(EXTEND32(st->tmpbuf[k].i), EXTEND32(st->tmpbuf[ncfft-k].i)),1);
-
+
C_MUL( tw , f2k , st->super_twiddles[k]);
freqdata[2*k-1] = HALF_OF(f1k.r + tw.r);
@@ -236,13 +236,13 @@ void kiss_fftr2(kiss_fftr_cfg st,const kiss_fft_scalar *timedata,kiss_fft_scalar
*/
f2k.r = SHR32(SUB32(EXTEND32(st->tmpbuf[k].r), EXTEND32(st->tmpbuf[ncfft-k].r)),1);
f2k.i = PSHR32(ADD32(EXTEND32(st->tmpbuf[k].i), EXTEND32(st->tmpbuf[ncfft-k].i)),1);
-
+
f1kr = SHL32(ADD32(EXTEND32(st->tmpbuf[k].r), EXTEND32(st->tmpbuf[ncfft-k].r)),13);
f1ki = SHL32(SUB32(EXTEND32(st->tmpbuf[k].i), EXTEND32(st->tmpbuf[ncfft-k].i)),13);
-
+
twr = SHR32(SUB32(MULT16_16(f2k.r,st->super_twiddles[k].r),MULT16_16(f2k.i,st->super_twiddles[k].i)), 1);
twi = SHR32(ADD32(MULT16_16(f2k.i,st->super_twiddles[k].r),MULT16_16(f2k.r,st->super_twiddles[k].i)), 1);
-
+
#ifdef FIXED_POINT
freqdata[2*k-1] = PSHR32(f1kr + twr, 15);
freqdata[2*k] = PSHR32(f1ki + twi, 15);
@@ -253,7 +253,7 @@ void kiss_fftr2(kiss_fftr_cfg st,const kiss_fft_scalar *timedata,kiss_fft_scalar
freqdata[2*k] = .5f*(f1ki + twi);
freqdata[2*(ncfft-k)-1] = .5f*(f1kr - twr);
freqdata[2*(ncfft-k)] = .5f*(twi - f1ki);
-
+
#endif
}
}
@@ -287,7 +287,7 @@ void kiss_fftri2(kiss_fftr_cfg st,const kiss_fft_scalar *freqdata,kiss_fft_scala
C_MUL (fok, tmp, st->super_twiddles[k]);
C_ADD (st->tmpbuf[k], fek, fok);
C_SUB (st->tmpbuf[ncfft - k], fek, fok);
-#ifdef USE_SIMD
+#ifdef USE_SIMD
st->tmpbuf[ncfft - k].i *= _mm_set1_ps(-1.0);
#else
st->tmpbuf[ncfft - k].i *= -1;
diff --git a/libspeex/lpc.c b/libspeex/lpc.c
index 141fd9d..fca4d9e 100644
--- a/libspeex/lpc.c
+++ b/libspeex/lpc.c
@@ -24,18 +24,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
@@ -78,7 +78,7 @@ const spx_word16_t *ac, /* in: [0...p] autocorrelation values */
int p
)
{
- int i, j;
+ int i, j;
spx_word16_t r;
spx_word16_t error = ac[0];
@@ -86,7 +86,7 @@ int p
/* Sum up this iteration's reflection coefficient */
spx_word32_t rr = NEG32(SHL32(EXTEND32(ac[i + 1]),13));
- for (j = 0; j < i; j++)
+ for (j = 0; j < i; j++)
rr = SUB32(rr,MULT16_16(lpc[j],ac[i - j]));
#ifdef FIXED_POINT
r = DIV32_16(rr+PSHR32(error,1),ADD16(error,8));
@@ -95,7 +95,7 @@ int p
#endif
/* Update LPC coefficients and total error */
lpc[i] = r;
- for (j = 0; j < (i+1)>>1; j++)
+ for (j = 0; j < (i+1)>>1; j++)
{
spx_word16_t tmp1, tmp2;
/* It could be that j == i-1-j, in which case, we're updating the same value twice, which is OK */
@@ -124,7 +124,7 @@ int p
void _spx_autocorr(
const spx_word16_t *x, /* in: [0...n-1] samples x */
spx_word16_t *ac, /* out: [0...lag-1] ac values */
-int lag,
+int lag,
int n
)
{
@@ -132,7 +132,7 @@ int n
int i, j;
spx_word32_t ac0=1;
int shift, ac_shift;
-
+
for (j=0;j<n;j++)
ac0 = ADD32(ac0,SHR32(MULT16_16(x[j],x[j]),8));
ac0 = ADD32(ac0,n);
@@ -148,8 +148,8 @@ int n
ac_shift--;
ac0 <<= 1;
}
-
-
+
+
for (i=0;i<lag;i++)
{
d=0;
@@ -157,7 +157,7 @@ int n
{
d = ADD32(d,SHR32(MULT16_16(x[j],x[j-i]), shift));
}
-
+
ac[i] = SHR32(d, ac_shift);
}
}
@@ -177,15 +177,15 @@ int n
void _spx_autocorr(
const spx_word16_t *x, /* in: [0...n-1] samples x */
float *ac, /* out: [0...lag-1] ac values */
-int lag,
+int lag,
int n
)
{
float d;
int i;
- while (lag--)
+ while (lag--)
{
- for (i = lag, d = 0; i < n; i++)
+ for (i = lag, d = 0; i < n; i++)
d += x[i] * x[i-lag];
ac[lag] = d;
}
diff --git a/libspeex/lsp.c b/libspeex/lsp.c
index 79ae369..77254d4 100644
--- a/libspeex/lsp.c
+++ b/libspeex/lsp.c
@@ -4,7 +4,7 @@ Original copyright
AUTHOR......: David Rowe
DATE CREATED: 24/2/93
-Heavily modified by Jean-Marc Valin (c) 2002-2006 (fixed-point,
+Heavily modified by Jean-Marc Valin (c) 2002-2006 (fixed-point,
optimizations, additional functions, ...)
This file contains functions for converting Linear Prediction
@@ -17,18 +17,18 @@ Heavily modified by Jean-Marc Valin (c) 2002-2006 (fixed-point,
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
@@ -168,7 +168,7 @@ static inline spx_word32_t cheb_poly_eva(
b1 = tmp;
sum = ADD32(sum, EXTEND32(MULT16_16_P14(coef[m-i],b0)));
}
-
+
return sum;
}
#endif
@@ -417,14 +417,14 @@ void lsp_to_lpc(const spx_lsp_t *freq,spx_coef_t *ak,int lpcrdr, char *stack)
VARDECL(spx_word32_t *xqmem);
int m = lpcrdr>>1;
- /*
-
+ /*
+
Reconstruct P(z) and Q(z) by cascading second order polynomials
in form 1 - 2cos(w)z(-1) + z(-2), where w is the LSP frequency.
In the time domain this is:
y(n) = x(n) - 2cos(w)x(n-1) + x(n-2)
-
+
This is what the ALLOCS below are trying to do:
int xp[m+1][lpcrdr+1+2]; // P matrix in QIMP
@@ -446,7 +446,7 @@ void lsp_to_lpc(const spx_lsp_t *freq,spx_coef_t *ak,int lpcrdr, char *stack)
ALLOC(xq, (m+1), spx_word32_t*);
ALLOC(xqmem, (m+1)*(lpcrdr+1+2), spx_word32_t);
-
+
for(i=0; i<=m; i++) {
xp[i] = xpmem + i*(lpcrdr+1+2);
xq[i] = xqmem + i*(lpcrdr+1+2);
@@ -455,15 +455,15 @@ void lsp_to_lpc(const spx_lsp_t *freq,spx_coef_t *ak,int lpcrdr, char *stack)
/* work out 2cos terms in Q14 */
ALLOC(freqn, lpcrdr, spx_word16_t);
- for (i=0;i<lpcrdr;i++)
+ for (i=0;i<lpcrdr;i++)
freqn[i] = ANGLE2X(freq[i]);
#define QIMP 21 /* scaling for impulse */
xin = SHL32(EXTEND32(1), (QIMP-1)); /* 0.5 in QIMP format */
-
+
/* first col and last non-zero values of each row are trivial */
-
+
for(i=0;i<=m;i++) {
xp[i][1] = 0;
xp[i][2] = xin;
@@ -505,16 +505,16 @@ void lsp_to_lpc(const spx_lsp_t *freq,spx_coef_t *ak,int lpcrdr, char *stack)
int shift = QIMP-13;
/* final filter sections */
- a = PSHR32(xp[m][j+2] + xout1 + xq[m][j+2] - xout2, shift);
+ a = PSHR32(xp[m][j+2] + xout1 + xq[m][j+2] - xout2, shift);
xout1 = xp[m][j+2];
xout2 = xq[m][j+2];
-
+
/* hard limit ak's to +/- 32767 */
if (a < -32767) a = -32767;
if (a > 32767) a = 32767;
ak[j-1] = (short)a;
-
+
}
}
diff --git a/libspeex/lsp_tables_nb.c b/libspeex/lsp_tables_nb.c
index 16f2e1b..8015b9a 100644
--- a/libspeex/lsp_tables_nb.c
+++ b/libspeex/lsp_tables_nb.c
@@ -1,13 +1,13 @@
-/* Copyright (C) 2002 Jean-Marc Valin
+/* Copyright (C) 2002 Jean-Marc Valin
File: lsp_tables_nb.c
Codebooks for LSPs in narrowband CELP mode
-
+
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
+ this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
diff --git a/libspeex/ltp.c b/libspeex/ltp.c
index e9e6c5a..347a9db 100644
--- a/libspeex/ltp.c
+++ b/libspeex/ltp.c
@@ -1,22 +1,22 @@
-/* Copyright (C) 2002-2006 Jean-Marc Valin
+/* Copyright (C) 2002-2006 Jean-Marc Valin
File: ltp.c
Long-Term Prediction functions
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
@@ -126,7 +126,7 @@ static void pitch_xcorr(const spx_word16_t *_x, const spx_word16_t *_y, spx_word
part4 = MAC16_16(part4,*x,y2);
x++;
y3=*y++;
-
+
sum1 = ADD32(sum1,SHR32(part1,6));
sum2 = ADD32(sum2,SHR32(part2,6));
sum3 = ADD32(sum3,SHR32(part3,6));
@@ -179,7 +179,7 @@ void open_loop_nbest_pitch(spx_word16_t *sw, int start, int end, int len, int *p
spx_word32_t e0;
VARDECL(spx_word32_t *corr);
#ifdef FIXED_POINT
- /* In fixed-point, we need only one (temporary) array of 32-bit values and two (corr16, ener16)
+ /* In fixed-point, we need only one (temporary) array of 32-bit values and two (corr16, ener16)
arrays for (normalized) 16-bit values */
VARDECL(spx_word16_t *corr16);
VARDECL(spx_word16_t *ener16);
@@ -200,7 +200,7 @@ void open_loop_nbest_pitch(spx_word16_t *sw, int start, int end, int len, int *p
corr16 = corr;
ener16 = energy;
#endif
-
+
ALLOC(best_score, N, spx_word32_t);
ALLOC(best_ener, N, spx_word32_t);
for (i=0;i<N;i++)
@@ -209,7 +209,7 @@ void open_loop_nbest_pitch(spx_word16_t *sw, int start, int end, int len, int *p
best_ener[i]=0;
pitch[i]=start;
}
-
+
#ifdef FIXED_POINT
for (i=-end;i<len;i++)
{
@@ -226,7 +226,7 @@ void open_loop_nbest_pitch(spx_word16_t *sw, int start, int end, int len, int *p
{
sw[i]=SHR16(sw[i],1);
}
- }
+ }
#endif
energy[0]=inner_prod(sw-start, sw-start, len);
e0=inner_prod(sw, sw, len);
@@ -237,14 +237,14 @@ void open_loop_nbest_pitch(spx_word16_t *sw, int start, int end, int len, int *p
if (energy[i-start+1] < 0)
energy[i-start+1] = 0;
}
-
+
#ifdef FIXED_POINT
eshift = normalize16(energy, ener16, 32766, end-start+1);
#endif
-
+
/* In fixed-point, this actually overrites the energy array (aliased to corr) */
pitch_xcorr(sw, sw-end, corr, len, end-start+1, stack);
-
+
#ifdef FIXED_POINT
/* Normalize to 180 so we can square it and it still fits in 16 bits */
cshift = normalize16(corr, corr16, 180, end-start+1);
@@ -255,7 +255,7 @@ void open_loop_nbest_pitch(spx_word16_t *sw, int start, int end, int len, int *p
{
sw[i]=SHL16(sw[i],1);
}
- }
+ }
#endif
/* Search for the best pitch prediction gain */
@@ -288,7 +288,7 @@ void open_loop_nbest_pitch(spx_word16_t *sw, int start, int end, int len, int *p
}
}
}
-
+
/* Compute open-loop gain if necessary */
if (gain)
{
@@ -326,15 +326,15 @@ static int pitch_gain_search_3tap_vq(
int i;
for (i=0;i<gain_cdbk_size;i++) {
-
+
ptr = gain_cdbk+4*i;
g[0]=ADD16((spx_word16_t)ptr[0],32);
g[1]=ADD16((spx_word16_t)ptr[1],32);
g[2]=ADD16((spx_word16_t)ptr[2],32);
gain_sum = (spx_word16_t)ptr[3];
-
+
sum = compute_pitch_error(C16, g, pitch_control);
-
+
if (sum>best_sum && gain_sum<=max_gain) {
best_sum=sum;
best_cdbk=i;
@@ -384,11 +384,11 @@ int scaledown
if (cumul_gain > 262144)
max_gain = 31;
-
+
x[0]=tmp1;
x[1]=tmp1+nsf;
x[2]=tmp1+2*nsf;
-
+
for (j=0;j<nsf;j++)
new_target[j] = target[j];
@@ -453,17 +453,17 @@ int scaledown
spx_word16_t C16[9];
#else
spx_word16_t *C16=C;
-#endif
+#endif
C[0]=corr[2];
C[1]=corr[1];
C[2]=corr[0];
C[3]=A[1][2];
C[4]=A[0][1];
- C[5]=A[0][2];
+ C[5]=A[0][2];
C[6]=A[2][2];
C[7]=A[1][1];
C[8]=A[0][0];
-
+
/*plc_tuning *= 2;*/
if (plc_tuning<2)
plc_tuning=2;
@@ -565,13 +565,13 @@ spx_word32_t *cumul_gain
const signed char *gain_cdbk;
int gain_cdbk_size;
int scaledown=0;
-
+
VARDECL(int *nbest);
-
+
params = (const ltp_params*) par;
gain_cdbk_size = 1<<params->gain_bits;
gain_cdbk = params->gain_cdbk + 4*gain_cdbk_size*cdbk_offset;
-
+
N=complexity;
if (N>10)
N=10;
@@ -588,7 +588,7 @@ spx_word32_t *cumul_gain
SPEEX_MEMSET(exc, 0, nsf);
return start;
}
-
+
#ifdef FIXED_POINT
/* Check if we need to scale everything down in the pitch search to avoid overflows */
for (i=0;i<nsf;i++)
@@ -614,11 +614,11 @@ spx_word32_t *cumul_gain
open_loop_nbest_pitch(sw, start, end, nsf, nbest, NULL, N, stack);
else
nbest[0] = start;
-
+
ALLOC(best_exc, nsf, spx_sig_t);
ALLOC(new_target, nsf, spx_word16_t);
ALLOC(best_target, nsf, spx_word16_t);
-
+
for (i=0;i<N;i++)
{
pitch=nbest[i];
diff --git a/libspeex/modes.c b/libspeex/modes.c
index 5883a4a..88e431a 100644
--- a/libspeex/modes.c
+++ b/libspeex/modes.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2006 Jean-Marc Valin
+/* Copyright (C) 2002-2006 Jean-Marc Valin
File: modes.c
Describes the different modes of the codec
@@ -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
diff --git a/libspeex/modes_wb.c b/libspeex/modes_wb.c
index cfbcdf6..aef5fdf 100644
--- a/libspeex/modes_wb.c
+++ b/libspeex/modes_wb.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2007 Jean-Marc Valin
+/* Copyright (C) 2002-2007 Jean-Marc Valin
File: modes.c
Describes the wideband modes of the codec
@@ -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
diff --git a/libspeex/nb_celp.c b/libspeex/nb_celp.c
index 3b050aa..3956cb6 100644
--- a/libspeex/nb_celp.c
+++ b/libspeex/nb_celp.c
@@ -1,21 +1,21 @@
-/* Copyright (C) 2002-2006 Jean-Marc Valin
+/* Copyright (C) 2002-2006 Jean-Marc Valin
File: nb_celp.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
@@ -119,13 +119,13 @@ void *nb_encoder_init(const SpeexMode *m)
#else
st->stack = (char*)speex_alloc_scratch(NB_ENC_STACK);
#endif
-
+
st->mode=m;
st->gamma1=mode->gamma1;
st->gamma2=mode->gamma2;
st->lpc_floor = mode->lpc_floor;
-
+
st->submodes=mode->submodes;
st->submodeID=st->submodeSelect=mode->defaultSubmode;
st->bounded_pitch = 1;
@@ -142,7 +142,7 @@ void *nb_encoder_init(const SpeexMode *m)
st->cumul_gain = 1024;
st->window= lpc_window;
-
+
/* Create the window for autocorrelation (lag-windowing) */
st->lagWindow = lag_window;
@@ -151,7 +151,7 @@ void *nb_encoder_init(const SpeexMode *m)
st->old_lsp[i]= DIV32(MULT16_16(QCONST16(3.1415927f, LSP_SHIFT), i+1), NB_ORDER+1);
st->innov_rms_save = NULL;
-
+
#ifndef DISABLE_VBR
vbr_init(&st->vbr);
st->vbr_quality = 8;
@@ -170,7 +170,7 @@ void *nb_encoder_init(const SpeexMode *m)
st->sampling_rate=8000;
st->isWideband = 0;
st->highpass_enabled = 1;
-
+
#ifdef ENABLE_VALGRIND
VALGRIND_MAKE_READABLE(st, NB_ENC_STACK);
#endif
@@ -204,7 +204,7 @@ void nb_encoder_destroy(void *state)
int nb_encoder_ctl(void *state, int request, void *ptr)
{
EncState *st;
- st=(EncState*)state;
+ st=(EncState*)state;
switch(request)
{
case SPEEX_GET_FRAME_SIZE:
@@ -240,7 +240,7 @@ int nb_encoder_ctl(void *state, int request, void *ptr)
case SPEEX_SET_ABR:
st->abr_enabled = (*(spx_int32_t*)ptr);
st->vbr_enabled = st->abr_enabled!=0;
- if (st->vbr_enabled)
+ if (st->vbr_enabled)
{
spx_int32_t i=10;
spx_int32_t rate, target;
@@ -262,7 +262,7 @@ int nb_encoder_ctl(void *state, int request, void *ptr)
st->abr_drift=0;
st->abr_drift2=0;
}
-
+
break;
case SPEEX_GET_ABR:
(*(spx_int32_t*)ptr) = st->abr_enabled;
@@ -428,7 +428,7 @@ int nb_encode(void *state, void *vin, SpeexBits *bits)
VARDECL(spx_coef_t *interp_qlpc);
char *stack;
VARDECL(spx_word16_t *syn_resp);
-
+
spx_word32_t ener=0;
spx_word16_t fine_gain;
spx_word16_t *in = (spx_word16_t*)vin;
@@ -454,7 +454,7 @@ int nb_encode(void *state, void *vin, SpeexBits *bits)
if (st->highpass_enabled)
highpass(in, in, NB_FRAME_SIZE, (st->isWideband?HIGHPASS_WIDEBAND:HIGHPASS_NARROWBAND)|HIGHPASS_INPUT, st->mem_hp);
-
+
{
VARDECL(spx_word16_t *w_sig);
VARDECL(spx_word16_t *autocorr);
@@ -506,7 +506,7 @@ int nb_encode(void *state, void *vin, SpeexBits *bits)
/*Open-loop pitch*/
- if (!st->submodes[st->submodeID] || (st->complexity>2 && SUBMODE(have_subframe_gain)<3) || SUBMODE(forced_pitch_gain) || SUBMODE(lbr_pitch) != -1
+ if (!st->submodes[st->submodeID] || (st->complexity>2 && SUBMODE(have_subframe_gain)<3) || SUBMODE(forced_pitch_gain) || SUBMODE(lbr_pitch) != -1
#ifndef DISABLE_VBR
|| st->vbr_enabled || st->vad_enabled
#endif
@@ -514,7 +514,7 @@ int nb_encode(void *state, void *vin, SpeexBits *bits)
{
int nol_pitch[6];
spx_word16_t nol_pitch_coef[6];
-
+
bw_lpc(0.9, interp_lpc, bw_lpc1, NB_ORDER);
bw_lpc(0.55, interp_lpc, bw_lpc2, NB_ORDER);
@@ -522,7 +522,7 @@ int nb_encode(void *state, void *vin, SpeexBits *bits)
SPEEX_COPY(st->sw+diff, in, NB_FRAME_SIZE-diff);
filter10(st->sw, bw_lpc1, bw_lpc2, st->sw, NB_FRAME_SIZE, st->mem_sw_whole, stack);
- open_loop_nbest_pitch(st->sw, NB_PITCH_START, NB_PITCH_END, NB_FRAME_SIZE,
+ open_loop_nbest_pitch(st->sw, NB_PITCH_START, NB_PITCH_END, NB_FRAME_SIZE,
nol_pitch, nol_pitch_coef, 6, stack);
ol_pitch=nol_pitch[0];
ol_pitch_coef = nol_pitch_coef[0];
@@ -530,11 +530,11 @@ int nb_encode(void *state, void *vin, SpeexBits *bits)
for (i=1;i<6;i++)
{
#ifdef FIXED_POINT
- if ((nol_pitch_coef[i]>MULT16_16_Q15(nol_pitch_coef[0],27853)) &&
+ if ((nol_pitch_coef[i]>MULT16_16_Q15(nol_pitch_coef[0],27853)) &&
#else
- if ((nol_pitch_coef[i]>.85*nol_pitch_coef[0]) &&
+ if ((nol_pitch_coef[i]>.85*nol_pitch_coef[0]) &&
#endif
- (ABS(2*nol_pitch[i]-ol_pitch)<=2 || ABS(3*nol_pitch[i]-ol_pitch)<=3 ||
+ (ABS(2*nol_pitch[i]-ol_pitch)<=2 || ABS(3*nol_pitch[i]-ol_pitch)<=3 ||
ABS(4*nol_pitch[i]-ol_pitch)<=4 || ABS(5*nol_pitch[i]-ol_pitch)<=5))
{
/*ol_pitch_coef=nol_pitch_coef[i];*/
@@ -549,7 +549,7 @@ int nb_encode(void *state, void *vin, SpeexBits *bits)
ol_pitch=0;
ol_pitch_coef=0;
}
-
+
/*Compute "real" excitation*/
/*SPEEX_COPY(st->exc, st->winBuf, diff);
SPEEX_COPY(st->exc+diff, in, NB_FRAME_SIZE-diff);*/
@@ -584,7 +584,7 @@ int nb_encode(void *state, void *vin, SpeexBits *bits)
for (i=0;i<NB_ORDER;i++)
lsp_dist += (st->old_lsp[i] - lsp[i])*(st->old_lsp[i] - lsp[i]);
lsp_dist /= LSP_SCALING*LSP_SCALING;
-
+
if (st->abr_enabled)
{
float qual_change=0;
@@ -607,7 +607,7 @@ int nb_encode(void *state, void *vin, SpeexBits *bits)
st->relative_quality = vbr_analysis(&st->vbr, in, NB_FRAME_SIZE, ol_pitch, GAIN_SCALING_1*ol_pitch_coef);
/*if (delta_qual<0)*/
/* delta_qual*=.1*(3+st->vbr_quality);*/
- if (st->vbr_enabled)
+ if (st->vbr_enabled)
{
spx_int32_t mode;
int choice=0;
@@ -622,7 +622,7 @@ int nb_encode(void *state, void *vin, SpeexBits *bits)
thresh = vbr_nb_thresh[mode][v1];
else
thresh = (st->vbr_quality-v1)*vbr_nb_thresh[mode][v1+1] + (1+v1-st->vbr_quality)*vbr_nb_thresh[mode][v1];
- if (st->relative_quality > thresh &&
+ if (st->relative_quality > thresh &&
st->relative_quality-thresh<min_diff)
{
choice = mode;
@@ -656,7 +656,7 @@ int nb_encode(void *state, void *vin, SpeexBits *bits)
speex_encoder_ctl(state, SPEEX_SET_BITRATE, &rate);
}
}
-
+
if (st->abr_enabled)
{
spx_int32_t bitrate;
@@ -685,7 +685,7 @@ int nb_encode(void *state, void *vin, SpeexBits *bits)
}
/*speex_encoder_ctl(state, SPEEX_SET_MODE, &mode);*/
st->submodeID=mode;
- }
+ }
} else {
st->relative_quality = -1;
}
@@ -741,7 +741,7 @@ int nb_encode(void *state, void *vin, SpeexBits *bits)
if (SUBMODE(lbr_pitch)!=-1)
{
speex_bits_pack(bits, ol_pitch-NB_PITCH_START, 7);
- }
+ }
if (SUBMODE(forced_pitch_gain))
{
@@ -760,8 +760,8 @@ int nb_encode(void *state, void *vin, SpeexBits *bits)
speex_bits_pack(bits, quant, 4);
ol_pitch_coef=MULT16_16_P15(QCONST16(0.066667,15),SHL16(quant,GAIN_SHIFT));
}
-
-
+
+
/*Quantize and transmit open-loop excitation gain*/
#ifdef FIXED_POINT
{
@@ -813,7 +813,7 @@ int nb_encode(void *state, void *vin, SpeexBits *bits)
exc=st->exc+offset;
/* Weighted signal */
sw=st->sw+offset;
-
+
/* LSP interpolation (quantized and unquantized) */
lsp_interpolate(st->old_lsp, lsp, interp_lsp, NB_ORDER, sub, NB_NB_SUBFRAMES, LSP_MARGIN);
lsp_interpolate(st->old_qlsp, qlsp, interp_qlsp, NB_ORDER, sub, NB_NB_SUBFRAMES, LSP_MARGIN);
@@ -857,13 +857,13 @@ int nb_encode(void *state, void *vin, SpeexBits *bits)
inBuf = &in[((sub-1)*NB_SUBFRAME_SIZE)];
for (i=0;i<NB_SUBFRAME_SIZE;i++)
sw[i] = inBuf[i];
-
+
if (st->complexity==0)
response_bound >>= 1;
compute_impulse_response(interp_qlpc, bw_lpc1, bw_lpc2, syn_resp, response_bound, NB_ORDER, stack);
for (i=response_bound;i<NB_SUBFRAME_SIZE;i++)
syn_resp[i]=VERY_SMALL;
-
+
/* Compute zero response of A(z/g1) / ( A(z/g2) * A(z) ) */
for (i=0;i<NB_ORDER;i++)
mem[i]=SHL32(st->mem_sp[i],1);
@@ -881,16 +881,16 @@ int nb_encode(void *state, void *vin, SpeexBits *bits)
mem[i]=SHL32(st->mem_sw[i],1);
filter10(exc, bw_lpc1, bw_lpc2, exc, NB_SUBFRAME_SIZE, mem, stack);
#endif
-
+
/* Compute weighted signal */
for (i=0;i<NB_ORDER;i++)
mem[i]=st->mem_sw[i];
filter10(sw, bw_lpc1, bw_lpc2, sw, NB_SUBFRAME_SIZE, mem, stack);
-
+
if (st->complexity==0)
for (i=0;i<NB_ORDER;i++)
st->mem_sw[i]=mem[i];
-
+
/* Compute target signal (saturation prevents overflows on clipped input speech) */
for (i=0;i<NB_SUBFRAME_SIZE;i++)
target[i]=EXTRACT16(SATURATE(SUB32(sw[i],PSHR32(exc[i],1)),32767));
@@ -923,7 +923,7 @@ int nb_encode(void *state, void *vin, SpeexBits *bits)
pit_min = NB_PITCH_START;
pit_max = NB_PITCH_END;
}
-
+
/* Force pitch to use only the current frame if needed */
if (st->bounded_pitch && pit_max>offset)
pit_max=offset;
@@ -931,20 +931,20 @@ int nb_encode(void *state, void *vin, SpeexBits *bits)
/* Perform pitch search */
pitch = SUBMODE(ltp_quant)(target, sw, interp_qlpc, bw_lpc1, bw_lpc2,
exc32, SUBMODE(ltp_params), pit_min, pit_max, ol_pitch_coef,
- NB_ORDER, NB_SUBFRAME_SIZE, bits, stack,
+ NB_ORDER, NB_SUBFRAME_SIZE, bits, stack,
exc, syn_resp, st->complexity, 0, st->plc_tuning, &st->cumul_gain);
st->pitch[sub]=pitch;
}
/* Quantization of innovation */
SPEEX_MEMSET(innov, 0, NB_SUBFRAME_SIZE);
-
+
/* FIXME: Make sure this is safe from overflows (so far so good) */
for (i=0;i<NB_SUBFRAME_SIZE;i++)
exc[i] = EXTRACT16(SUB32(EXTEND32(exc[i]), PSHR32(exc32[i],SIG_SHIFT-1)));
-
+
ener = SHL32(EXTEND32(compute_rms16(exc, NB_SUBFRAME_SIZE)),SIG_SHIFT);
-
+
/*FIXME: Should use DIV32_16 and make sure result fits in 16 bits */
#ifdef FIXED_POINT
{
@@ -958,7 +958,7 @@ int nb_encode(void *state, void *vin, SpeexBits *bits)
fine_gain = PDIV32_16(ener,PSHR32(ol_gain,SIG_SHIFT));
#endif
/* Calculate gain correction for the sub-frame (if any) */
- if (SUBMODE(have_subframe_gain))
+ if (SUBMODE(have_subframe_gain))
{
int qe;
if (SUBMODE(have_subframe_gain)==3)
@@ -974,23 +974,23 @@ int nb_encode(void *state, void *vin, SpeexBits *bits)
} else {
ener=ol_gain;
}
-
+
/*printf ("%f %f\n", ener, ol_gain);*/
-
+
/* Normalize innovation */
signal_div(target, target, ener, NB_SUBFRAME_SIZE);
-
+
/* Quantize innovation */
speex_assert (SUBMODE(innovation_quant));
{
/* Codebook search */
- SUBMODE(innovation_quant)(target, interp_qlpc, bw_lpc1, bw_lpc2,
- SUBMODE(innovation_params), NB_ORDER, NB_SUBFRAME_SIZE,
+ SUBMODE(innovation_quant)(target, interp_qlpc, bw_lpc1, bw_lpc2,
+ SUBMODE(innovation_params), NB_ORDER, NB_SUBFRAME_SIZE,
innov, syn_resp, bits, stack, st->complexity, SUBMODE(double_codebook));
-
+
/* De-normalize innovation and update excitation */
signal_mul(innov, innov, ener, NB_SUBFRAME_SIZE);
-
+
/* In some (rare) modes, we do a second search (more bits) to reduce noise even more */
if (SUBMODE(double_codebook)) {
char *tmp_stack=stack;
@@ -999,8 +999,8 @@ int nb_encode(void *state, void *vin, SpeexBits *bits)
SPEEX_MEMSET(innov2, 0, NB_SUBFRAME_SIZE);
for (i=0;i<NB_SUBFRAME_SIZE;i++)
target[i]=MULT16_16_P13(QCONST16(2.2f,13), target[i]);
- SUBMODE(innovation_quant)(target, interp_qlpc, bw_lpc1, bw_lpc2,
- SUBMODE(innovation_params), NB_ORDER, NB_SUBFRAME_SIZE,
+ SUBMODE(innovation_quant)(target, interp_qlpc, bw_lpc1, bw_lpc2,
+ SUBMODE(innovation_params), NB_ORDER, NB_SUBFRAME_SIZE,
innov2, syn_resp, bits, stack, st->complexity, 0);
signal_mul(innov2, innov2, MULT16_32_Q15(QCONST16(0.454545f,15),ener), NB_SUBFRAME_SIZE);
for (i=0;i<NB_SUBFRAME_SIZE;i++)
@@ -1019,7 +1019,7 @@ int nb_encode(void *state, void *vin, SpeexBits *bits)
/* Compute weighted signal again, from synthesized speech (not sure it's the right thing) */
if (st->complexity!=0)
filter10(sw, bw_lpc1, bw_lpc2, sw, NB_SUBFRAME_SIZE, st->mem_sw, stack);
-
+
}
/* Store the LSPs for interpolation in the next frame */
@@ -1097,7 +1097,7 @@ void *nb_decoder_init(const SpeexMode *m)
st->pitch_gain_buf[0] = st->pitch_gain_buf[1] = st->pitch_gain_buf[2] = 0;
st->pitch_gain_buf_idx = 0;
st->seed = 1000;
-
+
st->sampling_rate=8000;
st->last_ol_gain = 0;
@@ -1122,7 +1122,7 @@ void nb_decoder_destroy(void *state)
{
DecState *st;
st=(DecState*)state;
-
+
#if !(defined(VAR_ARRAYS) || defined (USE_ALLOCA))
speex_free_scratch(st->stack);
#endif
@@ -1285,13 +1285,13 @@ static void nb_decode_lost(DecState *st, spx_word16_t *out, char *stack)
gain_med = median3(st->pitch_gain_buf[0], st->pitch_gain_buf[1], st->pitch_gain_buf[2]);
if (gain_med < st->last_pitch_gain)
st->last_pitch_gain = gain_med;
-
+
#ifdef FIXED_POINT
pitch_gain = st->last_pitch_gain;
if (pitch_gain>54)
pitch_gain = 54;
pitch_gain = SHL16(pitch_gain, 9);
-#else
+#else
pitch_gain = GAIN_SCALING_1*st->last_pitch_gain;
if (pitch_gain>.85)
pitch_gain=.85;
@@ -1302,7 +1302,7 @@ static void nb_decode_lost(DecState *st, spx_word16_t *out, char *stack)
noise_gain = MULT16_16_Q15(innov_gain, MULT16_16_Q15(fact, SUB16(Q15ONE,MULT16_16_Q15(pitch_gain,pitch_gain))));
/* Shift all buffers by one frame */
SPEEX_MOVE(st->excBuf, st->excBuf+NB_FRAME_SIZE, 2*NB_PITCH_END + NB_SUBFRAME_SIZE + 12);
-
+
pitch_val = st->last_pitch + SHR32((spx_int32_t)speex_rand(1+st->count_lost, &st->seed),SIG_SHIFT);
if (pitch_val > NB_PITCH_END)
@@ -1311,7 +1311,7 @@ static void nb_decode_lost(DecState *st, spx_word16_t *out, char *stack)
pitch_val = NB_PITCH_START;
for (i=0;i<NB_FRAME_SIZE;i++)
{
- st->exc[i]= MULT16_16_Q15(pitch_gain, (st->exc[i-pitch_val]+VERY_SMALL)) +
+ st->exc[i]= MULT16_16_Q15(pitch_gain, (st->exc[i-pitch_val]+VERY_SMALL)) +
speex_rand(noise_gain, &st->seed);
}
@@ -1319,7 +1319,7 @@ static void nb_decode_lost(DecState *st, spx_word16_t *out, char *stack)
iir_mem16(&st->exc[-NB_SUBFRAME_SIZE], st->interp_qlpc, out, NB_FRAME_SIZE,
NB_ORDER, st->mem_sp, stack);
highpass(out, out, NB_FRAME_SIZE, HIGHPASS_NARROWBAND|HIGHPASS_OUTPUT, st->mem_hp);
-
+
st->first = 0;
st->count_lost++;
st->pitch_gain_buf[st->pitch_gain_buf_idx++] = PSHR16(pitch_gain,9);
@@ -1329,7 +1329,7 @@ static void nb_decode_lost(DecState *st, spx_word16_t *out, char *stack)
/* Just so we don't need to carry the complete wideband mode information */
static const int wb_skip_table[8] = {0, 36, 112, 192, 352, 0, 0, 0};
-
+
int nb_decode(void *state, SpeexBits *bits, void *vout)
{
DecState *st;
@@ -1349,7 +1349,7 @@ int nb_decode(void *state, SpeexBits *bits, void *vout)
VARDECL(spx_coef_t *ak);
VARDECL(spx_lsp_t *qlsp);
spx_word16_t pitch_average=0;
-
+
spx_word16_t *out = (spx_word16_t*)vout;
VARDECL(spx_lsp_t *interp_qlsp);
@@ -1362,7 +1362,7 @@ int nb_decode(void *state, SpeexBits *bits, void *vout)
if (!bits && st->dtx_enabled)
{
st->submodeID=0;
- } else
+ } else
{
/* If bits is NULL, consider the packet to be lost (what could we do anyway) */
if (!bits)
@@ -1390,10 +1390,10 @@ int nb_decode(void *state, SpeexBits *bits, void *vout)
{
speex_notify("Invalid mode encountered. The stream is corrupted.");
return -2;
- }
+ }
advance -= (SB_SUBMODE_BITS+1);
speex_bits_advance(bits, advance);
-
+
if (speex_bits_remaining(bits)<5)
return -1;
wideband = speex_bits_unpack_unsigned(bits, 1);
@@ -1406,7 +1406,7 @@ int nb_decode(void *state, SpeexBits *bits, void *vout)
{
speex_notify("Invalid mode encountered. The stream is corrupted.");
return -2;
- }
+ }
advance -= (SB_SUBMODE_BITS+1);
speex_bits_advance(bits, advance);
wideband = speex_bits_unpack_unsigned(bits, 1);
@@ -1440,7 +1440,7 @@ int nb_decode(void *state, SpeexBits *bits, void *vout)
speex_notify("Invalid mode encountered. The stream is corrupted.");
return -2;
}
-
+
} while (m>8);
/* Get the sub-mode that was used */
@@ -1489,7 +1489,7 @@ int nb_decode(void *state, SpeexBits *bits, void *vout)
for (i=0;i<NB_ORDER;i++)
lsp_dist = ADD32(lsp_dist, EXTEND32(ABS(st->old_qlsp[i] - qlsp[i])));
#ifdef FIXED_POINT
- fact = SHR16(19661,SHR32(lsp_dist,LSP_SHIFT+2));
+ fact = SHR16(19661,SHR32(lsp_dist,LSP_SHIFT+2));
#else
fact = .6*exp(-.2*lsp_dist);
#endif
@@ -1509,15 +1509,15 @@ int nb_decode(void *state, SpeexBits *bits, void *vout)
if (SUBMODE(lbr_pitch)!=-1)
{
ol_pitch = NB_PITCH_START+speex_bits_unpack_unsigned(bits, 7);
- }
-
+ }
+
if (SUBMODE(forced_pitch_gain))
{
int quant;
quant = speex_bits_unpack_unsigned(bits, 4);
ol_pitch_coef=MULT16_16_P15(QCONST16(0.066667,15),SHL16(quant,GAIN_SHIFT));
}
-
+
/* Get global excitation gain */
{
int qe;
@@ -1604,20 +1604,20 @@ int nb_decode(void *state, SpeexBits *bits, void *vout)
- SUBMODE(ltp_unquant)(exc, exc32, pit_min, pit_max, ol_pitch_coef, SUBMODE(ltp_params),
- NB_SUBFRAME_SIZE, &pitch, &pitch_gain[0], bits, stack,
+ SUBMODE(ltp_unquant)(exc, exc32, pit_min, pit_max, ol_pitch_coef, SUBMODE(ltp_params),
+ NB_SUBFRAME_SIZE, &pitch, &pitch_gain[0], bits, stack,
st->count_lost, offset, st->last_pitch_gain, 0);
- /* Ensuring that things aren't blowing up as would happen if e.g. an encoder is
+ /* Ensuring that things aren't blowing up as would happen if e.g. an encoder is
crafting packets to make us produce NaNs and slow down the decoder (vague DoS threat).
We can probably be even more aggressive and limit to 15000 or so. */
sanitize_values32(exc32, NEG32(QCONST32(32000,SIG_SHIFT-1)), QCONST32(32000,SIG_SHIFT-1), NB_SUBFRAME_SIZE);
-
+
tmp = gain_3tap_to_1tap(pitch_gain);
pitch_average += tmp;
- if ((tmp>best_pitch_gain&&ABS(2*best_pitch-pitch)>=3&&ABS(3*best_pitch-pitch)>=4&&ABS(4*best_pitch-pitch)>=5)
- || (tmp>MULT16_16_Q15(QCONST16(.6,15),best_pitch_gain)&&(ABS(best_pitch-2*pitch)<3||ABS(best_pitch-3*pitch)<4||ABS(best_pitch-4*pitch)<5))
+ if ((tmp>best_pitch_gain&&ABS(2*best_pitch-pitch)>=3&&ABS(3*best_pitch-pitch)>=4&&ABS(4*best_pitch-pitch)>=5)
+ || (tmp>MULT16_16_Q15(QCONST16(.6,15),best_pitch_gain)&&(ABS(best_pitch-2*pitch)<3||ABS(best_pitch-3*pitch)<4||ABS(best_pitch-4*pitch)<5))
|| (MULT16_16_Q15(QCONST16(.67,15),tmp)>best_pitch_gain&&(ABS(2*best_pitch-pitch)<3||ABS(3*best_pitch-pitch)<4||ABS(4*best_pitch-pitch)<5)) )
{
best_pitch = pitch;
@@ -1625,12 +1625,12 @@ int nb_decode(void *state, SpeexBits *bits, void *vout)
best_pitch_gain = tmp;
}
}
-
+
/* Unquantize the innovation */
{
int q_energy;
spx_word32_t ener;
-
+
SPEEX_MEMSET(innov, 0, NB_SUBFRAME_SIZE);
/* Decode sub-frame gain correction */
@@ -1645,7 +1645,7 @@ int nb_decode(void *state, SpeexBits *bits, void *vout)
} else {
ener = ol_gain;
}
-
+
speex_assert (SUBMODE(innovation_unquant));
{
/*Fixed codebook contribution*/
@@ -1678,7 +1678,7 @@ int nb_decode(void *state, SpeexBits *bits, void *vout)
}
/*Vocoder mode*/
- if (st->submodeID==1)
+ if (st->submodeID==1)
{
spx_word16_t g=ol_pitch_coef;
g=MULT16_16_P14(QCONST16(1.5f,14),(g-QCONST16(.2f,6)));
@@ -1686,7 +1686,7 @@ int nb_decode(void *state, SpeexBits *bits, void *vout)
g=0;
if (g>GAIN_SCALING)
g=GAIN_SCALING;
-
+
SPEEX_MEMSET(exc, 0, NB_SUBFRAME_SIZE);
while (st->voc_offset<NB_SUBFRAME_SIZE)
{
@@ -1697,7 +1697,7 @@ int nb_decode(void *state, SpeexBits *bits, void *vout)
st->voc_offset+=ol_pitch;
}
st->voc_offset -= NB_SUBFRAME_SIZE;
-
+
for (i=0;i<NB_SUBFRAME_SIZE;i++)
{
spx_word16_t exci=exc[i];
@@ -1714,7 +1714,7 @@ int nb_decode(void *state, SpeexBits *bits, void *vout)
}
}
-
+
ALLOC(interp_qlsp, NB_ORDER, spx_lsp_t);
if (st->lpc_enh_enabled && SUBMODE(comb_gain)>0 && !st->count_lost)
@@ -1724,9 +1724,9 @@ int nb_decode(void *state, SpeexBits *bits, void *vout)
} else {
SPEEX_COPY(out, &st->exc[-NB_SUBFRAME_SIZE], NB_FRAME_SIZE);
}
-
+
/* If the last packet was lost, re-scale the excitation to obtain the same energy as encoded in ol_gain */
- if (st->count_lost)
+ if (st->count_lost)
{
spx_word16_t exc_ener;
spx_word32_t gain32;
@@ -1778,10 +1778,10 @@ int nb_decode(void *state, SpeexBits *bits, void *vout)
}
st->pi_gain[sub] = pi_g;
}
-
- iir_mem16(sp, st->interp_qlpc, sp, NB_SUBFRAME_SIZE, NB_ORDER,
+
+ iir_mem16(sp, st->interp_qlpc, sp, NB_SUBFRAME_SIZE, NB_ORDER,
st->mem_sp, stack);
-
+
for (i=0;i<NB_ORDER;i++)
st->interp_qlpc[i] = ak[i];
@@ -1799,7 +1799,7 @@ int nb_decode(void *state, SpeexBits *bits, void *vout)
if (st->max_level < st->min_level+1)
st->max_level = st->min_level+1;
/*printf ("%f %f %f %d\n", og, st->min_level, st->max_level, update);*/
-
+
/* Store the LSPs for interpolation in the next frame */
for (i=0;i<NB_ORDER;i++)
st->old_qlsp[i] = qlsp[i];
@@ -1811,7 +1811,7 @@ int nb_decode(void *state, SpeexBits *bits, void *vout)
#ifdef FIXED_POINT
st->last_pitch_gain = PSHR16(pitch_average,2);
#else
- st->last_pitch_gain = .25*pitch_average;
+ st->last_pitch_gain = .25*pitch_average;
#endif
st->pitch_gain_buf[st->pitch_gain_buf_idx++] = st->last_pitch_gain;
if (st->pitch_gain_buf_idx > 2) /* rollover */
diff --git a/libspeex/quant_lsp.c b/libspeex/quant_lsp.c
index 699716b..0d023ec 100644
--- a/libspeex/quant_lsp.c
+++ b/libspeex/quant_lsp.c
@@ -1,22 +1,22 @@
-/* Copyright (C) 2002 Jean-Marc Valin
+/* Copyright (C) 2002 Jean-Marc Valin
File: quant_lsp.c
LSP vector quantization
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
@@ -111,7 +111,7 @@ static int lsp_quant(spx_word16_t *x, const signed char *cdbk, int nbVec, int nb
{
tmp=SUB16(x[j],SHL16((spx_word16_t)*ptr++,5));
dist=MAC16_16(dist,tmp,tmp);
- }
+ }
if (dist<best_dist)
{
best_dist=dist;
@@ -121,7 +121,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] = SUB16(x[j],SHL16((spx_word16_t)cdbk[best_id*nbDim+j],5));
-
+
return best_id;
}
#endif
@@ -150,7 +150,7 @@ static int lsp_weight_quant(spx_word16_t *x, spx_word16_t *weight, const signed
best_id=i;
}
}
-
+
for (j=0;j<nbDim;j++)
x[j] = SUB16(x[j],SHL16((spx_word16_t)cdbk[best_id*nbDim+j],5));
return best_id;
@@ -162,7 +162,7 @@ void lsp_quant_nb(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits)
int i;
int id;
spx_word16_t quant_weight[10];
-
+
for (i=0;i<order;i++)
qlsp[i]=lsp[i];
@@ -180,7 +180,7 @@ void lsp_quant_nb(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits)
for (i=0;i<order;i++)
qlsp[i]*=2;
-
+
id = lsp_weight_quant(qlsp, quant_weight, cdbk_nb_low1, NB_CDBK_SIZE_LOW1, 5);
speex_bits_pack(bits, id, 6);
@@ -235,7 +235,7 @@ void lsp_unquant_nb(spx_lsp_t *lsp, int order, SpeexBits *bits)
id=speex_bits_unpack_unsigned(bits, 6);
for (i=0;i<5;i++)
lsp[i+5] = ADD32(lsp[i+5], LSP_DIV_512(cdbk_nb_high1[id*5+i]));
-
+
id=speex_bits_unpack_unsigned(bits, 6);
for (i=0;i<5;i++)
lsp[i+5] = ADD32(lsp[i+5], LSP_DIV_1024(cdbk_nb_high2[id*5+i]));
@@ -262,10 +262,10 @@ void lsp_quant_lbr(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits)
#endif
id = lsp_quant(qlsp, cdbk_nb, NB_CDBK_SIZE, order);
speex_bits_pack(bits, id, 6);
-
+
for (i=0;i<order;i++)
qlsp[i]*=2;
-
+
id = lsp_weight_quant(qlsp, quant_weight, cdbk_nb_low1, NB_CDBK_SIZE_LOW1, 5);
speex_bits_pack(bits, id, 6);
@@ -304,7 +304,7 @@ void lsp_unquant_lbr(spx_lsp_t *lsp, int order, SpeexBits *bits)
id=speex_bits_unpack_unsigned(bits, 6);
for (i=0;i<5;i++)
lsp[i+5] += LSP_DIV_512(cdbk_nb_high1[id*5+i]);
-
+
}
#endif /* DISABLE_DECODER */
diff --git a/libspeex/sb_celp.c b/libspeex/sb_celp.c
index 389309b..3aab085 100644
--- a/libspeex/sb_celp.c
+++ b/libspeex/sb_celp.c
@@ -1,21 +1,21 @@
-/* Copyright (C) 2002-2006 Jean-Marc Valin
+/* Copyright (C) 2002-2006 Jean-Marc Valin
File: sb_celp.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
@@ -83,7 +83,7 @@ static const spx_word16_t fold_quant_bound[32] = {
#else
static const spx_word16_t gc_quant_bound[16] = {
- 0.97979, 1.28384, 1.68223, 2.20426, 2.88829, 3.78458, 4.95900, 6.49787,
+ 0.97979, 1.28384, 1.68223, 2.20426, 2.88829, 3.78458, 4.95900, 6.49787,
8.51428, 11.15642, 14.61846, 19.15484, 25.09895, 32.88761, 43.09325, 56.46588};
static const spx_word16_t fold_quant_bound[32] = {
0.30498, 0.34559, 0.39161, 0.44375, 0.50283, 0.56979, 0.64565, 0.73162,
@@ -176,7 +176,7 @@ void *sb_encoder_init(const SpeexMode *m)
st->encode_submode = 1;
st->submodes=mode->submodes;
st->submodeSelect = st->submodeID=mode->defaultSubmode;
-
+
tmp=9;
speex_encoder_ctl(st->st_low, SPEEX_SET_QUALITY, &tmp);
tmp=1;
@@ -201,7 +201,7 @@ void *sb_encoder_init(const SpeexMode *m)
st->pi_gain = (spx_word32_t*)speex_alloc((st->nbSubframes)*sizeof(spx_word32_t));
st->exc_rms = (spx_word16_t*)speex_alloc((st->nbSubframes)*sizeof(spx_word16_t));
st->innov_rms_save = NULL;
-
+
st->mem_sp = (spx_mem_t*)speex_alloc((st->lpcSize)*sizeof(spx_mem_t));
st->mem_sp2 = (spx_mem_t*)speex_alloc((st->lpcSize)*sizeof(spx_mem_t));
st->mem_sw = (spx_mem_t*)speex_alloc((st->lpcSize)*sizeof(spx_mem_t));
@@ -251,7 +251,7 @@ void sb_encoder_destroy(void *state)
speex_free(st->mem_sp2);
speex_free(st->mem_sw);
-
+
speex_free(st);
}
@@ -322,7 +322,7 @@ int sb_encoder_ctl(void *state, int request, void *ptr)
st->abr_enabled = (*(spx_int32_t*)ptr);
st->vbr_enabled = st->abr_enabled!=0;
speex_encoder_ctl(st->st_low, SPEEX_SET_VBR, &st->vbr_enabled);
- if (st->vbr_enabled)
+ if (st->vbr_enabled)
{
spx_int32_t i=10, rate, target;
float vbr_qual;
@@ -343,7 +343,7 @@ int sb_encoder_ctl(void *state, int request, void *ptr)
st->abr_drift=0;
st->abr_drift2=0;
}
-
+
break;
case SPEEX_GET_ABR:
(*(spx_int32_t*)ptr) = st->abr_enabled;
@@ -541,17 +541,17 @@ int sb_encode(void *state, void *vin, SpeexBits *bits)
VARDECL(spx_lsp_t *qlsp);
VARDECL(spx_lsp_t *interp_lsp);
VARDECL(spx_lsp_t *interp_qlsp);
-
+
st = (SBEncState*)state;
stack=st->stack;
mode = (const SpeexSBMode*)(st->mode->mode);
low = in;
high = in+st->frame_size;
-
+
/* High-band buffering / sync with low band */
/* Compute the two sub-bands by filtering with QMF h0*/
qmf_decomp(in, h0, low, high, st->full_frame_size, QMF_ORDER, st->h0_mem, stack);
-
+
#ifndef DISABLE_VBR
if (st->vbr_enabled || st->vad_enabled)
{
@@ -570,13 +570,13 @@ int sb_encode(void *state, void *vin, SpeexBits *bits)
high = high - (st->windowSize-st->frame_size);
SPEEX_COPY(high, st->high, st->windowSize-st->frame_size);
SPEEX_COPY(st->high, &high[st->frame_size], st->windowSize-st->frame_size);
-
+
ALLOC(low_pi_gain, st->nbSubframes, spx_word32_t);
ALLOC(low_exc_rms, st->nbSubframes, spx_word16_t);
speex_encoder_ctl(st->st_low, SPEEX_GET_PI_GAIN, low_pi_gain);
speex_encoder_ctl(st->st_low, SPEEX_GET_EXC, low_exc_rms);
-
+
speex_encoder_ctl(st->st_low, SPEEX_GET_LOW_MODE, &dtx);
if (dtx==0)
@@ -588,12 +588,12 @@ int sb_encode(void *state, void *vin, SpeexBits *bits)
ALLOC(interp_lpc, st->lpcSize, spx_coef_t);
ALLOC(bw_lpc1, st->lpcSize, spx_coef_t);
ALLOC(bw_lpc2, st->lpcSize, spx_coef_t);
-
+
ALLOC(lsp, st->lpcSize, spx_lsp_t);
ALLOC(qlsp, st->lpcSize, spx_lsp_t);
ALLOC(interp_lsp, st->lpcSize, spx_lsp_t);
ALLOC(interp_qlsp, st->lpcSize, spx_lsp_t);
-
+
{
VARDECL(spx_word16_t *autocorr);
VARDECL(spx_word16_t *w_sig);
@@ -661,14 +661,14 @@ int sb_encode(void *state, void *vin, SpeexBits *bits)
ratio = 2*log((1.f+e_high)/(1.f+e_low));
-
+
speex_encoder_ctl(st->st_low, SPEEX_GET_RELATIVE_QUALITY, &st->relative_quality);
if (ratio<-4)
ratio=-4;
if (ratio>2)
ratio=2;
/*if (ratio>-2)*/
- if (st->vbr_enabled)
+ if (st->vbr_enabled)
{
spx_int32_t modeid;
modeid = mode->nb_modes-1;
@@ -683,7 +683,7 @@ int sb_encode(void *state, void *vin, SpeexBits *bits)
if (v1==10)
thresh = mode->vbr_thresh[modeid][v1];
else
- thresh = (st->vbr_quality-v1) * mode->vbr_thresh[modeid][v1+1] +
+ thresh = (st->vbr_quality-v1) * mode->vbr_thresh[modeid][v1+1] +
(1+v1-st->vbr_quality) * mode->vbr_thresh[modeid][v1];
if (st->relative_quality >= thresh && st->sampling_rate*st->submodes[modeid]->bits_per_frame/st->full_frame_size <= st->vbr_max_high)
break;
@@ -744,7 +744,7 @@ int sb_encode(void *state, void *vin, SpeexBits *bits)
/* LSP quantization */
- SUBMODE(lsp_quant)(lsp, qlsp, st->lpcSize, bits);
+ SUBMODE(lsp_quant)(lsp, qlsp, st->lpcSize, bits);
if (st->first)
{
@@ -753,7 +753,7 @@ int sb_encode(void *state, void *vin, SpeexBits *bits)
for (i=0;i<st->lpcSize;i++)
st->old_qlsp[i] = qlsp[i];
}
-
+
ALLOC(mem, st->lpcSize, spx_mem_t);
ALLOC(syn_resp, st->subframeSize, spx_word16_t);
ALLOC(innov, st->subframeSize, spx_sig_t);
@@ -775,7 +775,7 @@ int sb_encode(void *state, void *vin, SpeexBits *bits)
ALLOC(exc, st->subframeSize, spx_word16_t);
ALLOC(res, st->subframeSize, spx_word16_t);
ALLOC(sw, st->subframeSize, spx_word16_t);
-
+
/* LSP interpolation (quantized and unquantized) */
lsp_interpolate(st->old_lsp, lsp, interp_lsp, st->lpcSize, sub, st->nbSubframes, LSP_MARGIN);
lsp_interpolate(st->old_qlsp, qlsp, interp_qlsp, st->lpcSize, sub, st->nbSubframes, LSP_MARGIN);
@@ -795,14 +795,14 @@ int sb_encode(void *state, void *vin, SpeexBits *bits)
rh += st->interp_qlpc[i+1] - st->interp_qlpc[i];
st->pi_gain[sub] += st->interp_qlpc[i] + st->interp_qlpc[i+1];
}
-
+
rl = low_pi_gain[sub];
#ifdef FIXED_POINT
filter_ratio=EXTRACT16(SATURATE(PDIV32(SHL32(ADD32(rl,82),7),ADD32(82,rh)),32767));
#else
filter_ratio=(rl+.01)/(rh+.01);
#endif
-
+
/* Compute "real excitation" */
fir_mem16(sp, st->interp_qlpc, exc, st->subframeSize, st->lpcSize, st->mem_sp2, stack);
/* Compute energy of low-band and high-band excitation */
@@ -816,7 +816,7 @@ int sb_encode(void *state, void *vin, SpeexBits *bits)
/* Gain to use if we want to use the low-band excitation for high-band */
g=PDIV32(MULT16_16(filter_ratio,eh),EXTEND32(ADD16(1,el)));
-
+
#if 0
{
char *tmp_stack=stack;
@@ -873,11 +873,11 @@ int sb_encode(void *state, void *vin, SpeexBits *bits)
compute_impulse_response(st->interp_qlpc, bw_lpc1, bw_lpc2, syn_resp, st->subframeSize, st->lpcSize, stack);
-
+
/* Reset excitation */
for (i=0;i<st->subframeSize;i++)
res[i]=VERY_SMALL;
-
+
/* Compute zero response (ringing) of A(z/g1) / ( A(z/g2) * Aq(z) ) */
for (i=0;i<st->lpcSize;i++)
mem[i]=st->mem_sp[i];
@@ -902,8 +902,8 @@ int sb_encode(void *state, void *vin, SpeexBits *bits)
SPEEX_MEMSET(innov, 0, st->subframeSize);
/*print_vec(target, st->subframeSize, "\ntarget");*/
- SUBMODE(innovation_quant)(target, st->interp_qlpc, bw_lpc1, bw_lpc2,
- SUBMODE(innovation_params), st->lpcSize, st->subframeSize,
+ SUBMODE(innovation_quant)(target, st->interp_qlpc, bw_lpc1, bw_lpc2,
+ SUBMODE(innovation_params), st->lpcSize, st->subframeSize,
innov, syn_resp, bits, stack, st->complexity, SUBMODE(double_codebook));
/*print_vec(target, st->subframeSize, "after");*/
@@ -917,8 +917,8 @@ int sb_encode(void *state, void *vin, SpeexBits *bits)
for (i=0;i<st->subframeSize;i++)
target[i]=MULT16_16_P13(QCONST16(2.5f,13), target[i]);
- SUBMODE(innovation_quant)(target, st->interp_qlpc, bw_lpc1, bw_lpc2,
- SUBMODE(innovation_params), st->lpcSize, st->subframeSize,
+ SUBMODE(innovation_quant)(target, st->interp_qlpc, bw_lpc1, bw_lpc2,
+ SUBMODE(innovation_params), st->lpcSize, st->subframeSize,
innov2, syn_resp, bits, stack, st->complexity, 0);
signal_mul(innov2, innov2, MULT16_32_P15(QCONST16(0.4f,15),scale), st->subframeSize);
@@ -934,17 +934,17 @@ int sb_encode(void *state, void *vin, SpeexBits *bits)
st->innov_rms_save[sub] = MULT16_16_Q15(QCONST16(.70711f, 15), compute_rms(innov, st->subframeSize));
}
st->exc_rms[sub] = compute_rms16(exc, st->subframeSize);
-
+
}
-
+
/*Keep the previous memory*/
for (i=0;i<st->lpcSize;i++)
mem[i]=st->mem_sp[i];
/* Final signal synthesis from excitation */
iir_mem16(exc, st->interp_qlpc, sp, st->subframeSize, st->lpcSize, st->mem_sp, stack);
-
+
/* Compute weighted signal again, from synthesized speech (not sure it's the right thing) */
filter_mem16(sp, bw_lpc1, bw_lpc2, sw, st->subframeSize, st->lpcSize, st->mem_sw, stack);
}
@@ -1009,7 +1009,7 @@ void *sb_decoder_init(const SpeexMode *m)
st->pi_gain = (spx_word32_t*)speex_alloc((st->nbSubframes)*sizeof(spx_word32_t));
st->exc_rms = (spx_word16_t*)speex_alloc((st->nbSubframes)*sizeof(spx_word16_t));
st->mem_sp = (spx_mem_t*)speex_alloc((2*st->lpcSize)*sizeof(spx_mem_t));
-
+
st->innov_save = NULL;
@@ -1187,8 +1187,8 @@ static void sb_decode_lost(SBDecState *st, spx_word16_t *out, int dtx, char *sta
}
st->first=1;
-
-
+
+
/* Final signal synthesis from excitation */
if (!dtx)
{
@@ -1197,10 +1197,10 @@ static void sb_decode_lost(SBDecState *st, spx_word16_t *out, int dtx, char *sta
for (i=0;i<st->frame_size;i++)
out[i+st->frame_size] = speex_rand(st->last_ener, &st->seed);
- iir_mem16(out+st->frame_size, st->interp_qlpc, out+st->frame_size, st->frame_size, st->lpcSize,
+ iir_mem16(out+st->frame_size, st->interp_qlpc, out+st->frame_size, st->frame_size, st->lpcSize,
st->mem_sp, stack);
-
-
+
+
/* Reconstruct the original */
qmf_synth(out, out+st->frame_size, h0, out, st->full_frame_size, QMF_ORDER, st->g0_mem, st->g1_mem, stack);
if (dtx)
@@ -1228,7 +1228,7 @@ int sb_decode(void *state, SpeexBits *bits, void *vout)
spx_word16_t *out = (spx_word16_t*)vout;
spx_word16_t *low_innov_alias;
spx_word32_t exc_ener_sum = 0;
-
+
st = (SBDecState*)state;
stack=st->stack;
mode = (const SpeexSBMode*)(st->mode->mode);
@@ -1308,13 +1308,13 @@ int sb_decode(void *state, SpeexBits *bits, void *vout)
ALLOC(qlsp, st->lpcSize, spx_lsp_t);
ALLOC(interp_qlsp, st->lpcSize, spx_lsp_t);
SUBMODE(lsp_unquant)(qlsp, st->lpcSize, bits);
-
+
if (st->first)
{
for (i=0;i<st->lpcSize;i++)
st->old_qlsp[i] = qlsp[i];
}
-
+
ALLOC(ak, st->lpcSize, spx_coef_t);
for (sub=0;sub<st->nbSubframes;sub++)
@@ -1326,7 +1326,7 @@ int sb_decode(void *state, SpeexBits *bits, void *vout)
spx_word16_t el=0;
int offset;
spx_word32_t rl=0,rh=0;
-
+
offset = st->subframeSize*sub;
sp=out+st->frame_size+offset;
ALLOC(exc, st->subframeSize, spx_word32_t);
@@ -1336,7 +1336,7 @@ int sb_decode(void *state, SpeexBits *bits, void *vout)
innov_save = st->innov_save+2*offset;
SPEEX_MEMSET(innov_save, 0, 2*st->subframeSize);
}
-
+
/* LSP interpolation */
lsp_interpolate(st->old_qlsp, qlsp, interp_qlsp, st->lpcSize, sub, st->nbSubframes, LSP_MARGIN);
@@ -1345,7 +1345,7 @@ int sb_decode(void *state, SpeexBits *bits, void *vout)
/* Calculate reponse ratio between the low and high filter in the middle
of the band (4000 Hz) */
-
+
st->pi_gain[sub]=LPC_SCALING;
rh = LPC_SCALING;
for (i=0;i<st->lpcSize;i+=2)
@@ -1360,7 +1360,7 @@ int sb_decode(void *state, SpeexBits *bits, void *vout)
#else
filter_ratio=(rl+.01)/(rh+.01);
#endif
-
+
SPEEX_MEMSET(exc, 0, st->subframeSize);
if (!SUBMODE(innovation_unquant))
{
@@ -1369,20 +1369,20 @@ int sb_decode(void *state, SpeexBits *bits, void *vout)
quant = speex_bits_unpack_unsigned(bits, 5);
g= spx_exp(MULT16_16(QCONST16(.125f,11),(quant-10)));
-
+
g = PDIV32(g, filter_ratio);
-
+
for (i=0;i<st->subframeSize;i+=2)
{
exc[i]=SHL32(MULT16_32_P15(MULT16_16_Q15(mode->folding_gain,low_innov_alias[offset+i]),SHL32(g,6)),SIG_SHIFT);
exc[i+1]=NEG32(SHL32(MULT16_32_P15(MULT16_16_Q15(mode->folding_gain,low_innov_alias[offset+i+1]),SHL32(g,6)),SIG_SHIFT));
}
-
+
} else {
spx_word16_t gc;
spx_word32_t scale;
int qgc = speex_bits_unpack_unsigned(bits, 4);
-
+
el = low_exc_rms[sub];
gc = MULT16_16_Q15(QCONST16(0.87360,15),gc_quant_bound[qgc]);
@@ -1390,7 +1390,7 @@ int sb_decode(void *state, SpeexBits *bits, void *vout)
gc = MULT16_16_P14(QCONST16(1.4142f,14),gc);
scale = SHL32(PDIV32(SHL32(MULT16_16(gc, el),3), filter_ratio),SIG_SHIFT-3);
- SUBMODE(innovation_unquant)(exc, SUBMODE(innovation_params), st->subframeSize,
+ SUBMODE(innovation_unquant)(exc, SUBMODE(innovation_params), st->subframeSize,
bits, stack, &st->seed);
signal_mul(exc,exc,scale,st->subframeSize);
@@ -1400,7 +1400,7 @@ int sb_decode(void *state, SpeexBits *bits, void *vout)
VARDECL(spx_sig_t *innov2);
ALLOC(innov2, st->subframeSize, spx_sig_t);
SPEEX_MEMSET(innov2, 0, st->subframeSize);
- SUBMODE(innovation_unquant)(innov2, SUBMODE(innovation_params), st->subframeSize,
+ SUBMODE(innovation_unquant)(innov2, SUBMODE(innovation_params), st->subframeSize,
bits, stack, &st->seed);
signal_mul(innov2, innov2, MULT16_32_P15(QCONST16(0.4f,15),scale), st->subframeSize);
for (i=0;i<st->subframeSize;i++)
@@ -1409,14 +1409,14 @@ int sb_decode(void *state, SpeexBits *bits, void *vout)
}
}
-
+
if (st->innov_save)
{
for (i=0;i<st->subframeSize;i++)
innov_save[2*i]=EXTRACT16(PSHR32(exc[i],SIG_SHIFT));
}
-
- iir_mem16(st->excBuf, st->interp_qlpc, sp, st->subframeSize, st->lpcSize,
+
+ iir_mem16(st->excBuf, st->interp_qlpc, sp, st->subframeSize, st->lpcSize,
st->mem_sp, stack);
for (i=0;i<st->subframeSize;i++)
st->excBuf[i]=EXTRACT16(PSHR32(exc[i],SIG_SHIFT));
@@ -1426,7 +1426,7 @@ int sb_decode(void *state, SpeexBits *bits, void *vout)
exc_ener_sum = ADD32(exc_ener_sum, DIV32(MULT16_16(st->exc_rms[sub],st->exc_rms[sub]), st->nbSubframes));
}
st->last_ener = spx_sqrt(exc_ener_sum);
-
+
qmf_synth(out, out+st->frame_size, h0, out, st->full_frame_size, QMF_ORDER, st->g0_mem, st->g1_mem, stack);
for (i=0;i<st->lpcSize;i++)
st->old_qlsp[i] = qlsp[i];
diff --git a/libspeex/smallft.c b/libspeex/smallft.c
index 5c26d01..82c3b0a 100644
--- a/libspeex/smallft.c
+++ b/libspeex/smallft.c
@@ -127,7 +127,7 @@ static void dradf2(int ido,int l1,float *cc,float *ch,float *wa1){
t1+=ido;
t2+=ido;
}
-
+
if(ido<2)return;
if(ido==2)goto L105;
@@ -174,7 +174,7 @@ static void dradf4(int ido,int l1,float *cc,float *ch,float *wa1,
int i,k,t0,t1,t2,t3,t4,t5,t6;
float ci2,ci3,ci4,cr2,cr3,cr4,ti1,ti2,ti3,ti4,tr1,tr2,tr3,tr4;
t0=l1*ido;
-
+
t1=t0;
t4=t1<<1;
t2=t1+(t1<<1);
@@ -246,7 +246,7 @@ static void dradf4(int ido,int l1,float *cc,float *ch,float *wa1,
if(ido&1)return;
L105:
-
+
t2=(t1=t0+ido-1)+(t0<<1);
t3=ido<<2;
t4=ido;
@@ -280,7 +280,7 @@ static void dradfg(int ido,int ip,int l1,int idl1,float *cc,float *c1,
int nbd;
float dcp,arg,dsp,ar1h,ar2h;
int idp2,ipp2;
-
+
arg=tpi/(float)ip;
dcp=cos(arg);
dsp=sin(arg);
@@ -638,7 +638,7 @@ static void dradb2(int ido,int l1,float *cc,float *ch,float *wa1){
float ti2,tr2;
t0=l1*ido;
-
+
t1=0;
t2=0;
t3=(ido<<1)-1;
@@ -754,7 +754,7 @@ static void dradb4(int ido,int l1,float *cc,float *ch,float *wa1,
int i,k,t0,t1,t2,t3,t4,t5,t6,t7,t8;
float ci2,ci3,ci4,cr2,cr3,cr4,ti1,ti2,ti3,ti4,tr1,tr2,tr3,tr4;
t0=l1*ido;
-
+
t1=0;
t2=ido<<2;
t3=0;
@@ -763,7 +763,7 @@ static void dradb4(int ido,int l1,float *cc,float *ch,float *wa1,
t4=t3+t6;
t5=t1;
tr3=cc[t4-1]+cc[t4-1];
- tr4=cc[t4]+cc[t4];
+ tr4=cc[t4]+cc[t4];
tr1=cc[t3]-cc[(t4+=t6)-1];
tr2=cc[t3]+cc[t4-1];
ch[t5]=tr2+tr3;
@@ -858,7 +858,7 @@ static void dradbg(int ido,int ip,int l1,int idl1,float *cc,float *c1,
ipp2=ip;
ipph=(ip+1)>>1;
if(ido<l1)goto L103;
-
+
t1=0;
t2=0;
for(k=0;k<l1;k++){
diff --git a/libspeex/speex.c b/libspeex/speex.c
index dd384c8..33701ba 100644
--- a/libspeex/speex.c
+++ b/libspeex/speex.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002 Jean-Marc Valin
+/* Copyright (C) 2002 Jean-Marc Valin
File: speex.c
Basic Speex functions
@@ -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
@@ -195,7 +195,7 @@ EXPORT int speex_decoder_ctl(void *state, int request, void *ptr)
int nb_mode_query(const void *mode, int request, void *ptr)
{
const SpeexNBMode *m = (const SpeexNBMode*)mode;
-
+
switch (request)
{
case SPEEX_MODE_FRAME_SIZE:
diff --git a/libspeex/speex_callbacks.c b/libspeex/speex_callbacks.c
index 09f037c..8be9e38 100644
--- a/libspeex/speex_callbacks.c
+++ b/libspeex/speex_callbacks.c
@@ -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
@@ -65,7 +65,7 @@ EXPORT int speex_inband_handler(SpeexBits *bits, SpeexCallback *callback_list, v
adv = 16;
else if (id<14)
adv = 32;
- else
+ else
adv = 64;
speex_bits_advance(bits, adv);
}
diff --git a/libspeex/speex_header.c b/libspeex/speex_header.c
index a495456..5900d36 100644
--- a/libspeex/speex_header.c
+++ b/libspeex/speex_header.c
@@ -1,22 +1,22 @@
-/* Copyright (C) 2002 Jean-Marc Valin
+/* Copyright (C) 2002 Jean-Marc Valin
File: speex_header.c
Describes the Speex header
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
@@ -98,10 +98,10 @@ EXPORT void speex_init_header(SpeexHeader *header, int rate, int nb_channels, co
header->speex_version[i]=SPEEX_VERSION[i];
for (;i<SPEEX_HEADER_VERSION_LENGTH;i++)
header->speex_version[i]=0;
-
+
header->speex_version_id = 1;
header->header_size = sizeof(SpeexHeader);
-
+
header->rate = rate;
header->mode = m->modeID;
header->mode_bitstream_version = m->bitstream_version;
@@ -111,7 +111,7 @@ EXPORT void speex_init_header(SpeexHeader *header, int rate, int nb_channels, co
header->bitrate = -1;
speex_mode_query(m, SPEEX_MODE_FRAME_SIZE, &header->frame_size);
header->vbr = 0;
-
+
header->frames_per_packet = 0;
header->extra_headers = 0;
header->reserved1 = 0;
@@ -122,9 +122,9 @@ EXPORT char *speex_header_to_packet(SpeexHeader *header, int *size)
{
SpeexHeader *le_header;
le_header = (SpeexHeader*)speex_alloc(sizeof(SpeexHeader));
-
+
SPEEX_COPY(le_header, header, 1);
-
+
/*Make sure everything is now little-endian*/
ENDIAN_SWITCH(le_header->speex_version_id);
ENDIAN_SWITCH(le_header->header_size);
@@ -164,9 +164,9 @@ EXPORT SpeexHeader *speex_packet_to_header(char *packet, int size)
}
le_header = (SpeexHeader*)speex_alloc(sizeof(SpeexHeader));
-
+
SPEEX_COPY(le_header, (SpeexHeader*)packet, 1);
-
+
/*Make sure everything is converted correctly from little-endian*/
ENDIAN_SWITCH(le_header->speex_version_id);
ENDIAN_SWITCH(le_header->header_size);
diff --git a/libspeex/stereo.c b/libspeex/stereo.c
index 8fee55e..83642cb 100644
--- a/libspeex/stereo.c
+++ b/libspeex/stereo.c
@@ -1,21 +1,21 @@
-/* Copyright (C) 2002 Jean-Marc Valin
+/* Copyright (C) 2002 Jean-Marc Valin
File: stereo.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
@@ -69,7 +69,7 @@ static const spx_word16_t balance_bounds[31] = {18, 23, 30, 38, 49, 63, 81, 104
#ifdef FIXED_POINT
#define COMPATIBILITY_HACK(s) do {if ((s)->reserved1 != 0xdeadbeef) speex_stereo_state_reset((SpeexStereoState*)s); } while (0);
#else
-#define COMPATIBILITY_HACK(s)
+#define COMPATIBILITY_HACK(s)
#endif
EXPORT SpeexStereoState *speex_stereo_state_init()
@@ -96,7 +96,7 @@ EXPORT void speex_stereo_state_reset(SpeexStereoState *_stereo)
stereo->smooth_right = 1.f;
stereo->reserved1 = 0;
stereo->reserved2 = 0;
-#endif
+#endif
}
EXPORT void speex_stereo_state_destroy(SpeexStereoState *stereo)
@@ -124,7 +124,7 @@ EXPORT void speex_encode_stereo(float *data, int frame_size, SpeexBits *bits)
/*Quantization*/
speex_bits_pack(bits, 14, 5);
speex_bits_pack(bits, SPEEX_INBAND_STEREO, 4);
-
+
balance=4*log(balance);
/*Pack sign*/
@@ -135,9 +135,9 @@ EXPORT void speex_encode_stereo(float *data, int frame_size, SpeexBits *bits)
balance=floor(.5+fabs(balance));
if (balance>30)
balance=31;
-
+
speex_bits_pack(bits, (int)balance, 5);
-
+
/* FIXME: this is a hack */
tmp=scal_quant(e_ratio*Q15_ONE, e_ratio_quant_bounds, 4);
speex_bits_pack(bits, tmp, 2);
@@ -154,7 +154,7 @@ EXPORT void speex_encode_stereo_int(spx_int16_t *data, int frame_size, SpeexBits
#ifdef FIXED_POINT
int shift;
#endif
-
+
/* In band marker */
speex_bits_pack(bits, 14, 5);
/* Stereo marker */
@@ -199,9 +199,9 @@ EXPORT void speex_encode_stereo_int(spx_int16_t *data, int frame_size, SpeexBits
if (balance_id>30)
balance_id=31;
#endif
-
+
speex_bits_pack(bits, balance_id, 5);
-
+
/* "coherence" quantisation */
#ifdef FIXED_POINT
shift = spx_ilog2(e_tot);
@@ -212,7 +212,7 @@ EXPORT void speex_encode_stereo_int(spx_int16_t *data, int frame_size, SpeexBits
#else
e_ratio = e_tot/(1.+e_left+e_right);
#endif
-
+
tmp=scal_quant(EXTRACT16(e_ratio), e_ratio_quant_bounds, 4);
/*fprintf (stderr, "%d %d %d %d\n", largest, smallest, balance_id, e_ratio);*/
speex_bits_pack(bits, tmp, 2);
@@ -231,12 +231,12 @@ EXPORT void speex_decode_stereo(float *data, int frame_size, SpeexStereoState *_
spx_word32_t balance;
spx_word16_t e_left, e_right, e_ratio;
RealSpeexStereoState *stereo = (RealSpeexStereoState*)_stereo;
-
+
COMPATIBILITY_HACK(stereo);
-
+
balance=stereo->balance;
e_ratio=stereo->e_ratio;
-
+
/* These two are Q14, with max value just below 2. */
e_right = DIV32(QCONST32(1., 22), spx_sqrt(MULT16_32_Q15(e_ratio, ADD32(QCONST32(1., 16), balance))));
e_left = SHR32(MULT16_16(spx_sqrt(balance), e_right), 8);
@@ -260,10 +260,10 @@ EXPORT void speex_decode_stereo_int(spx_int16_t *data, int frame_size, SpeexSter
RealSpeexStereoState *stereo = (RealSpeexStereoState*)_stereo;
COMPATIBILITY_HACK(stereo);
-
+
balance=stereo->balance;
e_ratio=stereo->e_ratio;
-
+
/* These two are Q14, with max value just below 2. */
e_right = DIV32(QCONST32(1., 22), spx_sqrt(MULT16_32_Q15(e_ratio, ADD32(QCONST32(1., 16), balance))));
e_left = SHR32(MULT16_16(spx_sqrt(balance), e_right), 8);
@@ -285,7 +285,7 @@ EXPORT int speex_std_stereo_request_handler(SpeexBits *bits, void *state, void *
int tmp;
stereo = (RealSpeexStereoState*)data;
-
+
COMPATIBILITY_HACK(stereo);
if (speex_bits_unpack_unsigned(bits, 1))
diff --git a/libspeex/testenc.c b/libspeex/testenc.c
index 88a6492..1f634ed 100644
--- a/libspeex/testenc.c
+++ b/libspeex/testenc.c
@@ -114,7 +114,7 @@ int main(int argc, char **argv)
rewind(fin);
rewind(fout);
- while ( FRAME_SIZE == fread(in_short, sizeof(short), FRAME_SIZE, fin)
+ while ( FRAME_SIZE == fread(in_short, sizeof(short), FRAME_SIZE, fin)
&&
FRAME_SIZE == fread(out_short, sizeof(short), FRAME_SIZE,fout) )
{
diff --git a/libspeex/testenc_uwb.c b/libspeex/testenc_uwb.c
index 2dfd695..16da3cc 100644
--- a/libspeex/testenc_uwb.c
+++ b/libspeex/testenc_uwb.c
@@ -107,7 +107,7 @@ int main(int argc, char **argv)
rewind(fin);
rewind(fout);
- while ( FRAME_SIZE == fread(in_short, sizeof(short), FRAME_SIZE, fin)
+ while ( FRAME_SIZE == fread(in_short, sizeof(short), FRAME_SIZE, fin)
&&
FRAME_SIZE == fread(out_short, sizeof(short), FRAME_SIZE,fout) )
{
@@ -131,6 +131,6 @@ int main(int argc, char **argv)
#ifdef FIXED_DEBUG
printf ("Total: %f MIPS\n", (float)(1e-6*50*spx_mips/snr_frames));
#endif
-
+
return 1;
}
diff --git a/libspeex/testenc_wb.c b/libspeex/testenc_wb.c
index 64ba237..c1beb43 100644
--- a/libspeex/testenc_wb.c
+++ b/libspeex/testenc_wb.c
@@ -110,7 +110,7 @@ int main(int argc, char **argv)
rewind(fin);
rewind(fout);
- while ( FRAME_SIZE == fread(in_short, sizeof(short), FRAME_SIZE, fin)
+ while ( FRAME_SIZE == fread(in_short, sizeof(short), FRAME_SIZE, fin)
&&
FRAME_SIZE == fread(out_short, sizeof(short), FRAME_SIZE,fout) )
{
@@ -134,6 +134,6 @@ int main(int argc, char **argv)
#ifdef FIXED_DEBUG
printf ("Total: %f MIPS\n", (float)(1e-6*50*spx_mips/snr_frames));
#endif
-
+
return 1;
}
diff --git a/libspeex/vbr.c b/libspeex/vbr.c
index 8b014d1..16d5dc0 100644
--- a/libspeex/vbr.c
+++ b/libspeex/vbr.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002 Jean-Marc Valin
+/* Copyright (C) 2002 Jean-Marc Valin
File: vbr.c
VBR-related routines
@@ -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
@@ -55,7 +55,7 @@ const float vbr_nb_thresh[9][11]={
{11.0f, 11.0f, 9.9f, 8.5f, 7.0f, 5.25f, 4.5f, 4.0f, 4.0f, 4.0f, 2.0f}, /* 11 kbps */
{11.0f, 11.0f, 11.0f, 11.0f, 9.5f, 9.25f, 8.0f, 7.0f, 5.0f, 4.0f, 3.0f}, /* 15 kbps */
{11.0f, 11.0f, 11.0f, 11.0f, 11.0f, 11.0f, 9.5f, 8.5f, 6.2f, 5.2f, 5.0f}, /* 18 kbps */
- {11.0f, 11.0f, 11.0f, 11.0f, 11.0f, 11.0f, 11.0f, 11.0f, 10.0f, 9.8f, 7.5f}, /* 24 kbps */
+ {11.0f, 11.0f, 11.0f, 11.0f, 11.0f, 11.0f, 11.0f, 11.0f, 10.0f, 9.8f, 7.5f}, /* 24 kbps */
{ 7.0f, 4.5f, 3.7f, 3.0f, 2.5f, 1.0f, 1.8f, 1.5f, 1.0f, 0.0f, 0.0f} /* 4 kbps */
};
@@ -65,7 +65,7 @@ const float vbr_hb_thresh[5][11]={
{-1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f}, /* 2 kbps */
{11.0f, 11.0f, 9.5f, 8.5f, 7.5f, 6.0f, 5.0f, 3.9f, 3.0f, 2.0f, 1.0f}, /* 6 kbps */
{11.0f, 11.0f, 11.0f, 11.0f, 11.0f, 9.5f, 8.7f, 7.8f, 7.0f, 6.5f, 4.0f}, /* 10 kbps */
- {11.0f, 11.0f, 11.0f, 11.0f, 11.0f, 11.0f, 11.0f, 11.0f, 9.8f, 7.5f, 5.5f} /* 18 kbps */
+ {11.0f, 11.0f, 11.0f, 11.0f, 11.0f, 11.0f, 11.0f, 11.0f, 9.8f, 7.5f, 5.5f} /* 18 kbps */
};
const float vbr_uhb_thresh[2][11]={
@@ -115,7 +115,7 @@ void vbr_init(VBRState *vbr)
-Decrease bit-rate for males (low pitch)?
- -(wideband only) less bits in the high-band when signal is very
+ -(wideband only) less bits in the high-band when signal is very
non-stationary (harder to notice high-frequency noise)???
*/
@@ -162,7 +162,7 @@ float vbr_analysis(VBRState *vbr, spx_word16_t *sig, int len, int pitch, float p
vbr->consec_noise++;
if (pow_ener > 3*vbr->noise_level)
tmp = 3*vbr->noise_level;
- else
+ else
tmp = pow_ener;
if (vbr->consec_noise>=4)
{
@@ -177,7 +177,7 @@ float vbr_analysis(VBRState *vbr, spx_word16_t *sig, int len, int pitch, float p
if (pow_ener < vbr->noise_level && ener>MIN_ENERGY)
{
vbr->noise_accum = .95*vbr->noise_accum + .05*pow_ener;
- vbr->noise_accum_count = .95*vbr->noise_accum_count + .05;
+ vbr->noise_accum_count = .95*vbr->noise_accum_count + .05;
}
/* Checking for very low absolute energy */
@@ -223,7 +223,7 @@ float vbr_analysis(VBRState *vbr, spx_word16_t *sig, int len, int pitch, float p
qual=4;
if (qual>10)
qual=10;
-
+
/*
if (vbr->consec_noise>=2)
qual-=1.3;
@@ -239,7 +239,7 @@ float vbr_analysis(VBRState *vbr, spx_word16_t *sig, int len, int pitch, float p
qual -= 1.0 * (log(3.0 + vbr->consec_noise)-log(3));
if (qual<0)
qual=0;
-
+
if (ener<1600000)
{
if (vbr->consec_noise>2)
diff --git a/libspeex/vorbis_psy.c b/libspeex/vorbis_psy.c
index 68a6fe9..cb385b7 100644
--- a/libspeex/vorbis_psy.c
+++ b/libspeex/vorbis_psy.c
@@ -4,18 +4,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
@@ -48,15 +48,15 @@
/* psychoacoustic setup ********************************************/
static VorbisPsyInfo example_tuning = {
-
- .5,.5,
+
+ .5,.5,
3,3,25,
-
+
/*63 125 250 500 1k 2k 4k 8k 16k*/
// vorbis mode 4 style
//{-32,-32,-32,-32,-28,-24,-22,-20,-20, -20, -20, -8, -6, -6, -6, -6, -6},
{ -4, -6, -6, -6, -6, -6, -6, -6, -8, -8,-10,-10, -8, -6, -4, -4, -2},
-
+
{
0, 1, 2, 3, 4, 5, 5, 5, /* 7dB */
6, 6, 6, 5, 4, 4, 4, 4, /* 15dB */
@@ -78,16 +78,16 @@ static void _analysis_output(char *base,int i,float *v,int n,int bark,int dB){
sprintf(buffer,"%s_%d.m",base,i);
of=fopen(buffer,"w");
-
+
if(!of)perror("failed to open data dump file");
-
+
for(j=0;j<n;j++){
if(bark){
float b=toBARK((4000.f*j/n)+.25);
fprintf(of,"%f ",b);
}else
fprintf(of,"%f ",(double)j);
-
+
if(dB){
float val;
if(v[j]==0.)
@@ -107,7 +107,7 @@ static void bark_noise_hybridmp(int n,const long *b,
float *noise,
const float offset,
const int fixed){
-
+
float *N=alloca(n*sizeof(*N));
float *X=alloca(n*sizeof(*N));
float *XX=alloca(n*sizeof(*N));
@@ -127,7 +127,7 @@ static void bark_noise_hybridmp(int n,const long *b,
if (y < 1.f) y = 1.f;
w = y * y * .5;
-
+
tN += w;
tX += w;
tY += w * y;
@@ -139,12 +139,12 @@ static void bark_noise_hybridmp(int n,const long *b,
XY[0] = tXY;
for (i = 1, x = 1.f; i < n; i++, x += 1.f) {
-
+
y = f[i] + offset;
if (y < 1.f) y = 1.f;
w = y * y;
-
+
tN += w;
tX += w * x;
tXX += w * x * x;
@@ -157,59 +157,59 @@ static void bark_noise_hybridmp(int n,const long *b,
Y[i] = tY;
XY[i] = tXY;
}
-
+
for (i = 0, x = 0.f;; i++, x += 1.f) {
-
+
lo = b[i] >> 16;
if( lo>=0 ) break;
hi = b[i] & 0xffff;
-
+
tN = N[hi] + N[-lo];
tX = X[hi] - X[-lo];
tXX = XX[hi] + XX[-lo];
- tY = Y[hi] + Y[-lo];
+ tY = Y[hi] + Y[-lo];
tXY = XY[hi] - XY[-lo];
-
+
A = tY * tXX - tX * tXY;
B = tN * tXY - tX * tY;
D = tN * tXX - tX * tX;
R = (A + x * B) / D;
if (R < 0.f)
R = 0.f;
-
+
noise[i] = R - offset;
}
-
+
for ( ;; i++, x += 1.f) {
-
+
lo = b[i] >> 16;
hi = b[i] & 0xffff;
if(hi>=n)break;
-
+
tN = N[hi] - N[lo];
tX = X[hi] - X[lo];
tXX = XX[hi] - XX[lo];
tY = Y[hi] - Y[lo];
tXY = XY[hi] - XY[lo];
-
+
A = tY * tXX - tX * tXY;
B = tN * tXY - tX * tY;
D = tN * tXX - tX * tX;
R = (A + x * B) / D;
if (R < 0.f) R = 0.f;
-
+
noise[i] = R - offset;
}
for ( ; i < n; i++, x += 1.f) {
-
+
R = (A + x * B) / D;
if (R < 0.f) R = 0.f;
-
+
noise[i] = R - offset;
}
-
+
if (fixed <= 0) return;
-
+
for (i = 0, x = 0.f;; i++, x += 1.f) {
hi = i + fixed / 2;
lo = hi - fixed;
@@ -220,8 +220,8 @@ static void bark_noise_hybridmp(int n,const long *b,
tXX = XX[hi] + XX[-lo];
tY = Y[hi] + Y[-lo];
tXY = XY[hi] - XY[-lo];
-
-
+
+
A = tY * tXX - tX * tXY;
B = tN * tXY - tX * tY;
D = tN * tXX - tX * tX;
@@ -230,22 +230,22 @@ static void bark_noise_hybridmp(int n,const long *b,
if (R - offset < noise[i]) noise[i] = R - offset;
}
for ( ;; i++, x += 1.f) {
-
+
hi = i + fixed / 2;
lo = hi - fixed;
if(hi>=n)break;
-
+
tN = N[hi] - N[lo];
tX = X[hi] - X[lo];
tXX = XX[hi] - XX[lo];
tY = Y[hi] - Y[lo];
tXY = XY[hi] - XY[lo];
-
+
A = tY * tXX - tX * tXY;
B = tN * tXY - tX * tY;
D = tN * tXX - tX * tX;
R = (A + x * B) / D;
-
+
if (R - offset < noise[i]) noise[i] = R - offset;
}
for ( ; i < n; i++, x += 1.f) {
@@ -255,7 +255,7 @@ static void bark_noise_hybridmp(int n,const long *b,
}
static void _vp_noisemask(VorbisPsy *p,
- float *logfreq,
+ float *logfreq,
float *logmask){
int i,n=p->n/2;
@@ -270,15 +270,15 @@ static void _vp_noisemask(VorbisPsy *p,
p->vi->noisewindowfixed);
for(i=0;i<n;i++)work[i]=logfreq[i]-work[i];
-
+
{
static int seq=0;
-
+
float work2[n];
for(i=0;i<n;i++){
work2[i]=logmask[i]+work[i];
}
-
+
//_analysis_output("logfreq",seq,logfreq,n,0,0);
//_analysis_output("median",seq,work,n,0,0);
//_analysis_output("envelope",seq,work2,n,0,0);
@@ -299,7 +299,7 @@ VorbisPsy *vorbis_psy_init(int rate, int n)
long i,j,lo=-99,hi=1;
VorbisPsy *p = speex_alloc(sizeof(VorbisPsy));
memset(p,0,sizeof(*p));
-
+
p->n = n;
spx_drft_init(&p->lookup, n);
p->bark = speex_alloc(n*sizeof(*p->bark));
@@ -317,35 +317,35 @@ VorbisPsy *vorbis_psy_init(int rate, int n)
sin((i+.5)/n * M_PI)*sin((i+.5)/n * M_PI);
/* bark scale lookups */
for(i=0;i<n;i++){
- float bark=toBARK(rate/(2*n)*i);
-
- for(;lo+p->vi->noisewindowlomin<i &&
+ float bark=toBARK(rate/(2*n)*i);
+
+ for(;lo+p->vi->noisewindowlomin<i &&
toBARK(rate/(2*n)*lo)<(bark-p->vi->noisewindowlo);lo++);
-
+
for(;hi<=n && (hi<i+p->vi->noisewindowhimin ||
toBARK(rate/(2*n)*hi)<(bark+p->vi->noisewindowhi));hi++);
-
+
p->bark[i]=((lo-1)<<16)+(hi-1);
}
/* set up rolling noise median */
p->noiseoffset=speex_alloc(n*sizeof(*p->noiseoffset));
-
+
for(i=0;i<n;i++){
float halfoc=toOC((i+.5)*rate/(2.*n))*2.;
int inthalfoc;
float del;
-
+
if(halfoc<0)halfoc=0;
if(halfoc>=P_BANDS-1)halfoc=P_BANDS-1;
inthalfoc=(int)halfoc;
del=halfoc-inthalfoc;
-
+
p->noiseoffset[i]=
- p->vi->noiseoff[inthalfoc]*(1.-del) +
+ p->vi->noiseoff[inthalfoc]*(1.-del) +
p->vi->noiseoff[inthalfoc+1]*del;
-
+
}
#if 0
_analysis_output_always("noiseoff0",ls,p->noiseoffset,n,1,0,0);
@@ -378,14 +378,14 @@ void compute_curve(VorbisPsy *psy, float *audio, float *curve)
float scale_dB;
scale_dB=todB(scale);
-
+
/* window the PCM data; use a BH4 window, not vorbis */
for(i=0;i<psy->n;i++)
work[i]=audio[i] * psy->window[i];
{
static int seq=0;
-
+
//_analysis_output("win",seq,work,psy->n,0,0);
seq++;
@@ -432,7 +432,7 @@ void curve_to_lpc(VorbisPsy *psy, float *curve, float *awk1, float *awk2, int or
ac[2*i-1] = curve[i];
ac[0] = curve[0];
ac[2*len-1] = curve[len-1];
-
+
spx_drft_backward(&psy->lookup, ac);
_spx_lpc(awk1, ac, ord);
tmp = 1.;
@@ -447,7 +447,7 @@ void curve_to_lpc(VorbisPsy *psy, float *curve, float *awk1, float *awk2, int or
#else
/* Use the second (awk2) filter to correct the first one */
for (i=0;i<2*len;i++)
- ac[i] = 0;
+ ac[i] = 0;
for (i=0;i<ord;i++)
ac[i+1] = awk1[i];
ac[0] = 1;
@@ -467,7 +467,7 @@ void curve_to_lpc(VorbisPsy *psy, float *curve, float *awk1, float *awk2, int or
ac[2*i-1] = curve[i];
ac[0] = curve[0];
ac[2*len-1] = curve[len-1];
-
+
spx_drft_backward(&psy->lookup, ac);
_spx_lpc(awk2, ac, ord);
tmp = 1;
diff --git a/libspeex/vq.c b/libspeex/vq.c
index e95e1f2..c7f1396 100644
--- a/libspeex/vq.c
+++ b/libspeex/vq.c
@@ -5,18 +5,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
diff --git a/libspeex/window.c b/libspeex/window.c
index fe5ee70..a89d4d7 100644
--- a/libspeex/window.c
+++ b/libspeex/window.c
@@ -1,21 +1,21 @@
-/* Copyright (C) 2006 Jean-Marc Valin
+/* Copyright (C) 2006 Jean-Marc Valin
File: window.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
@@ -41,30 +41,30 @@ const spx_word16_t lag_window[11] = {
};
const spx_word16_t lpc_window[200] = {
-2621, 2627, 2642, 2668, 2704, 2750, 2807, 2874,
-2951, 3038, 3135, 3242, 3359, 3486, 3623, 3769,
-3925, 4090, 4264, 4448, 4641, 4843, 5053, 5272,
-5500, 5736, 5981, 6233, 6493, 6761, 7036, 7319,
-7609, 7905, 8209, 8519, 8835, 9157, 9485, 9819,
-10158, 10502, 10852, 11206, 11564, 11926, 12293, 12663,
-13037, 13414, 13793, 14176, 14561, 14948, 15337, 15727,
-16119, 16512, 16906, 17300, 17695, 18089, 18484, 18877,
-19270, 19662, 20053, 20442, 20829, 21214, 21596, 21976,
-22353, 22726, 23096, 23463, 23826, 24184, 24538, 24887,
-25231, 25570, 25904, 26232, 26555, 26871, 27181, 27484,
-27781, 28070, 28353, 28628, 28896, 29157, 29409, 29653,
-29889, 30117, 30336, 30547, 30749, 30941, 31125, 31300,
-31465, 31621, 31767, 31903, 32030, 32147, 32254, 32352,
-32439, 32516, 32582, 32639, 32685, 32722, 32747, 32763,
-32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767,
-32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767,
-32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767,
-32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767,
-32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767,
-32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767,
-32767, 32767, 32767, 32723, 32590, 32368, 32058, 31661,
-31177, 30610, 29959, 29227, 28416, 27528, 26566, 25532,
-24430, 23263, 22034, 20747, 19406, 18015, 16579, 15104,
+2621, 2627, 2642, 2668, 2704, 2750, 2807, 2874,
+2951, 3038, 3135, 3242, 3359, 3486, 3623, 3769,
+3925, 4090, 4264, 4448, 4641, 4843, 5053, 5272,
+5500, 5736, 5981, 6233, 6493, 6761, 7036, 7319,
+7609, 7905, 8209, 8519, 8835, 9157, 9485, 9819,
+10158, 10502, 10852, 11206, 11564, 11926, 12293, 12663,
+13037, 13414, 13793, 14176, 14561, 14948, 15337, 15727,
+16119, 16512, 16906, 17300, 17695, 18089, 18484, 18877,
+19270, 19662, 20053, 20442, 20829, 21214, 21596, 21976,
+22353, 22726, 23096, 23463, 23826, 24184, 24538, 24887,
+25231, 25570, 25904, 26232, 26555, 26871, 27181, 27484,
+27781, 28070, 28353, 28628, 28896, 29157, 29409, 29653,
+29889, 30117, 30336, 30547, 30749, 30941, 31125, 31300,
+31465, 31621, 31767, 31903, 32030, 32147, 32254, 32352,
+32439, 32516, 32582, 32639, 32685, 32722, 32747, 32763,
+32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767,
+32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767,
+32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767,
+32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767,
+32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767,
+32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767,
+32767, 32767, 32767, 32723, 32590, 32368, 32058, 31661,
+31177, 30610, 29959, 29227, 28416, 27528, 26566, 25532,
+24430, 23263, 22034, 20747, 19406, 18015, 16579, 15104,
13594, 12058, 10503, 8941, 7391, 5887, 4498, 3392
};
#else
diff --git a/speexclient/alsa_device.c b/speexclient/alsa_device.c
index a3a4abb..90b9fe4 100644
--- a/speexclient/alsa_device.c
+++ b/speexclient/alsa_device.c
@@ -2,7 +2,7 @@
Copyright (C) 2004-2006 Jean-Marc Valin
Copyright (C) 2006 Commonwealth Scientific and Industrial Research
Organisation (CSIRO) Australia
-
+
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
@@ -66,7 +66,7 @@ AlsaDevice *alsa_device_open(char *device_name, unsigned int rate, int channels,
dev->channels = channels;
dev->period = period;
err = snd_output_stdio_attach(&jcd_out, stdout, 0);
-
+
if ((err = snd_pcm_open (&dev->capture_handle, dev->device_name, SND_PCM_STREAM_CAPTURE, 0)) < 0) {
fprintf (stderr, "cannot open audio device %s (%s)\n",
dev->device_name,
@@ -110,7 +110,7 @@ AlsaDevice *alsa_device_open(char *device_name, unsigned int rate, int channels,
snd_strerror (err));
assert(0);
}
-
+
period_size = period;
dir = 0;
if ((err = snd_pcm_hw_params_set_period_size_near (dev->capture_handle, hw_params, &period_size, &dir)) < 0) {
@@ -118,13 +118,13 @@ AlsaDevice *alsa_device_open(char *device_name, unsigned int rate, int channels,
snd_strerror (err));
assert(0);
}
-
+
if ((err = snd_pcm_hw_params_set_periods (dev->capture_handle, hw_params, 2, 0)) < 0) {
fprintf (stderr, "cannot set number of periods (%s)\n",
snd_strerror (err));
assert(0);
}
-
+
buffer_size = period_size * 2;
dir=0;
if ((err = snd_pcm_hw_params_set_buffer_size_near (dev->capture_handle, hw_params, &buffer_size)) < 0) {
@@ -132,7 +132,7 @@ AlsaDevice *alsa_device_open(char *device_name, unsigned int rate, int channels,
snd_strerror (err));
assert(0);
}
-
+
if ((err = snd_pcm_hw_params (dev->capture_handle, hw_params)) < 0) {
fprintf (stderr, "cannot set capture parameters (%s)\n",
snd_strerror (err));
@@ -160,16 +160,16 @@ AlsaDevice *alsa_device_open(char *device_name, unsigned int rate, int channels,
fprintf (stderr, "cannot set software parameters (%s)\n",
snd_strerror (err));
assert(0);
- }
-
-
+ }
+
+
if ((err = snd_pcm_open (&dev->playback_handle, dev->device_name, SND_PCM_STREAM_PLAYBACK, 0)) < 0) {
fprintf (stderr, "cannot open audio device %s (%s)\n",
dev->device_name,
snd_strerror (err));
assert(0);
}
-
+
if ((err = snd_pcm_hw_params_malloc (&hw_params)) < 0) {
fprintf (stderr, "cannot allocate hardware parameter structure (%s)\n",
snd_strerror (err));
@@ -206,7 +206,7 @@ AlsaDevice *alsa_device_open(char *device_name, unsigned int rate, int channels,
snd_strerror (err));
assert(0);
}
-
+
period_size = period;
dir = 0;
if ((err = snd_pcm_hw_params_set_period_size_near (dev->playback_handle, hw_params, &period_size, &dir)) < 0) {
@@ -237,7 +237,7 @@ AlsaDevice *alsa_device_open(char *device_name, unsigned int rate, int channels,
/*snd_pcm_dump_setup(dev->playback_handle, jcd_out);*/
snd_pcm_hw_params_free (hw_params);
-
+
if ((err = snd_pcm_sw_params_malloc (&sw_params)) < 0) {
fprintf (stderr, "cannot allocate software parameters structure (%s)\n",
snd_strerror (err));
@@ -263,8 +263,8 @@ AlsaDevice *alsa_device_open(char *device_name, unsigned int rate, int channels,
snd_strerror (err));
assert(0);
}
-
-
+
+
snd_pcm_link(dev->capture_handle, dev->playback_handle);
if ((err = snd_pcm_prepare (dev->capture_handle)) < 0) {
fprintf (stderr, "cannot prepare audio interface for use (%s)\n",
@@ -276,7 +276,7 @@ AlsaDevice *alsa_device_open(char *device_name, unsigned int rate, int channels,
snd_strerror (err));
assert(0);
}
-
+
dev->readN = snd_pcm_poll_descriptors_count(dev->capture_handle);
dev->writeN = snd_pcm_poll_descriptors_count(dev->playback_handle);
@@ -288,7 +288,7 @@ AlsaDevice *alsa_device_open(char *device_name, unsigned int rate, int channels,
snd_strerror (err));
assert(0);
}
-
+
dev->write_fd = malloc(dev->writeN*sizeof(*dev->read_fd));
if (snd_pcm_poll_descriptors(dev->playback_handle, dev->write_fd, dev->writeN) != dev->writeN)
{
diff --git a/speexclient/speex_jitter_buffer.c b/speexclient/speex_jitter_buffer.c
index 9df6659..aa76d26 100644
--- a/speexclient/speex_jitter_buffer.c
+++ b/speexclient/speex_jitter_buffer.c
@@ -43,7 +43,7 @@ void speex_jitter_get(SpeexJitter *jitter, spx_int16_t *out, int *current_timest
JitterBufferPacket packet;
packet.data = data;
packet.len = 2048;
-
+
if (jitter->valid_bits)
{
/* Try decoding last received packet */
@@ -58,7 +58,7 @@ void speex_jitter_get(SpeexJitter *jitter, spx_int16_t *out, int *current_timest
}
ret = jitter_buffer_get(jitter->packets, &packet, jitter->frame_size, NULL);
-
+
if (ret != JITTER_BUFFER_OK)
{
/* No packet found */
diff --git a/speexclient/speexclient.c b/speexclient/speexclient.c
index cb375c9..116befe 100644
--- a/speexclient/speexclient.c
+++ b/speexclient/speexclient.c
@@ -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
@@ -29,9 +29,9 @@
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
+
****************************************************************************/
-
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -62,7 +62,7 @@
int main(int argc, char *argv[])
{
-
+
int sd, rc, n;
int i;
struct sockaddr_in cliAddr, remoteAddr;
@@ -80,7 +80,7 @@ int main(int argc, char *argv[])
fprintf(stderr, "wrong options\n");
exit(1);
}
-
+
h = gethostbyname(argv[2]);
if(h==NULL) {
fprintf(stderr, "%s: unknown host '%s' \n", argv[0], argv[1]);
@@ -89,7 +89,7 @@ int main(int argc, char *argv[])
local_port = atoi(argv[3]);
remote_port = atoi(argv[4]);
-
+
printf("%s: sending data to '%s' (IP : %s) \n", argv[0], h->h_name,
inet_ntoa(*(struct in_addr *)h->h_addr_list[0]));
@@ -119,7 +119,7 @@ int main(int argc, char *argv[])
/* Setup audio device */
audio_dev = alsa_device_open(argv[1], SAMPLING_RATE, 1, FRAME_SIZE);
-
+
/* Setup the encoder and decoder in wideband */
void *enc_state, *dec_state;
enc_state = speex_encoder_init(&speex_wb_mode);
@@ -133,8 +133,8 @@ int main(int argc, char *argv[])
SpeexBits enc_bits, dec_bits;
speex_bits_init(&enc_bits);
speex_bits_init(&dec_bits);
-
-
+
+
struct sched_param param;
/*param.sched_priority = 40; */
param.sched_priority = sched_get_priority_min(SCHED_FIFO);
@@ -143,7 +143,7 @@ int main(int argc, char *argv[])
int send_timestamp = 0;
int recv_started=0;
-
+
/* Setup all file descriptors for poll()ing */
nfds = alsa_device_nfds(audio_dev);
pfds = malloc(sizeof(*pfds)*(nfds+1));
@@ -154,7 +154,7 @@ int main(int argc, char *argv[])
/* Setup jitter buffer using decoder */
SpeexJitter jitter;
speex_jitter_init(&jitter, dec_state, SAMPLING_RATE);
-
+
/* Echo canceller with 200 ms tail length */
SpeexEchoState *echo_state = speex_echo_state_init(FRAME_SIZE, 10*FRAME_SIZE);
tmp = SAMPLING_RATE;
@@ -163,9 +163,9 @@ int main(int argc, char *argv[])
/* Setup preprocessor and associate with echo canceller for residual echo suppression */
preprocess = speex_preprocess_state_init(FRAME_SIZE, SAMPLING_RATE);
speex_preprocess_ctl(preprocess, SPEEX_PREPROCESS_SET_ECHO_STATE, echo_state);
-
+
alsa_device_start(audio_dev);
-
+
/* Infinite loop on capture, playback and receiving packets */
while (1)
{
@@ -178,8 +178,8 @@ int main(int argc, char *argv[])
n = recv(sd, msg, MAX_MSG, 0);
int recv_timestamp = ((int*)msg)[1];
int payload = ((int*)msg)[0];
-
- if ((payload & 0x80000000) == 0)
+
+ if ((payload & 0x80000000) == 0)
{
/* Put content of the packet into the jitter buffer, except for the pseudo-header */
speex_jitter_put(&jitter, msg+8, n-8, recv_timestamp);
@@ -212,21 +212,21 @@ int main(int argc, char *argv[])
char outpacket[MAX_MSG];
/* Get audio from the soundcard */
alsa_device_read(audio_dev, pcm, FRAME_SIZE);
-
+
/* Perform echo cancellation */
speex_echo_capture(echo_state, pcm, pcm2);
for (i=0;i<FRAME_SIZE;i++)
pcm[i] = pcm2[i];
-
+
speex_bits_reset(&enc_bits);
-
+
/* Apply noise/echo suppression */
speex_preprocess_run(preprocess, pcm);
-
+
/* Encode */
speex_encode_int(enc_state, pcm, &enc_bits);
int packetSize = speex_bits_write(&enc_bits, outpacket+8, MAX_MSG);
-
+
/* Pseudo header: four null bytes and a 32-bit timestamp */
((int*)outpacket)[0] = htonl(0);
((int*)outpacket)[1] = send_timestamp;
@@ -234,14 +234,14 @@ int main(int argc, char *argv[])
rc = sendto(sd, outpacket, packetSize+8, 0,
(struct sockaddr *) &remoteAddr,
sizeof(remoteAddr));
-
+
if(rc<0) {
printf("cannot send audio data\n");
close(sd);
exit(1);
}
}
-
+
}
diff --git a/ti/config.h b/ti/config.h
index da4834c..0957472 100644
--- a/ti/config.h
+++ b/ti/config.h
@@ -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
@@ -37,7 +37,7 @@
#define EXPORT
/* Disable DC block if doing SNR testing */
-#define DISABLE_HIGHPASS
+#define DISABLE_HIGHPASS
/* Allow for 2 20ms narrowband blocks per frame, plus a couple of bytes */
#define MAX_CHARS_PER_FRAME (42/BYTES_PER_CHAR)
@@ -55,7 +55,7 @@
//#undef MANUAL_ALLOC
//#undef OS_SUPPORT_CUSTOM
-#if defined (CONFIG_TI_C54X) || defined (CONFIG_TI_C55X)
+#if defined (CONFIG_TI_C54X) || defined (CONFIG_TI_C55X)
//#define PRECISION16
// These values determined by analysis for 8kbps narrowband
diff --git a/ti/testenc-TI-C5x.c b/ti/testenc-TI-C5x.c
index 4d72644..6232762 100644
--- a/ti/testenc-TI-C5x.c
+++ b/ti/testenc-TI-C5x.c
@@ -8,18 +8,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
@@ -52,7 +52,7 @@
//#define TESTENC_BYTES_PER_FRAME 28 /* 11kbps */
//#define TESTENC_QUALITY 5 /* 11 kbps */
-/* For narrowband, QUALITY maps to these bit rates (see modes.c, manual.pdf)
+/* For narrowband, QUALITY maps to these bit rates (see modes.c, manual.pdf)
* {1, 8, 2, 3, 3, 4, 4, 5, 5, 6, 7}
* 0 -> 2150
* 1 -> 3950
@@ -72,12 +72,12 @@ extern long long spx_mips;
#include <math.h>
#ifdef MANUAL_ALLOC
-/* Take all Speex space from this private heap */
+/* Take all Speex space from this private heap */
/* This is useful for multichannel applications */
-#pragma DATA_SECTION(spxHeap, ".myheap");
+#pragma DATA_SECTION(spxHeap, ".myheap");
static char spxHeap[SPEEX_PERSIST_STACK_SIZE];
-#pragma DATA_SECTION(spxScratch, ".myheap");
+#pragma DATA_SECTION(spxScratch, ".myheap");
static char spxScratch[SPEEX_SCRATCH_STACK_SIZE];
char *spxGlobalHeapPtr, *spxGlobalHeapEnd;
@@ -88,7 +88,7 @@ void byte2word(short* pInBuf, short* pOutBuf, int nWords)
{
short *pIn, *pOut, sNext;
int i;
-
+
pIn = pInBuf;
pOut = pOutBuf;
for(i=0;i<nWords;i++)
@@ -97,12 +97,12 @@ void byte2word(short* pInBuf, short* pOutBuf, int nWords)
*pOut++ = (sNext & 0x00ff) | (*pIn++ << 8); // insert high byte
}
}
-
+
void word2byte(short* pInBuf, short* pOutBuf, int nWords)
{
short *pIn, *pOut;
int i;
-
+
pIn = pInBuf;
pOut = pOutBuf;
for(i=0;i<nWords;i++)
@@ -111,7 +111,7 @@ void word2byte(short* pInBuf, short* pOutBuf, int nWords)
*pOut++ = (short) ((unsigned short) *pIn++ >> 8);
}
}
-
+
void main()
{
char *outFile, *bitsFile;
@@ -140,7 +140,7 @@ void main()
spx_int32_t skip_group_delay;
SpeexCallback callback;
- /* C54xx defaults to max wait states, even for parts like C5416 with
+ /* C54xx defaults to max wait states, even for parts like C5416 with
larger internal memory. Need to force the wait state register to zero */
#ifdef CONFIG_TI_C54X
@@ -209,7 +209,7 @@ void main()
#endif
outFile = "c:\\speextrunktest\\samples\\maleout5x.snd";
fout = fopen(outFile, "wb+");
-
+
speex_bits_init(&bits);
#ifndef DECODE_ONLY
while (!feof(fin))
@@ -222,7 +222,7 @@ void main()
speex_bits_reset(&bits);
speex_encode_int(st, in_short, &bits);
- nbChars = speex_bits_write(&bits, cbits,
+ nbChars = speex_bits_write(&bits, cbits,
sizeof(cbits)*BYTES_PER_CHAR) /BYTES_PER_CHAR;
bitCount+=bits.nbBits;
@@ -260,7 +260,7 @@ void main()
rewind(fin);
rewind(fout);
- while ( FRAME_SIZE == fread(inout_byte, 2, FRAME_SIZE, fin))
+ while ( FRAME_SIZE == fread(inout_byte, 2, FRAME_SIZE, fin))
{
float s=0, e=0;
diff --git a/ti/testenc-TI-C64x.c b/ti/testenc-TI-C64x.c
index 8d6e97a..5902717 100644
--- a/ti/testenc-TI-C64x.c
+++ b/ti/testenc-TI-C64x.c
@@ -1,5 +1,5 @@
/* Copyright (C) 2005 Psi Systems, Inc.
- Author: Jean-Marc Valin
+ Author: Jean-Marc Valin
File: testenc-TI-C64x.c
Encoder/Decoder Loop Main file for TI TMS320C64xx processor
for use with TI Code Composer (TM) DSP development tools.
@@ -9,18 +9,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
@@ -50,7 +50,7 @@
//#define TESTENC_BYTES_PER_FRAME 28 /* 11kbps */
//#define TESTENC_QUALITY 5 /* 11 kbps */
-/* For narrowband, QUALITY maps to these bit rates (see modes.c, manual.pdf)
+/* For narrowband, QUALITY maps to these bit rates (see modes.c, manual.pdf)
* {1, 8, 2, 3, 3, 4, 4, 5, 5, 6, 7}
* 0 -> 2150
* 1 -> 3950
@@ -69,12 +69,12 @@ extern long long spx_mips;
#endif
#ifdef MANUAL_ALLOC
-/* Take all Speex space from this private heap */
+/* Take all Speex space from this private heap */
/* This is useful for multichannel applications */
-#pragma DATA_SECTION(spxHeap, ".myheap");
+#pragma DATA_SECTION(spxHeap, ".myheap");
static char spxHeap[SPEEX_PERSIST_STACK_SIZE];
-#pragma DATA_SECTION(spxScratch, ".myheap");
+#pragma DATA_SECTION(spxScratch, ".myheap");
static char spxScratch[SPEEX_SCRATCH_STACK_SIZE];
char *spxGlobalHeapPtr, *spxGlobalHeapEnd;
@@ -171,7 +171,7 @@ void main()
#endif
outFile = "c:\\speextrunktest\\samples\\maleout6x.snd";
fout = fopen(outFile, "wb+");
-
+
speex_bits_init(&bits);
#ifndef DECODE_ONLY
while (!feof(fin))
@@ -200,7 +200,7 @@ void main()
// bitCount+=160; /* only correct for 8kbps, but just for the printf */
bitCount+=bits.nbBits;
#endif
-
+
speex_decode_int(dec, &bits, out_short);
speex_bits_reset(&bits);
@@ -214,11 +214,11 @@ void main()
speex_encoder_destroy(st);
speex_decoder_destroy(dec);
-#ifdef CHECK_RESULT
+#ifdef CHECK_RESULT
rewind(fin);
rewind(fout);
- while ( FRAME_SIZE == fread(in_short, sizeof(short), FRAME_SIZE, fin)
+ while ( FRAME_SIZE == fread(in_short, sizeof(short), FRAME_SIZE, fin)
&&
FRAME_SIZE == fread(out_short, sizeof(short), FRAME_SIZE,fout) )
{
diff --git a/tmv/config.h b/tmv/config.h
index 0b68fb8..ea7abe1 100644
--- a/tmv/config.h
+++ b/tmv/config.h
@@ -19,23 +19,23 @@
#define TM_DEBUGMEM_ALIGNNMENT 1
-#define TM_PROFILE 1
-#define TM_PROFILE_FIRMEM16 0
-#define TM_PROFILE_IIRMEM16 0
-#define TM_PROFILE_FILTERMEM16 0
-#define TM_PROFILE_VQNBEST 0
-#define TM_PROFILE_VQNBESTSIGN 0
-#define TM_PROFILE_COMPUTEQUANTWEIGHTS 0
-#define TM_PROFILE_LSPQUANT 0
+#define TM_PROFILE 1
+#define TM_PROFILE_FIRMEM16 0
+#define TM_PROFILE_IIRMEM16 0
+#define TM_PROFILE_FILTERMEM16 0
+#define TM_PROFILE_VQNBEST 0
+#define TM_PROFILE_VQNBESTSIGN 0
+#define TM_PROFILE_COMPUTEQUANTWEIGHTS 0
+#define TM_PROFILE_LSPQUANT 0
#define TM_PROFILE_LSPWEIGHTQUANT 0
#define TM_PROFILE_LSPENFORCEMARGIN 0
#define TM_PROFILE_LSPTOLPC 0
-#define TM_PROFILE_INNERPROD 0
-#define TM_PROFILE_PITCHXCORR 0
-#define TM_PROFILE_LSP_INTERPOLATE 0
-#define TM_PROFILE_CHEBPOLYEVA 0
-#define TM_PROFILE_COMPUTEWEIGHTEDCODEBOOK 0
-#define TM_PROFILE_TARGETUPDATE 0
+#define TM_PROFILE_INNERPROD 0
+#define TM_PROFILE_PITCHXCORR 0
+#define TM_PROFILE_LSP_INTERPOLATE 0
+#define TM_PROFILE_CHEBPOLYEVA 0
+#define TM_PROFILE_COMPUTEWEIGHTEDCODEBOOK 0
+#define TM_PROFILE_TARGETUPDATE 0
#define TM_PROFILE_SPXAUTOCORR 0
#define TM_PROFILE_COMPUTEPITCHERROR 0
#define TM_PROFILE_COMPUTERMS16 0