OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
11 #include "webrtc/modules/audio_coding/codecs/isac/fix/source/codec.h" | 11 #include "webrtc/modules/audio_coding/codecs/isac/fix/source/codec.h" |
12 #include "webrtc/system_wrappers/interface/cpu_features_wrapper.h" | 12 #include "webrtc/system_wrappers/interface/cpu_features_wrapper.h" |
13 | 13 |
14 static const int kSamples = FRAMESAMPLES/2; | 14 static const int kSamples = FRAMESAMPLES/2; |
15 static int32_t spec2time_out_expected_1[kSamples] = {-3366470, -2285227, | 15 static const int32_t spec2time_out_expected_1[kSamples] = { |
16 -3415765, -2310215, -3118030, -2222470, -3030254, -2192091, -3423170, | 16 -3366470, -2285227, -3415765, -2310215, -3118030, -2222470, -3030254, |
17 -2216041, -3305541, -2171936, -3195767, -2095779, -3153304, -2157560, | 17 -2192091, -3423170, -2216041, -3305541, -2171936, -3195767, -2095779, |
18 -3071167, -2032108, -3101190, -1972016, -3103824, -2089118, -3139811, | 18 -3153304, -2157560, -3071167, -2032108, -3101190, -1972016, -3103824, |
19 -1898337, -3102801, -2055082, -3029665, -1854140, -2962586, -1966454, | 19 -2089118, -3139811, -1898337, -3102801, -2055082, -3029665, -1854140, |
20 -3071167, -1894588, -2851743, -1917315, -2848087, -1594932, -2799242, | 20 -2962586, -1966454, -3071167, -1894588, -2851743, -1917315, -2848087, |
21 -1462184, -2845887, -1437599, -2691776, -1329637, -2770659, -1268491, | 21 -1594932, -2799242, -1462184, -2845887, -1437599, -2691776, -1329637, |
22 -2625161, -1578991, -2460299, -1186385, -2365613, -1039354, -2322608, | 22 -2770659, -1268491, -2625161, -1578991, -2460299, -1186385, -2365613, |
23 -958518, -2271749, -789860, -2254538, -850308, -2384436, -850959, -2133734, | 23 -1039354, -2322608, -958518, -2271749, -789860, -2254538, -850308, |
24 -587678, -2093316, -495115, -1973364, -475177, -1801282, -173507, | 24 -2384436, -850959, -2133734, -587678, -2093316, -495115, -1973364, |
25 -1848516, -158015, -1792018, -62648, -1643313, 214746, -1500758, 267077, | 25 -475177, -1801282, -173507, -1848516, -158015, -1792018, -62648, |
26 -1450193, 560521, -1521579, 675283, -1345408, 857559, -1300822, 1116332, | 26 -1643313, 214746, -1500758, 267077, -1450193, 560521, -1521579, |
27 -1294533, 1241117, -1070027, 1263503, -983816, 1529821, -1019586, | 27 675283, -1345408, 857559, -1300822, 1116332, -1294533, 1241117, |
28 1910421, -955420, 2073688, -836459, 2401105, -653905, 2690474, -731425, | 28 -1070027, 1263503, -983816, 1529821, -1019586, 1910421, -955420, |
29 2930131, -935234, 3299500, -875978, 3523432, -878906, 3924822, -1081630, | 29 2073688, -836459, 2401105, -653905, 2690474, -731425, 2930131, |
30 4561267, -1203023, 5105274, -1510983, 6052762, -2294646, 7021597, | 30 -935234, 3299500, -875978, 3523432, -878906, 3924822, -1081630, |
31 -3108053, 8826736, -4935222, 11678789, -8442713, 18725700, -21526692, | 31 4561267, -1203023, 5105274, -1510983, 6052762, -2294646, 7021597, |
32 25420577, 19589811, -28108666, 12634054, -14483066, 6263217, -9979706, | 32 -3108053, 8826736, -4935222, 11678789, -8442713, 18725700, -21526692, |
33 3665661, -7909736, 2531530, -6434896, 1700772, -5525393, 1479473, | 33 25420577, 19589811, -28108666, 12634054, -14483066, 6263217, -9979706, |
34 -4894262, 1231760, -4353044, 1032940, -3786590, 941152, -3331614, | 34 3665661, -7909736, 2531530, -6434896, 1700772, -5525393, 1479473, |
35 665090, -2851619, 830696, -2762201, 958007, -2483118, 788233, -2184965, | 35 -4894262, 1231760, -4353044, 1032940, -3786590, 941152, -3331614, |
36 804825, -1967306, 1007255, -1862474, 920889, -1457506, 755406, -1405841, | 36 665090, -2851619, 830696, -2762201, 958007, -2483118, 788233, |
37 890230, -1302124, 1161599, -701867, 1154163, -1083366, 1204743, -513581, | 37 -2184965, 804825, -1967306, 1007255, -1862474, 920889, -1457506, |
38 1547264, -650636, 1493384, -285543, 1771863, -277906, 1841343, -9078, | 38 755406, -1405841, 890230, -1302124, 1161599, -701867, 1154163, |
39 1751863, 230222, 1819578, 207170, 1978972, 398137, 2106468, 552155, | 39 -1083366, 1204743, -513581, 1547264, -650636, 1493384, -285543, |
40 1997624, 685213, 2129520, 601078, 2238736, 944591, 2441879, 1194178, | 40 1771863, -277906, 1841343, -9078, 1751863, 230222, 1819578, |
41 2355280, 986124, 2393328, 1049005, 2417944, 1208368, 2489516, 1352023, | 41 207170, 1978972, 398137, 2106468, 552155, 1997624, 685213, |
42 2572118, 1445283, 2856081, 1532997, 2742279, 1615877, 2915274, 1808036, | 42 2129520, 601078, 2238736, 944591, 2441879, 1194178, 2355280, |
43 2856871, 1806936, 3241747, 1622461, 2978558, 1841297, 3010378, 1923666, | 43 986124, 2393328, 1049005, 2417944, 1208368, 2489516, 1352023, |
44 3271367, 2126700, 3070935, 1956958, 3107588, 2128405, 3288872, 2114911, | 44 2572118, 1445283, 2856081, 1532997, 2742279, 1615877, 2915274, |
45 3315952, 2406651, 3344038, 2370199, 3368980, 2144361, 3305030, 2183803, | 45 1808036, 2856871, 1806936, 3241747, 1622461, 2978558, 1841297, |
46 3401450, 2523102, 3405463, 2452475, 3463355, 2421678, 3551968, 2431949, | 46 3010378, 1923666, 3271367, 2126700, 3070935, 1956958, 3107588, |
47 3477251, 2148125, 3244489, 2174090}; | 47 2128405, 3288872, 2114911, 3315952, 2406651, 3344038, 2370199, |
48 static int32_t spec2time_out_expected_2[kSamples]= {1691694, -2499988, -2035547, | 48 3368980, 2144361, 3305030, 2183803, 3401450, 2523102, 3405463, |
49 1060469, 988634, -2044502, -306271, 2041000, 201454, -2289456, 93694, | 49 2452475, 3463355, 2421678, 3551968, 2431949, 3477251, 2148125, |
50 2129427, -369152, -1887834, 860796, 2089102, -929424, -1673956, 1395291, | 50 3244489, 2174090}; |
51 1785651, -1619673, -1380109, 1963449, 1093311, -2111007, -840456, | 51 static const int32_t spec2time_out_expected_2[kSamples] = { |
52 2372786, 578119, -2242702, 89774, 2463304, -132717, -2121480, 643634, | 52 1691694, -2499988, -2035547, 1060469, 988634, -2044502, -306271, |
53 2277636, -1125999, -1995858, 1543748, 2227861, -1483779, -1495491, | 53 2041000, 201454, -2289456, 93694, 2129427, -369152, -1887834, |
54 2102642, 1833876, -1920568, -958378, 2485101, 772261, -2454257, -24942, | 54 860796, 2089102, -929424, -1673956, 1395291, 1785651, -1619673, |
55 2918714, 136838, -2500453, 816118, 3039735, -746560, -2365815, 1586396, | 55 -1380109, 1963449, 1093311, -2111007, -840456, 2372786, 578119, |
56 2714951, -1511696, -1942334, 2571792, 2182827, -2325335, -1311543, | 56 -2242702, 89774, 2463304, -132717, -2121480, 643634, 2277636, |
57 3055970, 1367220, -2737182, -110626, 3889222, 631008, -3280879, 853066, | 57 -1125999, -1995858, 1543748, 2227861, -1483779, -1495491, 2102642, |
58 4122279, -706638, -3334449, 2148311, 3993512, -1846301, -3004894, | 58 1833876, -1920568, -958378, 2485101, 772261, -2454257, -24942, |
59 3426779, 3329522, -3165264, -2242423, 4756866, 2557711, -4131280, | 59 2918714, 136838, -2500453, 816118, 3039735, -746560, -2365815, |
60 -805259, 5702711, 1120592, -4852821, 743664, 6476444, -621186, -5465828, | 60 1586396, 2714951, -1511696, -1942334, 2571792, 2182827, -2325335, |
61 2815787, 6768835, -3017442, -5338409, 5658126, 6838454, -5492288, | 61 -1311543, 3055970, 1367220, -2737182, -110626, 3889222, 631008, |
62 -4682382, 8874947, 6153814, -8832561, -2649251, 12817398, 4237692, | 62 -3280879, 853066, 4122279, -706638, -3334449, 2148311, 3993512, |
63 -13000247, 1190661, 18986363, -115738, -19693978, 9908367, 30660381, | 63 -1846301, -3004894, 3426779, 3329522, -3165264, -2242423, 4756866, |
64 -10632635, -37962068, 47022884, 89744622, -42087632, 40279224, | 64 2557711, -4131280, -805259, 5702711, 1120592, -4852821, 743664, |
65 -88869341, -47542383, 38572364, 10441576, -30339718, -9926740, 19896578, | 65 6476444, -621186, -5465828, 2815787, 6768835, -3017442, -5338409, |
66 28009, -18886612, -1124047, 13232498, -4150304, -12770551, 2637074, | 66 5658126, 6838454, -5492288, -4682382, 8874947, 6153814, -8832561, |
67 9051831, -6162211, -8713972, 4557937, 5489716, -6862312, -5532349, | 67 -2649251, 12817398, 4237692, -13000247, 1190661, 18986363, -115738, |
68 5415449, 2791310, -6999367, -2790102, 5375806, 546222, -6486452, | 68 -19693978, 9908367, 30660381, -10632635, -37962068, 47022884, 89744622, |
69 -821261, 4994973, -1278840, -5645501, 1060484, 3996285, -2503954, | 69 -42087632, 40279224, -88869341, -47542383, 38572364, 10441576, -30339718, |
70 -4653629, 2220549, 3036977, -3282133, -3318585, 2780636, 1789880, | 70 -9926740, 19896578, 28009, -18886612, -1124047, 13232498, -4150304, |
71 -4004589, -2041031, 3105373, 574819, -3992722, -971004, 3001703, | 71 -12770551, 2637074, 9051831, -6162211, -8713972, 4557937, 5489716, |
72 -676739, -3841508, 417284, 2897970, -1427018, -3058480, 1189948, | 72 -6862312, -5532349, 5415449, 2791310, -6999367, -2790102, 5375806, |
73 2210960, -2268992, -2603272, 1949785, 1576172, -2720404, -1891738, | 73 546222, -6486452, -821261, 4994973, -1278840, -5645501, 1060484, |
74 2309456, 769178, -2975646, -707150, 2424652, -88039, -2966660, -65452, | 74 3996285, -2503954, -4653629, 2220549, 3036977, -3282133, -3318585, |
75 2320780, -957557, -2798978, 744640, 1879794, -1672081, -2365319, | 75 2780636, 1789880, -4004589, -2041031, 3105373, 574819, -3992722, |
76 1253309, 1366383, -2204082, -1544367, 1801452, 613828, -2531994, | 76 -971004, 3001703, -676739, -3841508, 417284, 2897970, -1427018, |
77 -983847, 2064842, 118326, -2613790, -203220, 2219635, -730341, -2641861, | 77 -3058480, 1189948, 2210960, -2268992, -2603272, 1949785, 1576172, |
78 563557, 1765434, -1329916, -2272927, 1037138, 1266725, -1939220, | 78 -2720404, -1891738, 2309456, 769178, -2975646, -707150, 2424652, |
79 -1588643, 1754528, 816552, -2376303, -1099167, 1864999, 122477, | 79 -88039, -2966660, -65452, 2320780, -957557, -2798978, 744640, |
80 -2422762, -400027, 1889228, -579916, -2490353, 287139, 2011318, | 80 1879794, -1672081, -2365319, 1253309, 1366383, -2204082, -1544367, |
81 -1176657, -2502978, 812896, 1116502, -1940211}; | 81 1801452, 613828, -2531994, -983847, 2064842, 118326, -2613790, |
82 static int16_t time2spec_out_expected_1[kSamples]= {20342, 23889, -10063, -9419, | 82 -203220, 2219635, -730341, -2641861, 563557, 1765434, -1329916, |
83 3242, 7280, -2012, -5029, 332, 4478, -97, -3244, -891, 3117, 773, -2204, | 83 -2272927, 1037138, 1266725, -1939220, -1588643, 1754528, 816552, |
84 -1335, 2009, 1236, -1469, -1562, 1277, 1366, -815, -1619, 599, 1449, -177, | 84 -2376303, -1099167, 1864999, 122477, -2422762, -400027, 1889228, |
85 -1507, 116, 1294, 263, -1338, -244, 1059, 553, -1045, -549, 829, 826, | 85 -579916, -2490353, 287139, 2011318, -1176657, -2502978, 812896, |
86 -731, -755, 516, 909, -427, -853, 189, 1004, -184, -828, -108, 888, 72, | 86 1116502, -1940211}; |
87 -700, -280, 717, 342, -611, -534, 601, 534, -374, -646, 399, 567, -171, | 87 static const int16_t time2spec_out_expected_1[kSamples] = { |
88 -720, 234, 645, -11, -712, -26, 593, 215, -643, -172, 536, 361, -527, | 88 20342, 23889, -10063, -9419, 3242, 7280, -2012, -5029, 332, 4478, |
89 -403, 388, 550, -361, -480, 208, 623, -206, -585, 41, 578, 12, -504, | 89 -97, -3244, -891, 3117, 773, -2204, -1335, 2009, 1236, -1469, |
90 -182, 583, 218, -437, -339, 499, 263, -354, -450, 347, 456, -193, -524, | 90 -1562, 1277, 1366, -815, -1619, 599, 1449, -177, -1507, 116, |
91 212, 475, -74, -566, 94, 511, 112, -577, -201, 408, 217, -546, -295, 338, | 91 1294, 263, -1338, -244, 1059, 553, -1045, -549, 829, 826, |
92 387, -13, 4, -46, 2, -76, 103, -83, 108, -55, 100, -150, 131, -156, 141, | 92 -731, -755, 516, 909, -427, -853, 189, 1004, -184, -828, |
93 -171, 179, -190, 128, -227, 172, -214, 215, -189, 265, -244, 322, -335, | 93 -108, 888, 72, -700, -280, 717, 342, -611, -534, 601, |
94 337, -352, 358, -368, 362, -355, 366, -381, 403, -395, 411, -392, 446, | 94 534, -374, -646, 399, 567, -171, -720, 234, 645, -11, |
95 -458, 504, -449, 507, -464, 452, -491, 481, -534, 486, -516, 560, -535, | 95 -712, -26, 593, 215, -643, -172, 536, 361, -527, -403, |
96 525, -537, 559, -554, 570, -616, 591, -585, 627, -509, 588, -584, 547, | 96 388, 550, -361, -480, 208, 623, -206, -585, 41, 578, |
97 -610, 580, -614, 635, -620, 655, -554, 546, -591, 642, -590, 660, -656, | 97 12, -504, -182, 583, 218, -437, -339, 499, 263, -354, |
98 629, -604, 620, -580, 617, -645, 648, -573, 612, -604, 584, -571, 597, | 98 -450, 347, 456, -193, -524, 212, 475, -74, -566, 94, |
99 -562, 627, -550, 560, -606, 529, -584, 568, -503, 532, -463, 512, -440, | 99 511, 112, -577, -201, 408, 217, -546, -295, 338, 387, |
100 399, -457, 437, -349, 278, -317, 257, -220, 163, -8, -61, 18, -161, 367, | 100 -13, 4, -46, 2, -76, 103, -83, 108, -55, 100, |
101 -1306}; | 101 -150, 131, -156, 141, -171, 179, -190, 128, -227, 172, |
102 static int16_t time2spec_out_expected_2[kSamples]= {14283, -11552, -15335, 6626, | 102 -214, 215, -189, 265, -244, 322, -335, 337, -352, 358, |
103 7554, -2150, -6309, 1307, 4523, -4, -3908, -314, 3001, 914, -2715, -1042, | 103 -368, 362, -355, 366, -381, 403, -395, 411, -392, 446, |
104 2094, 1272, -1715, -1399, 1263, 1508, -1021, -1534, 735, 1595, -439, -1447, | 104 -458, 504, -449, 507, -464, 452, -491, 481, -534, 486, |
105 155, 1433, 22, -1325, -268, 1205, 424, -1030, -608, 950, 643, -733, -787, | 105 -516, 560, -535, 525, -537, 559, -554, 570, -616, 591, |
106 661, 861, -502, -888, 331, 852, -144, -849, 19, 833, 99, -826, -154, | 106 -585, 627, -509, 588, -584, 547, -610, 580, -614, 635, |
107 771, 368, -735, -459, 645, 513, -491, -604, 431, 630, -314, -598, 183, | 107 -620, 655, -554, 546, -591, 642, -590, 660, -656, 629, |
108 622, -78, -612, -48, 641, 154, -645, -257, 610, 281, -529, -444, 450, | 108 -604, 620, -580, 617, -645, 648, -573, 612, -604, 584, |
109 441, -327, -506, 274, 476, -232, -570, 117, 554, -86, -531, -21, 572, | 109 -571, 597, -562, 627, -550, 560, -606, 529, -584, 568, |
110 151, -606, -221, 496, 322, -407, -388, 407, 394, -268, -428, 280, 505, | 110 -503, 532, -463, 512, -440, 399, -457, 437, -349, 278, |
111 -115, -588, 19, 513, -29, -539, -109, 468, 173, -501, -242, 442, 278, | 111 -317, 257, -220, 163, -8, -61, 18, -161, 367, -1306}; |
112 -478, -680, 656, -659, 656, -669, 602, -688, 612, -667, 612, -642, 627, | 112 static const int16_t time2spec_out_expected_2[kSamples] = { |
113 -648, 653, -676, 596, -680, 655, -649, 678, -672, 587, -608, 637, -645, | 113 14283, -11552, -15335, 6626, 7554, -2150, -6309, 1307, 4523, -4, |
114 637, -620, 556, -580, 553, -635, 518, -599, 583, -501, 536, -544, 473, | 114 -3908, -314, 3001, 914, -2715, -1042, 2094, 1272, -1715, -1399, |
115 -552, 583, -511, 541, -532, 563, -486, 461, -453, 486, -388, 424, -416, | 115 1263, 1508, -1021, -1534, 735, 1595, -439, -1447, 155, 1433, |
116 432, -374, 399, -462, 364, -346, 293, -329, 331, -313, 281, -247, 309, | 116 22, -1325, -268, 1205, 424, -1030, -608, 950, 643, -733, |
117 -337, 241, -190, 207, -194, 179, -163, 155, -156, 117, -135, 107, -126, | 117 -787, 661, 861, -502, -888, 331, 852, -144, -849, 19, |
118 29, -22, 81, -8, 17, -61, -10, 8, -37, 80, -44, 72, -88, 65, -89, 130, | 118 833, 99, -826, -154, 771, 368, -735, -459, 645, 513, |
119 -114, 181, -215, 189, -245, 260, -288, 294, -339, 344, -396, 407, -429, | 119 -491, -604, 431, 630, -314, -598, 183, 622, -78, -612, |
120 438, -439, 485, -556, 629, -612, 637, -645, 661, -737, 829, -830, 831, | 120 -48, 641, 154, -645, -257, 610, 281, -529, -444, 450, |
121 -1041}; | 121 441, -327, -506, 274, 476, -232, -570, 117, 554, -86, |
| 122 -531, -21, 572, 151, -606, -221, 496, 322, -407, -388, |
| 123 407, 394, -268, -428, 280, 505, -115, -588, 19, 513, |
| 124 -29, -539, -109, 468, 173, -501, -242, 442, 278, -478, |
| 125 -680, 656, -659, 656, -669, 602, -688, 612, -667, 612, |
| 126 -642, 627, -648, 653, -676, 596, -680, 655, -649, 678, |
| 127 -672, 587, -608, 637, -645, 637, -620, 556, -580, 553, |
| 128 -635, 518, -599, 583, -501, 536, -544, 473, -552, 583, |
| 129 -511, 541, -532, 563, -486, 461, -453, 486, -388, 424, |
| 130 -416, 432, -374, 399, -462, 364, -346, 293, -329, 331, |
| 131 -313, 281, -247, 309, -337, 241, -190, 207, -194, 179, |
| 132 -163, 155, -156, 117, -135, 107, -126, 29, -22, 81, |
| 133 -8, 17, -61, -10, 8, -37, 80, -44, 72, -88, |
| 134 65, -89, 130, -114, 181, -215, 189, -245, 260, -288, |
| 135 294, -339, 344, -396, 407, -429, 438, -439, 485, -556, |
| 136 629, -612, 637, -645, 661, -737, 829, -830, 831, -1041}; |
122 | 137 |
123 class TransformTest : public testing::Test { | 138 class TransformTest : public testing::Test { |
124 protected: | 139 protected: |
125 TransformTest() { | 140 TransformTest() { |
126 WebRtcSpl_Init(); | 141 WebRtcSpl_Init(); |
127 } | 142 } |
128 | 143 |
129 // Pass a function pointer to the Tester function. | 144 // Pass a function pointer to the Tester function. |
130 void Time2SpecTester(Time2Spec Time2SpecFunction) { | 145 void Time2SpecTester(Time2Spec Time2SpecFunction) { |
131 // WebRtcIsacfix_Time2Spec functions hard coded the buffer lengths. It's a | 146 // WebRtcIsacfix_Time2Spec functions hard coded the buffer lengths. It's a |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 TEST_F(TransformTest, Spec2TimeTest) { | 202 TEST_F(TransformTest, Spec2TimeTest) { |
188 Spec2TimeTester(WebRtcIsacfix_Spec2TimeC); | 203 Spec2TimeTester(WebRtcIsacfix_Spec2TimeC); |
189 #ifdef WEBRTC_DETECT_NEON | 204 #ifdef WEBRTC_DETECT_NEON |
190 if ((WebRtc_GetCPUFeaturesARM() & kCPUFeatureNEON) != 0) { | 205 if ((WebRtc_GetCPUFeaturesARM() & kCPUFeatureNEON) != 0) { |
191 Spec2TimeTester(WebRtcIsacfix_Spec2TimeNeon); | 206 Spec2TimeTester(WebRtcIsacfix_Spec2TimeNeon); |
192 } | 207 } |
193 #elif defined(WEBRTC_HAS_NEON) | 208 #elif defined(WEBRTC_HAS_NEON) |
194 Spec2TimeTester(WebRtcIsacfix_Spec2TimeNeon); | 209 Spec2TimeTester(WebRtcIsacfix_Spec2TimeNeon); |
195 #endif | 210 #endif |
196 } | 211 } |
OLD | NEW |