diff options
author | Jean-Marc Valin <jean-marc.valin@usherbrooke.ca> | 2008-09-06 05:55:28 +0400 |
---|---|---|
committer | Jean-Marc Valin <jean-marc.valin@usherbrooke.ca> | 2008-09-06 07:06:07 +0400 |
commit | 99a7ef29c4a4b7de435190b927354ba84bd65635 (patch) | |
tree | b713fb4c7a5941a75672473f077ea71ca619dace /libspeex/nb_celp.c | |
parent | dc31cc4b56d29d4c7f3d84efbb0b2d61577ca99a (diff) |
Merged lsp_interpolate() with lsp_enforce_margin()
Diffstat (limited to 'libspeex/nb_celp.c')
-rw-r--r-- | libspeex/nb_celp.c | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/libspeex/nb_celp.c b/libspeex/nb_celp.c index b6083a1..a36da69 100644 --- a/libspeex/nb_celp.c +++ b/libspeex/nb_celp.c @@ -504,9 +504,7 @@ int nb_encode(void *state, void *vin, SpeexBits *bits) for (i=0;i<NB_ORDER;i++) interp_lsp[i] = lsp[i]; else - lsp_interpolate(st->old_lsp, lsp, interp_lsp, NB_ORDER, NB_NB_SUBFRAMES, NB_NB_SUBFRAMES<<1); - - lsp_enforce_margin(interp_lsp, NB_ORDER, LSP_MARGIN); + lsp_interpolate(st->old_lsp, lsp, interp_lsp, NB_ORDER, NB_NB_SUBFRAMES, NB_NB_SUBFRAMES<<1, LSP_MARGIN); /* Compute interpolated LPCs (unquantized) for whole frame*/ lsp_to_lpc(interp_lsp, interp_lpc, NB_ORDER,stack); @@ -558,9 +556,10 @@ int nb_encode(void *state, void *vin, SpeexBits *bits) } /*Compute "real" excitation*/ - SPEEX_COPY(st->exc, st->winBuf, diff); - SPEEX_COPY(st->exc+diff, in, NB_FRAME_SIZE-diff); - fir_mem16(st->exc, interp_lpc, st->exc, NB_FRAME_SIZE, NB_ORDER, st->mem_exc, stack); + /*SPEEX_COPY(st->exc, st->winBuf, diff); + SPEEX_COPY(st->exc+diff, in, NB_FRAME_SIZE-diff);*/ + fir_mem16(st->winBuf, interp_lpc, st->exc, diff, NB_ORDER, st->mem_exc, stack); + fir_mem16(in, interp_lpc, st->exc+diff, NB_FRAME_SIZE-diff, NB_ORDER, st->mem_exc, stack); /* Compute open-loop excitation gain */ { @@ -821,12 +820,8 @@ int nb_encode(void *state, void *vin, SpeexBits *bits) sw=st->sw+offset; /* LSP interpolation (quantized and unquantized) */ - lsp_interpolate(st->old_lsp, lsp, interp_lsp, NB_ORDER, sub, NB_NB_SUBFRAMES); - lsp_interpolate(st->old_qlsp, qlsp, interp_qlsp, NB_ORDER, sub, NB_NB_SUBFRAMES); - - /* Make sure the filters are stable */ - lsp_enforce_margin(interp_lsp, NB_ORDER, LSP_MARGIN); - lsp_enforce_margin(interp_qlsp, NB_ORDER, LSP_MARGIN); + lsp_interpolate(st->old_lsp, lsp, interp_lsp, NB_ORDER, sub, NB_NB_SUBFRAMES, LSP_MARGIN); + lsp_interpolate(st->old_qlsp, qlsp, interp_qlsp, NB_ORDER, sub, NB_NB_SUBFRAMES, LSP_MARGIN); /* Compute interpolated LPCs (quantized and unquantized) */ lsp_to_lpc(interp_lsp, interp_lpc, NB_ORDER,stack); @@ -1773,10 +1768,7 @@ int nb_decode(void *state, SpeexBits *bits, void *vout) exc=st->exc+offset; /* LSP interpolation (quantized and unquantized) */ - lsp_interpolate(st->old_qlsp, qlsp, interp_qlsp, NB_ORDER, sub, NB_NB_SUBFRAMES); - - /* Make sure the LSP's are stable */ - lsp_enforce_margin(interp_qlsp, NB_ORDER, LSP_MARGIN); + lsp_interpolate(st->old_qlsp, qlsp, interp_qlsp, NB_ORDER, sub, NB_NB_SUBFRAMES, LSP_MARGIN); /* Compute interpolated LPCs (unquantized) */ lsp_to_lpc(interp_qlsp, ak, NB_ORDER, stack); |