25 55960, 53912, 51402, 48438, 38146, 32650, 26170, 18630
29 static char dtmf_matrix[4][4] =
43 dsp->
dtmf.lastwhat =
'\0';
44 dsp->
dtmf.lastdigit =
'\0';
54 if (!dsp->
dtmf.enable)
64 "because tx_volume is changed\n",
71 "because rx_volume is changed\n",
79 "because encryption is enabled\n",
87 "because pipeline exists.\n",
127 int lowgroup, highgroup;
130 dsp->
dtmf.digits[0] =
'\0';
137 size = dsp->
dtmf.size;
138 buf = dsp->
dtmf.buffer;
153 "size. (is=%d < must=%d)\n",
155 return dsp->
dtmf.digits;
157 hfccoeff = (
s32 *)data;
158 for (k = 0; k <
NCOEFF; k++) {
159 sk2 = (*hfccoeff++) >> 4;
160 sk = (*hfccoeff++) >> 4;
161 if (sk > 32767 || sk < -32767 || sk2 > 32767
164 "DTMF-Detection overflow\n");
168 (((cos2pik[k] * sk) >> 15) * sk2) +
179 return dsp->
dtmf.digits;
184 for (k = 0; k <
NCOEFF; k++) {
188 buf = dsp->
dtmf.buffer;
189 cos2pik_ = cos2pik[
k];
191 sk = ((cos2pik_ * sk1) >> 15) - sk2 + (*buf++);
197 if (sk > 32767 || sk < -32767 || sk2 > 32767 || sk2 < -32767)
202 (((cos2pik[k] * sk) >> 15) * sk2) +
211 for (i = 0; i <
NCOEFF; i++) {
214 if (result[i] > dsp->
dtmf.treshold) {
215 if (result[i] > tresh)
226 s32 tresh_100 = tresh/100;
228 if (tresh_100 == 0) {
231 "tresh(%d) too small set tresh/100 to 1\n",
235 " tr:%3d r %3d %3d %3d %3d %3d %3d %3d %3d\n",
236 result[0] / 10000, result[1] / 10000, result[2] / 10000,
237 result[3] / 10000, result[4] / 10000, result[5] / 10000,
238 result[6] / 10000, result[7] / 10000, tresh / 10000,
239 result[0] / (tresh_100), result[1] / (tresh_100),
240 result[2] / (tresh_100), result[3] / (tresh_100),
241 result[4] / (tresh_100), result[5] / (tresh_100),
242 result[6] / (tresh_100), result[7] / (tresh_100));
250 for (i = 0; i <
NCOEFF; i++) {
251 if (result[i] < treshl)
253 if (result[i] < tresh) {
259 if (i < NCOEFF / 2) {
269 if (highgroup >= 0) {
274 highgroup = i - (NCOEFF / 2);
280 if (lowgroup >= 0 && highgroup >= 0)
281 what = dtmf_matrix[lowgroup][highgroup];
287 if (dsp->
dtmf.lastwhat != what)
291 if (dsp->
dtmf.count == 2) {
292 if (dsp->
dtmf.lastdigit != what) {
299 <
sizeof(dsp->
dtmf.digits)) {
301 dsp->
dtmf.digits) + 1] =
'\0';