How variable table’s data is generated for fixed version of log10

The code is from MELP voice encoder/decoder, I have a couple of question for this function
1. how the variable table’s data generated? how to understand the commend “table is Q13”
2. how to understand parameter Q ?

int log10_fxp((Shortword x, Shortword Q))
{
/* table is Q13 */
short table[]= {
0, 2466, 3908, 4932, 5725, 6374, 6923, 7398, 7817, 8192,
8531, 8840, 9125, 9389, 9634, 9864, 10079, 10283, 10475, 10658,
10831, 10997, 11155, 11306, 11451, 11591, 11725, 11855, 11979, 12100,
12217, 12330, 12439, 12545, 12649, 12749, 12846, 12941, 13034, 13124,
13211, 13297, 13381, 13463, 13543, 13621, 13697, 13772, 13846, 13917,
13988, 14057, 14125, 14191, 14257, 14321, 14384, 14446, 14506, 14566,
14625, 14683, 14740, 14796, 14851, 14905, 14959, 15011, 15063, 15115,
15165, 15215, 15264, 15312, 15360, 15407, 15454, 15500, 15545, 15590,
15634, 15677, 15721, 15763, 15805, 15847, 15888, 15929, 15969, 16009,
16048, 16087, 16125, 16163, 16201, 16238, 16275, 16312, 16348, 16384,
16419, 16454, 16489, 16523, 16557, 16591, 16624, 16657, 16690, 16723,
16755, 16787, 16818, 16850, 16881, 16912, 16942, 16972, 17002, 17032,
17062, 17091, 17120, 17149, 17177, 17206, 17234, 17262, 17289, 17317,
17344, 17371, 17398, 17425, 17451, 17477, 17504, 17529, 17555, 17581,
17606, 17631, 17656, 17681, 17705, 17730, 17754, 17778, 17802, 17826,
17850, 17873, 17896, 17920, 17943, 17966, 17988, 18011, 18033, 18056,
18078, 18100, 18122, 18144, 18165, 18187, 18208, 18229, 18250, 18271,
18292, 18313, 18334, 18354, 18374, 18395, 18415, 18435, 18455, 18475,
18494, 18514, 18533, 18553, 18572, 18591, 18610, 18629, 18648, 18667,
18686, 18704, 18723, 18741, 18759, 18778, 18796, 18814, 18832, 18850,
18867, 18885, 18903, 18920, 18937, 18955, 18972, 18989, 19006, 19023,
19040, 19057, 19074, 19090, 19107, 19123, 19140, 19156, 19172, 19189,
19205, 19221, 19237, 19253, 19269, 19284, 19300, 19316, 19331, 19347,
19362, 19378, 19393, 19408, 19423, 19438, 19453, 19468, 19483, 19498,
19513, 19528, 19542, 19557, 19572, 19586, 19600, 19615, 19629, 19643,
19658, 19672, 19686, 19700, 19714, 19728 };
}


Source: unix

Leave a Reply