From: drowe67 Date: Sat, 5 Nov 2011 02:21:32 +0000 (+0000) Subject: removed fprintf from run time LSP code, added all/low/high mode for LSP dT X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=36a1d165724853de7e80b215821b3efbf2783e96;p=freetel-svn-tracking.git removed fprintf from run time LSP code, added all/low/high mode for LSP dT git-svn-id: https://svn.code.sf.net/p/freetel/code@299 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/codec2-dev/src/c2sim.c b/codec2-dev/src/c2sim.c index f0b711ef..05443fb2 100644 --- a/codec2-dev/src/c2sim.c +++ b/codec2-dev/src/c2sim.c @@ -4,8 +4,9 @@ AUTHOR......: David Rowe DATE CREATED: 20/8/2010 - Codec2 simulation. Combines encoder and decoder and allows switching in - out various algorithms and quantisation steps. + Codec2 simulation. Combines encoder and decoder and allows + switching in and out various algorithms and quantisation + steps. Primary program for algorithm developments. \*---------------------------------------------------------------------------*/ @@ -100,7 +101,7 @@ int main(int argc, char *argv[]) float sum_snr; int lpc_model, order = LPC_ORD; - int lsp, lspd, lspvq, lsp_quantiser, lspres, lspdt; + int lsp, lspd, lspvq, lsp_quantiser, lspres, lspdt, lspdt_mode; float ak[LPC_MAX]; COMP Sw_[FFT_ENC]; COMP Ew[FFT_ENC]; @@ -163,6 +164,7 @@ int main(int argc, char *argv[]) "\t[--lspvq]\n" "\t[--lspres]\n" "\t[--lspdt]\n" + "\t[--lspdt_mode all|high|low]\n" "\t[--phase0]\n" "\t[--postfilter]\n" "\t[--hand_voicing]\n" @@ -224,7 +226,22 @@ int main(int argc, char *argv[]) assert(order == LPC_ORD); lspres = switch_present("--lspres",argc,argv); + lspdt = switch_present("--lspdt",argc,argv); + if ( (arg = switch_present("--lspdt_mode",argc,argv))) { + if (strcmp(argv[arg+1],"all") == 0) + lspdt_mode = LSPDT_ALL; + else if (strcmp(argv[arg+1],"low") == 0) + lspdt_mode = LSPDT_LOW; + else if (strcmp(argv[arg+1],"high") == 0) + lspdt_mode = LSPDT_HIGH; + else { + fprintf(stderr, "Error in lspdt_mode: %d\n", lspdt_mode); + exit(1); + } + } + else + lspdt_mode = LSPDT_ALL; phase0 = switch_present("--phase0",argc,argv); if (phase0) { @@ -340,7 +357,7 @@ int main(int argc, char *argv[]) if (lspd) { //locate_lsps_jnd_steps(lsps, LPC_ORD); lspd_quantise(lsps, lsps_, LPC_ORD); - locate_lsps_jnd_steps(lsps_, LPC_ORD); + bw_expand_lsps(lsps_, LPC_ORD); lsp_to_lpc(lsps_, ak, LPC_ORD); } @@ -356,21 +373,43 @@ int main(int argc, char *argv[]) locate_lsps_jnd_steps(lsps_, LPC_ORD); lsp_to_lpc(lsps_, ak, LPC_ORD); } + + /* we need lsp__prev[] for lspdt. If no other + LSP quantisation is used we use original LSPs + rather than quantised version. */ + + if (!lsp && !lspd && !lspvq && !lspres) + for(i=0; i lmax) { lmax = Fw[b].real; lmax_bin = b; diff --git a/codec2-dev/src/quantise.c b/codec2-dev/src/quantise.c index e351b53d..59e3c144 100644 --- a/codec2-dev/src/quantise.c +++ b/codec2-dev/src/quantise.c @@ -338,11 +338,21 @@ void lspres_quantise(float lsps[], float lsps_[], int order) lspdt_quantise - LSP difference in time quantiser. + LSP difference in time quantiser. Split VQ, encoding LSPs 1-4 with + one VQ, and LSPs 5-10 with a second. Update of previous lsp memory + is done outside of this function to handle dT between 10 or 20ms + frames. + + mode action + ------------------ + + LSPDT_ALL VQ LSPs 1-4 and 5-10 + LSPDT_LOW Just VQ LSPs 1-4, for LSPs 5-10 just copy previous + LSPDT_HIGH Just VQ LSPs 5-10, for LSPs 1-4 just copy previous \*---------------------------------------------------------------------------*/ -void lspdt_quantise(float lsps[], float lsps_[], float lsps__prev[]) +void lspdt_quantise(float lsps[], float lsps_[], float lsps__prev[], int mode) { int i,k,m; float wt[LPC_ORD]; @@ -353,36 +363,37 @@ void lspdt_quantise(float lsps[], float lsps_[], float lsps__prev[]) for(i=0; i