Browse code

TrueSpeech compatible audio decoder by Konstantin Shishkov

Originally committed as revision 4803 to svn://svn.ffmpeg.org/ffmpeg/trunk

Diego Biurrun authored on 2006/01/03 11:30:38
Showing 7 changed files
... ...
@@ -26,6 +26,7 @@ version <next>
26 26
 - ffserver fixed, it should now be usable again
27 27
 - QDM2 audio decoder
28 28
 - cook audio decoder
29
+- TrueSpeech audio decoder
29 30
 - wma2 audio decoder fixed, now all files should play correctly
30 31
 - JPEG-LS decoder (unfinished)
31 32
 - build system improvements
... ...
@@ -161,6 +161,9 @@ endif
161 161
 ifeq ($(CONFIG_TRUEMOTION2_DECODER),yes)
162 162
     OBJS+= truemotion2.o
163 163
 endif
164
+ifeq ($(CONFIG_TRUESPEECH_DECODER),yes)
165
+    OBJS+= truespeech.o
166
+endif
164 167
 ifeq ($(CONFIG_TSCC_DECODER),yes)
165 168
     OBJS+= tscc.o
166 169
 endif
... ...
@@ -497,6 +497,9 @@ void avcodec_register_all(void)
497 497
 #ifdef CONFIG_COOK_DECODER
498 498
     register_avcodec(&cook_decoder);
499 499
 #endif //CONFIG_COOK_DECODER
500
+#ifdef CONFIG_TRUESPEECH_DECODER
501
+    register_avcodec(&truespeech_decoder);
502
+#endif //CONFIG_TRUESPEECH_DECODER
500 503
 #ifdef CONFIG_RAWVIDEO_DECODER
501 504
     register_avcodec(&rawvideo_decoder);
502 505
 #endif //CONFIG_RAWVIDEO_DECODER
