1 /* 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. 3 * 4 * Use of this source code is governed by a BSD-style license 5 * that can be found in the LICENSE file in the root of the source 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11 /* 12 * This file contains trigonometric functions look-up tables used in 13 * transform functions WebRtcIsacfix_Time2Spec and WebRtcIsacfix_Spec2Time. 14 */ 15 16 #include <stdint.h> 17 18 #include "modules/audio_coding/codecs/isac/fix/source/settings.h" 19 20 /* Cosine table 1 in Q14. */ 21 const int16_t WebRtcIsacfix_kCosTab1[FRAMESAMPLES/2] = { 22 16384, 16383, 16378, 16371, 16362, 16349, 16333, 16315, 16294, 16270, 23 16244, 16214, 16182, 16147, 16110, 16069, 16026, 15980, 15931, 15880, 24 15826, 15769, 15709, 15647, 15582, 15515, 15444, 15371, 15296, 15218, 25 15137, 15053, 14968, 14879, 14788, 14694, 14598, 14500, 14399, 14295, 26 14189, 14081, 13970, 13856, 13741, 13623, 13502, 13380, 13255, 13128, 27 12998, 12867, 12733, 12597, 12458, 12318, 12176, 12031, 11885, 11736, 28 11585, 11433, 11278, 11121, 10963, 10803, 10641, 10477, 10311, 10143, 29 9974, 9803, 9630, 9456, 9280, 9102, 8923, 8743, 8561, 8377, 30 8192, 8006, 7818, 7629, 7438, 7246, 7053, 6859, 6664, 6467, 31 6270, 6071, 5872, 5671, 5469, 5266, 5063, 4859, 4653, 4447, 32 4240, 4033, 3825, 3616, 3406, 3196, 2986, 2775, 2563, 2351, 33 2139, 1926, 1713, 1499, 1285, 1072, 857, 643, 429, 214, 34 0, -214, -429, -643, -857, -1072, -1285, -1499, -1713, -1926, 35 -2139, -2351, -2563, -2775, -2986, -3196, -3406, -3616, -3825, -4033, 36 -4240, -4447, -4653, -4859, -5063, -5266, -5469, -5671, -5872, -6071, 37 -6270, -6467, -6664, -6859, -7053, -7246, -7438, -7629, -7818, -8006, 38 -8192, -8377, -8561, -8743, -8923, -9102, -9280, -9456, -9630, -9803, 39 -9974, -10143, -10311, -10477, -10641, -10803, -10963, -11121, -11278, -11433, 40 -11585, -11736, -11885, -12031, -12176, -12318, -12458, -12597, -12733, 41 -12867, -12998, -13128, -13255, -13380, -13502, -13623, -13741, -13856, 42 -13970, -14081, -14189, -14295, -14399, -14500, -14598, -14694, -14788, 43 -14879, -14968, -15053, -15137, -15218, -15296, -15371, -15444, -15515, 44 -15582, -15647, -15709, -15769, -15826, -15880, -15931, -15980, -16026, 45 -16069, -16110, -16147, -16182, -16214, -16244, -16270, -16294, -16315, 46 -16333, -16349, -16362, -16371, -16378, -16383 47 }; 48 49 /* Sine table 1 in Q14. */ 50 const int16_t WebRtcIsacfix_kSinTab1[FRAMESAMPLES/2] = { 51 0, 214, 429, 643, 857, 1072, 1285, 1499, 1713, 1926, 52 2139, 2351, 2563, 2775, 2986, 3196, 3406, 3616, 3825, 4033, 53 4240, 4447, 4653, 4859, 5063, 5266, 5469, 5671, 5872, 6071, 54 6270, 6467, 6664, 6859, 7053, 7246, 7438, 7629, 7818, 8006, 55 8192, 8377, 8561, 8743, 8923, 9102, 9280, 9456, 9630, 9803, 56 9974, 10143, 10311, 10477, 10641, 10803, 10963, 11121, 11278, 11433, 57 11585, 11736, 11885, 12031, 12176, 12318, 12458, 12597, 12733, 12867, 58 12998, 13128, 13255, 13380, 13502, 13623, 13741, 13856, 13970, 14081, 59 14189, 14295, 14399, 14500, 14598, 14694, 14788, 14879, 14968, 15053, 60 15137, 15218, 15296, 15371, 15444, 15515, 15582, 15647, 15709, 15769, 61 15826, 15880, 15931, 15980, 16026, 16069, 16110, 16147, 16182, 16214, 62 16244, 16270, 16294, 16315, 16333, 16349, 16362, 16371, 16378, 16383, 63 16384, 16383, 16378, 16371, 16362, 16349, 16333, 16315, 16294, 16270, 64 16244, 16214, 16182, 16147, 16110, 16069, 16026, 15980, 15931, 15880, 65 15826, 15769, 15709, 15647, 15582, 15515, 15444, 15371, 15296, 15218, 66 15137, 15053, 14968, 14879, 14788, 14694, 14598, 14500, 14399, 14295, 67 14189, 14081, 13970, 13856, 13741, 13623, 13502, 13380, 13255, 13128, 68 12998, 12867, 12733, 12597, 12458, 12318, 12176, 12031, 11885, 11736, 69 11585, 11433, 11278, 11121, 10963, 10803, 10641, 10477, 10311, 10143, 70 9974, 9803, 9630, 9456, 9280, 9102, 8923, 8743, 8561, 8377, 71 8192, 8006, 7818, 7629, 7438, 7246, 7053, 6859, 6664, 6467, 72 6270, 6071, 5872, 5671, 5469, 5266, 5063, 4859, 4653, 4447, 73 4240, 4033, 3825, 3616, 3406, 3196, 2986, 2775, 2563, 2351, 74 2139, 1926, 1713, 1499, 1285, 1072, 857, 643, 429, 214 75 }; 76 77 78 /* Sine table 2 in Q14. */ 79 const int16_t WebRtcIsacfix_kSinTab2[FRAMESAMPLES/4] = { 80 16384, -16381, 16375, -16367, 16356, -16342, 16325, -16305, 16283, -16257, 81 16229, -16199, 16165, -16129, 16090, -16048, 16003, -15956, 15906, -15853, 82 15798, -15739, 15679, -15615, 15549, -15480, 15408, -15334, 15257, -15178, 83 15095, -15011, 14924, -14834, 14741, -14647, 14549, -14449, 14347, -14242, 84 14135, -14025, 13913, -13799, 13682, -13563, 13441, -13318, 13192, -13063, 85 12933, -12800, 12665, -12528, 12389, -12247, 12104, -11958, 11810, -11661, 86 11509, -11356, 11200, -11042, 10883, -10722, 10559, -10394, 10227, -10059, 87 9889, -9717, 9543, -9368, 9191, -9013, 8833, -8652, 8469, -8285, 88 8099, -7912, 7723, -7534, 7342, -7150, 6957, -6762, 6566, -6369, 89 6171, -5971, 5771, -5570, 5368, -5165, 4961, -4756, 4550, -4344, 90 4137, -3929, 3720, -3511, 3301, -3091, 2880, -2669, 2457, -2245, 91 2032, -1819, 1606, -1392, 1179, -965, 750, -536, 322, -107 92 }; 93 94 #if defined(MIPS32_LE) 95 /* Cosine table 2 in Q14. Used only on MIPS platforms. */ 96 const int16_t WebRtcIsacfix_kCosTab2[FRAMESAMPLES/4] = { 97 107, -322, 536, -750, 965, -1179, 1392, -1606, 1819, -2032, 98 2245, -2457, 2669, -2880, 3091, -3301, 3511, -3720, 3929, -4137, 99 4344, -4550, 4756, -4961, 5165, -5368, 5570, -5771, 5971, -6171, 100 6369, -6566, 6762, -6957, 7150, -7342, 7534, -7723, 7912, -8099, 101 8285, -8469, 8652, -8833, 9013, -9191, 9368, -9543, 9717, -9889, 102 10059, -10227, 10394, -10559, 10722, -10883, 11042, -11200, 11356, -11509, 103 11661, -11810, 11958, -12104, 12247, -12389, 12528, -12665, 12800, -12933, 104 13063, -13192, 13318, -13441, 13563, -13682, 13799, -13913, 14025, -14135, 105 14242, -14347, 14449, -14549, 14647, -14741, 14834, -14924, 15011, -15095, 106 15178, -15257, 15334, -15408, 15480, -15549, 15615, -15679, 15739, -15798, 107 15853, -15906, 15956, -16003, 16048, -16090, 16129, -16165, 16199, -16229, 108 16257, -16283, 16305, -16325, 16342, -16356, 16367, -16375, 16381, -16384 109 }; 110 #endif 111