Added both LSP and prediction gain quantization... the code is a bit ugly
authorjmvalin <jmvalin@0101bb08-14d6-0310-b084-bc0e0c8e3800>
Mon, 18 Feb 2002 20:47:44 +0000 (20:47 +0000)
committerjmvalin <jmvalin@0101bb08-14d6-0310-b084-bc0e0c8e3800>
Mon, 18 Feb 2002 20:47:44 +0000 (20:47 +0000)
but it seems to work. For now we assume a fixed narrowband codebook...
Next step: Analysis by synthesis and excitation quantization

git-svn-id: http://svn.xiph.org/trunk/speex@3068 0101bb08-14d6-0310-b084-bc0e0c8e3800

libspeex/gain_table.c [new file with mode: 0644]
libspeex/lsp_tables_nb.c [new file with mode: 0644]
libspeex/ltp.c
libspeex/ltp.h
libspeex/quant_lsp.c [new file with mode: 0644]
libspeex/quant_lsp.h [new file with mode: 0644]
libspeex/speex.c
libspeex/speex.h

diff --git a/libspeex/gain_table.c b/libspeex/gain_table.c
new file mode 100644 (file)
index 0000000..e0bfd7a
--- /dev/null
@@ -0,0 +1,131 @@
+float gain_cdbk_nb[] = {
+-0.0835367,-0.551418,0.308789,-0.167073,-1.10284,0.617578,-0.0921273,0.340544,0.0515904,-0.00697838,-0.304062,-0.095350,
+-0.0113288,1.1138,-0.00677945,-0.0226576,2.2276,-0.0135589,0.025236,0.0151019,-0.000153606,-0.000128342,-1.24055,-4.59609e-0,
+-0.329528,0.415655,-0.202465,-0.659056,0.83131,-0.40493,0.27394,0.168311,-0.133436,-0.108589,-0.172769,-0.040992,
+0.252626,0.868252,-0.11296,0.505252,1.7365,-0.22592,-0.438686,0.196155,0.0570733,-0.0638199,-0.753862,-0.0127,
+0.302641,-0.46334,0.0337584,0.605282,-0.92668,0.0675168,0.280451,0.0312832,-0.0204334,-0.0915916,-0.214684,-0.0011396,
+-0.525935,0.91423,0.017383,-1.05187,1.82846,0.034766,0.961651,-0.0317841,0.0182847,-0.276608,-0.835816,-0.00030216,
+0.282038,0.0840179,0.268353,0.564076,0.168036,0.536706,-0.0473925,-0.0450929,-0.151371,-0.0795454,-0.00705901,-0.072013,
+0.313786,0.535252,-0.369231,0.627572,1.0705,-0.738462,-0.335909,0.395263,0.231719,-0.0984617,-0.286495,-0.13633,
+0.27669,-0.523893,-0.299434,0.55338,-1.04779,-0.598868,0.289912,-0.313743,0.165701,-0.0765574,-0.274464,-0.089660,
+-0.125827,0.791536,0.108779,-0.251654,1.58307,0.217558,0.199193,-0.172205,0.0273747,-0.0158324,-0.626529,-0.011832,
+0.0571856,0.840065,-0.532651,0.114371,1.68013,-1.0653,-0.0960792,0.894923,0.0609199,-0.00327019,-0.705709,-0.28371,
+0.149074,0.452369,-0.00631503,0.298148,0.904738,-0.0126301,-0.134873,0.00571345,0.00188281,-0.0222231,-0.204638,-3.98796e-0,
+-0.262684,-0.355641,0.201628,-0.525368,-0.711282,0.403256,-0.186842,0.143414,0.105929,-0.0690029,-0.126481,-0.040653,
+-0.291021,0.407483,0.26212,-0.582042,0.814966,0.52424,0.237172,-0.213619,0.152565,-0.0846932,-0.166042,-0.068706,
+0.13806,0.14114,0.125357,0.27612,0.28228,0.250714,-0.0389716,-0.0353858,-0.0346136,-0.0190606,-0.0199205,-0.015714,
+0.527793,0.661201,-0.212787,1.05559,1.3224,-0.425574,-0.697955,0.28139,0.224615,-0.278565,-0.437187,-0.045278,
+0.154056,-0.214349,0.164432,0.308112,-0.428698,0.328864,0.0660435,0.0704917,-0.0506635,-0.0237333,-0.0459455,-0.027037,
+0.0120761,0.960133,-0.0070357,0.0241522,1.92027,-0.0140714,-0.0231893,0.0135104,0.000169928,-0.000145832,-0.921855,-4.95011e-0,
+-0.122786,0.47906,-0.368261,-0.245572,0.95812,-0.736522,0.117644,0.352838,-0.0904346,-0.0150764,-0.229498,-0.13561,
+0.0868574,1.07242,-0.148461,0.173715,2.14484,-0.296922,-0.186295,0.318425,0.0257899,-0.00754421,-1.15008,-0.022040,
+-0.141727,-0.31882,0.00269713,-0.283454,-0.63764,0.00539426,-0.0903708,0.0017198,0.000764512,-0.0200865,-0.101646,-7.27451e-0,
+-0.0730263,0.794255,0.250746,-0.146053,1.58851,0.501492,0.116003,-0.398313,0.0366221,-0.00533284,-0.630841,-0.062873,
+0.172625,0.263122,0.282431,0.34525,0.526244,0.564862,-0.0908429,-0.148628,-0.0975093,-0.0297994,-0.0692332,-0.079767,
+0.343943,0.634859,0.0239209,0.687886,1.26972,0.0478418,-0.436711,-0.0303728,-0.0164549,-0.118297,-0.403046,-0.00057220,
+0.189343,-0.69774,0.0241036,0.378686,-1.39548,0.0482072,0.264224,0.0336361,-0.0091277,-0.0358508,-0.486841,-0.00058098,
+0.00695874,0.783606,0.0104012,0.0139175,1.56721,0.0208024,-0.0109058,-0.0163009,-0.000144758,-4.84241e-05,-0.614038,-0.00010818,
+-0.189688,0.350888,-0.0109644,-0.379376,0.701776,-0.0219288,0.133118,0.00769455,-0.00415963,-0.0359815,-0.123122,-0.00012021,
+0.149356,0.546013,0.29965,0.298712,1.09203,0.5993,-0.163101,-0.327226,-0.0895091,-0.0223072,-0.29813,-0.089790,
+-0.0704944,-0.468163,-0.305077,-0.140989,-0.936326,-0.610154,-0.0660057,-0.285652,-0.0430124,-0.00496946,-0.219177,-0.09307,
+-0.177064,0.658498,0.530958,-0.354128,1.317,1.06192,0.233193,-0.69927,0.188027,-0.0313517,-0.43362,-0.28191,
+0.026998,0.0969227,0.0184398,0.053996,0.193845,0.0368796,-0.00523344,-0.00357447,-0.000995675,-0.000728892,-0.00939401,-0.00034002,
+0.483163,0.574196,-0.0542726,0.966326,1.14839,-0.108545,-0.554861,0.0623262,0.052445,-0.233446,-0.329701,-0.0029455,
+-0.0120126,-0.349254,0.175344,-0.0240252,-0.698508,0.350688,-0.0083909,0.122479,0.00421267,-0.000144303,-0.121978,-0.030745,
+-0.128498,0.90756,-0.183164,-0.256996,1.81512,-0.366328,0.233239,0.332465,-0.0470724,-0.0165117,-0.823665,-0.033549,
+-0.471804,0.352014,-0.49458,-0.943608,0.704028,-0.98916,0.332163,0.348198,-0.46669,-0.222599,-0.123914,-0.24460,
+0.129794,0.94913,-0.0962774,0.259588,1.89826,-0.192555,-0.246383,0.18276,0.0249925,-0.0168465,-0.900848,-0.0092693,
+0.00141897,-0.202971,0.000190774,0.00283794,-0.405942,0.000381548,0.00057602,7.74432e-05,-5.41405e-07,-2.01348e-06,-0.0411972,-3.63947e-0,
+-0.248142,0.73736,0.275587,-0.496284,1.47472,0.551174,0.36594,-0.406414,0.136769,-0.0615745,-0.5437,-0.075948,
+0.283302,0.273483,0.177215,0.566604,0.546966,0.35443,-0.154957,-0.0969306,-0.100411,-0.08026,-0.074793,-0.031405,
+0.264314,0.754669,-0.0186371,0.528628,1.50934,-0.0372742,-0.398939,0.0281297,0.00985209,-0.0698619,-0.569525,-0.00034734,
+0.0334528,-0.466391,-0.0836871,0.0669056,-0.932782,-0.167374,0.0312042,-0.0780618,0.00559914,-0.00111909,-0.217521,-0.0070035,
+-0.116798,1.02104,0.0885608,-0.233596,2.04208,0.177122,0.238511,-0.180848,0.0206874,-0.0136418,-1.04252,-0.0078430,
+-0.361083,0.583672,0.0205782,-0.722166,1.16734,0.0411564,0.421508,-0.0240218,0.0148609,-0.130381,-0.340673,-0.00042346,
+0.00695965,0.52519,-0.014762,0.0139193,1.05038,-0.029524,-0.00731028,0.0155057,0.000205477,-4.84367e-05,-0.275825,-0.00021791,
+-0.125383,-0.527224,0.0312592,-0.250766,-1.05445,0.0625184,-0.13221,0.0329612,0.00783874,-0.0157209,-0.277965,-0.00097713,
+0.0364032,0.496502,0.453268,0.0728064,0.993004,0.906536,-0.0361485,-0.450097,-0.0330008,-0.00132519,-0.246514,-0.20545,
+0.261375,0.352348,0.0362082,0.52275,0.704696,0.0724164,-0.18419,-0.0255158,-0.0189278,-0.0683169,-0.124149,-0.0013110,
+0.387433,0.968697,-0.348807,0.774866,1.93739,-0.697614,-0.75061,0.675777,0.270279,-0.150104,-0.938374,-0.12166,
+0.526889,-0.406021,0.550916,1.05378,-0.812042,1.10183,0.427856,0.447367,-0.580543,-0.277612,-0.164853,-0.30350,
+-0.0201473,0.926353,0.094649,-0.0402946,1.85271,0.189298,0.037327,-0.175357,0.00381384,-0.000405914,-0.85813,-0.0089584,
+-0.0324727,0.371984,-0.168088,-0.0649454,0.743968,-0.336176,0.0241586,0.125052,-0.0109165,-0.00105448,-0.138372,-0.028253,
+-0.0342151,1.28198,-0.303342,-0.0684302,2.56396,-0.606684,0.0877261,0.777757,-0.0207578,-0.00117067,-1.64347,-0.092016,
+-0.249713,-0.174371,-0.181183,-0.499426,-0.348742,-0.362366,-0.0870854,-0.0631861,-0.0904875,-0.0623566,-0.0304052,-0.032827,
+-0.113929,0.735418,0.372056,-0.227858,1.47084,0.744112,0.167571,-0.547233,0.0847759,-0.0129798,-0.54084,-0.13842,
+0.182865,0.39086,0.424518,0.36573,0.78172,0.849036,-0.142949,-0.331854,-0.155259,-0.0334396,-0.152772,-0.18021,
+0.458371,0.263759,0.267603,0.916742,0.527518,0.535206,-0.241799,-0.141165,-0.245323,-0.210104,-0.0695688,-0.071611,
+0.176407,-1.15397,0.185397,0.352814,-2.30794,0.370794,0.407137,0.427885,-0.0654107,-0.0311194,-1.33165,-0.03437,
+0.129757,0.888182,0.0106701,0.259514,1.77636,0.0213402,-0.230496,-0.018954,-0.00276904,-0.0168369,-0.788867,-0.00011385,
+-0.0816914,0.34195,0.188348,-0.163383,0.6839,0.376696,0.0558687,-0.128811,0.0307728,-0.00667348,-0.11693,-0.03547,
+0.0361682,0.819199,0.156563,0.0723364,1.6384,0.313126,-0.0592579,-0.256513,-0.0113252,-0.00130814,-0.671087,-0.02451,
+-0.30052,-0.299784,-0.334056,-0.60104,-0.599568,-0.668112,-0.180182,-0.200289,-0.200781,-0.0903123,-0.0898704,-0.11159,
+-0.337084,0.754302,0.561453,-0.674168,1.5086,1.12291,0.508526,-0.84701,0.378514,-0.113626,-0.568972,-0.31522,
+0.110344,0.25692,-0.0358049,0.220688,0.51384,-0.0716098,-0.0566992,0.018398,0.00790171,-0.0121758,-0.0660079,-0.0012819,
+0.409419,0.755356,-0.137551,0.818838,1.51071,-0.275102,-0.618514,0.2078,0.112632,-0.167624,-0.570563,-0.018920,
+-0.279742,-0.838229,0.444577,-0.559484,-1.67646,0.889154,-0.468976,0.745315,0.248734,-0.0782556,-0.702628,-0.19764,
+-0.00139772,1.19865,-0.00139142,-0.00279544,2.3973,-0.00278284,0.00335075,0.00333565,-3.88963e-06,-1.95362e-06,-1.43676,-1.93605e-0,
+-0.219368,0.223393,-0.235062,-0.438736,0.446786,-0.470124,0.0980106,0.105022,-0.10313,-0.0481223,-0.0499044,-0.055254,
+0.265489,0.744652,-0.163906,0.530978,1.4893,-0.327812,-0.395394,0.244106,0.0870305,-0.0704844,-0.554507,-0.026865,
+0.129166,-0.336387,0.029217,0.258332,-0.672774,0.058434,0.0868995,0.0196564,-0.00754769,-0.0166839,-0.113156,-0.00085363,
+-0.279395,1.13197,0.174922,-0.55879,2.26394,0.349844,0.632534,-0.396013,0.0977447,-0.0780616,-1.28136,-0.030597,
+0.465391,0.00413588,0.466138,0.930782,0.00827176,0.932276,-0.0038496,-0.00385578,-0.433873,-0.216589,-1.71055e-05,-0.21728,
+0.216105,0.592293,-0.0902254,0.43221,1.18459,-0.180451,-0.255995,0.10688,0.0389963,-0.0467014,-0.350811,-0.0081406,
+0.416302,-0.888743,-0.211615,0.832604,-1.77749,-0.42323,0.739971,-0.376143,0.176191,-0.173307,-0.789864,-0.044780,
+-0.0901889,0.90439,0.181285,-0.180378,1.80878,0.36257,0.163132,-0.327905,0.0326998,-0.00813404,-0.817921,-0.032864,
+-0.401604,0.740389,-0.398883,-0.803208,1.48078,-0.797766,0.594686,0.590657,-0.320386,-0.161286,-0.548176,-0.15910,
+0.0545025,0.528413,0.154116,0.109005,1.05683,0.308232,-0.0575997,-0.162874,-0.0167994,-0.00297052,-0.27922,-0.023751,
+-0.375791,-0.59267,0.116821,-0.751582,-1.18534,0.233642,-0.44544,0.138473,0.0878006,-0.141219,-0.351258,-0.013647,
+-0.0552678,0.491509,0.303215,-0.110536,0.983018,0.60643,0.0543292,-0.298066,0.0335161,-0.00305453,-0.241581,-0.091939,
+0.106225,0.288451,0.133849,0.21245,0.576902,0.267698,-0.0612814,-0.0772178,-0.0284362,-0.0112838,-0.083204,-0.017915,
+0.543973,0.789725,-0.329006,1.08795,1.57945,-0.658012,-0.859178,0.519649,0.357941,-0.295907,-0.623666,-0.10824,
+0.319605,-0.283423,0.284489,0.63921,-0.566846,0.568978,0.181167,0.161261,-0.181848,-0.102147,-0.0803286,-0.08093,
+0.00153946,1.03402,-0.00193658,0.00307892,2.06804,-0.00387316,-0.00318366,0.00400492,5.96257e-06,-2.36994e-06,-1.0692,-3.75034e-0,
+0.0585713,0.615447,-0.233984,0.117143,1.23089,-0.467968,-0.0720951,0.28801,0.0274095,-0.0034306,-0.378775,-0.054748,
+0.233006,0.960139,-0.199943,0.466012,1.92028,-0.399886,-0.447436,0.383946,0.0931758,-0.0542918,-0.921867,-0.039977,
+-0.072204,-0.297819,-0.166072,-0.144408,-0.595638,-0.332144,-0.0430074,-0.0989188,-0.0239821,-0.00521342,-0.0886962,-0.027579,
+-0.168131,0.871075,0.31078,-0.336262,1.74215,0.62156,0.292909,-0.541425,0.104504,-0.028268,-0.758772,-0.096584,
+0.063543,0.392442,0.274186,0.127086,0.784884,0.548372,-0.0498739,-0.215204,-0.0348452,-0.00403771,-0.154011,-0.07517,
+0.265409,0.543113,0.125965,0.530818,1.08623,0.25193,-0.288294,-0.136826,-0.0668645,-0.0704419,-0.294972,-0.015867,
+0.493319,-0.732808,0.214881,0.986638,-1.46562,0.429762,0.723016,0.314933,-0.21201,-0.243364,-0.537008,-0.046173,
+0.00333244,0.667791,-0.00225985,0.00666488,1.33558,-0.0045197,-0.00445075,0.00301821,1.50616e-05,-1.11052e-05,-0.445945,-5.10692e-0,
+-0.126584,0.520066,0.111321,-0.253168,1.04013,0.222642,0.131664,-0.115789,0.0281829,-0.0160235,-0.270469,-0.012392,
+0.176282,0.673591,0.174415,0.352564,1.34718,0.34883,-0.237484,-0.234969,-0.0614925,-0.0310753,-0.453725,-0.030420,
+-0.00289298,-0.692194,-0.216093,-0.00578596,-1.38439,-0.432186,-0.00400501,-0.299157,-0.00125031,-8.36933e-06,-0.479133,-0.046696,
+-0.183322,0.56588,0.405543,-0.366644,1.13176,0.811086,0.207477,-0.458977,0.14869,-0.033607,-0.32022,-0.16446,
+-0.0273091,0.219592,0.0806131,-0.0546182,0.439184,0.161226,0.0119937,-0.035404,0.00440294,-0.000745787,-0.0482206,-0.0064984,
+0.337531,0.473932,-0.0585394,0.675062,0.947864,-0.117079,-0.319933,0.0554874,0.0395177,-0.113927,-0.224612,-0.0034268,
+0.0758383,-0.523449,0.117991,0.151677,-1.0469,0.235982,0.079395,0.123525,-0.0178965,-0.00575145,-0.273999,-0.013921,
+-0.256515,1.27713,-0.0594036,-0.51303,2.55426,-0.118807,0.655206,0.151732,-0.0304758,-0.0657999,-1.63106,-0.0035287,
+-0.431556,0.00121694,-0.340688,-0.863112,0.00243388,-0.681376,0.00105036,0.000829194,-0.294052,-0.186241,-1.48094e-06,-0.11606,
+0.13298,0.795351,-0.0885678,0.26596,1.5907,-0.177136,-0.211532,0.140885,0.0235555,-0.0176837,-0.632583,-0.0078442,
+0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,
+-0.320505,0.956657,0.376907,-0.64101,1.91331,0.753814,0.613227,-0.721141,0.241601,-0.102723,-0.915193,-0.14205,
+0.322145,0.236588,0.423848,0.64429,0.473176,0.847696,-0.152431,-0.200555,-0.273081,-0.103777,-0.0559739,-0.17964,
+0.152594,0.632575,0.0287492,0.305188,1.26515,0.0574984,-0.193054,-0.0363721,-0.00877391,-0.0232849,-0.400151,-0.00082651,
+0.161205,-0.332659,-0.168981,0.32241,-0.665318,-0.337962,0.107253,-0.112426,0.0544812,-0.0259871,-0.110662,-0.028554,
+-0.183764,0.968242,0.220087,-0.367528,1.93648,0.440174,0.355856,-0.426195,0.0808881,-0.0337692,-0.937493,-0.048438,
+-0.167863,0.576404,-0.132621,-0.335726,1.15281,-0.265242,0.193514,0.152887,-0.0445243,-0.028178,-0.332242,-0.017588,
+0.00305447,0.680886,0.141503,0.00610894,1.36177,0.283006,-0.00415949,-0.192695,-0.000864433,-9.32979e-06,-0.463606,-0.020023,
+-0.102294,-0.807369,0.0698728,-0.204588,-1.61474,0.139746,-0.165178,0.112826,0.0142951,-0.0104641,-0.651845,-0.0048822,
+-0.0405991,0.618238,0.431265,-0.0811982,1.23648,0.86253,0.0501998,-0.533249,0.0350179,-0.00164829,-0.382218,-0.1859,
+0.17566,0.422673,0.161592,0.35132,0.845346,0.323184,-0.148493,-0.136601,-0.0567705,-0.0308564,-0.178652,-0.02611,
+0.364899,0.851563,-0.223539,0.729798,1.70313,-0.447078,-0.621469,0.380715,0.163138,-0.133151,-0.72516,-0.049969,
+0.193683,-0.477745,0.31487,0.387366,-0.95549,0.62974,0.185062,0.300855,-0.12197,-0.0375131,-0.22824,-0.099143,
+0.00412616,0.876173,-0.000801891,0.00825232,1.75235,-0.00160378,-0.00723046,0.00140519,6.61746e-06,-1.70252e-05,-0.767679,-6.43029e-0,
+0.179121,0.376297,-0.192549,0.358242,0.752594,-0.385098,-0.134805,0.144911,0.0689791,-0.0320843,-0.141599,-0.037075,
+0.204961,1.12444,-0.32357,0.409922,2.24888,-0.64714,-0.460933,0.72767,0.132638,-0.042009,-1.26437,-0.10469,
+-0.109874,-0.135019,-0.100525,-0.219748,-0.270038,-0.20105,-0.0296702,-0.0271456,-0.0220902,-0.0120723,-0.0182301,-0.010105,
+-0.108037,0.637784,0.245745,-0.216074,1.27557,0.49149,0.137809,-0.313464,0.0530991,-0.011672,-0.406768,-0.060390,
+0.306307,0.425902,0.27687,0.612614,0.851804,0.55374,-0.260914,-0.235839,-0.169614,-0.093824,-0.181393,-0.07665,
+0.420456,0.452155,0.112949,0.840912,0.90431,0.225898,-0.380223,-0.102141,-0.0949802,-0.176783,-0.204444,-0.012757,
+0.166341,-0.803933,0.486546,0.332682,-1.60787,0.973092,0.267454,0.782301,-0.161865,-0.0276693,-0.646308,-0.23672,
+0.140166,0.770046,0.065796,0.280332,1.54009,0.131592,-0.215869,-0.101332,-0.0184447,-0.0196465,-0.592971,-0.0043291,
+0.00434579,0.38118,0.0373839,0.00869158,0.76236,0.0747678,-0.00331306,-0.0285,-0.000324925,-1.88859e-05,-0.145298,-0.0013975,
+0.0386892,0.677762,0.290483,0.0773784,1.35552,0.580966,-0.0524441,-0.393757,-0.0224771,-0.00149685,-0.459361,-0.084380,
+-0.276609,-0.463445,-0.138162,-0.553218,-0.92689,-0.276324,-0.256386,-0.128061,-0.0764337,-0.0765125,-0.214781,-0.019088,
+-0.219103,0.797238,0.435135,-0.438206,1.59448,0.87027,0.349354,-0.693812,0.190679,-0.0480061,-0.635588,-0.18934,
+-0.0736288,0.198374,-0.0835409,-0.147258,0.396748,-0.167082,0.0292121,0.0331447,-0.012302,-0.0054212,-0.0393522,-0.0069790,
+0.374279,0.621436,-0.150749,0.748558,1.24287,-0.301498,-0.465181,0.187362,0.112844,-0.140085,-0.386183,-0.022725
+};
+
diff --git a/libspeex/lsp_tables_nb.c b/libspeex/lsp_tables_nb.c
new file mode 100644 (file)
index 0000000..2986c3b
--- /dev/null
@@ -0,0 +1,340 @@
+float cdbk_nb[]={     0.269728, 0.372372, 0.627997, 1.06063, 1.30239, 1.48717, 1.78314, 1.97805, 2.21079, 2.48535 ,
+  0.238271, 0.315725, 0.638869, 1.37119, 1.59263, 1.76589, 2.03894, 2.20728, 2.5266, 2.68382 ,
+  0.294884, 0.411627, 0.600158, 0.822329, 0.981997, 1.21208, 1.79851, 2.03834, 2.27372, 2.58234 ,
+  0.244089, 0.430726, 0.915875, 1.27547, 1.61116, 1.88346, 2.15962, 2.35166, 2.58783, 2.71514 ,
+  0.296914, 0.440389, 0.645098, 0.867076, 1.1, 1.25419, 1.62175, 2.06706, 2.32597, 2.51984 ,
+  0.220366, 0.317708, 0.477417, 0.724629, 1.28188, 1.82627, 2.10124, 2.25393, 2.51205, 2.65214 ,
+  0.191591, 0.280986, 0.426704, 0.721106, 1.24776, 1.4955, 1.74968, 1.98178, 2.31016, 2.6156 ,
+  0.423628, 0.637314, 0.948166, 1.15734, 1.37077, 1.55106, 1.8518, 2.09573, 2.41582, 2.60455 ,
+  0.261613, 0.369219, 0.577887, 0.954382, 1.1873, 1.40033, 1.93694, 2.15025, 2.43406, 2.64057 ,
+  0.215087, 0.307791, 0.499946, 1.00464, 1.41578, 1.63173, 2.00253, 2.21793, 2.50021, 2.66374 ,
+  0.318431, 0.421922, 0.685682, 0.896042, 1.09237, 1.62071, 1.95193, 2.16939, 2.55651, 2.68343 ,
+  0.483978, 0.72216, 1.03175, 1.26215, 1.51141, 1.71417, 2.00766, 2.22631, 2.50928, 2.66919 ,
+  0.356634, 0.486076, 0.703328, 0.980017, 1.16423, 1.36811, 1.74593, 1.90952, 2.31981, 2.62239 ,
+  0.259869, 0.353586, 0.535455, 1.04063, 1.51952, 1.66591, 1.89411, 2.10949, 2.32896, 2.52832 ,
+  0.263716, 0.392173, 0.595003, 0.873455, 1.24867, 1.40275, 1.72664, 2.15184, 2.4364, 2.57092 ,
+  0.411293, 0.5996, 0.801386, 1.03027, 1.29426, 1.446, 1.77104, 2.05175, 2.30522, 2.49947 ,
+  0.315757, 0.440872, 0.736251, 1.08131, 1.2668, 1.48529, 1.81962, 2.01611, 2.41981, 2.63678 ,
+  0.262304, 0.372285, 0.797399, 1.24213, 1.42686, 1.66303, 1.91566, 2.12389, 2.49887, 2.66555 ,
+  0.284825, 0.395208, 0.568187, 0.76433, 0.910514, 1.08911, 1.67343, 2.16638, 2.44018, 2.63368 ,
+  0.433473, 0.685322, 1.05765, 1.31078, 1.62243, 1.89684, 2.20113, 2.40323, 2.63409, 2.74982 ,
+  0.34656, 0.551076, 0.767065, 0.950295, 1.18316, 1.33273, 1.63998, 2.08616, 2.43606, 2.57953 ,
+  0.252917, 0.354724, 0.527754, 0.949258, 1.59235, 1.81358, 1.99463, 2.18584, 2.43107, 2.56997 ,
+  0.170951, 0.251011, 0.382747, 0.605955, 1.06095, 1.45111, 1.80031, 2.09231, 2.41228, 2.70243 ,
+  0.313611, 0.532802, 1.01002, 1.2955, 1.50965, 1.70444, 1.96896, 2.17994, 2.48031, 2.6541 ,
+  0.272186, 0.387625, 0.678405, 0.890476, 1.12855, 1.57645, 1.85565, 2.05152, 2.36162, 2.55816 ,
+  0.249509, 0.327312, 0.562653, 1.24126, 1.50434, 1.66193, 1.94194, 2.1075, 2.47949, 2.66921 ,
+  0.283599, 0.37744, 0.545607, 0.738599, 0.876566, 1.23801, 1.98935, 2.21852, 2.47939, 2.66798 ,
+  0.459734, 0.749676, 1.20389, 1.47848, 1.76765, 2.00572, 2.25088, 2.41791, 2.63026, 2.74254 ,
+  0.351086, 0.49999, 0.704679, 0.950692, 1.16255, 1.33235, 1.84067, 2.09974, 2.30144, 2.52462 ,
+  0.250584, 0.357747, 0.50166, 0.801887, 1.46943, 1.71743, 1.91476, 2.13214, 2.35938, 2.51803 ,
+  0.232147, 0.329861, 0.534622, 0.761803, 0.985477, 1.48983, 1.82211, 2.02592, 2.27526, 2.53374 ,
+  0.231836, 0.353668, 0.707724, 1.05028, 1.29772, 1.59986, 1.91137, 2.15276, 2.48583, 2.65205 ,
+  0.317159, 0.470838, 0.657216, 0.940975, 1.42336, 1.60453, 1.84145, 2.11511, 2.38872, 2.53362 ,
+  0.219511, 0.304055, 0.511536, 1.16337, 1.62401, 1.80039, 2.09973, 2.28361, 2.5308, 2.67414 ,
+  0.316807, 0.449246, 0.649587, 0.860357, 1.03242, 1.23352, 1.86624, 2.22325, 2.43576, 2.60502 ,
+  0.318532, 0.489181, 0.836814, 1.15236, 1.5711, 1.76458, 1.99917, 2.20342, 2.44869, 2.60566 ,
+  0.261281, 0.372857, 0.608347, 0.878198, 1.08918, 1.33054, 1.61895, 1.8529, 2.18253, 2.5736 ,
+  0.224587, 0.325594, 0.442077, 0.710575, 1.53609, 1.83835, 2.01913, 2.20131, 2.43855, 2.57416 ,
+  0.193531, 0.284962, 0.43149, 0.708334, 1.22455, 1.56404, 1.90009, 2.13506, 2.37332, 2.56776 ,
+  0.314956, 0.495846, 0.837423, 1.08895, 1.36169, 1.59985, 1.91515, 2.15034, 2.45905, 2.63057 ,
+  0.350715, 0.479519, 0.682716, 0.888293, 1.03901, 1.34058, 1.84057, 2.02033, 2.45346, 2.66141 ,
+  0.212276, 0.3058, 0.512172, 0.992759, 1.31046, 1.51773, 1.86444, 2.08347, 2.36975, 2.59348 ,
+  0.273572, 0.356961, 0.556407, 0.717054, 0.933298, 1.63536, 1.99289, 2.18879, 2.52033, 2.6428 ,
+  0.36, 0.593924, 1.10505, 1.40683, 1.67902, 1.87804, 2.10217, 2.28084, 2.53772, 2.68099 ,
+  0.360684, 0.528996, 0.720781, 0.941827, 1.18705, 1.34171, 1.66351, 1.9465, 2.17224, 2.44208 ,
+  0.258135, 0.36976, 0.52351, 0.847932, 1.38542, 1.55746, 1.80364, 2.0728, 2.29423, 2.47316 ,
+  0.236148, 0.343427, 0.53523, 0.890964, 1.1935, 1.38111, 1.76157, 2.0302, 2.23925, 2.47578 ,
+  0.40043, 0.566104, 0.801628, 0.99867, 1.1681, 1.4608, 1.89969, 2.11785, 2.48078, 2.6628 ,
+  0.238041, 0.340015, 0.562572, 0.959519, 1.22978, 1.44599, 1.7223, 1.92043, 2.42423, 2.63401 ,
+  0.236202, 0.391391, 0.79144, 1.12109, 1.40971, 1.72637, 2.05167, 2.28914, 2.56868, 2.70601 ,
+  0.226826, 0.318678, 0.467267, 0.673579, 0.861992, 1.23531, 1.77993, 2.07083, 2.424, 2.69776 ,
+  0.400471, 0.627706, 0.981657, 1.22973, 1.51949, 1.77614, 2.10302, 2.32538, 2.59398, 2.72723 ,
+  0.287822, 0.414135, 0.630681, 0.845693, 1.01989, 1.279, 1.61573, 1.88405, 2.46629, 2.66913 ,
+  0.223998, 0.318094, 0.466934, 0.835527, 1.58699, 1.91364, 2.11961, 2.28102, 2.54028, 2.66498 ,
+  0.19858, 0.291564, 0.462822, 0.793839, 1.07424, 1.32906, 1.74148, 2.01413, 2.35125, 2.63758 ,
+  0.394161, 0.614835, 0.922974, 1.14704, 1.43365, 1.66683, 1.9888, 2.22139, 2.5197, 2.6786 ,
+  0.329487, 0.439227, 0.707224, 0.972886, 1.13834, 1.5006, 1.78052, 1.99363, 2.55529, 2.70152 ,
+  0.26733, 0.349403, 0.577575, 1.14286, 1.36053, 1.55618, 1.83955, 2.01045, 2.51628, 2.69329 ,
+  0.270552, 0.366466, 0.582126, 0.780037, 0.961004, 1.46912, 1.80281, 2.03412, 2.52409, 2.66918 ,
+  0.502396, 0.870048, 1.26533, 1.45902, 1.71358, 1.89864, 2.11986, 2.29413, 2.54172, 2.67867 ,
+  0.318575, 0.487927, 0.668967, 0.909524, 1.31323, 1.46681, 1.72947, 2.0484, 2.30229, 2.47571 ,
+  0.231111, 0.33457, 0.518309, 0.834968, 1.36396, 1.62473, 1.85849, 2.07699, 2.49917, 2.668 ,
+  0.211596, 0.307791, 0.533462, 0.848872, 1.18835, 1.59966, 1.81581, 1.9592, 2.14327, 2.51038 ,
+  0.288493, 0.388643, 0.675794, 1.17165, 1.40162, 1.57163, 1.87474, 2.0527, 2.33181, 2.57845    
+};
+
+
+float cdbk_nb_low1[]={     -0.0655543, -0.101129, -0.0298978, 0.0882873, 0.00337778 ,
+  0.0444603, 0.0409333, 0.10182, 0.0461466, -0.0650902 ,
+  -0.0172001, -0.00107768, 0.017437, -0.0854496, -0.0804818 ,
+  -0.0250186, -0.033342, 0.0859539, 0.0422287, -0.0336373 ,
+  -0.0122282, -0.00702939, -0.00273717, 0.0436743, 0.0750326 ,
+  0.0509004, 0.0307107, 0.00385482, 0.0975481, 0.0520072 ,
+  -0.0693214, -0.0657402, -0.01715, -0.0802262, 0.0126328 ,
+  -0.000227006, -0.0310426, -0.0654538, 0.099594, 0.0156321 ,
+  -0.0278677, -0.0601328, -0.0962925, 0.0296747, -0.0647882 ,
+  0.0880463, 0.0952325, 0.064322, -0.0224025, -0.0718566 ,
+  -0.122052, -0.104625, 0.088844, 0.0213181, -0.00914904 ,
+  -0.139819, 0.0206462, -0.00202082, -0.0242757, -0.0205778 ,
+  0.0462255, 0.0522061, -0.0217426, -0.0846706, 0.0888732 ,
+  0.0835503, 0.0652306, -0.0235534, -0.0172334, -0.00277483 ,
+  0.00150936, -0.00877738, -0.0444865, -0.111987, -0.138896 ,
+  0.0219605, 0.016342, 0.031852, 0.0337835, -0.0147081 ,
+  -0.0381873, -0.0598413, -0.079579, 0.104383, 0.0942897 ,
+  -0.0302849, 0.00665801, 0.127664, -0.0467457, -0.0153641 ,
+  -0.0443721, -0.0617561, -0.0723298, -0.062182, -0.0952357 ,
+  -0.0191426, -0.0326638, 0.0119874, 0.0735538, 0.00987799 ,
+  -0.0169503, -0.0333773, -0.0889741, 0.0159132, 0.101053 ,
+  0.00518823, 0.0122941, 0.0883399, 0.0775766, 0.0754684 ,
+  -0.0129463, -0.0111309, -0.0666994, -0.145152, 0.0609637 ,
+  0.0149505, 0.00288834, -0.0322146, 0.0846859, 0.13334 ,
+  -0.0215246, -0.0375458, -0.0597056, 0.00844475, 0.0115602 ,
+  9.18713e-05, -0.0126033, -0.0326302, -0.0306023, -0.0746021 ,
+  -0.0312898, -0.0592624, 0.00344474, 0.0179648, -0.0752463 ,
+  -0.0318479, -0.00145497, 0.083032, -0.0201982, 0.0946814 ,
+  0.00498007, 0.00582578, -0.0321795, -0.0603405, -0.00580713 ,
+  0.12181, 0.132346, 0.0848409, 0.0246252, 0.00535887 ,
+  -0.0199198, 0.0159214, 0.039223, -0.110065, 0.0228657 ,
+  0.0233148, -0.00312667, -0.0346861, 0.0428938, -0.0297953 ,
+  -0.0776093, -0.0704185, 0.00185731, 0.0141093, 0.0804856 ,
+  -0.000235904, 0.0026389, 0.0897934, -0.0118589, -0.121998 ,
+  -0.00723547, -0.0233072, -0.00330989, -0.0212308, -0.161398 ,
+  -0.0255158, -0.00454821, 0.177098, 0.0649557, -0.0187818 ,
+  -0.000390172, 0.0073975, -0.0207349, -0.0306636, 0.153513 ,
+  0.0622679, 0.0715318, 0.0267595, 0.0174141, 0.0988135 ,
+  -0.0406207, -0.0545689, -0.109045, -0.0656236, -0.000884104 ,
+  0.0401535, 0.0175747, -0.0502592, 0.0211702, 0.0547423 ,
+  -0.082678, -0.105789, -0.0440659, -0.00441166, -0.0287188 ,
+  0.0603695, 0.0577467, 0.0152909, -0.0769367, -0.128555 ,
+  -0.0754509, -0.0693817, 0.0606266, -0.0538219, -0.0784887 ,
+  -0.0897885, 0.0690449, 0.0776909, 0.0436813, 0.0471098 ,
+  0.0641614, 0.0939191, 0.044401, -0.0661894, 0.026984 ,
+  0.0781983, 0.0616256, 0.0338938, 0.0532354, -0.00592076 ,
+  0.0497276, 0.0509346, -0.0250973, -0.118397, -0.0324086 ,
+  0.0208215, 0.00715322, 0.0606004, 0.117552, -0.0108358 ,
+  -0.0513235, -0.0807871, -0.125875, 0.026021, 0.0309376 ,
+  -0.0501016, 0.106063, 0.0596738, -0.0209521, -0.0453132 ,
+  -0.0169995, -0.0215964, -0.0666571, -0.139192, -0.0406381 ,
+  -0.0658071, -0.0683402, 0.106692, 0.0973516, 0.0563357 ,
+  -0.043158, -0.0531559, -0.0982735, -0.0747131, 0.111161 ,
+  0.0650995, 0.0828947, 0.111352, 0.0934352, 0.0506575 ,
+  0.0223406, -0.000525354, -0.0962768, -0.0605878, 0.0503502 ,
+  -0.00846221, -0.0282482, 0.00914371, 0.152428, 0.0721601 ,
+  0.0327924, -0.000156104, -0.09595, -0.0237955, -0.044508 ,
+  0.050491, 0.0264203, 0.00393974, 0.00315918, -0.0846835 ,
+  -0.0323181, -0.0228242, 0.0194378, -0.0151592, -0.00841336 ,
+  0.0146836, 0.0345354, 0.0225321, -0.0119043, 0.039804 ,
+  -0.0237711, -0.0113373, -0.0256323, -0.0493186, 0.0671639 ,
+  0.0294226, 0.0784092, 0.0958702, 0.0138153, 0.0158757 ,
+  0.025846, 0.0385042, 0.038218, -0.037266, -0.0432286 ,
+  -0.00383273, -0.0165184, 0.00472654, 0.099767, -0.0999449    
+};
+
+
+float cdbk_nb_low2[]={     -0.00553417, 0.051551, -0.0206, -0.0236118, 0.00363419 ,
+  0.0258439, 0.0162547, -0.00375006, -0.0363438, 0.0247921 ,
+  0.0165057, -0.0352534, -0.0125269, 0.0304936, 0.00262701 ,
+  -0.00583667, 0.0263556, 0.0151064, -0.00997957, 0.0298423 ,
+  0.0274432, 0.0254502, -0.00985422, -0.00954423, -0.0395286 ,
+  0.0154365, -0.00681299, 0.0145233, 0.0130981, 0.039625 ,
+  -0.00890096, 0.000264599, -0.00434403, 0.0488133, -0.0059634 ,
+  -0.00637707, 0.0140688, 0.0369816, 0.0214196, 0.000111946 ,
+  -0.0464447, 0.00175744, 0.000897567, -0.0127923, -0.0185842 ,
+  0.0309533, -0.00269354, -0.0585772, 0.0105241, -0.0168645 ,
+  -0.000884906, -0.0234174, -0.0328042, -0.00053199, 0.0338048 ,
+  -0.00465172, -0.0262954, 0.0275862, 0.0429352, 0.0123076 ,
+  0.0244735, 0.014398, 0.0412805, -0.0109519, 0.0150057 ,
+  0.0494515, 0.0339368, -0.0349237, 0.0194881, 0.00777093 ,
+  -0.00404876, -0.0119337, -0.0279294, 0.0183178, -0.0456247 ,
+  0.0482093, -0.0149973, -0.00360052, 0.0156161, -0.0279961 ,
+  -0.0381402, 0.0139395, -0.0294856, 0.00431026, 0.0240724 ,
+  -0.00887403, -0.00463013, -0.0502563, -0.0141036, -0.00253083 ,
+  -0.0394498, -0.0310626, 0.0373318, 0.00491526, -0.00850795 ,
+  -0.00735437, -0.00406555, -0.00145146, -0.0218061, 0.0688501 ,
+  -0.00338479, 0.0136075, 0.0258571, -0.0171041, -0.021574 ,
+  0.0236386, -0.0400467, -0.024559, -0.0234444, 0.00552196 ,
+  0.0223936, 0.0183723, -0.0100089, 0.0383622, -0.0258619 ,
+  -0.0267077, 0.0630433, 0.0439962, 0.0018735, -0.00721039 ,
+  -0.0251396, -0.00789336, 0.021444, -0.0117388, 0.0159689 ,
+  0.0146708, 0.0159553, -0.0340823, -0.00494922, 0.0326371 ,
+  -0.0207368, -0.007705, -0.000472901, 0.0221478, 0.0319243 ,
+  0.0330039, 0.00624302, 0.0208645, 0.0354114, 0.00574869 ,
+  -0.00667464, -0.021198, 0.00823423, -0.0363503, -0.013873 ,
+  0.030341, 0.0366775, 0.0106626, -0.00378801, -0.00246903 ,
+  -0.0378636, -0.0316933, -0.00801628, 0.031722, -0.022742 ,
+  -0.00614319, -0.0119342, 0.015641, 0.0194738, -0.0269902 ,
+  -0.00425604, 0.0226167, 0.0130164, -0.0507161, -0.000816131 ,
+  0.0219625, 0.00631556, -0.0318796, -0.0389182, -0.00625858 ,
+  0.00351259, -0.0608217, 0.0126861, 0.00446846, -0.0252368 ,
+  0.0341673, 0.0381394, 0.0110244, 0.00199993, 0.0556177 ,
+  -0.0107369, 0.00904716, -0.0190746, -0.0272831, -0.0325124 ,
+  0.0508565, -0.0045395, -0.00621427, -0.00184118, 0.0212109 ,
+  -0.0140032, -0.0159059, -0.0469765, 0.0339782, 0.00117445 ,
+  -0.0568115, 0.0191909, 0.0128089, 0.0323505, -0.0007419 ,
+  -0.0721642, 0.0549319, -0.0174275, -0.021641, -0.0301466 ,
+  0.011882, 0.0055706, -0.0136104, 0.0036586, -0.0017436 ,
+  -0.00875541, -0.0459846, 0.0100172, -0.00318508, 0.0279886 ,
+  -0.0167395, -0.00439621, 0.0599351, 0.0139864, 0.0456879 ,
+  -0.0116237, 0.0015521, 0.0698578, -0.0380055, -0.0163906 ,
+  0.0902863, 0.062899, -0.0522311, -0.050024, -0.0151131 ,
+  -0.0296949, -0.0373982, -0.0402556, -0.028698, -0.0273534 ,
+  0.0259646, 0.00888874, 0.0353482, 0.00917048, -0.0346128 ,
+  -0.0409628, 0.0790229, -0.0202591, 0.0196149, 0.0242309 ,
+  -0.0158649, -0.00483786, -0.0163035, -0.0341089, 0.020219 ,
+  0.0145009, -0.0272164, 0.0470234, 0.00160258, -0.00223571 ,
+  0.00891682, -0.0182521, 0.0281905, -0.0390396, 0.028879 ,
+  -0.0179987, -0.0171056, 0.0176083, -0.0155917, -0.0560607 ,
+  0.0149986, -0.0194534, -0.0119414, -0.015046, -0.0359571 ,
+  -0.0147374, 0.0323392, -0.0385576, 0.0201228, -0.0219236 ,
+  -0.0131108, 0.0339223, 0.0104308, 0.0126651, -0.0369895 ,
+  -0.0616962, 0.0284283, 0.0220792, -0.026152, 0.0316787 ,
+  0.0176728, 0.00296456, -0.0251621, 0.0408358, 0.031802 ,
+  -0.0624609, -0.0643229, -0.0169164, 0.0159737, 0.0551334 ,
+  0.00227561, 0.0350103, 0.00340551, 0.0302082, 0.0207096 ,
+  -0.0398203, -0.0384344, 0.00764509, -0.0556771, 0.0140278 ,
+  0.0358373, -0.00199262, 0.0185304, -0.0353151, -0.018159 ,
+  -0.0220537, -0.0284294, -0.0157719, 0.00109848, -0.00257404 ,
+  -0.00733046, -0.0101345, 0.030504, 0.0629051, -0.0637191    
+};
+
+
+float cdbk_nb_high1[]={     -0.0514632, -0.0149474, 0.0567285, 0.0407909, 0.00804444 ,
+  0.0374946, -0.0769294, 0.0636051, -0.01463, -0.0709558 ,
+  0.108931, 0.106076, 0.0929974, 0.0790108, 0.0568998 ,
+  -0.00688702, -0.046929, -0.0819052, -0.129691, -0.0840913 ,
+  -0.116433, 0.0373375, -0.00351471, 0.0714152, 0.0802774 ,
+  -0.0191122, -0.0714742, -0.116297, -0.125167, 0.0343212 ,
+  -0.0432517, 0.149973, 0.142551, 0.0781639, 0.0482722 ,
+  0.00864491, 0.0365118, -0.0375072, -0.128788, -0.00321888 ,
+  0.0218819, 0.00917262, 0.0408439, 0.0274798, 0.0500807 ,
+  -0.0496658, -0.1675, -0.0069665, 0.0350367, 0.00208764 ,
+  0.0509967, -0.0719502, 0.0197218, 0.0731945, -0.00176543 ,
+  0.0464488, -0.0237592, -0.114873, -0.0205777, 0.0396074 ,
+  -0.0120158, 0.0671637, -0.0308286, -0.0311967, 0.08237 ,
+  0.0366128, -0.0546398, -0.100573, 0.104394, 0.0626587 ,
+  0.00739884, 0.019887, 0.121718, 0.0407406, -0.0236939 ,
+  -0.0657593, 0.0518818, 0.00855842, -0.0929197, -0.0943174 ,
+  -0.0982508, -0.0950299, 0.0607593, -0.0136917, -0.0410818 ,
+  -0.0826128, -0.0482003, -0.00726314, -0.0843069, -0.0431272 ,
+  0.115375, 0.00302776, 0.0522988, 0.024396, -0.0179167 ,
+  -0.0118116, -0.0320664, -0.0161883, -0.0625738, -0.112483 ,
+  -0.0318402, -0.0564005, -0.00952645, 0.0798927, 0.0440974 ,
+  -0.0591082, -0.0653166, -0.0895089, -0.0245719, -0.0195083 ,
+  -0.0735116, 0.10198, 0.100863, 0.00183414, -0.0337223 ,
+  -0.0181129, 0.0195384, 0.0510139, -0.0493603, -0.0110726 ,
+  0.0637268, -0.0390636, 0.103909, 0.107868, 0.0488991 ,
+  -0.0632583, -0.00991787, -0.0825218, 0.0450102, 0.0407687 ,
+  0.129521, 0.00945617, -0.0554423, 0.038553, 0.0182096 ,
+  0.146605, 0.057274, -0.0130397, -0.0815098, -0.076859 ,
+  0.0295986, 0.00524244, -0.0456347, 0.0414466, 0.0122503 ,
+  0.0205365, 0.00124128, -0.0561717, 0.0267084, 0.122171 ,
+  0.018961, 0.106064, 0.050566, -0.0468927, -0.0994168 ,
+  -0.0956199, 0.014591, -0.0454897, -0.0988353, 0.0290255 ,
+  -0.129542, 0.00182508, 0.116327, 0.0495164, 0.0188288 ,
+  5.76836e-05, -0.0588056, -0.00790935, -0.0286409, 0.033912 ,
+  0.03673, 0.114875, 0.0775452, 0.00775305, -0.00912589 ,
+  0.0637986, 0.0125472, -0.0438922, -0.113595, -0.136739 ,
+  -0.0104411, 0.0449807, -0.0118554, 0.117396, 0.0860067 ,
+  -0.0564834, -0.0314148, -0.0919665, -0.0557033, 0.101813 ,
+  -0.036728, 0.0986246, 0.0553852, 0.0312889, 0.0675714 ,
+  0.0611349, 0.070091, -0.000445569, -0.0415652, 0.0108021 ,
+  0.0401143, 0.052035, 0.0437807, 0.0818356, 0.0136719 ,
+  -0.128526, -0.078133, -0.0158878, 0.0146359, 0.036366 ,
+  0.0905963, -0.00022972, -0.00868102, 0.116366, 0.0706039 ,
+  0.0879287, -0.0131352, -0.0567071, -0.0110493, -0.0625303 ,
+  -0.0753564, 0.00361523, 0.0116234, -0.017862, 0.0652315 ,
+  0.0381553, -0.100041, -0.065865, 0.0353102, -0.0126853 ,
+  0.037603, 0.0112572, 0.0208825, 0.0100104, -0.0363122 ,
+  -0.0560478, -0.00458696, 0.0827052, -0.0213077, -0.0877915 ,
+  -0.0408236, -0.107874, 0.110818, 0.0716945, 0.0047753 ,
+  -0.0273641, -0.131826, -0.0307261, -0.051942, -0.0734081 ,
+  0.134498, 0.0944139, 0.0365214, 0.00395949, -0.034129 ,
+  0.0391766, -0.0381358, -0.0308189, -0.0663438, -0.0335281 ,
+  -0.0485652, -0.119194, 0.0204136, 0.141991, 0.0877492 ,
+  0.0313724, -0.0790709, -0.125472, -0.0323092, -0.0567239 ,
+  -0.0434374, 0.109476, 0.0339618, -0.0758288, 0.0156046 ,
+  -0.0213135, 0.0165884, -0.0479112, -0.035771, -0.0260249 ,
+  -0.0374654, 0.0158105, 0.105759, 0.111292, 0.0707682 ,
+  -0.0335704, -0.0498432, -0.00841032, 0.011728, -0.0400605 ,
+  0.078344, 0.0814653, -0.00775459, 0.038916, 0.0614271 ,
+  0.103764, 0.0187912, -0.0668583, -0.103635, 0.0613721 ,
+  -0.0331981, 0.0682425, 0.000967936, 0.0289237, -0.0115247 ,
+  -0.0384158, -0.123288, -0.14305, 0.0421315, 0.049136 ,
+  0.0557817, 0.0330269, 0.0161556, -0.0557267, -0.0754571 ,
+  -0.134596, 0.0355043, 0.0294491, -0.0297548, -0.0102754    
+};
+
+
+float cdbk_nb_high2[]={     0.0111702, 0.0457024, 0.0154358, -0.00832608, -0.0444777 ,
+  -0.0308269, 0.0256853, -0.062012, 0.033007, -0.00459552 ,
+  0.0375619, -0.00683076, 0.0455989, 0.0190509, 0.00147197 ,
+  -0.0713018, -0.0967067, -0.00269214, -0.0438367, 0.0197952 ,
+  0.0686924, -0.0505969, 0.0141609, -0.00542073, -0.00647079 ,
+  -0.0797842, 0.0303315, 0.020797, 0.0457188, 0.0502447 ,
+  0.0379932, -0.00289734, 0.00916184, 7.824e-05, -0.0401547 ,
+  -0.00663197, -0.014259, -0.05304, 0.00164523, -0.000302136 ,
+  0.0261437, -0.0305321, 0.00870998, -0.043686, -0.0217671 ,
+  -0.0367651, -0.0235639, -0.023853, 0.0074253, -0.0327088 ,
+  0.0224611, 0.00441881, 0.049065, -0.0349505, -0.0166166 ,
+  -0.0175955, -0.0497184, -0.00159429, 0.0127071, 0.0186188 ,
+  0.0421135, 0.0112857, -0.0151329, -0.0115667, 0.0593189 ,
+  0.0373968, 0.0370836, 0.00712526, 0.0129038, -0.000411518 ,
+  0.00561365, -0.00138152, 0.00277187, 0.0610071, 0.00857801 ,
+  0.0267474, 0.021476, -0.0326073, 0.0370953, -0.03464 ,
+  -0.00913278, 0.0292081, -0.0420155, -0.00836348, -0.0314839 ,
+  -0.000938885, 0.00416228, -0.00404124, 0.000910572, -0.0051524 ,
+  -0.0104142, -0.00808596, 0.0375118, 0.0304658, 0.0106932 ,
+  -0.0102391, -0.0406037, -0.0202769, -0.035942, 0.00105143 ,
+  0.0415115, 0.0149999, -0.012536, -0.0346291, -0.0186308 ,
+  -0.0178844, 0.0148517, 0.0220885, -0.0254783, 0.0580693 ,
+  0.00107311, -0.0209262, 0.0516524, 0.00789469, -0.040038 ,
+  -0.0487962, -0.0141184, -0.0275737, 0.00378801, 0.0209105 ,
+  0.0248704, -0.0277798, -0.0390184, 0.00528142, -0.0386159 ,
+  -0.0402828, 0.0037014, 0.0493212, -0.0321917, -0.00786431 ,
+  -0.00794263, 0.00121461, 0.0165288, -0.0584242, 0.0113561 ,
+  0.0246673, -0.0398795, 0.0168772, 0.0335133, 0.0417614 ,
+  0.0188213, 0.0441653, 0.0071928, -0.0360922, 0.0230144 ,
+  -0.0145525, 0.0547813, -0.00242151, 0.034053, -0.00956897 ,
+  0.0464904, 0.00412051, -0.0457123, -0.00186604, 0.00507841 ,
+  -0.005357, -0.0530386, 0.00481644, -0.00341195, -0.0325387 ,
+  -0.010087, 0.0297755, -0.00160409, -0.0428472, -0.0237488 ,
+  -0.0369163, 0.00877759, -0.0088037, 0.0411541, 0.00374025 ,
+  0.00551308, -0.0546508, 0.0430117, -0.015268, 0.00861582 ,
+  -0.038905, -0.0252308, 0.0178888, -0.0194219, 0.0102434 ,
+  0.0276825, -0.039738, -0.0209166, -0.00359507, 0.0126482 ,
+  -0.0180423, 0.0316965, -0.0289268, -0.003131, 0.0359975 ,
+  0.0147477, 0.0210486, 0.0277366, 0.048864, -0.0390901 ,
+  0.00334605, -0.0287453, -0.0621972, 0.00722314, 0.0496931 ,
+  -0.0188014, -0.0108535, 0.0162467, -0.0261308, -0.039174 ,
+  -0.0627715, 0.0236443, -0.0114683, -0.00701279, -0.0263067 ,
+  0.00295387, 0.0364453, 0.0464697, -0.00111337, 0.00211881 ,
+  -0.00883851, -0.0370306, -0.0330139, 0.0447865, 0.00101962 ,
+  0.02649, -0.00574201, 0.018793, -0.0124134, 0.0257427 ,
+  0.00934304, 0.0331119, 0.019222, 0.0247408, 0.0393881 ,
+  0.0487185, -0.0062744, -0.00637552, 0.0289155, 0.00843959 ,
+  -0.0230267, 0.000116788, -0.0220273, 0.0693036, -0.059517 ,
+  0.0214401, 0.0568095, -0.0335535, -0.00410495, 0.00190329 ,
+  -0.0481655, -0.0319722, 0.0247623, 0.0288602, -0.00782512 ,
+  -0.0061042, -0.0153888, 0.0748594, 0.00159915, 0.0374199 ,
+  -0.00765444, -0.0342589, -0.00555328, -0.0295472, 0.0546254 ,
+  0.076028, 0.0298688, 0.0325117, -0.0195416, 0.0123627 ,
+  -0.0378534, 0.0194714, 0.0216102, 0.00416067, 0.0203319 ,
+  -0.00772793, 0.00415324, -0.00626552, 0.00956295, -0.0812301 ,
+  -0.0405194, 0.00857382, -0.0241562, -0.0418562, 0.0144944 ,
+  -0.00674151, -0.0114772, -0.0328757, -0.0382963, -0.0362973 ,
+  -0.0317651, 0.0182464, 0.0289085, 0.0152755, -0.0322027 ,
+  0.0414898, -0.0240614, 0.0246489, -0.0665802, 0.0430969 ,
+  -0.0147647, -0.0106911, -0.00351295, 0.0223647, 0.0483556 ,
+  0.0138326, 0.00434786, -0.0378286, -0.0416217, 0.0193109 ,
+  -0.0292459, 0.0584988, 0.00844317, -0.0195525, 0.00644965 ,
+  0.0159521, 0.018142, -0.0318083, 0.036259, 0.0286272 ,
+  0.0160133, -0.0343231, 0.0070628, 0.0368015, -0.0263024    
+};
+
+
index 3fb7340..764c183 100644 (file)
@@ -129,7 +129,7 @@ int three_tap_ltp(float *x, int len, int start, int end, float *gain)
    gain[0]=best_corr[2];gain[1]=best_corr[1];gain[2]=best_corr[0];
    
    /* Check that 3-tap predictor "makes sense" */
