Wideband quantization improved by adding a sub-frame gain, codebook
authorjmvalin <jmvalin@0101bb08-14d6-0310-b084-bc0e0c8e3800>
Thu, 16 May 2002 19:16:33 +0000 (19:16 +0000)
committerjmvalin <jmvalin@0101bb08-14d6-0310-b084-bc0e0c8e3800>
Thu, 16 May 2002 19:16:33 +0000 (19:16 +0000)
re-trained.

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

README
libspeex/hexc_table.c
libspeex/ltp.c
libspeex/nb_celp.c
libspeex/sb_celp.c

diff --git a/README b/README
index b7578b0..73b4f2c 100644 (file)
--- a/README
+++ b/README
@@ -7,8 +7,26 @@ IP (VoIP). In some sense, it is meant to be complementary to the Ogg
 Vorbis codec.
 
 Although we aim at providing a patent-free codec, we strongly suggest you
-have a look at patent issues if you are thinking of using Speex 
-commercially. The speech coding field is a real patent mine field and
+have a look at patent issues if you are thinking about using Speex 
+commercially. The speech coding field is a real patent minefield and
 the scope and enforceability of all these patents is sometimes unclear,
 not to mention that each country has different laws.
 
+To use Speex:
+
+% speexenc [-n or -w] input_file.sw compressed_file.spx
+
+% speexdec compressed_file.spx output_file.sw
+
+where -n is for narrowband (8 kHz sampling) and -w is wideband (16 kHz 
+sampling).
+
+All audio files are assumed to be raw (no header) 16-bit PCM files. To
+convert a .wav file into this format:
+% sox my_file.wav -t sw my_file.sw
+
+Note that if the original sampling frequency of the wav is not 8 kHz or 16 kHz,
+you will need to add "-r 8000" or "-r 16000" (without the quotes).
+
+To create a .wav file:
+% sox -t sw my_file.sw my_file.wav
index 8459eea..e405384 100644 (file)
-float hexc_table[256][8]={{0.00596334,0.961802,-1.17836,-3.01893,0.498393,-1.77481,0.933678,0.707556},
-{-1.09273,0.779159,3.35175,8.96719,9.20773,-5.48121,-10.3742,-6.00719},
-{-6.63724,-0.431913,1.22604,4.36403,0.315399,-1.74806,1.18705,1.3023},
-{-0.34432,-0.291574,-0.676932,-0.693059,-0.7169,-0.664636,-0.479618,-0.499353},
-{-0.289628,-0.69633,-0.420114,-0.550872,-0.194063,0.406592,0.129426,0.638474},
-{1.55285,5.18598,-4.07314,-0.57972,1.41307,-3.34088,-1.75373,0.836238},
-{9.64848,5.49757,2.71352,-0.774738,-5.77379,-11.3207,-6.64266,8.36487},
-{5.35712,2.3447,0.611676,-3.20016,-0.573763,-0.633532,-3.71085,-0.11144},
-{1.55562,-3.0477,-0.443413,-2.66988,1.62136,1.25092,-0.598591,1.3126},
-{0.107545,-0.229729,2.97792,-0.0144502,-0.467264,-1.0848,0.459428,-1.23135},
-{-1.31507,-1.83314,-1.68476,0.838043,1.36763,1.84906,1.59447,-0.581666},
-{-1.84137,-1.61001,0.212489,-1.57008,1.15597,-0.186575,0.104659,0.534858},
-{1.3404,-2.36834,0.652265,0.144586,1.38806,0.0279121,0.0943678,-1.38542},
-{1.80025,1.93867,2.00891,0.685305,0.462605,-9.82099,-1.43226,-1.02076},
-{1.06998,0.460049,1.99375,-3.45493,-2.93745,1.12063,0.883749,0.0620846},
-{-0.421529,1.10504,-7.0891,-0.115913,3.5515,0.749357,2.06642,0.302182},
-{-4.9891,-4.97802,3.03304,-0.545989,-5.1588,1.47589,4.97565,1.61485},
-{10.6517,6.05228,7.04337,5.2549,4.60269,4.3744,1.75997,0.923521},
-{-7.65203,5.27239,-4.24031,-1.84605,2.09177,0.721852,1.14006,2.23425},
-{-0.767754,0.334586,0.809721,0.580797,-0.480078,-0.629865,-0.0528265,0.211446},
-{-0.579945,-1.66864,5.09098,-0.45305,3.4849,2.62679,-3.21053,-2.14739},
-{0.240911,12.8432,-8.82027,-1.6974,-6.1177,-8.82078,3.68925,-0.0674868},
-{1.85091,-0.942606,0.473398,-0.591,-1.94523,1.96216,-2.48735,-0.454837},
-{5.09157,-9.95944,1.32533,7.88265,1.75663,-1.93783,-1.24923,-0.293239},
-{-1.22145,-5.98452,3.7634,-0.705553,3.38743,-0.413326,-1.65825,2.90272},
-{1.2211,-1.75124,3.31627,1.23058,-3.09041,1.4764,0.354087,-0.887407},
-{2.51455,-1.35068,-1.29518,2.8944,-2.37898,1.2081,1.24154,-3.28068},
-{-0.319508,-0.252012,-0.133097,-0.305965,-0.562591,-0.759897,2.05952,0.299892},
-{-0.800117,0.0891911,0.299706,2.16995,3.36063,-0.111935,-0.646773,-3.46147},
-{3.00977,1.33377,8.45317,-3.46033,4.25616,-6.27074,-6.8382,-0.565441},
-{-1.11805,-0.977105,0.09164,6.71365,1.30803,10.4462,-9.19217,-8.67702},
-{3.54213,6.58884,-3.49584,1.99994,-8.29993,0.640732,-2.04007,-1.86263},
-{0.994519,0.128403,-1.17005,1.30192,-5.75131,-5.0784,8.31152,-2.85104},
-{-1.60038,5.54056,1.85563,6.81351,-2.48191,0.468508,-1.57252,-2.08778},
-{-0.971087,-3.78474,-3.88213,-3.01418,-4.89943,-3.35667,-1.89404,-2.25134},
-{2.18713,0.162262,-0.794402,-0.894054,0.301279,-0.367108,-0.16506,-0.325218},
-{3.54902,-1.02119,-2.61702,-0.433606,4.35146,-0.148326,-3.46654,2.14477},
-{3.56186,4.39716,-12.5599,-4.90088,1.10731,3.61826,1.3884,2.58328},
-{1.7457,0.499283,-1.11856,-3.02534,-9.0291,1.82454,2.67053,4.79438},
-{6.33564,1.3493,-2.90245,4.9839,-2.07942,-2.99799,-1.37353,0.194392},
-{0.59306,-0.667111,-1.63125,-1.94958,-0.273168,1.86502,2.00237,0.635809},
-{0.162288,0.0477809,0.397164,-0.0260089,0.0535681,-0.783583,-1.75111,-1.94167},
-{0.911535,-4.70564,-2.89805,-2.72332,8.24786,5.59401,-1.56173,-1.95495},
-{0.517353,-0.525953,-3.41303,3.64218,-0.911369,1.06019,-1.16563,1.05369},
-{-0.161767,-0.0456504,0.418959,0.160653,0.480297,-0.206741,0.636733,-1.81423},
-{-0.11519,-0.0362332,-1.05077,0.102514,-0.021697,-6.09927,1.80389,5.41577},
-{0.0991684,-0.682428,0.259715,-0.134647,0.416149,1.29069,-0.370203,-0.775089},
-{-4.50775,-0.00100952,-4.76029,4.93879,3.12663,1.40609,-2.15292,1.06787},
-{-2.78658,-2.41158,-1.97123,0.482207,2.33509,-3.01037,8.20183,0.841873},
-{0.287164,1.86315,7.77262,11.2794,-12.9211,-7.09667,-1.35359,-6.19793},
-{-6.79787,-1.34923,6.98219,0.0379624,-1.31655,-0.496518,-0.84944,1.89517},
-{0.245815,-1.10537,0.826552,0.0871601,-0.368666,-0.238575,-0.318147,0.0367272},
-{-4.26892,-1.14217,-1.47639,-6.52443,6.09884,1.01617,-1.62314,7.8186},
-{1.54392,5.37571,0.977919,-0.847368,-2.70392,-1.01109,-0.922396,-1.28249},
-{-0.495491,-0.256343,-2.23996,1.32637,0.479325,2.8504,0.512101,6.20605},
-{5.69122,-0.488377,-1.46671,0.681471,0.868299,1.68511,0.838676,-0.825714},
-{-2.31738,-2.1621,0.522756,0.900326,-0.470159,1.05873,-1.0559,-0.210936},
-{-0.459554,-1.06285,0.573956,1.98694,-0.65771,-1.34037,-0.0553681,1.62538},
-{-2.72696,-1.52834,-0.593637,5.75016,-3.12266,4.86092,0.413699,0.359828},
-{0.0808353,0.193152,0.0389671,0.175378,-0.211664,0.327569,-1.21192,0.0455147},
-{-0.882134,-1.33219,-1.5698,-0.629834,6.19642,0.60124,4.43049,-4.09649},
-{3.84539,-0.45681,1.76585,0.421058,0.929836,-1.3123,0.0920509,-0.565889},
-{0.204747,2.37451,-0.0402808,1.797,-2.46898,-1.09955,-5.20885,1.3839},
-{-0.189646,1.62857,-0.833329,-0.0364312,-2.83753,0.378956,0.39833,0.980087},
-{1.40852,1.19171,2.7495,-5.64983,1.96283,-3.27398,0.199364,1.38964},
-{-1.09869,1.3949,0.759887,0.687602,-1.42357,-2.77522,-3.61392,-4.87194},
-{-8.17908,-2.77667,-0.327769,-0.23556,4.90227,2.59569,-0.200477,-0.707252},
-{-1.7181,-1.89374,-1.89098,-2.34294,-1.41945,-1.285,-0.821974,0.250006},
-{0.57952,-2.18138,-1.63374,0.37941,0.450371,-0.115038,0.438043,0.546956},
-{0.0783844,2.43611,-1.9918,-0.547415,0.366085,-0.915101,0.498379,-0.843595},
-{-0.388358,1.27791,-1.16751,0.609873,-5.74965,2.55315,-10.591,14.4464},
-{6.1754,3.11497,1.50675,-5.21698,-0.804491,-1.65617,2.34825,-2.34182},
-{-1.98947,-2.5542,-0.827056,-2.67255,2.4294,1.31308,3.25936,1.28217},
-{2.0815,2.90298,1.029,-0.162884,1.25637,0.52683,0.122897,-0.25819},
-{-1.36184,-4.72108,-6.19039,0.875934,2.2871,3.55011,3.12527,1.12481},
-{-4.24993,1.57179,-0.643034,0.0488152,-0.855254,0.319326,-0.670514,1.94472},
-{0.392787,-0.572109,0.330958,-0.574133,0.489689,-0.233161,0.539798,-0.153841},
-{-0.151992,1.05461,1.59571,-1.14266,-0.775412,-4.78044,1.85783,-0.375044},
-{-1.37613,-1.17214,1.15579,-2.18811,0.0144438,3.36288,-0.559745,0.266116},
-{-1.90271,0.133615,-3.72728,5.39488,0.389955,-1.14554,2.92875,-1.07409},
-{-1.13268,-1.16504,-0.803357,-1.26185,-0.995426,2.98762,11.6034,-1.55409},
-{1.58461,3.43271,3.15758,3.61008,4.19841,2.95134,2.02262,1.21991},
-{-3.16395,1.76306,2.06703,1.88901,0.179146,1.37067,-1.19422,-0.984654},
-{0.0414621,-0.00391642,-0.0213088,-0.0476843,-0.0975031,0.017092,-0.014006,-0.00491766},
-{-1.2966,-3.69977,-0.196889,-1.74452,10.1355,-1.55321,1.81829,0.659723},
-{0.378435,13.6983,2.15336,-3.18556,-0.798485,0.863881,-0.15097,-0.732861},
-{-0.855569,0.24939,3.83951,-1.22131,-3.45346,0.658904,-3.41821,1.70097},
-{3.33813,-3.7548,-2.07261,-2.04664,0.0186421,-1.50429,1.8991,0.258947},
-{-1.4418,-3.00819,0.541237,4.31623,3.25692,1.92429,-0.401486,0.123254},
-{-2.61994,-3.4407,6.94121,2.97651,-0.864004,0.612121,1.20001,-3.97684},
-{-1.01072,-1.01778,-1.46718,0.962642,0.139496,6.4504,0.58795,-2.77344},
-{0.0683276,0.242321,-0.332268,-0.167348,0.0588223,-0.561949,0.0128769,0.692257},
-{-3.70373,3.53353,1.36103,-1.28587,4.6419,5.95083,0.463164,-4.46743},
-{4.73618,-2.4861,2.62966,-7.29803,-4.98566,-2.26953,-2.30375,3.06739},
-{-0.494718,0.718938,-0.304026,1.24893,-0.278192,4.10163,-6.95281,2.14885},
-{-0.472974,3.22649,-6.07153,1.07686,-3.75601,-1.10709,3.21006,0.312003},
-{0.170852,-0.556819,-5.61366,-10.0139,-5.71126,-2.51742,13.3491,11.8559},
-{-0.594016,1.23359,0.0658363,3.54037,-0.155034,-1.52533,0.0236745,-1.75594},
-{-15.9805,-7.17243,-13.2139,-10.7127,-7.74589,-7.88822,-2.35093,-1.36059},
-{-0.839397,-5.89704e-05,1.0169,-0.124808,-1.23702,1.07154,0.112274,-0.437035},
-{-0.498523,1.84575,-1.76887,-0.467115,2.6392,-0.207664,-1.27903,0.778147},
-{-0.894377,2.73574,-1.91608,-3.84077,0.645348,1.09503,0.102773,2.86183},
-{-1.16055,-3.20939,-3.60614,-8.21962,3.97539,12.4943,2.7547,10.0854},
-{15.0031,9.64887,-13.4129,3.18632,6.62155,0.941796,-8.23323,-8.32332},
-{-0.543627,-0.442222,-0.654387,-0.360416,-3.47404,-1.51365,3.9665,3.00349},
-{0.203788,1.75743,-0.0272479,0.617584,0.391623,0.884434,-2.73177,-1.05421},
-{1.26367,-12.8384,-1.06154,-1.10927,-0.234052,4.10143,3.1193,2.77169},
-{-0.507726,0.243182,-0.870555,0.644998,-0.567712,0.669043,-0.255913,0.462607},
-{-1.75066,3.07852,2.09557,-1.43375,1.54424,-0.999114,0.849652,-3.49942},
-{0.651646,-0.608241,0.548973,-0.48609,1.13023,-1.09611,-1.04516,1.27515},
-{-0.558097,0.401336,-0.948848,0.915317,-0.297274,3.34695,-1.907,0.354723},
-{-0.00229686,-0.41602,-0.641986,1.46701,1.20854,-0.559052,-0.817557,-0.262575},
-{-0.28695,-0.784754,0.4309,-0.00134333,0.474683,1.639,4.43773,-3.56919},
-{0.689816,2.2718,5.07713,-0.261499,0.422245,-1.12882,-2.44818,-1.98737},
-{-0.683059,0.46414,1.07219,-0.832315,1.01921,-0.012251,-0.468265,-0.0879798},
-{0.593875,-0.333936,-0.348577,0.902744,-0.471702,-0.148596,0.430625,-0.369835},
-{-7.15968,7.69222,-1.20884,-2.51399,9.04829,-8.10114,-3.45027,5.60251},
-{-3.12493,5.07696,1.41182,-3.44671,-3.56646,-1.87571,1.44955,1.77522},
-{-0.285136,-0.255548,-0.615051,0.346838,-1.27277,0.356668,-2.43423,5.33611},
-{0.512416,-2.74434,0.546467,2.83784,-0.533482,-0.817829,1.83944,-0.731159},
-{-0.528217,-5.85344,1.99714,-2.2978,0.098025,2.85496,1.09226,-1.43392},
-{-1.14276,1.48479,2.45777,2.07843,-3.71661,-0.741793,2.22734,-1.37552},
-{-7.3812,-4.55657,10.8417,10.8648,-1.20119,-1.15897,-3.46763,2.56275},
-{-0.316369,-0.0895606,-0.509939,-0.171779,-0.624263,0.654241,1.05006,2.63367},
-{-1.59816,0.335927,2.00651,3.53271,4.00066,1.59781,2.14921,-13.6871},
-{1.29544,-0.998222,1.64711,-2.71804,0.37388,-0.777328,0.648924,-0.758115},
-{0.123894,0.0498136,0.973389,0.587381,1.71504,-0.375171,-4.65329,0.85261},
-{3.10734,0.338142,-0.0128751,-0.864252,-1.49979,-2.89216,1.18564,1.80511},
-{-0.0904794,-0.538784,0.082841,-1.0526,1.32898,-1.73746,1.91643,2.8206},
-{-0.656568,0.848891,2.71889,1.47392,6.31869,-4.70759,-2.1531,-3.02864},
-{-3.19259,-4.22885,-1.97228,1.00988,-0.506759,0.192971,1.32023,2.91531},
-{0.408182,-1.64363,-1.30707,0.384958,-2.621,-0.650188,0.350918,-0.0830882},
-{0.22472,0.14646,-1.11336,-0.331597,0.982495,0.27725,-0.0547889,-0.0909637},
-{-1.69001,5.3349,-0.366215,2.32444,0.676152,-1.63652,-0.496699,0.990876},
-{-1.01343,2.02632,3.75093,-1.48647,-5.80882,-8.40272,-2.27878,10.2562},
-{3.8378,2.05113,-2.59689,-2.39786,-2.69032,0.0530386,0.26899,0.972373},
-{0.49211,0.0821152,-1.2347,-2.92653,2.16986,1.5811,0.59131,-1.51669},
-{0.467823,0.150847,1.88578,1.80124,0.0210955,0.103743,-1.30309,-0.624813},
-{-3.24128,0.153595,0.394586,1.34867,2.18227,2.90401,2.97036,1.87611},
-{-1.85919,0.571944,-0.334621,-0.769427,0.31506,0.493431,0.441428,0.315109},
-{-0.271593,-0.470292,0.489023,-0.56287,2.15425,-0.313037,2.40481,-0.930909},
-{1.0053,1.67489,1.8417,5.49286,2.59641,-9.01027,1.00317,-7.85156},
-{0.192674,1.23763,-0.2898,-0.821004,-1.89117,1.01075,1.95767,-2.19794},
-{2.12767,-0.14419,-4.98615,-0.415483,-0.621716,-1.12736,1.07307,2.17722},
-{-10.0525,-1.37945,12.0511,-8.52086,-12.1122,4.01575,7.7583,4.85601},
-{17.7165,16.2218,15.2097,16.8817,18.1844,16.7123,12.2521,9.76576},
-{-6.85617,7.56277,-3.45185,6.8115,4.55666,-1.9991,1.78707,-1.73036},
-{-0.499327,-0.0698337,-0.0373869,0.200028,0.329592,-0.0486077,0.0663931,-0.219115},
-{-2.27881,-2.05002,2.67206,1.03504,1.92792,0.121717,0.562062,-0.835895},
-{0.99975,11.1524,1.06566,1.68586,-0.504727,-5.86336,-3.12448,-4.47146},
-{0.285341,0.755941,0.0583213,2.3038,-2.79715,0.933629,-1.48385,0.0677943},
-{7.66993,-10.4982,-9.97698,6.17148,0.167368,-2.61863,-2.28408,4.39419},
-{-8.53897,-13.7514,0.266647,4.65467,3.68827,-4.83792,5.20001,10.7581},
-{1.03452,-3.55737,2.1642,1.52748,-0.342402,2.28709,-1.64957,1.22567},
-{-1.0491,1.7385,1.34901,0.655908,-6.00214,5.13727,1.03022,-4.067},
-{1.47236,0.335302,-0.69815,1.23935,1.03984,0.212929,1.88324,1.36407},
-{1.59779,0.719427,-4.42698,2.39738,5.85166,1.55233,-1.7612,-6.04771},
-{-2.0815,3.45684,10.8921,-8.82219,4.29542,1.09212,-2.85653,0.495975},
-{-1.04604,3.60327,2.37328,2.24126,4.81999,5.53379,-13.2484,-1.413},
-{0.488281,2.15665,0.747949,1.81346,-7.05606,-1.65903,0.150788,2.36166},
-{1.25837,-0.720683,1.14494,-3.89918,-0.920351,-10.1479,9.42865,3.23743},
-{0.470473,-0.457707,0.70375,8.20134,-1.67875,-0.674016,-2.50759,-3.23649},
-{-8.45883,-4.82219,-5.41379,-4.18737,-3.69233,-3.11833,-1.47025,-0.0576363},
-{0.152079,1.29853,-0.206948,-2.06923,-0.237207,1.04946,-0.84165,-0.377527},
-{-0.211852,-0.00916021,0.914064,-4.63152,1.14687,1.25372,-3.83941,2.45133},
-{1.81849,4.29555,-2.98607,-6.09764,5.12727,1.66926,-1.61484,-1.91625},
-{-1.874,0.549654,-2.78619,-2.47448,-6.14046,8.90464,0.0288635,6.82601},
-{4.6217,2.7517,1.04102,1.74871,1.00226,-1.02518,-2.89941,-2.91679},
-{-0.263811,-0.67306,-2.09165,0.0961835,-2.75083,3.57406,1.60871,1.06315},
-{0.600714,0.441095,0.417873,0.0629572,0.0999319,-0.344547,-0.272613,-0.516114},
-{-3.89916,-12.2242,3.70331,5.16777,9.65396,9.09547,-4.37104,-1.57708},
-{-1.84074,1.29088,-2.02276,2.04776,-0.887496,0.801188,0.383502,-0.368345},
-{0.656491,0.143978,0.624393,-0.158679,0.427109,-1.56755,0.619428,-4.2152},
-{0.609344,0.0732138,0.873515,-0.617669,1.05644,-4.91967,-3.81445,3.99232},
-{-0.409582,0.16064,-0.0131707,1.03396,0.361093,2.09456,-0.354058,-2.99418},
-{0.809913,-1.76251,-2.44662,3.11799,2.88003,-3.4845,-0.188212,0.652149},
-{0.406978,-0.0842555,-0.349887,-1.77173,-0.50055,-1.06198,5.77243,0.0498347},
-{3.18269,1.12462,6.41939,4.60169,-5.97689,-1.26831,-5.5743,-1.79626},
-{-2.53636,0.0317959,2.79664,-0.353874,-0.112605,-1.60821,-0.133658,1.60668},
-{1.91824,-1.02026,0.159537,0.0412503,-0.85463,0.832986,0.0705105,0.279141},
-{-5.02989,1.85044,1.82933,-2.36279,3.71654,-1.09433,-1.57432,1.25383},
-{0.99047,1.45704,1.37992,-0.589451,-1.24788,-1.50652,-1.19568,0.39856},
-{0.00706045,-0.599155,2.22793,-2.16684,-1.27906,0.0548773,2.21572,6.60851},
-{2.2303,0.0380174,-3.36751,0.0567251,0.580353,1.31216,-0.878314,-1.62739},
-{-0.929961,-0.980825,0.109624,0.733087,0.48422,0.601498,0.860915,0.343296},
-{-0.895637,-3.87482,3.13111,4.75071,-3.33122,-3.58624,1.14427,2.81316},
-{3.45503,-7.73637,1.48223,9.10071,-7.08029,6.03079,2.97385,-7.47854},
-{-0.437426,0.244051,0.123814,0.125134,-0.704714,0.403038,-1.45737,1.76556},
-{-0.776061,-2.66567,-2.13818,-0.301486,2.19431,9.31766,11.6326,-12.9785},
-{5.32131,-3.93852,3.25484,-1.54489,-1.04619,0.357715,-1.25165,-1.42639},
-{0.393764,1.25782,1.8604,1.92865,0.637688,-1.72167,-12.2475,4.44725},
-{1.32603,1.2719,-0.799616,1.0445,-0.472987,-0.572721,-0.388705,0.0559285},
-{2.13059,4.79752,-3.01884,-11.9279,3.68476,-7.27929,2.36094,1.79636},
-{2.01085,3.33588,3.45415,0.707843,-1.88576,-1.93373,-5.90498,-12.0753},
-{-13.1358,-0.0722972,1.1759,-0.233742,-0.469496,4.38377,2.22281,1.5721},
-{1.44864,0.484473,-1.04305,-1.91033,-1.7157,-3.04247,-2.18691,-1.66752},
-{-1.89339,-0.656363,-3.56054,-0.157522,0.597456,0.181031,0.305276,1.17847},
-{-2.99884,2.18798,-1.60484,-0.120089,2.16557,-2.16618,2.11124,-0.19639},
-{0.639774,-0.139229,-2.33318,-1.39971,-2.31862,0.139156,-2.04763,11.8003},
-{8.72324,0.0659868,2.72419,0.407081,-5.44599,-1.47224,0.605711,-2.40505},
-{0.0521982,-1.62578,-0.653986,-8.16205,3.39202,0.744154,3.70636,0.841041},
-{0.219746,0.918197,1.4789,1.54168,1.08978,1.11674,0.929919,0.169255},
-{-10.0517,-4.4404,-13.512,-0.762768,7.76414,6.38467,5.95964,-1.69592},
-{-4.8178,-0.237022,-1.62624,-1.58952,-1.77048,1.70292,0.255762,-1.4344},
-{0.492779,-0.0236254,0.23246,-0.255688,0.559473,-1.94112,0.820715,-0.546517},
-{0.923056,-0.517965,0.592486,-1.11193,2.87061,-5.2177,3.94727,-2.44346},
-{-2.39633,2.94591,2.56805,-3.08263,-0.500908,2.79285,1.94271,-0.54145},
-{-0.322366,-2.03661,-9.94176,7.36866,-5.18107,1.64396,4.91411,-1.37354},
-{2.39178,2.2664,-3.19701,-6.74048,-4.5786,2.73158,7.68536,-2.16476},
-{5.03591,1.12068,3.87863,3.70015,-0.119696,-0.347596,0.416848,2.02736},
-{-6.64054,6.49094,4.84356,1.34578,0.554388,0.97534,-1.63704,-1.95429},
-{0.189083,0.253443,0.351171,0.330216,0.341852,0.47609,0.172018,0.40755},
-{0.0613737,-4.35191,5.36635,-0.253103,2.42636,-2.32654,2.31745,-0.0704671},
-{-1.93029,9.65932,2.30469,-12.7983,-5.15272,5.96595,-3.53528,-3.19886},
-{1.41572,0.286996,0.244565,0.130537,-6.55088,3.56512,-4.17733,2.66477},
-{5.81587,-4.98287,-1.32456,0.73151,-4.39559,1.45896,1.66452,0.335995},
-{1.66357,-7.16468,-2.14436,2.00926,1.21921,0.952822,-0.505583,-0.591253},
-{1.6658,-8.68521,10.3974,-2.57838,0.666186,6.00717,-2.46826,0.550397},
-{0.363529,-1.92985,-5.13981,-0.583374,-4.53813,9.68008,4.04232,-1.13259},
-{-0.621135,1.05921,-1.10351,0.422243,-0.154673,-1.85978,0.127122,1.38249},
-{1.90018,1.47782,1.0164,-3.71849,-0.253692,4.9619,-1.32665,-4.14597},
-{14.2059,-3.19643,6.07712,-7.06154,-5.59924,2.66166,-6.71292,1.60592},
-{-1.14988,-2.11124,-0.822718,0.427132,1.18521,9.47297,-4.22216,0.995913},
-{1.63825,3.91994,-2.24553,1.74886,-0.910052,-2.6372,2.55721,-1.43779},
-{-0.187612,-1.12707,-3.21935,-2.53696,0.444087,0.250754,6.32012,6.84569},
-{0.402972,1.10826,0.537091,2.65937,-2.35776,-3.67383,-0.411338,0.00468015},
-{-17.4953,-19.3723,-14.7056,-16.8843,-18.4026,-16.6708,-12.4375,-11.2071},
-{0.571586,0.621064,0.399659,-0.879283,-0.81783,-0.11569,0.346091,0.370155},
-{0.26496,-0.612374,0.656908,-1.40373,4.63243,-1.55518,-0.146315,-0.211709},
-{-0.221528,4.37888,-4.90966,-0.826994,-1.15318,2.45195,-0.999603,-0.885087},
-{0.0774179,-2.35438,-0.615972,-3.95522,-0.489508,5.37933,0.83192,3.97895},
-{11.8538,0.280897,-6.25442,-0.413919,0.177485,-2.81457,-0.187652,-1.32068},
-{0.849645,-0.777109,0.132662,-2.32685,-1.7465,-0.299211,-0.353344,2.7832},
-{0.360023,-0.0221648,0.182637,2.04186,0.437422,2.16491,-5.59429,-4.20462},
-{6.58371,-3.06165,-5.46584,-7.15424,1.15371,4.55279,-0.676023,-0.814275},
-{-0.662566,1.60954,-0.151962,0.439522,-0.119091,0.0794726,-0.154145,-0.439802},
-{0.690386,-0.213604,1.24216,0.0327462,1.01089,-0.331969,1.77089,-8.32465},
-{0.25844,0.71889,1.28564,0.484911,1.81275,-3.26167,-1.30672,-0.543728},
-{-0.874365,-0.847797,-0.0344846,-0.364135,3.38751,1.92608,-1.60058,-0.364437},
-{-2.47908,0.0358242,-0.416142,1.25336,1.61083,-0.405303,-0.200643,0.153088},
-{0.0676664,0.0732605,-1.70212,1.13502,0.178007,-1.04099,2.46956,-1.61058},
-{2.04816,1.49183,8.84348,-3.07608,-4.29935,-2.43361,0.184449,-0.966081},
-{-1.62614,3.1635,1.08861,-1.21798,0.171358,-0.17998,-1.12656,0.282562},
-{0.0912846,0.176816,-0.546831,-0.205794,-0.295235,0.878923,1.00537,-0.490185},
-{1.60419,1.08165,-7.39422,4.18227,9.66378,-4.6794,-6.23252,3.40852},
-{-7.56484,8.28081,6.27843,-3.72213,-0.614124,-5.09631,6.06978,-3.43011},
-{1.21491,0.697695,-1.62641,-0.529543,-0.617756,-0.414999,-2.13013,1.85773},
-{3.04352,-2.20158,-0.810965,1.49209,-0.184109,-1.33921,-1.8366,0.410804},
-{-0.105488,-2.76789,1.55884,-0.490935,-1.1862,0.247893,1.58913,0.842581},
-{-3.49846,0.159163,1.8186,-0.177431,-1.27182,0.0968679,2.14015,-0.368962},
-{-6.03981,-4.30762,-4.10649,11.161,7.31562,-0.27644,2.69345,-3.42264},
-{-0.313663,-0.421797,-0.390626,-0.0718103,1.16765,1.89664,-0.542448,2.32168},
-{1.34793,-1.60852,0.960585,-0.842856,2.52615,-4.00664,9.11328,-10.994},
-{0.614699,-0.444924,3.50166,-1.70597,0.372752,0.735592,-1.0934,0.745709},
-{-2.5638,-2.06912,1.59051,3.69104,0.513344,-2.79309,-4.0566,0.0711823},
-{2.02001,0.693771,0.597655,0.346926,-1.89079,-0.533733,-0.214125,-1.53317}};
+float hexc_table[256][8]={
+{-0.808777,0.522889,-0.585996,0.00203914,-0.628691,-0.371588,0.380914,-0.317525},
+{0.15673,-0.576408,0.728236,-0.323157,0.191227,-0.99638,0.93673,1.01064},
+{0.0959034,-0.277018,-1.71916,0.224231,0.637612,-0.672212,-0.236905,1.70337},
+{1.35613,0.458604,-1.36192,0.177675,-0.706717,0.322615,-0.95508,0.880085},
+{-0.40989,-1.0725,-1.1971,0.100905,0.395604,-0.162363,-0.464094,-0.5957},
+{1.61305,-1.83844,-0.883322,1.02425,-1.18022,0.223562,-0.115054,0.558894},
+{0.351025,-0.552213,-0.786358,-0.459102,1.58681,0.888893,-1.37592,-0.201812},
+{0.138743,-0.265277,1.17915,-1.24899,0.267171,1.34758,-1.87008,0.586374},
+{-0.600932,-0.613149,-0.47943,1.12824,-0.408298,0.826508,0.0477193,1.24647},
+{1.48869,-0.81186,-0.261784,-0.503374,-0.629299,0.662346,0.279251,-0.509087},
+{-0.0934602,-0.17457,-0.758435,1.08457,0.239585,-0.504587,0.686232,0.582796},
+{0.84693,1.38514,0.699449,1.25807,0.295049,-0.0894298,-0.10184,-0.806657},
+{-0.368078,0.210787,-2.20296,-0.65638,1.56279,-0.16844,1.61318,-0.120006},
+{-0.10194,0.0106725,0.120997,0.36348,-0.302064,-0.442791,0.00923203,0.578896},
+{0.0293595,-0.203684,0.545515,-0.120283,-1.0069,0.137839,0.126781,0.00352654},
+{-0.119486,0.154518,0.285092,3.33185,-1.33059,-0.983331,-1.05646,-0.506898},
+{-1.59366,0.660099,0.998661,-0.314723,0.658744,-0.831439,1.22569,-0.486493},
+{0.132164,-1.05403,1.78377,-1.59051,0.676839,0.224812,1.12597,-1.03693},
+{-0.0600416,-0.135391,-1.31914,0.102171,-0.937818,-0.496109,1.74828,0.447002},
+{0.520821,0.0324353,1.27146,-0.835034,-1.0944,-1.24635,-0.149284,1.39264},
+{-0.145715,0.839715,0.513449,0.180693,0.374319,0.404758,-0.902613,-0.741751},
+{3.34802,-0.109164,0.0169975,0.0553642,-1.05882,-0.451845,-0.492785,-0.443551},
+{-0.0560106,0.319378,-0.168577,0.226488,-0.440823,0.56149,-2.7563,2.05412},
+{0.118746,0.516211,-0.0143968,0.772312,-0.367631,0.691226,-3.23937,-0.330117},
+{0.165231,-0.235354,-0.433716,-0.880436,-0.659189,-0.897381,1.11856,2.82471},
+{0.588413,-1.41287,0.0470025,-0.446261,2.3859,-0.390315,0.439154,-1.15802},
+{0.603859,1.41714,-1.58189,-1.44953,-0.940504,0.333627,0.782746,0.596901},
+{0.329154,1.32764,0.272124,-0.080474,-1.03789,0.922687,0.176309,-0.250927},
+{-0.276147,-0.0525192,-0.322986,-0.0330593,0.687889,0.565872,0.630147,-0.495979},
+{-1.31743,0.150537,-0.169827,-0.0960073,0.905746,-0.420937,-0.58555,-0.469233},
+{0.109767,0.192229,-0.537553,0.09561,-0.602509,1.29395,-0.941109,-0.571217},
+{-0.253559,-0.468608,1.74868,-0.196019,1.14608,-0.386698,-0.980027,-0.494255},
+{-0.73753,0.68799,-0.943899,0.830381,-0.330815,0.704227,0.975151,-0.219969},
+{0.325216,0.115189,0.267397,-1.11632,1.71594,-2.11495,1.31783,-0.227522},
+{-0.0622045,0.0197852,-0.416733,-0.0019605,-0.765851,0.516627,-1.07842,3.83718},
+{0.427202,0.260416,0.159638,0.203798,-2.58566,-1.42905,1.84324,0.361801},
+{-0.0170446,0.0899078,0.631411,-0.0989984,2.69772,-0.34365,-1.53167,-1.46737},
+{0.439624,-3.04784,-0.560917,0.553406,0.203279,-0.238426,0.42574,0.748935},
+{-0.556707,-0.0942741,-0.25737,0.701488,-0.219897,2.55963,-1.44952,0.430409},
+{-0.295808,-0.0966204,0.837206,-0.39557,0.221283,0.348662,-0.131419,0.245537},
+{-0.432811,-2.24016,1.80876,0.796433,-0.02536,0.910951,-0.422385,-0.274461},
+{1.96178,0.36996,-0.198854,-1.35782,-1.16426,-0.312176,0.681845,0.462948},
+{-0.459443,-0.749728,-2.37122,1.236,1.62279,0.668355,0.342503,-0.0838306},
+{0.304269,0.262004,0.220552,0.570633,0.0833619,0.390873,0.208076,-0.0809892},
+{0.367254,-1.68072,-1.17645,-0.446899,0.792627,0.853643,1.01843,-0.186805},
+{0.337864,0.557125,0.751848,-0.533723,1.2263,-0.137238,0.205549,-0.013345},
+{0.331314,-0.798549,2.87356,-0.39505,-0.193366,-1.14558,-0.0373992,-0.00878555},
+{-2.1208,0.83966,0.737303,1.98379,-0.838669,-0.0178801,-0.485471,0.159222},
+{-1.11582,-0.0638764,0.824772,-0.0352022,-0.211324,0.369823,0.282492,-1.01858},
+{1.45412,0.492399,1.32568,-0.900533,0.352761,-1.54909,-0.167461,-0.581635},
+{0.313625,0.148285,-0.473284,0.115123,-1.79888,0.442188,0.644912,1.37658},
+{1.38859,1.94091,0.22186,0.180213,-0.273428,-1.01283,-1.03173,-0.897502},
+{0.771184,-0.25248,1.2455,0.517539,0.691557,-0.183637,0.63611,-1.15696},
+{1.85036,-1.25111,-1.45311,0.601111,1.0399,-0.239207,-0.927822,0.161069},
+{-1.79724,1.51284,-0.912954,0.990636,-1.19074,1.13124,-0.691979,0.82091},
+{0.292346,0.368185,0.385619,0.111567,-0.277132,-0.952879,-1.78787,-1.08619},
+{-0.71588,-0.744422,-0.125341,-0.122294,0.0917814,0.106495,0.474856,0.338462},
+{-0.427987,0.728385,-0.701375,-1.56086,0.436273,-0.389922,-0.268771,1.61832},
+{0.871989,1.23289,-0.394881,-0.538355,0.964153,-0.729176,-0.979271,0.0710916},
+{-0.61563,1.28199,0.157971,-1.17571,0.946734,0.444829,-1.09012,0.250331},
+{-1.13856,-0.688581,-0.0940012,0.452695,0.431558,1.73898,1.47172,-0.689541},
+{0.824974,0.0114767,-0.313246,-0.892286,-0.591019,-0.855078,-0.975519,-0.429125},
+{-0.0528536,-0.201216,1.35063,0.974641,-1.34623,0.0666181,0.665035,-1.12152},
+{0.313711,0.0441856,0.0955668,0.704854,-0.0354564,-1.20593,-1.8752,1.05217},
+{-0.695493,1.2416,-0.0320361,-0.0619316,0.183647,0.306643,-0.0217553,0.389798},
+{0.17934,-0.421392,0.0748884,-0.660978,-0.193801,-1.52173,3.13886,0.450854},
+{-0.0396398,0.0540767,-0.374352,-0.187403,-0.03619,0.217266,0.405445,1.09984},
+{1.04235,0.485276,-1.01031,0.46025,-0.15311,0.177342,0.742341,-0.688384},
+{-1.69186,-1.15831,0.0983169,1.13975,1.35315,0.854954,-0.21213,-0.851528},
+{2.09461,-1.73005,1.56185,-0.563142,-0.372469,0.115402,-0.555429,-0.0822499},
+{-0.0795778,-0.069224,-0.218627,0.13899,-0.301441,2.61665,-0.00878438,-2.27138},
+{-0.668836,-1.20384,1.25871,-0.737445,-0.517894,0.734018,-0.280888,1.13245},
+{-0.830671,-1.49774,0.209523,1.86076,-1.00498,0.179658,0.857851,0.0910563},
+{0.345519,-0.350603,-0.787428,-0.391039,-0.349897,0.159728,0.47223,0.205563},
+{1.54183,-0.0948628,-1.02113,0.650511,-0.485278,-1.36601,0.562137,0.524121},
+{2.90999,1.78334,2.05806,1.82433,1.5106,1.04695,0.72339,0.591056},
+{-1.30733,-1.24676,-1.61786,-0.067692,0.468792,1.22463,0.83458,0.703393},
+{-0.0155242,-0.0213231,0.00225538,0.723512,-0.356651,-0.299559,-0.155354,-0.754868},
+{-0.606517,1.47653,1.22334,0.18925,-0.962231,-1.00246,0.365475,-0.213715},
+{-0.164931,-1.20109,0.0430696,0.846456,-0.0651136,-0.941185,-0.398855,0.455344},
+{-2.76299,1.74181,-0.458678,0.440893,0.733256,-0.433325,-0.171665,0.721036},
+{1.58363,-1.09832,1.2246,-1.52276,0.95571,-1.1379,0.980383,-0.918086},
+{-0.643503,0.442085,0.287107,-1.10492,-0.591021,-0.192952,0.752239,0.549148},
+{0.195071,2.43492,-1.06219,-0.0949268,-0.885581,-1.47083,0.211643,0.535758},
+{0.0720198,0.250183,0.12972,-0.216719,-0.0317595,-0.857157,-0.298859,-1.67954},
+{0.999568,0.0687439,-1.61274,-1.40093,0.695667,-0.374883,-0.31825,0.206975},
+{0.105676,-0.0115208,-0.0175211,0.0465023,-0.348852,0.350671,-0.735256,0.537047},
+{0.174997,0.158472,0.553584,0.0843251,1.47625,-0.706212,-2.84033,0.448321},
+{0.0594142,-1.45687,-1.03239,-1.34435,-0.475703,0.769129,1.06548,1.33537},
+{0.773339,-0.451576,0.257821,-1.36492,0.42478,0.522859,0.775457,0.0230162},
+{0.528344,0.830586,-0.693501,-0.675812,0.383242,-0.684998,1.06472,0.617906},
+{0.722796,1.16666,-0.857913,-2.00835,0.204133,1.78738,-0.0914676,-0.609118},
+{0.0185043,-0.164745,-0.353897,-0.489875,-0.441889,0.366605,3.19346,-1.40696},
+{-0.361573,0.83363,0.38689,-0.141691,0.225086,-1.42919,-0.448093,0.983676},
+{-0.043528,-1.21209,-0.198167,0.508588,-0.488381,0.75472,0.314166,-0.316087},
+{-0.0787701,0.344402,1.85144,1.32925,0.143855,-1.34127,-1.26755,-1.04038},
+{-1.03463,2.61701,-1.23752,1.60173,-0.892178,-0.203644,-0.0435452,-0.156978},
+{-0.385499,2.16763,-1.31903,-0.830889,1.38589,-0.971437,0.341876,-0.621655},
+{-0.982007,0.483396,0.234676,0.325206,-1.15629,0.272426,-0.452657,1.10688},
+{-0.814407,0.0248399,0.519375,0.520542,-1.22835,-1.05489,0.791287,1.30571},
+{-0.587444,-0.168542,-0.662712,0.19709,3.21792,-1.40667,0.309692,-0.393578},
+{1.11184,-1.12929,0.160326,0.166788,-0.756938,1.45929,-0.823309,0.299687},
+{-0.0576646,-0.637203,-0.217167,-1.87038,0.187128,2.98001,0.269578,-0.0542942},
+{-0.778295,0.771084,1.79295,0.546435,-0.548952,1.22395,-0.75231,-0.797754},
+{-2.08654,-1.42989,1.03557,0.166929,-0.23891,-0.082845,1.12907,0.52266},
+{0.284327,0.414842,-0.494532,-1.12157,-0.450422,1.15686,1.53709,-0.0175749},
+{-0.639228,-0.0646058,-1.40381,2.55341,0.688712,-0.542615,0.841051,-0.901197},
+{0.763406,-0.568188,-0.00087138,0.413695,0.767502,0.740268,1.22465,0.552355},
+{0.0415443,0.38186,-3.06332,-0.177463,-0.369302,1.59641,0.62692,0.704707},
+{0.0812399,-0.813035,0.376212,-0.264687,0.16326,-0.0333936,-0.0502651,-0.951403},
+{0.384816,0.55555,2.90495,-1.85337,-1.14819,0.129403,-0.476643,-0.439153},
+{-1.40799,0.454224,0.114894,1.04154,1.63284,-0.0359158,0.30784,0.077151},
+{-1.31494,-0.813242,1.77587,-1.4204,1.27696,-0.0261728,0.105655,0.176416},
+{1.22696,-1.42075,0.614181,0.388936,0.579128,-1.12721,-0.568678,0.00162247},
+{0.147985,1.0085,0.307689,-1.64006,-1.73847,0.443712,0.378749,1.2384},
+{1.08718,-0.0593162,0.085134,-0.17511,-0.430982,-0.424982,0.186084,-0.135354},
+{0.179978,0.0977914,0.431251,-0.0309529,0.510113,-0.693534,0.50011,-3.4506},
+{1.19026,0.0486908,0.356885,0.167754,0.617369,-0.154919,-0.73482,-1.01514},
+{-0.0387573,0.414342,-1.80526,2.11058,-1.54069,0.917013,-0.109245,-0.289524},
+{-0.454713,1.52397,0.737781,1.12684,-0.680711,-0.790029,-1.42535,0.173591},
+{-0.328012,0.261804,0.746791,0.564532,-0.553552,0.0441862,1.38248,0.186016},
+{0.667876,1.38717,1.35139,-2.96378,-0.0395241,-0.567713,-0.145259,0.30536},
+{0.135526,0.911312,-1.26862,-0.32518,0.538648,0.417322,-0.0360691,-0.398564},
+{-0.98413,2.9185,0.654757,-1.09717,-0.950289,0.26985,0.0916787,-0.411594},
+{-0.335957,-0.0634045,-1.00525,0.133848,-1.34124,2.98978,0.7772,-0.200313},
+{-2.77015,-1.78929,-1.68706,-1.55953,-1.38527,-0.983483,-0.794544,-0.358305},
+{0.422973,-0.660658,1.31996,-0.426988,-0.468712,1.12782,0.14786,-0.806196},
+{0.361743,0.23277,0.25592,0.554855,0.998512,-2.28186,0.135399,-1.2093},
+{-0.687769,0.0452033,-0.262838,0.20035,0.0353051,0.460395,-0.155171,-0.00192579},
+{0.31032,-0.136012,0.137005,-0.945442,0.14841,-2.79005,1.45757,1.42989},
+{-0.900737,-1.35268,-0.471629,1.17497,1.18787,0.350648,-1.24437,0.964389},
+{1.56127,1.82359,-0.925776,1.01511,-1.45534,-0.297508,0.0559301,-0.139561},
+{-0.0462621,-0.796178,0.00627632,0.487887,1.14132,0.895285,-0.409346,-0.239578},
+{1.49325,-0.457553,-0.562713,1.49225,-0.230491,-0.132286,-0.0372553,-0.779219},
+{-0.074052,-0.430304,0.672071,-0.956253,1.49798,1.61828,-0.876909,-1.27406},
+{1.0187,0.253654,0.959619,-0.729613,-0.199576,-0.0358726,-1.21267,0.546944},
+{-0.966716,-1.27168,-1.03772,-0.327353,-0.632859,-0.0430861,0.10775,0.8553},
+{0.640816,0.206735,-0.344336,-0.524876,0.301453,0.635547,-0.136396,-0.0988855},
+{0.184806,0.27398,-0.850987,0.161236,0.0455893,-0.984509,-0.168223,0.0759809},
+{0.854671,-0.136258,1.39416,0.902722,0.199242,0.275231,-0.404062,0.2226},
+{-1.94917,-0.733045,-0.772245,0.0691312,0.568955,-0.188401,1.11741,0.0813894},
+{-0.0231792,0.0406332,-0.0422235,-0.0237807,0.00645228,-0.014091,-0.00328628,-0.0269731},
+{-0.906194,-0.363433,1.06006,0.360859,-0.503677,-0.786459,0.0167893,0.0133404},
+{0.422269,-0.343991,0.0560596,1.58514,-0.762344,0.318524,-0.97429,0.364358},
+{-3.27627,0.673321,1.32766,0.470124,0.44532,0.278163,-0.156709,-0.171223},
+{-0.123139,-1.49281,0.0668417,-1.51375,0.829185,-0.698139,0.904836,-0.0540672},
+{0.458845,-0.200406,-0.90056,0.0409038,-1.87272,-0.059603,0.117528,-0.341763},
+{0.311415,0.084379,0.200552,-0.256706,0.14961,-2.39829,-0.957787,2.49645},
+{0.0325073,0.516325,0.142447,0.775278,-0.0761688,0.471091,-1.43209,-2.50531},
+{2.35513,0.611441,0.32354,0.125114,0.53332,-0.186619,-0.117798,0.0939877},
+{0.281024,0.722204,0.368336,0.368587,-1.71743,0.664121,-1.96004,0.801418},
+{-0.0399085,-0.0233632,0.181302,0.716231,0.944008,1.9438,-2.5673,-1.24767},
+{-0.427528,-0.18767,-0.557845,-0.390206,-0.405721,1.04527,0.863514,2.54192},
+{-0.0880345,-0.459539,-0.912484,-0.65522,1.64758,1.67046,0.840719,-1.32067},
+{-0.147995,2.54311,-1.1464,-0.371562,-0.731225,0.910382,-0.950371,0.253017},
+{0.494899,1.59301,0.110902,-1.20394,-0.542264,-0.455406,0.616078,-0.751476},
+{0.0416721,0.00096097,-0.332705,-0.133402,-0.592335,0.469598,0.843544,-1.5787},
+{-0.28804,-0.147371,-0.148735,-0.89819,0.444204,-0.350171,-0.242063,0.216802},
+{0.0235683,-0.154932,0.329484,1.49847,-2.55488,1.53946,-0.52761,-0.292228},
+{-0.320628,0.56586,0.95019,0.860762,0.465814,-0.57876,-0.207143,0.0336202},
+{-1.89591,1.69693,-1.01986,0.291905,0.0337999,-0.304789,0.80978,-0.907923},
+{0.201753,-0.173085,0.57677,-0.541242,0.965199,-1.32738,2.05467,-2.2066},
+{-0.0423064,0.595229,-0.567897,0.903553,-1.62325,-1.0837,-0.758215,2.19196},
+{-0.0995138,1.16365,0.504768,1.15474,-2.97384,-0.639325,-0.157529,0.265709},
+{-0.171421,-0.293915,-0.0931648,1.62147,1.59152,-0.421573,-1.26656,-0.973813},
+{0.567538,-2.67901,0.384474,-0.825834,0.553463,1.14339,-0.162028,0.221003},
+{-0.200415,-0.498812,-0.719186,-0.068236,0.349007,1.10351,-0.74929,1.10836},
+{-0.227523,0.203778,0.250793,-1.22197,-0.626241,0.513681,-0.325717,-0.454119},
+{-0.00361921,-2.26803,1.59277,0.444606,1.00568,-1.12035,0.660596,-0.304733},
+{0.198435,-0.389408,-0.564997,-0.912806,-1.02791,-0.885569,0.0274177,0.655909},
+{-0.724919,-0.107059,-2.02767,2.517,0.127475,-0.421874,-0.670363,0.821456},
+{0.408334,0.604139,-0.0257201,0.962369,0.659979,0.604856,-0.652068,0.800184},
+{1.92652,-0.70313,-1.80901,-1.32288,-0.138311,0.695327,1.03039,0.435844},
+{0.0690851,-0.0623718,0.169685,-0.289407,0.141078,-0.281387,0.70663,-0.393098},
+{0.377194,-0.385657,2.19488,0.602355,-1.91452,-0.411003,-0.953451,0.47299},
+{-1.2391,0.289887,-0.611413,1.27895,0.130686,0.266617,-1.02355,0.169671},
+{-0.797655,1.07721,0.537033,-0.828331,0.623273,0.943434,0.239111,-1.2561},
+{0.208696,-0.0416711,1.07258,-0.724576,1.75278,-2.45005,-1.08247,0.165616},
+{-0.146516,0.0763024,-0.623232,-0.403905,-2.06184,2.23284,-0.725328,1.45169},
+{0.738275,1.21216,1.74647,-0.123546,-0.733204,-0.341279,-0.640132,-0.752561},
+{-0.235637,-0.244096,0.35929,0.344935,1.19224,0.234872,-0.0568987,-2.19267},
+{0.585596,-0.0452693,-0.605202,0.433336,1.2855,-0.605342,-0.0913277,-0.038099},
+{-0.411354,0.838034,-1.49501,1.15931,-0.845042,1.17135,-1.31966,1.15102},
+{1.29489,0.546986,0.317687,0.388757,-1.19381,0.291949,-0.988666,-0.790527},
+{0.463076,-0.634534,-0.00213198,0.0555478,0.278823,-0.003153,-0.0730633,0.130724},
+{-0.680517,-0.146837,-0.434109,-0.730404,1.35604,0.646014,0.547171,0.75849},
+{0.494406,0.898478,-0.141296,-0.307567,-0.414651,-0.168474,-0.169992,0.249803},
+{-1.40652,0.899466,1.45931,-0.86589,-0.120286,-0.0571926,-0.631404,0.350938},
+{-0.547421,-0.352653,0.0902851,-0.284476,-0.395727,1.46829,0.776707,0.326405},
+{-0.269792,-0.678802,-0.858414,-1.14491,-1.07189,-0.982154,-1.03886,-0.962474},
+{1.23972,-1.21529,0.7549,0.823635,-1.07411,-0.183865,0.312112,-0.981306},
+{-0.223371,-0.0609721,-0.0130559,1.76329,1.34323,-2.23744,-0.968509,0.553359},
+{-0.83723,0.945377,-0.0130015,0.7976,-0.802271,0.337151,-0.466119,-0.222138},
+{0.391602,0.503566,0.0480818,0.0673739,-0.647474,-1.56068,1.32505,-0.762175},
+{1.39401,-0.601129,-0.532522,-0.356412,0.231133,-0.38761,-0.260244,1.01642},
+{-0.0916899,0.947205,-0.473112,1.495,-1.10378,-0.309157,1.01827,-1.81116},
+{-0.0327095,-2.17732,-0.296067,1.76383,1.14406,0.470282,0.102904,-0.294464},
+{2.79548,-2.00851,-0.0650745,-0.56353,0.515563,-0.384438,0.379329,-0.303786},
+{-0.938677,0.790154,-1.28689,0.816583,0.729919,1.4185,-0.510592,-1.07938},
+{0.750844,-0.916416,0.960228,-2.26194,0.387169,-0.143917,-0.525221,1.02498},
+{-2.56175,-0.369587,-0.520176,1.1574,-0.386785,0.863226,0.222942,0.415037},
+{-0.590394,-0.815283,-0.929596,-1.35301,-0.275245,0.239319,0.360759,-0.343421},
+{0.613533,-1.29497,-0.224972,0.793246,-0.142523,-0.74719,1.17681,-0.29032},
+{0.66837,1.12645,0.887062,0.814444,0.96737,1.00758,0.745419,0.251183},
+{-1.39397,-2.09185,0.20586,-0.115216,1.29928,0.795985,0.553848,0.431367},
+{0.105604,-0.0561841,-0.238679,0.331352,0.348262,-0.0654908,-1.04148,-0.39253},
+{-1.73263,0.56412,0.790091,-0.350418,-1.3668,0.881681,0.570515,-0.11346},
+{-1.29172,-1.0458,1.03927,1.78312,0.209826,-0.878176,-0.667996,0.311771},
+{-2.02997,0.76276,-0.48451,-1.12103,0.0675854,0.666788,0.288789,0.311225},
+{1.28467,-0.216596,-0.248218,-0.76594,0.639806,-0.744657,0.995064,-1.01644},
+{-1.06103,0.557376,-1.46966,0.0673947,-0.531373,0.480932,-0.0105433,0.789753},
+{1.32469,1.42319,0.548429,-0.803708,-1.43431,-1.34565,-0.297593,0.547584},
+{-0.273803,1.04973,-0.174112,0.232881,0.405845,-0.512552,0.344319,-0.815064},
+{2.51955,1.57409,-1.39338,-0.937761,-0.0497074,-0.128205,-0.333554,-0.52516},
+{-0.352971,0.713345,-0.558412,-0.431516,-0.635593,-0.135521,-1.30022,0.669742},
+{0.246198,-0.698022,0.335394,-0.502827,1.58476,-0.426501,-0.796604,1.11315},
+{-0.367488,-0.503223,-0.211863,-0.525563,0.0375716,0.204918,2.01842,1.15478},
+{0.107188,-0.719032,-0.648959,-2.39294,2.46049,0.850218,0.18543,0.701523},
+{0.407559,1.31236,-2.89593,0.611598,-0.152036,-0.72166,0.920559,-0.383882},
+{1.28091,0.925667,0.313489,-1.10136,0.191921,0.638277,-0.356922,-1.11068},
+{-0.240606,-0.443837,0.155519,-0.470245,0.906559,-0.213211,2.30216,-0.722409},
+{-1.41226,-0.288547,0.332802,-0.187539,0.796591,-0.41168,-0.356223,1.33626},
+{-0.114571,-0.371635,0.108278,1.38411,-0.191887,1.28419,-0.0299939,-1.14145},
+{-1.13655,0.332799,1.10611,1.91257,0.726154,0.0727846,-0.652235,-1.19888},
+{0.189963,1.40878,-1.27619,1.09449,0.284361,-0.527403,-0.734522,-0.0705183},
+{-1.05085,0.810117,-0.641032,-0.283443,0.657092,-1.1502,0.777061,0.503461},
+{-0.0696791,0.188862,-0.0880076,0.11709,-0.262023,0.181331,-0.677646,2.10793},
+{-0.169008,0.192039,-0.110151,2.07904,-0.599761,-1.58628,1.00301,-0.0286543},
+{-0.2082,-1.1611,-0.715412,-0.0343943,1.20253,-0.988453,0.73203,0.740159},
+{0.738459,-1.18892,0.49685,-0.0177689,-0.458849,0.170949,-0.459235,1.25229},
+{0.345414,-0.120539,-0.481404,-1.75731,0.0219378,1.44327,-0.574763,1.36348},
+{-0.404927,-0.615118,0.908928,0.34826,-0.27947,0.389891,-1.43437,-0.0741029},
+{-1.56463,-0.364887,2.75591,0.667894,-0.57053,-0.13117,0.538331,-0.0885438},
+{0.518327,-0.215243,0.050454,-2.86284,-0.619997,0.155151,2.06075,0.471453},
+{-0.62011,-0.352696,-0.145548,0.876026,0.666619,-0.413956,1.11097,-1.30323},
+{-0.385767,0.170404,0.538993,0.961485,0.891708,1.22576,0.960098,1.11406},
+{0.388173,-0.598376,-1.7336,0.129233,-0.1874,1.26948,0.0620169,-0.0968803},
+{-0.19228,-0.471001,0.641792,-0.304033,0.772593,-1.03034,0.604548,-0.543104},
+{0.236728,0.232818,1.44882,-1.05148,-0.828635,-0.531352,1.08306,-0.814594},
+{-0.717436,-0.477879,0.650262,0.726283,0.623916,0.184593,0.138505,-0.0524061},
+{-1.65222,-0.3664,0.264498,-0.335065,0.462571,1.50107,-0.68202,0.38008},
+{0.852734,-0.893088,0.822156,-0.737121,0.493278,-0.482329,0.219251,-0.160266},
+{0.733272,0.0144073,1.1664,-1.4086,-2.45165,1.45537,-0.0296166,-0.0845569},
+{0.246836,0.26554,0.549598,-0.23729,-0.0491141,-0.575949,-0.311769,-0.230354},
+{0.128284,-0.261473,0.105539,0.293469,0.51569,0.803836,1.89172,-3.07493},
+{1.64698,-0.329134,-1.20051,0.000372357,0.810401,0.779316,-0.37545,-1.23125},
+{-0.132155,0.419303,-0.732552,0.667706,-0.626713,0.339305,-0.32,0.289691},
+{0.808921,0.354669,0.392377,0.671615,-0.803726,-1.28414,-0.556139,0.0837814},
+{0.835236,0.620821,0.717716,-0.0309147,-0.223465,0.124068,0.667246,1.04023},
+{-0.0521935,0.618173,0.241935,-2.14632,1.49656,-0.491607,0.372421,-0.678658},
+{-0.40883,0.823298,-1.92246,-0.388639,1.55592,0.392341,-1.13516,0.595127},
+{-0.958854,2.3407,1.30073,-0.280573,0.911012,-1.05048,-0.513848,-0.546581},
+{-0.17029,-0.09665,-0.684148,0.150044,-2.35408,1.49623,2.21859,-0.0558014},
+{-1.19796,-0.719742,-0.263796,-0.494669,-0.723702,-0.821728,-0.638013,-0.151613},
+{0.410444,-1.75187,0.966378,-0.396605,-0.975379,0.0302732,1.08905,0.168156},
+{0.195242,0.309484,1.07001,0.591054,-0.535163,-3.19281,0.13333,0.269121}};
index 65adc1b..b5f32d4 100644 (file)
@@ -519,6 +519,7 @@ float *exc2
       }
    }
 
