OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 | 10 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 nShifts = 7 - inst->stages; // WIDTH_PR_MAP_SHIFT - inst->stages + 5; | 89 nShifts = 7 - inst->stages; // WIDTH_PR_MAP_SHIFT - inst->stages + 5; |
90 //use larger width in tanh map for pause regions | 90 //use larger width in tanh map for pause regions |
91 if (tmp32no1 < 0) { | 91 if (tmp32no1 < 0) { |
92 tmpIndFX = 0; | 92 tmpIndFX = 0; |
93 tmp32no1 = -tmp32no1; | 93 tmp32no1 = -tmp32no1; |
94 //widthPrior = widthPrior * 2.0; | 94 //widthPrior = widthPrior * 2.0; |
95 nShifts++; | 95 nShifts++; |
96 } | 96 } |
97 tmp32no1 = WEBRTC_SPL_SHIFT_W32(tmp32no1, nShifts); // Q14 | 97 tmp32no1 = WEBRTC_SPL_SHIFT_W32(tmp32no1, nShifts); // Q14 |
98 // compute indicator function: sigmoid map | 98 // compute indicator function: sigmoid map |
99 tableIndex = (int16_t)(tmp32no1 >> 14); | 99 if (tmp32no1 < (16 << 14) && tmp32no1 >= 0) { |
100 if ((tableIndex < 16) && (tableIndex >= 0)) { | 100 tableIndex = (int16_t)(tmp32no1 >> 14); |
101 tmp16no2 = kIndicatorTable[tableIndex]; | 101 tmp16no2 = kIndicatorTable[tableIndex]; |
102 tmp16no1 = kIndicatorTable[tableIndex + 1] - kIndicatorTable[tableIndex]; | 102 tmp16no1 = kIndicatorTable[tableIndex + 1] - kIndicatorTable[tableIndex]; |
103 frac = (int16_t)(tmp32no1 & 0x00003fff); // Q14 | 103 frac = (int16_t)(tmp32no1 & 0x00003fff); // Q14 |
104 tmp16no2 += (int16_t)((tmp16no1 * frac) >> 14); | 104 tmp16no2 += (int16_t)((tmp16no1 * frac) >> 14); |
105 if (tmpIndFX == 0) { | 105 if (tmpIndFX == 0) { |
106 tmpIndFX = 8192 - tmp16no2; // Q14 | 106 tmpIndFX = 8192 - tmp16no2; // Q14 |
107 } else { | 107 } else { |
108 tmpIndFX = 8192 + tmp16no2; // Q14 | 108 tmpIndFX = 8192 + tmp16no2; // Q14 |
109 } | 109 } |
110 } | 110 } |
(...skipping 10 matching lines...) Expand all Loading... |
121 tmpIndFX = 0; | 121 tmpIndFX = 0; |
122 tmpU32no2 = tmpU32no1 - inst->thresholdSpecFlat; | 122 tmpU32no2 = tmpU32no1 - inst->thresholdSpecFlat; |
123 //widthPrior = widthPrior * 2.0; | 123 //widthPrior = widthPrior * 2.0; |
124 nShifts++; | 124 nShifts++; |
125 } | 125 } |
126 tmpU32no1 = WebRtcSpl_DivU32U16(tmpU32no2 << nShifts, 25); // Q14 | 126 tmpU32no1 = WebRtcSpl_DivU32U16(tmpU32no2 << nShifts, 25); // Q14 |
127 // compute indicator function: sigmoid map | 127 // compute indicator function: sigmoid map |
128 // FLOAT code | 128 // FLOAT code |
129 // indicator1 = 0.5 * (tanh(sgnMap * widthPrior * | 129 // indicator1 = 0.5 * (tanh(sgnMap * widthPrior * |
130 // (threshPrior1 - tmpFloat1)) + 1.0); | 130 // (threshPrior1 - tmpFloat1)) + 1.0); |
131 tableIndex = (int16_t)(tmpU32no1 >> 14); | 131 if (tmpU32no1 < (16 << 14)) { |
132 if (tableIndex < 16) { | 132 tableIndex = (int16_t)(tmpU32no1 >> 14); |
133 tmp16no2 = kIndicatorTable[tableIndex]; | 133 tmp16no2 = kIndicatorTable[tableIndex]; |
134 tmp16no1 = kIndicatorTable[tableIndex + 1] - kIndicatorTable[tableIndex]; | 134 tmp16no1 = kIndicatorTable[tableIndex + 1] - kIndicatorTable[tableIndex]; |
135 frac = (int16_t)(tmpU32no1 & 0x00003fff); // Q14 | 135 frac = (int16_t)(tmpU32no1 & 0x00003fff); // Q14 |
136 tmp16no2 += (int16_t)((tmp16no1 * frac) >> 14); | 136 tmp16no2 += (int16_t)((tmp16no1 * frac) >> 14); |
137 if (tmpIndFX) { | 137 if (tmpIndFX) { |
138 tmpIndFX = 8192 + tmp16no2; // Q14 | 138 tmpIndFX = 8192 + tmp16no2; // Q14 |
139 } else { | 139 } else { |
140 tmpIndFX = 8192 - tmp16no2; // Q14 | 140 tmpIndFX = 8192 - tmp16no2; // Q14 |
141 } | 141 } |
142 } | 142 } |
(...skipping 25 matching lines...) Expand all Loading... |
168 tmpIndFX = 0; | 168 tmpIndFX = 0; |
169 tmpU32no2 = tmpU32no3 - tmpU32no1; | 169 tmpU32no2 = tmpU32no3 - tmpU32no1; |
170 //widthPrior = widthPrior * 2.0; | 170 //widthPrior = widthPrior * 2.0; |
171 nShifts--; | 171 nShifts--; |
172 } | 172 } |
173 tmpU32no1 = tmpU32no2 >> nShifts; | 173 tmpU32no1 = tmpU32no2 >> nShifts; |
174 // compute indicator function: sigmoid map | 174 // compute indicator function: sigmoid map |
175 /* FLOAT code | 175 /* FLOAT code |
176 indicator2 = 0.5 * (tanh(widthPrior * (tmpFloat1 - threshPrior2)) + 1.0); | 176 indicator2 = 0.5 * (tanh(widthPrior * (tmpFloat1 - threshPrior2)) + 1.0); |
177 */ | 177 */ |
178 tableIndex = (int16_t)(tmpU32no1 >> 14); | 178 if (tmpU32no1 < (16 << 14)) { |
179 if (tableIndex < 16) { | 179 tableIndex = (int16_t)(tmpU32no1 >> 14); |
180 tmp16no2 = kIndicatorTable[tableIndex]; | 180 tmp16no2 = kIndicatorTable[tableIndex]; |
181 tmp16no1 = kIndicatorTable[tableIndex + 1] - kIndicatorTable[tableIndex]; | 181 tmp16no1 = kIndicatorTable[tableIndex + 1] - kIndicatorTable[tableIndex]; |
182 frac = (int16_t)(tmpU32no1 & 0x00003fff); // Q14 | 182 frac = (int16_t)(tmpU32no1 & 0x00003fff); // Q14 |
183 tmp16no2 += (int16_t)WEBRTC_SPL_MUL_16_16_RSFT_WITH_ROUND( | 183 tmp16no2 += (int16_t)WEBRTC_SPL_MUL_16_16_RSFT_WITH_ROUND( |
184 tmp16no1, frac, 14); | 184 tmp16no1, frac, 14); |
185 if (tmpIndFX) { | 185 if (tmpIndFX) { |
186 tmpIndFX = 8192 + tmp16no2; | 186 tmpIndFX = 8192 + tmp16no2; |
187 } else { | 187 } else { |
188 tmpIndFX = 8192 - tmp16no2; | 188 tmpIndFX = 8192 - tmp16no2; |
189 } | 189 } |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 tmp32no1 = (int32_t)inst->priorNonSpeechProb << 8; // Q22 | 252 tmp32no1 = (int32_t)inst->priorNonSpeechProb << 8; // Q22 |
253 | 253 |
254 nonSpeechProbFinal[i] = tmp32no1 / | 254 nonSpeechProbFinal[i] = tmp32no1 / |
255 (inst->priorNonSpeechProb + invLrtFX); // Q8 | 255 (inst->priorNonSpeechProb + invLrtFX); // Q8 |
256 } | 256 } |
257 } | 257 } |
258 } | 258 } |
259 } | 259 } |
260 } | 260 } |
261 | 261 |
OLD | NEW |