-   if (!((abs(gain[0]) + abs(gain[1]) + abs(gain[2])<2) 
+   /*if (!((abs(gain[0]) + abs(gain[1]) + abs(gain[2])<2) 
          && abs(gain[0]+gain[1]+gain[2]) < 1.2 
          && abs(gain[0]+gain[1]+gain[2]) > -.2 ))
    {
@@ -140,10 +140,109 @@ int three_tap_ltp(float *x, int len, int start, int end, float *gain)
          gain[1]=-.2;
       else 
          gain[1]=best_gain;
+         }*/
+   return best_period-2;
+}
+
+
+/** Finds the best 3-tap pitch predictor from a codebook*/
+int ltp_closed_loop(float *x, int len, int start, int end, float *gain)
+
+   /*  x:     time-domain signal (note, x[-end] must be valid)
+       len:   length of the x signal
+       start: smallest pitch period possible
+       end:   largest pitch period possible
+       gain:  return value for the pitch predictor gain
+    */
+{
+   int i, period, best_period=0;
+   float total, score[3]={0,0,0}, best_score=-1, corr[3]={0,0,0}, energy[3]={0,0,0};
+   float best_energy[3], best_corr[3], best_gain=0;
+   float A[3][3];
+   /*Check all periods */
+   for (period = start; period <= end; period++)
+   {
+      corr[0]=energy[0]=0;
+      for (i=0;i<len;i++)
+      {
+         corr[0] += x[i]*x[i-period];
+         energy[0] += x[i-period]*x[i-period];
+      }
+      score[0] = corr[0]*corr[0]/(energy[0]+1);
+      /* Smooth the "correlation score" */
+      total = score[0]+2*score[1]+score[2];
+      if (total > best_score && period >= start+3 && period <= end-3)
+      {
+         best_score=total;
+         best_period=period;
+         for (i=0;i<3;i++)
+         {
+            best_corr[i]=corr[i];
+            best_energy[i]=energy[i];
+         }
+         best_gain = corr[1]/(energy[1]+1);
+      }
+      score[2]=score[1];
+      score[1]=score[0];
+      corr[2]=corr[1];
+      corr[1]=corr[0];
+      energy[2]=energy[1];
+      energy[1]=energy[0];
+   }
+   /* build the correlation matrix */
+   A[0][0]=best_energy[0]+1;
+   A[1][1]=best_energy[1]+1;
+   A[2][2]=best_energy[2]+1;
+   A[0][1]=0;
+   A[0][2]=0;
+   for (i=0;i<len;i++)
+   {
+      A[0][1] += x[i-best_period+1]*x[i-best_period];
+      A[0][2] += x[i-best_period+2]*x[i-best_period];
+   }
+   A[1][0]=A[0][1];
+   A[2][0]=A[0][2];
+   A[1][2]=A[0][1] - x[-best_period+1]*x[-best_period] 
+                   + x[len-best_period]*x[len-best_period+1];
+   A[2][1]=A[1][2];
+
+   {
+      int j;
+      float C[9];
+      float *ptr=gain_cdbk_nb;
+      int best_cdbk=0;
+      float best_sum=0;
+      C[0]=best_corr[2];
+      C[1]=best_corr[1];
+      C[2]=best_corr[0];
+      C[3]=A[1][2];
+      C[4]=A[0][1];
+      C[5]=A[0][2];
+      C[6]=A[2][2];
+      C[7]=A[1][1];
+      C[8]=A[0][0];
+      
+      for (i=0;i<127;i++)
+      {
+         float sum=0;
+         ptr = gain_cdbk_nb+12*i;
+         for (j=0;j<9;j++)
+            sum+=C[j]*ptr[j+3];
+         if (sum>best_sum || i==0)
+         {
+            best_sum=sum;
+            best_cdbk=i;
+         }
+      }
+      gain[0] = gain_cdbk_nb[best_cdbk*12];
+      gain[1] = gain_cdbk_nb[best_cdbk*12+1];
+      gain[2] = gain_cdbk_nb[best_cdbk*12+2];
    }
    return best_period-2;
 }
 
+
+
 /** In place 3-tap pitch predictor (FIR)*/
 void predictor_three_tap(float *x, int len, int period, float *gain)
 {
index b633ac7..2844881 100644 (file)
@@ -4,6 +4,8 @@
 */
 
 
+extern float gain_cdbk_nb[];
+
 /** Computes the open-loop pitch prediction. Returns pitch period and pitch gain */
 int open_loop_ltp(float *x, int len, int start, int end, float *gain);
 
@@ -11,6 +13,8 @@ int open_loop_ltp(float *x, int len, int start, int end, float *gain);
 /** Computes a 3-tap pitch predictor */
 int three_tap_ltp(float *x, int len, int start, int end, float *gain);
 
+/** Finds the best 3-tap pitch predictor from a codebook*/
+int ltp_closed_loop(float *x, int len, int start, int end, float *gain);
 
 /** In place 3-tap pitch predictor (FIR)*/
 void predictor_three_tap(float *x, int len, int period, float *gain);
diff --git a/libspeex/quant_lsp.c b/libspeex/quant_lsp.c
new file mode 100644 (file)
index 0000000..9a60eca
--- /dev/null
@@ -0,0 +1,129 @@
+/* Copyright (C) 2002 Jean-Marc Valin 
+   File: quant_lsp.c
+   LSP vector quantization
+*/
+
+#include "quant_lsp.h"
+#include <math.h>
+#include <stdio.h>
+
+static float quant_weight[MAX_LSP_SIZE];
+
+int lsp_quant(float *x, float *cdbk, int nbVec, int nbDim)
+{
+   int i,j;
+   float dist, tmp;
+   float best_dist=0;
+   int best_id=0;
+   float *ptr=cdbk;
+   for (i=0;i<nbVec;i++)
+   {
+      dist=0;
+      for (j=0;j<nbDim;j++)
+      {
+         tmp=(x[j]-*ptr++);
+         dist+=tmp*tmp;
+      }
+      if (dist<best_dist || i==0)
+      {
+         best_dist=dist;
+         best_id=i;
+      }
+   }
+
+   for (j=0;j<nbDim;j++)
+      x[j] -= cdbk[best_id*nbDim+j];
+    
+   return best_id;
+}
+
+int lsp_weight_quant(float *x, float *weight, float *cdbk, int nbVec, int nbDim)
+{
+   int i,j;
+   float dist, tmp;
+   float best_dist=0;
+   int best_id=0;
+   float *ptr=cdbk;
+   for (i=0;i<nbVec;i++)
+   {
+      dist=0;
+      for (j=0;j<nbDim;j++)
+      {
+         tmp=(x[j]-*ptr++);
+         dist+=weight[j]*tmp*tmp;
+      }
+      if (dist<best_dist || i==0)
+      {
+         best_dist=dist;
+         best_id=i;
+      }
+   }
+   
+   for (j=0;j<nbDim;j++)
+      x[j] -= cdbk[best_id*nbDim+j];
+   return best_id;
+}
+
+
+unsigned int lsp_quant_nb(float *lsp, int order)
+{
+   int i;
+   float tmp1, tmp2;
+   unsigned int id;
+   quant_weight[0] = 1/(lsp[1]-lsp[0]);
+   quant_weight[order-1] = 1/(lsp[order-1]-lsp[order-2]);
+   for (i=1;i<order-1;i++)
+   {
+      tmp1 = 1/(lsp[i]-lsp[i-1]);
+      tmp2 = 1/(lsp[i+1]-lsp[i]);
+      quant_weight[i] = tmp1 > tmp2 ? tmp1 : tmp2;
+   }
+   id = lsp_quant(lsp, cdbk_nb, NB_CDBK_SIZE, order);
+   
+   id *= NB_CDBK_SIZE_LOW1;
+   id += lsp_weight_quant(lsp, quant_weight, cdbk_nb_low1, NB_CDBK_SIZE_LOW1, 5);
+   
+   id *= NB_CDBK_SIZE_LOW2;
+   id += lsp_weight_quant(lsp, quant_weight, cdbk_nb_low2, NB_CDBK_SIZE_LOW2, 5);
+   
+   id *= NB_CDBK_SIZE_HIGH1;
+   id += lsp_weight_quant(lsp+5, quant_weight+5, cdbk_nb_high1, NB_CDBK_SIZE_HIGH1, 5);
+   
+   id *= NB_CDBK_SIZE_HIGH2;
+   id += lsp_weight_quant(lsp+5, quant_weight+5, cdbk_nb_high2, NB_CDBK_SIZE_HIGH2, 5);
+   
+   return id;
+}
+
+void lsp_unquant_nb(float *lsp, int order, unsigned int id)
+{
+   int i, tmp;
+   for (i=0;i<order;i++)
+      lsp[i]=0;
+
+
+   tmp = id % NB_CDBK_SIZE_HIGH2;
+   for (i=0;i<5;i++)
+      lsp[i+5] += cdbk_nb_high2[tmp*5+i];
+   id /= NB_CDBK_SIZE_HIGH2;
+   
+   tmp = id % NB_CDBK_SIZE_HIGH1;
+   for (i=0;i<5;i++)
+      lsp[i+5] += cdbk_nb_high1[tmp*5+i];
+   id /= NB_CDBK_SIZE_HIGH1;
+   
+   tmp = id % NB_CDBK_SIZE_LOW2;
+   for (i=0;i<5;i++)
+      lsp[i] += cdbk_nb_low2[tmp*5+i];
+   id /= NB_CDBK_SIZE_LOW2;
+
+   tmp = id % NB_CDBK_SIZE_LOW1;
+   for (i=0;i<5;i++)
+      lsp[i] += cdbk_nb_low1[tmp*5+i];
+   id /= NB_CDBK_SIZE_LOW1;
+
+   tmp=id;
+   for (i=0;i<10;i++)
+      lsp[i] += cdbk_nb[tmp*10+i];
+   
+}
diff --git a/libspeex/quant_lsp.h b/libspeex/quant_lsp.h
new file mode 100644 (file)
index 0000000..cc6e146
--- /dev/null
@@ -0,0 +1,27 @@
+/* Copyright (C) 2002 Jean-Marc Valin 
+   File: quant_lsp.h
+   LSP vector quantization
+*/
+
+#ifndef QUANT_LSP_H
+#define QUANT_LSP_H
+
+#define MAX_LSP_SIZE 20
+
+#define NB_CDBK_SIZE 64
+#define NB_CDBK_SIZE_LOW1 64
+#define NB_CDBK_SIZE_LOW2 64
+#define NB_CDBK_SIZE_HIGH1 64
+#define NB_CDBK_SIZE_HIGH2 64
+
+extern float cdbk_nb[];
+extern float cdbk_nb_low1[];
+extern float cdbk_nb_low2[];
+extern float cdbk_nb_high1[];
+extern float cdbk_nb_high2[];
+
+
+unsigned int lsp_quant_nb(float *lsp, int order);
+void lsp_unquant_nb(float *lsp, int order, unsigned int id);
+
+#endif
index ef91ac5..7b7019e 100644 (file)
@@ -1,3 +1,7 @@
+/* Copyright (C) 2002 Jean-Marc Valin 
+   File: speex.c
+*/
+
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
@@ -6,6 +10,7 @@
 #include "lpc.h"
 #include "lsp.h"
 #include "ltp.h"
+#include "quant_lsp.h"
 
 #ifndef M_PI
 #define M_PI           3.14159265358979323846  /* pi */
@@ -110,15 +115,26 @@ void encode(EncState *st, float *in, int *outSize, void *bits)
    }
    for (i=0;i<st->lpcSize;i++)
       st->lsp[i] = acos(st->lsp[i]);
+
    /*for (i=0;i<roots;i++)
       printf("%f ", st->lsp[i]);
-      printf ("\n\n");*/
+      printf ("\n");*/
+   
+   /* LSP Quantization */
+   {
+      unsigned int id;
+      id=lsp_quant_nb(st->lsp,10 );
+      lsp_unquant_nb(st->lsp,10,id);
+   }
 
-   /* Quantize LSPs */
+   /*for (i=0;i<roots;i++)
+      printf("%f ", st->lsp[i]);
+      printf ("\n");*/
 
+#if 1
    for (sub=0;sub<st->nbSubframes;sub++)
    {
-      float tmp, gain[3];
+      float tmp, tmp1,tmp2,gain[3];
       int pitch, offset;
 
       offset = st->subframeSize*sub;
@@ -157,24 +173,28 @@ void encode(EncState *st, float *in, int *outSize, void *bits)
       }
 
       /* Find pitch gain and delay */
-      pitch = three_tap_ltp(st->wframe+offset, st->subframeSize, 20, 120, gain);
+      pitch = ltp_closed_loop(st->wframe+offset, st->subframeSize, 20, 120, gain);
+      /*pitch = three_tap_ltp(st->wframe+offset, st->subframeSize, 20, 120, gain);*/
       /*pitch = open_loop_ltp(st->wframe+offset, st->subframeSize, 20, 120, gain);*/
       
       /* Quantization of pitch period and gains */
 
       /*printf ("pitch = %d, gain = %f\n",pitch,gain);*/
       printf ("pitch = %d, gain = %f %f %f\n",pitch,gain[0], gain[1], gain[2]);
-
-      tmp=0;
+      /*printf ("%f %f %f ",gain[0], gain[1], gain[2]);*/
+      
+      tmp1=0;
       for (i=0;i<st->subframeSize;i++)
-         tmp+=st->wframe[offset+i]*st->wframe[offset+i];
-      printf ("before: %f ", tmp);
+         tmp1+=st->wframe[offset+i]*st->wframe[offset+i];
+      /*printf ("before: %f ", tmp1);*/
       predictor_three_tap(st->wframe+offset, st->subframeSize, pitch, gain);
-      tmp=0;
+      
+      tmp2=0;
       for (i=0;i<st->subframeSize;i++)
-         tmp+=st->wframe[offset+i]*st->wframe[offset+i];
-      printf ("after: %f\n", tmp);
-
+         tmp2+=st->wframe[offset+i]*st->wframe[offset+i];
+      /*printf ("after: %f\n", tmp2);*/
+      printf ("pitch gain: %f\n", tmp1/(tmp2+.001));
+      
       /*Analysis by synthesis and quantization here*/
 
       inverse_three_tap(st->wframe+offset, st->subframeSize, pitch, gain);
@@ -188,7 +208,7 @@ void encode(EncState *st, float *in, int *outSize, void *bits)
       }
 
    }
-
+#endif
    printf ("\n");
    for (i=0;i<st->lpcSize;i++)
       st->old_lsp[i] = st->lsp[i];
index 59bbf82..c07c85f 100644 (file)
@@ -1,3 +1,7 @@
+/* Copyright (C) 2002 Jean-Marc Valin 
+   File: speex.h
+*/
+
 #ifndef SPEEX_H
 #define SPEEX_H