[xiph-cvs] cvs commit: speex/libspeex lsp.c lsp.h nb_celp.c
Jean-Marc Valin
jm at xiph.org
Sun Nov 9 22:56:53 PST 2003
jm 03/11/10 01:56:53
Modified: libspeex lsp.c lsp.h nb_celp.c
Log:
fixed-point: integerized lsp interpolation
Revision Changes Path
1.41 +28 -0 speex/libspeex/lsp.c
Index: lsp.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/lsp.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- lsp.c 8 Nov 2003 06:52:00 -0000 1.40
+++ lsp.c 10 Nov 2003 06:56:53 -0000 1.41
@@ -524,3 +524,31 @@
lsp[i]= .5* (lsp[i] + lsp[i+1]-LSP_SCALING*margin);
}
}
+
+#ifdef FIXED_POINT
+
+
+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)
+{
+ int i;
+ spx_word16_t tmp = DIV32_16(SHL(1 + subframe,14),nb_subframes);
+ spx_word16_t tmp2 = 16384-tmp;
+ for (i=0;i<len;i++)
+ {
+ interp_lsp[i] = MULT16_16_P14(tmp2,old_lsp[i]) + MULT16_16_P14(tmp,new_lsp[i]);
+ }
+}
+
+#else
+
+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)
+{
+ int i;
+ float tmp = (1.0 + subframe)/nb_subframes;
+ for (i=0;i<len;i++)
+ {
+ interp_lsp[i] = (1-tmp)*old_lsp[i] + tmp*new_lsp[i];
+ }
+}
+
+#endif
<p><p>1.12 +2 -0 speex/libspeex/lsp.h
Index: lsp.h
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/lsp.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- lsp.h 9 Oct 2003 03:54:37 -0000 1.11
+++ lsp.h 10 Nov 2003 06:56:53 -0000 1.12
@@ -55,4 +55,6 @@
/*Added by JMV*/
void lsp_enforce_margin(spx_lsp_t *lsp, int len, float 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);
+
#endif /* __AK2LSPD__ */
<p><p>1.144 +3 -8 speex/libspeex/nb_celp.c
Index: nb_celp.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/nb_celp.c,v
retrieving revision 1.143
retrieving revision 1.144
diff -u -r1.143 -r1.144
--- nb_celp.c 10 Nov 2003 06:27:59 -0000 1.143
+++ nb_celp.c 10 Nov 2003 06:56:53 -0000 1.144
@@ -622,11 +622,8 @@
/* LSP interpolation (quantized and unquantized) */
- tmp = (1.0 + sub)/st->nbSubframes;
- for (i=0;i<st->lpcSize;i++)
- st->interp_lsp[i] = (1-tmp)*st->old_lsp[i] + tmp*st->lsp[i];
- for (i=0;i<st->lpcSize;i++)
- st->interp_qlsp[i] = (1-tmp)*st->old_qlsp[i] + tmp*st->qlsp[i];
+ 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);
/* Make sure the filters are stable */
lsp_enforce_margin(st->interp_lsp, st->lpcSize, .002);
@@ -1369,9 +1366,7 @@
/* Excitation after post-filter*/
/* LSP interpolation (quantized and unquantized) */
- tmp = (1.0 + sub)/st->nbSubframes;
- for (i=0;i<st->lpcSize;i++)
- st->interp_qlsp[i] = (1-tmp)*st->old_qlsp[i] + tmp*st->qlsp[i];
+ 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);
<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