[xiph-commits] r9098 - trunk/speex/libspeex

jm at motherfish-iii.xiph.org jm at motherfish-iii.xiph.org
Tue Mar 29 17:13:38 PST 2005


Author: jm
Date: 2005-03-29 17:13:35 -0800 (Tue, 29 Mar 2005)
New Revision: 9098

Modified:
   trunk/speex/libspeex/ltp.c
   trunk/speex/libspeex/misc.c
   trunk/speex/libspeex/misc.h
   trunk/speex/libspeex/modes.c
   trunk/speex/libspeex/nb_celp.c
   trunk/speex/libspeex/quant_lsp.c
   trunk/speex/libspeex/sb_celp.c
   trunk/speex/libspeex/speex_header.c
Log:
fixed-point cleanup, removed some warnings


Modified: trunk/speex/libspeex/ltp.c
===================================================================
--- trunk/speex/libspeex/ltp.c	2005-03-29 03:04:24 UTC (rev 9097)
+++ trunk/speex/libspeex/ltp.c	2005-03-30 01:13:35 UTC (rev 9098)
@@ -302,8 +302,8 @@
    spx_word16_t gain[3];
    spx_word64_t err;
 
-   ltp_params *params;
-   params = (ltp_params*) par;
+   const ltp_params *params;
+   params = (const ltp_params*) par;
    gain_cdbk_size = 1<<params->gain_bits;
    gain_cdbk = params->gain_cdbk + 3*gain_cdbk_size*cdbk_offset;
    ALLOC(tmp, 3*nsf, spx_sig_t);
@@ -540,7 +540,7 @@
    int best_pitch=0;
    spx_word64_t err, best_err=-1;
    int N;
-   ltp_params *params;
+   const ltp_params *params;
    VARDECL(int *nbest);
 
    N=complexity;
@@ -550,7 +550,7 @@
       N=1;
 
    ALLOC(nbest, N, int);
-   params = (ltp_params*) par;
+   params = (const ltp_params*) par;
 
    if (end<start)
    {
@@ -622,9 +622,9 @@
    spx_word16_t gain[3];
    const signed char *gain_cdbk;
    int gain_cdbk_size;
-   ltp_params *params;
+   const ltp_params *params;
 
-   params = (ltp_params*) par;
+   params = (const ltp_params*) par;
    gain_cdbk_size = 1<<params->gain_bits;
    gain_cdbk = params->gain_cdbk + 3*gain_cdbk_size*cdbk_offset;
 

Modified: trunk/speex/libspeex/misc.c
===================================================================
--- trunk/speex/libspeex/misc.c	2005-03-29 03:04:24 UTC (rev 9097)
+++ trunk/speex/libspeex/misc.c	2005-03-30 01:13:35 UTC (rev 9098)
@@ -163,18 +163,18 @@
    return memmove(dest,src,n);
 }
 
-void speex_error(char *str)
+void speex_error(const char *str)
 {
    fprintf (stderr, "Fatal error: %s\n", str);
    exit(1);
 }
 
-void speex_warning(char *str)
+void speex_warning(const char *str)
 {
    fprintf (stderr, "warning: %s\n", str);
 }
 
-void speex_warning_int(char *str, int val)
+void speex_warning_int(const char *str, int val)
 {
    fprintf (stderr, "warning: %s %d\n", str, val);
 }

Modified: trunk/speex/libspeex/misc.h
===================================================================
--- trunk/speex/libspeex/misc.h	2005-03-29 03:04:24 UTC (rev 9097)
+++ trunk/speex/libspeex/misc.h	2005-03-30 01:13:35 UTC (rev 9098)
@@ -71,11 +71,11 @@
 void speex_memcpy_bytes(char *dst, char *src, int nbytes);
 void speex_memset_bytes(char *dst, char src, int nbytes);
 
-void speex_error(char *str);
+void speex_error(const char *str);
 
-void speex_warning(char *str);
+void speex_warning(const char *str);
 
-void speex_warning_int(char *str, int val);
+void speex_warning_int(const char *str, int val);
 
 void speex_rand_vec(float std, spx_sig_t *data, int len);
 

Modified: trunk/speex/libspeex/modes.c
===================================================================
--- trunk/speex/libspeex/modes.c	2005-03-29 03:04:24 UTC (rev 9097)
+++ trunk/speex/libspeex/modes.c	2005-03-30 01:13:35 UTC (rev 9098)
@@ -710,7 +710,7 @@
    return mode->query(mode->mode, request, ptr);
 }
 
-const SpeexMode * const speex_lib_get_mode (int mode)
+const SpeexMode * speex_lib_get_mode (int mode)
 {
 #ifdef EPIC_48K
   if (mode == SPEEX_MODEID_NB_48K) return &speex_nb_48k_mode;

Modified: trunk/speex/libspeex/nb_celp.c
===================================================================
--- trunk/speex/libspeex/nb_celp.c	2005-03-29 03:04:24 UTC (rev 9097)
+++ trunk/speex/libspeex/nb_celp.c	2005-03-30 01:13:35 UTC (rev 9098)
@@ -1293,7 +1293,7 @@
       float lsp_dist=0, fact;
       for (i=0;i<st->lpcSize;i++)
          lsp_dist += fabs(st->old_qlsp[i] - st->qlsp[i]);
-      lsp_dist /= LSP_SCALING*LSP_SCALING;
+      lsp_dist /= LSP_SCALING;
       fact = .6*exp(-.2*lsp_dist);
       for (i=0;i<2*st->lpcSize;i++)
          st->mem_sp[i] = (spx_mem_t)(st->mem_sp[i]*fact);

Modified: trunk/speex/libspeex/quant_lsp.c
===================================================================
--- trunk/speex/libspeex/quant_lsp.c	2005-03-29 03:04:24 UTC (rev 9097)
+++ trunk/speex/libspeex/quant_lsp.c	2005-03-30 01:13:35 UTC (rev 9098)
@@ -114,7 +114,7 @@
    }
 
    for (j=0;j<nbDim;j++)
