summaryrefslogtreecommitdiff
path: root/gr-vocoder/lib
diff options
context:
space:
mode:
Diffstat (limited to 'gr-vocoder/lib')
-rw-r--r--gr-vocoder/lib/codec2/CMakeLists.txt2
-rw-r--r--gr-vocoder/lib/codec2/_kiss_fft_guts.h8
-rw-r--r--gr-vocoder/lib/codec2/c2dec.c2
-rw-r--r--gr-vocoder/lib/codec2/c2demo.c4
-rw-r--r--gr-vocoder/lib/codec2/c2enc.c2
-rw-r--r--gr-vocoder/lib/codec2/c2sim.c60
-rw-r--r--gr-vocoder/lib/codec2/codebook/lsp8910.txt128
-rw-r--r--gr-vocoder/lib/codec2/codec2.c74
-rw-r--r--gr-vocoder/lib/codec2/codec2.h2
-rw-r--r--gr-vocoder/lib/codec2/codec2_internal.h4
-rw-r--r--gr-vocoder/lib/codec2/comp.h8
-rw-r--r--gr-vocoder/lib/codec2/defines.h24
-rw-r--r--gr-vocoder/lib/codec2/dump.c54
-rw-r--r--gr-vocoder/lib/codec2/dump.h8
-rw-r--r--gr-vocoder/lib/codec2/fft.c32
-rw-r--r--gr-vocoder/lib/codec2/fft.h2
-rwxr-xr-xgr-vocoder/lib/codec2/fq20.sh2
-rw-r--r--gr-vocoder/lib/codec2/generate_codebook.c10
-rw-r--r--gr-vocoder/lib/codec2/globals.c12
-rw-r--r--gr-vocoder/lib/codec2/globals.h10
-rw-r--r--gr-vocoder/lib/codec2/interp.c86
-rw-r--r--gr-vocoder/lib/codec2/interp.h2
-rw-r--r--gr-vocoder/lib/codec2/kiss_fft.c20
-rw-r--r--gr-vocoder/lib/codec2/kiss_fft.h28
-rw-r--r--gr-vocoder/lib/codec2/lpc.c136
-rw-r--r--gr-vocoder/lib/codec2/lpc.h14
-rw-r--r--gr-vocoder/lib/codec2/lsp.c4
-rw-r--r--gr-vocoder/lib/codec2/nlp.c62
-rw-r--r--gr-vocoder/lib/codec2/nlp.h16
-rw-r--r--gr-vocoder/lib/codec2/pack.c4
-rw-r--r--gr-vocoder/lib/codec2/phase.c32
-rw-r--r--gr-vocoder/lib/codec2/phase.h14
-rw-r--r--gr-vocoder/lib/codec2/postfilter.c14
-rw-r--r--gr-vocoder/lib/codec2/postfilter.h8
-rw-r--r--gr-vocoder/lib/codec2/quantise.c194
-rw-r--r--gr-vocoder/lib/codec2/quantise.h24
-rw-r--r--gr-vocoder/lib/codec2/sine.c200
-rw-r--r--gr-vocoder/lib/codec2/sine.h10
-rw-r--r--gr-vocoder/lib/g7xx/g72x.h36
-rw-r--r--gr-vocoder/lib/gsm/README.gsm2
-rw-r--r--gr-vocoder/lib/gsm/add.c8
-rw-r--r--gr-vocoder/lib/gsm/code.c6
-rw-r--r--gr-vocoder/lib/gsm/debug.c2
-rw-r--r--gr-vocoder/lib/gsm/gsm.h2
-rw-r--r--gr-vocoder/lib/gsm/gsm_decode.c4
-rw-r--r--gr-vocoder/lib/gsm/gsm_explode.c6
-rw-r--r--gr-vocoder/lib/gsm/gsm_implode.c6
-rw-r--r--gr-vocoder/lib/gsm/gsm_option.c2
-rw-r--r--gr-vocoder/lib/gsm/long_term.c16
-rw-r--r--gr-vocoder/lib/gsm/lpc.c10
-rw-r--r--gr-vocoder/lib/gsm/preprocess.c6
-rw-r--r--gr-vocoder/lib/gsm/private.h10
-rw-r--r--gr-vocoder/lib/gsm/proto.h2
-rw-r--r--gr-vocoder/lib/gsm/rpe.c36
-rw-r--r--gr-vocoder/lib/gsm/short_term.c2
-rw-r--r--gr-vocoder/lib/gsm/table.c2
-rw-r--r--gr-vocoder/lib/vocoder_alaw_decode_bs.cc12
-rw-r--r--gr-vocoder/lib/vocoder_alaw_encode_sb.cc12
-rw-r--r--gr-vocoder/lib/vocoder_codec2_decode_ps.cc8
-rw-r--r--gr-vocoder/lib/vocoder_codec2_encode_sp.cc8
-rw-r--r--gr-vocoder/lib/vocoder_cvsd_decode_bs.cc64
-rw-r--r--gr-vocoder/lib/vocoder_cvsd_encode_sb.cc40
-rw-r--r--gr-vocoder/lib/vocoder_g721_decode_bs.cc12
-rw-r--r--gr-vocoder/lib/vocoder_g721_encode_sb.cc12
-rw-r--r--gr-vocoder/lib/vocoder_g723_24_decode_bs.cc12
-rw-r--r--gr-vocoder/lib/vocoder_g723_24_encode_sb.cc12
-rw-r--r--gr-vocoder/lib/vocoder_g723_40_decode_bs.cc12
-rw-r--r--gr-vocoder/lib/vocoder_g723_40_encode_sb.cc12
-rw-r--r--gr-vocoder/lib/vocoder_gsm_fr_decode_ps.cc8
-rw-r--r--gr-vocoder/lib/vocoder_gsm_fr_encode_sp.cc8
-rw-r--r--gr-vocoder/lib/vocoder_ulaw_decode_bs.cc12
-rw-r--r--gr-vocoder/lib/vocoder_ulaw_encode_sb.cc12
72 files changed, 865 insertions, 865 deletions
diff --git a/gr-vocoder/lib/codec2/CMakeLists.txt b/gr-vocoder/lib/codec2/CMakeLists.txt
index c9839bd96..95e9d256b 100644
--- a/gr-vocoder/lib/codec2/CMakeLists.txt
+++ b/gr-vocoder/lib/codec2/CMakeLists.txt
@@ -80,7 +80,7 @@ set(CODEBOOKSDVQ
${CMAKE_CURRENT_SOURCE_DIR}/codebook/dlsp2.txt
${CMAKE_CURRENT_SOURCE_DIR}/codebook/dlsp3.txt
${CMAKE_CURRENT_SOURCE_DIR}/codebook/dlsp4.txt
- ${CMAKE_CURRENT_SOURCE_DIR}/codebook/dlsp5.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/codebook/dlsp5.txt
)
add_custom_command(
diff --git a/gr-vocoder/lib/codec2/_kiss_fft_guts.h b/gr-vocoder/lib/codec2/_kiss_fft_guts.h
index ba6614440..f008a7b50 100644
--- a/gr-vocoder/lib/codec2/_kiss_fft_guts.h
+++ b/gr-vocoder/lib/codec2/_kiss_fft_guts.h
@@ -20,7 +20,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
#include <limits.h>
#define MAXFACTORS 32
-/* e.g. an fft of length 128 has 4 factors
+/* e.g. an fft of length 128 has 4 factors
as far as kissfft is concerned
4*4*4*2
*/
@@ -48,7 +48,7 @@ struct kiss_fft_state{
#define SAMP_MAX 2147483647
#else
# define FRACBITS 15
-# define SAMPPROD int32_t
+# define SAMPPROD int32_t
#define SAMP_MAX 32767
#endif
@@ -152,12 +152,12 @@ struct kiss_fft_state{
#ifdef KISS_FFT_USE_ALLOCA
// define this to allow use of alloca instead of malloc for temporary buffers
-// Temporary buffers are used in two case:
+// Temporary buffers are used in two case:
// 1. FFT sizes that have "bad" factors. i.e. not 2,3 and 5
// 2. "in-place" FFTs. Notice the quotes, since kissfft does not really do an in-place transform.
#include <alloca.h>
#define KISS_FFT_TMP_ALLOC(nbytes) alloca(nbytes)
-#define KISS_FFT_TMP_FREE(ptr)
+#define KISS_FFT_TMP_FREE(ptr)
#else
#define KISS_FFT_TMP_ALLOC(nbytes) KISS_FFT_MALLOC(nbytes)
#define KISS_FFT_TMP_FREE(ptr) KISS_FFT_FREE(ptr)
diff --git a/gr-vocoder/lib/codec2/c2dec.c b/gr-vocoder/lib/codec2/c2dec.c
index b866d04d6..3123e96fb 100644
--- a/gr-vocoder/lib/codec2/c2dec.c
+++ b/gr-vocoder/lib/codec2/c2dec.c
@@ -70,7 +70,7 @@ int main(int argc, char *argv[])
//buffering to occur
if (fout == stdout) fflush(stdout);
if (fin == stdin) fflush(stdin);
-
+
}
codec2_destroy(codec2);
diff --git a/gr-vocoder/lib/codec2/c2demo.c b/gr-vocoder/lib/codec2/c2demo.c
index efa8d6449..b9e17a78e 100644
--- a/gr-vocoder/lib/codec2/c2demo.c
+++ b/gr-vocoder/lib/codec2/c2demo.c
@@ -52,7 +52,7 @@ int main(int argc, char *argv[])
printf("usage: %s InputRawSpeechFile OutputRawSpeechFile\n", argv[0]);
exit(1);
}
-
+
if ( (fin = fopen(argv[1],"rb")) == NULL ) {
fprintf(stderr, "Error opening input speech file: %s: %s.\n",
argv[1], strerror(errno));
@@ -70,7 +70,7 @@ int main(int argc, char *argv[])
codec2 = codec2_create();
- while(fread(buf, sizeof(short), CODEC2_SAMPLES_PER_FRAME, fin) ==
+ while(fread(buf, sizeof(short), CODEC2_SAMPLES_PER_FRAME, fin) ==
CODEC2_SAMPLES_PER_FRAME) {
codec2_encode(codec2, bits, buf);
codec2_decode(codec2, buf, bits);
diff --git a/gr-vocoder/lib/codec2/c2enc.c b/gr-vocoder/lib/codec2/c2enc.c
index 4d1d019df..0e5b26cfd 100644
--- a/gr-vocoder/lib/codec2/c2enc.c
+++ b/gr-vocoder/lib/codec2/c2enc.c
@@ -47,7 +47,7 @@ int main(int argc, char *argv[])
printf("usage: %s InputRawspeechFile OutputBitFile\n", argv[0]);
exit(1);
}
-
+
if (strcmp(argv[1], "-") == 0) fin = stdin;
else if ( (fin = fopen(argv[1],"rb")) == NULL ) {
fprintf(stderr, "Error opening input bit file: %s: %s.\n",
diff --git a/gr-vocoder/lib/codec2/c2sim.c b/gr-vocoder/lib/codec2/c2sim.c
index bb49c7899..e335078b6 100644
--- a/gr-vocoder/lib/codec2/c2sim.c
+++ b/gr-vocoder/lib/codec2/c2sim.c
@@ -4,8 +4,8 @@
AUTHOR......: David Rowe
DATE CREATED: 20/8/2010
- Codec2 simulation. Combines encoder and decoder and allows switching in
- out various algorithms and quantisation steps.
+ Codec2 simulation. Combines encoder and decoder and allows switching in
+ out various algorithms and quantisation steps.
\*---------------------------------------------------------------------------*/
@@ -45,13 +45,13 @@
#include "interp.h"
/*---------------------------------------------------------------------------*\
-
- switch_present()
-
- Searches the command line arguments for a "switch". If the switch is
- found, returns the command line argument where it ws found, else returns
- NULL.
-
+
+ switch_present()
+
+ Searches the command line arguments for a "switch". If the switch is
+ found, returns the command line argument where it ws found, else returns
+ NULL.
+
\*---------------------------------------------------------------------------*/
int switch_present(sw,argc,argv)
@@ -71,9 +71,9 @@ register char *argv[]; /* array of command line arguments in string form */
void synth_one_frame(short buf[], MODEL *model, float Sn_[], float Pn[]);
/*---------------------------------------------------------------------------*\
-
- MAIN
-
+
+ MAIN
+
\*---------------------------------------------------------------------------*/
int main(int argc, char *argv[])
@@ -103,10 +103,10 @@ int main(int argc, char *argv[])
int lsp, lspd, lspdvq, lsp_quantiser;
float ak[LPC_MAX];
COMP Sw_[FFT_ENC];
- COMP Ew[FFT_ENC];
-
+ COMP Ew[FFT_ENC];
+
int dump;
-
+
int phase0;
float ex_phase[MAX_AMP+1];
@@ -129,7 +129,7 @@ int main(int argc, char *argv[])
float AresdB_prev[MAX_AMP];
for(i=0; i<MAX_AMP; i++)
- AresdB_prev[i] = 0.0;
+ AresdB_prev[i] = 0.0;
for(i=0; i<M; i++)
Sn[i] = 1.0;
@@ -201,12 +201,12 @@ int main(int argc, char *argv[])
if ((order < 4) || (order > 20)) {
fprintf(stderr, "Error in lpc order: %d\n", order);
exit(1);
- }
+ }
}
dump = switch_present("--dump",argc,argv);
#ifdef DUMP
- if (dump)
+ if (dump)
dump_on(argv[dump+1]);
#endif
@@ -264,7 +264,7 @@ int main(int argc, char *argv[])
//Sn[i+M-N] = hpf((float)buf[i], hpf_states);
Sn[i+M-N] = (float)buf[i];
}
-
+
/* Estimate pitch */
nlp(nlp_states,Sn,N,M,P_MIN,P_MAX,&pitch,Sw,&prev_Wo);
@@ -272,10 +272,10 @@ int main(int argc, char *argv[])
/* estimate model parameters */
- dft_speech(Sw, Sn, w);
+ dft_speech(Sw, Sn, w);
two_stage_pitch_refinement(&model, Sw);
estimate_amplitudes(&model, Sw, W);
-#ifdef DUMP
+#ifdef DUMP
dump_Sn(Sn); dump_Sw(Sw); dump_model(&model);
#endif
@@ -284,7 +284,7 @@ int main(int argc, char *argv[])
if (phase0) {
float Wn[M]; /* windowed speech samples */
float Rk[LPC_MAX+1]; /* autocorrelation coeffs */
-
+
#ifdef DUMP
dump_phase(&model.phi[0], model.L);
#endif
@@ -299,7 +299,7 @@ int main(int argc, char *argv[])
#ifdef DUMP
dump_ak(ak, LPC_ORD);
#endif
-
+
/* determine voicing */
snr = est_voicing_mbe(&model, Sw, W, Sw_, Ew, prev_Wo);
@@ -313,7 +313,7 @@ int main(int argc, char *argv[])
for(i=0; i<MAX_AMP; i++)
model.phi[i] = 0;
-
+
if (hand_voicing) {
fscanf(fvoicing,"%d\n",&model.voiced);
}
@@ -350,7 +350,7 @@ int main(int argc, char *argv[])
e = decode_energy(encode_energy(e));
model.Wo = decode_Wo(encode_Wo(model.Wo));
- aks_to_M2(ak, order, &model, e, &snr, 1);
+ aks_to_M2(ak, order, &model, e, &snr, 1);
apply_lpc_correction(&model);
sum_snr += snr;
#ifdef DUMP
@@ -371,7 +371,7 @@ int main(int argc, char *argv[])
/* option decimation to 20ms rate, which enables interpolation
routine to synthesise in between frame */
-
+
if (decimate) {
if (!phase0) {
printf("needs --phase0 to resample phase for interpolated Wo\n");
@@ -395,17 +395,17 @@ int main(int argc, char *argv[])
prev_lsps, prev_e, lsps, e, ak_interp);
apply_lpc_correction(&interp_model);
#endif
-
+
if (phase0)
phase_synth_zero_order(&interp_model, ak_interp, ex_phase,
- order);
+ order);
if (postfilt)
postfilter(&interp_model, &bg_est);
synth_one_frame(buf, &interp_model, Sn_, Pn);
if (fout != NULL) fwrite(buf,sizeof(short),N,fout);
if (phase0)
- phase_synth_zero_order(&model, ak, ex_phase, order);
+ phase_synth_zero_order(&model, ak, ex_phase, order);
if (postfilt)
postfilter(&model, &bg_est);
synth_one_frame(buf, &model, Sn_, Pn);
@@ -422,7 +422,7 @@ int main(int argc, char *argv[])
}
else {
if (phase0)
- phase_synth_zero_order(&model, ak, ex_phase, order);
+ phase_synth_zero_order(&model, ak, ex_phase, order);
if (postfilt)
postfilter(&model, &bg_est);
synth_one_frame(buf, &model, Sn_, Pn);
diff --git a/gr-vocoder/lib/codec2/codebook/lsp8910.txt b/gr-vocoder/lib/codec2/codebook/lsp8910.txt
index 93cfdd81d..759136bfe 100644
--- a/gr-vocoder/lib/codec2/codebook/lsp8910.txt
+++ b/gr-vocoder/lib/codec2/codebook/lsp8910.txt
@@ -1,65 +1,65 @@
3 64
-2.048073 2.534502 2.645915
-2.019670 2.269744 2.605462
-1.961101 2.329646 2.562857
-1.968573 2.532712 2.616918
-2.183480 2.514381 2.629582
-2.259379 2.516615 2.620410
-2.172791 2.462460 2.567064
-2.097666 2.303933 2.421685
-2.052990 2.353242 2.546992
-2.043642 2.232362 2.499262
-2.106151 2.393131 2.488401
-2.099167 2.437862 2.558655
-2.013877 2.422875 2.530071
-2.033848 2.483776 2.584598
-2.114474 2.516856 2.602372
-2.229214 2.584056 2.678855
-2.131151 2.584299 2.674845
-1.472721 2.477091 2.630241
-2.010907 2.598415 2.682989
-2.353653 2.524066 2.619773
-2.419897 2.623938 2.699605
-2.319080 2.602148 2.689044
-1.860342 2.503881 2.616576
-1.910517 2.386693 2.610126
-1.748689 2.371809 2.496542
-1.618495 2.403425 2.554956
-1.844073 2.437026 2.533443
-1.924810 2.388543 2.502698
-1.937227 2.258363 2.501697
-1.687554 2.209123 2.545239
-1.851950 2.278628 2.565632
-1.868154 2.330150 2.444883
-1.874180 2.213118 2.351940
-1.757311 2.030626 2.433836
-1.650306 2.152371 2.243421
-1.612794 1.884686 2.339313
-1.745431 2.278895 2.389449
-1.590923 2.304155 2.408510
-1.475982 2.275548 2.509897
-1.508695 2.045463 2.455520
-1.872054 2.061777 2.246202
-1.983947 2.159155 2.445535
-1.745180 2.483765 2.593698
-1.900116 2.079600 2.407479
-1.841672 2.167042 2.486827
-1.932912 2.148464 2.569850
-2.134174 2.363673 2.584252
-2.106094 2.450645 2.638417
-1.954135 2.460313 2.666512
-1.907634 2.573801 2.674025
-1.625579 2.539569 2.656363
-1.785866 2.572616 2.676082
-1.798447 2.376454 2.624298
-2.020033 2.397244 2.619868
-1.946581 2.468791 2.564185
-2.008920 2.342400 2.469132
-1.983846 2.271044 2.395408
-1.988039 2.154150 2.317920
-2.077197 2.216622 2.389101
-2.117255 2.283907 2.512242
-2.177233 2.334622 2.458268
-2.214655 2.425510 2.620013
-2.199931 2.390272 2.520731
-2.271755 2.448682 2.552649
+2.048073 2.534502 2.645915
+2.019670 2.269744 2.605462
+1.961101 2.329646 2.562857
+1.968573 2.532712 2.616918
+2.183480 2.514381 2.629582
+2.259379 2.516615 2.620410
+2.172791 2.462460 2.567064
+2.097666 2.303933 2.421685
+2.052990 2.353242 2.546992
+2.043642 2.232362 2.499262
+2.106151 2.393131 2.488401
+2.099167 2.437862 2.558655
+2.013877 2.422875 2.530071
+2.033848 2.483776 2.584598
+2.114474 2.516856 2.602372
+2.229214 2.584056 2.678855
+2.131151 2.584299 2.674845
+1.472721 2.477091 2.630241
+2.010907 2.598415 2.682989
+2.353653 2.524066 2.619773
+2.419897 2.623938 2.699605
+2.319080 2.602148 2.689044
+1.860342 2.503881 2.616576
+1.910517 2.386693 2.610126
+1.748689 2.371809 2.496542
+1.618495 2.403425 2.554956
+1.844073 2.437026 2.533443
+1.924810 2.388543 2.502698
+1.937227 2.258363 2.501697
+1.687554 2.209123 2.545239
+1.851950 2.278628 2.565632
+1.868154 2.330150 2.444883
+1.874180 2.213118 2.351940
+1.757311 2.030626 2.433836
+1.650306 2.152371 2.243421
+1.612794 1.884686 2.339313
+1.745431 2.278895 2.389449
+1.590923 2.304155 2.408510
+1.475982 2.275548 2.509897
+1.508695 2.045463 2.455520
+1.872054 2.061777 2.246202
+1.983947 2.159155 2.445535
+1.745180 2.483765 2.593698
+1.900116 2.079600 2.407479
+1.841672 2.167042 2.486827
+1.932912 2.148464 2.569850
+2.134174 2.363673 2.584252
+2.106094 2.450645 2.638417
+1.954135 2.460313 2.666512
+1.907634 2.573801 2.674025
+1.625579 2.539569 2.656363
+1.785866 2.572616 2.676082
+1.798447 2.376454 2.624298
+2.020033 2.397244 2.619868
+1.946581 2.468791 2.564185
+2.008920 2.342400 2.469132
+1.983846 2.271044 2.395408
+1.988039 2.154150 2.317920
+2.077197 2.216622 2.389101
+2.117255 2.283907 2.512242
+2.177233 2.334622 2.458268
+2.214655 2.425510 2.620013
+2.199931 2.390272 2.520731
+2.271755 2.448682 2.552649
diff --git a/gr-vocoder/lib/codec2/codec2.c b/gr-vocoder/lib/codec2/codec2.c
index 92708ee32..93ea9208c 100644
--- a/gr-vocoder/lib/codec2/codec2.c
+++ b/gr-vocoder/lib/codec2/codec2.c
@@ -4,7 +4,7 @@
AUTHOR......: David Rowe
DATE CREATED: 21/8/2010
- Codec2 fully quantised encoder and decoder functions. If you want use
+ Codec2 fully quantised encoder and decoder functions. If you want use
codec2, the codec2_xxx functions are for you.
\*---------------------------------------------------------------------------*/
@@ -45,16 +45,16 @@
#include "codec2_internal.h"
/*---------------------------------------------------------------------------*\
-
+
FUNCTIONS
\*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*\
-
- FUNCTION....: codec2_create
- AUTHOR......: David Rowe
- DATE CREATED: 21/8/2010
+
+ FUNCTION....: codec2_create
+ AUTHOR......: David Rowe
+ DATE CREATED: 21/8/2010
Create and initialise an instance of the codec. Returns a pointer
to the codec states or NULL on failure. One set of states is
@@ -106,10 +106,10 @@ void *codec2_create()
}
/*---------------------------------------------------------------------------*\
-
- FUNCTION....: codec2_create
- AUTHOR......: David Rowe
- DATE CREATED: 21/8/2010
+
+ FUNCTION....: codec2_create
+ AUTHOR......: David Rowe
+ DATE CREATED: 21/8/2010
Destroy an instance of the codec.
@@ -118,7 +118,7 @@ void *codec2_create()
void codec2_destroy(void *codec2_state)
{
CODEC2 *c2;
-
+
assert(codec2_state != NULL);
c2 = (CODEC2*)codec2_state;
nlp_destroy(c2->nlp);
@@ -126,12 +126,12 @@ void codec2_destroy(void *codec2_state)
}
/*---------------------------------------------------------------------------*\
-
- FUNCTION....: codec2_encode
- AUTHOR......: David Rowe
- DATE CREATED: 21/8/2010
- Encodes 160 speech samples (20ms of speech) into 51 bits.
+ FUNCTION....: codec2_encode
+ AUTHOR......: David Rowe
+ DATE CREATED: 21/8/2010
+
+ Encodes 160 speech samples (20ms of speech) into 51 bits.
The codec2 algorithm actually operates internally on 10ms (80
sample) frames, so we run the encoding algorithm twice. On the
@@ -148,7 +148,7 @@ void codec2_destroy(void *codec2_state)
Wo (fundamental frequnecy) 7
Voicing (10ms update) 2
TOTAL 51
-
+
\*---------------------------------------------------------------------------*/
void codec2_encode(void *codec2_state, unsigned char * bits, short speech[])
@@ -174,13 +174,13 @@ void codec2_encode(void *codec2_state, unsigned char * bits, short speech[])
analyse_one_frame(c2, &model, &speech[N]);
voiced2 = model.voiced;
-
+
Wo_index = encode_Wo(model.Wo);
- encode_amplitudes(lsp_indexes,
+ encode_amplitudes(lsp_indexes,
&energy_index,
- &model,
- c2->Sn,
- c2->w);
+ &model,
+ c2->Sn,
+ c2->w);
memset(bits, '\0', ((CODEC2_BITS_PER_FRAME + 7) / 8));
pack(bits, &nbit, Wo_index, WO_BITS);
for(i=0; i<LPC_ORD; i++) {
@@ -189,15 +189,15 @@ void codec2_encode(void *codec2_state, unsigned char * bits, short speech[])
pack(bits, &nbit, energy_index, E_BITS);
pack(bits, &nbit, voiced1, 1);
pack(bits, &nbit, voiced2, 1);
-
+
assert(nbit == CODEC2_BITS_PER_FRAME);
}
/*---------------------------------------------------------------------------*\
-
- FUNCTION....: codec2_decode
- AUTHOR......: David Rowe
- DATE CREATED: 21/8/2010
+
+ FUNCTION....: codec2_decode
+ AUTHOR......: David Rowe
+ DATE CREATED: 21/8/2010
Decodes frames of 51 bits into 160 samples (20ms) of speech.
@@ -239,7 +239,7 @@ void codec2_decode(void *codec2_state, short speech[],
model.Wo = decode_Wo(Wo_index);
model.L = PI/model.Wo;
memset(&model.A, 0, (model.L+1)*sizeof(model.A[0]));
- decode_amplitudes(&model,
+ decode_amplitudes(&model,
ak,
lsp_indexes,
energy_index,
@@ -270,10 +270,10 @@ void codec2_decode(void *codec2_state, short speech[],
}
/*---------------------------------------------------------------------------*\
-
- FUNCTION....: synthesise_one_frame()
- AUTHOR......: David Rowe
- DATE CREATED: 23/8/2010
+
+ FUNCTION....: synthesise_one_frame()
+ AUTHOR......: David Rowe
+ DATE CREATED: 23/8/2010
Synthesise 80 speech samples (10ms) from model parameters.
@@ -299,14 +299,14 @@ void synthesise_one_frame(CODEC2 *c2, short speech[], MODEL *model, float ak[])
}
/*---------------------------------------------------------------------------*\
-
- FUNCTION....: analyse_one_frame()
- AUTHOR......: David Rowe
- DATE CREATED: 23/8/2010
+
+ FUNCTION....: analyse_one_frame()
+ AUTHOR......: David Rowe
+ DATE CREATED: 23/8/2010
Extract sinusoidal model parameters from 80 speech samples (10ms of
speech).
-
+
\*---------------------------------------------------------------------------*/
void analyse_one_frame(CODEC2 *c2, MODEL *model, short speech[])
diff --git a/gr-vocoder/lib/codec2/codec2.h b/gr-vocoder/lib/codec2/codec2.h
index 946dedca5..88e68814f 100644
--- a/gr-vocoder/lib/codec2/codec2.h
+++ b/gr-vocoder/lib/codec2/codec2.h
@@ -4,7 +4,7 @@
AUTHOR......: David Rowe
DATE CREATED: 21/8/2010
- Codec2 fully quantised encoder and decoder functions. If you want use
+ Codec2 fully quantised encoder and decoder functions. If you want use
codec2, these are the functions you need to call.
\*---------------------------------------------------------------------------*/
diff --git a/gr-vocoder/lib/codec2/codec2_internal.h b/gr-vocoder/lib/codec2/codec2_internal.h
index 3943ac29d..3aa5300b1 100644
--- a/gr-vocoder/lib/codec2/codec2_internal.h
+++ b/gr-vocoder/lib/codec2/codec2_internal.h
@@ -30,7 +30,7 @@
#define __CODEC2_INTERNAL__
/*---------------------------------------------------------------------------*\
-
+
STATES
\*---------------------------------------------------------------------------*/
@@ -52,7 +52,7 @@ typedef struct {
} CODEC2;
/*---------------------------------------------------------------------------*\
-
+
FUNCTION HEADERS
\*---------------------------------------------------------------------------*/
diff --git a/gr-vocoder/lib/codec2/comp.h b/gr-vocoder/lib/codec2/comp.h
index cedcab37f..ffc20c163 100644
--- a/gr-vocoder/lib/codec2/comp.h
+++ b/gr-vocoder/lib/codec2/comp.h
@@ -1,11 +1,11 @@
/*---------------------------------------------------------------------------*\
-
+
FILE........: comp.h
- AUTHOR......: David Rowe
+ AUTHOR......: David Rowe
DATE CREATED: 24/08/09
-
+
Complex number definition.
-
+
\*---------------------------------------------------------------------------*/
/*
diff --git a/gr-vocoder/lib/codec2/defines.h b/gr-vocoder/lib/codec2/defines.h
index 2dcd527d3..75064fae1 100644
--- a/gr-vocoder/lib/codec2/defines.h
+++ b/gr-vocoder/lib/codec2/defines.h
@@ -1,11 +1,11 @@
/*---------------------------------------------------------------------------*\
- FILE........: defines.h
- AUTHOR......: David Rowe
- DATE CREATED: 23/4/93
-
- Defines and structures used throughout the codec.
-
+ FILE........: defines.h
+ AUTHOR......: David Rowe
+ DATE CREATED: 23/4/93
+
+ Defines and structures used throughout the codec.
+
\*---------------------------------------------------------------------------*/
/*
@@ -29,9 +29,9 @@
#define __DEFINES__
/*---------------------------------------------------------------------------*\
-
- DEFINES
-
+
+ DEFINES
+
\*---------------------------------------------------------------------------*/
/* General defines */
@@ -58,9 +58,9 @@
#define P_MAX 160 /* maximum pitch */
/*---------------------------------------------------------------------------*\
-
- TYPEDEFS
-
+
+ TYPEDEFS
+
\*---------------------------------------------------------------------------*/
/* Structure to hold model parameters for one frame */
diff --git a/gr-vocoder/lib/codec2/dump.c b/gr-vocoder/lib/codec2/dump.c
index 73a378e23..1dc34c858 100644
--- a/gr-vocoder/lib/codec2/dump.c
+++ b/gr-vocoder/lib/codec2/dump.c
@@ -1,9 +1,9 @@
/*---------------------------------------------------------------------------*\
-
+
FILE........: dump.c
- AUTHOR......: David Rowe
- DATE CREATED: 25/8/09
-
+ AUTHOR......: David Rowe
+ DATE CREATED: 25/8/09
+
Routines to dump data to text files for Octave analysis.
\*---------------------------------------------------------------------------*/
@@ -123,10 +123,10 @@ void dump_Sn(float Sn[]) {
for(i=0; i<M/2; i++)
fprintf(fsn,"%f\t",Sn[i]);
- fprintf(fsn,"\n");
+ fprintf(fsn,"\n");
for(i=M/2; i<M; i++)
fprintf(fsn,"%f\t",Sn[i]);
- fprintf(fsn,"\n");
+ fprintf(fsn,"\n");
}
void dump_Sw(COMP Sw[]) {
@@ -144,7 +144,7 @@ void dump_Sw(COMP Sw[]) {
for(i=0; i<FFT_ENC/2; i++)
fprintf(fsw,"%f\t",
10.0*log10(Sw[i].real*Sw[i].real + Sw[i].imag*Sw[i].imag));
- fprintf(fsw,"\n");
+ fprintf(fsw,"\n");
}
void dump_Sw_(COMP Sw_[]) {
@@ -162,7 +162,7 @@ void dump_Sw_(COMP Sw_[]) {
for(i=0; i<FFT_ENC/2; i++)
fprintf(fsw_,"%f\t",
10.0*log10(Sw_[i].real*Sw_[i].real + Sw_[i].imag*Sw_[i].imag));
- fprintf(fsw_,"\n");
+ fprintf(fsw_,"\n");
}
void dump_Ew(COMP Ew[]) {
@@ -180,7 +180,7 @@ void dump_Ew(COMP Ew[]) {
for(i=0; i<FFT_ENC/2; i++)
fprintf(few,"%f\t",
10.0*log10(Ew[i].real*Ew[i].real + Ew[i].imag*Ew[i].imag));
- fprintf(few,"\n");
+ fprintf(few,"\n");
}
void dump_model(MODEL *model) {
@@ -195,13 +195,13 @@ void dump_model(MODEL *model) {
assert(fmodel != NULL);
}
- fprintf(fmodel,"%f\t%d\t", model->Wo, model->L);
+ fprintf(fmodel,"%f\t%d\t", model->Wo, model->L);
for(l=1; l<=model->L; l++)
fprintf(fmodel,"%f\t",model->A[l]);
for(l=model->L+1; l<MAX_AMP; l++)
fprintf(fmodel,"0.0\t");
fprintf(fmodel,"%d\t",model->voiced);
- fprintf(fmodel,"\n");
+ fprintf(fmodel,"\n");
}
void dump_quantised_model(MODEL *model) {
@@ -216,12 +216,12 @@ void dump_quantised_model(MODEL *model) {
assert(fqmodel != NULL);
}
- fprintf(fqmodel,"%f\t%d\t", model->Wo, model->L);
+ fprintf(fqmodel,"%f\t%d\t", model->Wo, model->L);
for(l=1; l<=model->L; l++)
fprintf(fqmodel,"%f\t",model->A[l]);
for(l=model->L+1; l<MAX_AMP; l++)
fprintf(fqmodel,"0.0\t");
- fprintf(fqmodel,"\n");
+ fprintf(fqmodel,"\n");
}
void dump_resample(float w[], float A[], int n) {
@@ -241,7 +241,7 @@ void dump_resample(float w[], float A[], int n) {
fprintf(fres,"%f\t",w[l]);
for(l=0; l<n; l++)
fprintf(fres,"%f\t",A[l]);
- fprintf(fres,"\n");
+ fprintf(fres,"\n");
}
void dump_phase(float phase[], int L) {
@@ -260,7 +260,7 @@ void dump_phase(float phase[], int L) {
fprintf(fphase,"%f\t",phase[l]);
for(l=L+1; l<MAX_AMP; l++)
fprintf(fphase,"%f\t",0.0);
- fprintf(fphase,"\n");
+ fprintf(fphase,"\n");
}
void dump_phase_(float phase_[], int L) {
@@ -279,7 +279,7 @@ void dump_phase_(float phase_[], int L) {
fprintf(fphase_,"%f\t",phase_[l]);
for(l=L+1; l<MAX_AMP; l++)
fprintf(fphase_,"%f\t",0.0);
- fprintf(fphase_,"\n");
+ fprintf(fphase_,"\n");
}
void dump_snr(float snr) {
@@ -310,7 +310,7 @@ void dump_Pw(COMP Pw[]) {
for(i=0; i<FFT_DEC/2; i++)
fprintf(fpw,"%f\t",Pw[i].real);
- fprintf(fpw,"\n");
+ fprintf(fpw,"\n");
}
void dump_lsp(float lsp[]) {
@@ -327,7 +327,7 @@ void dump_lsp(float lsp[]) {
for(i=0; i<10; i++)
fprintf(flsp,"%f\t",lsp[i]);
- fprintf(flsp,"\n");
+ fprintf(flsp,"\n");
}
void dump_ak(float ak[], int order) {
@@ -344,7 +344,7 @@ void dump_ak(float ak[], int order) {
for(i=0; i<=order; i++)
fprintf(fak,"%f\t",ak[i]);
- fprintf(fak,"\n");
+ fprintf(fak,"\n");
}
void dump_Fw(COMP Fw[]) {
@@ -361,7 +361,7 @@ void dump_Fw(COMP Fw[]) {
for(i=0; i<256; i++)
fprintf(ffw,"%f\t",Fw[i].real);
- fprintf(ffw,"\n");
+ fprintf(ffw,"\n");
}
void dump_e(float e_hz[]) {
@@ -378,10 +378,10 @@ void dump_e(float e_hz[]) {
for(i=0; i<500/2; i++)
fprintf(fe,"%f\t",e_hz[i]);
- fprintf(fe,"\n");
+ fprintf(fe,"\n");
for(i=500/2; i<500; i++)
fprintf(fe,"%f\t",e_hz[i]);
- fprintf(fe,"\n");
+ fprintf(fe,"\n");
}
void dump_sq(float sq[]) {
@@ -398,10 +398,10 @@ void dump_sq(float sq[]) {
for(i=0; i<M/2; i++)
fprintf(fsq,"%f\t",sq[i]);
- fprintf(fsq,"\n");
+ fprintf(fsq,"\n");
for(i=M/2; i<M; i++)
fprintf(fsq,"%f\t",sq[i]);
- fprintf(fsq,"\n");
+ fprintf(fsq,"\n");
}
void dump_dec(COMP Fw[]) {
@@ -418,7 +418,7 @@ void dump_dec(COMP Fw[]) {
for(i=0; i<320/5; i++)
fprintf(fdec,"%f\t",Fw[i].real);
- fprintf(fdec,"\n");
+ fprintf(fdec,"\n");
}
void dump_bg(float e, float bg_est, float percent_uv) {
@@ -432,7 +432,7 @@ void dump_bg(float e, float bg_est, float percent_uv) {
assert(fbg != NULL);
}
- fprintf(fbg,"%f\t%f\t%f\n", e, bg_est, percent_uv);
+ fprintf(fbg,"%f\t%f\t%f\n", e, bg_est, percent_uv);
}
void dump_E(float E) {
@@ -463,7 +463,7 @@ void dump_Rk(float Rk[]) {
for(i=0; i<P_MAX; i++)
fprintf(frk,"%f\t",Rk[i]);
- fprintf(frk,"\n");
+ fprintf(frk,"\n");
}
#endif
diff --git a/gr-vocoder/lib/codec2/dump.h b/gr-vocoder/lib/codec2/dump.h
index eeddd3406..4b92d009d 100644
--- a/gr-vocoder/lib/codec2/dump.h
+++ b/gr-vocoder/lib/codec2/dump.h
@@ -1,9 +1,9 @@
/*---------------------------------------------------------------------------*\
-
+
FILE........: dump.h
- AUTHOR......: David Rowe
- DATE CREATED: 25/8/09
-
+ AUTHOR......: David Rowe
+ DATE CREATED: 25/8/09
+
Routines to dump data to text files for Octave analysis.
\*---------------------------------------------------------------------------*/
diff --git a/gr-vocoder/lib/codec2/fft.c b/gr-vocoder/lib/codec2/fft.c
index a3027e4cd..19f3141a8 100644
--- a/gr-vocoder/lib/codec2/fft.c
+++ b/gr-vocoder/lib/codec2/fft.c
@@ -1,11 +1,11 @@
/*---------------------------------------------------------------------------*\
-
- FILE........: fft.c
- AUTHOR......: Bruce Robertson
- DATE CREATED: 20/11/2010
-
- Bridging function to the kiss_fft package.
-
+
+ FILE........: fft.c
+ AUTHOR......: Bruce Robertson
+ DATE CREATED: 20/11/2010
+
+ Bridging function to the kiss_fft package.
+
\*---------------------------------------------------------------------------*/
/*
@@ -29,9 +29,9 @@
#include "kiss_fft.h"
/*---------------------------------------------------------------------------*\
-
- GLOBALS
-
+
+ GLOBALS
+
\*---------------------------------------------------------------------------*/
kiss_fft_cpx *fin;
@@ -40,10 +40,10 @@ kiss_fft_cfg cfg_forward;
kiss_fft_cfg cfg_reverse;
/*---------------------------------------------------------------------------*\
-
- initialize_fft(int n)
-
- Initialisation function for kiss_fft. This assumes that all calls to fft()
+
+ initialize_fft(int n)
+
+ Initialisation function for kiss_fft. This assumes that all calls to fft()
use the same datatypes and are one arrays of the same size.
\*---------------------------------------------------------------------------*/
@@ -62,8 +62,8 @@ initialize_fft (int n)
}
/*---------------------------------------------------------------------------*\
-
- fft(float x[], int n, int isign)
+
+ fft(float x[], int n, int isign)
Function that calls kiss_fft with the signature of four1 from NRC.
\*---------------------------------------------------------------------------*/
diff --git a/gr-vocoder/lib/codec2/fft.h b/gr-vocoder/lib/codec2/fft.h
index 84c6737bd..d5f83045e 100644
--- a/gr-vocoder/lib/codec2/fft.h
+++ b/gr-vocoder/lib/codec2/fft.h
@@ -1,5 +1,5 @@
/*---------------------------------------------------------------------------*\
-
+
FILE........: fft.h
AUTHOR......: Bruce Robertson
DATE CREATED: 29/11/2010
diff --git a/gr-vocoder/lib/codec2/fq20.sh b/gr-vocoder/lib/codec2/fq20.sh
index b83784b43..9ccf739dc 100755
--- a/gr-vocoder/lib/codec2/fq20.sh
+++ b/gr-vocoder/lib/codec2/fq20.sh
@@ -1,7 +1,7 @@
#!/bin/sh
# fq20.shsh
# David Rowe 27 July 2010
-#
+#
# Decode a file with fully quantised codec at 20ms frame rate
../src/sinedec ../raw/$1.raw $1.mdl -o $1_phase0_lsp_20_EWo2.raw --phase 0 --lpc 10 --lsp --postfilter --dec
diff --git a/gr-vocoder/lib/codec2/generate_codebook.c b/gr-vocoder/lib/codec2/generate_codebook.c
index 0bea80d85..705f29d38 100644
--- a/gr-vocoder/lib/codec2/generate_codebook.c
+++ b/gr-vocoder/lib/codec2/generate_codebook.c
@@ -1,9 +1,9 @@
/*---------------------------------------------------------------------------*\
-
+
FILE........: generate_codebook.c
- AUTHOR......: Bruce Perens
- DATE CREATED: 29 Sep 2010
-
+ AUTHOR......: Bruce Perens
+ DATE CREATED: 29 Sep 2010
+
Generate header files containing LSP quantisers, runs at compile time.
\*---------------------------------------------------------------------------*/
@@ -92,7 +92,7 @@ get_float(FILE * in, const char * name, char * * cursor, char * buffer,
while ( (c = *s) != '\0' && !isdigit(c) && c != '-' && c != '.' )
s++;
-
+
/* Comments start with "#" and continue to the end of the line. */
if ( c != '\0' && c != '#' ) {
char * end = 0;
diff --git a/gr-vocoder/lib/codec2/globals.c b/gr-vocoder/lib/codec2/globals.c
index f2182f79a..da2faf722 100644
--- a/gr-vocoder/lib/codec2/globals.c
+++ b/gr-vocoder/lib/codec2/globals.c
@@ -1,11 +1,11 @@
/*---------------------------------------------------------------------------*\
-
+
FILE........: globals.c
- AUTHOR......: David Rowe
- DATE CREATED: 11/5/94
-
- Globals for sinusoidal speech coder.
-
+ AUTHOR......: David Rowe
+ DATE CREATED: 11/5/94
+
+ Globals for sinusoidal speech coder.
+
\*---------------------------------------------------------------------------*/
/*
diff --git a/gr-vocoder/lib/codec2/globals.h b/gr-vocoder/lib/codec2/globals.h
index cef720344..d01e7b4e9 100644
--- a/gr-vocoder/lib/codec2/globals.h
+++ b/gr-vocoder/lib/codec2/globals.h
@@ -1,11 +1,11 @@
/*---------------------------------------------------------------------------*\
-
+
FILE........: globals.h
AUTHOR......: David Rowe
- DATE CREATED: 1/11/94
-
- Globals for sinusoidal speech coder.
-
+ DATE CREATED: 1/11/94
+
+ Globals for sinusoidal speech coder.
+
\*---------------------------------------------------------------------------*/
/*
diff --git a/gr-vocoder/lib/codec2/interp.c b/gr-vocoder/lib/codec2/interp.c
index 257c4a81c..64372b050 100644
--- a/gr-vocoder/lib/codec2/interp.c
+++ b/gr-vocoder/lib/codec2/interp.c
@@ -41,10 +41,10 @@ float sample_log_amp(MODEL *model, float w);
/*---------------------------------------------------------------------------*\
- FUNCTION....: interp()
- AUTHOR......: David Rowe
- DATE CREATED: 22/8/10
-
+ FUNCTION....: interp()
+ AUTHOR......: David Rowe
+ DATE CREATED: 22/8/10
+
Given two frames decribed by model parameters 20ms apart, determines
the model parameters of the 10ms frame between them. Assumes
voicing is available for middle (interpolated) frame. Outputs are
@@ -58,7 +58,7 @@ float sample_log_amp(MODEL *model, float w);
When this function is used (--dec mode) bg noise appears to be
amplitude modulated, and gets louder. The interp_lsp() function
below seems to do a better job.
-
+
\*---------------------------------------------------------------------------*/
void interpolate(
@@ -97,13 +97,13 @@ void interpolate(
/*---------------------------------------------------------------------------*\
FUNCTION....: sample_log_amp()
- AUTHOR......: David Rowe
- DATE CREATED: 22/8/10
-
+ AUTHOR......: David Rowe
+ DATE CREATED: 22/8/10
+
Samples the amplitude envelope at an arbitrary frequency w. Uses
linear interpolation in the log domain to sample between harmonic
amplitudes.
-
+
\*---------------------------------------------------------------------------*/
float sample_log_amp(MODEL *model, float w)
@@ -125,9 +125,9 @@ float sample_log_amp(MODEL *model, float w)
log_amp = (1.0-f)*log10(model->A[model->L] + 1E-6);
}
else {
- log_amp = (1.0-f)*log10(model->A[m] + 1E-6) +
+ log_amp = (1.0-f)*log10(model->A[m] + 1E-6) +
f*log10(model->A[m+1] + 1E-6);
- //printf("m=%d A[m] %f A[m+1] %f x %f %f %f\n", m, model->A[m],
+ //printf("m=%d A[m] %f A[m+1] %f x %f %f %f\n", m, model->A[m],
// model->A[m+1], pow(10.0, log_amp),
// (1-f), f);
}
@@ -138,13 +138,13 @@ float sample_log_amp(MODEL *model, float w)
/*---------------------------------------------------------------------------*\
FUNCTION....: sample_log_amp_quad()
- AUTHOR......: David Rowe
- DATE CREATED: 9 March 2011
-
+ AUTHOR......: David Rowe
+ DATE CREATED: 9 March 2011
+
Samples the amplitude envelope at an arbitrary frequency w. Uses
quadratic interpolation in the log domain to sample between harmonic
amplitudes.
-
+
y(x) = ax*x + bx + c
We assume three points are x=-1, x=0, x=1, which we map to m-1,m,m+1
@@ -172,7 +172,7 @@ float sample_log_amp_quad(MODEL *model, float w)
log_amp = a*x*x + b*x + c;
//printf("m=%d A[m-1] %f A[m] %f A[m+1] %f w %f x %f log_amp %f\n", m,
- // model->A[m-1],
+ // model->A[m-1],
// model->A[m], model->A[m+1], w, x, pow(10.0, log_amp));
return log_amp;
}
@@ -180,14 +180,14 @@ float sample_log_amp_quad(MODEL *model, float w)
/*---------------------------------------------------------------------------*\
FUNCTION....: sample_log_amp_quad_nl()
- AUTHOR......: David Rowe
+ AUTHOR......: David Rowe
DATE CREATED: 10 March 2011
-
+
Samples the amplitude envelope at an arbitrary frequency w. Uses
quadratic interpolation in the log domain to sample between harmonic
amplitudes. This version can handle non-linear steps along a freq
axis defined by arbitrary steps.
-
+
y(x) = ax*x + bx + c
We assume three points are (x_1,y_1), (0,y0) and (x1,y1).
@@ -215,9 +215,9 @@ float sample_log_amp_quad_nl(
for (i=0; i<np; i++)
if (fabs(w[i] - w_sample) < best_dist) {
best_dist = fabs(w[i] - w_sample);
- m = i;
+ m = i;
}
-
+
/* stay one point away from edge of array */
if (m < 1) m = 1;
@@ -234,13 +234,13 @@ float sample_log_amp_quad_nl(
a = (y_1*x1 - y1*x_1 + c*x_1 - c*x1)/(x_1*x_1*x1 - x1*x1*x_1);
b = (y1 -a*x1*x1 - c)/x1;
x = w_sample - w[m];
-
+
//printf("%f %f %f\n", w[0], w[1], w[2]);
//printf("%f %f %f %f %f %f\n", x_1, y_1, 0.0, y0, x1, y1);
log_amp = a*x*x + b*x + c;
//printf("a %f b %f c %f\n", a, b, c);
//printf("m=%d A[m-1] %f A[m] %f A[m+1] %f w_sample %f w[m] %f x %f log_amp %f\n", m,
- // A[m-1],
+ // A[m-1],
// A[m], A[m+1], w_sample, w[m], x, log_amp);
//exit(0);
return log_amp;
@@ -254,20 +254,20 @@ float fres[] = {100, 200, 300, 400, 500, 600, 700, 800, 900, 1000,
/*---------------------------------------------------------------------------*\
FUNCTION....: resample_amp_nl()
- AUTHOR......: David Rowe
+ AUTHOR......: David Rowe
DATE CREATED: 7 March 2011
-
- Converts the current model with L {Am} samples spaced Wo apart to
+
+ Converts the current model with L {Am} samples spaced Wo apart to
RES_POINTS samples spaced Wo/RES_POINTS apart. Then subtracts
from the previous frames samples to get the delta.
\*---------------------------------------------------------------------------*/
-void resample_amp_fixed(MODEL *model,
+void resample_amp_fixed(MODEL *model,
float w[], float A[],
float wres[], float Ares[],
- float AresdB_prev[],
- float AresdB[],
+ float AresdB_prev[],
+ float AresdB[],
float deltat[])
{
int i;
@@ -280,7 +280,7 @@ void resample_amp_fixed(MODEL *model,
for(i=0; i<RES_POINTS; i++) {
wres[i] = fres[i]*PI/4000.0;
}
-
+
for(i=0; i<RES_POINTS; i++) {
Ares[i] = pow(10.0,sample_log_amp_quad_nl(w, A, model->L, wres[i]));
}
@@ -297,13 +297,13 @@ void resample_amp_fixed(MODEL *model,
/*---------------------------------------------------------------------------*\
FUNCTION....: resample_amp_nl()
- AUTHOR......: David Rowe
+ AUTHOR......: David Rowe
DATE CREATED: 7 March 2011
-
+
Converts the current model with L {Am} samples spaced Wo apart to M
samples spaced Wo/M apart. Then converts back to L {Am} samples.
used to prototype constant rate Amplitude encoding ideas.
-
+
Returns the SNR in dB.
\*---------------------------------------------------------------------------*/
@@ -346,7 +346,7 @@ float resample_amp_nl(MODEL *model, int m, float AresdB_prev[])
#endif
signal = noise = 0.0;
-
+
for(i=1; i<model->L; i++) {
new_A = pow(10.0,sample_log_amp_quad_nl(wres, Ares, RES_POINTS, model->Wo*i));
signal += pow(model->A[i], 2.0);
@@ -364,13 +364,13 @@ float resample_amp_nl(MODEL *model, int m, float AresdB_prev[])
/*---------------------------------------------------------------------------*\
FUNCTION....: resample_amp()
- AUTHOR......: David Rowe
+ AUTHOR......: David Rowe
DATE CREATED: 10 March 2011
-
+
Converts the current model with L {Am} samples spaced Wo apart to M
samples with a non-linear spacing. Then converts back to L {Am}
samples. used to prototype constant rate Amplitude encoding ideas.
-
+
Returns the SNR in dB.
\*---------------------------------------------------------------------------*/
@@ -394,7 +394,7 @@ float resample_amp(MODEL *model, int m)
//dump_resample(&model_m);
signal = noise = 0.0;
-
+
for(i=1; i<model->L/4; i++) {
new_A = pow(10,sample_log_amp_quad(&model_m, i*model->Wo));
signal += pow(model->A[i], 2.0);
@@ -411,10 +411,10 @@ float resample_amp(MODEL *model, int m)
/*---------------------------------------------------------------------------*\
- FUNCTION....: interp_lsp()
- AUTHOR......: David Rowe
+ FUNCTION....: interp_lsp()
+ AUTHOR......: David Rowe
DATE CREATED: 10 Nov 2010
-
+
Given two frames decribed by model parameters 20ms apart, determines
the model parameters of the 10ms frame between them. Assumes
voicing is available for middle (interpolated) frame. Outputs are
@@ -422,7 +422,7 @@ float resample_amp(MODEL *model, int m)
This version uses interpolation of LSPs, seems to do a better job
with bg noise.
-
+
\*---------------------------------------------------------------------------*/
void interpolate_lsp(
@@ -469,5 +469,5 @@ void interpolate_lsp(
/* convert back to amplitudes */
lsp_to_lpc(lsps, ak_interp, LPC_ORD);
- aks_to_M2(ak_interp, LPC_ORD, interp, e, &snr, 0);
+ aks_to_M2(ak_interp, LPC_ORD, interp, e, &snr, 0);
}
diff --git a/gr-vocoder/lib/codec2/interp.h b/gr-vocoder/lib/codec2/interp.h
index d41eac3f8..d50972614 100644
--- a/gr-vocoder/lib/codec2/interp.h
+++ b/gr-vocoder/lib/codec2/interp.h
@@ -31,7 +31,7 @@
#define RES_POINTS 20
void interpolate(MODEL *interp, MODEL *prev, MODEL *next);
-void interpolate_lsp(MODEL *interp, MODEL *prev, MODEL *next,
+void interpolate_lsp(MODEL *interp, MODEL *prev, MODEL *next,
float *prev_lsps, float prev_e,
float *next_lsps, float next_e,
float *ak_interp);
diff --git a/gr-vocoder/lib/codec2/kiss_fft.c b/gr-vocoder/lib/codec2/kiss_fft.c
index 465d6c97a..17b4e7211 100644
--- a/gr-vocoder/lib/codec2/kiss_fft.c
+++ b/gr-vocoder/lib/codec2/kiss_fft.c
@@ -250,7 +250,7 @@ void kf_work(
const kiss_fft_cpx * Fout_end = Fout + p*m;
#ifdef _OPENMP
- // use openmp extensions at the
+ // use openmp extensions at the
// top-level (not recursive)
if (fstride==1 && p<=5)
{
@@ -258,15 +258,15 @@ void kf_work(
// execute the p different work units in different threads
# pragma omp parallel for
- for (k=0;k<p;++k)
+ for (k=0;k<p;++k)
kf_work( Fout +k*m, f+ fstride*in_stride*k,fstride*p,in_stride,factors,st);
// all threads have joined by this point
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;
}
return;
@@ -282,7 +282,7 @@ void kf_work(
do{
// recursive call:
// DFT of size m*p performed by doing
- // p instances of smaller DFTs of size m,
+ // p instances of smaller DFTs of size m,
// each one takes a decimated version of the input
kf_work( Fout , f, fstride*p, in_stride, factors,st);
f += fstride*in_stride;
@@ -291,21 +291,21 @@ void kf_work(
Fout=Fout_beg;
- // recombine the p smaller DFTs
+ // recombine the p smaller DFTs
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;
}
}
/* 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;
diff --git a/gr-vocoder/lib/codec2/kiss_fft.h b/gr-vocoder/lib/codec2/kiss_fft.h
index 64c50f4aa..c01722cad 100644
--- a/gr-vocoder/lib/codec2/kiss_fft.h
+++ b/gr-vocoder/lib/codec2/kiss_fft.h
@@ -28,17 +28,17 @@ extern "C" {
# define kiss_fft_scalar __m128
#define KISS_FFT_MALLOC(nbytes) _mm_malloc(nbytes,16)
#define KISS_FFT_FREE _mm_free
-#else
+#else
#define KISS_FFT_MALLOC malloc
#define KISS_FFT_FREE free
-#endif
+#endif
#ifdef FIXED_POINT
-#include <sys/types.h>
+#include <sys/types.h>
# if (FIXED_POINT == 32)
# define kiss_fft_scalar int32_t
-# else
+# else
# define kiss_fft_scalar int16_t
# endif
#else
@@ -55,9 +55,9 @@ typedef struct {
typedef struct kiss_fft_state* kiss_fft_cfg;
-/*
+/*
* kiss_fft_alloc
- *
+ *
* Initialize a FFT (or IFFT) algorithm's cfg/state buffer.
*
* typical usage: kiss_fft_cfg mycfg=kiss_fft_alloc(1024,0,NULL,NULL);
@@ -67,18 +67,18 @@ typedef struct kiss_fft_state* kiss_fft_cfg;
*
* If lenmem is NULL, then kiss_fft_alloc will allocate a cfg buffer using malloc.
* The returned value should be free()d when done to avoid memory leaks.
- *
+ *
* The state can be placed in a user supplied buffer 'mem':
* If lenmem is not NULL and mem is not NULL and *lenmem is large enough,
* then the function places the cfg in mem and the size used in *lenmem
* and returns mem.
- *
+ *
* If lenmem is not NULL and ( mem is NULL or *lenmem is not large enough),
- * then the function returns NULL and places the minimum cfg
+ * then the function returns NULL and places the minimum cfg
* buffer size in *lenmem.
* */
-kiss_fft_cfg kiss_fft_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem);
+kiss_fft_cfg kiss_fft_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem);
/*
* kiss_fft(cfg,in_out_buf)
@@ -97,16 +97,16 @@ void kiss_fft(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout);
* */
void kiss_fft_stride(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout,int fin_stride);
-/* If kiss_fft_alloc allocated a buffer, it is one contiguous
+/* If kiss_fft_alloc allocated a buffer, it is one contiguous
buffer and can be simply free()d when no longer needed*/
#define kiss_fft_free free
/*
- Cleans up some memory that gets managed internally. Not necessary to call, but it might clean up
+ Cleans up some memory that gets managed internally. Not necessary to call, but it might clean up
your compiler output to call this before you exit.
*/
void kiss_fft_cleanup(void);
-
+
/*
* Returns the smallest integer k, such that k>=n and k has only "fast" factors (2,3,5)
@@ -118,7 +118,7 @@ int kiss_fft_next_fast_size(int n);
(kiss_fft_next_fast_size( ((n)+1)>>1)<<1)
#ifdef __cplusplus
-}
+}
#endif
#endif
diff --git a/gr-vocoder/lib/codec2/lpc.c b/gr-vocoder/lib/codec2/lpc.c
index ba8011377..1784f75ca 100644
--- a/gr-vocoder/lib/codec2/lpc.c
+++ b/gr-vocoder/lib/codec2/lpc.c
@@ -1,11 +1,11 @@
/*---------------------------------------------------------------------------*\
-
- FILE........: lpc.c
- AUTHOR......: David Rowe
- DATE CREATED: 30/9/90
-
- Linear Prediction functions written in C.
-
+
+ FILE........: lpc.c
+ AUTHOR......: David Rowe
+ DATE CREATED: 30/9/90
+
+ Linear Prediction functions written in C.
+
\*---------------------------------------------------------------------------*/
/*
@@ -34,11 +34,11 @@
#include "lpc.h"
/*---------------------------------------------------------------------------*\
-
- hanning_window()
-
- Hanning windows a frame of speech samples.
-
+
+ hanning_window()
+
+ Hanning windows a frame of speech samples.
+
\*---------------------------------------------------------------------------*/
void hanning_window(
@@ -54,12 +54,12 @@ void hanning_window(
}
/*---------------------------------------------------------------------------*\
-
- autocorrelate()
-
- Finds the first P autocorrelation values of an array of windowed speech
- samples Sn[].
-
+
+ autocorrelate()
+
+ Finds the first P autocorrelation values of an array of windowed speech
+ samples Sn[].
+
\*---------------------------------------------------------------------------*/
void autocorrelate(
@@ -79,12 +79,12 @@ void autocorrelate(
}
/*---------------------------------------------------------------------------*\
-
- autocorrelate_freq()
-
+
+ autocorrelate_freq()
+
Finds the first P autocorrelation values from an array of frequency domain
- power samples.
-
+ power samples.
+
\*---------------------------------------------------------------------------*/
void autocorrelate_freq(
@@ -106,18 +106,18 @@ void autocorrelate_freq(
}
/*---------------------------------------------------------------------------*\
-
- levinson_durbin()
-
- Given P+1 autocorrelation coefficients, finds P Linear Prediction Coeff.
+
+ levinson_durbin()
+
+ Given P+1 autocorrelation coefficients, finds P Linear Prediction Coeff.
(LPCs) where P is the order of the LPC all-pole model. The Levinson-Durbin
- algorithm is used, and is described in:
-
- J. Makhoul
- "Linear prediction, a tutorial review"
- Proceedings of the IEEE
- Vol-63, No. 4, April 1975
-
+ algorithm is used, and is described in:
+
+ J. Makhoul
+ "Linear prediction, a tutorial review"
+ Proceedings of the IEEE
+ Vol-63, No. 4, April 1975
+
\*---------------------------------------------------------------------------*/
void levinson_durbin(
@@ -152,18 +152,18 @@ void levinson_durbin(
for(i=1; i<=order; i++)
lpcs[i] = a[order][i];
- lpcs[0] = 1.0;
+ lpcs[0] = 1.0;
}
/*---------------------------------------------------------------------------*\
-
- inverse_filter()
-
+
+ inverse_filter()
+
Inverse Filter, A(z). Produces an array of residual samples from an array
- of input samples and linear prediction coefficients.
-
+ of input samples and linear prediction coefficients.
+
The filter memory is stored in the first order samples of the input array.
-
+
\*---------------------------------------------------------------------------*/
void inverse_filter(
@@ -180,26 +180,26 @@ void inverse_filter(
res[i] = 0.0;
for(j=0; j<=order; j++)
res[i] += Sn[i-j]*a[j];
- }
+ }
}
/*---------------------------------------------------------------------------*\
-
- synthesis_filter()
-
- C version of the Speech Synthesis Filter, 1/A(z). Given an array of
+
+ synthesis_filter()
+
+ C version of the Speech Synthesis Filter, 1/A(z). Given an array of
residual or excitation samples, and the the LP filter coefficients, this
function will produce an array of speech samples. This filter structure is
- IIR.
-
- The synthesis filter has memory as well, this is treated in the same way
- as the memory for the inverse filter (see inverse_filter() notes above).
- The difference is that the memory for the synthesis filter is stored in
+ IIR.
+
+ The synthesis filter has memory as well, this is treated in the same way
+ as the memory for the inverse filter (see inverse_filter() notes above).
+ The difference is that the memory for the synthesis filter is stored in
the output array, wheras the memory of the inverse filter is stored in the
- input array.
-
- Note: the calling function must update the filter memory.
-
+ input array.
+
+ Note: the calling function must update the filter memory.
+
\*---------------------------------------------------------------------------*/
void synthesis_filter(
@@ -222,12 +222,12 @@ void synthesis_filter(
}
/*---------------------------------------------------------------------------*\
-
- find_aks()
-
- This function takes a frame of samples, and determines the linear
- prediction coefficients for that frame of samples.
-
+
+ find_aks()
+
+ This function takes a frame of samples, and determines the linear
+ prediction coefficients for that frame of samples.
+
\*---------------------------------------------------------------------------*/
void find_aks(
@@ -257,11 +257,11 @@ void find_aks(
}
/*---------------------------------------------------------------------------*\
-
- weight()
-
- Weights a vector of LPCs.
-
+
+ weight()
+
+ Weights a vector of LPCs.
+
\*---------------------------------------------------------------------------*/
void weight(
@@ -272,8 +272,8 @@ void weight(
)
{
int i;
-
+
for(i=1; i<=order; i++)
akw[i] = ak[i]*pow(gamma,(float)i);
}
-
+
diff --git a/gr-vocoder/lib/codec2/lpc.h b/gr-vocoder/lib/codec2/lpc.h
index ead05e1ba..9125189d1 100644
--- a/gr-vocoder/lib/codec2/lpc.h
+++ b/gr-vocoder/lib/codec2/lpc.h
@@ -1,11 +1,11 @@
/*---------------------------------------------------------------------------*\
-
- FILE........: lpc.h
- AUTHOR......: David Rowe
- DATE CREATED: 24/8/09
-
- Linear Prediction functions written in C.
-
+
+ FILE........: lpc.h
+ AUTHOR......: David Rowe
+ DATE CREATED: 24/8/09
+
+ Linear Prediction functions written in C.
+
\*---------------------------------------------------------------------------*/
/*
diff --git a/gr-vocoder/lib/codec2/lsp.c b/gr-vocoder/lib/codec2/lsp.c
index 47001c1ef..b57507bb4 100644
--- a/gr-vocoder/lib/codec2/lsp.c
+++ b/gr-vocoder/lib/codec2/lsp.c
@@ -153,7 +153,7 @@ int lpc_to_lsp (float *a, int lpcrdr, float *freq, int nb, float delta)
float Q[LSP_MAX_ORDER + 1];
float P[LSP_MAX_ORDER + 1];
- flag = 1;
+ flag = 1;
m = lpcrdr/2; /* order of P'(z) & Q'(z) polynimials */
/* Allocate memory space for polynomials */
@@ -274,7 +274,7 @@ void lsp_to_lpc(float *lsp, float *ak, int lpcrdr)
int m = lpcrdr/2;
float freq[LSP_MAX_ORDER];
float Wp[(LSP_MAX_ORDER * 4) + 2];
-
+
/* convert from radians to the x=cos(w) domain */
for(i=0; i<lpcrdr; i++)
diff --git a/gr-vocoder/lib/codec2/nlp.c b/gr-vocoder/lib/codec2/nlp.c
index 42ae90919..0d5e530ce 100644
--- a/gr-vocoder/lib/codec2/nlp.c
+++ b/gr-vocoder/lib/codec2/nlp.c
@@ -1,11 +1,11 @@
/*---------------------------------------------------------------------------*\
-
- FILE........: nlp.c
- AUTHOR......: David Rowe
- DATE CREATED: 23/3/93
-
- Non Linear Pitch (NLP) estimation functions.
-
+
+ FILE........: nlp.c
+ AUTHOR......: David Rowe
+ DATE CREATED: 23/3/93
+
+ Non Linear Pitch (NLP) estimation functions.
+
\*---------------------------------------------------------------------------*/
/*
@@ -35,9 +35,9 @@
#include <stdlib.h>
/*---------------------------------------------------------------------------*\
-
- DEFINES
-
+
+ DEFINES
+
\*---------------------------------------------------------------------------*/
#define PMAX_M 600 /* maximum NLP analysis window size */
@@ -52,9 +52,9 @@
#define NLP_NTAP 48 /* Decimation LPF order */
/*---------------------------------------------------------------------------*\
-
- GLOBALS
-
+
+ GLOBALS
+
\*---------------------------------------------------------------------------*/
/* 48 tap 600Hz low pass FIR filter coefficients */
@@ -117,14 +117,14 @@ typedef struct {
} NLP;
float post_process_mbe(COMP Fw[], int pmin, int pmax, float gmax);
-float post_process_sub_multiples(COMP Fw[],
+float post_process_sub_multiples(COMP Fw[],
int pmin, int pmax, float gmax, int gmax_bin,
float *prev_Wo);
/*---------------------------------------------------------------------------*\
-
- nlp_create()
-
+
+ nlp_create()
+
Initialisation function for NLP pitch estimator.
\*---------------------------------------------------------------------------*/
@@ -149,9 +149,9 @@ void *nlp_create()
}
/*---------------------------------------------------------------------------*\
-
+
nlp_destory()
-
+
Initialisation function for NLP pitch estimator.
\*---------------------------------------------------------------------------*/
@@ -163,9 +163,9 @@ void nlp_destroy(void *nlp_state)
}
/*---------------------------------------------------------------------------*\
-
- nlp()
-
+
+ nlp()
+
Determines the pitch in samples using the Non Linear Pitch (NLP)
algorithm [1]. Returns the fundamental in Hz. Note that the actual
pitch estimate is for the centre of the M sample Sn[] vector, not
@@ -189,11 +189,11 @@ void nlp_destroy(void *nlp_state)
References:
[1] http://www.itr.unisa.edu.au/~steven/thesis/dgr.pdf Chapter 4
-
+
\*---------------------------------------------------------------------------*/
float nlp(
- void *nlp_state,
+ void *nlp_state,
float Sn[], /* input speech vector */
int n, /* frames shift (no. new samples in Sn[]) */
int m, /* analysis window size */
@@ -271,7 +271,7 @@ float nlp(
}
}
- best_f0 = post_process_sub_multiples(Fw, pmin, pmax, gmax, gmax_bin,
+ best_f0 = post_process_sub_multiples(Fw, pmin, pmax, gmax, gmax_bin,
prev_Wo);
/* Shift samples in buffer to make room for new samples */
@@ -282,13 +282,13 @@ float nlp(
/* return pitch and F0 estimate */
*pitch = (float)SAMPLE_RATE/best_f0;
- return(best_f0);
+ return(best_f0);
}
/*---------------------------------------------------------------------------*\
-
- post_process_sub_multiples()
-
+
+ post_process_sub_multiples()
+
Given the global maximma of Fw[] we search interger submultiples for
local maxima. If local maxima exist and they are above an
experimentally derived threshold (OK a magic number I pulled out of
@@ -306,7 +306,7 @@ float nlp(
\*---------------------------------------------------------------------------*/
-float post_process_sub_multiples(COMP Fw[],
+float post_process_sub_multiples(COMP Fw[],
int pmin, int pmax, float gmax, int gmax_bin,
float *prev_Wo)
{
@@ -361,4 +361,4 @@ float post_process_sub_multiples(COMP Fw[],
return best_f0;
}
-
+
diff --git a/gr-vocoder/lib/codec2/nlp.h b/gr-vocoder/lib/codec2/nlp.h
index 88a3733dc..5e11f1186 100644
--- a/gr-vocoder/lib/codec2/nlp.h
+++ b/gr-vocoder/lib/codec2/nlp.h
@@ -1,11 +1,11 @@
/*---------------------------------------------------------------------------*\
-
- FILE........: nlp.c
- AUTHOR......: David Rowe
- DATE CREATED: 23/3/93
-
- Non Linear Pitch (NLP) estimation functions.
-
+
+ FILE........: nlp.c
+ AUTHOR......: David Rowe
+ DATE CREATED: 23/3/93
+
+ Non Linear Pitch (NLP) estimation functions.
+
\*---------------------------------------------------------------------------*/
/*
@@ -32,7 +32,7 @@
void *nlp_create();
void nlp_destroy(void *nlp_state);
-float nlp(void *nlp_state, float Sn[], int n, int m, int pmin, int pmax,
+float nlp(void *nlp_state, float Sn[], int n, int m, int pmin, int pmax,
float *pitch, COMP Sw[], float *prev_Wo);
float test_candidate_mbe(COMP Sw[], float f0, COMP Sw_[]);
diff --git a/gr-vocoder/lib/codec2/pack.c b/gr-vocoder/lib/codec2/pack.c
index 31551dfc4..e04c9378c 100644
--- a/gr-vocoder/lib/codec2/pack.c
+++ b/gr-vocoder/lib/codec2/pack.c
@@ -65,7 +65,7 @@ pack(
bitArray[wordIndex] |=
((unsigned char)((field >> (fieldWidth - sliceWidth))
<< (bitsLeft - sliceWidth)));
-
+
*bitIndex = bI + sliceWidth;
fieldWidth -= sliceWidth;
} while ( fieldWidth != 0 );
@@ -91,7 +91,7 @@ unpack(
bitsLeft < fieldWidth ? bitsLeft : fieldWidth;
field |= (((bitArray[bI >> ShiftRight] >> (bitsLeft - sliceWidth)) & ((1 << sliceWidth) - 1)) << (fieldWidth - sliceWidth));
-
+
*bitIndex = bI + sliceWidth;
fieldWidth -= sliceWidth;
} while ( fieldWidth != 0 );
diff --git a/gr-vocoder/lib/codec2/phase.c b/gr-vocoder/lib/codec2/phase.c
index 0e1a14a60..69cc6697f 100644
--- a/gr-vocoder/lib/codec2/phase.c
+++ b/gr-vocoder/lib/codec2/phase.c
@@ -1,11 +1,11 @@
/*---------------------------------------------------------------------------*\
-
- FILE........: phase.c
- AUTHOR......: David Rowe
- DATE CREATED: 1/2/09
-
+
+ FILE........: phase.c
+ AUTHOR......: David Rowe
+ DATE CREATED: 1/2/09
+
Functions for modelling and synthesising phase.
-
+
\*---------------------------------------------------------------------------*/
/*
@@ -22,7 +22,7 @@
License for more details.
You should have received a copy of the GNU Lesser General Public License
- along with this program; if not,see <http://www.gnu.org/licenses/>.
+ along with this program; if not,see <http://www.gnu.org/licenses/>.
*/
#include "defines.h"
@@ -101,14 +101,14 @@ void aks_to_H(
phase_synth_zero_order()
- Synthesises phases based on SNR and a rule based approach. No phase
+ Synthesises phases based on SNR and a rule based approach. No phase
parameters are required apart from the SNR (which can be reduced to a
1 bit V/UV decision per frame).
The phase of each harmonic is modelled as the phase of a LPC
synthesis filter excited by an impulse. Unlike the first order
model the position of the impulse is not transmitted, so we create
- an excitation pulse train using a rule based approach.
+ an excitation pulse train using a rule based approach.
Consider a pulse train with a pulse starting time n=0, with pulses
repeated at a rate of Wo, the fundamental frequency. A pulse train
@@ -149,10 +149,10 @@ void aks_to_H(
This E[m] then gets passed through the LPC synthesis filter to
determine the final harmonic phase.
-
+
Comparing to speech synthesised using original phases:
- - Through headphones speech synthesised with this model is not as
+ - Through headphones speech synthesised with this model is not as
good. Through a loudspeaker it is very close to original phases.
- If there are voicing errors, the speech can sound clicky or
@@ -207,21 +207,21 @@ void phase_synth_zero_order(
G = 1.0;
aks_to_H(model, aks, G, H, order);
- /*
+ /*
Update excitation fundamental phase track, this sets the position
of each pitch pulse during voiced speech. After much experiment
I found that using just this frame's Wo improved quality for UV
sounds compared to interpolating two frames Wo like this:
-
+
ex_phase[0] += (*prev_Wo+mode->Wo)*N/2;
*/
-
+
ex_phase[0] += (model->Wo)*N;
ex_phase[0] -= TWO_PI*floor(ex_phase[0]/TWO_PI + 0.5);
r = TWO_PI/GLOTTAL_FFT_SIZE;
for(m=1; m<=model->L; m++) {
-
+
/* generate excitation */
if (model->voiced) {
@@ -254,7 +254,7 @@ void phase_synth_zero_order(
A_[m].imag = H[m].imag*Ex[m].real + H[m].real*Ex[m].imag;
/* modify sinusoidal phase */
-
+
new_phi = atan2(A_[m].imag, A_[m].real+1E-12);
model->phi[m] = new_phi;
}
diff --git a/gr-vocoder/lib/codec2/phase.h b/gr-vocoder/lib/codec2/phase.h
index 833bc7cdc..4f1a62089 100644
--- a/gr-vocoder/lib/codec2/phase.h
+++ b/gr-vocoder/lib/codec2/phase.h
@@ -1,11 +1,11 @@
/*---------------------------------------------------------------------------*\
-
- FILE........: phase.h
- AUTHOR......: David Rowe
- DATE CREATED: 1/2/09
-
+
+ FILE........: phase.h
+ AUTHOR......: David Rowe
+ DATE CREATED: 1/2/09
+
Functions for modelling phase.
-
+
\*---------------------------------------------------------------------------*/
/*
@@ -28,7 +28,7 @@
#ifndef __PHASE__
#define __PHASE__
-void phase_synth_zero_order(MODEL *model, float aks[], float *ex_phase,
+void phase_synth_zero_order(MODEL *model, float aks[], float *ex_phase,
int order);
#endif
diff --git a/gr-vocoder/lib/codec2/postfilter.c b/gr-vocoder/lib/codec2/postfilter.c
index 6e17eeb87..05d77c845 100644
--- a/gr-vocoder/lib/codec2/postfilter.c
+++ b/gr-vocoder/lib/codec2/postfilter.c
@@ -1,13 +1,13 @@
/*---------------------------------------------------------------------------*\
-
+
FILE........: postfilter.c
- AUTHOR......: David Rowe
+ AUTHOR......: David Rowe
DATE CREATED: 13/09/09
-
+
Postfilter to improve sound quality for speech with high levels of
background noise. Unlike mixed-excitation models requires no bits
to be transmitted to handle background noise.
-
+
\*---------------------------------------------------------------------------*/
/*
@@ -71,7 +71,7 @@
This idea is rather experimental. Some potential problems that may
happen:
-
+
1/ If someone says "aaaaaaaahhhhhhhhh" will background estimator track
up to speech level? This would be a bad thing.
@@ -88,13 +88,13 @@
5/ Not sure what happens during long periods of voiced speech
e.g. "sshhhhhhh"
-
+
\*---------------------------------------------------------------------------*/
void postfilter(
MODEL *model,
float *bg_est
-)
+)
{
int m, uv;
float e;
diff --git a/gr-vocoder/lib/codec2/postfilter.h b/gr-vocoder/lib/codec2/postfilter.h
index bf080b1b6..156714e54 100644
--- a/gr-vocoder/lib/codec2/postfilter.h
+++ b/gr-vocoder/lib/codec2/postfilter.h
@@ -1,11 +1,11 @@
/*---------------------------------------------------------------------------*\
-
+
FILE........: postfilter.h
- AUTHOR......: David Rowe
+ AUTHOR......: David Rowe
DATE CREATED: 13/09/09
-
+
Postfilter header file.
-
+
\*---------------------------------------------------------------------------*/
/*
diff --git a/gr-vocoder/lib/codec2/quantise.c b/gr-vocoder/lib/codec2/quantise.c
index ff8d156b5..c09803099 100644
--- a/gr-vocoder/lib/codec2/quantise.c
+++ b/gr-vocoder/lib/codec2/quantise.c
@@ -1,11 +1,11 @@
/*---------------------------------------------------------------------------*\
-
+
FILE........: quantise.c
- AUTHOR......: David Rowe
- DATE CREATED: 31/5/92
-
- Quantisation functions for the sinusoidal coder.
-
+ AUTHOR......: David Rowe
+ DATE CREATED: 31/5/92
+
+ Quantisation functions for the sinusoidal coder.
+
\*---------------------------------------------------------------------------*/
/*
@@ -41,16 +41,16 @@
#define LSP_DELTA1 0.01 /* grid spacing for LSP root searches */
/*---------------------------------------------------------------------------*\
-
+
FUNCTION HEADERS
\*---------------------------------------------------------------------------*/
-float speech_to_uq_lsps(float lsp[], float ak[], float Sn[], float w[],
+float speech_to_uq_lsps(float lsp[], float ak[], float Sn[], float w[],
int order);
/*---------------------------------------------------------------------------*\
-
+
FUNCTIONS
\*---------------------------------------------------------------------------*/
@@ -61,7 +61,7 @@ int lsp_bits(int i) {
#if VECTOR_QUANTISATION
/*---------------------------------------------------------------------------*\
-
+
quantise_uniform
Simulates uniform quantising of a float.
@@ -146,7 +146,7 @@ long quantise(const float * cb, float vec[], float w[], int k, int m, float *se)
}
/*---------------------------------------------------------------------------*\
-
+
lspd_quantise
Scalar lsp difference quantiser.
@@ -154,10 +154,10 @@ long quantise(const float * cb, float vec[], float w[], int k, int m, float *se)
\*---------------------------------------------------------------------------*/
void lspd_quantise(
- float lsp[],
+ float lsp[],
float lsp_[],
int order
-)
+)
{
int i,k,m;
float lsp_hz[LPC_MAX];
@@ -183,8 +183,8 @@ void lspd_quantise(
wt[0] = 1.0;
for(i=0; i<order; i++) {
- if (i)
- dlsp[i] = lsp_hz[i] - lsp__hz[i-1];
+ if (i)
+ dlsp[i] = lsp_hz[i] - lsp__hz[i-1];
else
dlsp[0] = lsp_hz[0];
@@ -194,14 +194,14 @@ void lspd_quantise(
indexes[i] = quantise(cb, &dlsp[i], wt, k, m, &se);
dlsp_[i] = cb[indexes[i]*k];
- if (i)
+ if (i)
lsp__hz[i] = lsp__hz[i-1] + dlsp_[i];
else
lsp__hz[0] = dlsp_[0];
}
for(; i<order; i++)
lsp__hz[i] = lsp__hz[i-1] + dlsp[i];
-
+
/* convert back to radians */
for(i=0; i<order; i++)
@@ -209,7 +209,7 @@ void lspd_quantise(
}
/*---------------------------------------------------------------------------*\
-
+
lspd_vq_quantise
Vector lsp difference quantiser.
@@ -217,10 +217,10 @@ void lspd_quantise(
\*---------------------------------------------------------------------------*/
void lspdvq_quantise(
- float lsp[],
+ float lsp[],
float lsp_[],
int order
-)
+)
{
int i,k,m,ncb, nlsp;
float dlsp[LPC_MAX];
@@ -243,8 +243,8 @@ void lspdvq_quantise(
/* scalar quantise dLSPs 1,2,3,4,5 */
for(i=0; i<5; i++) {
- if (i)
- dlsp[i] = (lsp[i] - lsp_[i-1])*4000.0/PI;
+ if (i)
+ dlsp[i] = (lsp[i] - lsp_[i-1])*4000.0/PI;
else
dlsp[0] = lsp[0]*4000.0/PI;
@@ -253,8 +253,8 @@ void lspdvq_quantise(
cb = lsp_cbdvq[i].cb;
index = quantise(cb, &dlsp[i], wt, k, m, &se);
dlsp_[i] = cb[index*k]*PI/4000.0;
-
- if (i)
+
+ if (i)
lsp_[i] = lsp_[i-1] + dlsp_[i];
else
lsp_[0] = dlsp_[0];
@@ -330,7 +330,7 @@ void force_min_lsp_dist(float lsp[], int lpc_order)
}
/*---------------------------------------------------------------------------*\
-
+
lpc_model_amplitudes
Derive a LPC model for amplitude samples then estimate amplitude samples
@@ -342,7 +342,7 @@ void force_min_lsp_dist(float lsp[], int lpc_order)
float lpc_model_amplitudes(
float Sn[], /* Input frame of speech samples */
- float w[],
+ float w[],
MODEL *model, /* sinusoidal model parameters */
int order, /* LPC model order */
int lsp_quant, /* optional LSP quantisation if non-zero */
@@ -353,7 +353,7 @@ float lpc_model_amplitudes(
float R[LPC_MAX+1];
float E;
int i,j;
- float snr;
+ float snr;
float lsp[LPC_MAX];
float lsp_hz[LPC_MAX];
float lsp_[LPC_MAX];
@@ -368,11 +368,11 @@ float lpc_model_amplitudes(
Wn[i] = Sn[i]*w[i];
autocorrelate(Wn,R,M,order);
levinson_durbin(R,ak,order);
-
+
E = 0.0;
for(i=0; i<=order; i++)
E += ak[i]*R[i];
-
+
for(i=0; i<order; i++)
wt[i] = 1.0;
@@ -386,7 +386,7 @@ float lpc_model_amplitudes(
for(i=0; i<order; i++)
lsp_hz[i] = (4000.0/PI)*lsp[i];
-
+
/* simple uniform scalar quantisers */
for(i=0; i<10; i++) {
@@ -396,7 +396,7 @@ float lpc_model_amplitudes(
index = quantise(cb, &lsp_hz[i], wt, k, m, &se);
lsp_hz[i] = cb[index*k];
}
-
+
/* experiment: simulating uniform quantisation error
for(i=0; i<order; i++)
lsp[i] += PI*(12.5/4000.0)*(1.0 - 2.0*(float)rand()/RAND_MAX);
@@ -428,7 +428,7 @@ float lpc_model_amplitudes(
lsp[i] = lsp[i-1] + PI*(75.0/4000.0);
}
- for(j=0; j<order; j++)
+ for(j=0; j<order; j++)
lsp_[j] = lsp[j];
lsp_to_lpc(lsp_, ak, order);
@@ -455,13 +455,13 @@ float lpc_model_amplitudes(
}
/*---------------------------------------------------------------------------*\
-
- aks_to_M2()
-
- Transforms the linear prediction coefficients to spectral amplitude
- samples. This function determines A(m) from the average energy per
- band using an FFT.
-
+
+ aks_to_M2()
+
+ Transforms the linear prediction coefficients to spectral amplitude
+ samples. This function determines A(m) from the average energy per
+ band using an FFT.
+
\*---------------------------------------------------------------------------*/
void aks_to_M2(
@@ -487,7 +487,7 @@ void aks_to_M2(
for(i=0; i<FFT_DEC; i++) {
Pw[i].real = 0.0;
- Pw[i].imag = 0.0;
+ Pw[i].imag = 0.0;
}
for(i=0; i<=order; i++)
@@ -499,7 +499,7 @@ void aks_to_M2(
for(i=0; i<FFT_DEC/2; i++)
Pw[i].real = E/(Pw[i].real*Pw[i].real + Pw[i].imag*Pw[i].imag);
#ifdef DUMP
- if (dump)
+ if (dump)
dump_Pw(Pw);
#endif
@@ -523,10 +523,10 @@ void aks_to_M2(
}
/*---------------------------------------------------------------------------*\
-
- FUNCTION....: encode_Wo()
- AUTHOR......: David Rowe
- DATE CREATED: 22/8/2010
+
+ FUNCTION....: encode_Wo()
+ AUTHOR......: David Rowe
+ DATE CREATED: 22/8/2010
Encodes Wo using a WO_LEVELS quantiser.
@@ -548,10 +548,10 @@ int encode_Wo(float Wo)
}
/*---------------------------------------------------------------------------*\
-
- FUNCTION....: decode_Wo()
- AUTHOR......: David Rowe
- DATE CREATED: 22/8/2010
+
+ FUNCTION....: decode_Wo()
+ AUTHOR......: David Rowe
+ DATE CREATED: 22/8/2010
Decodes Wo using a WO_LEVELS quantiser.
@@ -571,10 +571,10 @@ float decode_Wo(int index)
}
/*---------------------------------------------------------------------------*\
-
- FUNCTION....: speech_to_uq_lsps()
- AUTHOR......: David Rowe
- DATE CREATED: 22/8/2010
+
+ FUNCTION....: speech_to_uq_lsps()
+ AUTHOR......: David Rowe
+ DATE CREATED: 22/8/2010
Analyse a windowed frame of time domain speech to determine LPCs
which are the converted to LSPs for quantisation and transmission
@@ -584,7 +584,7 @@ float decode_Wo(int index)
float speech_to_uq_lsps(float lsp[],
float ak[],
- float Sn[],
+ float Sn[],
float w[],
int order
)
@@ -598,19 +598,19 @@ float speech_to_uq_lsps(float lsp[],
Wn[i] = Sn[i]*w[i];
autocorrelate(Wn, R, M, order);
levinson_durbin(R, ak, order);
-
+
E = 0.0;
for(i=0; i<=order; i++)
E += ak[i]*R[i];
-
+
roots = lpc_to_lsp(ak, order, lsp, 5, LSP_DELTA1);
if (roots != order) {
/* for some reason LSP roots could not be found */
/* some alpha testers are reporting this condition */
fprintf(stderr, "LSP roots not found!\nroots = %d\n", roots);
for(i=0; i<=order; i++)
- fprintf(stderr, "a[%d] = %f\n", i, ak[i]);
-
+ fprintf(stderr, "a[%d] = %f\n", i, ak[i]);
+
/* some benign LSP values we can use instead */
for(i=0; i<order; i++)
lsp[i] = (PI/order)*(float)i;
@@ -620,10 +620,10 @@ float speech_to_uq_lsps(float lsp[],
}
/*---------------------------------------------------------------------------*\
-
- FUNCTION....: encode_lsps()
- AUTHOR......: David Rowe
- DATE CREATED: 22/8/2010
+
+ FUNCTION....: encode_lsps()
+ AUTHOR......: David Rowe
+ DATE CREATED: 22/8/2010
From a vector of unquantised (floating point) LSPs finds the quantised
LSP indexes.
@@ -643,7 +643,7 @@ void encode_lsps(int indexes[], float lsp[], int order)
for(i=0; i<order; i++)
lsp_hz[i] = (4000.0/PI)*lsp[i];
-
+
/* simple uniform scalar quantisers */
wt[0] = 1.0;
@@ -656,10 +656,10 @@ void encode_lsps(int indexes[], float lsp[], int order)
}
/*---------------------------------------------------------------------------*\
-
- FUNCTION....: decode_lsps()
- AUTHOR......: David Rowe
- DATE CREATED: 22/8/2010
+
+ FUNCTION....: decode_lsps()
+ AUTHOR......: David Rowe
+ DATE CREATED: 22/8/2010
From a vector of quantised LSP indexes, returns the quantised
(floating point) LSPs.
@@ -685,10 +685,10 @@ void decode_lsps(float lsp[], int indexes[], int order)
}
/*---------------------------------------------------------------------------*\
-
- FUNCTION....: bw_expand_lsps()
- AUTHOR......: David Rowe
- DATE CREATED: 22/8/2010
+
+ FUNCTION....: bw_expand_lsps()
+ AUTHOR......: David Rowe
+ DATE CREATED: 22/8/2010
Applies Bandwidth Expansion (BW) to a vector of LSPs. Prevents any
two LSPs getting too close together after quantisation. We know
@@ -724,10 +724,10 @@ void bw_expand_lsps(float lsp[],
}
/*---------------------------------------------------------------------------*\
-
- FUNCTION....: apply_lpc_correction()
- AUTHOR......: David Rowe
- DATE CREATED: 22/8/2010
+
+ FUNCTION....: apply_lpc_correction()
+ AUTHOR......: David Rowe
+ DATE CREATED: 22/8/2010
Apply first harmonic LPC correction at decoder. This helps improve
low pitch males after LPC modelling, like hts1a and morig.
@@ -742,10 +742,10 @@ void apply_lpc_correction(MODEL *model)
}
/*---------------------------------------------------------------------------*\
-
- FUNCTION....: encode_energy()
- AUTHOR......: David Rowe
- DATE CREATED: 22/8/2010
+
+ FUNCTION....: encode_energy()
+ AUTHOR......: David Rowe
+ DATE CREATED: 22/8/2010
Encodes LPC energy using an E_LEVELS quantiser.
@@ -768,10 +768,10 @@ int encode_energy(float e)
}
/*---------------------------------------------------------------------------*\
-
- FUNCTION....: decode_energy()
- AUTHOR......: David Rowe
- DATE CREATED: 22/8/2010
+
+ FUNCTION....: decode_energy()
+ AUTHOR......: David Rowe
+ DATE CREATED: 22/8/2010
Decodes energy using a WO_BITS quantiser.
@@ -792,10 +792,10 @@ float decode_energy(int index)
}
/*---------------------------------------------------------------------------*\
-
- FUNCTION....: encode_amplitudes()
- AUTHOR......: David Rowe
- DATE CREATED: 22/8/2010
+
+ FUNCTION....: encode_amplitudes()
+ AUTHOR......: David Rowe
+ DATE CREATED: 22/8/2010
Time domain LPC is used model the amplitudes which are then
converted to LSPs and quantised. So we don't actually encode the
@@ -804,10 +804,10 @@ float decode_energy(int index)
\*---------------------------------------------------------------------------*/
-void encode_amplitudes(int lsp_indexes[],
+void encode_amplitudes(int lsp_indexes[],
int *energy_index,
- MODEL *model,
- float Sn[],
+ MODEL *model,
+ float Sn[],
float w[])
{
float lsps[LPC_ORD];
@@ -820,19 +820,19 @@ void encode_amplitudes(int lsp_indexes[],
}
/*---------------------------------------------------------------------------*\
-
- FUNCTION....: decode_amplitudes()
- AUTHOR......: David Rowe
- DATE CREATED: 22/8/2010
+
+ FUNCTION....: decode_amplitudes()
+ AUTHOR......: David Rowe
+ DATE CREATED: 22/8/2010
Given the amplitude quantiser indexes recovers the harmonic
amplitudes.
\*---------------------------------------------------------------------------*/
-float decode_amplitudes(MODEL *model,
+float decode_amplitudes(MODEL *model,
float ak[],
- int lsp_indexes[],
+ int lsp_indexes[],
int energy_index,
float lsps[],
float *e
@@ -844,7 +844,7 @@ float decode_amplitudes(MODEL *model,
bw_expand_lsps(lsps, LPC_ORD);
lsp_to_lpc(lsps, ak, LPC_ORD);
*e = decode_energy(energy_index);
- aks_to_M2(ak, LPC_ORD, model, *e, &snr, 1);
+ aks_to_M2(ak, LPC_ORD, model, *e, &snr, 1);
apply_lpc_correction(model);
return snr;
diff --git a/gr-vocoder/lib/codec2/quantise.h b/gr-vocoder/lib/codec2/quantise.h
index 90a3661ff..42b05f43b 100644
--- a/gr-vocoder/lib/codec2/quantise.h
+++ b/gr-vocoder/lib/codec2/quantise.h
@@ -1,11 +1,11 @@
/*---------------------------------------------------------------------------*\
-
+
FILE........: quantise.h
- AUTHOR......: David Rowe
- DATE CREATED: 31/5/92
-
- Quantisation functions for the sinusoidal coder.
-
+ AUTHOR......: David Rowe
+ DATE CREATED: 31/5/92
+
+ Quantisation functions for the sinusoidal coder.
+
\*---------------------------------------------------------------------------*/
/*
@@ -36,7 +36,7 @@
void quantise_init();
float lpc_model_amplitudes(float Sn[], float w[], MODEL *model, int order,
int lsp,float ak[]);
-void aks_to_M2(float ak[], int order, MODEL *model, float E, float *snr,
+void aks_to_M2(float ak[], int order, MODEL *model, float E, float *snr,
int dump);
int encode_Wo(float Wo);
@@ -45,15 +45,15 @@ float decode_Wo(int index);
void encode_lsps(int indexes[], float lsp[], int order);
void decode_lsps(float lsp[], int indexes[], int order);
void lspd_quantise(float lsp[], float lsp_[], int order);
-void lspdvq_quantise(float lsp[], float lsp_[], int order);
+void lspdvq_quantise(float lsp[], float lsp_[], int order);
int encode_energy(float e);
float decode_energy(int index);
-void encode_amplitudes(int lsp_indexes[],
+void encode_amplitudes(int lsp_indexes[],
int *energy_index,
- MODEL *model,
- float Sn[],
+ MODEL *model,
+ float Sn[],
float w[]);
float decode_amplitudes(MODEL *model,
@@ -71,7 +71,7 @@ int lsp_bits(int i);
void apply_lpc_correction(MODEL *model);
float speech_to_uq_lsps(float lsp[],
float ak[],
- float Sn[],
+ float Sn[],
float w[],
int order
);
diff --git a/gr-vocoder/lib/codec2/sine.c b/gr-vocoder/lib/codec2/sine.c
index 45cc9de71..b30f9abad 100644
--- a/gr-vocoder/lib/codec2/sine.c
+++ b/gr-vocoder/lib/codec2/sine.c
@@ -1,11 +1,11 @@
/*---------------------------------------------------------------------------*\
-
+
FILE........: sine.c
- AUTHOR......: David Rowe
+ AUTHOR......: David Rowe
DATE CREATED: 19/8/2010
-
+
Sinusoidal analysis and synthesis functions.
-
+
\*---------------------------------------------------------------------------*/
/*
@@ -26,9 +26,9 @@
*/
/*---------------------------------------------------------------------------*\
-
- INCLUDES
-
+
+ INCLUDES
+
\*---------------------------------------------------------------------------*/
#include <stdlib.h>
@@ -42,25 +42,25 @@
#define HPF_BETA 0.125
/*---------------------------------------------------------------------------*\
-
- HEADERS
-
+
+ HEADERS
+
\*---------------------------------------------------------------------------*/
-void hs_pitch_refinement(MODEL *model, COMP Sw[], float pmin, float pmax,
+void hs_pitch_refinement(MODEL *model, COMP Sw[], float pmin, float pmax,
float pstep);
/*---------------------------------------------------------------------------*\
-
- FUNCTIONS
-
+
+ FUNCTIONS
+
\*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*\
-
- FUNCTION....: make_analysis_window
- AUTHOR......: David Rowe
- DATE CREATED: 11/5/94
+
+ FUNCTION....: make_analysis_window
+ AUTHOR......: David Rowe
+ DATE CREATED: 11/5/94
Init function that generates the time domain analysis window and it's DFT.
@@ -72,15 +72,15 @@ void make_analysis_window(float w[],COMP W[])
COMP temp;
int i,j;
- /*
+ /*
Generate Hamming window centered on M-sample pitch analysis window
-
+
0 M/2 M-1
|-------------|-------------|
|-------|-------|
NW samples
- All our analysis/synthsis is centred on the M/2 sample.
+ All our analysis/synthsis is centred on the M/2 sample.
*/
m = 0.0;
@@ -92,7 +92,7 @@ void make_analysis_window(float w[],COMP W[])
}
for(i=M/2+NW/2; i<M; i++)
w[i] = 0.0;
-
+
/* Normalise - makes freq domain amplitude estimation straight
forward */
@@ -101,7 +101,7 @@ void make_analysis_window(float w[],COMP W[])
w[i] *= m;
}
- /*
+ /*
Generate DFT of analysis window, used for later processing. Note
we modulo FFT_ENC shift the time domain window w[], this makes the
imaginary part of the DFT W[] equal to zero as the shifted w[] is
@@ -112,13 +112,13 @@ void make_analysis_window(float w[],COMP W[])
|-------------------------|
----\ /----
- \ /
+ \ /
\ / <- shifted version of window w[n]
\ /
\ /
-------
- |---------| |---------|
+ |---------| |---------|
NW/2 NW/2
*/
@@ -133,8 +133,8 @@ void make_analysis_window(float w[],COMP W[])
fft(&W[0].real,FFT_ENC,-1); /* "Numerical Recipes in C" FFT */
- /*
- Re-arrange W[] to be symmetrical about FFT_ENC/2. Makes later
+ /*
+ Re-arrange W[] to be symmetrical about FFT_ENC/2. Makes later
analysis convenient.
Before:
@@ -142,21 +142,21 @@ void make_analysis_window(float w[],COMP W[])
0 FFT_ENC-1
|----------|---------|
- __ _
- \ /
- \_______________/
+ __ _
+ \ /
+ \_______________/
After:
0 FFT_ENC-1
|----------|---------|
- ___
- / \
- ________/ \_______
+ ___
+ / \
+ ________/ \_______
*/
-
-
+
+
for(i=0; i<FFT_ENC/2; i++) {
temp.real = W[i].real;
temp.imag = W[i].imag;
@@ -169,15 +169,15 @@ void make_analysis_window(float w[],COMP W[])
}
/*---------------------------------------------------------------------------*\
-
- FUNCTION....: hpf
- AUTHOR......: David Rowe
+
+ FUNCTION....: hpf
+ AUTHOR......: David Rowe
DATE CREATED: 16 Nov 2010
High pass filter with a -3dB point of about 160Hz.
y(n) = -HPF_BETA*y(n-1) + x(n) - x(n-1)
-
+
\*---------------------------------------------------------------------------*/
float hpf(float x, float states[])
@@ -189,10 +189,10 @@ float hpf(float x, float states[])
}
/*---------------------------------------------------------------------------*\
-
- FUNCTION....: dft_speech
- AUTHOR......: David Rowe
- DATE CREATED: 27/5/94
+
+ FUNCTION....: dft_speech
+ AUTHOR......: David Rowe
+ DATE CREATED: 27/5/94
Finds the DFT of the current speech input speech frame.
@@ -201,7 +201,7 @@ float hpf(float x, float states[])
void dft_speech(COMP Sw[], float Sn[], float w[])
{
int i;
-
+
for(i=0; i<FFT_ENC; i++) {
Sw[i].real = 0.0;
Sw[i].imag = 0.0;
@@ -209,7 +209,7 @@ void dft_speech(COMP Sw[], float Sn[], float w[])
/* Centre analysis window on time axis, we need to arrange input
to FFT this way to make FFT phases correct */
-
+
/* move 2nd half to start of FFT input vector */
for(i=0; i<NW/2; i++)
@@ -224,10 +224,10 @@ void dft_speech(COMP Sw[], float Sn[], float w[])
}
/*---------------------------------------------------------------------------*\
-
- FUNCTION....: two_stage_pitch_refinement
+
+ FUNCTION....: two_stage_pitch_refinement
AUTHOR......: David Rowe
- DATE CREATED: 27/5/94
+ DATE CREATED: 27/5/94
Refines the current pitch estimate using the harmonic sum pitch
estimation technique.
@@ -236,7 +236,7 @@ void dft_speech(COMP Sw[], float Sn[], float w[])
void two_stage_pitch_refinement(MODEL *model, COMP Sw[])
{
- float pmin,pmax,pstep; /* pitch refinment minimum, maximum and step */
+ float pmin,pmax,pstep; /* pitch refinment minimum, maximum and step */
/* Coarse refinement */
@@ -244,16 +244,16 @@ void two_stage_pitch_refinement(MODEL *model, COMP Sw[])
pmin = TWO_PI/model->Wo - 5;
pstep = 1.0;
hs_pitch_refinement(model,Sw,pmin,pmax,pstep);
-
+
/* Fine refinement */
-
+
pmax = TWO_PI/model->Wo + 1;
pmin = TWO_PI/model->Wo - 1;
pstep = 0.25;
hs_pitch_refinement(model,Sw,pmin,pmax,pstep);
-
+
/* Limit range */
-
+
if (model->Wo < TWO_PI/P_MAX)
model->Wo = TWO_PI/P_MAX;
if (model->Wo > TWO_PI/P_MIN)
@@ -263,20 +263,20 @@ void two_stage_pitch_refinement(MODEL *model, COMP Sw[])
}
/*---------------------------------------------------------------------------*\
-
- FUNCTION....: hs_pitch_refinement
- AUTHOR......: David Rowe
- DATE CREATED: 27/5/94
-
- Harmonic sum pitch refinement function.
-
- pmin pitch search range minimum
- pmax pitch search range maximum
- step pitch search step size
- model current pitch estimate in model.Wo
-
- model refined pitch estimate in model.Wo
-
+
+ FUNCTION....: hs_pitch_refinement
+ AUTHOR......: David Rowe
+ DATE CREATED: 27/5/94
+
+ Harmonic sum pitch refinement function.
+
+ pmin pitch search range minimum
+ pmax pitch search range maximum
+ step pitch search step size
+ model current pitch estimate in model.Wo
+
+ model refined pitch estimate in model.Wo
+
\*---------------------------------------------------------------------------*/
void hs_pitch_refinement(MODEL *model, COMP Sw[], float pmin, float pmax, float pstep)
@@ -289,14 +289,14 @@ void hs_pitch_refinement(MODEL *model, COMP Sw[], float pmin, float pmax, float
float Em; /* mamimum energy */
float r; /* number of rads/bin */
float p; /* current pitch */
-
+
/* Initialisation */
-
+
model->L = PI/model->Wo; /* use initial pitch est. for L */
Wom = model->Wo;
Em = 0.0;
r = TWO_PI/FFT_ENC;
-
+
/* Determine harmonic sum for a range of Wo values */
for(p=pmin; p<=pmax; p+=pstep) {
@@ -308,10 +308,10 @@ void hs_pitch_refinement(MODEL *model, COMP Sw[], float pmin, float pmax, float
for(m=1; m<=model->L; m++) {
b = floor(m*Wo/r + 0.5);
E += Sw[b].real*Sw[b].real + Sw[b].imag*Sw[b].imag;
- }
+ }
/* Compare to see if this is a maximum */
-
+
if (E > Em) {
Em = E;
Wom = Wo;
@@ -322,13 +322,13 @@ void hs_pitch_refinement(MODEL *model, COMP Sw[], float pmin, float pmax, float
}
/*---------------------------------------------------------------------------*\
-
- FUNCTION....: estimate_amplitudes
- AUTHOR......: David Rowe
- DATE CREATED: 27/5/94
-
- Estimates the complex amplitudes of the harmonics.
-
+
+ FUNCTION....: estimate_amplitudes
+ AUTHOR......: David Rowe
+ DATE CREATED: 27/5/94
+
+ Estimates the complex amplitudes of the harmonics.
+
\*---------------------------------------------------------------------------*/
void estimate_amplitudes(MODEL *model, COMP Sw[], COMP W[])
@@ -369,14 +369,14 @@ void estimate_amplitudes(MODEL *model, COMP Sw[], COMP W[])
}
/*---------------------------------------------------------------------------*\
-
- est_voicing_mbe()
-
+
+ est_voicing_mbe()
+
Returns the error of the MBE cost function for a fiven F0.
Note: I think a lot of the operations below can be simplified as
W[].imag = 0 and has been normalised such that den always equals 1.
-
+
\*---------------------------------------------------------------------------*/
float est_voicing_mbe(
@@ -393,7 +393,7 @@ float est_voicing_mbe(
int offset; /* centers Hw[] about current harmonic */
float den; /* denominator of Am expression */
float error; /* accumulated error between original and synthesised */
- float Wo;
+ float Wo;
float sig, snr;
float elow, ehigh, eratio;
float dF0, sixty;
@@ -445,16 +445,16 @@ float est_voicing_mbe(
error += Ew[m].imag*Ew[m].imag;
}
}
-
+
snr = 10.0*log10(sig/error);
if (snr > V_THRESH)
model->voiced = 1;
else
model->voiced = 0;
-
+
/* post processing, helps clean up some voicing errors ------------------*/
- /*
+ /*
Determine the ratio of low freancy to high frequency energy,
voiced speech tends to be dominated by low frequency energy,
unvoiced by high frequency. This measure can be used to
@@ -488,7 +488,7 @@ float est_voicing_mbe(
/* If pitch is jumping about it's likely this is UV */
dF0 = (model->Wo - prev_Wo)*FS/TWO_PI;
- if (fabs(dF0) > 15.0)
+ if (fabs(dF0) > 15.0)
model->voiced = 0;
/* A common source of Type 2 errors is the pitch estimator
@@ -507,10 +507,10 @@ float est_voicing_mbe(
}
/*---------------------------------------------------------------------------*\
-
- FUNCTION....: make_synthesis_window
- AUTHOR......: David Rowe
- DATE CREATED: 11/5/94
+
+ FUNCTION....: make_synthesis_window
+ AUTHOR......: David Rowe
+ DATE CREATED: 11/5/94
Init function that generates the trapezoidal (Parzen) sythesis window.
@@ -539,15 +539,15 @@ void make_synthesis_window(float Pn[])
}
/*---------------------------------------------------------------------------*\
-
- FUNCTION....: synthesise
- AUTHOR......: David Rowe
- DATE CREATED: 20/2/95
-
+
+ FUNCTION....: synthesise
+ AUTHOR......: David Rowe
+ DATE CREATED: 20/2/95
+
Synthesise a speech signal in the frequency domain from the
sinusodal model parameters. Uses overlap-add with a trapezoidal
window to smoothly interpolate betwen frames.
-
+
\*---------------------------------------------------------------------------*/
void synthesise(
@@ -579,7 +579,7 @@ void synthesise(
gives better results for synthesis frames greater than 10ms. Inverse
FFT synthesis using a 512 pt FFT works well for 10ms window. I think
(but am not sure) that the problem is realted to the quantisation of
- the harmonic frequencies to the FFT bin size, e.g. there is a
+ the harmonic frequencies to the FFT bin size, e.g. there is a
8000/512 Hz step between FFT bins. For some reason this makes
the speech from longer frame > 10ms sound poor. The effect can also
be seen when synthesising test signals like single sine waves, some
@@ -619,7 +619,7 @@ void synthesise(
}
for(i=N-1,j=0; i<2*N; i++,j++)
Sw_[j].real += 2.0*model->A[l]*cos(j*model->Wo*l + model->phi[l]);
- }
+ }
#endif
/* Overlap add to previous samples */
diff --git a/gr-vocoder/lib/codec2/sine.h b/gr-vocoder/lib/codec2/sine.h
index ae578bf70..f223e2afc 100644
--- a/gr-vocoder/lib/codec2/sine.h
+++ b/gr-vocoder/lib/codec2/sine.h
@@ -1,11 +1,11 @@
/*---------------------------------------------------------------------------*\
-
+
FILE........: sine.h
- AUTHOR......: David Rowe
+ AUTHOR......: David Rowe
DATE CREATED: 1/11/94
-
+
Header file for sinusoidal analysis and synthesis functions.
-
+
\*---------------------------------------------------------------------------*/
/*
@@ -36,7 +36,7 @@ float hpf(float x, float states[]);
void dft_speech(COMP Sw[], float Sn[], float w[]);
void two_stage_pitch_refinement(MODEL *model, COMP Sw[]);
void estimate_amplitudes(MODEL *model, COMP Sw[], COMP W[]);
-float est_voicing_mbe(MODEL *model, COMP Sw[], COMP W[], COMP Sw_[],COMP Ew[],
+float est_voicing_mbe(MODEL *model, COMP Sw[], COMP W[], COMP Sw_[],COMP Ew[],
float prev_Wo);
void make_synthesis_window(float Pn[]);
void synthesise(float Sn_[], MODEL *model, float Pn[], int shift);
diff --git a/gr-vocoder/lib/g7xx/g72x.h b/gr-vocoder/lib/g7xx/g72x.h
index 33807171a..9d906cae7 100644
--- a/gr-vocoder/lib/g7xx/g72x.h
+++ b/gr-vocoder/lib/g7xx/g72x.h
@@ -103,36 +103,36 @@ extern int g723_40_decoder(
extern int
quantize(
- int d,
- int y,
- short *table,
+ int d,
+ int y,
+ short *table,
int size);
extern int reconstruct(int,int,int);void
extern update(
- int code_size,
- int y,
- int wi,
- int fi,
- int dq,
- int sr,
- int dqsez,
+ int code_size,
+ int y,
+ int wi,
+ int fi,
+ int dq,
+ int sr,
+ int dqsez,
struct g72x_state *state_ptr);
extern int
tandem_adjust_alaw(
- int sr,
- int se,
- int y,
- int i,
+ int sr,
+ int se,
+ int y,
+ int i,
int sign,
short *qtab);
extern int
tandem_adjust_ulaw(
- int sr,
- int se,
- int y,
- int i,
+ int sr,
+ int se,
+ int y,
+ int i,
int sign,
short *qtab);
diff --git a/gr-vocoder/lib/gsm/README.gsm b/gr-vocoder/lib/gsm/README.gsm
index cb6af85cf..10470e04e 100644
--- a/gr-vocoder/lib/gsm/README.gsm
+++ b/gr-vocoder/lib/gsm/README.gsm
@@ -17,7 +17,7 @@ rate, i.e. a frame rate of 50 Hz) into 260 bits; for compatibility
with typical UNIX applications, our implementation turns frames of 160
16-bit linear samples into 33-byte frames (1650 Bytes/s).
The quality of the algorithm is good enough for reliable speaker
-recognition; even music often survives transcoding in recognizable
+recognition; even music often survives transcoding in recognizable
form (given the bandwidth limitations of 8 kHz sampling rate).
The interfaces offered are a front end modelled after compress(1), and
diff --git a/gr-vocoder/lib/gsm/add.c b/gr-vocoder/lib/gsm/add.c
index 21ccfabe7..4118107b1 100644
--- a/gr-vocoder/lib/gsm/add.c
+++ b/gr-vocoder/lib/gsm/add.c
@@ -88,7 +88,7 @@ longword gsm_L_sub P2((a,b), longword a, longword b)
}
else if (b <= 0) return a - b;
else {
- /* a<0, b>0 */
+ /* a<0, b>0 */
ulongword A = (ulongword)-(a + 1) + b;
return A >= MAX_LONGWORD ? MIN_LONGWORD : -(longword)A - 1;
@@ -120,7 +120,7 @@ word gsm_norm P1((a), longword a )
* variable L_var1 for positive values on the interval
*
* with minimum of
- * minimum of 1073741824 (01000000000000000000000000000000) and
+ * minimum of 1073741824 (01000000000000000000000000000000) and
* maximum of 2147483647 (01111111111111111111111111111111)
*
*
@@ -141,7 +141,7 @@ word gsm_norm P1((a), longword a )
a = ~a;
}
- return a & 0xffff0000
+ return a & 0xffff0000
? ( a & 0xff000000
? -1 + bitoff[ 0xFF & (a >> 24) ]
: 7 + bitoff[ 0xFF & (a >> 16) ] )
@@ -194,7 +194,7 @@ word gsm_asr P2((a,n), word a, int n)
# endif
}
-/*
+/*
* (From p. 46, end of section 4.2.5)
*
* NOTE: The following lines gives [sic] one correct implementation
diff --git a/gr-vocoder/lib/gsm/code.c b/gr-vocoder/lib/gsm/code.c
index 19af507b7..68ea05226 100644
--- a/gr-vocoder/lib/gsm/code.c
+++ b/gr-vocoder/lib/gsm/code.c
@@ -21,8 +21,8 @@
#include "proto.h"
#include <string.h>
-/*
- * 4.2 FIXED POINT IMPLEMENTATION OF THE RPE-LTP CODER
+/*
+ * 4.2 FIXED POINT IMPLEMENTATION OF THE RPE-LTP CODER
*/
void Gsm_Coder P8((S,s,LARc,Nc,bc,Mc,xmaxc,xMc),
@@ -35,7 +35,7 @@ void Gsm_Coder P8((S,s,LARc,Nc,bc,Mc,xmaxc,xMc),
* The RPE-LTD coder works on a frame by frame basis. The length of
* the frame is equal to 160 samples. Some computations are done
* once per frame to produce at the output of the coder the
- * LARc[1..8] parameters which are the coded LAR coefficients and
+ * LARc[1..8] parameters which are the coded LAR coefficients and
* also to realize the inverse filtering operation for the entire
* frame (160 samples of signal d[0..159]). These parts produce at
* the output of the coder:
diff --git a/gr-vocoder/lib/gsm/debug.c b/gr-vocoder/lib/gsm/debug.c
index e05210428..58d1dbcac 100644
--- a/gr-vocoder/lib/gsm/debug.c
+++ b/gr-vocoder/lib/gsm/debug.c
@@ -18,7 +18,7 @@
#include <stdio.h>
#include "proto.h"
-void gsm_debug_words P4( (name, from, to, ptr),
+void gsm_debug_words P4( (name, from, to, ptr),
char * name,
int from,
int to,
diff --git a/gr-vocoder/lib/gsm/gsm.h b/gr-vocoder/lib/gsm/gsm.h
index 990e42af5..a6d5e4705 100644
--- a/gr-vocoder/lib/gsm/gsm.h
+++ b/gr-vocoder/lib/gsm/gsm.h
@@ -57,7 +57,7 @@ typedef gsm_byte gsm_frame[33]; /* 33 * 8 bits */
#define GSM_SAMPLES_PER_FRAME 160
extern gsm gsm_create GSM_P((void));
-extern void gsm_destroy GSM_P((gsm));
+extern void gsm_destroy GSM_P((gsm));
extern int gsm_print GSM_P((FILE *, gsm, gsm_byte *));
extern int gsm_option GSM_P((gsm, int, int *));
diff --git a/gr-vocoder/lib/gsm/gsm_decode.c b/gr-vocoder/lib/gsm/gsm_decode.c
index 7318ba2d4..7ebf35dd0 100644
--- a/gr-vocoder/lib/gsm/gsm_decode.c
+++ b/gr-vocoder/lib/gsm/gsm_decode.c
@@ -206,7 +206,7 @@ int gsm_decode P3((s, c, target), gsm s, gsm_byte * c, gsm_signal * target)
xmaxc[2] = sr & 0x3f; sr >>= 6;
xmc[26] = sr & 0x7; sr >>= 3;
xmc[27] = sr & 0x7; sr >>= 3;
- sr |= (uword)*c++ << 1;
+ sr |= (uword)*c++ << 1;
xmc[28] = sr & 0x7; sr >>= 3;
xmc[29] = sr & 0x7; sr >>= 3;
xmc[30] = sr & 0x7; sr >>= 3;
@@ -223,7 +223,7 @@ int gsm_decode P3((s, c, target), gsm s, gsm_byte * c, gsm_signal * target)
xmc[38] = sr & 0x7; sr >>= 3;
sr = *c++;
Nc[3] = sr & 0x7f; sr >>= 7;
- sr |= (uword)*c++ << 1;
+ sr |= (uword)*c++ << 1;
bc[3] = sr & 0x3; sr >>= 2;
Mc[3] = sr & 0x3; sr >>= 2;
sr |= (uword)*c++ << 5;
diff --git a/gr-vocoder/lib/gsm/gsm_explode.c b/gr-vocoder/lib/gsm/gsm_explode.c
index a906fc2ed..744ded5af 100644
--- a/gr-vocoder/lib/gsm/gsm_explode.c
+++ b/gr-vocoder/lib/gsm/gsm_explode.c
@@ -228,7 +228,7 @@ int gsm_explode P3((s, c, target), gsm s, gsm_byte * c, gsm_signal * target)
#define xmc (target + 46 - 26)
xmc[26] = sr & 0x7; sr >>= 3;
xmc[27] = sr & 0x7; sr >>= 3;
- sr |= (uword)*c++ << 1;
+ sr |= (uword)*c++ << 1;
xmc[28] = sr & 0x7; sr >>= 3;
xmc[29] = sr & 0x7; sr >>= 3;
xmc[30] = sr & 0x7; sr >>= 3;
@@ -245,7 +245,7 @@ int gsm_explode P3((s, c, target), gsm s, gsm_byte * c, gsm_signal * target)
xmc[38] = sr & 0x7; sr >>= 3;
sr = *c++;
Nc[3] = sr & 0x7f; sr >>= 7;
- sr |= (uword)*c++ << 1;
+ sr |= (uword)*c++ << 1;
bc[3] = sr & 0x3; sr >>= 2;
Mc[3] = sr & 0x3; sr >>= 2;
sr |= (uword)*c++ << 5;
@@ -273,7 +273,7 @@ int gsm_explode P3((s, c, target), gsm s, gsm_byte * c, gsm_signal * target)
xmc[51] = sr & 0x7; sr >>= 3;
}
}
- else
+ else
#endif
{
/* GSM_MAGIC = (*c >> 4) & 0xF; */
diff --git a/gr-vocoder/lib/gsm/gsm_implode.c b/gr-vocoder/lib/gsm/gsm_implode.c
index 453b8cf39..08ebf5853 100644
--- a/gr-vocoder/lib/gsm/gsm_implode.c
+++ b/gr-vocoder/lib/gsm/gsm_implode.c
@@ -316,7 +316,7 @@ void gsm_implode P3((s, source, c), gsm s, gsm_signal * source, gsm_byte * c)
#define xmc (source + 46 - 26)
xmc[26] = sr & 0x7; sr >>= 3;
xmc[27] = sr & 0x7; sr >>= 3;
- sr |= (uword)*c++ << 1;
+ sr |= (uword)*c++ << 1;
xmc[28] = sr & 0x7; sr >>= 3;
xmc[29] = sr & 0x7; sr >>= 3;
xmc[30] = sr & 0x7; sr >>= 3;
@@ -333,7 +333,7 @@ void gsm_implode P3((s, source, c), gsm s, gsm_signal * source, gsm_byte * c)
xmc[38] = sr & 0x7; sr >>= 3;
sr = *c++;
Nc[3] = sr & 0x7f; sr >>= 7;
- sr |= (uword)*c++ << 1;
+ sr |= (uword)*c++ << 1;
bc[3] = sr & 0x3; sr >>= 2;
Mc[3] = sr & 0x3; sr >>= 2;
sr |= (uword)*c++ << 5;
@@ -361,7 +361,7 @@ void gsm_implode P3((s, source, c), gsm s, gsm_signal * source, gsm_byte * c)
}
}
else
-#endif
+#endif
{
*c++ = ((GSM_MAGIC & 0xF) << 4) /* 1 */
diff --git a/gr-vocoder/lib/gsm/gsm_option.c b/gr-vocoder/lib/gsm/gsm_option.c
index 280780132..303170a9c 100644
--- a/gr-vocoder/lib/gsm/gsm_option.c
+++ b/gr-vocoder/lib/gsm/gsm_option.c
@@ -56,7 +56,7 @@ int gsm_option P3((r, opt, val), gsm r, int opt, int * val)
case GSM_OPT_WAV49:
-#ifdef WAV49
+#ifdef WAV49
result = r->wav_fmt;
if (val) r->wav_fmt = !!*val;
#endif
diff --git a/gr-vocoder/lib/gsm/long_term.c b/gr-vocoder/lib/gsm/long_term.c
index fd67bda19..7dd9631e0 100644
--- a/gr-vocoder/lib/gsm/long_term.c
+++ b/gr-vocoder/lib/gsm/long_term.c
@@ -330,7 +330,7 @@ static void Cut_Calculation_of_the_LTP_parameters P5((st, d,dp,bc_out,Nc_out),
else scal = 6 - temp;
assert(scal >= 0);
- ltp_cut = (longword)SASR(dmax, scal) * st->ltp_cut / 100;
+ ltp_cut = (longword)SASR(dmax, scal) * st->ltp_cut / 100;
/* Initialization of a working array wt
@@ -362,7 +362,7 @@ static void Cut_Calculation_of_the_LTP_parameters P5((st, d,dp,bc_out,Nc_out),
register float a = lp[-8], b = lp[-7], c = lp[-6],
d = lp[-5], e = lp[-4], f = lp[-3],
g = lp[-2], h = lp[-1];
- register float E;
+ register float E;
register float S0 = 0, S1 = 0, S2 = 0, S3 = 0, S4 = 0,
S5 = 0, S6 = 0, S7 = 0, S8 = 0;
@@ -528,7 +528,7 @@ static void Calculation_of_the_LTP_parameters P4((d,dp,bc_out,Nc_out),
register float a = lp[-8], b = lp[-7], c = lp[-6],
d = lp[-5], e = lp[-4], f = lp[-3],
g = lp[-2], h = lp[-1];
- register float E;
+ register float E;
register float S0 = 0, S1 = 0, S2 = 0, S3 = 0, S4 = 0,
S5 = 0, S6 = 0, S7 = 0, S8 = 0;
@@ -742,7 +742,7 @@ static void Fast_Calculation_of_the_LTP_parameters P4((d,dp,bc_out,Nc_out),
register float a = lp[-8], b = lp[-7], c = lp[-6],
d = lp[-5], e = lp[-4], f = lp[-3],
g = lp[-2], h = lp[-1];
- register float E;
+ register float E;
register float S0 = 0, S1 = 0, S2 = 0, S3 = 0, S4 = 0,
S5 = 0, S6 = 0, S7 = 0, S8 = 0;
@@ -860,7 +860,7 @@ static void Long_term_analysis_filtering P6((bc,Nc,dp,d,dpp,e),
case 0: STEP( 3277 ); break;
case 1: STEP( 11469 ); break;
case 2: STEP( 21299 ); break;
- case 3: STEP( 32767 ); break;
+ case 3: STEP( 32767 ); break;
}
}
@@ -881,7 +881,7 @@ void Gsm_Long_Term_Predictor P7((S,d,dp,e,dpp,Nc,bc), /* 4x for 160 samples */
assert( dpp); assert( Nc ); assert( bc );
#if defined(FAST) && defined(USE_FLOAT_MUL)
- if (S->fast)
+ if (S->fast)
#if defined (LTP_CUT)
if (S->ltp_cut)
Cut_Fast_Calculation_of_the_LTP_parameters(S,
@@ -889,7 +889,7 @@ void Gsm_Long_Term_Predictor P7((S,d,dp,e,dpp,Nc,bc), /* 4x for 160 samples */
else
#endif /* LTP_CUT */
Fast_Calculation_of_the_LTP_parameters(d, dp, bc, Nc );
- else
+ else
#endif /* FAST & USE_FLOAT_MUL */
#ifdef LTP_CUT
if (S->ltp_cut)
@@ -930,7 +930,7 @@ void Gsm_Long_Term_Synthesis_Filtering P5((S,Ncr,bcr,erp,drp),
*/
brp = gsm_QLB[ bcr ];
- /* Computation of the reconstructed short term residual
+ /* Computation of the reconstructed short term residual
* signal drp[0..39]
*/
assert(brp != MIN_WORD);
diff --git a/gr-vocoder/lib/gsm/lpc.c b/gr-vocoder/lib/gsm/lpc.c
index ac2b8a9eb..bc1695c41 100644
--- a/gr-vocoder/lib/gsm/lpc.c
+++ b/gr-vocoder/lib/gsm/lpc.c
@@ -69,7 +69,7 @@ static void Autocorrelation P2((s, L_ACF),
float_s[k] = (float) \
(s[k] = GSM_MULT_R(s[k], 16384 >> (n-1)));\
break;
-# else
+# else
# define SCALE(n) \
case n: for (k = 0; k <= 159; k++) \
s[k] = GSM_MULT_R( s[k], 16384 >> (n-1) );\
@@ -133,13 +133,13 @@ static void Autocorrelation P2((s, L_ACF),
STEP(5); STEP(6); STEP(7); STEP(8);
}
- for (k = 9; k--; L_ACF[k] <<= 1) ;
+ for (k = 9; k--; L_ACF[k] <<= 1) ;
}
/* Rescaling of the array s[0..159]
*/
if (scalauto > 0) {
- assert(scalauto <= 4);
+ assert(scalauto <= 4);
for (k = 160; k--; *s++ <<= scalauto) ;
}
}
@@ -224,7 +224,7 @@ static void Reflection_coefficients P2( (L_ACF, r),
assert(*r >= 0);
if (P[1] > 0) *r = -*r; /* r[n] = sub(0, r[n]) */
assert (*r != MIN_WORD);
- if (n == 8) return;
+ if (n == 8) return;
/* Schur recursion
*/
@@ -294,7 +294,7 @@ static void Quantization_and_coding P1((LAR),
/* This procedure needs four tables; the following equations
* give the optimum scaling for the constants:
- *
+ *
* A[0..7] = integer( real_A[0..7] * 1024 )
* B[0..7] = integer( real_B[0..7] * 512 )
* MAC[0..7] = maximum of the LARc[0..7]
diff --git a/gr-vocoder/lib/gsm/preprocess.c b/gr-vocoder/lib/gsm/preprocess.c
index 1e1bbf8b0..abc47c72b 100644
--- a/gr-vocoder/lib/gsm/preprocess.c
+++ b/gr-vocoder/lib/gsm/preprocess.c
@@ -15,7 +15,7 @@
#include "proto.h"
/* 4.2.0 .. 4.2.3 PREPROCESSING SECTION
- *
+ *
* After A-law to linear conversion (or directly from the
* Ato D converter) the following scaling is assumed for
* input to the RPE-LTP algorithm:
@@ -26,7 +26,7 @@
* Where S is the sign bit, v a valid bit, and * a "don't care" bit.
* The original signal is called sop[..]
*
- * out: 0.1................... 12
+ * out: 0.1................... 12
* S.S.v.v.v.v.v.v.v.v.v.v.v.v.0.0
*/
@@ -66,7 +66,7 @@ void Gsm_Preprocess P3((S, s, so),
/* 4.2.2 Offset compensation
- *
+ *
* This part implements a high-pass filter and requires extended
* arithmetic precision for the recursive part of this filter.
* The input of this procedure is the array so[0...159] and the
diff --git a/gr-vocoder/lib/gsm/private.h b/gr-vocoder/lib/gsm/private.h
index 6b538cc27..ca42cd537 100644
--- a/gr-vocoder/lib/gsm/private.h
+++ b/gr-vocoder/lib/gsm/private.h
@@ -82,10 +82,10 @@ extern longword gsm_L_asr P((longword a, int n));
extern word gsm_asr P((word a, int n));
/*
- * Inlined functions from add.h
+ * Inlined functions from add.h
*/
-/*
+/*
* #define GSM_MULT_R(a, b) (* word a, word b, !(a == b == MIN_WORD) *) \
* (0x0FFFF & SASR(((longword)(a) * (longword)(b) + 16384), 15))
*/
@@ -170,10 +170,10 @@ extern void Gsm_Preprocess P((
extern void Gsm_Encoding P((
struct gsm_state * S,
- word * e,
- word * ep,
+ word * e,
+ word * ep,
word * xmaxc,
- word * Mc,
+ word * Mc,
word * xMc));
extern void Gsm_Short_Term_Analysis_Filter P((
diff --git a/gr-vocoder/lib/gsm/proto.h b/gr-vocoder/lib/gsm/proto.h
index 87cf05e8a..ea60abfe7 100644
--- a/gr-vocoder/lib/gsm/proto.h
+++ b/gr-vocoder/lib/gsm/proto.h
@@ -40,7 +40,7 @@
# define P1(x, a) (a)
# define P2(x, a, b) (a, b)
# define P3(x, a, b, c) (a, b, c)
-# define P4(x, a, b, c, d) (a, b, c, d)
+# define P4(x, a, b, c, d) (a, b, c, d)
# define P5(x, a, b, c, d, e) (a, b, c, d, e)
# define P6(x, a, b, c, d, e, f) (a, b, c, d, e, f)
# define P7(x, a, b, c, d, e, f, g) (a, b, c, d, e, f, g)
diff --git a/gr-vocoder/lib/gsm/rpe.c b/gr-vocoder/lib/gsm/rpe.c
index 8a6b81fae..bdc78910e 100644
--- a/gr-vocoder/lib/gsm/rpe.c
+++ b/gr-vocoder/lib/gsm/rpe.c
@@ -27,7 +27,7 @@ static void Weighting_filter P2((e, x),
* The coefficients of the weighting filter are stored in a table
* (see table 4.4). The following scaling is used:
*
- * H[0..10] = integer( real_H[ 0..10] * 8192 );
+ * H[0..10] = integer( real_H[ 0..10] * 8192 );
*/
{
/* word wt[ 50 ]; */
@@ -48,7 +48,7 @@ static void Weighting_filter P2((e, x),
e -= 5;
/* Compute the signal x[0..39]
- */
+ */
for (k = 0; k <= 39; k++) {
L_result = 8192 >> 1;
@@ -63,7 +63,7 @@ static void Weighting_filter P2((e, x),
#define STEP( i, H ) (e[ k + i ] * (longword)H)
/* Every one of these multiplications is done twice --
- * but I don't see an elegant way to optimize this.
+ * but I don't see an elegant way to optimize this.
* Do you?
*/
@@ -81,16 +81,16 @@ static void Weighting_filter P2((e, x),
L_result += STEP( 10, -134 ) ;
#else
L_result +=
- STEP( 0, -134 )
- + STEP( 1, -374 )
+ STEP( 0, -134 )
+ + STEP( 1, -374 )
/* + STEP( 2, 0 ) */
- + STEP( 3, 2054 )
- + STEP( 4, 5741 )
- + STEP( 5, 8192 )
- + STEP( 6, 5741 )
- + STEP( 7, 2054 )
+ + STEP( 3, 2054 )
+ + STEP( 4, 5741 )
+ + STEP( 5, 8192 )
+ + STEP( 6, 5741 )
+ + STEP( 7, 2054 )
/* + STEP( 8, 0 ) */
- + STEP( 9, -374 )
+ + STEP( 9, -374 )
+ STEP(10, -134 )
;
#endif
@@ -114,7 +114,7 @@ static void Weighting_filter P2((e, x),
/* 4.2.14 */
static void RPE_grid_selection P3((x,xM,Mc_out),
- word * x, /* [0..39] IN */
+ word * x, /* [0..39] IN */
word * xM, /* [0..12] OUT */
word * Mc_out /* OUT */
)
@@ -147,7 +147,7 @@ static void RPE_grid_selection P3((x,xM,Mc_out),
* L_temp = GSM_L_MULT( temp1, temp1 );
* L_result = GSM_L_ADD( L_temp, L_result );
* }
- *
+ *
* if (L_result > EM) {
* Mc = m;
* EM = L_result;
@@ -310,7 +310,7 @@ static void APCM_quantization P5((xM,xMc,mant_out,exp_out,xmaxc_out),
* can be calculated by using the exponent and the mantissa part of
* xmaxc (logarithmic table).
* So, this method avoids any division and uses only a scaling
- * of the RPE samples by a function of the exponent. A direct
+ * of the RPE samples by a function of the exponent. A direct
* multiplication by the inverse of the mantissa (NRFAC[0..7]
* found in table 4.5) gives the 3 bit coded version xMc[0..12]
* of the RPE samples.
@@ -321,7 +321,7 @@ static void APCM_quantization P5((xM,xMc,mant_out,exp_out,xmaxc_out),
*/
assert( exp <= 4096 && exp >= -4096);
- assert( mant >= 0 && mant <= 7 );
+ assert( mant >= 0 && mant <= 7 );
temp1 = 6 - exp; /* normalization by the exponent */
temp2 = gsm_NRFAC[ mant ]; /* inverse mantissa */
@@ -351,7 +351,7 @@ static void APCM_inverse_quantization P4((xMc,mant,exp,xMp),
word mant,
word exp,
register word * xMp) /* [0..12] OUT */
-/*
+/*
* This part is for decoding the RPE sequence of coded xMc[0..12]
* samples to obtain the xMp[0..12] array. Table 4.6 is used to get
* the mantissa of xmaxc (FAC[0..7]).
@@ -361,7 +361,7 @@ static void APCM_inverse_quantization P4((xMc,mant,exp,xMp),
word temp, temp1, temp2, temp3;
longword ltmp;
- assert( mant >= 0 && mant <= 7 );
+ assert( mant >= 0 && mant <= 7 );
temp1 = gsm_FAC[ mant ]; /* see 4.2-15 for mant */
temp2 = gsm_sub( 6, exp ); /* see 4.2-15 for exp */
@@ -438,7 +438,7 @@ void Gsm_Update_of_reconstructed_short_time_residual_signal P3((dpp, ep, dp),
{
int k;
- for (k = 0; k <= 79; k++)
+ for (k = 0; k <= 79; k++)
dp[ -120 + k ] = dp[ -80 + k ];
for (k = 0; k <= 39; k++)
diff --git a/gr-vocoder/lib/gsm/short_term.c b/gr-vocoder/lib/gsm/short_term.c
index 4f5fd7be7..68aabe5bb 100644
--- a/gr-vocoder/lib/gsm/short_term.c
+++ b/gr-vocoder/lib/gsm/short_term.c
@@ -73,7 +73,7 @@ static void Decoding_of_the_coded_Log_Area_Ratios P2((LARc,LARpp),
}
/* 4.2.9 */
-/* Computation of the quantized reflection coefficients
+/* Computation of the quantized reflection coefficients
*/
/* 4.2.9.1 Interpolation of the LARpp[1..8] to get the LARp[1..8]
diff --git a/gr-vocoder/lib/gsm/table.c b/gr-vocoder/lib/gsm/table.c
index 16a04118c..d8366931e 100644
--- a/gr-vocoder/lib/gsm/table.c
+++ b/gr-vocoder/lib/gsm/table.c
@@ -51,7 +51,7 @@ word gsm_QLB[4] = { 3277, 11469, 21299, 32767 };
word gsm_H[11] = {-134, -374, 0, 2054, 5741, 8192, 5741, 2054, 0, -374, -134 };
-/* Table 4.5 Normalized inverse mantissa used to compute xM/xmax
+/* Table 4.5 Normalized inverse mantissa used to compute xM/xmax
*/
/* i 0 1 2 3 4 5 6 7 */
word gsm_NRFAC[8] = { 29128, 26215, 23832, 21846, 20165, 18725, 17476, 16384 };
diff --git a/gr-vocoder/lib/vocoder_alaw_decode_bs.cc b/gr-vocoder/lib/vocoder_alaw_decode_bs.cc
index 7ffdddd81..33c119e05 100644
--- a/gr-vocoder/lib/vocoder_alaw_decode_bs.cc
+++ b/gr-vocoder/lib/vocoder_alaw_decode_bs.cc
@@ -1,19 +1,19 @@
/* -*- c++ -*- */
/*
* Copyright 2011 Free Software Foundation, Inc.
- *
+ *
* This file is part of GNU Radio
- *
+ *
* GNU Radio is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
- *
+ *
* GNU Radio is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
@@ -50,7 +50,7 @@ vocoder_alaw_decode_bs::~vocoder_alaw_decode_bs()
-int
+int
vocoder_alaw_decode_bs::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
@@ -60,6 +60,6 @@ vocoder_alaw_decode_bs::work(int noutput_items,
for(int i = 0; i < noutput_items; i++)
out[i] = alaw2linear(in[i]);
-
+
return noutput_items;
}
diff --git a/gr-vocoder/lib/vocoder_alaw_encode_sb.cc b/gr-vocoder/lib/vocoder_alaw_encode_sb.cc
index e4d975271..ebb953c34 100644
--- a/gr-vocoder/lib/vocoder_alaw_encode_sb.cc
+++ b/gr-vocoder/lib/vocoder_alaw_encode_sb.cc
@@ -1,19 +1,19 @@
/* -*- c++ -*- */
/*
* Copyright 2011 Free Software Foundation, Inc.
- *
+ *
* This file is part of GNU Radio
- *
+ *
* GNU Radio is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
- *
+ *
* GNU Radio is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
@@ -48,14 +48,14 @@ vocoder_alaw_encode_sb::~vocoder_alaw_encode_sb()
{
}
-int
+int
vocoder_alaw_encode_sb::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
const short *in = (const short *)input_items[0];
unsigned char *out = (unsigned char *)output_items[0];
-
+
for(int i = 0; i < noutput_items; i++)
out[i] = linear2alaw(in[i]);
diff --git a/gr-vocoder/lib/vocoder_codec2_decode_ps.cc b/gr-vocoder/lib/vocoder_codec2_decode_ps.cc
index b1feb1aaf..8e95c75dd 100644
--- a/gr-vocoder/lib/vocoder_codec2_decode_ps.cc
+++ b/gr-vocoder/lib/vocoder_codec2_decode_ps.cc
@@ -1,19 +1,19 @@
/* -*- c++ -*- */
/*
* Copyright 2005,2011 Free Software Foundation, Inc.
- *
+ *
* This file is part of GNU Radio
- *
+ *
* GNU Radio is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
- *
+ *
* GNU Radio is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
diff --git a/gr-vocoder/lib/vocoder_codec2_encode_sp.cc b/gr-vocoder/lib/vocoder_codec2_encode_sp.cc
index 1f22e38b2..da1c59c43 100644
--- a/gr-vocoder/lib/vocoder_codec2_encode_sp.cc
+++ b/gr-vocoder/lib/vocoder_codec2_encode_sp.cc
@@ -1,19 +1,19 @@
/* -*- c++ -*- */
/*
* Copyright 2005,2011 Free Software Foundation, Inc.
- *
+ *
* This file is part of GNU Radio
- *
+ *
* GNU Radio is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
- *
+ *
* GNU Radio is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
diff --git a/gr-vocoder/lib/vocoder_cvsd_decode_bs.cc b/gr-vocoder/lib/vocoder_cvsd_decode_bs.cc
index baf99f041..8202ec36c 100644
--- a/gr-vocoder/lib/vocoder_cvsd_decode_bs.cc
+++ b/gr-vocoder/lib/vocoder_cvsd_decode_bs.cc
@@ -1,19 +1,19 @@
/* -*- c++ -*- */
/*
* Copyright 2007,2010,2011 Free Software Foundation, Inc.
- *
+ *
* This file is part of GNU Radio
- *
+ *
* GNU Radio is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
- *
+ *
* GNU Radio is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
@@ -37,7 +37,7 @@
* Create a new instance of vocoder_cvsd_decode_bs and return
* a boost shared_ptr. This is effectively the public constructor.
*/
-vocoder_cvsd_decode_bs_sptr
+vocoder_cvsd_decode_bs_sptr
vocoder_make_cvsd_decode_bs (short min_step, short max_step, double step_decay,
double accum_decay, int K, int J,
short pos_accum_max, short neg_accum_max)
@@ -47,7 +47,7 @@ vocoder_make_cvsd_decode_bs (short min_step, short max_step, double step_decay,
pos_accum_max, neg_accum_max));
}
-vocoder_cvsd_decode_bs::vocoder_cvsd_decode_bs (short min_step, short max_step, double step_decay,
+vocoder_cvsd_decode_bs::vocoder_cvsd_decode_bs (short min_step, short max_step, double step_decay,
double accum_decay, int K, int J,
short pos_accum_max, short neg_accum_max)
: gr_sync_interpolator ("vocoder_cvsd_decode_bs",
@@ -55,14 +55,14 @@ vocoder_cvsd_decode_bs::vocoder_cvsd_decode_bs (short min_step, short max_step,
gr_make_io_signature (1, 1, sizeof (short)),
8),
d_min_step (min_step), d_max_step(max_step), d_step_decay(step_decay),
- d_accum_decay(accum_decay), d_K(K), d_J(J),
+ d_accum_decay(accum_decay), d_K(K), d_J(J),
d_pos_accum_max(pos_accum_max), d_neg_accum_max(neg_accum_max),
- d_accum(0),
- d_loop_counter(1),
+ d_accum(0),
+ d_loop_counter(1),
d_runner(0),
d_runner_mask(0),
d_stepsize(min_step)
-
+
{
assert(d_K <= 32);
assert(d_J <= d_K);
@@ -78,7 +78,7 @@ unsigned char vocoder_cvsd_decode_bs::cvsd_bitwise_sum (unsigned int input)
{
unsigned int temp=input;
unsigned char bits=0;
-
+
while(temp) {
temp=temp&(temp-1);
bits++;
@@ -91,7 +91,7 @@ int vocoder_cvsd_decode_bs::cvsd_round (double input)
double temp;
temp=input+0.5;
temp=floor(temp);
-
+
return (int)temp;
}
@@ -100,18 +100,18 @@ unsigned int vocoder_cvsd_decode_bs::cvsd_pow (short radix, short power)
double d_radix = (double) radix;
int i_power = (int) power;
double output;
-
+
output=pow(d_radix,i_power);
- return ( (unsigned int) cvsd_round(output));
+ return ( (unsigned int) cvsd_round(output));
}
-int
+int
vocoder_cvsd_decode_bs::work (int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
-
+
const unsigned char *in = (const unsigned char *) input_items[0];
short *out = (short *) output_items[0];
@@ -122,28 +122,28 @@ vocoder_cvsd_decode_bs::work (int noutput_items,
unsigned int mask=0; // 4 bytes, 0 .. 4,294,967,295
unsigned char input_byte=0; // 1 bytes
unsigned char input_bit=0; // 1 byte, 0 .. 255
-
+
// Loop through each input data point
for(i = 0; i < noutput_items/8.0; i++) {
input_byte = in[i];
// Initiliaze bit counter
- bit_count=0;
-
+ bit_count=0;
+
while(bit_count<8) {
// Compute the Appropriate Mask
mask=cvsd_pow(2,7-bit_count);
-
+
// Pull off the corresponding bit
input_bit = input_byte & mask;
-
+
// Update the bit counter
bit_count++;
-
+
// Update runner with the next input bit
// Runner is a shift-register; shift left, add on newest output bit
d_runner = (d_runner<<1) | ((unsigned int) input_bit);
-
+
// Run this only if you have >= J bits in your shift register
if (d_loop_counter>=d_J) {
// Update Step Size
@@ -157,7 +157,7 @@ vocoder_cvsd_decode_bs::work (int noutput_items,
d_stepsize = std::max( (short) cvsd_round(d_stepsize*d_step_decay), d_min_step);
}
}
-
+
// Update Accum (i.e. the reference value)
if (input_bit) {
d_accum=d_accum+d_stepsize;
@@ -165,10 +165,10 @@ vocoder_cvsd_decode_bs::work (int noutput_items,
else {
d_accum=d_accum-d_stepsize;
}
-
+
// Multiply by Accum_Decay
d_accum=(cvsd_round(d_accum*d_accum_decay));
-
+
// Check for overflow
if (d_accum >=((int) d_pos_accum_max)) {
d_accum=(int)d_pos_accum_max;
@@ -176,18 +176,18 @@ vocoder_cvsd_decode_bs::work (int noutput_items,
else if (d_accum <=((int) d_neg_accum_max)) {
d_accum=(int)d_neg_accum_max;
}
-
+
// Find the output short to write to the file
output_short=((short) d_accum);
-
+
if (d_loop_counter <= d_K) {
d_loop_counter++;
}
-
+
*(out++) = output_short;
- } // while ()
-
+ } // while ()
+
} // for()
-
+
return noutput_items;
}
diff --git a/gr-vocoder/lib/vocoder_cvsd_encode_sb.cc b/gr-vocoder/lib/vocoder_cvsd_encode_sb.cc
index 71cf6df8c..e15882c22 100644
--- a/gr-vocoder/lib/vocoder_cvsd_encode_sb.cc
+++ b/gr-vocoder/lib/vocoder_cvsd_encode_sb.cc
@@ -1,19 +1,19 @@
/* -*- c++ -*- */
/*
* Copyright 2007,2010,2011 Free Software Foundation, Inc.
- *
+ *
* This file is part of GNU Radio
- *
+ *
* GNU Radio is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
- *
+ *
* GNU Radio is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
@@ -37,7 +37,7 @@
* Create a new instance of vocoder_cvsd_encode_sb and return
* a boost shared_ptr. This is effectively the public constructor.
*/
-vocoder_cvsd_encode_sb_sptr
+vocoder_cvsd_encode_sb_sptr
vocoder_make_cvsd_encode_sb (short min_step, short max_step, double step_decay,
double accum_decay, int K, int J,
short pos_accum_max, short neg_accum_max)
@@ -47,7 +47,7 @@ vocoder_make_cvsd_encode_sb (short min_step, short max_step, double step_decay,
pos_accum_max, neg_accum_max));
}
-vocoder_cvsd_encode_sb::vocoder_cvsd_encode_sb (short min_step, short max_step, double step_decay,
+vocoder_cvsd_encode_sb::vocoder_cvsd_encode_sb (short min_step, short max_step, double step_decay,
double accum_decay, int K, int J,
short pos_accum_max, short neg_accum_max)
: gr_sync_decimator ("vocoder_cvsd_encode_sb",
@@ -55,10 +55,10 @@ vocoder_cvsd_encode_sb::vocoder_cvsd_encode_sb (short min_step, short max_step,
gr_make_io_signature (1, 1, sizeof (unsigned char)),
8),
d_min_step (min_step), d_max_step(max_step), d_step_decay(step_decay),
- d_accum_decay(accum_decay), d_K(K), d_J(J),
+ d_accum_decay(accum_decay), d_K(K), d_J(J),
d_pos_accum_max(pos_accum_max), d_neg_accum_max(neg_accum_max),
- d_accum(0),
- d_loop_counter(1),
+ d_accum(0),
+ d_loop_counter(1),
d_runner(0),
d_stepsize(min_step)
@@ -77,7 +77,7 @@ unsigned char vocoder_cvsd_encode_sb::cvsd_bitwise_sum (unsigned int input)
{
unsigned int temp=input;
unsigned char bits=0;
-
+
while(temp) {
temp=temp&(temp-1);
bits++;
@@ -90,7 +90,7 @@ int vocoder_cvsd_encode_sb::cvsd_round (double input)
double temp;
temp=input+0.5;
temp=floor(temp);
-
+
return (int)temp;
}
@@ -101,10 +101,10 @@ unsigned int vocoder_cvsd_encode_sb::cvsd_pow (short radix, short power)
double output;
output=pow(d_radix,i_power);
- return ( (unsigned int) cvsd_round(output));
+ return ( (unsigned int) cvsd_round(output));
}
-int
+int
vocoder_cvsd_encode_sb::work (int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
@@ -117,7 +117,7 @@ vocoder_cvsd_encode_sb::work (int noutput_items,
unsigned char output_byte=0; // 1 bytes 0.255
unsigned char bit_count=0; // 1 byte, 0 .. 255
unsigned int mask=0; // 4 bytes, 0 .. 4,294,967,295
-
+
// Loop through each input data point
for(i = 0; i < noutput_items*8; i++) {
if((int)in[i] >= d_accum) { // Note: sign((data(n)-accum))
@@ -126,7 +126,7 @@ vocoder_cvsd_encode_sb::work (int noutput_items,
else {
output_bit=0;
}
-
+
// Update Accum (i.e. the reference value)
if (output_bit) {
d_accum=d_accum+d_stepsize;
@@ -147,7 +147,7 @@ vocoder_cvsd_encode_sb::work (int noutput_items,
else if(d_accum <= ((int) d_neg_accum_max)) {
d_accum = (int) d_neg_accum_max;
}
-
+
// Update runner with the last output bit
// Update Step Size
if (d_loop_counter >= d_J) { // Run this only if you have >= J bits in your shift register
@@ -158,10 +158,10 @@ vocoder_cvsd_encode_sb::work (int noutput_items,
}
else {
// No runs of 1s and 0s
- d_stepsize = std::max( (short)cvsd_round(d_stepsize*d_step_decay), d_min_step);
+ d_stepsize = std::max( (short)cvsd_round(d_stepsize*d_step_decay), d_min_step);
}
}
-
+
// Runner is a shift-register; shift left, add on newest output bit
d_runner = (d_runner<<1) | ((unsigned int) output_bit);
@@ -169,7 +169,7 @@ vocoder_cvsd_encode_sb::work (int noutput_items,
// If you have put in 8 bits, output it as a byte
output_byte = (output_byte<<1) | output_bit;
bit_count++;
-
+
if (d_loop_counter <= d_K) {
d_loop_counter++;
}
@@ -178,7 +178,7 @@ vocoder_cvsd_encode_sb::work (int noutput_items,
if (bit_count==8) {
// Read in short from the file
*(out++) = output_byte;
-
+
// Reset the bit_count
bit_count=0;
output_byte=0;
diff --git a/gr-vocoder/lib/vocoder_g721_decode_bs.cc b/gr-vocoder/lib/vocoder_g721_decode_bs.cc
index 2abee8d14..d5b737d1c 100644
--- a/gr-vocoder/lib/vocoder_g721_decode_bs.cc
+++ b/gr-vocoder/lib/vocoder_g721_decode_bs.cc
@@ -1,19 +1,19 @@
/* -*- c++ -*- */
/*
* Copyright 2011 Free Software Foundation, Inc.
- *
+ *
* This file is part of GNU Radio
- *
+ *
* GNU Radio is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
- *
+ *
* GNU Radio is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
@@ -66,7 +66,7 @@ vocoder_g721_decode_bs_impl::~vocoder_g721_decode_bs_impl()
{
}
-int
+int
vocoder_g721_decode_bs_impl::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
@@ -76,6 +76,6 @@ vocoder_g721_decode_bs_impl::work(int noutput_items,
for(int i = 0; i < noutput_items; i++)
out[i] = g721_decoder(in[i], AUDIO_ENCODING_LINEAR, &d_state);
-
+
return noutput_items;
}
diff --git a/gr-vocoder/lib/vocoder_g721_encode_sb.cc b/gr-vocoder/lib/vocoder_g721_encode_sb.cc
index 667e983dc..1e33613a5 100644
--- a/gr-vocoder/lib/vocoder_g721_encode_sb.cc
+++ b/gr-vocoder/lib/vocoder_g721_encode_sb.cc
@@ -1,19 +1,19 @@
/* -*- c++ -*- */
/*
* Copyright 2011 Free Software Foundation, Inc.
- *
+ *
* This file is part of GNU Radio
- *
+ *
* GNU Radio is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
- *
+ *
* GNU Radio is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
@@ -66,7 +66,7 @@ vocoder_g721_encode_sb_impl::~vocoder_g721_encode_sb_impl()
{
}
-int
+int
vocoder_g721_encode_sb_impl::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
@@ -76,6 +76,6 @@ vocoder_g721_encode_sb_impl::work(int noutput_items,
for(int i = 0; i < noutput_items; i++)
out[i] = g721_encoder(in[i], AUDIO_ENCODING_LINEAR, &d_state);
-
+
return noutput_items;
}
diff --git a/gr-vocoder/lib/vocoder_g723_24_decode_bs.cc b/gr-vocoder/lib/vocoder_g723_24_decode_bs.cc
index 2ea036c58..0bedfe4ca 100644
--- a/gr-vocoder/lib/vocoder_g723_24_decode_bs.cc
+++ b/gr-vocoder/lib/vocoder_g723_24_decode_bs.cc
@@ -1,19 +1,19 @@
/* -*- c++ -*- */
/*
* Copyright 2011 Free Software Foundation, Inc.
- *
+ *
* This file is part of GNU Radio
- *
+ *
* GNU Radio is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
- *
+ *
* GNU Radio is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
@@ -66,7 +66,7 @@ vocoder_g723_24_decode_bs_impl::~vocoder_g723_24_decode_bs_impl()
{
}
-int
+int
vocoder_g723_24_decode_bs_impl::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
@@ -76,6 +76,6 @@ vocoder_g723_24_decode_bs_impl::work(int noutput_items,
for(int i = 0; i < noutput_items; i++)
out[i] = g723_24_decoder(in[i], AUDIO_ENCODING_LINEAR, &d_state);
-
+
return noutput_items;
}
diff --git a/gr-vocoder/lib/vocoder_g723_24_encode_sb.cc b/gr-vocoder/lib/vocoder_g723_24_encode_sb.cc
index 7e6914223..1b61de79f 100644
--- a/gr-vocoder/lib/vocoder_g723_24_encode_sb.cc
+++ b/gr-vocoder/lib/vocoder_g723_24_encode_sb.cc
@@ -1,19 +1,19 @@
/* -*- c++ -*- */
/*
* Copyright 2011 Free Software Foundation, Inc.
- *
+ *
* This file is part of GNU Radio
- *
+ *
* GNU Radio is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
- *
+ *
* GNU Radio is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
@@ -66,7 +66,7 @@ vocoder_g723_24_encode_sb_impl::~vocoder_g723_24_encode_sb_impl()
{
}
-int
+int
vocoder_g723_24_encode_sb_impl::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
@@ -76,6 +76,6 @@ vocoder_g723_24_encode_sb_impl::work(int noutput_items,
for(int i = 0; i < noutput_items; i++)
out[i] = g723_24_encoder(in[i], AUDIO_ENCODING_LINEAR, &d_state);
-
+
return noutput_items;
}
diff --git a/gr-vocoder/lib/vocoder_g723_40_decode_bs.cc b/gr-vocoder/lib/vocoder_g723_40_decode_bs.cc
index 38fd0fb5e..cdc152896 100644
--- a/gr-vocoder/lib/vocoder_g723_40_decode_bs.cc
+++ b/gr-vocoder/lib/vocoder_g723_40_decode_bs.cc
@@ -1,19 +1,19 @@
/* -*- c++ -*- */
/*
* Copyright 2011 Free Software Foundation, Inc.
- *
+ *
* This file is part of GNU Radio
- *
+ *
* GNU Radio is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
- *
+ *
* GNU Radio is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
@@ -66,7 +66,7 @@ vocoder_g723_40_decode_bs_impl::~vocoder_g723_40_decode_bs_impl()
{
}
-int
+int
vocoder_g723_40_decode_bs_impl::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
@@ -76,6 +76,6 @@ vocoder_g723_40_decode_bs_impl::work(int noutput_items,
for(int i = 0; i < noutput_items; i++)
out[i] = g723_40_decoder(in[i], AUDIO_ENCODING_LINEAR, &d_state);
-
+
return noutput_items;
}
diff --git a/gr-vocoder/lib/vocoder_g723_40_encode_sb.cc b/gr-vocoder/lib/vocoder_g723_40_encode_sb.cc
index 1089306e7..083aaf97a 100644
--- a/gr-vocoder/lib/vocoder_g723_40_encode_sb.cc
+++ b/gr-vocoder/lib/vocoder_g723_40_encode_sb.cc
@@ -1,19 +1,19 @@
/* -*- c++ -*- */
/*
* Copyright 2011 Free Software Foundation, Inc.
- *
+ *
* This file is part of GNU Radio
- *
+ *
* GNU Radio is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
- *
+ *
* GNU Radio is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
@@ -66,7 +66,7 @@ vocoder_g723_40_encode_sb_impl::~vocoder_g723_40_encode_sb_impl()
{
}
-int
+int
vocoder_g723_40_encode_sb_impl::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
@@ -76,6 +76,6 @@ vocoder_g723_40_encode_sb_impl::work(int noutput_items,
for(int i = 0; i < noutput_items; i++)
out[i] = g723_40_encoder(in[i], AUDIO_ENCODING_LINEAR, &d_state);
-
+
return noutput_items;
}
diff --git a/gr-vocoder/lib/vocoder_gsm_fr_decode_ps.cc b/gr-vocoder/lib/vocoder_gsm_fr_decode_ps.cc
index 986e0814e..146ddf63c 100644
--- a/gr-vocoder/lib/vocoder_gsm_fr_decode_ps.cc
+++ b/gr-vocoder/lib/vocoder_gsm_fr_decode_ps.cc
@@ -1,19 +1,19 @@
/* -*- c++ -*- */
/*
* Copyright 2005,2010 Free Software Foundation, Inc.
- *
+ *
* This file is part of GNU Radio
- *
+ *
* GNU Radio is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
- *
+ *
* GNU Radio is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
diff --git a/gr-vocoder/lib/vocoder_gsm_fr_encode_sp.cc b/gr-vocoder/lib/vocoder_gsm_fr_encode_sp.cc
index 7a69b856d..5abb3a457 100644
--- a/gr-vocoder/lib/vocoder_gsm_fr_encode_sp.cc
+++ b/gr-vocoder/lib/vocoder_gsm_fr_encode_sp.cc
@@ -1,19 +1,19 @@
/* -*- c++ -*- */
/*
* Copyright 2005,2010 Free Software Foundation, Inc.
- *
+ *
* This file is part of GNU Radio
- *
+ *
* GNU Radio is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
- *
+ *
* GNU Radio is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
diff --git a/gr-vocoder/lib/vocoder_ulaw_decode_bs.cc b/gr-vocoder/lib/vocoder_ulaw_decode_bs.cc
index 3ade9d3f0..5abec77f8 100644
--- a/gr-vocoder/lib/vocoder_ulaw_decode_bs.cc
+++ b/gr-vocoder/lib/vocoder_ulaw_decode_bs.cc
@@ -1,19 +1,19 @@
/* -*- c++ -*- */
/*
* Copyright 2011 Free Software Foundation, Inc.
- *
+ *
* This file is part of GNU Radio
- *
+ *
* GNU Radio is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
- *
+ *
* GNU Radio is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
@@ -50,7 +50,7 @@ vocoder_ulaw_decode_bs::~vocoder_ulaw_decode_bs()
-int
+int
vocoder_ulaw_decode_bs::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
@@ -60,6 +60,6 @@ vocoder_ulaw_decode_bs::work(int noutput_items,
for(int i = 0; i < noutput_items; i++)
out[i] = ulaw2linear(in[i]);
-
+
return noutput_items;
}
diff --git a/gr-vocoder/lib/vocoder_ulaw_encode_sb.cc b/gr-vocoder/lib/vocoder_ulaw_encode_sb.cc
index 19c53d72c..3fabd7ad8 100644
--- a/gr-vocoder/lib/vocoder_ulaw_encode_sb.cc
+++ b/gr-vocoder/lib/vocoder_ulaw_encode_sb.cc
@@ -1,19 +1,19 @@
/* -*- c++ -*- */
/*
* Copyright 2011 Free Software Foundation, Inc.
- *
+ *
* This file is part of GNU Radio
- *
+ *
* GNU Radio is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
- *
+ *
* GNU Radio is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
@@ -48,14 +48,14 @@ vocoder_ulaw_encode_sb::~vocoder_ulaw_encode_sb()
{
}
-int
+int
vocoder_ulaw_encode_sb::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
const short *in = (const short *)input_items[0];
unsigned char *out = (unsigned char *)output_items[0];
-
+
for(int i = 0; i < noutput_items; i++)
out[i] = linear2ulaw(in[i]);