+   /*printf ("pitch: %d %d\n", best_pitch, best_gain_index);*/
    speex_bits_pack(bits, best_pitch-start, params->pitch_bits);
    speex_bits_pack(bits, best_gain_index, params->gain_bits);
    /*printf ("encode pitch: %d %d\n", best_pitch, best_gain_index);*/
index 2d7bc42..4f54e06 100644 (file)
@@ -429,7 +429,7 @@ void nb_encode(void *state, float *in, FrameBits *bits)
          ener=sign/sqrt(.01+ener/st->subframeSize);
          for (i=0;i<st->subframeSize;i++)
          {
-            if (i%8==0)
+            if (i%4==0)
                printf ("\nexc ");
             printf ("%f ", ener*st->buf2[i]);
          }
@@ -441,7 +441,7 @@ void nb_encode(void *state, float *in, FrameBits *bits)
 #else
       if (0)
       {
-      /* Perform a split-codebook search */
+      /* Perform innovation search */
       st->innovation_quant(target, st->interp_qlpc, st->bw_lpc1, st->bw_lpc2,
                            st->innovation_params, st->lpcSize,
                            st->subframeSize, exc, bits, st->stack);
@@ -468,7 +468,6 @@ void nb_encode(void *state, float *in, FrameBits *bits)
                qe=63;
             ener = exp(qe/7.0);
             speex_bits_pack(bits, qe, 6);
-            /*printf ("quant_energy: %d %f\n", qe, ener);*/
          }
          ener_1 = 1/ener;
          
