changeset 7843:58f33e404d6a libavcodec

Convert table to integer.
author vitor
date Wed, 10 Sep 2008 19:00:02 +0000
parents 3e7e3cb59bd4
children d35a71a3db5f
files ra288.c ra288.h
diffstat 2 files changed, 66 insertions(+), 130 deletions(-) [+]
line wrap: on
line diff
--- a/ra288.c	Tue Sep 09 19:20:20 2008 +0000
+++ b/ra288.c	Wed Sep 10 19:00:02 2008 +0000
@@ -93,7 +93,7 @@
     sumsum = exp(sum * 0.1151292546497) * gain; /* pow(10.0,sum/20)*gain */
 
     for (i=0; i < 5; i++)
-        buffer[i] = codetable[cb_coef][i] * sumsum;
+        buffer[i] = codetable[cb_coef][i] * sumsum * (1./2048.);
 
     sum = scalar_product_float(buffer, buffer, 5) / 5;
 
--- a/ra288.h	Tue Sep 09 19:20:20 2008 +0000
+++ b/ra288.h	Wed Sep 10 19:00:02 2008 +0000
@@ -27,135 +27,71 @@
     -0.515625, -0.90234375, -1.57910156, -2.76342773
 };
 
-static const float codetable[128][5]={
-{ 0.326171875,   -1.4404296875,  -0.6123046875,  -0.8740234375,  -1.24658203125},
-{-2.45703125,    -2.23486328125, -0.51025390625,  1.419921875,    1.6201171875 },
-{-1.37646484375, -1.30712890625, -0.462890625,   -1.37939453125, -2.1728515625 },
-{-3.26123046875, -0.166015625,    0.7236328125,  -0.623046875,    0.6162109375 },
-{-0.2744140625,  -3.29931640625,  0.62548828125,  0.08740234375, -0.6220703125 },
-{-1.2265625,     -3.4814453125,  -2.40478515625,  3.37548828125,  1.17724609375},
-{-1.2099609375,  -0.076171875,    2.28662109375, -1.89111328125,  0            },
-{-4.0078125,      1.044921875,   -0.2333984375,  -1.35986328125,  0.26025390625},
-{ 0.92236328125,  1.34716796875,  0.67431640625, -3.39599609375, -2.88720703125},
-{ 2.4814453125,  -1.201171875,   -2.8212890625,   0.87744140625,  0.27734375   },
-{-1.078125,      -1.61572265625, -2.20849609375, -3.044921875,   -3.66455078125},
-{-1.32763671875,  2.1279296875,  -1.458984375,   -0.56103515625,  1.30078125   },
-{ 0.61474609375,  0.48583984375,  1.32373046875, -1.203125,      -5.0732421875 },
-{ 0.8408203125,  -3.69580078125, -1.3388671875,   1.06005859375, -1.13720703125},
-{ 0.50390625,     0.36474609375, -0.4189453125,  -3.8798828125,  -6.27099609375},
-{ 1.5166015625,   2.37109375,    -2.04736328125, -1.24072265625,  0.50537109375},
-{ 0.9091796875,  -0.46875,       -3.236328125,    0.2001953125,   2.8720703125 },
-{-1.21728515625, -1.283203125,   -1.953125,      -0.029296875,    3.5166015625 },
-{-1.3046875,      0.7060546875,   0.75,          -1.87060546875,  0.60205078125},
-{-2.5888671875,   3.375,          0.77587890625, -2.04443359375,  1.78955078125},
-{-1.6875,        -3.9892578125,  -3.76416015625,  0.67578125,     2.2939453125 },
-{-2.29443359375, -3.03173828125, -5.45703125,     3.95703125,     8.2177734375 },
-{ 0.4541015625,   3.419921875,    0.61962890625, -4.38330078125,  1.25341796875},
-{ 2.27001953125,  5.763671875,    1.68017578125, -2.76220703125,  0.58544921875},
-{ 1.2412109375,  -0.08935546875, -4.32568359375, -3.89453125,     1.5771484375 },
-{-1.40234375,    -0.98193359375, -4.74267578125, -4.09423828125,  6.33935546875},
-{ 1.5068359375,   1.044921875,   -1.796875,      -4.70849609375, -1.4140625    },
-{-3.71533203125,  3.18115234375, -1.11474609375, -1.2314453125,   3.091796875  },
-{-1.62744140625, -2.744140625,   -4.4580078125,  -5.43505859375,  2.70654296875},
-{-0.19873046875, -3.28173828125, -8.5283203125,  -1.41064453125,  5.6484375    },
-{ 1.802734375,    3.318359375,   -0.1279296875,  -5.2958984375,  -0.90625      },
-{ 3.55224609375,  6.544921875,   -1.45947265625, -5.17333984375,  2.41015625   },
-{ 0.119140625,   -1.08349609375,  1.296875,       1.84375,       -2.642578125  },
-{-1.97412109375, -2.8974609375,   1.04052734375,  0.42138671875, -1.3994140625 },
-{-1.6123046875,   0.85107421875, -0.9794921875,  -0.0625,        -1.001953125  },
-{-3.10595703125,  1.6318359375,  -0.77294921875, -0.01025390625,  0.5576171875 },
-{-1.87353515625, -0.89404296875,  3.12353515625,  1.24267578125, -1.390625     },
-{-4.556640625,   -3.1875,         2.59228515625,  0.9697265625,  -1.09619140625},
-{-2.1923828125,   0.365234375,    0.94482421875, -1.47802734375, -0.24072265625},
-{-4.51904296875,  2.6201171875,   1.55908203125, -2.19384765625,  0.87109375   },
-{ 2.3359375,     -0.1806640625,   0.9111328125,   0.51611328125, -0.92236328125},
-{ 3.5849609375,  -1.3134765625,  -1.25830078125,  0.330078125,   -0.29833984375},
-{-0.2451171875,   1.09130859375, -0.9033203125,  -0.86767578125, -1.00048828125},
-{ 0.49365234375,  1.89453125,    -1.20361328125,  1.07861328125, -0.07421875   },
-{ 1.265625,       1.38134765625,  2.728515625,    1.38623046875, -3.5673828125 },
-{-1.48876953125, -2.4013671875,   2.90771484375,  4.49267578125, -2.17138671875},
-{ 0.34033203125,  1.908203125,    2.8310546875,  -2.17333984375, -2.267578125  },
-{-1.03564453125,  2.658203125,   -1.2548828125,   0.15673828125, -0.5869140625 },
-{ 1.3896484375,  -1.0185546875,   1.724609375,    0.2763671875,  -0.345703125  },
-{-2.08935546875,  0.4638671875,   2.431640625,    1.83056640625,  0.220703125  },
-{-1.212890625,    1.7099609375,   0.83935546875, -0.0830078125,   0.1162109375 },
-{-1.67724609375,  0.12841796875,  1.0322265625,  -0.97900390625,  1.15283203125},
-{-3.5830078125,  -0.58984375,     4.56396484375, -0.59375,       -1.95947265625},
-{-6.5908203125,  -0.21435546875,  3.919921875,   -2.06640625,     0.17626953125},
-{-1.82080078125,  2.65283203125,  0.978515625,   -2.30810546875, -0.61474609375},
-{-1.9462890625,   3.78076171875,  4.11572265625, -1.80224609375, -0.48193359375},
-{ 2.5380859375,  -0.20654296875,  0.5615234375,  -0.62548828125,  0.3984375    },
-{ 3.61767578125,  2.00634765625, -1.92822265625,  1.3134765625, 0.0146484384313},
-{ 0.6083984375,   1.49169921875, -0.01708984375, -0.6689453125,  -0.1201171875 },
-{-0.72705078125,  2.75146484375, -0.3310546875,  -1.28271484375,  1.5478515625 },
-{ 2.3583984375,  -2.23876953125,  0.98046875,    -0.5185546875,   0.39013671875},
-{-0.06298828125,  0.35009765625,  2.2431640625,   7.29345703125,  5.2275390625 },
-{ 0.20361328125,  1.34716796875,  0.9033203125,  -2.46923828125, -0.56298828125},
-{-1.89794921875,  3.59423828125, -2.81640625,     2.09228515625,  0.3251953125 },
-{ 0.70458984375, -0.4580078125,   0.009765625,   -1.03466796875, -0.82861328125},
-{-1.8125,        -1.6611328125,  -1.080078125,    0.0537109375,   1.04296875   },
-{-1.44140625,     0.005859375,   -0.765625,      -1.708984375,   -0.90576171875},
-{-0.64208984375, -0.84521484375,  0.56640625,    -0.2724609375,   0.83447265625},
-{ 0.04296875,    -2.23095703125,  0.0947265625,  -0.2216796875,  -1.44384765625},
-{-1.38623046875, -0.8134765625,  -0.13330078125,  1.017578125,   -0.07568359375},
-{-0.09228515625, -1.16015625,     0.81201171875, -0.5078125,     -1.19580078125},
-{-1.3876953125,  -0.66845703125,  0.310546875,   -0.12109375,    -1.30712890625},
-{ 0.74072265625,  0.03857421875, -1.47119140625, -1.79150390625, -0.47509765625},
-{ 0.93408203125, -1.21728515625, -2.59375,       -0.36572265625,  0.62060546875},
-{-1.41748046875, -1.623046875,   -1.833984375,   -1.8017578125,  -0.89306640625},
-{-1.42236328125, -0.75537109375, -1.34765625,    -0.6865234375,   0.548828125  },
-{ 0.900390625,   -0.8955078125,   0.22265625,     0.3447265625,  -2.0859375    },
-{ 0.22802734375, -2.078125,      -0.93212890625,  0.74267578125,  0.5537109375 },
-{-0.06201171875, -0.4853515625,  -0.31103515625, -0.72802734375, -3.1708984375 },
-{ 0.42626953125, -0.99853515625, -1.869140625,   -1.36328125,    -0.2822265625 },
-{ 1.12841796875, -0.88720703125,  1.28515625,    -1.490234375,    0.9609375    },
-{ 0.31298828125,  0.5830078125,   0.92431640625,  2.00537109375,  3.0966796875 },
-{-0.02197265625,  0.5849609375,   1.0546875,     -0.70751953125,  1.07568359375},
-{-0.978515625,    0.83642578125,  1.7177734375,   1.294921875,    2.07568359375},
-{ 1.43359375,    -1.9375,         0.625,          0.06396484375, -0.720703125  },
-{ 1.38037109375,  0.00390625,    -0.94140625,     1.2978515625,   1.71533203125},
-{ 1.56201171875, -0.3984375,      1.31201171875, -0.85009765625, -0.68701171875},
-{ 1.439453125,    1.96728515625,  0.1923828125,  -0.12353515625,  0.6337890625 },
-{ 2.0927734375,   0.02490234375, -2.20068359375, -0.015625,      -0.32177734375},
-{ 1.90576171875,  2.7568359375,  -2.728515625,   -1.265625,       2.78662109375},
-{-0.2958984375,   0.6025390625,  -0.78466796875, -2.53271484375,  0.32421875   },
-{-0.25634765625,  1.767578125,   -1.0703125,     -1.23388671875,  0.83349609375},
-{ 2.09814453125, -1.58740234375, -1.11474609375,  0.396484375,   -1.10546875   },
-{ 2.81494140625,  0.2578125,     -1.60498046875,  0.66015625,     0.81640625   },
-{ 1.33544921875,  0.60595703125, -0.53857421875, -1.59814453125, -1.66357421875},
-{ 1.96923828125,  0.8046875,     -1.44775390625, -0.5732421875,   0.705078125  },
-{ 0.0361328125,   0.4482421875,   0.97607421875,  0.44677734375, -0.5009765625 },
-{-1.21875,       -0.78369140625,  0.9931640625,   1.4404296875,   0.11181640625},
-{-1.05859375,     0.99462890625,0.00732421921566,-0.6171875,     -0.1015625    },
-{-1.734375,       0.7470703125,   0.28369140625,  0.72802734375,  0.4697265625 },
-{-1.27587890625, -1.1416015625,   1.76806640625, -0.7265625,     -1.06689453125},
-{-0.85302734375,  0.03955078125,  2.7041015625,   0.69921875,    -1.10205078125},
-{-0.49755859375,  0.42333984375,  0.1044921875,  -1.115234375,   -0.7373046875 },
-{-0.822265625,    1.375,         -0.11181640625,  1.24560546875, -0.67822265625},
-{ 1.32177734375,  0.24609375,     0.23388671875,  1.35888671875, -0.49267578125},
-{ 1.22900390625, -0.72607421875, -0.779296875,    0.30322265625,  0.94189453125},
-{-0.072265625,    1.0771484375,  -2.09375,        0.630859375,   -0.68408203125},
-{-0.25732421875,  0.60693359375, -1.33349609375,  0.93212890625,  0.625        },
-{ 1.04931640625, -0.73291015625,  1.80078125,     0.2978515625,  -2.24169921875},
-{ 1.6142578125,  -1.64501953125,  0.91552734375,  1.775390625,   -0.59423828125},
-{ 1.2568359375,   1.22705078125,  0.70751953125, -1.5009765625,  -2.43115234375},
-{ 0.3974609375,   0.8916015625,  -1.21923828125,  2.0673828125,  -1.99072265625},
-{ 0.8125,        -0.107421875,    1.6689453125,   0.4892578125,   0.54443359375},
-{ 0.38134765625,  0.8095703125,   1.91357421875,  2.9931640625,   1.533203125  },
-{ 0.560546875,    1.98486328125,  0.740234375,    0.39794921875,  0.09716796875},
-{ 0.58154296875,  1.21533203125,  1.25048828125,  1.18212890625,  1.19287109375},
-{ 0.3759765625,  -2.88818359375,  2.69287109375, -0.1796875,     -1.56201171875},
-{ 0.5810546875,   0.51123046875,  1.8271484375,   3.38232421875, -1.02001953125},
-{ 0.142578125,    1.51318359375,  2.103515625,   -0.3701171875,  -1.19873046875},
-{ 0.25537109375,  1.91455078125,  1.974609375,    0.6767578125,   0.04150390625},
-{ 2.13232421875,  0.4912109375,  -0.611328125,   -0.7158203125,  -0.67529296875},
-{ 1.880859375,    0.77099609375, -0.03759765625,  1.0078125,      0.423828125  },
-{ 2.49462890625,  1.42529296875, -0.0986328125,   0.17529296875, -0.24853515625},
-{ 1.7822265625,   1.5654296875,   1.12451171875,  0.82666015625,  0.6328125    },
-{ 1.41845703125, -1.90771484375,  0.11181640625, -0.583984375,   -1.138671875  },
-{ 2.91845703125, -1.75048828125,  0.39306640625,  1.86767578125, -1.5322265625 },
-{ 1.8291015625,  -0.2958984375,   0.02587890625, -0.13134765625, -1.61181640625},
-{ 0.2958984375,   0.9853515625,  -0.642578125,    1.984375,       0.1943359375 }
+static const int16_t codetable[128][5]={
+    {   668, -2950, -1254, -1790, -2553}, { -5032, -4577, -1045,  2908,  3318},
+    { -2819, -2677,  -948, -2825, -4450}, { -6679,  -340,  1482, -1276,  1262},
+    {  -562, -6757,  1281,   179, -1274}, { -2512, -7130, -4925,  6913,  2411},
+    { -2478,  -156,  4683, -3873,     0}, { -8208,  2140,  -478, -2785,   533},
+    {  1889,  2759,  1381, -6955, -5913}, {  5082, -2460, -5778,  1797,   568},
+    { -2208, -3309, -4523, -6236, -7505}, { -2719,  4358, -2988, -1149,  2664},
+    {  1259,   995,  2711, -2464,-10390}, {  1722, -7569, -2742,  2171, -2329},
+    {  1032,   747,  -858, -7946,-12843}, {  3106,  4856, -4193, -2541,  1035},
+    {  1862,  -960, -6628,   410,  5882}, { -2493, -2628, -4000,   -60,  7202},
+    { -2672,  1446,  1536, -3831,  1233}, { -5302,  6912,  1589, -4187,  3665},
+    { -3456, -8170, -7709,  1384,  4698}, { -4699, -6209,-11176,  8104, 16830},
+    {   930,  7004,  1269, -8977,  2567}, {  4649, 11804,  3441, -5657,  1199},
+    {  2542,  -183, -8859, -7976,  3230}, { -2872, -2011, -9713, -8385, 12983},
+    {  3086,  2140, -3680, -9643, -2896}, { -7609,  6515, -2283, -2522,  6332},
+    { -3333, -5620, -9130,-11131,  5543}, {  -407, -6721,-17466, -2889, 11568},
+    {  3692,  6796,  -262,-10846, -1856}, {  7275, 13404, -2989,-10595,  4936},
+    {   244, -2219,  2656,  3776, -5412}, { -4043, -5934,  2131,   863, -2866},
+    { -3302,  1743, -2006,  -128, -2052}, { -6361,  3342, -1583,   -21,  1142},
+    { -3837, -1831,  6397,  2545, -2848}, { -9332, -6528,  5309,  1986, -2245},
+    { -4490,   748,  1935, -3027,  -493}, { -9255,  5366,  3193, -4493,  1784},
+    {  4784,  -370,  1866,  1057, -1889}, {  7342, -2690, -2577,   676,  -611},
+    {  -502,  2235, -1850, -1777, -2049}, {  1011,  3880, -2465,  2209,  -152},
+    {  2592,  2829,  5588,  2839, -7306}, { -3049, -4918,  5955,  9201, -4447},
+    {   697,  3908,  5798, -4451, -4644}, { -2121,  5444, -2570,   321, -1202},
+    {  2846, -2086,  3532,   566,  -708}, { -4279,   950,  4980,  3749,   452},
+    { -2484,  3502,  1719,  -170,   238}, { -3435,   263,  2114, -2005,  2361},
+    { -7338, -1208,  9347, -1216, -4013}, {-13498,  -439,  8028, -4232,   361},
+    { -3729,  5433,  2004, -4727, -1259}, { -3986,  7743,  8429, -3691,  -987},
+    {  5198,  -423,  1150, -1281,   816}, {  7409,  4109, -3949,  2690,    30},
+    {  1246,  3055,   -35, -1370,  -246}, { -1489,  5635,  -678, -2627,  3170},
+    {  4830, -4585,  2008, -1062,   799}, {  -129,   717,  4594, 14937, 10706},
+    {   417,  2759,  1850, -5057, -1153}, { -3887,  7361, -5768,  4285,   666},
+    {  1443,  -938,    20, -2119, -1697}, { -3712, -3402, -2212,   110,  2136},
+    { -2952,    12, -1568, -3500, -1855}, { -1315, -1731,  1160,  -558,  1709},
+    {    88, -4569,   194,  -454, -2957}, { -2839, -1666,  -273,  2084,  -155},
+    {  -189, -2376,  1663, -1040, -2449}, { -2842, -1369,   636,  -248, -2677},
+    {  1517,    79, -3013, -3669,  -973}, {  1913, -2493, -5312,  -749,  1271},
+    { -2903, -3324, -3756, -3690, -1829}, { -2913, -1547, -2760, -1406,  1124},
+    {  1844, -1834,   456,   706, -4272}, {   467, -4256, -1909,  1521,  1134},
+    {  -127,  -994,  -637, -1491, -6494}, {   873, -2045, -3828, -2792,  -578},
+    {  2311, -1817,  2632, -3052,  1968}, {   641,  1194,  1893,  4107,  6342},
+    {   -45,  1198,  2160, -1449,  2203}, { -2004,  1713,  3518,  2652,  4251},
+    {  2936, -3968,  1280,   131, -1476}, {  2827,     8, -1928,  2658,  3513},
+    {  3199,  -816,  2687, -1741, -1407}, {  2948,  4029,   394,  -253,  1298},
+    {  4286,    51, -4507,   -32,  -659}, {  3903,  5646, -5588, -2592,  5707},
+    {  -606,  1234, -1607, -5187,   664}, {  -525,  3620, -2192, -2527,  1707},
+    {  4297, -3251, -2283,   812, -2264}, {  5765,   528, -3287,  1352,  1672},
+    {  2735,  1241, -1103, -3273, -3407}, {  4033,  1648, -2965, -1174,  1444},
+    {    74,   918,  1999,   915, -1026}, { -2496, -1605,  2034,  2950,   229},
+    { -2168,  2037,    15, -1264,  -208}, { -3552,  1530,   581,  1491,   962},
+    { -2613, -2338,  3621, -1488, -2185}, { -1747,    81,  5538,  1432, -2257},
+    { -1019,   867,   214, -2284, -1510}, { -1684,  2816,  -229,  2551, -1389},
+    {  2707,   504,   479,  2783, -1009}, {  2517, -1487, -1596,   621,  1929},
+    {  -148,  2206, -4288,  1292, -1401}, {  -527,  1243, -2731,  1909,  1280},
+    {  2149, -1501,  3688,   610, -4591}, {  3306, -3369,  1875,  3636, -1217},
+    {  2574,  2513,  1449, -3074, -4979}, {   814,  1826, -2497,  4234, -4077},
+    {  1664,  -220,  3418,  1002,  1115}, {   781,  1658,  3919,  6130,  3140},
+    {  1148,  4065,  1516,   815,   199}, {  1191,  2489,  2561,  2421,  2443},
+    {   770, -5915,  5515,  -368, -3199}, {  1190,  1047,  3742,  6927, -2089},
+    {   292,  3099,  4308,  -758, -2455}, {   523,  3921,  4044,  1386,    85},
+    {  4367,  1006, -1252, -1466, -1383}, {  3852,  1579,   -77,  2064,   868},
+    {  5109,  2919,  -202,   359,  -509}, {  3650,  3206,  2303,  1693,  1296},
+    {  2905, -3907,   229, -1196, -2332}, {  5977, -3585,   805,  3825, -3138},
+    {  3746,  -606,    53,  -269, -3301}, {   606,  2018, -1316,  4064,   398}
 };
 
 static const float syn_window[111]={