From eecbd24f0f2df405b0a4dba4da1e2f0b3fb426d1 Mon Sep 17 00:00:00 2001 From: drowe67 Date: Sun, 4 Oct 2009 10:06:51 +0000 Subject: [PATCH] 32 bit LSP difference split VQ, sounds OK over our small test database thru a loudspeaker git-svn-id: https://svn.code.sf.net/p/freetel/code@71 01035d8c-6547-0410-b346-abe4f91aad63 --- codec2/src/quantise.c | 94 +++- codec2/src/sinedec.c | 1 + codec2/unittest/genlsp.c | 36 +- codec2/unittest/lspd123.txt | 1024 +++++++++++++++++++++++++++++++++++ codec2/unittest/lspd456.txt | 1024 +++++++++++++++++++++++++++++++++++ codec2/unittest/lspd78.txt | 64 +++ codec2/unittest/lspd910.txt | 64 +++ 7 files changed, 2277 insertions(+), 30 deletions(-) create mode 100644 codec2/unittest/lspd123.txt create mode 100644 codec2/unittest/lspd456.txt create mode 100644 codec2/unittest/lspd78.txt create mode 100644 codec2/unittest/lspd910.txt diff --git a/codec2/src/quantise.c b/codec2/src/quantise.c index f2e37c85..b9de0a1d 100644 --- a/codec2/src/quantise.c +++ b/codec2/src/quantise.c @@ -35,7 +35,7 @@ #include #define MAX_ORDER 20 -#define LSP_DELTA1 0.05 /* grid spacing for LSP root searches */ +#define LSP_DELTA1 0.01 /* grid spacing for LSP root searches */ #define MAX_CB 10 /* max number of codebooks */ /* describes each codebook */ @@ -48,27 +48,15 @@ typedef struct { /* lsp_q describes entire quantiser made up of several codebooks */ -//#define FIRST_ATTEMPT -#ifdef FIRST_ATTEMPT +/* 10+10+6+6 = 32 bit LSP difference split VQ */ LSP_CB lsp_q[] = { - {2, 1024, "../unittest/lsp12_01.txt" }, /* LSP 1,2 */ - {2, 512, "../unittest/lsp34_01.txt" }, /* LSP 3,4 */ - {3, 512, "../unittest/lsp57_01.txt" }, /* LSP 5,6,7 */ - {3, 512, "../unittest/lsp810_01.txt"}, /* LSP 8,9,10 */ + {3, 1024, "../unittest/lspd123.txt"}, + {3, 1024, "../unittest/lspd456.txt"}, + {2, 64, "../unittest/lspd78.txt"}, + {2, 64, "../unittest/lspd910.txt"}, {0, 0, ""} }; -#else - -/* 10+10+8 = 28 bit LSP quantiser */ - -LSP_CB lsp_q[] = { - {3, 1024, "../unittest/lsp123.txt" }, /* LSP 1,2,3 */ - {4, 1024, "../unittest/lsp4567.txt" }, /* LSP 4,5,6,7 */ - {3, 256, "../unittest/lsp8910.txt" }, /* LSP 8,9,10 */ - {0, 0, ""} -}; -#endif /* ptr to each codebook */ @@ -225,9 +213,10 @@ void quantise_init() \*---------------------------------------------------------------------------*/ -long quantise(float cb[], float vec[], int k, int m, float *se) +long quantise(float cb[], float vec[], float w[], int k, int m, float *se) /* float cb[][K]; current VQ codebook */ /* float vec[]; vector to quantise */ +/* float w[]; weighting vector */ /* int k; dimension of vectors */ /* int m; size of codebook */ /* float *se; accumulated squared error */ @@ -243,7 +232,7 @@ long quantise(float cb[], float vec[], int k, int m, float *se) for(j=0; j #include +#include #include #include "lpc.h" /* LPC analysis functions */ #include "lsp.h" /* LSP encode/decode functions */ +int switch_present(sw,argc,argv) + char sw[]; /* switch in string form */ + int argc; /* number of command line arguments */ + char *argv[]; /* array of command line arguments in string form */ +{ + int i; /* loop variable */ + + for(i=1; i