index ab9e3b9..d6fa747 100644 (file)
@@ -393,7 +393,7 @@ void sb_encode(void *state, float *in, FrameBits *bits)
    {
       float *exc, *sp, *mem, *res, *target, *sw, tmp, filter_ratio;
       int offset;
-      float rl, rh;
+      float rl, rh, eh=0, el=0;
       int fold;
 
       offset = st->subframeSize*sub;
@@ -443,18 +443,19 @@ void sb_encode(void *state, float *in, FrameBits *bits)
       /*printf ("filter_ratio %f\n", filter_ratio);*/
       fold=0;
 
+      /* Compute "real excitation" */
+      residue_mem(sp, st->interp_qlpc, exc, st->subframeSize, st->lpcSize, st->mem_sp2);
+      /* Compute energy of low-band and high-band excitation */
+      for (i=0;i<st->subframeSize;i++)
+         eh+=sqr(exc[i]);
+      for (i=0;i<st->subframeSize;i++)
+         el+=sqr(((EncState*)st->st_low)->exc[offset+i]);
+
       if (fold) {/* 1 for spectral folding excitation, 0 for stochastic */
-         float el=0,eh=0,g;
+         float g;
          /*speex_bits_pack(bits, 1, 1);*/
-         /* Compute "real excitation" */
-         residue_mem(sp, st->interp_qlpc, exc, st->subframeSize, st->lpcSize, st->mem_sp2);
 
 #if 1
-         /* Compute energy of low-band and high-band excitation */
-         for (i=0;i<st->subframeSize;i++)
-            eh+=sqr(exc[i]);
-         for (i=0;i<st->subframeSize;i++)
-            el+=sqr(((EncState*)st->st_low)->exc[offset+i]);
          /* Gain to use if we want to use the low-band excitation for high-band */
          g=eh/(.01+el);
          g=sqrt(g);
@@ -484,17 +485,40 @@ void sb_encode(void *state, float *in, FrameBits *bits)
          /* FIXME: Update perceptually weighted signal in case we switch to the
             other mode */
       } else {
-         float el=0;
-         float gc;
+         float gc, scale, scale_1;
          float *innov;
 
          /*speex_bits_pack(bits, 0, 1);*/
          innov = PUSH(st->stack, st->subframeSize);
 
-         for (i=0;i<st->subframeSize;i++)
-            el+=sqr(((EncState*)st->st_low)->exc[offset+i]);
 
-         gc = (.01+filter_ratio)/(1+sqrt(el/st->subframeSize));
+         gc = sqrt(1+eh)*filter_ratio/sqrt((1+el)*st->subframeSize);
+
+         {
+            int qgc = (int)floor(.5+3.7*(log(gc)+2));
+            if (qgc<0)
+               qgc=0;
+            if (qgc>15)
+               qgc=15;
+            speex_bits_pack(bits, qgc, 4);
+            gc = exp((1/3.7)*qgc-2);
+         }
+
+         scale = gc*sqrt(1+el)/filter_ratio;
+         scale_1 = 1/scale;
+         if (0 && rand()%5==0)
+         {
+            float sc = 1/sqrt(.1+eh/st->subframeSize);
+            if (rand()&1)
+               sc=-sc;
+            for (i=0;i<st->subframeSize;i++)
+            {
+               float tmp=exc[i]*sc;
+               if (i%8==0)
+                  printf ("\nhexc");
+               printf (" %f", tmp);
+            }
+         }
 
          /* Reset excitation */
          for (i=0;i<st->subframeSize;i++)
@@ -528,7 +552,7 @@ void sb_encode(void *state, float *in, FrameBits *bits)
 
 
          for (i=0;i<st->subframeSize;i++)
-            target[i]*=gc;
+            target[i]*=scale_1;
          
          /* Reset excitation */
          for (i=0;i<st->subframeSize;i++)
@@ -541,7 +565,7 @@ void sb_encode(void *state, float *in, FrameBits *bits)
          /*print_vec(target, st->subframeSize, "after");*/
 
          for (i=0;i<st->subframeSize;i++)
-            exc[i] += innov[i]/gc;
+            exc[i] += innov[i]*scale;
 
          POP(st->stack);
       }
@@ -763,10 +787,18 @@ void sb_decode(void *state, FrameBits *bits, float *out)
          for (i=0;i<st->subframeSize;i++)
             exc[i]=g*((DecState*)st->st_low)->exc[offset+i];
       } else {
+         float gc, scale;
+         int qgc = speex_bits_unpack_unsigned(bits, 4);
+
+         gc = exp((1/3.7)*qgc-2);
+
+         scale = gc*sqrt(1+el)/filter_ratio;
+
+
          st->innovation_unquant(exc, st->innovation_params, st->subframeSize, 
                                 bits, st->stack);
          for (i=0;i<st->subframeSize;i++)
-            exc[i]*=gain;
+            exc[i]*=scale;
       }
       syn_filt_mem(exc, st->interp_qlpc, sp, st->subframeSize, st->lpcSize, st->mem_sp);