[xiph-cvs] cvs commit: speex/libspeex lsp.c lsp.h nb_celp.c sb_celp.c
Jean-Marc Valin
jm at xiph.org
Wed Nov 26 21:00:07 PST 2003
jm 03/11/27 00:00:07
Modified: libspeex lsp.c lsp.h nb_celp.c sb_celp.c
Log:
fixed-point: lsp_enforce_margin argument no longer a float
Revision Changes Path
1.46 +4 -4 speex/libspeex/lsp.c
Index: lsp.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/lsp.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -r1.45 -r1.46
--- lsp.c 14 Nov 2003 18:04:28 -0000 1.45
+++ lsp.c 27 Nov 2003 05:00:05 -0000 1.46
@@ -515,11 +515,11 @@
#ifdef FIXED_POINT
/*Makes sure the LSPs are stable*/
-void lsp_enforce_margin(spx_lsp_t *lsp, int len, float margin)
+void lsp_enforce_margin(spx_lsp_t *lsp, int len, spx_word16_t margin)
{
int i;
- spx_word16_t m = LSP_SCALING*margin;
- spx_word16_t m2 = (LSP_SCALING*M_PI)-LSP_SCALING*margin;
+ spx_word16_t m = margin;
+ spx_word16_t m2 = 25736-margin;
if (lsp[0]<m)
lsp[0]=m;
@@ -550,7 +550,7 @@
#else
/*Makes sure the LSPs are stable*/
-void lsp_enforce_margin(spx_lsp_t *lsp, int len, float margin)
+void lsp_enforce_margin(spx_lsp_t *lsp, int len, spx_word16_t margin)
{
int i;
if (lsp[0]<LSP_SCALING*margin)
<p><p>1.13 +1 -1 speex/libspeex/lsp.h
Index: lsp.h
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/lsp.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- lsp.h 10 Nov 2003 06:56:53 -0000 1.12
+++ lsp.h 27 Nov 2003 05:00:05 -0000 1.13
@@ -53,7 +53,7 @@
void lsp_to_lpc(spx_lsp_t *freq, spx_coef_t *ak, int lpcrdr, char *stack);
/*Added by JMV*/
-void lsp_enforce_margin(spx_lsp_t *lsp, int len, float margin);
+void lsp_enforce_margin(spx_lsp_t *lsp, int len, spx_word16_t margin);
void lsp_interpolate(spx_lsp_t *old_lsp, spx_lsp_t *new_lsp, spx_lsp_t *interp_lsp, int len, int subframe, int nb_subframes);
<p><p>1.155 +18 -13 speex/libspeex/nb_celp.c
Index: nb_celp.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/nb_celp.c,v
retrieving revision 1.154
retrieving revision 1.155
diff -u -r1.154 -r1.155
--- nb_celp.c 25 Nov 2003 06:58:10 -0000 1.154
+++ nb_celp.c 27 Nov 2003 05:00:05 -0000 1.155
@@ -56,27 +56,32 @@
#define SUBMODE(x) st->submodes[st->submodeID]->x
-#ifdef FIXED_POINT
-spx_word32_t ol_gain_table[32]={18900, 25150, 33468, 44536, 59265, 78865, 104946, 139653, 185838, 247297, 329081, 437913, 582736, 775454, 1031906, 1373169, 1827293, 2431601, 3235761, 4305867, 5729870, 7624808, 10146425, 13501971, 17967238, 23909222, 31816294, 42338330, 56340132, 74972501, 99766822, 132760927};
-#endif
#ifdef FIXED_POINT
+spx_word32_t ol_gain_table[32]={18900, 25150, 33468, 44536, 59265, 78865, 104946, 139653, 185838, 247297, 329081, 437913, 582736, 775454, 1031906, 1373169, 1827293, 2431601, 3235761, 4305867, 5729870, 7624808, 10146425, 13501971, 17967238, 23909222, 31816294, 42338330, 56340132, 74972501, 99766822, 132760927};
spx_word16_t exc_gain_quant_scal3_bound[7]={1841, 3883, 6051, 8062, 10444, 13580, 18560};
spx_word16_t exc_gain_quant_scal3[8]={1002, 2680, 5086, 7016, 9108, 11781, 15380, 21740};
-#else
-float exc_gain_quant_scal3_bound[7]={0.112338, 0.236980, 0.369316, 0.492054, 0.637471, 0.828874, 1.132784};
-float exc_gain_quant_scal3[8]={0.061130, 0.163546, 0.310413, 0.428220, 0.555887, 0.719055, 0.938694, 1.326874};
-#endif
-
-#ifdef FIXED_POINT
spx_word16_t exc_gain_quant_scal1_bound[1]={14385};
spx_word16_t exc_gain_quant_scal1[2]={11546, 17224};
+
+#define LSP_MARGIN 16
+#define LSP_DELTA
+
#else
+
+float exc_gain_quant_scal3_bound[7]={0.112338, 0.236980, 0.369316, 0.492054, 0.637471, 0.828874, 1.132784};
+float exc_gain_quant_scal3[8]={0.061130, 0.163546, 0.310413, 0.428220, 0.555887, 0.719055, 0.938694, 1.326874};
float exc_gain_quant_scal1_bound[1]={0.87798};
float exc_gain_quant_scal1[2]={0.70469, 1.05127};
+
+#define LSP_MARGIN .002
+#define LSP_DELTA
+
#endif
+
+
#define sqr(x) ((x)*(x))
void *nb_encoder_init(SpeexMode *m)
@@ -284,7 +289,7 @@
else
lsp_interpolate(st->old_lsp, st->lsp, st->interp_lsp, st->lpcSize, st->nbSubframes, st->nbSubframes<<1);
- lsp_enforce_margin(st->interp_lsp, st->lpcSize, .002);
+ lsp_enforce_margin(st->interp_lsp, st->lpcSize, LSP_MARGIN);
/* Compute interpolated LPCs (unquantized) for whole frame*/
lsp_to_lpc(st->interp_lsp, st->interp_lpc, st->lpcSize,stack);
@@ -657,8 +662,8 @@
lsp_interpolate(st->old_qlsp, st->qlsp, st->interp_qlsp, st->lpcSize, sub, st->nbSubframes);
/* Make sure the filters are stable */
- lsp_enforce_margin(st->interp_lsp, st->lpcSize, .002);
- lsp_enforce_margin(st->interp_qlsp, st->lpcSize, .002);
+ lsp_enforce_margin(st->interp_lsp, st->lpcSize, LSP_MARGIN);
+ lsp_enforce_margin(st->interp_qlsp, st->lpcSize, LSP_MARGIN);
/* Compute interpolated LPCs (quantized and unquantized) */
lsp_to_lpc(st->interp_lsp, st->interp_lpc, st->lpcSize,stack);
@@ -1402,7 +1407,7 @@
lsp_interpolate(st->old_qlsp, st->qlsp, st->interp_qlsp, st->lpcSize, sub, st->nbSubframes);
/* Make sure the LSP's are stable */
- lsp_enforce_margin(st->interp_qlsp, st->lpcSize, .002);
+ lsp_enforce_margin(st->interp_qlsp, st->lpcSize, LSP_MARGIN);
/* Compute interpolated LPCs (unquantized) */
<p><p>1.158 +9 -3 speex/libspeex/sb_celp.c
Index: sb_celp.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/sb_celp.c,v
retrieving revision 1.157
retrieving revision 1.158
diff -u -r1.157 -r1.158
--- sb_celp.c 21 Nov 2003 06:59:25 -0000 1.157
+++ sb_celp.c 27 Nov 2003 05:00:05 -0000 1.158
@@ -55,6 +55,12 @@
#ifdef FIXED_POINT
spx_word16_t gc_quant_bound[16] = {125, 164, 215, 282, 370, 484, 635, 832, 1090, 1428, 1871, 2452, 3213, 4210, 5516, 7228};
+#define LSP_MARGIN 410
+
+#else
+
+#define LSP_MARGIN .05
+
#endif
#define QMF_ORDER 64
@@ -509,8 +515,8 @@
lsp_interpolate(st->old_lsp, st->lsp, st->interp_lsp, st->lpcSize, sub, st->nbSubframes);
lsp_interpolate(st->old_qlsp, st->qlsp, st->interp_qlsp, st->lpcSize, sub, st->nbSubframes);
- lsp_enforce_margin(st->interp_lsp, st->lpcSize, .05);
- lsp_enforce_margin(st->interp_qlsp, st->lpcSize, .05);
+ lsp_enforce_margin(st->interp_lsp, st->lpcSize, LSP_MARGIN);
+ lsp_enforce_margin(st->interp_qlsp, st->lpcSize, LSP_MARGIN);
lsp_to_lpc(st->interp_lsp, st->interp_lpc, st->lpcSize,stack);
lsp_to_lpc(st->interp_qlsp, st->interp_qlpc, st->lpcSize, stack);
@@ -978,7 +984,7 @@
/* LSP interpolation */
lsp_interpolate(st->old_qlsp, st->qlsp, st->interp_qlsp, st->lpcSize, sub, st->nbSubframes);
- lsp_enforce_margin(st->interp_qlsp, st->lpcSize, .05);
+ lsp_enforce_margin(st->interp_qlsp, st->lpcSize, LSP_MARGIN);
/* LSP to LPC */
lsp_to_lpc(st->interp_qlsp, st->interp_qlpc, st->lpcSize, stack);
<p><p>--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list