From d8430f2e5e6e783329bf7ac63c1915bc7449848f Mon Sep 17 00:00:00 2001 From: drowe67 Date: Sat, 16 Aug 2014 05:56:07 +0000 Subject: [PATCH] removed one FFT in post filter, as it was redundant git-svn-id: https://svn.code.sf.net/p/freetel/code@1805 01035d8c-6547-0410-b346-abe4f91aad63 --- codec2-dev/src/codec2.c | 4 ++-- codec2-dev/src/quantise.c | 38 ++++++++------------------------------ 2 files changed, 10 insertions(+), 32 deletions(-) diff --git a/codec2-dev/src/codec2.c b/codec2-dev/src/codec2.c index a167f763..bdb827c1 100644 --- a/codec2-dev/src/codec2.c +++ b/codec2-dev/src/codec2.c @@ -1328,7 +1328,7 @@ void synthesise_one_frame(struct CODEC2 *c2, short speech[], MODEL *model, float phase_synth_zero_order(c2->fft_fwd_cfg, model, ak, &c2->ex_phase, LPC_ORD); - PROFILE_SAMPLE_AND_LOG(pf_start,phase_start, " phase_synth"); + PROFILE_SAMPLE_AND_LOG(pf_start, phase_start, " phase_synth"); postfilter(model, &c2->bg_est); @@ -1411,7 +1411,7 @@ void analyse_one_frame(struct CODEC2 *c2, MODEL *model, short speech[]) DATE CREATED: Nov 7 2012 Limits output level to protect ears when there are bit errors or the input - is overdriven. This doesn't correct or mask bit erros, just reduces the + is overdriven. This doesn't correct or mask bit errors, just reduces the worst of their damage. \*---------------------------------------------------------------------------*/ diff --git a/codec2-dev/src/quantise.c b/codec2-dev/src/quantise.c index 429a6add..b4d3b31b 100644 --- a/codec2-dev/src/quantise.c +++ b/codec2-dev/src/quantise.c @@ -767,7 +767,7 @@ void force_min_lsp_dist(float lsp[], int order) of this text is on the MBE vocoder, and this is a freq domain adaptation of post filtering commonly used in CELP. - I used the Octave simulation lpcpf.m to get an understaing of the + I used the Octave simulation lpcpf.m to get an understanding of the algorithm. Requires two more FFTs which is significantly more MIPs. However @@ -785,7 +785,7 @@ void force_min_lsp_dist(float lsp[], int order) \*---------------------------------------------------------------------------*/ void lpc_post_filter(kiss_fft_cfg fft_fwd_cfg, COMP Pw[], float ak[], - int order, int dump, float beta, float gamma, int bass_boost) + int order, int dump, float beta, float gamma, int bass_boost, float E) { int i; COMP x[FFT_ENC]; /* input to FFTs */ @@ -800,30 +800,6 @@ void lpc_post_filter(kiss_fft_cfg fft_fwd_cfg, COMP Pw[], float ak[], PROFILE_SAMPLE(tstart); - /* Determine LPC inverse filter spectrum 1/A(exp(jw)) -----------*/ - - /* we actually want the synthesis filter A(exp(jw)) but the - inverse (analysis) filter is easier to find as it's FIR, we - just use the inverse of 1/A to get the synthesis filter - A(exp(jw)) */ - - for(i=0; i max_Rw) max_Rw = Rw[i]; if (Rw[i] < min_Rw) @@ -889,8 +865,10 @@ void lpc_post_filter(kiss_fft_cfg fft_fwd_cfg, COMP Pw[], float ak[], e_after += Pw[i].real; } gain = e_before/e_after; - /* apply gain factor to normalise energy */ + /* apply gain factor to normalise energy, and LPC Energy */ + + gain *= E; for(i=0; i