Mercurial > libavcodec.hg
annotate tta.c @ 12528:f4caff0e1e10 libavcodec
In dv decoder, set sample aspect aspect ratio, fix issue #1612
author | bcoudurier |
---|---|
date | Mon, 27 Sep 2010 21:31:29 +0000 |
parents | 6cecfd898626 |
children |
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 * |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3763
diff
changeset
|
5 * This file is part of FFmpeg. |
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3763
diff
changeset
|
6 * |
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3763
diff
changeset
|
7 * FFmpeg is free software; you can redistribute it and/or |
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
|
8 * 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
|
9 * License as published by the Free Software Foundation; either |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3763
diff
changeset
|
10 * version 2.1 of the License, or (at your option) any later version. |
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
|
11 * |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3763
diff
changeset
|
12 * FFmpeg is distributed in the hope that it will be useful, |
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
|
13 * 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
|
14 * 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
|
15 * 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
|
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
|
17 * You should have received a copy of the GNU Lesser General Public |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3763
diff
changeset
|
18 * License along with FFmpeg; if not, write to the Free Software |
5215 | 19 * Foundation, Inc., 51 Franklin Street, 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
|
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 |
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 /** |
11644
7dd2a45249a9
Remove explicit filename from Doxygen @file commands.
diego
parents:
11560
diff
changeset
|
23 * @file |
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
|
24 * 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
|
25 * (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
|
26 * @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
|
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 */ |
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 |
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 #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
|
31 //#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
|
32 #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
|
33 #include "avcodec.h" |
9428 | 34 #include "get_bits.h" |
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
|
35 |
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 #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
|
37 #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
|
38 |
11946
c592b59ea05f
tta: replace potentially huge VLAs with malloc/free in context
mru
parents:
11644
diff
changeset
|
39 #define MAX_ORDER 16 |
c592b59ea05f
tta: replace potentially huge VLAs with malloc/free in context
mru
parents:
11644
diff
changeset
|
40 typedef struct TTAFilter { |
c592b59ea05f
tta: replace potentially huge VLAs with malloc/free in context
mru
parents:
11644
diff
changeset
|
41 int32_t shift, round, error, mode; |
c592b59ea05f
tta: replace potentially huge VLAs with malloc/free in context
mru
parents:
11644
diff
changeset
|
42 int32_t qm[MAX_ORDER]; |
c592b59ea05f
tta: replace potentially huge VLAs with malloc/free in context
mru
parents:
11644
diff
changeset
|
43 int32_t dx[MAX_ORDER]; |
c592b59ea05f
tta: replace potentially huge VLAs with malloc/free in context
mru
parents:
11644
diff
changeset
|
44 int32_t dl[MAX_ORDER]; |
c592b59ea05f
tta: replace potentially huge VLAs with malloc/free in context
mru
parents:
11644
diff
changeset
|
45 } TTAFilter; |
c592b59ea05f
tta: replace potentially huge VLAs with malloc/free in context
mru
parents:
11644
diff
changeset
|
46 |
c592b59ea05f
tta: replace potentially huge VLAs with malloc/free in context
mru
parents:
11644
diff
changeset
|
47 typedef struct TTARice { |
c592b59ea05f
tta: replace potentially huge VLAs with malloc/free in context
mru
parents:
11644
diff
changeset
|
48 uint32_t k0, k1, sum0, sum1; |
c592b59ea05f
tta: replace potentially huge VLAs with malloc/free in context
mru
parents:
11644
diff
changeset
|
49 } TTARice; |
c592b59ea05f
tta: replace potentially huge VLAs with malloc/free in context
mru
parents:
11644
diff
changeset
|
50 |
c592b59ea05f
tta: replace potentially huge VLAs with malloc/free in context
mru
parents:
11644
diff
changeset
|
51 typedef struct TTAChannel { |
c592b59ea05f
tta: replace potentially huge VLAs with malloc/free in context
mru
parents:
11644
diff
changeset
|
52 int32_t predictor; |
c592b59ea05f
tta: replace potentially huge VLAs with malloc/free in context
mru
parents:
11644
diff
changeset
|
53 TTAFilter filter; |
c592b59ea05f
tta: replace potentially huge VLAs with malloc/free in context
mru
parents:
11644
diff
changeset
|
54 TTARice rice; |
c592b59ea05f
tta: replace potentially huge VLAs with malloc/free in context
mru
parents:
11644
diff
changeset
|
55 } TTAChannel; |
c592b59ea05f
tta: replace potentially huge VLAs with malloc/free in context
mru
parents:
11644
diff
changeset
|
56 |
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
|
57 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
|
58 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
|
59 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
|
60 |
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 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
|
62 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
|
63 |
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 int32_t *decode_buffer; |
11946
c592b59ea05f
tta: replace potentially huge VLAs with malloc/free in context
mru
parents:
11644
diff
changeset
|
65 |
12487 | 66 TTAChannel *ch_ctx; |
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
|
67 } 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
|
68 |
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 #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
|
70 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
|
71 { |
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 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
|
73 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
|
74 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
|
75 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
|
76 } |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
77 |
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 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
|
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 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
|
81 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
|
82 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
|
83 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
|
84 } |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
85 #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
|
86 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
|
87 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
|
88 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
|
89 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
|
90 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
|
91 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
|
92 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
|
93 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
|
94 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
|
95 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
|
96 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
|
97 }; |
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 |
7129 | 99 static const uint32_t * const 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
|
100 #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
|
101 |
7129 | 102 static const 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
|
103 {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
|
104 {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
|
105 {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
|
106 {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
|
107 }; |
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 |
3151
27e1b9632715
64bit fixes for the tta decoder, sizeof(long) is 8 on amd64, 4 on x86, the patch
banan
parents:
3118
diff
changeset
|
109 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
|
110 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
|
111 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
|
112 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
|
113 // 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
|
114 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
|
115 } |
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 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
117 // 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
|
118 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
|
119 *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
|
120 *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
|
121 *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
|
122 *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
|
123 *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
|
124 *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
|
125 *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
|
126 *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
|
127 } |
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 |
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 // 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
|
130 // 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
|
131 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
|
132 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
|
133 |
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 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
|
135 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
|
136 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
|
137 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
|
138 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
|
139 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
|
140 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
|
141 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
|
142 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
|
143 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
|
144 } 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
|
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 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
|
149 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
|
150 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
|
151 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
|
152 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
|
153 } 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
|
154 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
|
155 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
|
156 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
|
157 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
|
158 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
|
159 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
|
160 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
|
161 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
|
162 } |
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 |
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 *(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
|
165 *(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
|
166 *(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
|
167 *(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
|
168 |
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 // 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
|
170 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
|
171 *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
|
172 *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
|
173 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
|
174 } 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
|
175 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
|
176 *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
|
177 *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
|
178 } |
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 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
180 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
|
181 *(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
|
182 *(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
|
183 *(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
|
184 } |
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 |
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 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
|
187 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
|
188 } |
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 |
3151
27e1b9632715
64bit fixes for the tta decoder, sizeof(long) is 8 on amd64, 4 on x86, the patch
banan
parents:
3118
diff
changeset
|
190 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
|
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 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
|
193 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
|
194 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
|
195 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
|
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_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
|
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 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
|
201 |
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 // 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
|
203 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
|
204 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
|
205 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
|
206 } |
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 |
6517
48759bfbd073
Apply 'cold' attribute to init/uninit functions in libavcodec
zuxy
parents:
6287
diff
changeset
|
208 static av_cold int tta_decode_init(AVCodecContext * avctx) |
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
|
209 { |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
210 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
|
211 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
|
212 |
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 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
|
214 |
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 // 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
|
216 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
|
217 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
|
218 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
219 init_get_bits(&s->gb, avctx->extradata, avctx->extradata_size); |
8612 | 220 if (show_bits_long(&s->gb, 32) == AV_RL32("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
|
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 /* 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
|
223 skip_bits(&s->gb, 32); |
12129 | 224 // if (get_bits_long(&s->gb, 32) != av_bswap32(AV_RL32("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
|
225 // 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
|
226 // 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
|
227 // } |
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 |
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 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
|
230 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
|
231 { |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
232 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
|
233 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
|
234 } |
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 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
|
236 avctx->channels = s->channels = get_bits(&s->gb, 16); |
7823
4525dcd81357
Bump Major version, this commit is almost just renaming bits_per_sample to
michael
parents:
7129
diff
changeset
|
237 avctx->bits_per_coded_sample = get_bits(&s->gb, 16); |
4525dcd81357
Bump Major version, this commit is almost just renaming bits_per_sample to
michael
parents:
7129
diff
changeset
|
238 s->bps = (avctx->bits_per_coded_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
|
239 avctx->sample_rate = get_bits_long(&s->gb, 32); |
3303
68721b62a528
sanity checks, some might have been exploitable ...
michael
parents:
3151
diff
changeset
|
240 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
|
241 av_log(avctx, AV_LOG_ERROR, "sample_rate too large\n"); |
68721b62a528
sanity checks, some might have been exploitable ...
michael
parents:
3151
diff
changeset
|
242 return -1; |
68721b62a528
sanity checks, some might have been exploitable ...
michael
parents:
3151
diff
changeset
|
243 } |
3763
5ecf721e6148
remove get_le16 and get_le32, get_bits and get_bits_long can just be used directly.
reimar
parents:
3761
diff
changeset
|
244 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
|
245 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
|
246 |
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 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
|
248 { |
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 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
|
250 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
|
251 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
|
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 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
|
254 // 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
|
255 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
|
256 // 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
|
257 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
|
258 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
|
259 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
|
260 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
|
261 } |
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 |
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 // 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
|
264 #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
|
265 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
|
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 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
|
268 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
|
269 (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
|
270 |
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 av_log(s->avctx, AV_LOG_DEBUG, "flags: %x chans: %d bps: %d rate: %d block: %d\n", |
7823
4525dcd81357
Bump Major version, this commit is almost just renaming bits_per_sample to
michael
parents:
7129
diff
changeset
|
272 s->flags, avctx->channels, avctx->bits_per_coded_sample, avctx->sample_rate, |
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
|
273 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
|
274 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
|
275 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
|
276 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
277 // 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
|
278 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
|
279 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
|
280 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
|
281 |
3303
68721b62a528
sanity checks, some might have been exploitable ...
michael
parents:
3151
diff
changeset
|
282 if(s->frame_length >= UINT_MAX / (s->channels * sizeof(int32_t))){ |
68721b62a528
sanity checks, some might have been exploitable ...
michael
parents:
3151
diff
changeset
|
283 av_log(avctx, AV_LOG_ERROR, "frame_length too large\n"); |
68721b62a528
sanity checks, some might have been exploitable ...
michael
parents:
3151
diff
changeset
|
284 return -1; |
68721b62a528
sanity checks, some might have been exploitable ...
michael
parents:
3151
diff
changeset
|
285 } |
68721b62a528
sanity checks, some might have been exploitable ...
michael
parents:
3151
diff
changeset
|
286 |
3151
27e1b9632715
64bit fixes for the tta decoder, sizeof(long) is 8 on amd64, 4 on x86, the patch
banan
parents:
3118
diff
changeset
|
287 s->decode_buffer = av_mallocz(sizeof(int32_t)*s->frame_length*s->channels); |
11946
c592b59ea05f
tta: replace potentially huge VLAs with malloc/free in context
mru
parents:
11644
diff
changeset
|
288 s->ch_ctx = av_malloc(avctx->channels * sizeof(*s->ch_ctx)); |
c592b59ea05f
tta: replace potentially huge VLAs with malloc/free in context
mru
parents:
11644
diff
changeset
|
289 if (!s->ch_ctx) |
c592b59ea05f
tta: replace potentially huge VLAs with malloc/free in context
mru
parents:
11644
diff
changeset
|
290 return AVERROR(ENOMEM); |
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
|
291 } 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
|
292 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
|
293 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
|
294 } |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
295 |
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 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
|
297 } |
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 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
299 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
|
300 void *data, int *data_size, |
9355
54bc8a2727b0
Implement avcodec_decode_video2(), _audio3() and _subtitle2() which takes an
rbultje
parents:
9082
diff
changeset
|
301 AVPacket *avpkt) |
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
|
302 { |
9355
54bc8a2727b0
Implement avcodec_decode_video2(), _audio3() and _subtitle2() which takes an
rbultje
parents:
9082
diff
changeset
|
303 const uint8_t *buf = avpkt->data; |
54bc8a2727b0
Implement avcodec_decode_video2(), _audio3() and _subtitle2() which takes an
rbultje
parents:
9082
diff
changeset
|
304 int buf_size = avpkt->size; |
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
|
305 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
|
306 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
|
307 |
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 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
|
309 { |
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 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
|
311 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
|
312 |
11546
1d81cd330928
TTA : Check if the output buffer size is within bounds.
jai_menon
parents:
11343
diff
changeset
|
313 if (*data_size < (framelen * s->channels * 2)) { |
11549 | 314 av_log(avctx, AV_LOG_ERROR, "Output buffer size is too small.\n"); |
11546
1d81cd330928
TTA : Check if the output buffer size is within bounds.
jai_menon
parents:
11343
diff
changeset
|
315 return -1; |
1d81cd330928
TTA : Check if the output buffer size is within bounds.
jai_menon
parents:
11343
diff
changeset
|
316 } |
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
|
317 // 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
|
318 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
|
319 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
|
320 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
|
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 // 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
|
323 for (i = 0; i < s->channels; i++) { |
11946
c592b59ea05f
tta: replace potentially huge VLAs with malloc/free in context
mru
parents:
11644
diff
changeset
|
324 s->ch_ctx[i].predictor = 0; |
c592b59ea05f
tta: replace potentially huge VLAs with malloc/free in context
mru
parents:
11644
diff
changeset
|
325 ttafilter_init(&s->ch_ctx[i].filter, ttafilter_configs[s->bps-1][0], ttafilter_configs[s->bps-1][1]); |
c592b59ea05f
tta: replace potentially huge VLAs with malloc/free in context
mru
parents:
11644
diff
changeset
|
326 rice_init(&s->ch_ctx[i].rice, 10, 10); |
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
|
327 } |
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 |
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 for (p = s->decode_buffer; p < s->decode_buffer + (framelen * s->channels); p++) { |
11946
c592b59ea05f
tta: replace potentially huge VLAs with malloc/free in context
mru
parents:
11644
diff
changeset
|
330 int32_t *predictor = &s->ch_ctx[cur_chan].predictor; |
c592b59ea05f
tta: replace potentially huge VLAs with malloc/free in context
mru
parents:
11644
diff
changeset
|
331 TTAFilter *filter = &s->ch_ctx[cur_chan].filter; |
c592b59ea05f
tta: replace potentially huge VLAs with malloc/free in context
mru
parents:
11644
diff
changeset
|
332 TTARice *rice = &s->ch_ctx[cur_chan].rice; |
3151
27e1b9632715
64bit fixes for the tta decoder, sizeof(long) is 8 on amd64, 4 on x86, the patch
banan
parents:
3118
diff
changeset
|
333 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
|
334 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
|
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 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
|
337 |
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 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
|
339 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
|
340 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
|
341 } 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
|
342 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
|
343 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
|
344 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
|
345 } |
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 |
11343
2b78e800f630
Fixed overreads in TTA decoder with corrupted bistreams.
fenrir
parents:
9428
diff
changeset
|
347 if (get_bits_left(&s->gb) < k) |
2b78e800f630
Fixed overreads in TTA decoder with corrupted bistreams.
fenrir
parents:
9428
diff
changeset
|
348 return -1; |
2b78e800f630
Fixed overreads in TTA decoder with corrupted bistreams.
fenrir
parents:
9428
diff
changeset
|
349 |
2b78e800f630
Fixed overreads in TTA decoder with corrupted bistreams.
fenrir
parents:
9428
diff
changeset
|
350 if (k) { |
2b78e800f630
Fixed overreads in TTA decoder with corrupted bistreams.
fenrir
parents:
9428
diff
changeset
|
351 if (k > MIN_CACHE_BITS) |
2b78e800f630
Fixed overreads in TTA decoder with corrupted bistreams.
fenrir
parents:
9428
diff
changeset
|
352 return -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
|
353 value = (unary << k) + get_bits(&s->gb, k); |
11343
2b78e800f630
Fixed overreads in TTA decoder with corrupted bistreams.
fenrir
parents:
9428
diff
changeset
|
354 } else |
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
|
355 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
|
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 // 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
|
358 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
|
359 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
|
360 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
|
361 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
|
362 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
|
363 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
|
364 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
|
365 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
|
366 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
|
367 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
|
368 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
|
369 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
|
370 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
|
371 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
|
372 } |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
373 |
3985 | 374 // extract coded value |
375 #define UNFOLD(x) (((x)&1) ? (++(x)>>1) : (-(x)>>1)) | |
376 *p = UNFOLD(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
|
377 |
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 // 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
|
379 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
|
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 // 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
|
382 #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
|
383 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
|
384 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
|
385 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
|
386 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
|
387 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
|
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 *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
|
390 |
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 #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
|
392 // 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
|
393 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
|
394 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
|
395 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
|
396 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
|
397 |
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 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
|
399 // 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
|
400 *(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
|
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 #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
|
403 |
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 /*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
|
405 { |
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 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
|
407 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
|
408 }*/ |
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 |
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 // 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
|
411 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
|
412 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
|
413 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
|
414 // 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
|
415 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
|
416 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
|
417 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
|
418 *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
|
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 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
|
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 } |
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 |
11343
2b78e800f630
Fixed overreads in TTA decoder with corrupted bistreams.
fenrir
parents:
9428
diff
changeset
|
424 if (get_bits_left(&s->gb) < 32) |
2b78e800f630
Fixed overreads in TTA decoder with corrupted bistreams.
fenrir
parents:
9428
diff
changeset
|
425 return -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
|
426 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
|
427 |
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 // 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
|
429 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
|
430 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
|
431 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
|
432 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
|
433 // *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
|
434 // *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
|
435 *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
|
436 } |
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 *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
|
438 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
|
439 } |
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 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
|
441 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
|
442 } |
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 } |
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 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
445 // 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
|
446 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
|
447 } |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
448 |
6517
48759bfbd073
Apply 'cold' attribute to init/uninit functions in libavcodec
zuxy
parents:
6287
diff
changeset
|
449 static av_cold int tta_decode_close(AVCodecContext *avctx) { |
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
|
450 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
|
451 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
452 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
|
453 av_free(s->decode_buffer); |
11946
c592b59ea05f
tta: replace potentially huge VLAs with malloc/free in context
mru
parents:
11644
diff
changeset
|
454 av_freep(&s->ch_ctx); |
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
|
455 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
456 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
|
457 } |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
458 |
01b58c3b8a91
tta decoder, tested with 44khz mono and stereo (for the latter use ffplay or change MAX_AUDIO_FRAME_SIZE)
alex
parents:
diff
changeset
|
459 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
|
460 "tta", |
11560
8a4984c5cacc
Define AVMediaType enum, and use it instead of enum CodecType, which
stefano
parents:
11549
diff
changeset
|
461 AVMEDIA_TYPE_AUDIO, |
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
|
462 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
|
463 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
|
464 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
|
465 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
|
466 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
|
467 tta_decode_frame, |
9082
ac81b12341d0
Add some missing codecs and update names to match the codec long_name
jbr
parents:
8718
diff
changeset
|
468 .long_name = NULL_IF_CONFIG_SMALL("True Audio (TTA)"), |
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
|
469 }; |