From a78ca7a61f2c35bf562b641b1e2c09f7c5421345 Mon Sep 17 00:00:00 2001 From: drowe67 Date: Thu, 24 Sep 2009 08:41:27 +0000 Subject: [PATCH] fixed bug when phase0 and LPC combined - important to do phase0 with original {Am} git-svn-id: https://svn.code.sf.net/p/freetel/code@64 01035d8c-6547-0410-b346-abe4f91aad63 --- codec2/src/sinedec.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/codec2/src/sinedec.c b/codec2/src/sinedec.c index 3dab7a59..bf840f21 100644 --- a/codec2/src/sinedec.c +++ b/codec2/src/sinedec.c @@ -197,15 +197,8 @@ int main(int argc, char *argv[]) dump_model(&model); - /* optional LPC model amplitudes */ - - if (lpc_model) { - snr = lpc_model_amplitudes(Sn, &model, order, lsp_quantiser, ak); - sum_snr += snr; - dump_quantised_model(&model); - } - - /* optional phase modelling */ + /* optional phase modelling - make sure this happens before LPC modelling + as first order model fit doesn't work well with LPC Modelled {Am} */ if (phase) { float Wn[M]; /* windowed speech samples */ @@ -226,7 +219,7 @@ int main(int argc, char *argv[]) levinson_durbin(Rk,ak,PHASE_LPC_ORD); } else - assert(order == PHASE_LPC_ORD); + assert(order == PHASE_LPC_ORD); dump_ak(ak, PHASE_LPC_ORD); snr = phase_model_first_order(ak, H, &n_min, &min_Am); @@ -243,11 +236,19 @@ int main(int argc, char *argv[]) phase_synth_first_order(snr, H, n_min, min_Am); dump_phase_(&model.phi[0]); } + + if (postfilt) + postfilter(&model, snr>2.0, &bg_est); + } - if (postfilt) - postfilter(&model, snr>2.0, &bg_est); + /* optional LPC model amplitudes */ + if (lpc_model) { + snr = lpc_model_amplitudes(Sn, &model, order, lsp_quantiser, ak); + sum_snr += snr; + dump_quantised_model(&model); + } /* Synthesise speech */ -- 2.25.1