[FFmpeg-soc] [soc]: r5000 - in amr: amrnbdata.h amrnbdec.c

cmcq subversion at mplayerhq.hu
Sun Aug 9 01:57:10 CEST 2009


Author: cmcq
Date: Sun Aug  9 01:57:09 2009
New Revision: 5000

Log:
Store gains tables as 16-bit integers to save about 3KB

Modified:
   amr/amrnbdata.h
   amr/amrnbdec.c

Modified: amr/amrnbdata.h
==============================================================================
--- amr/amrnbdata.h	Sun Aug  9 00:49:53 2009	(r4999)
+++ amr/amrnbdata.h	Sun Aug  9 01:57:09 2009	(r5000)
@@ -1619,25 +1619,17 @@ static const uint8_t gray_decode[8] = { 
 #define MIN_ENERGY -14.0
 
 /** scalar quantized pitch gain table for 7.95 and 12.2 kbps modes */
-static const float qua_gain_pit[16] = {
-0.0             , 0.20001220703125, 0.400146484375  , 0.5             ,
-0.5999755859375 , 0.70001220703125, 0.75            , 0.79998779296875,
-0.8499755859375 , 0.9000244140625 , 0.95001220703125, 1.0             ,
-1.04998779296875, 1.0999755859375 , 1.1500244140625 , 1.20001220703125,
+static const uint16_t qua_gain_pit[16] = {
+     0,  3277,  6556,  8192,  9830, 11469, 12288, 13107,
+ 13926, 14746, 15565, 16384, 17203, 18022, 18842, 19661
 };
 
-/** scalar quantized fixed gain table for 7.95 and 12.2 kbps modes
- *
- * \note This table was generated from the integer qua_gain_code tables
- * in the reference source that store Q10 qua_ener = 20*log10(g_fac).
- * The table below stores g_fac as a float from
- * printf("%10.6f,\n", powf(10.0, qua_ener/(20.0*(1<<10)))). */
-static const float qua_gain_code[32] = {
- 0.077640,  0.100586,  0.130857,  0.170410,  0.204592,  0.235358,  0.270507,
- 0.311044,  0.357898,  0.411116,  0.473151,  0.543935,  0.625519,  0.719258,
- 0.827138,  0.951199,  1.094237,  1.258359,  1.446773,  1.664146,  1.913533,
- 2.200788,  2.530880,  2.910154,  3.347019,  3.849033,  4.426342,  5.090240,
- 6.108541,  7.940604, 10.323297, 13.420948,
+/** scalar quantized fixed gain table for 7.95 and 12.2 kbps modes */
+static const uint16_t qua_gain_code[32] = {
+   159,   206,   268,   349,   419,   482,   554,   637,
+   733,   842,   969,  1114,  1281,  1473,  1694,  1948,
+  2241,  2577,  2963,  3408,  3919,  4507,  5183,  5960,
+  6855,  7883,  9065, 10425, 12510, 16263, 21142, 27485
 };
 
 /** desired mean innovation energy, indexed by active mode */
@@ -1650,195 +1642,161 @@ static const float energy_pred_fac[4] = 
  *
  * first index has even/odd indexes for subframes 0,2/1,3
  * second index is {pitch_gain, fixed_gain_factor} */
-static const float gains_MODE_475[512][2] = {
-{0.049561, 0.031250}, {0.033081, 0.034180}, {0.175354, 0.277100}, {0.138306, 0.830566},
-{0.126160, 0.137451}, {0.773743, 0.157959}, {0.252197, 0.438965}, {0.341858, 1.290283},
-{0.469299, 0.091309}, {0.227966, 0.107666}, {0.666016, 0.644043}, {0.720642, 0.608887},
-{1.250610, 0.194580}, {0.318481, 0.164795}, {0.410400, 2.039551}, {0.322388, 0.414063},
-{0.090820, 0.104492}, {0.359009, 0.110352}, {0.325439, 0.994141}, {0.218689, 0.309570},
-{0.150696, 0.219971}, {0.970093, 0.245361}, {0.914429, 0.798584}, {0.630554, 1.186035},
-{0.221863, 0.493408}, {0.158447, 0.203857}, {0.754395, 1.194336}, {0.744995, 0.416016},
-{0.819824, 0.391602}, {0.556519, 0.571533}, {0.242188, 0.375488}, {0.334412, 2.425781},
-{0.231628, 0.101807}, {0.082947, 0.101074}, {0.222168, 0.383057}, {0.487976, 0.864502},
-{0.696106, 0.157471}, {0.521973, 0.155029}, {0.247559, 0.336182}, {1.013672, 1.495117},
-{0.697021, 0.170898}, {0.122498, 0.148193}, {0.757751, 0.385254}, {0.678650, 1.136230},
-{0.834961, 0.416992}, {0.731812, 0.300049}, {0.488037, 1.781494}, {0.807556, 1.395264},
-{0.148193, 0.282959}, {0.126526, 0.473877}, {0.379517, 1.494385}, {0.216431, 0.440430},
-{0.544739, 0.439941}, {0.529724, 0.385742}, {0.850525, 0.873047}, {0.812561, 1.522705},
-{0.374878, 0.275879}, {0.365845, 0.423340}, {0.863098, 1.138184}, {0.687927, 0.810791},
-{0.746216, 0.378662}, {0.850281, 0.736084}, {0.310120, 2.554688}, {0.576416, 1.637207},
-{0.103088, 0.166748}, {0.087646, 0.318848}, {0.440186, 0.960205}, {0.249146, 0.662354},
-{0.475647, 0.171875}, {0.919800, 0.195801}, {0.384460, 1.272461}, {0.264709, 1.307861},
-{0.407471, 0.132080}, {0.369995, 0.152832}, {0.833191, 0.903320}, {0.701782, 0.587891},
-{0.986084, 0.174805}, {0.743225, 0.183350}, {0.492249, 2.804932}, {0.385376, 0.550781},
-{0.272583, 0.121094}, {0.445129, 0.127686}, {0.623352, 0.935791}, {0.512329, 0.741455},
-{0.512878, 0.235840}, {0.868408, 0.458984}, {0.531189, 1.320557}, {1.000671, 1.187256},
-{0.452881, 0.483154}, {0.371643, 0.300293}, {0.571960, 1.073730}, {0.888550, 0.821045},
-{0.827576, 0.701416}, {0.803406, 0.357666}, {0.337769, 0.409668}, {0.801880, 3.606201},
-{0.447876, 0.146484}, {0.080444, 0.133789}, {0.259521, 0.864014}, {0.613037, 0.577148},
-{0.646179, 0.151855}, {0.798828, 0.163330}, {0.862183, 0.860840}, {0.307556, 2.388672},
-{0.936157, 0.151123}, {0.190125, 0.144043}, {1.003540, 0.735596}, {0.948608, 1.017578},
-{0.948303, 0.393311}, {0.940247, 0.299805}, {0.977966, 2.270264}, {0.459839, 1.214844},
-{0.121460, 0.296143}, {0.698669, 0.282471}, {0.763672, 1.347412}, {0.578308, 0.645508},
-{0.470947, 0.496582}, {0.810547, 0.546631}, {0.977234, 1.243408}, {0.492310, 1.650635},
-{0.615417, 0.344971}, {0.305298, 0.572998}, {0.764343, 1.458740}, {0.923218, 0.707764},
-{1.114746, 0.558838}, {0.966003, 0.616943}, {0.992737, 2.503418}, {0.894226, 2.763428},
-{0.109680, 0.082275}, {0.190125, 0.096924}, {0.214233, 0.714844}, {0.280273, 0.651855},
-{0.458923, 0.153320}, {0.696716, 0.160156}, {0.362915, 0.594482}, {0.399414, 1.798584},
-{0.502808, 0.202393}, {0.244141, 0.210693}, {0.612305, 0.608398}, {0.980042, 0.866943},
-{1.111084, 0.257324}, {0.372498, 0.354980}, {0.359131, 1.928711}, {1.144531, 0.846680},
-{0.113770, 0.132813}, {0.561401, 0.166748}, {0.709412, 1.015625}, {0.280396, 0.401367},
-{0.192749, 0.282471}, {0.973694, 0.625000}, {0.753723, 0.911377}, {1.063232, 1.284180},
-{0.372681, 0.489258}, {0.178040, 0.425293}, {1.005066, 1.283447}, {1.024597, 0.410156},
-{1.050110, 0.429443}, {0.291321, 0.788818}, {0.450806, 1.473389}, {0.875366, 2.444336},
-{0.246277, 0.107910}, {0.255981, 0.111816}, {0.562378, 0.547363}, {0.453308, 1.029541},
-{0.784912, 0.195557}, {0.682739, 0.201416}, {0.771973, 0.508789}, {0.790771, 1.600098},
-{0.580139, 0.243164}, {0.404602, 0.240479}, {0.643127, 0.610840}, {0.933167, 1.222168},
-{0.769165, 0.501709}, {0.945068, 0.403564}, {0.988403, 1.689697}, {0.868591, 1.413574},
-{0.160278, 0.202148}, {0.342712, 0.411621}, {0.833923, 1.410645}, {0.223877, 0.379395},
-{0.690491, 0.642822}, {0.596313, 0.356201}, {0.854675, 1.155518}, {0.970276, 1.535889},
-{0.383179, 0.456543}, {0.482788, 0.557861}, {1.036255, 1.115967}, {1.011719, 0.939697},
-{0.930664, 0.564209}, {0.977966, 0.791992}, {0.882507, 4.347656}, {0.723083, 0.674561},
-{0.120911, 0.343506}, {0.085449, 0.213867}, {0.264587, 0.865967}, {0.268005, 1.027832},
-{0.329895, 0.166016}, {1.065735, 0.190674}, {0.396790, 1.249512}, {0.493835, 1.874268},
-{0.448914, 0.193848}, {0.508606, 0.288574}, {0.918030, 0.771484}, {0.911133, 0.741943},
-{1.246399, 0.214844}, {0.887756, 0.208008}, {0.752991, 3.590820}, {0.421387, 0.468750},
-{0.257874, 0.227783}, {0.501587, 0.265381}, {0.650574, 0.997070}, {0.615356, 1.106689},
-{0.166931, 0.205078}, {1.260803, 0.263916}, {1.019958, 1.456543}, {0.968811, 1.117676},
-{0.663513, 0.628418}, {0.230286, 0.284668}, {0.886169, 0.987305}, {1.263367, 0.641357},
-{0.928894, 0.667480}, {0.932251, 0.533691}, {0.381897, 0.787598}, {0.801086, 4.755859},
-{0.439209, 0.227051}, {0.150269, 0.395020}, {0.275574, 0.754883}, {0.845459, 1.044189},
-{0.638428, 0.203369}, {1.058289, 0.197754}, {1.030945, 0.558838}, {0.948853, 2.006104},
-{0.830261, 0.411133}, {0.195129, 0.447754}, {0.973389, 0.688477}, {0.965088, 1.300537},
-{1.037964, 0.595215}, {1.024658, 0.323730}, {0.956482, 1.991211}, {0.715698, 2.088867},
-{0.229614, 0.501221}, {0.583679, 0.321533}, {0.827698, 1.657715}, {0.746277, 0.472656},
-{0.499268, 0.866699}, {0.810974, 0.434082}, {0.994812, 1.611084}, {0.994324, 1.894043},
-{0.520081, 0.622803}, {0.440979, 0.645752}, {1.115051, 1.828369}, {1.030579, 0.548828},
-{1.091431, 0.704102}, {1.053772, 0.812500}, {0.574768, 4.922363}, {0.673950, 2.031250},
-{0.078491, 0.151367}, {0.087341, 0.142334}, {0.365784, 0.558838}, {0.242798, 0.885254},
-{0.313965, 0.183594}, {0.818420, 0.202637}, {0.338928, 0.698242}, {0.718018, 1.442383},
-{0.655334, 0.136719}, {0.332397, 0.137695}, {0.813049, 0.734375}, {0.729126, 0.899170},
-{1.213806, 0.194824}, {0.599670, 0.177734}, {0.833923, 2.135742}, {0.451111, 0.745361},
-{0.153503, 0.189941}, {0.369263, 0.203369}, {0.394836, 1.238770}, {0.506897, 0.601318},
-{0.374817, 0.455322}, {0.934326, 0.308105}, {0.879395, 1.110107}, {0.833923, 1.102295},
-{0.191467, 0.728271}, {0.151306, 0.307373}, {0.920898, 1.134521}, {0.938843, 0.636475},
-{0.884521, 0.583984}, {0.760620, 0.619385}, {0.460144, 0.719971}, {0.787903, 2.944336},
-{0.333740, 0.166992}, {0.191711, 0.176270}, {0.310120, 0.311035}, {0.777100, 1.025391},
-{0.933960, 0.166260}, {0.477234, 0.144531}, {0.398804, 0.493408}, {1.005737, 2.133057},
-{0.815674, 0.215332}, {0.329407, 0.219482}, {0.894531, 0.531738}, {0.899719, 1.031982},
-{0.870972, 0.316895}, {0.850159, 0.495361}, {0.944641, 1.826660}, {0.965271, 1.116211},
-{0.153870, 0.491455}, {0.308960, 0.440430}, {0.314880, 1.606934}, {0.435181, 0.878174},
-{0.666504, 0.393311}, {0.715881, 0.416992}, {1.031677, 0.843506}, {0.992920, 1.621094},
-{0.567993, 0.245850}, {0.571838, 0.514160}, {1.170776, 1.229736}, {0.759338, 1.042236},
-{0.971619, 0.325195}, {0.937317, 0.857422}, {0.726196, 3.452393}, {0.982727, 1.673340},
-{0.122681, 0.179932}, {0.230652, 0.210205}, {0.699097, 0.703125}, {0.217529, 0.864258},
-{0.552795, 0.302979}, {0.756287, 0.218750}, {0.521606, 1.130127}, {0.705627, 1.410156},
-{0.496155, 0.143799}, {0.501587, 0.143555}, {1.143066, 0.916748}, {0.791809, 0.768799},
-{0.960022, 0.185059}, {1.015259, 0.184082}, {0.929077, 2.719238}, {0.968689, 0.539063},
-{0.285217, 0.148926}, {0.623657, 0.165527}, {0.931213, 1.012207}, {0.349670, 0.812256},
-{0.511292, 0.407715}, {1.212280, 0.566650}, {0.942993, 1.345459}, {0.857788, 1.338135},
-{0.349609, 0.705078}, {0.462646, 0.328613}, {0.877930, 1.300049}, {0.990967, 0.964355},
-{0.922729, 0.914063}, {0.934204, 0.350342}, {0.890930, 0.993652}, {0.750793, 3.832031},
-{0.464905, 0.414795}, {0.132446, 0.215820}, {0.272156, 1.114990}, {1.104370, 0.807129},
-{0.777710, 0.198975}, {0.911011, 0.221436}, {0.916504, 1.045166}, {0.947144, 2.042969},
-{1.098267, 0.265381}, {0.143921, 0.211182}, {0.993713, 0.924561}, {0.956970, 1.122070},
-{0.998291, 0.374512}, {1.012207, 0.539551}, {1.027405, 2.367432}, {0.972229, 1.101807},
-{0.200012, 0.264893}, {0.588562, 0.533936}, {0.730774, 1.481445}, {0.561462, 1.089355},
-{0.546570, 0.397705}, {0.627991, 0.747559}, {1.005920, 1.258545}, {0.943970, 1.725098},
-{0.834839, 0.620850}, {0.321838, 0.555908}, {1.022095, 1.516846}, {1.016541, 0.832031},
-{1.239258, 0.821045}, {1.140625, 0.484619}, {0.864990, 3.141357}, {0.924927, 3.833740},
-{0.273010, 0.249023}, {0.102600, 0.216309}, {0.263123, 1.050049}, {0.546387, 0.892822},
-{0.359680, 0.280029}, {0.710876, 0.354492}, {0.969604, 0.543701}, {0.279663, 1.622070},
-{0.422913, 0.294189}, {0.379639, 0.195068}, {0.757751, 0.832275}, {0.974609, 0.946533},
-{1.212097, 0.514893}, {0.591370, 0.522705}, {0.899780, 2.155762}, {0.883789, 0.634521},
-{0.110901, 0.302246}, {0.474304, 0.198486}, {1.164490, 1.076660}, {0.338989, 0.503906},
-{0.225037, 0.694336}, {1.064148, 0.550781}, {1.019104, 1.095215}, {0.988708, 1.315430},
-{0.489990, 0.674561}, {0.207825, 0.517334}, {1.063599, 1.337158}, {0.836060, 0.680176},
-{1.213318, 0.664063}, {0.555298, 0.947266}, {1.109131, 1.179932}, {1.058105, 2.980225},
-{0.312256, 0.243164}, {0.301208, 0.241211}, {0.603516, 0.752197}, {0.367065, 1.311279},
-{0.969299, 0.406982}, {0.513000, 0.288818}, {0.920837, 0.577637}, {1.207092, 1.709473},
-{0.730164, 0.381348}, {0.444275, 0.275391}, {1.028992, 0.374023}, {0.962036, 1.313721},
-{0.897705, 0.504150}, {1.227112, 0.526123}, {1.047241, 2.012939}, {1.093201, 1.542480},
-{0.333679, 0.367188}, {0.250244, 0.628418}, {1.063293, 1.662598}, {0.346252, 0.705078},
-{1.015381, 0.825684}, {0.547791, 0.447021}, {1.230408, 1.156494}, {1.193237, 1.780762},
-{0.406372, 0.678955}, {0.700195, 0.810791}, {1.183899, 1.233887}, {1.152222, 1.152832},
-{1.003357, 0.579346}, {1.246948, 1.070801}, {0.692932, 6.476074}, {0.707581, 0.749023},
-{0.174927, 0.382324}, {0.311768, 0.261230}, {0.586792, 1.199951}, {0.301453, 0.863281},
-{0.460266, 0.214355}, {1.264465, 0.207764}, {0.423462, 1.072998}, {1.025330, 1.887939},
-{0.618713, 0.248779}, {0.600891, 0.235352}, {0.945679, 0.965576}, {0.943542, 0.837402},
-{1.151306, 0.239746}, {1.228027, 0.235107}, {1.030029, 3.146240}, {0.874878, 1.025391},
-{0.402771, 0.297852}, {0.562866, 0.198730}, {1.034058, 1.253418}, {0.345520, 1.195801},
-{0.334961, 0.438965}, {1.236450, 0.967285}, {1.037903, 1.508301}, {1.094299, 1.447510},
-{0.571594, 0.834961}, {0.456177, 0.481201}, {1.192444, 1.263916}, {1.159851, 0.733887},
-{1.004272, 0.924805}, {0.980835, 0.577881}, {0.528809, 0.669678}, {0.576477, 6.435059},
-{0.662598, 0.314209}, {0.216980, 0.246338}, {0.342163, 0.884277}, {1.187317, 1.345703},
-{0.760071, 0.194580}, {1.259399, 0.222412}, {0.941589, 0.748535}, {1.039856, 2.508545},
-{1.152527, 0.642822}, {0.238831, 0.309570}, {1.191345, 0.822998}, {1.101807, 1.276855},
-{1.177429, 0.409668}, {1.190674, 0.774414}, {1.103027, 2.625488}, {1.014709, 1.671143},
-{0.191284, 0.561035}, {0.663391, 0.594971}, {0.950928, 1.687744}, {0.768860, 0.825439},
-{0.678467, 0.804932}, {1.023071, 0.591797}, {1.150696, 1.639404}, {1.048035, 2.413818},
-{0.777771, 0.635986}, {0.545471, 0.766602}, {1.161682, 1.895508}, {1.119812, 0.947266},
-{1.249695, 0.898926}, {1.196411, 0.825195}, {0.796143, 4.729736}, {0.642456, 5.645508},
+static const uint16_t gains_MODE_475[512][2] = {
+{  812,  128}, {  542,  140}, { 2873, 1135}, { 2266, 3402}, { 2067,  563},
+{12677,  647}, { 4132, 1798}, { 5601, 5285}, { 7689,  374}, { 3735,  441},
+{10912, 2638}, {11807, 2494}, {20490,  797}, { 5218,  675}, { 6724, 8354},
+{ 5282, 1696}, { 1488,  428}, { 5882,  452}, { 5332, 4072}, { 3583, 1268},
+{ 2469,  901}, {15894, 1005}, {14982, 3271}, {10331, 4858}, { 3635, 2021},
+{ 2596,  835}, {12360, 4892}, {12206, 1704}, {13432, 1604}, { 9118, 2341},
+{ 3968, 1538}, { 5479, 9936}, { 3795,  417}, { 1359,  414}, { 3640, 1569},
+{ 7995, 3541}, {11405,  645}, { 8552,  635}, { 4056, 1377}, {16608, 6124},
+{11420,  700}, { 2007,  607}, {12415, 1578}, {11119, 4654}, {13680, 1708},
+{11990, 1229}, { 7996, 7297}, {13231, 5715}, { 2428, 1159}, { 2073, 1941},
+{ 6218, 6121}, { 3546, 1804}, { 8925, 1802}, { 8679, 1580}, {13935, 3576},
+{13313, 6237}, { 6142, 1130}, { 5994, 1734}, {14141, 4662}, {11271, 3321},
+{12226, 1551}, {13931, 3015}, { 5081,10464}, { 9444, 6706}, { 1689,  683},
+{ 1436, 1306}, { 7212, 3933}, { 4082, 2713}, { 7793,  704}, {15070,  802},
+{ 6299, 5212}, { 4337, 5357}, { 6676,  541}, { 6062,  626}, {13651, 3700},
+{11498, 2408}, {16156,  716}, {12177,  751}, { 8065,11489}, { 6314, 2256},
+{ 4466,  496}, { 7293,  523}, {10213, 3833}, { 8394, 3037}, { 8403,  966},
+{14228, 1880}, { 8703, 5409}, {16395, 4863}, { 7420, 1979}, { 6089, 1230},
+{ 9371, 4398}, {14558, 3363}, {13559, 2873}, {13163, 1465}, { 5534, 1678},
+{13138,14771}, { 7338,  600}, { 1318,  548}, { 4252, 3539}, {10044, 2364},
+{10587,  622}, {13088,  669}, {14126, 3526}, { 5039, 9784}, {15338,  619},
+{ 3115,  590}, {16442, 3013}, {15542, 4168}, {15537, 1611}, {15405, 1228},
+{16023, 9299}, { 7534, 4976}, { 1990, 1213}, {11447, 1157}, {12512, 5519},
+{ 9475, 2644}, { 7716, 2034}, {13280, 2239}, {16011, 5093}, { 8066, 6761},
+{10083, 1413}, { 5002, 2347}, {12523, 5975}, {15126, 2899}, {18264, 2289},
+{15827, 2527}, {16265,10254}, {14651,11319}, { 1797,  337}, { 3115,  397},
+{ 3510, 2928}, { 4592, 2670}, { 7519,  628}, {11415,  656}, { 5946, 2435},
+{ 6544, 7367}, { 8238,  829}, { 4000,  863}, {10032, 2492}, {16057, 3551},
+{18204, 1054}, { 6103, 1454}, { 5884, 7900}, {18752, 3468}, { 1864,  544},
+{ 9198,  683}, {11623, 4160}, { 4594, 1644}, { 3158, 1157}, {15953, 2560},
+{12349, 3733}, {17420, 5260}, { 6106, 2004}, { 2917, 1742}, {16467, 5257},
+{16787, 1680}, {17205, 1759}, { 4773, 3231}, { 7386, 6035}, {14342,10012},
+{ 4035,  442}, { 4194,  458}, { 9214, 2242}, { 7427, 4217}, {12860,  801},
+{11186,  825}, {12648, 2084}, {12956, 6554}, { 9505,  996}, { 6629,  985},
+{10537, 2502}, {15289, 5006}, {12602, 2055}, {15484, 1653}, {16194, 6921},
+{14231, 5790}, { 2626,  828}, { 5615, 1686}, {13663, 5778}, { 3668, 1554},
+{11313, 2633}, { 9770, 1459}, {14003, 4733}, {15897, 6291}, { 6278, 1870},
+{ 7910, 2285}, {16978, 4571}, {16576, 3849}, {15248, 2311}, {16023, 3244},
+{14459,17808}, {11847, 2763}, { 1981, 1407}, { 1400,  876}, { 4335, 3547},
+{ 4391, 4210}, { 5405,  680}, {17461,  781}, { 6501, 5118}, { 8091, 7677},
+{ 7355,  794}, { 8333, 1182}, {15041, 3160}, {14928, 3039}, {20421,  880},
+{14545,  852}, {12337,14708}, { 6904, 1920}, { 4225,  933}, { 8218, 1087},
+{10659, 4084}, {10082, 4533}, { 2735,  840}, {20657, 1081}, {16711, 5966},
+{15873, 4578}, {10871, 2574}, { 3773, 1166}, {14519, 4044}, {20699, 2627},
+{15219, 2734}, {15274, 2186}, { 6257, 3226}, {13125,19480}, { 7196,  930},
+{ 2462, 1618}, { 4515, 3092}, {13852, 4277}, {10460,  833}, {17339,  810},
+{16891, 2289}, {15546, 8217}, {13603, 1684}, { 3197, 1834}, {15948, 2820},
+{15812, 5327}, {17006, 2438}, {16788, 1326}, {15671, 8156}, {11726, 8556},
+{ 3762, 2053}, { 9563, 1317}, {13561, 6790}, {12227, 1936}, { 8180, 3550},
+{13287, 1778}, {16299, 6599}, {16291, 7758}, { 8521, 2551}, { 7225, 2645},
+{18269, 7489}, {16885, 2248}, {17882, 2884}, {17265, 3328}, { 9417,20162},
+{11042, 8320}, { 1286,  620}, { 1431,  583}, { 5993, 2289}, { 3978, 3626},
+{ 5144,  752}, {13409,  830}, { 5553, 2860}, {11764, 5908}, {10737,  560},
+{ 5446,  564}, {13321, 3008}, {11946, 3683}, {19887,  798}, { 9825,  728},
+{13663, 8748}, { 7391, 3053}, { 2515,  778}, { 6050,  833}, { 6469, 5074},
+{ 8305, 2463}, { 6141, 1865}, {15308, 1262}, {14408, 4547}, {13663, 4515},
+{ 3137, 2983}, { 2479, 1259}, {15088, 4647}, {15382, 2607}, {14492, 2392},
+{12462, 2537}, { 7539, 2949}, {12909,12060}, { 5468,  684}, { 3141,  722},
+{ 5081, 1274}, {12732, 4200}, {15302,  681}, { 7819,  592}, { 6534, 2021},
+{16478, 8737}, {13364,  882}, { 5397,  899}, {14656, 2178}, {14741, 4227},
+{14270, 1298}, {13929, 2029}, {15477, 7482}, {15815, 4572}, { 2521, 2013},
+{ 5062, 1804}, { 5159, 6582}, { 7130, 3597}, {10920, 1611}, {11729, 1708},
+{16903, 3455}, {16268, 6640}, { 9306, 1007}, { 9369, 2106}, {19182, 5037},
+{12441, 4269}, {15919, 1332}, {15357, 3512}, {11898,14141}, {16101, 6854},
+{ 2010,  737}, { 3779,  861}, {11454, 2880}, { 3564, 3540}, { 9057, 1241},
+{12391,  896}, { 8546, 4629}, {11561, 5776}, { 8129,  589}, { 8218,  588},
+{18728, 3755}, {12973, 3149}, {15729,  758}, {16634,  754}, {15222,11138},
+{15871, 2208}, { 4673,  610}, {10218,  678}, {15257, 4146}, { 5729, 3327},
+{ 8377, 1670}, {19862, 2321}, {15450, 5511}, {14054, 5481}, { 5728, 2888},
+{ 7580, 1346}, {14384, 5325}, {16236, 3950}, {15118, 3744}, {15306, 1435},
+{14597, 4070}, {12301,15696}, { 7617, 1699}, { 2170,  884}, { 4459, 4567},
+{18094, 3306}, {12742,  815}, {14926,  907}, {15016, 4281}, {15518, 8368},
+{17994, 1087}, { 2358,  865}, {16281, 3787}, {15679, 4596}, {16356, 1534},
+{16584, 2210}, {16833, 9697}, {15929, 4513}, { 3277, 1085}, { 9643, 2187},
+{11973, 6068}, { 9199, 4462}, { 8955, 1629}, {10289, 3062}, {16481, 5155},
+{15466, 7066}, {13678, 2543}, { 5273, 2277}, {16746, 6213}, {16655, 3408},
+{20304, 3363}, {18688, 1985}, {14172,12867}, {15154,15703}, { 4473, 1020},
+{ 1681,  886}, { 4311, 4301}, { 8952, 3657}, { 5893, 1147}, {11647, 1452},
+{15886, 2227}, { 4582, 6644}, { 6929, 1205}, { 6220,  799}, {12415, 3409},
+{15968, 3877}, {19859, 2109}, { 9689, 2141}, {14742, 8830}, {14480, 2599},
+{ 1817, 1238}, { 7771,  813}, {19079, 4410}, { 5554, 2064}, { 3687, 2844},
+{17435, 2256}, {16697, 4486}, {16199, 5388}, { 8028, 2763}, { 3405, 2119},
+{17426, 5477}, {13698, 2786}, {19879, 2720}, { 9098, 3880}, {18172, 4833},
+{17336,12207}, { 5116,  996}, { 4935,  988}, { 9888, 3081}, { 6014, 5371},
+{15881, 1667}, { 8405, 1183}, {15087, 2366}, {19777, 7002}, {11963, 1562},
+{ 7279, 1128}, {16859, 1532}, {15762, 5381}, {14708, 2065}, {20105, 2155},
+{17158, 8245}, {17911, 6318}, { 5467, 1504}, { 4100, 2574}, {17421, 6810},
+{ 5673, 2888}, {16636, 3382}, { 8975, 1831}, {20159, 4737}, {19550, 7294},
+{ 6658, 2781}, {11472, 3321}, {19397, 5054}, {18878, 4722}, {16439, 2373},
+{20430, 4386}, {11353,26526}, {11593, 3068}, { 2866, 1566}, { 5108, 1070},
+{ 9614, 4915}, { 4939, 3536}, { 7541,  878}, {20717,  851}, { 6938, 4395},
+{16799, 7733}, {10137, 1019}, { 9845,  964}, {15494, 3955}, {15459, 3430},
+{18863,  982}, {20120,  963}, {16876,12887}, {14334, 4200}, { 6599, 1220},
+{ 9222,  814}, {16942, 5134}, { 5661, 4898}, { 5488, 1798}, {20258, 3962},
+{17005, 6178}, {17929, 5929}, { 9365, 3420}, { 7474, 1971}, {19537, 5177},
+{19003, 3006}, {16454, 3788}, {16070, 2367}, { 8664, 2743}, { 9445,26358},
+{10856, 1287}, { 3555, 1009}, { 5606, 3622}, {19453, 5512}, {12453,  797},
+{20634,  911}, {15427, 3066}, {17037,10275}, {18883, 2633}, { 3913, 1268},
+{19519, 3371}, {18052, 5230}, {19291, 1678}, {19508, 3172}, {18072,10754},
+{16625, 6845}, { 3134, 2298}, {10869, 2437}, {15580, 6913}, {12597, 3381},
+{11116, 3297}, {16762, 2424}, {18853, 6715}, {17171, 9887}, {12743, 2605},
+{ 8937, 3140}, {19033, 7764}, {18347, 3880}, {20475, 3682}, {19602, 3380},
+{13044,19373}, {10526,23124}
 };
 
 /** gain table for 6.70, 7.40 and 10.2 kbps modes
  *
  * second index is {pitch_gain, fixed_gain_factor} */
-static const float gains_high[128][2] = {
-{0.0352173, 0.161621 }, {0.0491943, 0.448242 }, {0.189758 , 0.256836 }, {0.255188 , 0.338623 },
-{0.144836 , 0.347900 }, {0.198242 , 0.484619 }, {0.111511 , 0.566406 }, {0.0574341, 0.809082 },
-{0.143494 , 0.726807 }, {0.220703 , 0.590820 }, {0.210632 , 0.755859 }, {0.180359 , 1.05005  },
-{0.112793 , 1.09863  }, {0.237061 , 1.32227  }, {0.0724487, 1.76025  }, {0.188171 , 2.19727  },
-{0.450684 , 0.215576 }, {0.363892 , 0.367676 }, {0.314636 , 0.520996 }, {0.484863 , 0.490479 },
-{0.397156 , 0.549316 }, {0.468140 , 0.671875 }, {0.363281 , 0.736328 }, {0.298950 , 0.918945 },
-{0.426575 , 0.875977 }, {0.498901 , 0.971191 }, {0.370117 , 1.07520  }, {0.470520 , 1.24194  },
-{0.337097 , 1.46997  }, {0.474182 , 1.73975  }, {0.369873 , 1.93799  }, {0.341431 , 2.80444  },
-{0.645813 , 0.331055 }, {0.552307 , 0.389893 }, {0.597778 , 0.496826 }, {0.546021 , 0.589600 },
-{0.628418 , 0.630859 }, {0.574158 , 0.667480 }, {0.531006 , 0.785645 }, {0.595520 , 0.828857 },
-{0.621155 , 0.950195 }, {0.559692 , 1.10547  }, {0.619629 , 1.22168  }, {0.556274 , 1.40015  },
-{0.640869 , 1.52979  }, {0.617065 , 1.86304  }, {0.539795 , 2.13062  }, {0.546631 , 3.05078  },
-{0.788818 , 0.238281 }, {0.697937 , 0.428467 }, {0.740845 , 0.568359 }, {0.695068 , 0.578125 },
-{0.653076 , 0.748047 }, {0.752686 , 0.698486 }, {0.715454 , 0.812256 }, {0.687866 , 0.903320 },
-{0.662903 , 1.07739  }, {0.737427 , 1.10669  }, {0.688660 , 1.27075  }, {0.729980 , 1.53931  },
-{0.681580 , 1.83936  }, {0.740234 , 2.03345  }, {0.669495 , 2.63110  }, {0.628662 , 4.24219  },
-{0.848328 , 0.410400 }, {0.767822 , 0.499268 }, {0.809631 , 0.595459 }, {0.856506 , 0.729736 },
-{0.821045 , 0.756348 }, {0.756592 , 0.893066 }, {0.824585 , 0.922852 }, {0.786133 , 1.04297  },
-{0.825989 , 1.18677  }, {0.773132 , 1.33228  }, {0.845581 , 1.49072  }, {0.795349 , 1.58276  },
-{0.827454 , 1.88501  }, {0.790833 , 2.27319  }, {0.837036 , 2.82007  }, {0.768494 , 3.71240  },
-{0.922424 , 0.375977 }, {0.919922 , 0.569580 }, {0.886658 , 0.613037 }, {0.896729 , 0.781006 },
-{0.938843 , 0.869141 }, {0.862610 , 0.966797 }, {0.921753 , 1.03418  }, {0.874756 , 1.17773  },
-{0.906128 , 1.33081  }, {0.934204 , 1.48511  }, {0.874573 , 1.68164  }, {0.919189 , 1.87720  },
-{0.879272 , 2.30127  }, {0.939148 , 2.37817  }, {0.904785 , 3.48413  }, {0.830078 , 6.08862  },
-{1.00073  , 0.480713 }, {1.02643  , 0.691406 }, {0.959045 , 0.694092 }, {0.982910 , 0.814453 },
-{1.00000  , 0.967529 }, {1.03394  , 1.11792  }, {0.958923 , 1.12280  }, {0.990112 , 1.33008  },
-{1.02734  , 1.55811  }, {0.960999 , 1.74341  }, {0.996460 , 1.82349  }, {1.01385  , 2.10547  },
-{1.03931  , 2.54346  }, {0.970764 , 2.88501  }, {1.03015  , 3.58643  }, {1.00800  , 5.09521  },
-{1.10730  , 0.508545 }, {1.18414  , 0.775879 }, {1.06860  , 0.836426 }, {1.22400  , 0.983154 },
-{1.10284  , 1.03735  }, {1.15674  , 1.23682  }, {1.08099  , 1.31885  }, {1.21063  , 1.51172  },
-{1.09558  , 1.71240  }, {1.30115  , 1.92310  }, {1.09314  , 2.26782  }, {1.16846  , 2.26807  },
-{1.25226  , 2.77856  }, {1.10321  , 3.53638  }, {1.22064  , 4.36572  }, {1.15002  , 7.99902  },
+static const uint16_t gains_high[128][2] = {
+{  577,  662}, {  806, 1836}, { 3109, 1052}, { 4181, 1387}, { 2373, 1425},
+{ 3248, 1985}, { 1827, 2320}, {  941, 3314}, { 2351, 2977}, { 3616, 2420},
+{ 3451, 3096}, { 2955, 4301}, { 1848, 4500}, { 3884, 5416}, { 1187, 7210},
+{ 3083, 9000}, { 7384,  883}, { 5962, 1506}, { 5155, 2134}, { 7944, 2009},
+{ 6507, 2250}, { 7670, 2752}, { 5952, 3016}, { 4898, 3764}, { 6989, 3588},
+{ 8174, 3978}, { 6064, 4404}, { 7709, 5087}, { 5523, 6021}, { 7769, 7126},
+{ 6060, 7938}, { 5594,11487}, {10581, 1356}, { 9049, 1597}, { 9794, 2035},
+{ 8946, 2415}, {10296, 2584}, { 9407, 2734}, { 8700, 3218}, { 9757, 3395},
+{10177, 3892}, { 9170, 4528}, {10152, 5004}, { 9114, 5735}, {10500, 6266},
+{10110, 7631}, { 8844, 8727}, { 8956,12496}, {12924,  976}, {11435, 1755},
+{12138, 2328}, {11388, 2368}, {10700, 3064}, {12332, 2861}, {11722, 3327},
+{11270, 3700}, {10861, 4413}, {12082, 4533}, {11283, 5205}, {11960, 6305},
+{11167, 7534}, {12128, 8329}, {10969,10777}, {10300,17376}, {13899, 1681},
+{12580, 2045}, {13265, 2439}, {14033, 2989}, {13452, 3098}, {12396, 3658},
+{13510, 3780}, {12880, 4272}, {13533, 4861}, {12667, 5457}, {13854, 6106},
+{13031, 6483}, {13557, 7721}, {12957, 9311}, {13714,11551}, {12591,15206},
+{15113, 1540}, {15072, 2333}, {14527, 2511}, {14692, 3199}, {15382, 3560},
+{14133, 3960}, {15102, 4236}, {14332, 4824}, {14846, 5451}, {15306, 6083},
+{14329, 6888}, {15060, 7689}, {14406, 9426}, {15387, 9741}, {14824,14271},
+{13600,24939}, {16396, 1969}, {16817, 2832}, {15713, 2843}, {16104, 3336},
+{16384, 3963}, {16940, 4579}, {15711, 4599}, {16222, 5448}, {16832, 6382},
+{15745, 7141}, {16326, 7469}, {16611, 8624}, {17028,10418}, {15905,11817},
+{16878,14690}, {16515,20870}, {18142, 2083}, {19401, 3178}, {17508, 3426},
+{20054, 4027}, {18069, 4249}, {18952, 5066}, {17711, 5402}, {19835, 6192},
+{17950, 7014}, {21318, 7877}, {17910, 9289}, {19144, 9290}, {20517,11381},
+{18075,14485}, {19999,17882}, {18842,32764}
 };
 
 /** gain table for 5.15 and 5.90 kbps modes
  *
  * second index is {pitch_gain, fixed_gain_factor} */
-static const float gains_low[64][2] = {
-{0.659973 , 7.01978  }, {1.25000  , 0.679932 }, {1.14996  , 1.60986  }, {0.379944 , 1.80981  },
-{1.04999  , 2.54980  }, {1.31995  , 0.309814 }, {1.28998  , 1.07983  }, {0.689941 , 0.379883 },
-{1.15997  , 3.12988  }, {1.06000  , 0.609863 }, {1.08997  , 1.17993  }, {0.609985 , 0.609863 },
-{1.06995  , 1.91992  }, {0.869995 , 0.459961 }, {0.969971 , 0.769775 }, {0.409973 , 0.439941 },
-{1.10999  , 4.92993  }, {1.09998  , 0.739990 }, {1.01996  , 1.42993  }, {0.539978 , 0.979980 },
-{0.969971 , 2.18994  }, {1.09998  , 0.339844 }, {1.01996  , 1.00000  }, {0.500000 , 0.159912 },
-{0.929993 , 3.39990  }, {0.869995 , 0.759766 }, {0.859985 , 1.13989  }, {0.329956 , 0.659912 },
-{0.819946 , 1.59985  }, {0.759949 , 0.219971 }, {0.759949 , 0.649902 }, {0.229980 , 0.159912 },
-{0.899963 , 5.73999  }, {1.16998  , 0.599854 }, {1.22998  , 1.23999  }, {0.419983 , 1.00000  },
-{1.25000  , 2.08984  }, {1.19995  , 0.179932 }, {1.15997  , 1.03979  }, {0.479980 , 0.509766 },
-{0.699951 , 3.00000  }, {0.969971 , 0.359863 }, {0.959961 , 1.12988  }, {0.559998 , 0.349854 },
-{0.979980 , 1.70996  }, {0.904968 , 0.179932 }, {0.919983 , 0.549805 }, {0.309998 , 0.299805 },
-{0.809998 , 4.22998  }, {1.00995  , 0.569824 }, {0.919983 , 1.41992  }, {0.239990 , 0.899902 },
-{0.869995 , 2.09985  }, {1.02997  , 0.189941 }, {0.919983 , 0.929932 }, {0.369995 , 0.149902 },
-{0.569946 , 2.25977  }, {0.809998 , 0.429932 }, {0.809998 , 0.859863 }, {0.149963 , 0.479980 },
-{0.699951 , 1.34985  }, {0.639954 , 0.179932 }, {0.709961 , 0.779785 }, {0.0899658, 0.189941 },
+static const uint16_t gains_low[64][2] = {
+{10813,28753}, {20480, 2785}, {18841, 6594}, { 6225, 7413}, {17203,10444},
+{21626, 1269}, {21135, 4423}, {11304, 1556}, {19005,12820}, {17367, 2498},
+{17858, 4833}, { 9994, 2498}, {17530, 7864}, {14254, 1884}, {15892, 3153},
+{ 6717, 1802}, {18186,20193}, {18022, 3031}, {16711, 5857}, { 8847, 4014},
+{15892, 8970}, {18022, 1392}, {16711, 4096}, { 8192,  655}, {15237,13926},
+{14254, 3112}, {14090, 4669}, { 5406, 2703}, {13434, 6553}, {12451,  901},
+{12451, 2662}, { 3768,  655}, {14745,23511}, {19169, 2457}, {20152, 5079},
+{ 6881, 4096}, {20480, 8560}, {19660,  737}, {19005, 4259}, { 7864, 2088},
+{11468,12288}, {15892, 1474}, {15728, 4628}, { 9175, 1433}, {16056, 7004},
+{14827,  737}, {15073, 2252}, { 5079, 1228}, {13271,17326}, {16547, 2334},
+{15073, 5816}, { 3932, 3686}, {14254, 8601}, {16875,  778}, {15073, 3809},
+{ 6062,  614}, { 9338, 9256}, {13271, 1761}, {13271, 3522}, { 2457, 1966},
+{11468, 5529}, {10485,  737}, {11632, 3194}, { 1474,  778}
 };
 
 

Modified: amr/amrnbdec.c
==============================================================================
--- amr/amrnbdec.c	Sun Aug  9 00:49:53 2009	(r4999)
+++ amr/amrnbdec.c	Sun Aug  9 01:57:09 2009	(r5000)
@@ -721,18 +721,18 @@ static void decode_gains(AMRContext *p, 
                          float *fixed_gain_factor)
 {
     if (mode == MODE_122 || mode == MODE_795) {
-        p->pitch_gain[4]   = qua_gain_pit [amr_subframe->p_gain];
-        *fixed_gain_factor = qua_gain_code[amr_subframe->fixed_gain];
+        p->pitch_gain[4]   = qua_gain_pit [amr_subframe->p_gain    ] / 16384.0;
+        *fixed_gain_factor = qua_gain_code[amr_subframe->fixed_gain] / 2048.0;
     } else {
-        const float *gains =
+        const uint16_t *gains =
             mode >= MODE_67  ? gains_high[amr_subframe->p_gain] :
             mode >= MODE_515 ? gains_low [amr_subframe->p_gain] :
                 // gain index is only coded in subframes 0,2 for MODE_475
                 gains_MODE_475[(p->frame.subframe[subframe & 2].p_gain << 1) +
                                (subframe & 1)];
 
-        p->pitch_gain[4]   = gains[0];
-        *fixed_gain_factor = gains[1];
+        p->pitch_gain[4]   = gains[0] / 16384.0;
+        *fixed_gain_factor = gains[1] / 4096.0;
     }
 }
 


More information about the FFmpeg-soc mailing list