[xiph-commits] r12173 - trunk/speex/libspeex
jm at svn.xiph.org
jm at svn.xiph.org
Wed Dec 6 06:08:43 PST 2006
Author: jm
Date: 2006-12-06 06:08:39 -0800 (Wed, 06 Dec 2006)
New Revision: 12173
Modified:
trunk/speex/libspeex/sb_celp.c
trunk/speex/libspeex/sb_celp.h
Log:
zero-response now in 16-bit and stored on the stack. About 1 kB saved off the
wideband encoder (including removing unused QMF memory).
Modified: trunk/speex/libspeex/sb_celp.c
===================================================================
--- trunk/speex/libspeex/sb_celp.c 2006-12-05 19:42:15 UTC (rev 12172)
+++ trunk/speex/libspeex/sb_celp.c 2006-12-06 14:08:39 UTC (rev 12173)
@@ -215,10 +215,7 @@
st->h0_mem=(spx_word16_t*)speex_alloc((QMF_ORDER)*sizeof(spx_word16_t));
st->h1_mem=(spx_word16_t*)speex_alloc((QMF_ORDER)*sizeof(spx_word16_t));
- st->g0_mem=(spx_word32_t*)speex_alloc((QMF_ORDER)*sizeof(spx_word32_t));
- st->g1_mem=(spx_word32_t*)speex_alloc((QMF_ORDER)*sizeof(spx_word32_t));
- st->res=(spx_sig_t*)speex_alloc((st->frame_size)*sizeof(spx_sig_t));
st->sw=(spx_sig_t*)speex_alloc((st->frame_size)*sizeof(spx_sig_t));
st->window= lpc_window;
@@ -279,10 +276,7 @@
speex_free(st->h0_mem);
speex_free(st->h1_mem);
- speex_free(st->g0_mem);
- speex_free(st->g1_mem);
- speex_free(st->res);
speex_free(st->sw);
speex_free(st->lagWindow);
@@ -498,11 +492,6 @@
/* Final signal synthesis from excitation */
iir_mem2(st->high, st->interp_qlpc, st->high, st->frame_size, st->lpcSize, st->mem_sp);
-#ifdef RESYNTH
- /* Reconstruct the original */
- qmf_synth(low, st->high, h0, in, st->full_frame_size, QMF_ORDER, st->g0_mem, st->g1_mem, stack);
-#endif
-
if (dtx)
return 0;
else
@@ -529,7 +518,8 @@
for (sub=0;sub<st->nbSubframes;sub++)
{
VARDECL(spx_word32_t *exc);
- spx_sig_t *sp, *res, *sw;
+ VARDECL(spx_word16_t *res);
+ spx_sig_t *sp, *sw;
spx_word16_t *innov_save=NULL;
spx_word16_t filter_ratio;
int offset;
@@ -538,9 +528,9 @@
offset = st->subframeSize*sub;
sp=st->high+offset;
- res=st->res+offset;
sw=st->sw+offset;
ALLOC(exc, st->subframeSize, spx_word32_t);
+ ALLOC(res, st->subframeSize, spx_word16_t);
/* Pointer for saving innovation */
if (st->innov_save)
{
@@ -665,16 +655,16 @@
/* Reset excitation */
for (i=0;i<st->subframeSize;i++)
- exc[i]=VERY_SMALL;
+ res[i]=VERY_SMALL;
/* Compute zero response (ringing) of A(z/g1) / ( A(z/g2) * Aq(z) ) */
for (i=0;i<st->lpcSize;i++)
mem[i]=st->mem_sp[i];
- iir_mem2(exc, st->interp_qlpc, exc, st->subframeSize, st->lpcSize, mem);
+ iir_mem16(res, st->interp_qlpc, res, st->subframeSize, st->lpcSize, mem, stack);
for (i=0;i<st->lpcSize;i++)
mem[i]=st->mem_sw[i];
- filter_mem2(exc, st->bw_lpc1, st->bw_lpc2, res, st->subframeSize, st->lpcSize, mem);
+ filter_mem16(res, st->bw_lpc1, st->bw_lpc2, res, st->subframeSize, st->lpcSize, mem, stack);
/* Compute weighted signal */
for (i=0;i<st->lpcSize;i++)
@@ -683,7 +673,7 @@
/* Compute target signal */
for (i=0;i<st->subframeSize;i++)
- target[i]=PSHR32(sw[i]-res[i],SIG_SHIFT);
+ target[i]=SUB16(PSHR32(sw[i],SIG_SHIFT),res[i]);
for (i=0;i<st->subframeSize;i++)
exc[i]=0;
@@ -742,11 +732,6 @@
filter_mem2(sp, st->bw_lpc1, st->bw_lpc2, sw, st->subframeSize, st->lpcSize, st->mem_sw);
}
-
-#ifdef RESYNTH
- /* Reconstruct the original */
- qmf_synth(low, st->high, h0, in, st->full_frame_size, QMF_ORDER, st->g0_mem, st->g1_mem, stack);
-#endif
for (i=0;i<st->lpcSize;i++)
st->old_lsp[i] = st->lsp[i];
for (i=0;i<st->lpcSize;i++)
@@ -1294,7 +1279,7 @@
for (i=0;i<st->lpcSize;i++)
st->mem_sw[i]=st->mem_sp[i]=st->mem_sp2[i]=0;
for (i=0;i<QMF_ORDER;i++)
- st->h0_mem[i]=st->h1_mem[i]=st->g0_mem[i]=st->g1_mem[i]=0;
+ st->h0_mem[i]=st->h1_mem[i]=0;
}
break;
case SPEEX_SET_SUBMODE_ENCODING:
Modified: trunk/speex/libspeex/sb_celp.h
===================================================================
--- trunk/speex/libspeex/sb_celp.h 2006-12-05 19:42:15 UTC (rev 12172)
+++ trunk/speex/libspeex/sb_celp.h 2006-12-06 14:08:39 UTC (rev 12173)
@@ -61,9 +61,7 @@
spx_word16_t *x0d, *x1d; /**< QMF filter signals*/
spx_sig_t *high; /**< High-band signal (buffer) */
spx_word16_t *h0_mem, *h1_mem;
- spx_word32_t *g0_mem, *g1_mem; /**< QMF memories */
- spx_sig_t *res; /**< Zero-input response (ringing) */
spx_sig_t *sw; /**< Perceptually weighted signal */
const spx_word16_t *window; /**< LPC analysis window */
spx_word16_t *lagWindow; /**< Auto-correlation window */
More information about the commits
mailing list