Mercurial > libavcodec.hg
annotate tta.c @ 3846:afbeb215e56f libavcodec
Original Commit: r43 | ods15 | 2006-09-23 10:53:46 +0300 (Sat, 23 Sep 2006) | 2 lines
change residue codebook dimentions
author | ods15 |
---|---|
date | Mon, 02 Oct 2006 05:56:35 +0000 |
parents | 5ecf721e6148 |
children | c8c591fe26f8 |
rev | line source |
---|---|
3118
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
1 /* |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
2 * TTA (The Lossless True Audio) decoder |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
3 * Copyright (c) 2006 Alex Beregszaszi |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
4 * |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
5 * This library is free software; you can redistribute it and/or |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
6 * modify it under the terms of the GNU Lesser General Public |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
7 * License as published by the Free Software Foundation; either |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
8 * version 2 of the License, or (at your option) any later version. |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
9 * |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
10 * This library is distributed in the hope that it will be useful, |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
13 * Lesser General Public License for more details. |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
14 * |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
15 * You should have received a copy of the GNU Lesser General Public |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
16 * License along with this library; if not, write to the Free Software |
3517 | 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
3118
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
18 */ |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
19 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
20 /** |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
21 * @file tta.c |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
22 * TTA (The Lossless True Audio) decoder |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
23 * (www.true-audio.com or tta.corecodec.org) |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
24 * @author Alex Beregszaszi |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
25 * |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
26 */ |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
27 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
28 #define ALT_BITSTREAM_READER_LE |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
29 //#define DEBUG |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
30 #include <limits.h> |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
31 #include "avcodec.h" |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
32 #include "bitstream.h" |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
33 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
34 #define FORMAT_INT 1 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
35 #define FORMAT_FLOAT 3 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
36 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
37 typedef struct TTAContext { |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
38 AVCodecContext *avctx; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
39 GetBitContext gb; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
40 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
41 int flags, channels, bps, is_float, data_length; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
42 int frame_length, last_frame_length, total_frames; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
43 |
3151
27e1b9632715
64bit fixes for the tta decoder, sizeof(long) is 8 on amd64, 4 on x86, the patch
banan
parents:
3118
diff
changeset
|
44 int32_t *decode_buffer; |
3118
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
45 } TTAContext; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
46 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
47 #if 0 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
48 static inline int shift_1(int i) |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
49 { |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
50 if (i < 32) |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
51 return 1 << i; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
52 else |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
53 return 0x80000000; // 16 << 31 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
54 } |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
55 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
56 static inline int shift_16(int i) |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
57 { |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
58 if (i < 28) |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
59 return 16 << i; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
60 else |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
61 return 0x80000000; // 16 << 27 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
62 } |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
63 #else |
3151
27e1b9632715
64bit fixes for the tta decoder, sizeof(long) is 8 on amd64, 4 on x86, the patch
banan
parents:
3118
diff
changeset
|
64 static const uint32_t shift_1[] = { |
3118
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
65 0x00000001, 0x00000002, 0x00000004, 0x00000008, |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
66 0x00000010, 0x00000020, 0x00000040, 0x00000080, |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
67 0x00000100, 0x00000200, 0x00000400, 0x00000800, |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
68 0x00001000, 0x00002000, 0x00004000, 0x00008000, |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
69 0x00010000, 0x00020000, 0x00040000, 0x00080000, |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
70 0x00100000, 0x00200000, 0x00400000, 0x00800000, |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
71 0x01000000, 0x02000000, 0x04000000, 0x08000000, |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
72 0x10000000, 0x20000000, 0x40000000, 0x80000000, |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
73 0x80000000, 0x80000000, 0x80000000, 0x80000000, |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
74 0x80000000, 0x80000000, 0x80000000, 0x80000000 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
75 }; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
76 |
3151
27e1b9632715
64bit fixes for the tta decoder, sizeof(long) is 8 on amd64, 4 on x86, the patch
banan
parents:
3118
diff
changeset
|
77 static const uint32_t *shift_16 = shift_1 + 4; |
3118
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
78 #endif |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
79 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
80 #define MAX_ORDER 16 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
81 typedef struct TTAFilter { |
3151
27e1b9632715
64bit fixes for the tta decoder, sizeof(long) is 8 on amd64, 4 on x86, the patch
banan
parents:
3118
diff
changeset
|
82 int32_t shift, round, error, mode; |
27e1b9632715
64bit fixes for the tta decoder, sizeof(long) is 8 on amd64, 4 on x86, the patch
banan
parents:
3118
diff
changeset
|
83 int32_t qm[MAX_ORDER]; |
27e1b9632715
64bit fixes for the tta decoder, sizeof(long) is 8 on amd64, 4 on x86, the patch
banan
parents:
3118
diff
changeset
|
84 int32_t dx[MAX_ORDER]; |
27e1b9632715
64bit fixes for the tta decoder, sizeof(long) is 8 on amd64, 4 on x86, the patch
banan
parents:
3118
diff
changeset
|
85 int32_t dl[MAX_ORDER]; |
3118
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
86 } TTAFilter; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
87 |
3151
27e1b9632715
64bit fixes for the tta decoder, sizeof(long) is 8 on amd64, 4 on x86, the patch
banan
parents:
3118
diff
changeset
|
88 static int32_t ttafilter_configs[4][2] = { |
3118
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
89 {10, 1}, |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
90 {9, 1}, |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
91 {10, 1}, |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
92 {12, 0} |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
93 }; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
94 |
3151
27e1b9632715
64bit fixes for the tta decoder, sizeof(long) is 8 on amd64, 4 on x86, the patch
banan
parents:
3118
diff
changeset
|
95 static void ttafilter_init(TTAFilter *c, int32_t shift, int32_t mode) { |
3118
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
96 memset(c, 0, sizeof(TTAFilter)); |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
97 c->shift = shift; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
98 c->round = shift_1[shift-1]; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
99 // c->round = 1 << (shift - 1); |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
100 c->mode = mode; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
101 } |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
102 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
103 // FIXME: copy paste from original |
3151
27e1b9632715
64bit fixes for the tta decoder, sizeof(long) is 8 on amd64, 4 on x86, the patch
banan
parents:
3118
diff
changeset
|
104 static inline void memshl(register int32_t *a, register int32_t *b) { |
3118
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
105 *a++ = *b++; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
106 *a++ = *b++; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
107 *a++ = *b++; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
108 *a++ = *b++; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
109 *a++ = *b++; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
110 *a++ = *b++; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
111 *a++ = *b++; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
112 *a = *b; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
113 } |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
114 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
115 // FIXME: copy paste from original |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
116 // mode=1 encoder, mode=0 decoder |
3151
27e1b9632715
64bit fixes for the tta decoder, sizeof(long) is 8 on amd64, 4 on x86, the patch
banan
parents:
3118
diff
changeset
|
117 static inline void ttafilter_process(TTAFilter *c, int32_t *in, int32_t mode) { |
27e1b9632715
64bit fixes for the tta decoder, sizeof(long) is 8 on amd64, 4 on x86, the patch
banan
parents:
3118
diff
changeset
|
118 register int32_t *dl = c->dl, *qm = c->qm, *dx = c->dx, sum = c->round; |
3118
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
119 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
120 if (!c->error) { |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
121 sum += *dl++ * *qm, qm++; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
122 sum += *dl++ * *qm, qm++; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
123 sum += *dl++ * *qm, qm++; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
124 sum += *dl++ * *qm, qm++; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
125 sum += *dl++ * *qm, qm++; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
126 sum += *dl++ * *qm, qm++; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
127 sum += *dl++ * *qm, qm++; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
128 sum += *dl++ * *qm, qm++; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
129 dx += 8; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
130 } else if(c->error < 0) { |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
131 sum += *dl++ * (*qm -= *dx++), qm++; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
132 sum += *dl++ * (*qm -= *dx++), qm++; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
133 sum += *dl++ * (*qm -= *dx++), qm++; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
134 sum += *dl++ * (*qm -= *dx++), qm++; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
135 sum += *dl++ * (*qm -= *dx++), qm++; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
136 sum += *dl++ * (*qm -= *dx++), qm++; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
137 sum += *dl++ * (*qm -= *dx++), qm++; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
138 sum += *dl++ * (*qm -= *dx++), qm++; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
139 } else { |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
140 sum += *dl++ * (*qm += *dx++), qm++; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
141 sum += *dl++ * (*qm += *dx++), qm++; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
142 sum += *dl++ * (*qm += *dx++), qm++; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
143 sum += *dl++ * (*qm += *dx++), qm++; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
144 sum += *dl++ * (*qm += *dx++), qm++; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
145 sum += *dl++ * (*qm += *dx++), qm++; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
146 sum += *dl++ * (*qm += *dx++), qm++; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
147 sum += *dl++ * (*qm += *dx++), qm++; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
148 } |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
149 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
150 *(dx-0) = ((*(dl-1) >> 30) | 1) << 2; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
151 *(dx-1) = ((*(dl-2) >> 30) | 1) << 1; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
152 *(dx-2) = ((*(dl-3) >> 30) | 1) << 1; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
153 *(dx-3) = ((*(dl-4) >> 30) | 1); |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
154 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
155 // compress |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
156 if (mode) { |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
157 *dl = *in; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
158 *in -= (sum >> c->shift); |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
159 c->error = *in; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
160 } else { |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
161 c->error = *in; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
162 *in += (sum >> c->shift); |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
163 *dl = *in; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
164 } |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
165 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
166 if (c->mode) { |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
167 *(dl-1) = *dl - *(dl-1); |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
168 *(dl-2) = *(dl-1) - *(dl-2); |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
169 *(dl-3) = *(dl-2) - *(dl-3); |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
170 } |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
171 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
172 memshl(c->dl, c->dl + 1); |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
173 memshl(c->dx, c->dx + 1); |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
174 } |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
175 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
176 typedef struct TTARice { |
3151
27e1b9632715
64bit fixes for the tta decoder, sizeof(long) is 8 on amd64, 4 on x86, the patch
banan
parents:
3118
diff
changeset
|
177 uint32_t k0, k1, sum0, sum1; |
3118
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
178 } TTARice; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
179 |
3151
27e1b9632715
64bit fixes for the tta decoder, sizeof(long) is 8 on amd64, 4 on x86, the patch
banan
parents:
3118
diff
changeset
|
180 static void rice_init(TTARice *c, uint32_t k0, uint32_t k1) |
3118
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
181 { |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
182 c->k0 = k0; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
183 c->k1 = k1; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
184 c->sum0 = shift_16[k0]; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
185 c->sum1 = shift_16[k1]; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
186 } |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
187 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
188 static int tta_get_unary(GetBitContext *gb) |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
189 { |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
190 int ret = 0; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
191 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
192 // count ones |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
193 while(get_bits1(gb)) |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
194 ret++; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
195 return ret; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
196 } |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
197 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
198 static int tta_decode_init(AVCodecContext * avctx) |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
199 { |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
200 TTAContext *s = avctx->priv_data; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
201 int i; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
202 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
203 s->avctx = avctx; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
204 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
205 // 30bytes includes a seektable with one frame |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
206 if (avctx->extradata_size < 30) |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
207 return -1; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
208 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
209 init_get_bits(&s->gb, avctx->extradata, avctx->extradata_size); |
3761
c559d45f66e8
Changes needed due to show_bits_long behaviour changes/fixes
reimar
parents:
3517
diff
changeset
|
210 if (show_bits_long(&s->gb, 32) == ff_get_fourcc("TTA1")) |
3118
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
211 { |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
212 /* signature */ |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
213 skip_bits(&s->gb, 32); |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
214 // if (get_bits_long(&s->gb, 32) != bswap_32(ff_get_fourcc("TTA1"))) { |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
215 // av_log(s->avctx, AV_LOG_ERROR, "Missing magic\n"); |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
216 // return -1; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
217 // } |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
218 |
3763
5ecf721e6148
remove get_le16 and get_le32, get_bits and get_bits_long can just be used directly.
reimar
parents:
3761
diff
changeset
|
219 s->flags = get_bits(&s->gb, 16); |
3118
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
220 if (s->flags != 1 && s->flags != 3) |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
221 { |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
222 av_log(s->avctx, AV_LOG_ERROR, "Invalid flags\n"); |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
223 return -1; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
224 } |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
225 s->is_float = (s->flags == FORMAT_FLOAT); |
3763
5ecf721e6148
remove get_le16 and get_le32, get_bits and get_bits_long can just be used directly.
reimar
parents:
3761
diff
changeset
|
226 avctx->channels = s->channels = get_bits(&s->gb, 16); |
5ecf721e6148
remove get_le16 and get_le32, get_bits and get_bits_long can just be used directly.
reimar
parents:
3761
diff
changeset
|
227 avctx->bits_per_sample = get_bits(&s->gb, 16); |
3118
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
228 s->bps = (avctx->bits_per_sample + 7) / 8; |
3763
5ecf721e6148
remove get_le16 and get_le32, get_bits and get_bits_long can just be used directly.
reimar
parents:
3761
diff
changeset
|
229 avctx->sample_rate = get_bits_long(&s->gb, 32); |
3303
68721b62a528
sanity checks, some might have been exploitable ...
michael
parents:
3151
diff
changeset
|
230 if(avctx->sample_rate > 1000000){ //prevent FRAME_TIME * avctx->sample_rate from overflowing and sanity check |
68721b62a528
sanity checks, some might have been exploitable ...
michael
parents:
3151
diff
changeset
|
231 av_log(avctx, AV_LOG_ERROR, "sample_rate too large\n"); |
68721b62a528
sanity checks, some might have been exploitable ...
michael
parents:
3151
diff
changeset
|
232 return -1; |
68721b62a528
sanity checks, some might have been exploitable ...
michael
parents:
3151
diff
changeset
|
233 } |
3763
5ecf721e6148
remove get_le16 and get_le32, get_bits and get_bits_long can just be used directly.
reimar
parents:
3761
diff
changeset
|
234 s->data_length = get_bits_long(&s->gb, 32); |
3118
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
235 skip_bits(&s->gb, 32); // CRC32 of header |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
236 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
237 if (s->is_float) |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
238 { |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
239 avctx->sample_fmt = SAMPLE_FMT_FLT; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
240 av_log(s->avctx, AV_LOG_ERROR, "Unsupported sample format. Please contact the developers.\n"); |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
241 return -1; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
242 } |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
243 else switch(s->bps) { |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
244 // case 1: avctx->sample_fmt = SAMPLE_FMT_U8; break; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
245 case 2: avctx->sample_fmt = SAMPLE_FMT_S16; break; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
246 // case 3: avctx->sample_fmt = SAMPLE_FMT_S24; break; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
247 case 4: avctx->sample_fmt = SAMPLE_FMT_S32; break; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
248 default: |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
249 av_log(s->avctx, AV_LOG_ERROR, "Invalid/unsupported sample format. Please contact the developers.\n"); |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
250 return -1; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
251 } |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
252 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
253 // FIXME: horribly broken, but directly from reference source |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
254 #define FRAME_TIME 1.04489795918367346939 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
255 s->frame_length = (int)(FRAME_TIME * avctx->sample_rate); |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
256 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
257 s->last_frame_length = s->data_length % s->frame_length; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
258 s->total_frames = s->data_length / s->frame_length + |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
259 (s->last_frame_length ? 1 : 0); |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
260 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
261 av_log(s->avctx, AV_LOG_DEBUG, "flags: %x chans: %d bps: %d rate: %d block: %d\n", |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
262 s->flags, avctx->channels, avctx->bits_per_sample, avctx->sample_rate, |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
263 avctx->block_align); |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
264 av_log(s->avctx, AV_LOG_DEBUG, "data_length: %d frame_length: %d last: %d total: %d\n", |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
265 s->data_length, s->frame_length, s->last_frame_length, s->total_frames); |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
266 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
267 // FIXME: seek table |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
268 for (i = 0; i < s->total_frames; i++) |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
269 skip_bits(&s->gb, 32); |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
270 skip_bits(&s->gb, 32); // CRC32 of seektable |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
271 |
3303
68721b62a528
sanity checks, some might have been exploitable ...
michael
parents:
3151
diff
changeset
|
272 if(s->frame_length >= UINT_MAX / (s->channels * sizeof(int32_t))){ |
68721b62a528
sanity checks, some might have been exploitable ...
michael
parents:
3151
diff
changeset
|
273 av_log(avctx, AV_LOG_ERROR, "frame_length too large\n"); |
68721b62a528
sanity checks, some might have been exploitable ...
michael
parents:
3151
diff
changeset
|
274 return -1; |
68721b62a528
sanity checks, some might have been exploitable ...
michael
parents:
3151
diff
changeset
|
275 } |
68721b62a528
sanity checks, some might have been exploitable ...
michael
parents:
3151
diff
changeset
|
276 |
3151
27e1b9632715
64bit fixes for the tta decoder, sizeof(long) is 8 on amd64, 4 on x86, the patch
banan
parents:
3118
diff
changeset
|
277 s->decode_buffer = av_mallocz(sizeof(int32_t)*s->frame_length*s->channels); |
3118
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
278 } else { |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
279 av_log(avctx, AV_LOG_ERROR, "Wrong extradata present\n"); |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
280 return -1; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
281 } |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
282 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
283 return 0; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
284 } |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
285 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
286 static int tta_decode_frame(AVCodecContext *avctx, |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
287 void *data, int *data_size, |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
288 uint8_t *buf, int buf_size) |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
289 { |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
290 TTAContext *s = avctx->priv_data; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
291 int i; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
292 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
293 init_get_bits(&s->gb, buf, buf_size*8); |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
294 { |
3151
27e1b9632715
64bit fixes for the tta decoder, sizeof(long) is 8 on amd64, 4 on x86, the patch
banan
parents:
3118
diff
changeset
|
295 int32_t predictors[s->channels]; |
3118
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
296 TTAFilter filters[s->channels]; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
297 TTARice rices[s->channels]; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
298 int cur_chan = 0, framelen = s->frame_length; |
3151
27e1b9632715
64bit fixes for the tta decoder, sizeof(long) is 8 on amd64, 4 on x86, the patch
banan
parents:
3118
diff
changeset
|
299 int32_t *p; |
3118
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
300 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
301 // FIXME: seeking |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
302 s->total_frames--; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
303 if (!s->total_frames && s->last_frame_length) |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
304 framelen = s->last_frame_length; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
305 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
306 // init per channel states |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
307 for (i = 0; i < s->channels; i++) { |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
308 predictors[i] = 0; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
309 ttafilter_init(&(filters[i]), ttafilter_configs[s->bps-1][0], ttafilter_configs[s->bps-1][1]); |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
310 rice_init(&(rices[i]), 10, 10); |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
311 } |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
312 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
313 for (p = s->decode_buffer; p < s->decode_buffer + (framelen * s->channels); p++) { |
3151
27e1b9632715
64bit fixes for the tta decoder, sizeof(long) is 8 on amd64, 4 on x86, the patch
banan
parents:
3118
diff
changeset
|
314 int32_t *predictor = &(predictors[cur_chan]); |
3118
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
315 TTAFilter *filter = &(filters[cur_chan]); |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
316 TTARice *rice = &(rices[cur_chan]); |
3151
27e1b9632715
64bit fixes for the tta decoder, sizeof(long) is 8 on amd64, 4 on x86, the patch
banan
parents:
3118
diff
changeset
|
317 uint32_t unary, depth, k; |
27e1b9632715
64bit fixes for the tta decoder, sizeof(long) is 8 on amd64, 4 on x86, the patch
banan
parents:
3118
diff
changeset
|
318 int32_t value; |
3118
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
319 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
320 unary = tta_get_unary(&s->gb); |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
321 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
322 if (unary == 0) { |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
323 depth = 0; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
324 k = rice->k0; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
325 } else { |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
326 depth = 1; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
327 k = rice->k1; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
328 unary--; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
329 } |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
330 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
331 if (k) |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
332 value = (unary << k) + get_bits(&s->gb, k); |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
333 else |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
334 value = unary; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
335 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
336 // FIXME: copy paste from original |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
337 switch (depth) { |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
338 case 1: |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
339 rice->sum1 += value - (rice->sum1 >> 4); |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
340 if (rice->k1 > 0 && rice->sum1 < shift_16[rice->k1]) |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
341 rice->k1--; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
342 else if(rice->sum1 > shift_16[rice->k1 + 1]) |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
343 rice->k1++; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
344 value += shift_1[rice->k0]; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
345 default: |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
346 rice->sum0 += value - (rice->sum0 >> 4); |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
347 if (rice->k0 > 0 && rice->sum0 < shift_16[rice->k0]) |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
348 rice->k0--; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
349 else if(rice->sum0 > shift_16[rice->k0 + 1]) |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
350 rice->k0++; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
351 } |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
352 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
353 // extract sign |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
354 #define SIGN(x) (((x)&1) ? (++(x)>>1) : (-(x)>>1)) |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
355 *p = SIGN(value); |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
356 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
357 // run hybrid filter |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
358 ttafilter_process(filter, p, 0); |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
359 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
360 // fixed order prediction |
3151
27e1b9632715
64bit fixes for the tta decoder, sizeof(long) is 8 on amd64, 4 on x86, the patch
banan
parents:
3118
diff
changeset
|
361 #define PRED(x, k) (int32_t)((((uint64_t)x << k) - x) >> k) |
3118
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
362 switch (s->bps) { |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
363 case 1: *p += PRED(*predictor, 4); break; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
364 case 2: |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
365 case 3: *p += PRED(*predictor, 5); break; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
366 case 4: *p += *predictor; break; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
367 } |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
368 *predictor = *p; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
369 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
370 #if 0 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
371 // extract 32bit float from last two int samples |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
372 if (s->is_float && ((p - data) & 1)) { |
3151
27e1b9632715
64bit fixes for the tta decoder, sizeof(long) is 8 on amd64, 4 on x86, the patch
banan
parents:
3118
diff
changeset
|
373 uint32_t neg = *p & 0x80000000; |
27e1b9632715
64bit fixes for the tta decoder, sizeof(long) is 8 on amd64, 4 on x86, the patch
banan
parents:
3118
diff
changeset
|
374 uint32_t hi = *(p - 1); |
27e1b9632715
64bit fixes for the tta decoder, sizeof(long) is 8 on amd64, 4 on x86, the patch
banan
parents:
3118
diff
changeset
|
375 uint32_t lo = abs(*p) - 1; |
3118
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
376 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
377 hi += (hi || lo) ? 0x3f80 : 0; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
378 // SWAP16: swap all the 16 bits |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
379 *(p - 1) = (hi << 16) | SWAP16(lo) | neg; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
380 } |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
381 #endif |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
382 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
383 /*if ((get_bits_count(&s->gb)+7)/8 > buf_size) |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
384 { |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
385 av_log(NULL, AV_LOG_INFO, "overread!!\n"); |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
386 break; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
387 }*/ |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
388 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
389 // flip channels |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
390 if (cur_chan < (s->channels-1)) |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
391 cur_chan++; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
392 else { |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
393 // decorrelate in case of stereo integer |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
394 if (!s->is_float && (s->channels > 1)) { |
3151
27e1b9632715
64bit fixes for the tta decoder, sizeof(long) is 8 on amd64, 4 on x86, the patch
banan
parents:
3118
diff
changeset
|
395 int32_t *r = p - 1; |
3118
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
396 for (*p += *r / 2; r > p - s->channels; r--) |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
397 *r = *(r + 1) - *r; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
398 } |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
399 cur_chan = 0; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
400 } |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
401 } |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
402 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
403 skip_bits(&s->gb, 32); // frame crc |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
404 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
405 // convert to output buffer |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
406 switch(s->bps) { |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
407 case 2: { |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
408 uint16_t *samples = data; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
409 for (p = s->decode_buffer; p < s->decode_buffer + (framelen * s->channels); p++) { |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
410 // *samples++ = (unsigned char)*p; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
411 // *samples++ = (unsigned char)(*p >> 8); |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
412 *samples++ = *p; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
413 } |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
414 *data_size = (uint8_t *)samples - (uint8_t *)data; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
415 break; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
416 } |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
417 default: |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
418 av_log(s->avctx, AV_LOG_ERROR, "Error, only 16bit samples supported!\n"); |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
419 } |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
420 } |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
421 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
422 // return get_bits_count(&s->gb)+7)/8; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
423 return buf_size; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
424 } |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
425 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
426 static int tta_decode_close(AVCodecContext *avctx) { |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
427 TTAContext *s = avctx->priv_data; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
428 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
429 if (s->decode_buffer) |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
430 av_free(s->decode_buffer); |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
431 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
432 return 0; |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
433 } |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
434 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
435 AVCodec tta_decoder = { |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
436 "tta", |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
437 CODEC_TYPE_AUDIO, |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
438 CODEC_ID_TTA, |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
439 sizeof(TTAContext), |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
440 tta_decode_init, |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
441 NULL, |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
442 tta_decode_close, |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
443 tta_decode_frame, |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
444 }; |