-      x[j] -= SHL((spx_word16_t)cdbk[best_id*nbDim+j],5);
+      x[j] = SUB16(x[j],SHL((spx_word16_t)cdbk[best_id*nbDim+j],5));
     
    return best_id;
 }
@@ -144,7 +144,7 @@
    }
    
    for (j=0;j<nbDim;j++)
-      x[j] -= SHL((spx_word16_t)cdbk[best_id*nbDim+j],5);
+      x[j] = SUB16(x[j],SHL((spx_word16_t)cdbk[best_id*nbDim+j],5));
    return best_id;
 }
 
@@ -161,7 +161,7 @@
    compute_quant_weights(qlsp, quant_weight, order);
 
    for (i=0;i<order;i++)
-      qlsp[i]-=LSP_LINEAR(i);
+      qlsp[i]=SUB16(qlsp[i],LSP_LINEAR(i));
 
 #ifndef FIXED_POINT
    for (i=0;i<order;i++)
@@ -244,7 +244,7 @@
    compute_quant_weights(qlsp, quant_weight, order);
 
    for (i=0;i<order;i++)
-      qlsp[i]-=LSP_LINEAR(i);
+      qlsp[i]=SUB16(qlsp[i],LSP_LINEAR(i));
 #ifndef FIXED_POINT
    for (i=0;i<order;i++)
       qlsp[i]=qlsp[i]*LSP_SCALE;
@@ -330,7 +330,7 @@
       }*/
 
    for (i=0;i<order;i++)
-      qlsp[i]-=LSP_LINEAR_HIGH(i);
+      qlsp[i]=SUB16(qlsp[i],LSP_LINEAR_HIGH(i));
 #ifndef FIXED_POINT
    for (i=0;i<order;i++)
       qlsp[i] = qlsp[i]*LSP_SCALE;
@@ -394,7 +394,7 @@
    compute_quant_weights(qlsp, quant_weight, order);
 
    for (i=0;i<order;i++)
-      qlsp[i]-=LSP_SCALING*(.25*i+.3125);
+      qlsp[i]=SUB16(qlsp[i],LSP_SCALING*(.25*i+.3125));
 #ifndef FIXED_POINT
    for (i=0;i<order;i++)
       qlsp[i] = qlsp[i]*LSP_SCALE;

Modified: trunk/speex/libspeex/sb_celp.c
===================================================================
--- trunk/speex/libspeex/sb_celp.c	2005-03-29 03:04:24 UTC (rev 9097)
+++ trunk/speex/libspeex/sb_celp.c	2005-03-30 01:13:35 UTC (rev 9098)
@@ -525,7 +525,7 @@
       fir_mem_up(st->high, h1, st->y1, st->full_frame_size, QMF_ORDER, st->g1_mem, stack);
 
       for (i=0;i<st->full_frame_size;i++)
-         in[i]=2*(st->y0[i]-st->y1[i]) / SIG_SCALING;
+         in[i]=SHR(st->y0[i]-st->y1[i], SIG_SHIFT-1);
 #endif
 
       if (dtx)
@@ -761,7 +761,7 @@
    fir_mem_up(st->high, h1, st->y1, st->full_frame_size, QMF_ORDER, st->g1_mem, stack);
 
    for (i=0;i<st->full_frame_size;i++)
-      in[i]=2*(st->y0[i]-st->y1[i]) / SIG_SCALING;
+      in[i]=SHR(st->y0[i]-st->y1[i], SIG_SHIFT-1);
 #endif
    for (i=0;i<st->lpcSize;i++)
       st->old_lsp[i] = st->lsp[i];
@@ -953,7 +953,7 @@
       ret = speex_decode_native(st->st_low, bits, low);
       
       for (i=0;i<st->frame_size;i++)
-         st->x0d[i] = low[i]*SIG_SCALING;
+         st->x0d[i] = SHL((spx_sig_t)low[i], SIG_SHIFT);
    }
 
    speex_decoder_ctl(st->st_low, SPEEX_GET_DTX_STATUS, &dtx);

Modified: trunk/speex/libspeex/speex_header.c
===================================================================
--- trunk/speex/libspeex/speex_header.c	2005-03-29 03:04:24 UTC (rev 9097)
+++ trunk/speex/libspeex/speex_header.c	2005-03-30 01:13:35 UTC (rev 9098)
@@ -69,7 +69,7 @@
 void speex_init_header(SpeexHeader *header, int rate, int nb_channels, const SpeexMode *m)
 {
    int i;
-   char *h="Speex   ";
+   const char *h="Speex   ";
    /*
    strncpy(header->speex_string, "Speex   ", 8);
    strncpy(header->speex_version, SPEEX_VERSION, SPEEX_HEADER_VERSION_LENGTH-1);
@@ -129,7 +129,7 @@
 {
    int i;
    SpeexHeader *le_header;
-   char *h = "Speex   ";
+   const char *h = "Speex   ";
    for (i=0;i<8;i++)
       if (packet[i]!=h[i])
       {



More information about the commits mailing list