From 8e5c2c36f6584d88c6dbe0ce1f47c09d75c818fc Mon Sep 17 00:00:00 2001 From: drowe67 Date: Mon, 31 Oct 2011 07:22:39 +0000 Subject: [PATCH] --lspd mode with scalr LSP differences for lsp1-4, then VQ in log domain of lsp5-10. Tried a 1024 element VQ but errors propogate so pretty rougfh results git-svn-id: https://svn.code.sf.net/p/freetel/code@294 01035d8c-6547-0410-b346-abe4f91aad63 --- codec2-dev/src/Makefile.am | 7 +---- codec2-dev/src/Makefile.in | 7 +---- codec2-dev/src/c2sim.c | 2 ++ codec2-dev/src/quantise.c | 44 +++++++++++++++++++++++++++---- codec2-dev/unittest/genlsp.c | 3 ++- codec2-dev/unittest/vqtrain.c | 49 +++-------------------------------- 6 files changed, 48 insertions(+), 64 deletions(-) diff --git a/codec2-dev/src/Makefile.am b/codec2-dev/src/Makefile.am index b890b101..93995db9 100644 --- a/codec2-dev/src/Makefile.am +++ b/codec2-dev/src/Makefile.am @@ -26,12 +26,7 @@ CODEBOOKSD= \ $D/dlsp2.txt \ $D/dlsp3.txt \ $D/dlsp4.txt \ - $D/dlsp5.txt \ - $D/dlsp6.txt \ - $D/dlsp7.txt \ - $D/dlsp8.txt \ - $D/dlsp9.txt \ - $D/dlsp10.txt + $(top_srcdir)/unittest/lspdlog5-10_1024.txt # lspd VQ quantisers diff --git a/codec2-dev/src/Makefile.in b/codec2-dev/src/Makefile.in index ab73357c..0c3274c4 100644 --- a/codec2-dev/src/Makefile.in +++ b/codec2-dev/src/Makefile.in @@ -240,12 +240,7 @@ CODEBOOKSD = \ $D/dlsp2.txt \ $D/dlsp3.txt \ $D/dlsp4.txt \ - $D/dlsp5.txt \ - $D/dlsp6.txt \ - $D/dlsp7.txt \ - $D/dlsp8.txt \ - $D/dlsp9.txt \ - $D/dlsp10.txt + $(top_srcdir)/unittest/lspdlog5-10_1024.txt # lspd VQ quantisers diff --git a/codec2-dev/src/c2sim.c b/codec2-dev/src/c2sim.c index 8c12786f..f6df412c 100644 --- a/codec2-dev/src/c2sim.c +++ b/codec2-dev/src/c2sim.c @@ -369,6 +369,7 @@ int main(int argc, char *argv[]) #endif } +#ifdef RESAMPLE /* optional resampling of model amplitudes */ //printf("frames=%d\n", frames); @@ -379,6 +380,7 @@ int main(int argc, char *argv[]) dump_quantised_model(&model); #endif } +#endif /* option decimation to 20ms rate, which enables interpolation routine to synthesise in between frame */ diff --git a/codec2-dev/src/quantise.c b/codec2-dev/src/quantise.c index 58e5d2d4..1f3443fe 100644 --- a/codec2-dev/src/quantise.c +++ b/codec2-dev/src/quantise.c @@ -120,7 +120,7 @@ long quantise(const float * cb, float vec[], float w[], int k, int m, float *se) lspd_quantise - Scalar lsp difference quantiser. + Scalar/VQ LSP difference quantiser. \*---------------------------------------------------------------------------*/ @@ -130,16 +130,20 @@ void lspd_quantise( int order ) { - int i,k,m; + int i,k,m,ncb, nlsp, index; float lsp_hz[LPC_MAX]; float lsp__hz[LPC_MAX]; float dlsp[LPC_MAX]; float dlsp_[LPC_MAX]; - float wt[1]; + float wt[LPC_MAX]; const float *cb; float se; int indexes[LPC_MAX]; + for(i=0; i #include @@ -132,7 +133,7 @@ int main(int argc, char *argv[]) { fprintf(flsp,"%f ",log10(lsp[0])); for(i=1; i DELTAQ); - /* check % within JND */ - - { - long jnd; - int cur_jnd; - float diff, jnd_thresh = 50.0*pi/4000.0; - - jnd = 0; - se = 0.0; - rewind(ftrain); - for(i=0; i jnd_thresh) - cur_jnd = 1; - if (cur_jnd) jnd++; - } - } - printf("jnd %3.2f %%\n", 100.0*(float)jnd/(J*k)); - } - /* save codebook to disk */ fvq = fopen(argv[4],"wt"); @@ -327,18 +299,3 @@ long quantise(float cb[], float vec[], int k, int m, float *se) return(besti); } -void jnd(float x[], int k) { - float lsp_hz, step = 100.0; - int i; - - for(i=0; i