Mercurial > audlegacy-plugins
annotate src/tta/ttadec.h @ 618:a7a28782c1b0 trunk
[svn] - revise input_id3_get_string() to take encoding of field into account.
- restore title_override options I accidentally dropped.
- remove unnecessary code.
author | yaz |
---|---|
date | Wed, 07 Feb 2007 23:31:26 -0800 |
parents | c0f69d57483b |
children | e9d2de5aa638 |
rev | line source |
---|---|
290 | 1 /* |
2 * ttadec.h | |
3 * | |
4 * Description: TTAv1 decoder definitions and prototypes | |
5 * Developed by: Alexander Djourik <sasha@iszf.irk.ru> | |
6 * Pavel Zhilin <pzh@iszf.irk.ru> | |
7 * | |
8 * Copyright (c) 1999-2004 Alexander Djourik. All rights reserved. | |
9 * | |
10 */ | |
11 | |
12 /* | |
13 * This library is free software; you can redistribute it and/or | |
14 * modify it under the terms of the GNU Lesser General Public | |
15 * License as published by the Free Software Foundation; either | |
16 * version 2.1 of the License, or (at your option) any later version. | |
17 * | |
18 * This library is distributed in the hope that it will be useful, | |
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
21 * Lesser General Public License for more details. | |
22 * | |
23 * You should have received a copy of the GNU Lesser General Public | |
24 * License along with this library; if not, write to the Free Software | |
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
26 * | |
27 * Please see the file COPYING in this directory for full copyright | |
28 * information. | |
29 */ | |
30 | |
31 #ifndef TTADEC_H_ | |
32 #define TTADEC_H_ | |
33 | |
34 #ifdef _WIN32 | |
35 #pragma pack(1) | |
36 #define __ATTRIBUTE_PACKED__ | |
37 #else | |
38 #define __ATTRIBUTE_PACKED__ __attribute__((packed)) | |
39 #endif | |
40 | |
41 #define TTA1_SIGN 0x31415454 | |
42 #define FRAME_TIME 1.04489795918367346939 | |
43 #define MAX_ORDER 8 | |
44 | |
45 #ifndef WAVE_FORMAT_PCM | |
46 #define WAVE_FORMAT_PCM 1 | |
47 #endif | |
48 | |
49 #ifdef _WIN32 | |
50 typedef unsigned __int64 uint64; | |
51 #else | |
551
c0f69d57483b
[svn] - change some references for long to int, reported by and patch by
nenolod
parents:
290
diff
changeset
|
52 typedef unsigned long int uint64; |
290 | 53 #endif |
54 | |
551
c0f69d57483b
[svn] - change some references for long to int, reported by and patch by
nenolod
parents:
290
diff
changeset
|
55 const unsigned int bit_mask[] = { |
290 | 56 0x00000000, 0x00000001, 0x00000003, 0x00000007, |
57 0x0000000f, 0x0000001f, 0x0000003f, 0x0000007f, | |
58 0x000000ff, 0x000001ff, 0x000003ff, 0x000007ff, | |
59 0x00000fff, 0x00001fff, 0x00003fff, 0x00007fff, | |
60 0x0000ffff, 0x0001ffff, 0x0003ffff, 0x0007ffff, | |
61 0x000fffff, 0x001fffff, 0x003fffff, 0x007fffff, | |
62 0x00ffffff, 0x01ffffff, 0x03ffffff, 0x07ffffff, | |
63 0x0fffffff, 0x1fffffff, 0x3fffffff, 0x7fffffff, | |
64 0xffffffff | |
65 }; | |
66 | |
551
c0f69d57483b
[svn] - change some references for long to int, reported by and patch by
nenolod
parents:
290
diff
changeset
|
67 const unsigned int bit_shift[] = { |
290 | 68 0x00000001, 0x00000002, 0x00000004, 0x00000008, |
69 0x00000010, 0x00000020, 0x00000040, 0x00000080, | |
70 0x00000100, 0x00000200, 0x00000400, 0x00000800, | |
71 0x00001000, 0x00002000, 0x00004000, 0x00008000, | |
72 0x00010000, 0x00020000, 0x00040000, 0x00080000, | |
73 0x00100000, 0x00200000, 0x00400000, 0x00800000, | |
74 0x01000000, 0x02000000, 0x04000000, 0x08000000, | |
75 0x10000000, 0x20000000, 0x40000000, 0x80000000, | |
76 0x80000000, 0x80000000, 0x80000000, 0x80000000, | |
77 0x80000000, 0x80000000, 0x80000000, 0x80000000 | |
78 }; | |
79 | |
551
c0f69d57483b
[svn] - change some references for long to int, reported by and patch by
nenolod
parents:
290
diff
changeset
|
80 const unsigned int *shift_16 = bit_shift + 4; |
290 | 81 |
82 typedef unsigned char byte; | |
83 | |
84 #ifdef _BIG_ENDIAN | |
85 #define ENDSWAP_INT16(x) (((((x)>>8)&0xFF)|(((x)&0xFF)<<8))) | |
86 #define ENDSWAP_INT32(x) (((((x)>>24)&0xFF)|(((x)>>8)&0xFF00)|(((x)&0xFF00)<<8)|(((x)&0xFF)<<24))) | |
87 #define WRITE_BUFFER(x, bsize, out) { \ | |
88 if (bsize > 2) *out++ = (byte)(*x >> 16); \ | |
89 if (bsize > 1) *out++ = (byte)(*x >> 8); \ | |
90 *out++ = (byte) *x; } | |
91 #else | |
92 #define ENDSWAP_INT16(x) (x) | |
93 #define ENDSWAP_INT32(x) (x) | |
94 #define WRITE_BUFFER(x, bsize, out) { \ | |
95 *out++ = (byte) *x; \ | |
96 if (bsize > 1) *out++ = (byte)(*x >> 8); \ | |
97 if (bsize > 2) *out++ = (byte)(*x >> 16); } | |
98 #endif | |
99 | |
100 #define PREDICTOR1(x, k) ((long)((((uint64)x << k) - x) >> k)) | |
101 #define DEC(x) (((x)&1)?(++(x)>>1):(-(x)>>1)) | |
102 | |
103 typedef struct { | |
551
c0f69d57483b
[svn] - change some references for long to int, reported by and patch by
nenolod
parents:
290
diff
changeset
|
104 unsigned int TTAid; |
290 | 105 unsigned short AudioFormat; |
106 unsigned short NumChannels; | |
107 unsigned short BitsPerSample; | |
551
c0f69d57483b
[svn] - change some references for long to int, reported by and patch by
nenolod
parents:
290
diff
changeset
|
108 unsigned int SampleRate; |
c0f69d57483b
[svn] - change some references for long to int, reported by and patch by
nenolod
parents:
290
diff
changeset
|
109 unsigned int DataLength; |
c0f69d57483b
[svn] - change some references for long to int, reported by and patch by
nenolod
parents:
290
diff
changeset
|
110 unsigned int CRC32; |
290 | 111 } __ATTRIBUTE_PACKED__ tta_hdr; |
112 | |
113 typedef struct { | |
551
c0f69d57483b
[svn] - change some references for long to int, reported by and patch by
nenolod
parents:
290
diff
changeset
|
114 unsigned int k0; |
c0f69d57483b
[svn] - change some references for long to int, reported by and patch by
nenolod
parents:
290
diff
changeset
|
115 unsigned int k1; |
c0f69d57483b
[svn] - change some references for long to int, reported by and patch by
nenolod
parents:
290
diff
changeset
|
116 unsigned int sum0; |
c0f69d57483b
[svn] - change some references for long to int, reported by and patch by
nenolod
parents:
290
diff
changeset
|
117 unsigned int sum1; |
290 | 118 } adapt; |
119 | |
120 typedef struct { | |
551
c0f69d57483b
[svn] - change some references for long to int, reported by and patch by
nenolod
parents:
290
diff
changeset
|
121 int shift; |
c0f69d57483b
[svn] - change some references for long to int, reported by and patch by
nenolod
parents:
290
diff
changeset
|
122 int round; |
c0f69d57483b
[svn] - change some references for long to int, reported by and patch by
nenolod
parents:
290
diff
changeset
|
123 int error; |
c0f69d57483b
[svn] - change some references for long to int, reported by and patch by
nenolod
parents:
290
diff
changeset
|
124 int mutex; |
c0f69d57483b
[svn] - change some references for long to int, reported by and patch by
nenolod
parents:
290
diff
changeset
|
125 int qm[MAX_ORDER+1]; |
c0f69d57483b
[svn] - change some references for long to int, reported by and patch by
nenolod
parents:
290
diff
changeset
|
126 int dx[MAX_ORDER+1]; |
c0f69d57483b
[svn] - change some references for long to int, reported by and patch by
nenolod
parents:
290
diff
changeset
|
127 int dl[MAX_ORDER+1]; |
290 | 128 } fltst; |
129 | |
130 typedef struct { | |
131 fltst fst; | |
132 adapt rice; | |
551
c0f69d57483b
[svn] - change some references for long to int, reported by and patch by
nenolod
parents:
290
diff
changeset
|
133 int last; |
290 | 134 } decoder; |
135 | |
136 #endif /* TTADEC_H_ */ |