From: drowe67 Date: Mon, 18 Mar 2013 04:20:52 +0000 (+0000) Subject: new 1300 bit/s mode X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=ff2feef271b127275a75b677574b2a059dd55e69;p=freetel-svn-tracking.git new 1300 bit/s mode git-svn-id: https://svn.code.sf.net/p/freetel/code@1207 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/codec2-dev/src/codec2_internal.h b/codec2-dev/src/codec2_internal.h index 5c6d279c..b9efcc4c 100644 --- a/codec2-dev/src/codec2_internal.h +++ b/codec2-dev/src/codec2_internal.h @@ -55,6 +55,8 @@ struct CODEC2 { float xq_enc[2]; /* joint pitch and energy VQ states */ float xq_dec[2]; + + int smoothing; /* enable smoothing for channels with errors */ }; #endif diff --git a/codec2-dev/src/interp.c b/codec2-dev/src/interp.c index a8d818fa..d7e56abb 100644 --- a/codec2-dev/src/interp.c +++ b/codec2-dev/src/interp.c @@ -223,6 +223,26 @@ void interp_Wo( MODEL *prev, /* previous frames model params */ MODEL *next /* next frames model params */ ) +{ + interp_Wo2(interp, prev, next, 0.5); +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: interp_Wo2() + AUTHOR......: David Rowe + DATE CREATED: 22 May 2012 + + Weighted interpolation of two Wo samples. + +\*---------------------------------------------------------------------------*/ + +void interp_Wo2( + MODEL *interp, /* interpolated model params */ + MODEL *prev, /* previous frames model params */ + MODEL *next, /* next frames model params */ + float weight +) { /* trap corner case where voicing est is probably wrong */ @@ -234,7 +254,7 @@ void interp_Wo( if (interp->voiced) { if (prev->voiced && next->voiced) - interp->Wo = (prev->Wo + next->Wo)/2.0; + interp->Wo = (1.0 - weight)*prev->Wo + weight*next->Wo; if (!prev->voiced && next->voiced) interp->Wo = next->Wo; if (prev->voiced && !next->voiced) @@ -265,6 +285,24 @@ float interp_energy(float prev_e, float next_e) } +/*---------------------------------------------------------------------------*\ + + FUNCTION....: interp_energy2() + AUTHOR......: David Rowe + DATE CREATED: 22 May 2012 + + Interpolates centre 10ms sample of energy given two samples 20ms + apart. + +\*---------------------------------------------------------------------------*/ + +float interp_energy2(float prev_e, float next_e, float weight) +{ + return pow(10.0, (1.0 - weight)*log10(prev_e) + weight*log10(next_e)); + +} + + /*---------------------------------------------------------------------------*\ FUNCTION....: interpolate_lsp_ver2() diff --git a/codec2-dev/src/interp.h b/codec2-dev/src/interp.h index 312ccb76..68d817b7 100644 --- a/codec2-dev/src/interp.h +++ b/codec2-dev/src/interp.h @@ -37,7 +37,9 @@ void interpolate_lsp(kiss_fft_cfg fft_dec_cfg, float *next_lsps, float next_e, float *ak_interp, float *lsps_interp); void interp_Wo(MODEL *interp, MODEL *prev, MODEL *next); +void interp_Wo2(MODEL *interp, MODEL *prev, MODEL *next, float weight); float interp_energy(float prev, float next); +float interp_energy2(float prev, float next, float weight); void interpolate_lsp_ver2(float interp[], float prev[], float next[], float weight); #endif diff --git a/codec2-dev/src/quantise.c b/codec2-dev/src/quantise.c index 1153943b..62728b84 100644 --- a/codec2-dev/src/quantise.c +++ b/codec2-dev/src/quantise.c @@ -727,11 +727,12 @@ int check_lsp_order(float lsp[], int lpc_order) for(i=1; i