Wall extra clean pathces from Thomas, thanks
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Wed, 14 Mar 2012 20:15:24 +0000 (20:15 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Wed, 14 Mar 2012 20:15:24 +0000 (20:15 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@345 01035d8c-6547-0410-b346-abe4f91aad63

14 files changed:
codec2-dev/src/c2dec.c
codec2-dev/src/c2demo.c
codec2-dev/src/c2enc.c
codec2-dev/src/c2sim.c
codec2-dev/src/codec2.c
codec2-dev/src/interp.c
codec2-dev/src/nlp.c
codec2-dev/src/quantise.c
codec2-dev/src/quantise.h
codec2-dev/src/sine.c
codec2-dev/unittest/scalarlsptest.c
codec2-dev/unittest/tcodec2.c
codec2-dev/unittest/vqtrain.c
codec2-dev/unittest/vqtrainjnd.c

index e5dc7a398449546ac33709b1defa3037a0fb71ed..e3d90fd56e70737cb28ebf897daa83d33b9486bf 100644 (file)
@@ -87,7 +87,7 @@ int main(int argc, char *argv[])
     bits = (unsigned char*)malloc(nbyte*sizeof(char));
     frames = bit_errors = 0;
 
-    while(fread(bits, sizeof(char), nbyte, fin) == nbyte) {
+    while(fread(bits, sizeof(char), nbyte, fin) == (size_t)nbyte) {
        frames++;
        if (ber != 0.0) {
            for(i=0; i<nbit; i++) {
index c350f0f3d9b2ba5727749ea45ab420fd2b606813..97f7489c4f455afa31996a044db736f2d97c8484 100644 (file)
@@ -75,7 +75,7 @@ int main(int argc, char *argv[])
     nbit = codec2_bits_per_frame(codec2);
     bits = (unsigned char*)malloc(nbit*sizeof(char));
 
-    while(fread(buf, sizeof(short), nsam, fin) == nsam) {
+    while(fread(buf, sizeof(short), nsam, fin) == (size_t)nsam) {
        codec2_encode(codec2, bits, buf);
        codec2_decode(codec2, buf, bits);
        fwrite(buf, sizeof(short), nsam, fout);
index a91ef73c88e62c16eaf1e5deb66ee9dba5809826..8a5fc961b0f1636cbf5ca057730a738a30626522 100644 (file)
@@ -82,7 +82,7 @@ int main(int argc, char *argv[])
 
     bits = (unsigned char*)malloc(nbyte*sizeof(char));
     
-    while(fread(buf, sizeof(short), nsam, fin) == nsam) {
+    while(fread(buf, sizeof(short), nsam, fin) == (size_t)nsam) {
        codec2_encode(codec2, bits, buf);
        fwrite(bits, sizeof(char), nbyte, fout);
        //if this is in a pipeline, we probably don't want the usual
index 928cc7c8c5bbb221ac75a522fbd7e1059c08b100..9933797ba62396209d33e4caaf46a4542fba121d 100644 (file)
@@ -86,8 +86,6 @@ int main(int argc, char *argv[])
     COMP  Sw_[FFT_ENC];
     COMP  Ew[FFT_ENC]; 
  
-    int dump = 0;
-  
     int phase0 = 0;
     float ex_phase[MAX_AMP+1];
 
index 9f6a867b1ab7dafe69e458702000829b91b2cbe4..baf4538699046a80752be3dcaac7deafca0c3a2b 100644 (file)
@@ -307,7 +307,7 @@ void codec2_encode_2500(struct CODEC2 *c2, unsigned char * bits, short speech[])
     pack(bits, &nbit, voiced1, 1);
     pack(bits, &nbit, voiced2, 1);
     fprintf(stderr,"v2: %d  v1: %d\n", voiced2, voiced1);
-    assert(nbit == codec2_bits_per_frame(c2));
+    assert(nbit == (unsigned)codec2_bits_per_frame(c2));
 }
 
 
@@ -351,7 +351,7 @@ void codec2_decode_2500(struct CODEC2 *c2, short speech[], const unsigned char *
     energy_index = unpack(bits, &nbit, E_BITS);
     voiced1 = unpack(bits, &nbit, 1);
     voiced2 = unpack(bits, &nbit, 1);
-    assert(nbit == codec2_bits_per_frame(c2));
+    assert(nbit == (unsigned)codec2_bits_per_frame(c2));
 
     /* decode integer codes to model parameters */
 
@@ -541,7 +541,7 @@ void codec2_encode_1500(struct CODEC2 *c2, unsigned char * bits, short speech[])
     energy_index = unpack(bits, &nbit_tmp, E_BITS);
     // fprintf(stderr,"energy_index after: %d\n", energy_index);
 
-    assert(nbit == codec2_bits_per_frame(c2));
+    assert(nbit == (unsigned)codec2_bits_per_frame(c2));
     //if (frames == 36)
     //exit(0);
 }
@@ -661,7 +661,7 @@ void codec2_decode_1500(struct CODEC2 *c2, short speech[], const unsigned char *
     energy_index = unpack(bits, &nbit, E_BITS);
     voiced3 = unpack(bits, &nbit, 1);
     voiced4 = unpack(bits, &nbit, 1);
-    assert(nbit == codec2_bits_per_frame(c2));
+    assert(nbit == (unsigned)codec2_bits_per_frame(c2));
 
     /* decode integer codes to model parameters */
 
@@ -772,7 +772,7 @@ void codec2_encode_1200(struct CODEC2 *c2, unsigned char * bits, short speech[])
     unsigned int nbit = 0;
     unsigned int nbit_tmp;
     float   prev_Wo;
-    static  int frames;
+//    static  int frames;
 
     assert(c2 != NULL);
 
@@ -845,7 +845,7 @@ void codec2_encode_1200(struct CODEC2 *c2, unsigned char * bits, short speech[])
     energy_index = unpack(bits, &nbit_tmp, E_BITS);
     // fprintf(stderr,"energy_index after: %d\n", energy_index);
 
-    assert(nbit == codec2_bits_per_frame(c2));
+    assert(nbit == (unsigned)codec2_bits_per_frame(c2));
     //if (frames == 8)
     //exit(0);
 }
@@ -964,7 +964,7 @@ void codec2_decode_1200(struct CODEC2 *c2, short speech[], const unsigned char *
     energy_index = unpack(bits, &nbit, E_BITS);
     voiced3 = unpack(bits, &nbit, 1);
     voiced4 = unpack(bits, &nbit, 1);
-    assert(nbit == codec2_bits_per_frame(c2));
+    assert(nbit == (unsigned)codec2_bits_per_frame(c2));
 
     /* decode integer codes to model parameters */
 
index 9e59244e0a914d7a806b0039661217f6452fc3ef..c2c1ba405911cdfac54c48b1f1de2838b7b383e9 100644 (file)
@@ -157,7 +157,7 @@ void interpolate_lsp(
   float *lsps_interp/* interpolated lsps for this frame              */
 )
 {
-    int   l,i;
+    int   i;
     float e;
     float snr;
 
index 4e677d487b2d88791e85c62d0a5c9ee87cafbacf..11c723f09ae601ce7f15af05f7b70135476c4f99 100644 (file)
@@ -197,10 +197,10 @@ float nlp(
   float  Sn[],                 /* input speech vector */
   int    n,                    /* frames shift (no. new samples in Sn[]) */
   int    m,                    /* analysis window size */
-  int    pmin,                 /* minimum pitch value */
+  int    pmin __attribute__((unused)), /* minimum pitch value */
   int    pmax,                 /* maximum pitch value */
   float *pitch,                        /* estimated pitch period in samples */
-  COMP   Sw[],                  /* Freq domain version of Sn[] */
+  COMP   Sw[] __attribute__((unused)), /* Freq domain version of Sn[] */
   float *prev_Wo
 )
 {
@@ -307,7 +307,7 @@ float nlp(
 \*---------------------------------------------------------------------------*/
 
 float post_process_sub_multiples(COMP Fw[], 
-                                int pmin, int pmax, float gmax, int gmax_bin,
+                                int pmin __attribute__((unused)), int pmax, float gmax, int gmax_bin,
                                 float *prev_Wo)
 {
     int   min_bin, cmax_bin;
index 4c031100a3e7eb2cf5fc6c4328e0b4844608f12f..6567d571cdfda9b3ac9578a88d596b0b702d1d19 100644 (file)
@@ -242,7 +242,7 @@ void lspd_quantise(
 void lspvq_quantise(
   float lsp[], 
   float lsp_[],
-  int   order
+  int   order __attribute__((unused))
 ) 
 {
     int   i,k,m,ncb, nlsp;
@@ -299,7 +299,7 @@ void lspvq_quantise(
 
 \*---------------------------------------------------------------------------*/
 
-void lspjnd_quantise(float lsps[], float lsps_[], int order) 
+void lspjnd_quantise(float lsps[], float lsps_[], int order __attribute__((unused))
 {
     int   i,k,m;
     float  wt[LPC_ORD], lsps_hz[LPC_ORD];
@@ -363,14 +363,17 @@ void compute_weights(const float *x, float *w, int ndim);
 
 \*---------------------------------------------------------------------------*/
 
-void lspdt_quantise(float lsps[], float lsps_[], float lsps__prev[], int mode
+void lspdt_quantise(float lsps[], float lsps_[], float lsps__prev[], int mode __attribute__((unused)))
 {
-    int   i,k,m;
+    int   i;
     float wt[LPC_ORD];
     float lsps_dt[LPC_ORD];
+#ifdef TRY_LSPDT_VQ
+    int k,m;
+    int   index;
     const float *cb;
     float se = 0.0;
-    int   index;
+#endif // TRY_LSPDT_VQ
     
     //compute_weights(lsps, wt, LPC_ORD);
     for(i=0; i<LPC_ORD; i++) {
@@ -658,7 +661,7 @@ void aks_to_M2(
   MODEL *model,        /* sinusoidal model parameters for this frame */
   float  E,    /* energy term */
   float *snr,  /* signal to noise ratio for this frame in dB */
-  int    dump   /* true to dump sample to dump file */
+  int    dump __attribute__((unused)) /* true to dump sample to dump file */
 )
 {
   COMP Pw[FFT_DEC];    /* power spectrum */
@@ -1070,7 +1073,7 @@ void decode_lsps_diff_freq_vq(float lsp_[], int indexes[], int order)
 void encode_lsps_diff_time_vq(int indexes[], 
                              float lsps[], 
                              float lsps__prev[], 
-                             int order)
+                             int order __attribute__((unused)))
 {
     int    i,k,m;
     float  lsps_dt[LPC_ORD];
@@ -1423,7 +1426,7 @@ float decode_amplitudes(MODEL *model,
 
 static float ge_coeff[2] = {0.8, 0.9};
 
-void compute_weights2(const float *x, const float *xp, float *w, int ndim)
+void compute_weights2(const float *x, const float *xp, float *w, int ndim __attribute__((unused)))
 {
   w[0] = 30;
   w[1] = 1;
index 3bef499f6e0426a6efb41979f001ad87f3366495..8344a5f0096edcd8e2c3d0d05efb2d554f4d9da3 100644 (file)
@@ -71,6 +71,7 @@ void decode_lsps_diff_time_vq(
 void encode_lsps_vq(int *indexes, float *x, float *xq, int ndim);
 void decode_lsps_vq(int *indexes, float *xq, int ndim);
 
+long quantise(const float * cb, float vec[], float w[], int k, int m, float *se);
 void lspd_quantise(float lsp[], float lsp_[], int order);
 void lspvq_quantise(float lsp[], float lsp_[], int order); 
 void lspjnd_quantise(float lsp[], float lsp_[], int order);
@@ -98,5 +99,11 @@ float speech_to_uq_lsps(float lsp[],
 void check_lsp_order(float lsp[], int lpc_order);
 void bw_expand_lsps(float lsp[], int order);
 void locate_lsps_jnd_steps(float lsp[], int order);
+float decode_amplitudes(MODEL *model, 
+                       float  ak[],
+                       int    lsp_indexes[], 
+                       int    energy_index,
+                       float  lsps[],
+                       float *e);
 
 #endif
index a124788e39b7ac49ffd19af4101209d2a9b350a4..bc73b5146b0c696fce522b4ef6664358b4ef495b 100644 (file)
@@ -386,7 +386,7 @@ float est_voicing_mbe(
     COMP   Sw_[],         /* DFT of all voiced synthesised signal  */
                           /* useful for debugging/dump file        */
     COMP   Ew[],          /* DFT of error                          */
-    float prev_Wo)
+    float prev_Wo __attribute__((unused)))
 {
     int   i,l,al,bl,m;    /* loop variables */
     COMP  Am;             /* amplitude sample for this band */
index b55eeb9db5c1b09897b30e8f100a9371cbb7a50f..f77a6959ae258a56ff191d332dd724ec21908d1e 100644 (file)
@@ -47,9 +47,9 @@ int main(int argc, char *argv[])
     int k,m;             /* LSP vector order and codebook size */     
     int    index;
     float  wt[1];        /* weighting (not used here for scalars) */
-    float *cb;           /* LSP quantiser codebook */
+    const float *cb;           /* LSP quantiser codebook */
     int i, ret;               
-    float  se, total_se; 
+    float  total_se; 
 
     if (argc < 2) {
        printf("usage: %s InputFile\n", argv[0]);
index d89669e8eb09d4d52fef35c5f9e296dd439f8f2b..a0b5b4bece7d2efc16adea5503fb3c94dc47d198 100644 (file)
@@ -195,9 +195,9 @@ int test3()
     assert(fout != NULL);
 
     while(fread(buf1, sizeof(short), 2*N, fin) == 2*N) {
-       codec2_encode(c2, bits, buf1);
+       codec2_encode(c2, (void*)bits, buf1);
        fwrite(bits, sizeof(char), codec2_bits_per_frame(c2), fbits);
-       codec2_decode(c2, buf2, bits);
+       codec2_decode(c2, buf2, (void*)bits);
        fwrite(buf2, sizeof(short), codec2_bits_per_frame(c2), fout);
     }
 
index dbea6f3d9381a6a60113d97a03c18b3e64c5e663..cf73d83b1a187732b92d686e6bdbc73f91d4543e 100644 (file)
@@ -113,7 +113,7 @@ int main(int argc, char *argv[]) {
     /* determine size of training set */
 
     J = 0;
-    while(fread(vec, sizeof(float), k, ftrain) == k)
+    while(fread(vec, sizeof(float), k, ftrain) == (size_t)k)
     J++;
     printf("J=%ld entries in training set\n", J);
 
index f7ef6c9ed0990d76852952778a886cfde1b679f2..e2f4e3f734a66e4c674ff48ad2de70ebc7342cf7 100644 (file)
@@ -70,17 +70,16 @@ void locate_lsps_jnd_steps(float lsps[], float step, int k);
 \*-----------------------------------------------------------------------*/
 
 int main(int argc, char *argv[]) {
-    int   k,m;         /* dimension and codebook size                  */
+    int     k;         /* dimension and codebook size                  */
     float  *vec;       /* current vector                               */
     int    *n;         /* number of vectors in this interval           */
     int     J;         /* number of vectors in training set            */
     int     i,j;
     FILE   *ftrain;    /* file containing training set                 */
-    int     ret;
     float  *train;      /* training database                            */
-    float  *pend_train; /* last entry                                   */
+    //float  *pend_train; /* last entry                                   */
     float  *pt;
-    int     ntrain, match, vec_exists, vec_index, entry;
+    int     ntrain, match, vec_exists, vec_index=0, entry;
     int     popular[MAX_POP], pop_thresh;
     FILE   *fvq;
     float   jnd;
@@ -117,7 +116,7 @@ int main(int argc, char *argv[]) {
     /* determine size of training set */
 
     J = 0;
-    while(fread(vec, sizeof(float), k, ftrain) == k)
+    while(fread(vec, sizeof(float), k, ftrain) == (size_t)k)
        J++;
     printf("J=%d entries in training set\n", J);
     train = (float*)malloc(sizeof(float)*k*J);
@@ -140,7 +139,7 @@ int main(int argc, char *argv[]) {
     rewind(ftrain);
     ntrain = 0;
     entry = 0;
-    while(fread(vec, sizeof(float), k, ftrain) == k) {
+    while(fread(vec, sizeof(float), k, ftrain) == (size_t)k) {
 
        /* convert to Hz */
 
@@ -241,7 +240,6 @@ int main(int argc, char *argv[]) {
 void locate_lsps_jnd_steps(float lsps[], float step, int k)
 {
     int   i;
-    float lsp_hz;
 
     for(i=0; i<k; i++) {
        lsps[i] = floor(lsps[i]/step + 0.5)*step;