[xiph-commits] r9164 - in trunk/speex: . libspeex
jm at motherfish-iii.xiph.org
jm at motherfish-iii.xiph.org
Thu Apr 21 21:40:57 PDT 2005
Author: jm
Date: 2005-04-21 21:40:52 -0700 (Thu, 21 Apr 2005)
New Revision: 9164
Modified:
trunk/speex/TODO
trunk/speex/configure.ac
trunk/speex/libspeex/cb_search.c
trunk/speex/libspeex/cb_search.h
trunk/speex/libspeex/filters.c
trunk/speex/libspeex/filters.h
trunk/speex/libspeex/ltp.c
trunk/speex/libspeex/ltp.h
trunk/speex/libspeex/modes.h
trunk/speex/libspeex/nb_celp.c
trunk/speex/libspeex/sb_celp.c
Log:
Fixed-point improvements (moved some stuff to 16-bit arithmetic)
Modified: trunk/speex/TODO
===================================================================
--- trunk/speex/TODO 2005-04-21 15:55:13 UTC (rev 9163)
+++ trunk/speex/TODO 2005-04-22 04:40:52 UTC (rev 9164)
@@ -1,11 +1,19 @@
-Version 1.0
-Allocator override
-better error handling
-
-Version 1.2:
Allocator override (speex_lib_ctl)
-support alloca?
-better error handling
+Support alloca/variable size arrays
+Better error handling
+Fixed-point:
+ - Packet-loss concealment
+ - Wideband
+ - Initialization
+ - Jitter buffer
+Echo cancellation:
+ - Re-enable denoiser hooks
+ - Improve doubletalk detector
+Denoiser:
+ - Fix hyper-geometric approximation
+ - Do some tuning
+VAD-NG:
+ - Use median filtering instead of "non-linear mean"
Modified: trunk/speex/configure.ac
===================================================================
--- trunk/speex/configure.ac 2005-04-21 15:55:13 UTC (rev 9163)
+++ trunk/speex/configure.ac 2005-04-22 04:40:52 UTC (rev 9164)
@@ -6,7 +6,7 @@
SPEEX_MAJOR_VERSION=1
SPEEX_MINOR_VERSION=1
-SPEEX_MICRO_VERSION=7
+SPEEX_MICRO_VERSION=8
SPEEX_EXTRA_VERSION=
#SPEEX_VERSION=1.1.7
SPEEX_VERSION=$SPEEX_MAJOR_VERSION.$SPEEX_MINOR_VERSION.$SPEEX_MICRO_VERSION$SPEEX_EXTRA_VERSION
Modified: trunk/speex/libspeex/cb_search.c
===================================================================
--- trunk/speex/libspeex/cb_search.c 2005-04-21 15:55:13 UTC (rev 9163)
+++ trunk/speex/libspeex/cb_search.c 2005-04-22 04:40:52 UTC (rev 9164)
@@ -45,7 +45,7 @@
#include "cb_search_arm4.h"
#else
-static void compute_weighted_codebook(const signed char *shape_cb, const spx_sig_t *r, spx_word16_t *resp, spx_word16_t *resp2, spx_word32_t *E, int shape_cb_size, int subvect_size, char *stack)
+static void compute_weighted_codebook(const signed char *shape_cb, const spx_word16_t *r, spx_word16_t *resp, spx_word16_t *resp2, spx_word32_t *E, int shape_cb_size, int subvect_size, char *stack)
{
int i, j, k;
for (i=0;i<shape_cb_size;i++)
@@ -90,7 +90,7 @@
int p, /* number of LPC coeffs */
int nsf, /* number of samples in subframe */
spx_sig_t *exc,
-spx_sig_t *r,
+spx_word16_t *r,
SpeexBits *bits,
char *stack,
int complexity,
@@ -241,7 +241,7 @@
int p, /* number of LPC coeffs */
int nsf, /* number of samples in subframe */
spx_sig_t *exc,
-spx_sig_t *r,
+spx_word16_t *r,
SpeexBits *bits,
char *stack,
int complexity,
@@ -590,7 +590,7 @@
int p, /* number of LPC coeffs */
int nsf, /* number of samples in subframe */
spx_sig_t *exc,
-spx_sig_t *r,
+spx_word16_t *r,
SpeexBits *bits,
char *stack,
int complexity,
Modified: trunk/speex/libspeex/cb_search.h
===================================================================
--- trunk/speex/libspeex/cb_search.h 2005-04-21 15:55:13 UTC (rev 9163)
+++ trunk/speex/libspeex/cb_search.h 2005-04-22 04:40:52 UTC (rev 9164)
@@ -54,7 +54,7 @@
int p, /* number of LPC coeffs */
int nsf, /* number of samples in subframe */
spx_sig_t *exc,
-spx_sig_t *r,
+spx_word16_t *r,
SpeexBits *bits,
char *stack,
int complexity,
@@ -79,7 +79,7 @@
int p, /* number of LPC coeffs */
int nsf, /* number of samples in subframe */
spx_sig_t *exc,
-spx_sig_t *r,
+spx_word16_t *r,
SpeexBits *bits,
char *stack,
int complexity,
Modified: trunk/speex/libspeex/filters.c
===================================================================
--- trunk/speex/libspeex/filters.c 2005-04-21 15:55:13 UTC (rev 9163)
+++ trunk/speex/libspeex/filters.c 2005-04-22 04:40:52 UTC (rev 9164)
@@ -39,6 +39,7 @@
#include "misc.h"
#include "math_approx.h"
#include "ltp.h"
+#include <math.h>
#ifdef FIXED_POINT
void bw_lpc(spx_word16_t gamma, const spx_coef_t *lpc_in, spx_coef_t *lpc_out, int order)
@@ -193,9 +194,29 @@
return sig_shift;
}
+#ifdef PRECISION16
void filter_mem2(const spx_sig_t *x, const spx_coef_t *num, const spx_coef_t *den, spx_sig_t *y, int N, int ord, spx_mem_t *mem)
{
int i,j;
+ spx_word16_t xi,yi,nyi;
+
+ for (i=0;i<N;i++)
+ {
+ xi=PSHR(SATURATE(x[i],536870911),SIG_SHIFT);
+ yi = PSHR(SATURATE(ADD32(x[i], SHL(mem[0],1)),536870911),SIG_SHIFT);
+ nyi = -yi;
+ for (j=0;j<ord-1;j++)
+ {
+ mem[j] = MAC16_16(MAC16_16(mem[j+1], num[j+1],xi), den[j+1],nyi);
+ }
+ mem[ord-1] = ADD32(MULT16_16(num[ord],xi), MULT16_16(den[ord],nyi));
+ y[i] = SHL(yi,SIG_SHIFT);
+ }
+}
+#else
+void filter_mem2(const spx_sig_t *x, const spx_coef_t *num, const spx_coef_t *den, spx_sig_t *y, int N, int ord, spx_mem_t *mem)
+{
+ int i,j;
spx_sig_t xi,yi,nyi;
for (i=0;i<N;i++)
@@ -211,10 +232,31 @@
y[i] = yi;
}
}
+#endif
+#ifdef PRECISION16
void iir_mem2(const spx_sig_t *x, const spx_coef_t *den, spx_sig_t *y, int N, int ord, spx_mem_t *mem)
{
int i,j;
+ spx_word16_t xi,yi,nyi;
+
+ for (i=0;i<N;i++)
+ {
+ xi=PSHR(SATURATE(x[i],536870911),SIG_SHIFT);
+ yi = PSHR(SATURATE(x[i] + (mem[0]<<1),536870911),SIG_SHIFT);
+ nyi = -yi;
+ for (j=0;j<ord-1;j++)
+ {
+ mem[j] = MAC16_16(mem[j+1],den[j+1],nyi);
+ }
+ mem[ord-1] = MULT16_16(den[ord],nyi);
+ y[i] = SHL(yi,SIG_SHIFT);
+ }
+}
+#else
+void iir_mem2(const spx_sig_t *x, const spx_coef_t *den, spx_sig_t *y, int N, int ord, spx_mem_t *mem)
+{
+ int i,j;
spx_word32_t xi,yi,nyi;
for (i=0;i<N;i++)
@@ -230,11 +272,30 @@
y[i] = yi;
}
}
+#endif
#endif
+#ifdef PRECISION16
+void fir_mem2(const spx_sig_t *x, const spx_coef_t *num, spx_sig_t *y, int N, int ord, spx_mem_t *mem)
+{
+ int i,j;
+ spx_word16_t xi,yi;
+ for (i=0;i<N;i++)
+ {
+ xi= PSHR(SATURATE(x[i],536870911),SIG_SHIFT);
+ yi = PSHR(SATURATE(x[i] + (mem[0]<<1),536870911),SIG_SHIFT);
+ for (j=0;j<ord-1;j++)
+ {
+ mem[j] = MAC16_16(mem[j+1], num[j+1],xi);
+ }
+ mem[ord-1] = MULT16_16(num[ord],xi);
+ y[i] = SHL(yi,SIG_SHIFT);
+ }
+}
+#else
void fir_mem2(const spx_sig_t *x, const spx_coef_t *num, spx_sig_t *y, int N, int ord, spx_mem_t *mem)
{
int i,j;
@@ -252,6 +313,7 @@
y[i] = SATURATE(yi,805306368);
}
}
+#endif
#else
@@ -352,6 +414,38 @@
fir_mem2(y, awk2, y, N, ord, mem);
}
+void compute_impulse_response(const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_word16_t *y, int N, int ord, char *stack)
+{
+ int i,j;
+ spx_word16_t y1, ny1i, ny2i;
+ VARDECL(spx_mem_t *mem1);
+ VARDECL(spx_mem_t *mem2);
+ ALLOC(mem1, ord, spx_mem_t);
+ ALLOC(mem2, ord, spx_mem_t);
+
+ for (i=0;i<ord+1;i++)
+ y[i] = awk1[i];
+ for (;i<N;i++)
+ y[i] = VERY_SMALL;
+
+ for (i=0;i<ord;i++)
+ mem1[i] = mem2[i] = 0;
+ for (i=0;i<N;i++)
+ {
+ y1 = ADD16(y[i], PSHR(mem1[0],LPC_SHIFT));
+ ny1i = -y1;
+ y[i] = ADD16(SHL(y1,1), PSHR(mem2[0],LPC_SHIFT));
+ ny2i = -y[i];
+ for (j=0;j<ord-1;j++)
+ {
+ mem1[j] = MAC16_16(mem1[j+1], awk2[j+1],ny1i);
+ mem2[j] = MAC16_16(mem2[j+1], ak[j+1],ny2i);
+ }
+ mem1[ord-1] = MULT16_16(awk2[ord],ny1i);
+ mem2[ord-1] = MULT16_16(ak[ord],ny2i);
+ }
+}
+
void qmf_decomp(const spx_word16_t *xx, const spx_word16_t *aa, spx_sig_t *y1, spx_sig_t *y2, int N, int M, spx_word16_t *mem, char *stack)
{
int i,j,k,M2;
Modified: trunk/speex/libspeex/filters.h
===================================================================
--- trunk/speex/libspeex/filters.h 2005-04-21 15:55:13 UTC (rev 9163)
+++ trunk/speex/libspeex/filters.h 2005-04-22 04:40:52 UTC (rev 9164)
@@ -69,6 +69,8 @@
void residue_percep_zero(const spx_sig_t *xx, const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_sig_t *y, int N, int ord, char *stack);
+void compute_impulse_response(const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_word16_t *y, int N, int ord, char *stack);
+
void comb_filter_mem_init (CombFilterMem *mem);
void comb_filter(
Modified: trunk/speex/libspeex/ltp.c
===================================================================
--- trunk/speex/libspeex/ltp.c 2005-04-21 15:55:13 UTC (rev 9163)
+++ trunk/speex/libspeex/ltp.c 2005-04-22 04:40:52 UTC (rev 9164)
@@ -284,7 +284,7 @@
SpeexBits *bits,
char *stack,
const spx_sig_t *exc2,
-const spx_sig_t *r,
+const spx_word16_t *r,
spx_sig_t *new_target,
int *cdbk_index,
int cdbk_offset
@@ -527,7 +527,7 @@
SpeexBits *bits,
char *stack,
spx_sig_t *exc2,
-spx_sig_t *r,
+spx_word16_t *r,
int complexity,
int cdbk_offset
)
@@ -738,7 +738,7 @@
SpeexBits *bits,
char *stack,
spx_sig_t *exc2,
-spx_sig_t *r,
+spx_word16_t *r,
int complexity,
int cdbk_offset
)
Modified: trunk/speex/libspeex/ltp.h
===================================================================
--- trunk/speex/libspeex/ltp.h 2005-04-21 15:55:13 UTC (rev 9163)
+++ trunk/speex/libspeex/ltp.h 2005-04-22 04:40:52 UTC (rev 9164)
@@ -65,7 +65,7 @@
SpeexBits *bits,
char *stack,
spx_sig_t *exc2,
-spx_sig_t *r,
+spx_word16_t *r,
int complexity,
int cdbk_offset
);
@@ -105,7 +105,7 @@
SpeexBits *bits,
char *stack,
spx_sig_t *exc2,
-spx_sig_t *r,
+spx_word16_t *r,
int complexity,
int cdbk_offset
);
Modified: trunk/speex/libspeex/modes.h
===================================================================
--- trunk/speex/libspeex/modes.h 2005-04-21 15:55:13 UTC (rev 9163)
+++ trunk/speex/libspeex/modes.h 2005-04-22 04:40:52 UTC (rev 9164)
@@ -57,7 +57,7 @@
/** Long-term predictor quantization */
typedef int (*ltp_quant_func)(spx_sig_t *, spx_sig_t *, spx_coef_t *, spx_coef_t *,
spx_coef_t *, spx_sig_t *, const void *, int, int, spx_word16_t,
- int, int, SpeexBits*, char *, spx_sig_t *, spx_sig_t *, int, int);
+ int, int, SpeexBits*, char *, spx_sig_t *, spx_word16_t *, int, int);
/** Long-term un-quantize */
typedef void (*ltp_unquant_func)(spx_sig_t *, int, int, spx_word16_t, const void *, int, int *,
@@ -66,7 +66,7 @@
/** Innovation quantization function */
typedef void (*innovation_quant_func)(spx_sig_t *, spx_coef_t *, spx_coef_t *, spx_coef_t *, const void *, int, int,
- spx_sig_t *, spx_sig_t *, SpeexBits *, char *, int, int);
+ spx_sig_t *, spx_word16_t *, SpeexBits *, char *, int, int);
/** Innovation unquantization function */
typedef void (*innovation_unquant_func)(spx_sig_t *, const void *, int, SpeexBits*, char *);
Modified: trunk/speex/libspeex/nb_celp.c
===================================================================
--- trunk/speex/libspeex/nb_celp.c 2005-04-21 15:55:13 UTC (rev 9163)
+++ trunk/speex/libspeex/nb_celp.c 2005-04-22 04:40:52 UTC (rev 9164)
@@ -222,7 +222,7 @@
VARDECL(spx_sig_t *target);
VARDECL(spx_mem_t *mem);
char *stack;
- VARDECL(spx_sig_t *syn_resp);
+ VARDECL(spx_word16_t *syn_resp);
VARDECL(spx_sig_t *real_exc);
#ifdef EPIC_48K
int pitch_half[2];
@@ -619,7 +619,7 @@
ALLOC(res, st->subframeSize, spx_sig_t);
/* Target signal */
ALLOC(target, st->subframeSize, spx_sig_t);
- ALLOC(syn_resp, st->subframeSize, spx_sig_t);
+ ALLOC(syn_resp, st->subframeSize, spx_word16_t);
ALLOC(real_exc, st->subframeSize, spx_sig_t);
ALLOC(mem, st->lpcSize, spx_mem_t);
@@ -688,16 +688,16 @@
for (i=0;i<st->subframeSize;i++)
real_exc[i] = exc[i];
+ if (st->complexity==0)
+ response_bound >>= 1;
/* Compute impulse response of A(z/g1) / ( A(z)*A(z/g2) )*/
- for (i=0;i<st->subframeSize;i++)
+ /*for (i=0;i<st->subframeSize;i++)
exc[i]=VERY_SMALL;
exc[0]=SIG_SCALING;
-
- if (st->complexity==0)
- response_bound >>= 1;
- syn_percep_zero(exc, st->interp_qlpc, st->bw_lpc1, st->bw_lpc2, syn_resp, response_bound, st->lpcSize, stack);
+ syn_percep_zero(exc, st->interp_qlpc, st->bw_lpc1, st->bw_lpc2, syn_resp, response_bound, st->lpcSize, stack);*/
+ compute_impulse_response(st->interp_qlpc, st->bw_lpc1, st->bw_lpc2, syn_resp, response_bound, st->lpcSize, stack);
for (i=response_bound;i<st->subframeSize;i++)
- syn_resp[i]=0;
+ syn_resp[i]=VERY_SMALL;
/* Reset excitation */
for (i=0;i<st->subframeSize;i++)
Modified: trunk/speex/libspeex/sb_celp.c
===================================================================
--- trunk/speex/libspeex/sb_celp.c 2005-04-21 15:55:13 UTC (rev 9163)
+++ trunk/speex/libspeex/sb_celp.c 2005-04-22 04:40:52 UTC (rev 9164)
@@ -329,7 +329,7 @@
char *stack;
VARDECL(spx_mem_t *mem);
VARDECL(spx_sig_t *innov);
- VARDECL(spx_sig_t *syn_resp);
+ VARDECL(spx_word16_t *syn_resp);
VARDECL(spx_word32_t *low_pi_gain);
VARDECL(spx_sig_t *low_exc);
VARDECL(spx_sig_t *low_innov);
@@ -547,7 +547,7 @@
}
ALLOC(mem, st->lpcSize, spx_mem_t);
- ALLOC(syn_resp, st->subframeSize, spx_sig_t);
+ ALLOC(syn_resp, st->subframeSize, spx_word16_t);
ALLOC(innov, st->subframeSize, spx_sig_t);
for (sub=0;sub<st->nbSubframes;sub++)
@@ -676,10 +676,12 @@
scale = SHL(MULT16_16(DIV32_16(SHL(gc,SIG_SHIFT-4),filter_ratio),(1+el)),4);
- for (i=0;i<st->subframeSize;i++)
+ /*for (i=0;i<st->subframeSize;i++)
exc[i]=VERY_SMALL;
exc[0]=SIG_SCALING;
- syn_percep_zero(exc, st->interp_qlpc, st->bw_lpc1, st->bw_lpc2, syn_resp, st->subframeSize, st->lpcSize, stack);
+ syn_percep_zero(exc, st->interp_qlpc, st->bw_lpc1, st->bw_lpc2, syn_resp, st->subframeSize, st->lpcSize, stack);*/
+ compute_impulse_response(st->interp_qlpc, st->bw_lpc1, st->bw_lpc2, syn_resp, st->subframeSize, st->lpcSize, stack);
+
/* Reset excitation */
for (i=0;i<st->subframeSize;i++)
More information about the commits
mailing list