... ...
@@ -189,6 +189,7 @@ enum CodecID {
189 189
     CODEC_ID_GSM,
190 190
     CODEC_ID_QDM2,
191 191
     CODEC_ID_COOK,
192
+    CODEC_ID_TRUESPEECH,
192 193
 
193 194
     CODEC_ID_OGGTHEORA= 0x16000,
194 195
 
... ...
@@ -2134,6 +2135,7 @@ extern AVCodec mp3adu_decoder;
2134 2134
 extern AVCodec mp3on4_decoder;
2135 2135
 extern AVCodec qdm2_decoder;
2136 2136
 extern AVCodec cook_decoder;
2137
+extern AVCodec truespeech_decoder;
2137 2138
 extern AVCodec mace3_decoder;
2138 2139
 extern AVCodec mace6_decoder;
2139 2140
 extern AVCodec huffyuv_decoder;
2140 2141
new file mode 100644
... ...
@@ -0,0 +1,377 @@
0
+/*
1
+ * DSP Group TrueSpeech compatible decoder
2
+ * Copyright (c) 2005 Konstantin Shishkov
3
+ *
4
+ * This library is free software; you can redistribute it and/or
5
+ * modify it under the terms of the GNU Lesser General Public
6
+ * License as published by the Free Software Foundation; either
7
+ * version 2 of the License, or (at your option) any later version.
8
+ *
9
+ * This library is distributed in the hope that it will be useful,
10
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
+ * Lesser General Public License for more details.
13
+ *
14
+ * You should have received a copy of the GNU Lesser General Public
15
+ * License along with this library; if not, write to the Free Software
16
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
+ */
18
+#include "avcodec.h"
19
+
20
+#include "truespeech_data.h"
21
+/**
22
+ * @file truespeech.c
23
+ * TrueSpeech decoder.
24
+ */
25
+
26
+/**
27
+ * TrueSpeech decoder context
28
+ */
29
+typedef struct {
30
+    /* input data */
31
+    int16_t vector[8];  //< input vector: 5/5/4/4/4/3/3/3
32
+    int offset1[2];     //< 8-bit value, used in one copying offset
33
+    int offset2[4];     //< 7-bit value, encodes offsets for copying and for two-point filter
34
+    int pulseoff[4];    //< 4-bit offset of pulse values block
35
+    int pulsepos[4];    //< 27-bit variable, encodes 7 pulse positions
36
+    int pulseval[4];    //< 7x2-bit pulse values
37
+    int flag;           //< 1-bit flag, shows how to choose filters
38
+    /* temporary data */
39
+    int filtbuf[146];   // some big vector used for storing filters
40
+    int prevfilt[8];    // filter from previous frame
41
+    int16_t tmp1[8];    // coefficients for adding to out
42
+    int16_t tmp2[8];    // coefficients for adding to out
43
+    int16_t tmp3[8];    // coefficients for adding to out
44
+    int16_t cvector[8]; // correlated input vector
45
+    int filtval;        // gain value for one function
46
+    int16_t newvec[60]; // tmp vector
47
+    int16_t filters[32]; // filters for every subframe
48
+} TSContext;
49
+
50
+static int truespeech_decode_init(AVCodecContext * avctx)
51
+{
52
+//    TSContext *c = avctx->priv_data;
53
+
54
+    return 0;
55
+}
56
+
57
+static void truespeech_read_frame(TSContext *dec, uint8_t *input)
58
+{
59
+    uint32_t t;
60
+
61
+    /* first dword */
62
+    t = LE_32(input);
63
+    input += 4;
64
+
65
+    dec->flag = t & 1;
66
+
67
+    dec->vector[0] = ts_codebook[0][(t >>  1) & 0x1F];
68
+    dec->vector[1] = ts_codebook[1][(t >>  6) & 0x1F];
69
+    dec->vector[2] = ts_codebook[2][(t >> 11) &  0xF];
70
+    dec->vector[3] = ts_codebook[3][(t >> 15) &  0xF];
71
+    dec->vector[4] = ts_codebook[4][(t >> 19) &  0xF];
72
+    dec->vector[5] = ts_codebook[5][(t >> 23) &  0x7];
73
+    dec->vector[6] = ts_codebook[6][(t >> 26) &  0x7];
74
+    dec->vector[7] = ts_codebook[7][(t >> 29) &  0x7];
75
+
76
+    /* second dword */
77
+    t = LE_32(input);
78
+    input += 4;
79
+
80
+    dec->offset2[0] = (t >>  0) & 0x7F;
81
+    dec->offset2[1] = (t >>  7) & 0x7F;
82
+    dec->offset2[2] = (t >> 14) & 0x7F;
83
+    dec->offset2[3] = (t >> 21) & 0x7F;
84
+
85
+    dec->offset1[0] = ((t >> 28) & 0xF) << 4;
86
+
87
+    /* third dword */
88
+    t = LE_32(input);
89
+    input += 4;
90
+
91
+    dec->pulseval[0] = (t >>  0) & 0x3FFF;
92
+    dec->pulseval[1] = (t >> 14) & 0x3FFF;
93
+
94
+    dec->offset1[1] = (t >> 28) & 0x0F;
95
+
96
+    /* fourth dword */
97
+    t = LE_32(input);
98
+    input += 4;
99
+
100
+    dec->pulseval[2] = (t >>  0) & 0x3FFF;
101
+    dec->pulseval[3] = (t >> 14) & 0x3FFF;
102
+
103
+    dec->offset1[1] |= ((t >> 28) & 0x0F) << 4;
104
+
105
+    /* fifth dword */
106
+    t = LE_32(input);
107
+    input += 4;
108
+
109
+    dec->pulsepos[0] = (t >> 4) & 0x7FFFFFF;
110
+
111
+    dec->pulseoff[0] = (t >> 0) & 0xF;
112
+
113
+    dec->offset1[0] |= (t >> 31) & 1;
114
+
115
+    /* sixth dword */
116
+    t = LE_32(input);
117
+    input += 4;
118
+
119
+    dec->pulsepos[1] = (t >> 4) & 0x7FFFFFF;
120
+
121
+    dec->pulseoff[1] = (t >> 0) & 0xF;
122
+
123
+    dec->offset1[0] |= ((t >> 31) & 1) << 1;
124
+
125
+    /* seventh dword */
126
+    t = LE_32(input);
127
+    input += 4;
128
+
129
+    dec->pulsepos[2] = (t >> 4) & 0x7FFFFFF;
130
+
131
+    dec->pulseoff[2] = (t >> 0) & 0xF;
132
+
133
+    dec->offset1[0] |= ((t >> 31) & 1) << 2;
134
+
135
+    /* eighth dword */
136
+    t = LE_32(input);
137
+    input += 4;
138
+
139
+    dec->pulsepos[3] = (t >> 4) & 0x7FFFFFF;
140
+
141
+    dec->pulseoff[3] = (t >> 0) & 0xF;
142
+
143
+    dec->offset1[0] |= ((t >> 31) & 1) << 3;
144
+
145
+}
146
+
147
+static void truespeech_correlate_filter(TSContext *dec)
148
+{
149
+    int16_t tmp[8];
150
+    int i, j;
151
+
152
+    for(i = 0; i < 8; i++){
153
+        if(i > 0){
154
+            memcpy(tmp, dec->cvector, i * 2);
155
+            for(j = 0; j < i; j++)
156
+                dec->cvector[j] = ((tmp[i - j - 1] * dec->vector[i]) +
157
+                                   (dec->cvector[j] << 15) + 0x4000) >> 15;
158
+        }
159
+        dec->cvector[i] = (8 - dec->vector[i]) >> 3;
160
+    }
161
+    for(i = 0; i < 8; i++)
162
+        dec->cvector[i] = (dec->cvector[i] * ts_230[i]) >> 15;
163
+
164
+    dec->filtval = dec->vector[0];
165
+}
166
+
167
+static void truespeech_filters_merge(TSContext *dec)
168
+{
169
+    int i;
170
+
171
+    if(!dec->flag){
172
+        for(i = 0; i < 8; i++){
173
+            dec->filters[i + 0] = dec->prevfilt[i];
174
+            dec->filters[i + 8] = dec->prevfilt[i];
175
+        }
176
+    }else{
177
+        for(i = 0; i < 8; i++){
178
+            dec->filters[i + 0]=(dec->cvector[i] * 21846 + dec->prevfilt[i] * 10923 + 16384) >> 15;
179
+            dec->filters[i + 8]=(dec->cvector[i] * 10923 + dec->prevfilt[i] * 21846 + 16384) >> 15;
180
+        }
181
+    }
182
+    for(i = 0; i < 8; i++){
183
+        dec->filters[i + 16] = dec->cvector[i];
184
+        dec->filters[i + 24] = dec->cvector[i];
185
+    }
186
+}
187
+
188
+static void truespeech_apply_twopoint_filter(TSContext *dec, int quart)
189
+{
190
+    int16_t tmp[146 + 60], *ptr0, *ptr1, *filter;
191
+    int i, t, off;
192
+
193
+    t = dec->offset2[quart];
194
+    if(t == 127){
195
+        memset(dec->newvec, 0, 60 * 2);
196
+        return;
197
+    }
198
+    for(i = 0; i < 146; i++)
199
+        tmp[i] = dec->filtbuf[i];
200
+    off = (t / 25) + dec->offset1[quart >> 1] + 18;
201
+    ptr0 = tmp + 145 - off;
202
+    ptr1 = tmp + 146;
203
+    filter = ts_240 + (t % 25) * 2;
204
+    for(i = 0; i < 60; i++){
205
+        t = (ptr0[0] * filter[0] + ptr0[1] * filter[1] + 0x2000) >> 14;
206
+        ptr0++;
207
+        dec->newvec[i] = t;
208
+        ptr1[i] = t;
209
+    }
210
+}
211
+
212
+static void truespeech_place_pulses(TSContext *dec, int16_t *out, int quart)
213
+{
214
+    int16_t tmp[7];
215
+    int i, j, t;
216
+    int16_t *ptr1, *ptr2;
217
+    int coef;
218
+
219
+    memset(out, 0, 60 * 2);
220
+    for(i = 0; i < 7; i++) {
221
+        t = dec->pulseval[quart] & 3;
222
+        dec->pulseval[quart] >>= 2;
223
+        tmp[6 - i] = ts_562[dec->pulseoff[quart] * 4 + t];
224
+    }
225
+
226
+    coef = dec->pulsepos[quart] >> 15;
227
+    ptr1 = ts_140 + 30;
228
+    ptr2 = tmp;
229
+    for(i = 0, j = 3; (i < 30) && (j > 0); i++){
230
+        t = *ptr1++;
231
+        if(coef >= t)
232
+            coef -= t;
233
+        else{
234
+            out[i] = *ptr2++;
235
+            ptr1 += 30;
236
+            j--;
237
+        }
238
+    }
239
+    coef = dec->pulsepos[quart] & 0x7FFF;
240
+    ptr1 = ts_140;
241
+    for(i = 30, j = 4; (i < 60) && (j > 0); i++){
242
+        t = *ptr1++;
243
+        if(coef >= t)
244
+            coef -= t;
245
+        else{
246
+            out[i] = *ptr2++;
247
+            ptr1 += 30;
248
+            j--;
249
+        }
250
+    }
251
+
252
+}
253
+
254
+static void truespeech_update_filters(TSContext *dec, int16_t *out, int quart)
255
+{
256
+    int i;
257
+
258
+    for(i = 0; i < 86; i++)
259
+        dec->filtbuf[i] = dec->filtbuf[i + 60];
260
+    for(i = 0; i < 60; i++){
261
+        dec->filtbuf[i + 86] = out[i] + dec->newvec[i] - (dec->newvec[i] >> 3);
262
+        out[i] += dec->newvec[i];
263
+    }
264
+}
265
+
266
+static void truespeech_synth(TSContext *dec, int16_t *out, int quart)
267
+{
268
+    int i,k;
269
+    int t[8];
270
+    int16_t *ptr0, *ptr1;
271
+
272
+    ptr0 = dec->tmp1;
273
+    ptr1 = dec->filters + quart * 8;
274
+    for(i = 0; i < 60; i++){
275
+        int sum = 0;
276
+        for(k = 0; k < 8; k++)
277
+            sum += ptr0[k] * ptr1[k];
278
+        sum = (sum + (out[i] << 12) + 0x800) >> 12;
279
+        out[i] = clip(sum, -0x7FFE, 0x7FFE);
280
+        for(k = 7; k > 0; k--)
281
+            ptr0[k] = ptr0[k - 1];
282
+        ptr0[0] = out[i];
283
+    }
284
+
285
+    for(i = 0; i < 8; i++)
286
+        t[i] = (ts_5E2[i] * ptr1[i]) >> 15;
287
+
288
+    ptr0 = dec->tmp2;
289
+    for(i = 0; i < 60; i++){
290
+        int sum = 0;
291
+        for(k = 0; k < 8; k++)
292
+            sum += ptr0[k] * t[k];
293
+        for(k = 7; k > 0; k--)
294
+            ptr0[k] = ptr0[k - 1];
295
+        ptr0[0] = out[i];
296
+        out[i] = ((out[i] << 12) - sum) >> 12;
297
+    }
298
+
299
+    for(i = 0; i < 8; i++)
300
+        t[i] = (ts_5F2[i] * ptr1[i]) >> 15;
301
+
302
+    ptr0 = dec->tmp3;
303
+    for(i = 0; i < 60; i++){
304
+        int sum = out[i] << 12;
305
+        for(k = 0; k < 8; k++)
306
+            sum += ptr0[k] * t[k];
307
+        for(k = 7; k > 0; k--)
308
+            ptr0[k] = ptr0[k - 1];
309
+        ptr0[0] = clip((sum + 0x800) >> 12, -0x7FFE, 0x7FFE);
310
+
311
+        sum = ((ptr0[1] * (dec->filtval - (dec->filtval >> 2))) >> 4) + sum;
312
+        sum = sum - (sum >> 3);
313
+        out[i] = clip((sum + 0x800) >> 12, -0x7FFE, 0x7FFE);
314
+    }
315
+}
316
+
317
+static void truespeech_save_prevvec(TSContext *c)
318
+{
319
+    int i;
320
+
321
+    for(i = 0; i < 8; i++)
322
+        c->prevfilt[i] = c->cvector[i];
323
+}
324
+
325
+static int truespeech_decode_frame(AVCodecContext *avctx,
326
+                void *data, int *data_size,
327
+                uint8_t *buf, int buf_size)
328
+{
329
+    TSContext *c = avctx->priv_data;
330
+
331
+    int i;
332
+    short *samples = data;
333
+    int consumed = 0;
334
+    int16_t out_buf[240];
335
+
336
+    if (!buf_size)
337
+        return 0;
338
+
339
+    while (consumed < buf_size) {
340
+        truespeech_read_frame(c, buf + consumed);
341
+        consumed += 32;
342
+
343
+        truespeech_correlate_filter(c);
344
+        truespeech_filters_merge(c);
345
+
346
+        memset(out_buf, 0, 240 * 2);
347
+        for(i = 0; i < 4; i++) {
348
+            truespeech_apply_twopoint_filter(c, i);
349
+            truespeech_place_pulses(c, out_buf + i * 60, i);
350
+            truespeech_update_filters(c, out_buf + i * 60, i);
351
+            truespeech_synth(c, out_buf + i * 60, i);
352
+        }
353
+
354
+        truespeech_save_prevvec(c);
355
+
356
+        /* finally output decoded frame */
357
+        for(i = 0; i < 240; i++)
358
+            *samples++ = out_buf[i];
359
+
360
+    }
361
+
362
+    *data_size = consumed * 15;
363
+
364
+    return buf_size;
365
+}
366
+
367
+AVCodec truespeech_decoder = {
368
+    "truespeech",
369
+    CODEC_TYPE_AUDIO,
370
+    CODEC_ID_TRUESPEECH,
371
+    sizeof(TSContext),
372
+    truespeech_decode_init,
373
+    NULL,
374
+    NULL,
375
+    truespeech_decode_frame,
376
+};
0 377
new file mode 100644
... ...
@@ -0,0 +1,136 @@
0
+#ifndef __TRUESPEECH_DATA__
1
+#define __TRUESPEECH_DATA__
2
+
3
+/* codebooks fo expanding input filter */
4
+const int16_t ts_cb_0[32] = {
5
+    0x8240, 0x8364, 0x84CE, 0x865D, 0x8805, 0x89DE, 0x8BD7, 0x8DF4,
6
+    0x9051, 0x92E2, 0x95DE, 0x990F, 0x9C81, 0xA079, 0xA54C, 0xAAD2,
7
+    0xB18A, 0xB90A, 0xC124, 0xC9CC, 0xD339, 0xDDD3, 0xE9D6, 0xF893,
8
+    0x096F, 0x1ACA, 0x29EC, 0x381F, 0x45F9, 0x546A, 0x63C3, 0x73B5,
9
+};
10
+
11
+const int16_t ts_cb_1[32] = {
12
+    0x9F65, 0xB56B, 0xC583, 0xD371, 0xE018, 0xEBB4, 0xF61C, 0xFF59,
13
+    0x085B, 0x1106, 0x1952, 0x214A, 0x28C9, 0x2FF8, 0x36E6, 0x3D92,
14
+    0x43DF, 0x49BB, 0x4F46, 0x5467, 0x5930, 0x5DA3, 0x61EC, 0x65F9,
15
+    0x69D4, 0x6D5A, 0x709E, 0x73AD, 0x766B, 0x78F0, 0x7B5A, 0x7DA5,
16
+};
17
+
18
+const int16_t ts_cb_2[16] = {
19
+    0x96F8, 0xA3B4, 0xAF45, 0xBA53, 0xC4B1, 0xCECC, 0xD86F, 0xE21E,
20
+    0xEBF3, 0xF640, 0x00F7, 0x0C20, 0x1881, 0x269A, 0x376B, 0x4D60,
21
+};
22
+
23
+const int16_t ts_cb_3[16] = {
24
+    0xC654, 0xDEF2, 0xEFAA, 0xFD94, 0x096A, 0x143F, 0x1E7B, 0x282C,
25
+    0x3176, 0x3A89, 0x439F, 0x4CA2, 0x557F, 0x5E50, 0x6718, 0x6F8D,
26
+};
27
+
28
+const int16_t ts_cb_4[16] = {
29
+    0xABE7, 0xBBA8, 0xC81C, 0xD326, 0xDD0E, 0xE5D4, 0xEE22, 0xF618,
30
+    0xFE28, 0x064F, 0x0EB7, 0x17B8, 0x21AA, 0x2D8B, 0x3BA2, 0x4DF9,
31
+};
32
+
33
+const int16_t ts_cb_5[8] = {
34
+    0xD51B, 0xF12E, 0x042E, 0x13C7, 0x2260, 0x311B, 0x40DE, 0x5385,
35
+};
36
+
37
+const int16_t ts_cb_6[8] = {
38
+    0xB550, 0xC825, 0xD980, 0xE997, 0xF883, 0x0752, 0x1811, 0x2E18,
39
+};
40
+
41
+const int16_t ts_cb_7[8] = {
42
+    0xCEF0, 0xE4F9, 0xF6BB, 0x0646, 0x14F5, 0x23FF, 0x356F, 0x4A8D,
43
+};
44
+
45
+const int16_t *ts_codebook[8] = {
46
+    ts_cb_0, ts_cb_1, ts_cb_2, ts_cb_3, ts_cb_4, ts_cb_5, ts_cb_6, ts_cb_7
47
+};
48
+
49
+/* table used for decoding pulse positions */
50
+const int16_t ts_140[120] = {
51
+    0x0E46, 0x0CCC, 0x0B6D, 0x0A28, 0x08FC, 0x07E8, 0x06EB, 0x0604,
52
+    0x0532, 0x0474, 0x03C9, 0x0330, 0x02A8, 0x0230, 0x01C7, 0x016C,
53
+    0x011E, 0x00DC, 0x00A5, 0x0078, 0x0054, 0x0038, 0x0023, 0x0014,
54
+    0x000A, 0x0004, 0x0001, 0x0000, 0x0000, 0x0000,
55
+
56
+    0x0196, 0x017A, 0x015F, 0x0145, 0x012C, 0x0114, 0x00FD, 0x00E7,
57
+    0x00D2, 0x00BE, 0x00AB, 0x0099, 0x0088, 0x0078, 0x0069, 0x005B,
58
+    0x004E, 0x0042, 0x0037, 0x002D, 0x0024, 0x001C, 0x0015, 0x000F,
59
+    0x000A, 0x0006, 0x0003, 0x0001, 0x0000, 0x0000,
60
+
61
+    0x001D, 0x001C, 0x001B, 0x001A, 0x0019, 0x0018, 0x0017, 0x0016,
62
+    0x0015, 0x0014, 0x0013, 0x0012, 0x0011, 0x0010, 0x000F, 0x000E,
63
+    0x000D, 0x000C, 0x000B, 0x000A, 0x0009, 0x0008, 0x0007, 0x0006,
64
+    0x0005, 0x0004, 0x0003, 0x0002, 0x0001, 0x0000,
65
+
66
+    0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001,
67
+    0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001,
68
+    0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001,
69
+    0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001
70
+};
71
+
72
+/* filter for correlated input filter */
73
+const int16_t ts_230[8] =
74
+    { 0x7F3B, 0x7E78, 0x7DB6, 0x7CF5, 0x7C35, 0x7B76, 0x7AB8, 0x79FC };
75
+
76
+/* two-point filters table */
77
+const int16_t ts_240[25 * 2] = {
78
+    0xED2F, 0x5239,
79
+    0x54F1, 0xE4A9,
80
+    0x2620, 0xEE3E,
81
+    0x09D6, 0x2C40,
82
+    0xEFB5, 0x2BE0,
83
+
84
+    0x3FE1, 0x3339,
85
+    0x442F, 0xE6FE,
86
+    0x4458, 0xF9DF,
87
+    0xF231, 0x43DB,
88
+    0x3DB0, 0xF705,
89
+
90
+    0x4F7B, 0xFEFB,
91
+    0x26AD, 0x0CDC,
92
+    0x33C2, 0x0739,
93
+    0x12BE, 0x43A2,
94
+    0x1BDF, 0x1F3E,
95
+
96
+    0x0211, 0x0796,
97
+    0x2AEB, 0x163F,
98
+    0x050D, 0x3A38,
99
+    0x0D1E, 0x0D78,
100
+    0x150F, 0x3346,
101
+
102
+    0x38A4, 0x0B7D,
103
+    0x2D5D, 0x1FDF,
104
+    0x19B7, 0x2822,
105
+    0x0D99, 0x1F12,
106
+    0x194C, 0x0CE6
107
+};
108
+
109
+/* possible pulse values */
110
+const int16_t ts_562[64] = {
111
+    0x0002, 0x0006, 0xFFFE, 0xFFFA,
112
+    0x0004, 0x000C, 0xFFFC, 0xFFF4,
113
+    0x0006, 0x0012, 0xFFFA, 0xFFEE,
114
+    0x000A, 0x001E, 0xFFF6, 0xFFE2,
115
+    0x0010, 0x0030, 0xFFF0, 0xFFD0,
116
+    0x0019, 0x004B, 0xFFE7, 0xFFB5,
117
+    0x0028, 0x0078, 0xFFD8, 0xFF88,
118
+    0x0040, 0x00C0, 0xFFC0, 0xFF40,
119
+    0x0065, 0x012F, 0xFF9B, 0xFED1,
120
+    0x00A1, 0x01E3, 0xFF5F, 0xFE1D,
121
+    0x0100, 0x0300, 0xFF00, 0xFD00,
122
+    0x0196, 0x04C2, 0xFE6A, 0xFB3E,
123
+    0x0285, 0x078F, 0xFD7B, 0xF871,
124
+    0x0400, 0x0C00, 0xFC00, 0xF400,
125
+    0x0659, 0x130B, 0xF9A7, 0xECF5,
126
+    0x0A14, 0x1E3C, 0xF5EC, 0xE1C4
127
+};
128
+
129
+/* filters used in final output calculations */
130
+const int16_t ts_5E2[8] =
131
+    { 0x4666, 0x26B8, 0x154C, 0x0BB6, 0x0671, 0x038B, 0x01F3, 0x0112 };
132
+const int16_t ts_5F2[8] =
133
+    { 0x6000, 0x4800, 0x3600, 0x2880, 0x1E60, 0x16C8, 0x1116, 0x0CD1 };
134
+
135
+#endif
... ...
@@ -44,6 +44,7 @@ const CodecTag codec_wav_tags[] = {
44 44
     { CODEC_ID_SONIC_LS, 0x2048 },
45 45
     { CODEC_ID_ADPCM_CT, 0x200 },
46 46
     { CODEC_ID_ADPCM_SWF, ('S'<<8)+'F' },
47
+    { CODEC_ID_TRUESPEECH, 0x22 },
47 48
     { 0, 0 },
48 49
 };
49 50