diff options
author | Mohamed Tarek <mt@rockbox.org> | 2010-07-17 07:53:14 +0000 |
---|---|---|
committer | Mohamed Tarek <mt@rockbox.org> | 2010-07-17 07:53:14 +0000 |
commit | 0f947104100131069fbfa9e53c8ef129c4716a30 (patch) | |
tree | bbb94c6b1899e25eb3d7e2ac38d7a338dd620d21 /apps/codecs/libwmapro | |
parent | 090768194fdbd611b995572f424c6fae690eb329 (diff) | |
download | rockbox-0f947104100131069fbfa9e53c8ef129c4716a30.tar.gz rockbox-0f947104100131069fbfa9e53c8ef129c4716a30.zip |
More cleaning for libwmapro; use codeclib's bitstream functions and drop those from the libwmapro.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27453 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/libwmapro')
-rw-r--r-- | apps/codecs/libwmapro/SOURCES | 3 | ||||
-rw-r--r-- | apps/codecs/libwmapro/bitstream.c | 358 | ||||
-rw-r--r-- | apps/codecs/libwmapro/get_bits.h | 661 | ||||
-rw-r--r-- | apps/codecs/libwmapro/libavutil/bswap.h | 89 | ||||
-rw-r--r-- | apps/codecs/libwmapro/libavutil/intreadwrite.h | 483 | ||||
-rw-r--r-- | apps/codecs/libwmapro/put_bits.h | 328 | ||||
-rw-r--r-- | apps/codecs/libwmapro/wma.h | 4 | ||||
-rw-r--r-- | apps/codecs/libwmapro/wmaprodec.c | 4 |
8 files changed, 5 insertions, 1925 deletions
diff --git a/apps/codecs/libwmapro/SOURCES b/apps/codecs/libwmapro/SOURCES index 174bede984..ce4bfc234d 100644 --- a/apps/codecs/libwmapro/SOURCES +++ b/apps/codecs/libwmapro/SOURCES | |||
@@ -1,6 +1,5 @@ | |||
1 | wmaprodec.c | 1 | wmaprodec.c |
2 | wma.c | 2 | wma.c |
3 | mdct_tables.c | 3 | mdct_tables.c |
4 | bitstream.c | 4 | ../lib/ffmpeg_bitstream.c |
5 | wmapro_mdct.c | 5 | wmapro_mdct.c |
6 | //libavutil/mathematics.c | ||
diff --git a/apps/codecs/libwmapro/bitstream.c b/apps/codecs/libwmapro/bitstream.c deleted file mode 100644 index 142ffa7651..0000000000 --- a/apps/codecs/libwmapro/bitstream.c +++ /dev/null | |||
@@ -1,358 +0,0 @@ | |||
1 | /* | ||
2 | * Common bit i/o utils | ||
3 | * Copyright (c) 2000, 2001 Fabrice Bellard | ||
4 | * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at> | ||
5 | * Copyright (c) 2010 Loren Merritt | ||
6 | * | ||
7 | * alternative bitstream reader & writer by Michael Niedermayer <michaelni@gmx.at> | ||
8 | * | ||
9 | * This file is part of FFmpeg. | ||
10 | * | ||
11 | * FFmpeg is free software; you can redistribute it and/or | ||
12 | * modify it under the terms of the GNU Lesser General Public | ||
13 | * License as published by the Free Software Foundation; either | ||
14 | * version 2.1 of the License, or (at your option) any later version. | ||
15 | * | ||
16 | * FFmpeg is distributed in the hope that it will be useful, | ||
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
19 | * Lesser General Public License for more details. | ||
20 | * | ||
21 | * You should have received a copy of the GNU Lesser General Public | ||
22 | * License along with FFmpeg; if not, write to the Free Software | ||
23 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
24 | */ | ||
25 | |||
26 | /** | ||
27 | * @file libavcodec/bitstream.c | ||
28 | * bitstream api. | ||
29 | */ | ||
30 | |||
31 | #include "get_bits.h" | ||
32 | #include "put_bits.h" | ||
33 | #include <string.h> | ||
34 | |||
35 | #define av_log(...) | ||
36 | |||
37 | /* Taken from libavutil/common.h */ | ||
38 | #define FFMIN(a,b) ((a) > (b) ? (b) : (a)) | ||
39 | #define FFMAX(a,b) ((a) > (b) ? (a) : (b)) | ||
40 | |||
41 | /* av_reverse - taken from libavutil/mathematics.c*/ | ||
42 | const uint8_t av_reverse[256]={ | ||
43 | 0x00,0x80,0x40,0xC0,0x20,0xA0,0x60,0xE0,0x10,0x90,0x50,0xD0,0x30,0xB0,0x70,0xF0, | ||
44 | 0x08,0x88,0x48,0xC8,0x28,0xA8,0x68,0xE8,0x18,0x98,0x58,0xD8,0x38,0xB8,0x78,0xF8, | ||
45 | 0x04,0x84,0x44,0xC4,0x24,0xA4,0x64,0xE4,0x14,0x94,0x54,0xD4,0x34,0xB4,0x74,0xF4, | ||
46 | 0x0C,0x8C,0x4C,0xCC,0x2C,0xAC,0x6C,0xEC,0x1C,0x9C,0x5C,0xDC,0x3C,0xBC,0x7C,0xFC, | ||
47 | 0x02,0x82,0x42,0xC2,0x22,0xA2,0x62,0xE2,0x12,0x92,0x52,0xD2,0x32,0xB2,0x72,0xF2, | ||
48 | 0x0A,0x8A,0x4A,0xCA,0x2A,0xAA,0x6A,0xEA,0x1A,0x9A,0x5A,0xDA,0x3A,0xBA,0x7A,0xFA, | ||
49 | 0x06,0x86,0x46,0xC6,0x26,0xA6,0x66,0xE6,0x16,0x96,0x56,0xD6,0x36,0xB6,0x76,0xF6, | ||
50 | 0x0E,0x8E,0x4E,0xCE,0x2E,0xAE,0x6E,0xEE,0x1E,0x9E,0x5E,0xDE,0x3E,0xBE,0x7E,0xFE, | ||
51 | 0x01,0x81,0x41,0xC1,0x21,0xA1,0x61,0xE1,0x11,0x91,0x51,0xD1,0x31,0xB1,0x71,0xF1, | ||
52 | 0x09,0x89,0x49,0xC9,0x29,0xA9,0x69,0xE9,0x19,0x99,0x59,0xD9,0x39,0xB9,0x79,0xF9, | ||
53 | 0x05,0x85,0x45,0xC5,0x25,0xA5,0x65,0xE5,0x15,0x95,0x55,0xD5,0x35,0xB5,0x75,0xF5, | ||
54 | 0x0D,0x8D,0x4D,0xCD,0x2D,0xAD,0x6D,0xED,0x1D,0x9D,0x5D,0xDD,0x3D,0xBD,0x7D,0xFD, | ||
55 | 0x03,0x83,0x43,0xC3,0x23,0xA3,0x63,0xE3,0x13,0x93,0x53,0xD3,0x33,0xB3,0x73,0xF3, | ||
56 | 0x0B,0x8B,0x4B,0xCB,0x2B,0xAB,0x6B,0xEB,0x1B,0x9B,0x5B,0xDB,0x3B,0xBB,0x7B,0xFB, | ||
57 | 0x07,0x87,0x47,0xC7,0x27,0xA7,0x67,0xE7,0x17,0x97,0x57,0xD7,0x37,0xB7,0x77,0xF7, | ||
58 | 0x0F,0x8F,0x4F,0xCF,0x2F,0xAF,0x6F,0xEF,0x1F,0x9F,0x5F,0xDF,0x3F,0xBF,0x7F,0xFF, | ||
59 | }; | ||
60 | |||
61 | |||
62 | const uint8_t ff_log2_run[32]={ | ||
63 | 0, 0, 0, 0, 1, 1, 1, 1, | ||
64 | 2, 2, 2, 2, 3, 3, 3, 3, | ||
65 | 4, 4, 5, 5, 6, 6, 7, 7, | ||
66 | 8, 9,10,11,12,13,14,15 | ||
67 | }; | ||
68 | |||
69 | void align_put_bits(PutBitContext *s) | ||
70 | { | ||
71 | #ifdef ALT_BITSTREAM_WRITER | ||
72 | put_bits(s,( - s->index) & 7,0); | ||
73 | #else | ||
74 | put_bits(s,s->bit_left & 7,0); | ||
75 | #endif | ||
76 | } | ||
77 | |||
78 | void ff_put_string(PutBitContext *pb, const char *string, int terminate_string) | ||
79 | { | ||
80 | while(*string){ | ||
81 | put_bits(pb, 8, *string); | ||
82 | string++; | ||
83 | } | ||
84 | if(terminate_string) | ||
85 | put_bits(pb, 8, 0); | ||
86 | } | ||
87 | |||
88 | void ff_copy_bits(PutBitContext *pb, const uint8_t *src, int length) | ||
89 | { | ||
90 | int words= length>>4; | ||
91 | int bits= length&15; | ||
92 | int i; | ||
93 | |||
94 | if(length==0) return; | ||
95 | /* The following define was just added to make the codec (wma pro) compile */ | ||
96 | #define CONFIG_SMALL 0 | ||
97 | if(CONFIG_SMALL || words < 16 || put_bits_count(pb)&7){ | ||
98 | for(i=0; i<words; i++) put_bits(pb, 16, AV_RB16(src + 2*i)); | ||
99 | }else{ | ||
100 | for(i=0; put_bits_count(pb)&31; i++) | ||
101 | put_bits(pb, 8, src[i]); | ||
102 | flush_put_bits(pb); | ||
103 | memcpy(put_bits_ptr(pb), src+i, 2*words-i); | ||
104 | skip_put_bytes(pb, 2*words-i); | ||
105 | } | ||
106 | |||
107 | put_bits(pb, bits, AV_RB16(src + 2*words)>>(16-bits)); | ||
108 | } | ||
109 | |||
110 | /* VLC decoding */ | ||
111 | |||
112 | //#define DEBUG_VLC | ||
113 | |||
114 | #define GET_DATA(v, table, i, wrap, size) \ | ||
115 | {\ | ||
116 | const uint8_t *ptr = (const uint8_t *)table + i * wrap;\ | ||
117 | switch(size) {\ | ||
118 | case 1:\ | ||
119 | v = *(const uint8_t *)ptr;\ | ||
120 | break;\ | ||
121 | case 2:\ | ||
122 | v = *(const uint16_t *)ptr;\ | ||
123 | break;\ | ||
124 | default:\ | ||
125 | v = *(const uint32_t *)ptr;\ | ||
126 | break;\ | ||
127 | }\ | ||
128 | } | ||
129 | |||
130 | |||
131 | static int alloc_table(VLC *vlc, int size, int use_static) | ||
132 | { | ||
133 | int index; | ||
134 | index = vlc->table_size; | ||
135 | vlc->table_size += size; | ||
136 | if (vlc->table_size > vlc->table_allocated) { | ||
137 | if(use_static) | ||
138 | return -1; //cant do anything, init_vlc() is used with too little memory | ||
139 | vlc->table_allocated += (1 << vlc->bits); | ||
140 | //vlc->table = av_realloc(vlc->table, | ||
141 | // sizeof(VLC_TYPE) * 2 * vlc->table_allocated); | ||
142 | if (!vlc->table) | ||
143 | return -1; | ||
144 | } | ||
145 | return index; | ||
146 | } | ||
147 | |||
148 | static inline uint32_t bitswap_32(uint32_t x) { | ||
149 | return av_reverse[x&0xFF]<<24 | ||
150 | | av_reverse[(x>>8)&0xFF]<<16 | ||
151 | | av_reverse[(x>>16)&0xFF]<<8 | ||
152 | | av_reverse[x>>24]; | ||
153 | } | ||
154 | |||
155 | typedef struct { | ||
156 | uint8_t bits; | ||
157 | uint16_t symbol; | ||
158 | /** codeword, with the first bit-to-be-read in the msb | ||
159 | * (even if intended for a little-endian bitstream reader) */ | ||
160 | uint32_t code; | ||
161 | } VLCcode; | ||
162 | |||
163 | static int compare_vlcspec(const void *a, const void *b) | ||
164 | { | ||
165 | const VLCcode *sa=a, *sb=b; | ||
166 | return (sa->code >> 1) - (sb->code >> 1); | ||
167 | } | ||
168 | |||
169 | /** | ||
170 | * Build VLC decoding tables suitable for use with get_vlc(). | ||
171 | * | ||
172 | * @param vlc the context to be initted | ||
173 | * | ||
174 | * @param table_nb_bits max length of vlc codes to store directly in this table | ||
175 | * (Longer codes are delegated to subtables.) | ||
176 | * | ||
177 | * @param nb_codes number of elements in codes[] | ||
178 | * | ||
179 | * @param codes descriptions of the vlc codes | ||
180 | * These must be ordered such that codes going into the same subtable are contiguous. | ||
181 | * Sorting by VLCcode.code is sufficient, though not necessary. | ||
182 | */ | ||
183 | static int build_table(VLC *vlc, int table_nb_bits, int nb_codes, | ||
184 | VLCcode *codes, int flags) | ||
185 | { | ||
186 | int table_size, table_index, index, code_prefix, symbol, subtable_bits; | ||
187 | int i, j, k, n, nb, inc; | ||
188 | uint32_t code; | ||
189 | VLC_TYPE (*table)[2]; | ||
190 | |||
191 | table_size = 1 << table_nb_bits; | ||
192 | table_index = alloc_table(vlc, table_size, flags & INIT_VLC_USE_NEW_STATIC); | ||
193 | #ifdef DEBUG_VLC | ||
194 | av_log(NULL,AV_LOG_DEBUG,"new table index=%d size=%d\n", | ||
195 | table_index, table_size); | ||
196 | #endif | ||
197 | if (table_index < 0) | ||
198 | return -1; | ||
199 | table = &vlc->table[table_index]; | ||
200 | |||
201 | for (i = 0; i < table_size; i++) { | ||
202 | table[i][1] = 0; //bits | ||
203 | table[i][0] = -1; //codes | ||
204 | } | ||
205 | |||
206 | /* first pass: map codes and compute auxillary table sizes */ | ||
207 | for (i = 0; i < nb_codes; i++) { | ||
208 | n = codes[i].bits; | ||
209 | code = codes[i].code; | ||
210 | symbol = codes[i].symbol; | ||
211 | #if defined(DEBUG_VLC) && 0 | ||
212 | av_log(NULL,AV_LOG_DEBUG,"i=%d n=%d code=0x%x\n", i, n, code); | ||
213 | #endif | ||
214 | if (n <= table_nb_bits) { | ||
215 | /* no need to add another table */ | ||
216 | j = code >> (32 - table_nb_bits); | ||
217 | nb = 1 << (table_nb_bits - n); | ||
218 | inc = 1; | ||
219 | if (flags & INIT_VLC_LE) { | ||
220 | j = bitswap_32(code); | ||
221 | inc = 1 << n; | ||
222 | } | ||
223 | for (k = 0; k < nb; k++) { | ||
224 | #ifdef DEBUG_VLC | ||
225 | av_log(NULL, AV_LOG_DEBUG, "%4x: code=%d n=%d\n", | ||
226 | j, i, n); | ||
227 | #endif | ||
228 | if (table[j][1] /*bits*/ != 0) { | ||
229 | av_log(NULL, AV_LOG_ERROR, "incorrect codes\n"); | ||
230 | return -1; | ||
231 | } | ||
232 | table[j][1] = n; //bits | ||
233 | table[j][0] = symbol; | ||
234 | j += inc; | ||
235 | } | ||
236 | } else { | ||
237 | /* fill auxiliary table recursively */ | ||
238 | n -= table_nb_bits; | ||
239 | code_prefix = code >> (32 - table_nb_bits); | ||
240 | subtable_bits = n; | ||
241 | codes[i].bits = n; | ||
242 | codes[i].code = code << table_nb_bits; | ||
243 | for (k = i+1; k < nb_codes; k++) { | ||
244 | n = codes[k].bits - table_nb_bits; | ||
245 | if (n <= 0) | ||
246 | break; | ||
247 | code = codes[k].code; | ||
248 | if (code >> (32 - table_nb_bits) != (unsigned)code_prefix) | ||
249 | break; | ||
250 | codes[k].bits = n; | ||
251 | codes[k].code = code << table_nb_bits; | ||
252 | subtable_bits = FFMAX(subtable_bits, n); | ||
253 | } | ||
254 | subtable_bits = FFMIN(subtable_bits, table_nb_bits); | ||
255 | j = (flags & INIT_VLC_LE) ? bitswap_32(code_prefix) >> (32 - table_nb_bits) : (unsigned)code_prefix; | ||
256 | table[j][1] = -subtable_bits; | ||
257 | #ifdef DEBUG_VLC | ||
258 | av_log(NULL,AV_LOG_DEBUG,"%4x: n=%d (subtable)\n", | ||
259 | j, codes[i].bits + table_nb_bits); | ||
260 | #endif | ||
261 | index = build_table(vlc, subtable_bits, k-i, codes+i, flags); | ||
262 | if (index < 0) | ||
263 | return -1; | ||
264 | /* note: realloc has been done, so reload tables */ | ||
265 | table = &vlc->table[table_index]; | ||
266 | table[j][0] = index; //code | ||
267 | i = k-1; | ||
268 | } | ||
269 | } | ||
270 | return table_index; | ||
271 | } | ||
272 | |||
273 | |||
274 | /* Build VLC decoding tables suitable for use with get_vlc(). | ||
275 | |||
276 | 'nb_bits' set thee decoding table size (2^nb_bits) entries. The | ||
277 | bigger it is, the faster is the decoding. But it should not be too | ||
278 | big to save memory and L1 cache. '9' is a good compromise. | ||
279 | |||
280 | 'nb_codes' : number of vlcs codes | ||
281 | |||
282 | 'bits' : table which gives the size (in bits) of each vlc code. | ||
283 | |||
284 | 'codes' : table which gives the bit pattern of of each vlc code. | ||
285 | |||
286 | 'symbols' : table which gives the values to be returned from get_vlc(). | ||
287 | |||
288 | 'xxx_wrap' : give the number of bytes between each entry of the | ||
289 | 'bits' or 'codes' tables. | ||
290 | |||
291 | 'xxx_size' : gives the number of bytes of each entry of the 'bits' | ||
292 | or 'codes' tables. | ||
293 | |||
294 | 'wrap' and 'size' allows to use any memory configuration and types | ||
295 | (byte/word/long) to store the 'bits', 'codes', and 'symbols' tables. | ||
296 | |||
297 | 'use_static' should be set to 1 for tables, which should be freed | ||
298 | with av_free_static(), 0 if free_vlc() will be used. | ||
299 | */ | ||
300 | int init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes, | ||
301 | const void *bits, int bits_wrap, int bits_size, | ||
302 | const void *codes, int codes_wrap, int codes_size, | ||
303 | const void *symbols, int symbols_wrap, int symbols_size, | ||
304 | int flags) | ||
305 | { | ||
306 | VLCcode buf[nb_codes]; | ||
307 | int i, j; | ||
308 | |||
309 | vlc->bits = nb_bits; | ||
310 | if(flags & INIT_VLC_USE_NEW_STATIC){ | ||
311 | if(vlc->table_size && vlc->table_size == vlc->table_allocated){ | ||
312 | return 0; | ||
313 | }else if(vlc->table_size){ | ||
314 | return -1; // fatal error, we are called on a partially initialized table | ||
315 | } | ||
316 | }else { | ||
317 | vlc->table = NULL; | ||
318 | vlc->table_allocated = 0; | ||
319 | vlc->table_size = 0; | ||
320 | } | ||
321 | |||
322 | #ifdef DEBUG_VLC | ||
323 | av_log(NULL,AV_LOG_DEBUG,"build table nb_codes=%d\n", nb_codes); | ||
324 | #endif | ||
325 | |||
326 | //assert(symbols_size <= 2 || !symbols); | ||
327 | j = 0; | ||
328 | #define COPY(condition)\ | ||
329 | for (i = 0; i < nb_codes; i++) {\ | ||
330 | GET_DATA(buf[j].bits, bits, i, bits_wrap, bits_size);\ | ||
331 | if (!(condition))\ | ||
332 | continue;\ | ||
333 | GET_DATA(buf[j].code, codes, i, codes_wrap, codes_size);\ | ||
334 | if (flags & INIT_VLC_LE)\ | ||
335 | buf[j].code = bitswap_32(buf[j].code);\ | ||
336 | else\ | ||
337 | buf[j].code <<= 32 - buf[j].bits;\ | ||
338 | if (symbols)\ | ||
339 | GET_DATA(buf[j].symbol, symbols, i, symbols_wrap, symbols_size)\ | ||
340 | else\ | ||
341 | buf[j].symbol = i;\ | ||
342 | j++;\ | ||
343 | } | ||
344 | COPY(buf[j].bits > nb_bits); | ||
345 | // qsort is the slowest part of init_vlc, and could probably be improved or avoided | ||
346 | qsort(buf, j, sizeof(VLCcode), compare_vlcspec); | ||
347 | COPY(buf[j].bits && buf[j].bits <= nb_bits); | ||
348 | nb_codes = j; | ||
349 | |||
350 | if (build_table(vlc, nb_bits, nb_codes, buf, flags) < 0) { | ||
351 | //av_freep(&vlc->table); | ||
352 | return -1; | ||
353 | } | ||
354 | //if((flags & INIT_VLC_USE_NEW_STATIC) && vlc->table_size != vlc->table_allocated) | ||
355 | // av_log(NULL, AV_LOG_ERROR, "needed %d had %d\n", vlc->table_size, vlc->table_allocated); | ||
356 | return 0; | ||
357 | } | ||
358 | |||
diff --git a/apps/codecs/libwmapro/get_bits.h b/apps/codecs/libwmapro/get_bits.h deleted file mode 100644 index 84853d8b8b..0000000000 --- a/apps/codecs/libwmapro/get_bits.h +++ /dev/null | |||
@@ -1,661 +0,0 @@ | |||
1 | /* | ||
2 | * copyright (c) 2004 Michael Niedermayer <michaelni@gmx.at> | ||
3 | * | ||
4 | * This file is part of FFmpeg. | ||
5 | * | ||
6 | * FFmpeg is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU Lesser General Public | ||
8 | * License as published by the Free Software Foundation; either | ||
9 | * version 2.1 of the License, or (at your option) any later version. | ||
10 | * | ||
11 | * FFmpeg is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | * Lesser General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU Lesser General Public | ||
17 | * License along with FFmpeg; if not, write to the Free Software | ||
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file libavcodec/get_bits.h | ||
23 | * bitstream reader API header. | ||
24 | */ | ||
25 | |||
26 | #ifndef AVCODEC_GET_BITS_H | ||
27 | #define AVCODEC_GET_BITS_H | ||
28 | |||
29 | #include <stdint.h> | ||
30 | #include <stdlib.h> | ||
31 | //#include <assert.h> | ||
32 | #include "libavutil/bswap.h" | ||
33 | //#include "libavutil/common.h" | ||
34 | #include "libavutil/intreadwrite.h" | ||
35 | //#include "libavutil/log.h" | ||
36 | |||
37 | #define av_log(...) | ||
38 | |||
39 | /* NEG_* were taken from mathops.h */ | ||
40 | #ifndef NEG_SSR32 | ||
41 | # define NEG_SSR32(a,s) ((( int32_t)(a))>>(32-(s))) | ||
42 | #endif | ||
43 | |||
44 | #ifndef NEG_USR32 | ||
45 | # define NEG_USR32(a,s) (((uint32_t)(a))>>(32-(s))) | ||
46 | #endif | ||
47 | |||
48 | #if defined(ALT_BITSTREAM_READER_LE) && !defined(ALT_BITSTREAM_READER) | ||
49 | # define ALT_BITSTREAM_READER | ||
50 | #endif | ||
51 | |||
52 | #if !defined(LIBMPEG2_BITSTREAM_READER) && !defined(A32_BITSTREAM_READER) && !defined(ALT_BITSTREAM_READER) | ||
53 | # define ALT_BITSTREAM_READER | ||
54 | #endif | ||
55 | |||
56 | /* bit input */ | ||
57 | /* buffer, buffer_end and size_in_bits must be present and used by every reader */ | ||
58 | typedef struct GetBitContext { | ||
59 | const uint8_t *buffer, *buffer_end; | ||
60 | #ifdef ALT_BITSTREAM_READER | ||
61 | int index; | ||
62 | #elif defined LIBMPEG2_BITSTREAM_READER | ||
63 | uint8_t *buffer_ptr; | ||
64 | uint32_t cache; | ||
65 | int bit_count; | ||
66 | #elif defined A32_BITSTREAM_READER | ||
67 | uint32_t *buffer_ptr; | ||
68 | uint32_t cache0; | ||
69 | uint32_t cache1; | ||
70 | int bit_count; | ||
71 | #endif | ||
72 | int size_in_bits; | ||
73 | } GetBitContext; | ||
74 | |||
75 | #define VLC_TYPE int16_t | ||
76 | |||
77 | typedef struct VLC { | ||
78 | int bits; | ||
79 | VLC_TYPE (*table)[2]; ///< code, bits | ||
80 | int table_size, table_allocated; | ||
81 | } VLC; | ||
82 | |||
83 | typedef struct RL_VLC_ELEM { | ||
84 | int16_t level; | ||
85 | int8_t len; | ||
86 | uint8_t run; | ||
87 | } RL_VLC_ELEM; | ||
88 | |||
89 | /* Bitstream reader API docs: | ||
90 | name | ||
91 | arbitrary name which is used as prefix for the internal variables | ||
92 | |||
93 | gb | ||
94 | getbitcontext | ||
95 | |||
96 | OPEN_READER(name, gb) | ||
97 | loads gb into local variables | ||
98 | |||
99 | CLOSE_READER(name, gb) | ||
100 | stores local vars in gb | ||
101 | |||
102 | UPDATE_CACHE(name, gb) | ||
103 | refills the internal cache from the bitstream | ||
104 | after this call at least MIN_CACHE_BITS will be available, | ||
105 | |||
106 | GET_CACHE(name, gb) | ||
107 | will output the contents of the internal cache, next bit is MSB of 32 or 64 bit (FIXME 64bit) | ||
108 | |||
109 | SHOW_UBITS(name, gb, num) | ||
110 | will return the next num bits | ||
111 | |||
112 | SHOW_SBITS(name, gb, num) | ||
113 | will return the next num bits and do sign extension | ||
114 | |||
115 | SKIP_BITS(name, gb, num) | ||
116 | will skip over the next num bits | ||
117 | note, this is equivalent to SKIP_CACHE; SKIP_COUNTER | ||
118 | |||
119 | SKIP_CACHE(name, gb, num) | ||
120 | will remove the next num bits from the cache (note SKIP_COUNTER MUST be called before UPDATE_CACHE / CLOSE_READER) | ||
121 | |||
122 | SKIP_COUNTER(name, gb, num) | ||
123 | will increment the internal bit counter (see SKIP_CACHE & SKIP_BITS) | ||
124 | |||
125 | LAST_SKIP_CACHE(name, gb, num) | ||
126 | will remove the next num bits from the cache if it is needed for UPDATE_CACHE otherwise it will do nothing | ||
127 | |||
128 | LAST_SKIP_BITS(name, gb, num) | ||
129 | is equivalent to LAST_SKIP_CACHE; SKIP_COUNTER | ||
130 | |||
131 | for examples see get_bits, show_bits, skip_bits, get_vlc | ||
132 | */ | ||
133 | |||
134 | #ifdef ALT_BITSTREAM_READER | ||
135 | # define MIN_CACHE_BITS 25 | ||
136 | |||
137 | # define OPEN_READER(name, gb)\ | ||
138 | unsigned int name##_index= (gb)->index;\ | ||
139 | int name##_cache= 0;\ | ||
140 | |||
141 | # define CLOSE_READER(name, gb)\ | ||
142 | (gb)->index= name##_index;\ | ||
143 | |||
144 | # ifdef ALT_BITSTREAM_READER_LE | ||
145 | # define UPDATE_CACHE(name, gb)\ | ||
146 | name##_cache= AV_RL32( ((const uint8_t *)(gb)->buffer)+(name##_index>>3) ) >> (name##_index&0x07);\ | ||
147 | |||
148 | # define SKIP_CACHE(name, gb, num)\ | ||
149 | name##_cache >>= (num); | ||
150 | # else | ||
151 | # define UPDATE_CACHE(name, gb)\ | ||
152 | name##_cache= AV_RB32( ((const uint8_t *)(gb)->buffer)+(name##_index>>3) ) << (name##_index&0x07);\ | ||
153 | |||
154 | # define SKIP_CACHE(name, gb, num)\ | ||
155 | name##_cache <<= (num); | ||
156 | # endif | ||
157 | |||
158 | // FIXME name? | ||
159 | # define SKIP_COUNTER(name, gb, num)\ | ||
160 | name##_index += (num);\ | ||
161 | |||
162 | # define SKIP_BITS(name, gb, num)\ | ||
163 | {\ | ||
164 | SKIP_CACHE(name, gb, num)\ | ||
165 | SKIP_COUNTER(name, gb, num)\ | ||
166 | }\ | ||
167 | |||
168 | # define LAST_SKIP_BITS(name, gb, num) SKIP_COUNTER(name, gb, num) | ||
169 | # define LAST_SKIP_CACHE(name, gb, num) ; | ||
170 | |||
171 | # ifdef ALT_BITSTREAM_READER_LE | ||
172 | # define SHOW_UBITS(name, gb, num)\ | ||
173 | zero_extend(name##_cache, num) | ||
174 | |||
175 | # define SHOW_SBITS(name, gb, num)\ | ||
176 | sign_extend(name##_cache, num) | ||
177 | # else | ||
178 | # define SHOW_UBITS(name, gb, num)\ | ||
179 | NEG_USR32(name##_cache, num) | ||
180 | |||
181 | # define SHOW_SBITS(name, gb, num)\ | ||
182 | NEG_SSR32(name##_cache, num) | ||
183 | # endif | ||
184 | |||
185 | # define GET_CACHE(name, gb)\ | ||
186 | ((uint32_t)name##_cache) | ||
187 | |||
188 | static inline int get_bits_count(const GetBitContext *s){ | ||
189 | return s->index; | ||
190 | } | ||
191 | |||
192 | static inline void skip_bits_long(GetBitContext *s, int n){ | ||
193 | s->index += n; | ||
194 | } | ||
195 | |||
196 | #elif defined LIBMPEG2_BITSTREAM_READER | ||
197 | //libmpeg2 like reader | ||
198 | |||
199 | # define MIN_CACHE_BITS 17 | ||
200 | |||
201 | # define OPEN_READER(name, gb)\ | ||
202 | int name##_bit_count=(gb)->bit_count;\ | ||
203 | int name##_cache= (gb)->cache;\ | ||
204 | uint8_t * name##_buffer_ptr=(gb)->buffer_ptr;\ | ||
205 | |||
206 | # define CLOSE_READER(name, gb)\ | ||
207 | (gb)->bit_count= name##_bit_count;\ | ||
208 | (gb)->cache= name##_cache;\ | ||
209 | (gb)->buffer_ptr= name##_buffer_ptr;\ | ||
210 | |||
211 | # define UPDATE_CACHE(name, gb)\ | ||
212 | if(name##_bit_count >= 0){\ | ||
213 | name##_cache+= AV_RB16(name##_buffer_ptr) << name##_bit_count; \ | ||
214 | name##_buffer_ptr+=2;\ | ||
215 | name##_bit_count-= 16;\ | ||
216 | }\ | ||
217 | |||
218 | # define SKIP_CACHE(name, gb, num)\ | ||
219 | name##_cache <<= (num);\ | ||
220 | |||
221 | # define SKIP_COUNTER(name, gb, num)\ | ||
222 | name##_bit_count += (num);\ | ||
223 | |||
224 | # define SKIP_BITS(name, gb, num)\ | ||
225 | {\ | ||
226 | SKIP_CACHE(name, gb, num)\ | ||
227 | SKIP_COUNTER(name, gb, num)\ | ||
228 | }\ | ||
229 | |||
230 | # define LAST_SKIP_BITS(name, gb, num) SKIP_BITS(name, gb, num) | ||
231 | # define LAST_SKIP_CACHE(name, gb, num) SKIP_CACHE(name, gb, num) | ||
232 | |||
233 | # define SHOW_UBITS(name, gb, num)\ | ||
234 | NEG_USR32(name##_cache, num) | ||
235 | |||
236 | # define SHOW_SBITS(name, gb, num)\ | ||
237 | NEG_SSR32(name##_cache, num) | ||
238 | |||
239 | # define GET_CACHE(name, gb)\ | ||
240 | ((uint32_t)name##_cache) | ||
241 | |||
242 | static inline int get_bits_count(const GetBitContext *s){ | ||
243 | return (s->buffer_ptr - s->buffer)*8 - 16 + s->bit_count; | ||
244 | } | ||
245 | |||
246 | static inline void skip_bits_long(GetBitContext *s, int n){ | ||
247 | OPEN_READER(re, s) | ||
248 | re_bit_count += n; | ||
249 | re_buffer_ptr += 2*(re_bit_count>>4); | ||
250 | re_bit_count &= 15; | ||
251 | re_cache = ((re_buffer_ptr[-2]<<8) + re_buffer_ptr[-1]) << (16+re_bit_count); | ||
252 | UPDATE_CACHE(re, s) | ||
253 | CLOSE_READER(re, s) | ||
254 | } | ||
255 | |||
256 | #elif defined A32_BITSTREAM_READER | ||
257 | |||
258 | # define MIN_CACHE_BITS 32 | ||
259 | |||
260 | # define OPEN_READER(name, gb)\ | ||
261 | int name##_bit_count=(gb)->bit_count;\ | ||
262 | uint32_t name##_cache0= (gb)->cache0;\ | ||
263 | uint32_t name##_cache1= (gb)->cache1;\ | ||
264 | uint32_t * name##_buffer_ptr=(gb)->buffer_ptr;\ | ||
265 | |||
266 | # define CLOSE_READER(name, gb)\ | ||
267 | (gb)->bit_count= name##_bit_count;\ | ||
268 | (gb)->cache0= name##_cache0;\ | ||
269 | (gb)->cache1= name##_cache1;\ | ||
270 | (gb)->buffer_ptr= name##_buffer_ptr;\ | ||
271 | |||
272 | # define UPDATE_CACHE(name, gb)\ | ||
273 | if(name##_bit_count > 0){\ | ||
274 | const uint32_t next= be2me_32( *name##_buffer_ptr );\ | ||
275 | name##_cache0 |= NEG_USR32(next,name##_bit_count);\ | ||
276 | name##_cache1 |= next<<name##_bit_count;\ | ||
277 | name##_buffer_ptr++;\ | ||
278 | name##_bit_count-= 32;\ | ||
279 | }\ | ||
280 | |||
281 | #if ARCH_X86 | ||
282 | # define SKIP_CACHE(name, gb, num)\ | ||
283 | __asm__(\ | ||
284 | "shldl %2, %1, %0 \n\t"\ | ||
285 | "shll %2, %1 \n\t"\ | ||
286 | : "+r" (name##_cache0), "+r" (name##_cache1)\ | ||
287 | : "Ic" ((uint8_t)(num))\ | ||
288 | ); | ||
289 | #else | ||
290 | # define SKIP_CACHE(name, gb, num)\ | ||
291 | name##_cache0 <<= (num);\ | ||
292 | name##_cache0 |= NEG_USR32(name##_cache1,num);\ | ||
293 | name##_cache1 <<= (num); | ||
294 | #endif | ||
295 | |||
296 | # define SKIP_COUNTER(name, gb, num)\ | ||
297 | name##_bit_count += (num);\ | ||
298 | |||
299 | # define SKIP_BITS(name, gb, num)\ | ||
300 | {\ | ||
301 | SKIP_CACHE(name, gb, num)\ | ||
302 | SKIP_COUNTER(name, gb, num)\ | ||
303 | }\ | ||
304 | |||
305 | # define LAST_SKIP_BITS(name, gb, num) SKIP_BITS(name, gb, num) | ||
306 | # define LAST_SKIP_CACHE(name, gb, num) SKIP_CACHE(name, gb, num) | ||
307 | |||
308 | # define SHOW_UBITS(name, gb, num)\ | ||
309 | NEG_USR32(name##_cache0, num) | ||
310 | |||
311 | # define SHOW_SBITS(name, gb, num)\ | ||
312 | NEG_SSR32(name##_cache0, num) | ||
313 | |||
314 | # define GET_CACHE(name, gb)\ | ||
315 | (name##_cache0) | ||
316 | |||
317 | static inline int get_bits_count(const GetBitContext *s){ | ||
318 | return ((uint8_t*)s->buffer_ptr - s->buffer)*8 - 32 + s->bit_count; | ||
319 | } | ||
320 | |||
321 | static inline void skip_bits_long(GetBitContext *s, int n){ | ||
322 | OPEN_READER(re, s) | ||
323 | re_bit_count += n; | ||
324 | re_buffer_ptr += re_bit_count>>5; | ||
325 | re_bit_count &= 31; | ||
326 | re_cache0 = be2me_32( re_buffer_ptr[-1] ) << re_bit_count; | ||
327 | re_cache1 = 0; | ||
328 | UPDATE_CACHE(re, s) | ||
329 | CLOSE_READER(re, s) | ||
330 | } | ||
331 | |||
332 | #endif | ||
333 | |||
334 | static inline int get_sbits(GetBitContext *s, int n){ | ||
335 | register int tmp; | ||
336 | OPEN_READER(re, s) | ||
337 | UPDATE_CACHE(re, s) | ||
338 | tmp= SHOW_SBITS(re, s, n); | ||
339 | LAST_SKIP_BITS(re, s, n) | ||
340 | CLOSE_READER(re, s) | ||
341 | return tmp; | ||
342 | } | ||
343 | |||
344 | /** | ||
345 | * reads 1-17 bits. | ||
346 | * Note, the alt bitstream reader can read up to 25 bits, but the libmpeg2 reader can't | ||
347 | */ | ||
348 | static inline unsigned int get_bits(GetBitContext *s, int n){ | ||
349 | register int tmp; | ||
350 | OPEN_READER(re, s) | ||
351 | UPDATE_CACHE(re, s) | ||
352 | tmp= SHOW_UBITS(re, s, n); | ||
353 | LAST_SKIP_BITS(re, s, n) | ||
354 | CLOSE_READER(re, s) | ||
355 | return tmp; | ||
356 | } | ||
357 | |||
358 | /** | ||
359 | * shows 1-17 bits. | ||
360 | * Note, the alt bitstream reader can read up to 25 bits, but the libmpeg2 reader can't | ||
361 | */ | ||
362 | static inline unsigned int show_bits(GetBitContext *s, int n){ | ||
363 | register int tmp; | ||
364 | OPEN_READER(re, s) | ||
365 | UPDATE_CACHE(re, s) | ||
366 | tmp= SHOW_UBITS(re, s, n); | ||
367 | // CLOSE_READER(re, s) | ||
368 | return tmp; | ||
369 | } | ||
370 | |||
371 | static inline void skip_bits(GetBitContext *s, int n){ | ||
372 | //Note gcc seems to optimize this to s->index+=n for the ALT_READER :)) | ||
373 | OPEN_READER(re, s) | ||
374 | UPDATE_CACHE(re, s) | ||
375 | LAST_SKIP_BITS(re, s, n) | ||
376 | CLOSE_READER(re, s) | ||
377 | } | ||
378 | |||
379 | static inline unsigned int get_bits1(GetBitContext *s){ | ||
380 | #ifdef ALT_BITSTREAM_READER | ||
381 | unsigned int index= s->index; | ||
382 | uint8_t result= s->buffer[ index>>3 ]; | ||
383 | #ifdef ALT_BITSTREAM_READER_LE | ||
384 | result>>= (index&0x07); | ||
385 | result&= 1; | ||
386 | #else | ||
387 | result<<= (index&0x07); | ||
388 | result>>= 8 - 1; | ||
389 | #endif | ||
390 | index++; | ||
391 | s->index= index; | ||
392 | |||
393 | return result; | ||
394 | #else | ||
395 | return get_bits(s, 1); | ||
396 | #endif | ||
397 | } | ||
398 | |||
399 | static inline unsigned int show_bits1(GetBitContext *s){ | ||
400 | return show_bits(s, 1); | ||
401 | } | ||
402 | |||
403 | static inline void skip_bits1(GetBitContext *s){ | ||
404 | skip_bits(s, 1); | ||
405 | } | ||
406 | |||
407 | /** | ||
408 | * reads 0-32 bits. | ||
409 | */ | ||
410 | static inline unsigned int get_bits_long(GetBitContext *s, int n){ | ||
411 | if(n<=MIN_CACHE_BITS) return get_bits(s, n); | ||
412 | else{ | ||
413 | #ifdef ALT_BITSTREAM_READER_LE | ||
414 | int ret= get_bits(s, 16); | ||
415 | return ret | (get_bits(s, n-16) << 16); | ||
416 | #else | ||
417 | int ret= get_bits(s, 16) << (n-16); | ||
418 | return ret | get_bits(s, n-16); | ||
419 | #endif | ||
420 | } | ||
421 | } | ||
422 | |||
423 | /** | ||
424 | * shows 0-32 bits. | ||
425 | */ | ||
426 | static inline unsigned int show_bits_long(GetBitContext *s, int n){ | ||
427 | if(n<=MIN_CACHE_BITS) return show_bits(s, n); | ||
428 | else{ | ||
429 | GetBitContext gb= *s; | ||
430 | return get_bits_long(&gb, n); | ||
431 | } | ||
432 | } | ||
433 | |||
434 | /** | ||
435 | * init GetBitContext. | ||
436 | * @param buffer bitstream buffer, must be FF_INPUT_BUFFER_PADDING_SIZE bytes larger then the actual read bits | ||
437 | * because some optimized bitstream readers read 32 or 64 bit at once and could read over the end | ||
438 | * @param bit_size the size of the buffer in bits | ||
439 | * | ||
440 | * While GetBitContext stores the buffer size, for performance reasons you are | ||
441 | * responsible for checking for the buffer end yourself (take advantage of the padding)! | ||
442 | */ | ||
443 | static inline void init_get_bits(GetBitContext *s, | ||
444 | const uint8_t *buffer, int bit_size) | ||
445 | { | ||
446 | int buffer_size= (bit_size+7)>>3; | ||
447 | if(buffer_size < 0 || bit_size < 0) { | ||
448 | buffer_size = bit_size = 0; | ||
449 | buffer = NULL; | ||
450 | } | ||
451 | |||
452 | s->buffer= buffer; | ||
453 | s->size_in_bits= bit_size; | ||
454 | s->buffer_end= buffer + buffer_size; | ||
455 | #ifdef ALT_BITSTREAM_READER | ||
456 | s->index=0; | ||
457 | #elif defined LIBMPEG2_BITSTREAM_READER | ||
458 | s->buffer_ptr = (uint8_t*)((intptr_t)buffer&(~1)); | ||
459 | s->bit_count = 16 + 8*((intptr_t)buffer&1); | ||
460 | skip_bits_long(s, 0); | ||
461 | #elif defined A32_BITSTREAM_READER | ||
462 | s->buffer_ptr = (uint32_t*)((intptr_t)buffer&(~3)); | ||
463 | s->bit_count = 32 + 8*((intptr_t)buffer&3); | ||
464 | skip_bits_long(s, 0); | ||
465 | #endif | ||
466 | } | ||
467 | |||
468 | static inline void align_get_bits(GetBitContext *s) | ||
469 | { | ||
470 | int n= (-get_bits_count(s)) & 7; | ||
471 | if(n) skip_bits(s, n); | ||
472 | } | ||
473 | |||
474 | #define init_vlc(vlc, nb_bits, nb_codes,\ | ||
475 | bits, bits_wrap, bits_size,\ | ||
476 | codes, codes_wrap, codes_size,\ | ||
477 | flags)\ | ||
478 | init_vlc_sparse(vlc, nb_bits, nb_codes,\ | ||
479 | bits, bits_wrap, bits_size,\ | ||
480 | codes, codes_wrap, codes_size,\ | ||
481 | NULL, 0, 0, flags) | ||
482 | |||
483 | int init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes, | ||
484 | const void *bits, int bits_wrap, int bits_size, | ||
485 | const void *codes, int codes_wrap, int codes_size, | ||
486 | const void *symbols, int symbols_wrap, int symbols_size, | ||
487 | int flags); | ||
488 | #define INIT_VLC_LE 2 | ||
489 | #define INIT_VLC_USE_NEW_STATIC 4 | ||
490 | void free_vlc(VLC *vlc); | ||
491 | |||
492 | #define INIT_VLC_STATIC(vlc, bits, a,b,c,d,e,f,g, static_size)\ | ||
493 | {\ | ||
494 | static VLC_TYPE table[static_size][2];\ | ||
495 | (vlc)->table= table;\ | ||
496 | (vlc)->table_allocated= static_size;\ | ||
497 | init_vlc(vlc, bits, a,b,c,d,e,f,g, INIT_VLC_USE_NEW_STATIC);\ | ||
498 | } | ||
499 | |||
500 | |||
501 | /** | ||
502 | * | ||
503 | * If the vlc code is invalid and max_depth=1, then no bits will be removed. | ||
504 | * If the vlc code is invalid and max_depth>1, then the number of bits removed | ||
505 | * is undefined. | ||
506 | */ | ||
507 | #define GET_VLC(code, name, gb, table, bits, max_depth)\ | ||
508 | {\ | ||
509 | int n, nb_bits;\ | ||
510 | unsigned int index;\ | ||
511 | \ | ||
512 | index= SHOW_UBITS(name, gb, bits);\ | ||
513 | code = table[index][0];\ | ||
514 | n = table[index][1];\ | ||
515 | \ | ||
516 | if(max_depth > 1 && n < 0){\ | ||
517 | LAST_SKIP_BITS(name, gb, bits)\ | ||
518 | UPDATE_CACHE(name, gb)\ | ||
519 | \ | ||
520 | nb_bits = -n;\ | ||
521 | \ | ||
522 | index= SHOW_UBITS(name, gb, nb_bits) + code;\ | ||
523 | code = table[index][0];\ | ||
524 | n = table[index][1];\ | ||
525 | if(max_depth > 2 && n < 0){\ | ||
526 | LAST_SKIP_BITS(name, gb, nb_bits)\ | ||
527 | UPDATE_CACHE(name, gb)\ | ||
528 | \ | ||
529 | nb_bits = -n;\ | ||
530 | \ | ||
531 | index= SHOW_UBITS(name, gb, nb_bits) + code;\ | ||
532 | code = table[index][0];\ | ||
533 | n = table[index][1];\ | ||
534 | }\ | ||
535 | }\ | ||
536 | SKIP_BITS(name, gb, n)\ | ||
537 | } | ||
538 | |||
539 | #define GET_RL_VLC(level, run, name, gb, table, bits, max_depth, need_update)\ | ||
540 | {\ | ||
541 | int n, nb_bits;\ | ||
542 | unsigned int index;\ | ||
543 | \ | ||
544 | index= SHOW_UBITS(name, gb, bits);\ | ||
545 | level = table[index].level;\ | ||
546 | n = table[index].len;\ | ||
547 | \ | ||
548 | if(max_depth > 1 && n < 0){\ | ||
549 | SKIP_BITS(name, gb, bits)\ | ||
550 | if(need_update){\ | ||
551 | UPDATE_CACHE(name, gb)\ | ||
552 | }\ | ||
553 | \ | ||
554 | nb_bits = -n;\ | ||
555 | \ | ||
556 | index= SHOW_UBITS(name, gb, nb_bits) + level;\ | ||
557 | level = table[index].level;\ | ||
558 | n = table[index].len;\ | ||
559 | }\ | ||
560 | run= table[index].run;\ | ||
561 | SKIP_BITS(name, gb, n)\ | ||
562 | } | ||
563 | |||
564 | |||
565 | /** | ||
566 | * parses a vlc code, faster then get_vlc() | ||
567 | * @param bits is the number of bits which will be read at once, must be | ||
568 | * identical to nb_bits in init_vlc() | ||
569 | * @param max_depth is the number of times bits bits must be read to completely | ||
570 | * read the longest vlc code | ||
571 | * = (max_vlc_length + bits - 1) / bits | ||
572 | */ | ||
573 | static inline int get_vlc2(GetBitContext *s, VLC_TYPE (*table)[2], | ||
574 | int bits, int max_depth) | ||
575 | { | ||
576 | int code; | ||
577 | |||
578 | OPEN_READER(re, s) | ||
579 | UPDATE_CACHE(re, s) | ||
580 | |||
581 | GET_VLC(code, re, s, table, bits, max_depth) | ||
582 | |||
583 | CLOSE_READER(re, s) | ||
584 | return code; | ||
585 | } | ||
586 | |||
587 | //#define TRACE | ||
588 | |||
589 | #ifdef TRACE | ||
590 | static inline void print_bin(int bits, int n){ | ||
591 | int i; | ||
592 | |||
593 | for(i=n-1; i>=0; i--){ | ||
594 | av_log(NULL, AV_LOG_DEBUG, "%d", (bits>>i)&1); | ||
595 | } | ||
596 | for(i=n; i<24; i++) | ||
597 | av_log(NULL, AV_LOG_DEBUG, " "); | ||
598 | } | ||
599 | |||
600 | static inline int get_bits_trace(GetBitContext *s, int n, char *file, const char *func, int line){ | ||
601 | int r= get_bits(s, n); | ||
602 | |||
603 | print_bin(r, n); | ||
604 | av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d bit @%5d in %s %s:%d\n", r, n, r, get_bits_count(s)-n, file, func, line); | ||
605 | return r; | ||
606 | } | ||
607 | static inline int get_vlc_trace(GetBitContext *s, VLC_TYPE (*table)[2], int bits, int max_depth, char *file, const char *func, int line){ | ||
608 | int show= show_bits(s, 24); | ||
609 | int pos= get_bits_count(s); | ||
610 | int r= get_vlc2(s, table, bits, max_depth); | ||
611 | int len= get_bits_count(s) - pos; | ||
612 | int bits2= show>>(24-len); | ||
613 | |||
614 | print_bin(bits2, len); | ||
615 | |||
616 | av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d vlc @%5d in %s %s:%d\n", bits2, len, r, pos, file, func, line); | ||
617 | return r; | ||
618 | } | ||
619 | static inline int get_xbits_trace(GetBitContext *s, int n, char *file, const char *func, int line){ | ||
620 | int show= show_bits(s, n); | ||
621 | int r= get_xbits(s, n); | ||
622 | |||
623 | print_bin(show, n); | ||
624 | av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d xbt @%5d in %s %s:%d\n", show, n, r, get_bits_count(s)-n, file, func, line); | ||
625 | return r; | ||
626 | } | ||
627 | |||
628 | #define get_bits(s, n) get_bits_trace(s, n, __FILE__, __PRETTY_FUNCTION__, __LINE__) | ||
629 | #define get_bits1(s) get_bits_trace(s, 1, __FILE__, __PRETTY_FUNCTION__, __LINE__) | ||
630 | #define get_xbits(s, n) get_xbits_trace(s, n, __FILE__, __PRETTY_FUNCTION__, __LINE__) | ||
631 | #define get_vlc(s, vlc) get_vlc_trace(s, (vlc)->table, (vlc)->bits, 3, __FILE__, __PRETTY_FUNCTION__, __LINE__) | ||
632 | #define get_vlc2(s, tab, bits, max) get_vlc_trace(s, tab, bits, max, __FILE__, __PRETTY_FUNCTION__, __LINE__) | ||
633 | |||
634 | #define tprintf(p, ...) av_log(p, AV_LOG_DEBUG, __VA_ARGS__) | ||
635 | |||
636 | #else //TRACE | ||
637 | #define tprintf(p, ...) {} | ||
638 | #endif | ||
639 | |||
640 | static inline int decode012(GetBitContext *gb){ | ||
641 | int n; | ||
642 | n = get_bits1(gb); | ||
643 | if (n == 0) | ||
644 | return 0; | ||
645 | else | ||
646 | return get_bits1(gb) + 1; | ||
647 | } | ||
648 | |||
649 | static inline int decode210(GetBitContext *gb){ | ||
650 | if (get_bits1(gb)) | ||
651 | return 0; | ||
652 | else | ||
653 | return 2 - get_bits1(gb); | ||
654 | } | ||
655 | |||
656 | static inline int get_bits_left(GetBitContext *gb) | ||
657 | { | ||
658 | return gb->size_in_bits - get_bits_count(gb); | ||
659 | } | ||
660 | |||
661 | #endif /* AVCODEC_GET_BITS_H */ | ||
diff --git a/apps/codecs/libwmapro/libavutil/bswap.h b/apps/codecs/libwmapro/libavutil/bswap.h deleted file mode 100644 index 82ed2271ac..0000000000 --- a/apps/codecs/libwmapro/libavutil/bswap.h +++ /dev/null | |||
@@ -1,89 +0,0 @@ | |||
1 | /* | ||
2 | * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> | ||
3 | * | ||
4 | * This file is part of FFmpeg. | ||
5 | * | ||
6 | * FFmpeg is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU Lesser General Public | ||
8 | * License as published by the Free Software Foundation; either | ||
9 | * version 2.1 of the License, or (at your option) any later version. | ||
10 | * | ||
11 | * FFmpeg is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | * Lesser General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU Lesser General Public | ||
17 | * License along with FFmpeg; if not, write to the Free Software | ||
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file libavutil/bswap.h | ||
23 | * byte swapping routines | ||
24 | */ | ||
25 | |||
26 | #ifndef AVUTIL_BSWAP_H | ||
27 | #define AVUTIL_BSWAP_H | ||
28 | |||
29 | #include <stdint.h> | ||
30 | //#include "config.h" | ||
31 | |||
32 | #ifndef bswap_16 | ||
33 | static inline uint16_t bswap_16(uint16_t x) | ||
34 | { | ||
35 | x= (x>>8) | (x<<8); | ||
36 | return x; | ||
37 | } | ||
38 | #endif | ||
39 | |||
40 | #ifndef bswap_32 | ||
41 | static inline uint32_t bswap_32(uint32_t x) | ||
42 | { | ||
43 | x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF); | ||
44 | x= (x>>16) | (x<<16); | ||
45 | return x; | ||
46 | } | ||
47 | #endif | ||
48 | |||
49 | #ifndef bswap_64 | ||
50 | static inline uint64_t bswap_64(uint64_t x) | ||
51 | { | ||
52 | #if 0 | ||
53 | x= ((x<< 8)&0xFF00FF00FF00FF00ULL) | ((x>> 8)&0x00FF00FF00FF00FFULL); | ||
54 | x= ((x<<16)&0xFFFF0000FFFF0000ULL) | ((x>>16)&0x0000FFFF0000FFFFULL); | ||
55 | return (x>>32) | (x<<32); | ||
56 | #else | ||
57 | union { | ||
58 | uint64_t ll; | ||
59 | uint32_t l[2]; | ||
60 | } w, r; | ||
61 | w.ll = x; | ||
62 | r.l[0] = bswap_32 (w.l[1]); | ||
63 | r.l[1] = bswap_32 (w.l[0]); | ||
64 | return r.ll; | ||
65 | #endif | ||
66 | } | ||
67 | #endif | ||
68 | |||
69 | // be2me ... big-endian to machine-endian | ||
70 | // le2me ... little-endian to machine-endian | ||
71 | |||
72 | #define HAVE_BIGENDIAN 0 | ||
73 | #if HAVE_BIGENDIAN | ||
74 | #define be2me_16(x) (x) | ||
75 | #define be2me_32(x) (x) | ||
76 | #define be2me_64(x) (x) | ||
77 | #define le2me_16(x) bswap_16(x) | ||
78 | #define le2me_32(x) bswap_32(x) | ||
79 | #define le2me_64(x) bswap_64(x) | ||
80 | #else | ||
81 | #define be2me_16(x) bswap_16(x) | ||
82 | #define be2me_32(x) bswap_32(x) | ||
83 | #define be2me_64(x) bswap_64(x) | ||
84 | #define le2me_16(x) (x) | ||
85 | #define le2me_32(x) (x) | ||
86 | #define le2me_64(x) (x) | ||
87 | #endif | ||
88 | |||
89 | #endif /* AVUTIL_BSWAP_H */ | ||
diff --git a/apps/codecs/libwmapro/libavutil/intreadwrite.h b/apps/codecs/libwmapro/libavutil/intreadwrite.h deleted file mode 100644 index 32dfcf2cad..0000000000 --- a/apps/codecs/libwmapro/libavutil/intreadwrite.h +++ /dev/null | |||
@@ -1,483 +0,0 @@ | |||
1 | /* | ||
2 | * This file is part of FFmpeg. | ||
3 | * | ||
4 | * FFmpeg is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU Lesser General Public | ||
6 | * License as published by the Free Software Foundation; either | ||
7 | * version 2.1 of the License, or (at your option) any later version. | ||
8 | * | ||
9 | * FFmpeg is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
12 | * Lesser General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU Lesser General Public | ||
15 | * License along with FFmpeg; if not, write to the Free Software | ||
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
17 | */ | ||
18 | |||
19 | #ifndef AVUTIL_INTREADWRITE_H | ||
20 | #define AVUTIL_INTREADWRITE_H | ||
21 | |||
22 | #include <stdint.h> | ||
23 | //#include "config.h" | ||
24 | #include "bswap.h" | ||
25 | //#include "common.h" | ||
26 | |||
27 | /* | ||
28 | * Arch-specific headers can provide any combination of | ||
29 | * AV_[RW][BLN](16|24|32|64) and AV_(COPY|SWAP|ZERO)(64|128) macros. | ||
30 | * Preprocessor symbols must be defined, even if these are implemented | ||
31 | * as inline functions. | ||
32 | */ | ||
33 | |||
34 | /* | ||
35 | * Map AV_RNXX <-> AV_R[BL]XX for all variants provided by per-arch headers. | ||
36 | */ | ||
37 | #define HAVE_BIGENDIAN 0 | ||
38 | #if HAVE_BIGENDIAN | ||
39 | |||
40 | # if defined(AV_RN16) && !defined(AV_RB16) | ||
41 | # define AV_RB16(p) AV_RN16(p) | ||
42 | # elif !defined(AV_RN16) && defined(AV_RB16) | ||
43 | # define AV_RN16(p) AV_RB16(p) | ||
44 | # endif | ||
45 | |||
46 | # if defined(AV_WN16) && !defined(AV_WB16) | ||
47 | # define AV_WB16(p, v) AV_WN16(p, v) | ||
48 | # elif !defined(AV_WN16) && defined(AV_WB16) | ||
49 | # define AV_WN16(p, v) AV_WB16(p, v) | ||
50 | # endif | ||
51 | |||
52 | # if defined(AV_RN24) && !defined(AV_RB24) | ||
53 | # define AV_RB24(p) AV_RN24(p) | ||
54 | # elif !defined(AV_RN24) && defined(AV_RB24) | ||
55 | # define AV_RN24(p) AV_RB24(p) | ||
56 | # endif | ||
57 | |||
58 | # if defined(AV_WN24) && !defined(AV_WB24) | ||
59 | # define AV_WB24(p, v) AV_WN24(p, v) | ||
60 | # elif !defined(AV_WN24) && defined(AV_WB24) | ||
61 | # define AV_WN24(p, v) AV_WB24(p, v) | ||
62 | # endif | ||
63 | |||
64 | # if defined(AV_RN32) && !defined(AV_RB32) | ||
65 | # define AV_RB32(p) AV_RN32(p) | ||
66 | # elif !defined(AV_RN32) && defined(AV_RB32) | ||
67 | # define AV_RN32(p) AV_RB32(p) | ||
68 | # endif | ||
69 | |||
70 | # if defined(AV_WN32) && !defined(AV_WB32) | ||
71 | # define AV_WB32(p, v) AV_WN32(p, v) | ||
72 | # elif !defined(AV_WN32) && defined(AV_WB32) | ||
73 | # define AV_WN32(p, v) AV_WB32(p, v) | ||
74 | # endif | ||
75 | |||
76 | # if defined(AV_RN64) && !defined(AV_RB64) | ||
77 | # define AV_RB64(p) AV_RN64(p) | ||
78 | # elif !defined(AV_RN64) && defined(AV_RB64) | ||
79 | # define AV_RN64(p) AV_RB64(p) | ||
80 | # endif | ||
81 | |||
82 | # if defined(AV_WN64) && !defined(AV_WB64) | ||
83 | # define AV_WB64(p, v) AV_WN64(p, v) | ||
84 | # elif !defined(AV_WN64) && defined(AV_WB64) | ||
85 | # define AV_WN64(p, v) AV_WB64(p, v) | ||
86 | # endif | ||
87 | |||
88 | #else /* HAVE_BIGENDIAN */ | ||
89 | |||
90 | # if defined(AV_RN16) && !defined(AV_RL16) | ||
91 | # define AV_RL16(p) AV_RN16(p) | ||
92 | # elif !defined(AV_RN16) && defined(AV_RL16) | ||
93 | # define AV_RN16(p) AV_RL16(p) | ||
94 | # endif | ||
95 | |||
96 | # if defined(AV_WN16) && !defined(AV_WL16) | ||
97 | # define AV_WL16(p, v) AV_WN16(p, v) | ||
98 | # elif !defined(AV_WN16) && defined(AV_WL16) | ||
99 | # define AV_WN16(p, v) AV_WL16(p, v) | ||
100 | # endif | ||
101 | |||
102 | # if defined(AV_RN24) && !defined(AV_RL24) | ||
103 | # define AV_RL24(p) AV_RN24(p) | ||
104 | # elif !defined(AV_RN24) && defined(AV_RL24) | ||
105 | # define AV_RN24(p) AV_RL24(p) | ||
106 | # endif | ||
107 | |||
108 | # if defined(AV_WN24) && !defined(AV_WL24) | ||
109 | # define AV_WL24(p, v) AV_WN24(p, v) | ||
110 | # elif !defined(AV_WN24) && defined(AV_WL24) | ||
111 | # define AV_WN24(p, v) AV_WL24(p, v) | ||
112 | # endif | ||
113 | |||
114 | # if defined(AV_RN32) && !defined(AV_RL32) | ||
115 | # define AV_RL32(p) AV_RN32(p) | ||
116 | # elif !defined(AV_RN32) && defined(AV_RL32) | ||
117 | # define AV_RN32(p) AV_RL32(p) | ||
118 | # endif | ||
119 | |||
120 | # if defined(AV_WN32) && !defined(AV_WL32) | ||
121 | # define AV_WL32(p, v) AV_WN32(p, v) | ||
122 | # elif !defined(AV_WN32) && defined(AV_WL32) | ||
123 | # define AV_WN32(p, v) AV_WL32(p, v) | ||
124 | # endif | ||
125 | |||
126 | # if defined(AV_RN64) && !defined(AV_RL64) | ||
127 | # define AV_RL64(p) AV_RN64(p) | ||
128 | # elif !defined(AV_RN64) && defined(AV_RL64) | ||
129 | # define AV_RN64(p) AV_RL64(p) | ||
130 | # endif | ||
131 | |||
132 | # if defined(AV_WN64) && !defined(AV_WL64) | ||
133 | # define AV_WL64(p, v) AV_WN64(p, v) | ||
134 | # elif !defined(AV_WN64) && defined(AV_WL64) | ||
135 | # define AV_WN64(p, v) AV_WL64(p, v) | ||
136 | # endif | ||
137 | |||
138 | #endif /* !HAVE_BIGENDIAN */ | ||
139 | |||
140 | #define HAVE_ATTRIBUTE_PACKED 0 | ||
141 | #define HAVE_FAST_UNALIGNED 0 | ||
142 | /* | ||
143 | * Define AV_[RW]N helper macros to simplify definitions not provided | ||
144 | * by per-arch headers. | ||
145 | */ | ||
146 | |||
147 | #if HAVE_ATTRIBUTE_PACKED | ||
148 | |||
149 | union unaligned_64 { uint64_t l; } __attribute__((packed)) av_alias; | ||
150 | union unaligned_32 { uint32_t l; } __attribute__((packed)) av_alias; | ||
151 | union unaligned_16 { uint16_t l; } __attribute__((packed)) av_alias; | ||
152 | |||
153 | # define AV_RN(s, p) (((const union unaligned_##s *) (p))->l) | ||
154 | # define AV_WN(s, p, v) ((((union unaligned_##s *) (p))->l) = (v)) | ||
155 | |||
156 | #elif defined(__DECC) | ||
157 | |||
158 | # define AV_RN(s, p) (*((const __unaligned uint##s##_t*)(p))) | ||
159 | # define AV_WN(s, p, v) (*((__unaligned uint##s##_t*)(p)) = (v)) | ||
160 | |||
161 | #elif HAVE_FAST_UNALIGNED | ||
162 | |||
163 | # define AV_RN(s, p) (((const av_alias##s*)(p))->u##s) | ||
164 | # define AV_WN(s, p, v) (((av_alias##s*)(p))->u##s = (v)) | ||
165 | |||
166 | #else | ||
167 | |||
168 | #ifndef AV_RB16 | ||
169 | # define AV_RB16(x) \ | ||
170 | ((((const uint8_t*)(x))[0] << 8) | \ | ||
171 | ((const uint8_t*)(x))[1]) | ||
172 | #endif | ||
173 | #ifndef AV_WB16 | ||
174 | # define AV_WB16(p, d) do { \ | ||
175 | ((uint8_t*)(p))[1] = (d); \ | ||
176 | ((uint8_t*)(p))[0] = (d)>>8; \ | ||
177 | } while(0) | ||
178 | #endif | ||
179 | |||
180 | #ifndef AV_RL16 | ||
181 | # define AV_RL16(x) \ | ||
182 | ((((const uint8_t*)(x))[1] << 8) | \ | ||
183 | ((const uint8_t*)(x))[0]) | ||
184 | #endif | ||
185 | #ifndef AV_WL16 | ||
186 | # define AV_WL16(p, d) do { \ | ||
187 | ((uint8_t*)(p))[0] = (d); \ | ||
188 | ((uint8_t*)(p))[1] = (d)>>8; \ | ||
189 | } while(0) | ||
190 | #endif | ||
191 | |||
192 | #ifndef AV_RB32 | ||
193 | # define AV_RB32(x) \ | ||
194 | ((((const uint8_t*)(x))[0] << 24) | \ | ||
195 | (((const uint8_t*)(x))[1] << 16) | \ | ||
196 | (((const uint8_t*)(x))[2] << 8) | \ | ||
197 | ((const uint8_t*)(x))[3]) | ||
198 | #endif | ||
199 | #ifndef AV_WB32 | ||
200 | # define AV_WB32(p, d) do { \ | ||
201 | ((uint8_t*)(p))[3] = (d); \ | ||
202 | ((uint8_t*)(p))[2] = (d)>>8; \ | ||
203 | ((uint8_t*)(p))[1] = (d)>>16; \ | ||
204 | ((uint8_t*)(p))[0] = (d)>>24; \ | ||
205 | } while(0) | ||
206 | #endif | ||
207 | |||
208 | #ifndef AV_RL32 | ||
209 | # define AV_RL32(x) \ | ||
210 | ((((const uint8_t*)(x))[3] << 24) | \ | ||
211 | (((const uint8_t*)(x))[2] << 16) | \ | ||
212 | (((const uint8_t*)(x))[1] << 8) | \ | ||
213 | ((const uint8_t*)(x))[0]) | ||
214 | #endif | ||
215 | #ifndef AV_WL32 | ||
216 | # define AV_WL32(p, d) do { \ | ||
217 | ((uint8_t*)(p))[0] = (d); \ | ||
218 | ((uint8_t*)(p))[1] = (d)>>8; \ | ||
219 | ((uint8_t*)(p))[2] = (d)>>16; \ | ||
220 | ((uint8_t*)(p))[3] = (d)>>24; \ | ||
221 | } while(0) | ||
222 | #endif | ||
223 | |||
224 | #ifndef AV_RB64 | ||
225 | # define AV_RB64(x) \ | ||
226 | (((uint64_t)((const uint8_t*)(x))[0] << 56) | \ | ||
227 | ((uint64_t)((const uint8_t*)(x))[1] << 48) | \ | ||
228 | ((uint64_t)((const uint8_t*)(x))[2] << 40) | \ | ||
229 | ((uint64_t)((const uint8_t*)(x))[3] << 32) | \ | ||
230 | ((uint64_t)((const uint8_t*)(x))[4] << 24) | \ | ||
231 | ((uint64_t)((const uint8_t*)(x))[5] << 16) | \ | ||
232 | ((uint64_t)((const uint8_t*)(x))[6] << 8) | \ | ||
233 | (uint64_t)((const uint8_t*)(x))[7]) | ||
234 | #endif | ||
235 | #ifndef AV_WB64 | ||
236 | # define AV_WB64(p, d) do { \ | ||
237 | ((uint8_t*)(p))[7] = (d); \ | ||
238 | ((uint8_t*)(p))[6] = (d)>>8; \ | ||
239 | ((uint8_t*)(p))[5] = (d)>>16; \ | ||
240 | ((uint8_t*)(p))[4] = (d)>>24; \ | ||
241 | ((uint8_t*)(p))[3] = (d)>>32; \ | ||
242 | ((uint8_t*)(p))[2] = (d)>>40; \ | ||
243 | ((uint8_t*)(p))[1] = (d)>>48; \ | ||
244 | ((uint8_t*)(p))[0] = (d)>>56; \ | ||
245 | } while(0) | ||
246 | #endif | ||
247 | |||
248 | #ifndef AV_RL64 | ||
249 | # define AV_RL64(x) \ | ||
250 | (((uint64_t)((const uint8_t*)(x))[7] << 56) | \ | ||
251 | ((uint64_t)((const uint8_t*)(x))[6] << 48) | \ | ||
252 | ((uint64_t)((const uint8_t*)(x))[5] << 40) | \ | ||
253 | ((uint64_t)((const uint8_t*)(x))[4] << 32) | \ | ||
254 | ((uint64_t)((const uint8_t*)(x))[3] << 24) | \ | ||
255 | ((uint64_t)((const uint8_t*)(x))[2] << 16) | \ | ||
256 | ((uint64_t)((const uint8_t*)(x))[1] << 8) | \ | ||
257 | (uint64_t)((const uint8_t*)(x))[0]) | ||
258 | #endif | ||
259 | #ifndef AV_WL64 | ||
260 | # define AV_WL64(p, d) do { \ | ||
261 | ((uint8_t*)(p))[0] = (d); \ | ||
262 | ((uint8_t*)(p))[1] = (d)>>8; \ | ||
263 | ((uint8_t*)(p))[2] = (d)>>16; \ | ||
264 | ((uint8_t*)(p))[3] = (d)>>24; \ | ||
265 | ((uint8_t*)(p))[4] = (d)>>32; \ | ||
266 | ((uint8_t*)(p))[5] = (d)>>40; \ | ||
267 | ((uint8_t*)(p))[6] = (d)>>48; \ | ||
268 | ((uint8_t*)(p))[7] = (d)>>56; \ | ||
269 | } while(0) | ||
270 | #endif | ||
271 | |||
272 | #if HAVE_BIGENDIAN | ||
273 | # define AV_RN(s, p) AV_RB##s(p) | ||
274 | # define AV_WN(s, p, v) AV_WB##s(p, v) | ||
275 | #else | ||
276 | # define AV_RN(s, p) AV_RL##s(p) | ||
277 | # define AV_WN(s, p, v) AV_WL##s(p, v) | ||
278 | #endif | ||
279 | |||
280 | #endif /* HAVE_FAST_UNALIGNED */ | ||
281 | |||
282 | #ifndef AV_RN16 | ||
283 | # define AV_RN16(p) AV_RN(16, p) | ||
284 | #endif | ||
285 | |||
286 | #ifndef AV_RN32 | ||
287 | # define AV_RN32(p) AV_RN(32, p) | ||
288 | #endif | ||
289 | |||
290 | #ifndef AV_RN64 | ||
291 | # define AV_RN64(p) AV_RN(64, p) | ||
292 | #endif | ||
293 | |||
294 | #ifndef AV_WN16 | ||
295 | # define AV_WN16(p, v) AV_WN(16, p, v) | ||
296 | #endif | ||
297 | |||
298 | #ifndef AV_WN32 | ||
299 | # define AV_WN32(p, v) AV_WN(32, p, v) | ||
300 | #endif | ||
301 | |||
302 | #ifndef AV_WN64 | ||
303 | # define AV_WN64(p, v) AV_WN(64, p, v) | ||
304 | #endif | ||
305 | |||
306 | #if HAVE_BIGENDIAN | ||
307 | # define AV_RB(s, p) AV_RN##s(p) | ||
308 | # define AV_WB(s, p, v) AV_WN##s(p, v) | ||
309 | # define AV_RL(s, p) bswap_##s(AV_RN##s(p)) | ||
310 | # define AV_WL(s, p, v) AV_WN##s(p, bswap_##s(v)) | ||
311 | #else | ||
312 | # define AV_RB(s, p) bswap_##s(AV_RN##s(p)) | ||
313 | # define AV_WB(s, p, v) AV_WN##s(p, bswap_##s(v)) | ||
314 | # define AV_RL(s, p) AV_RN##s(p) | ||
315 | # define AV_WL(s, p, v) AV_WN##s(p, v) | ||
316 | #endif | ||
317 | |||
318 | #define AV_RB8(x) (((const uint8_t*)(x))[0]) | ||
319 | #define AV_WB8(p, d) do { ((uint8_t*)(p))[0] = (d); } while(0) | ||
320 | |||
321 | #define AV_RL8(x) AV_RB8(x) | ||
322 | #define AV_WL8(p, d) AV_WB8(p, d) | ||
323 | |||
324 | #ifndef AV_RB16 | ||
325 | # define AV_RB16(p) AV_RB(16, p) | ||
326 | #endif | ||
327 | #ifndef AV_WB16 | ||
328 | # define AV_WB16(p, v) AV_WB(16, p, v) | ||
329 | #endif | ||
330 | |||
331 | #ifndef AV_RL16 | ||
332 | # define AV_RL16(p) AV_RL(16, p) | ||
333 | #endif | ||
334 | #ifndef AV_WL16 | ||
335 | # define AV_WL16(p, v) AV_WL(16, p, v) | ||
336 | #endif | ||
337 | |||
338 | #ifndef AV_RB32 | ||
339 | # define AV_RB32(p) AV_RB(32, p) | ||
340 | #endif | ||
341 | #ifndef AV_WB32 | ||
342 | # define AV_WB32(p, v) AV_WB(32, p, v) | ||
343 | #endif | ||
344 | |||
345 | #ifndef AV_RL32 | ||
346 | # define AV_RL32(p) AV_RL(32, p) | ||
347 | #endif | ||
348 | #ifndef AV_WL32 | ||
349 | # define AV_WL32(p, v) AV_WL(32, p, v) | ||
350 | #endif | ||
351 | |||
352 | #ifndef AV_RB64 | ||
353 | # define AV_RB64(p) AV_RB(64, p) | ||
354 | #endif | ||
355 | #ifndef AV_WB64 | ||
356 | # define AV_WB64(p, v) AV_WB(64, p, v) | ||
357 | #endif | ||
358 | |||
359 | #ifndef AV_RL64 | ||
360 | # define AV_RL64(p) AV_RL(64, p) | ||
361 | #endif | ||
362 | #ifndef AV_WL64 | ||
363 | # define AV_WL64(p, v) AV_WL(64, p, v) | ||
364 | #endif | ||
365 | |||
366 | #ifndef AV_RB24 | ||
367 | # define AV_RB24(x) \ | ||
368 | ((((const uint8_t*)(x))[0] << 16) | \ | ||
369 | (((const uint8_t*)(x))[1] << 8) | \ | ||
370 | ((const uint8_t*)(x))[2]) | ||
371 | #endif | ||
372 | #ifndef AV_WB24 | ||
373 | # define AV_WB24(p, d) do { \ | ||
374 | ((uint8_t*)(p))[2] = (d); \ | ||
375 | ((uint8_t*)(p))[1] = (d)>>8; \ | ||
376 | ((uint8_t*)(p))[0] = (d)>>16; \ | ||
377 | } while(0) | ||
378 | #endif | ||
379 | |||
380 | #ifndef AV_RL24 | ||
381 | # define AV_RL24(x) \ | ||
382 | ((((const uint8_t*)(x))[2] << 16) | \ | ||
383 | (((const uint8_t*)(x))[1] << 8) | \ | ||
384 | ((const uint8_t*)(x))[0]) | ||
385 | #endif | ||
386 | #ifndef AV_WL24 | ||
387 | # define AV_WL24(p, d) do { \ | ||
388 | ((uint8_t*)(p))[0] = (d); \ | ||
389 | ((uint8_t*)(p))[1] = (d)>>8; \ | ||
390 | ((uint8_t*)(p))[2] = (d)>>16; \ | ||
391 | } while(0) | ||
392 | #endif | ||
393 | |||
394 | /* | ||
395 | * The AV_[RW]NA macros access naturally aligned data | ||
396 | * in a type-safe way. | ||
397 | */ | ||
398 | |||
399 | #define AV_RNA(s, p) (((const av_alias##s*)(p))->u##s) | ||
400 | #define AV_WNA(s, p, v) (((av_alias##s*)(p))->u##s = (v)) | ||
401 | |||
402 | #ifndef AV_RN16A | ||
403 | # define AV_RN16A(p) AV_RNA(16, p) | ||
404 | #endif | ||
405 | |||
406 | #ifndef AV_RN32A | ||
407 | # define AV_RN32A(p) AV_RNA(32, p) | ||
408 | #endif | ||
409 | |||
410 | #ifndef AV_RN64A | ||
411 | # define AV_RN64A(p) AV_RNA(64, p) | ||
412 | #endif | ||
413 | |||
414 | #ifndef AV_WN16A | ||
415 | # define AV_WN16A(p, v) AV_WNA(16, p, v) | ||
416 | #endif | ||
417 | |||
418 | #ifndef AV_WN32A | ||
419 | # define AV_WN32A(p, v) AV_WNA(32, p, v) | ||
420 | #endif | ||
421 | |||
422 | #ifndef AV_WN64A | ||
423 | # define AV_WN64A(p, v) AV_WNA(64, p, v) | ||
424 | #endif | ||
425 | |||
426 | /* Parameters for AV_COPY*, AV_SWAP*, AV_ZERO* must be | ||
427 | * naturally aligned. They may be implemented using MMX, | ||
428 | * so emms_c() must be called before using any float code | ||
429 | * afterwards. | ||
430 | */ | ||
431 | |||
432 | #define AV_COPY(n, d, s) \ | ||
433 | (((av_alias##n*)(d))->u##n = ((const av_alias##n*)(s))->u##n) | ||
434 | |||
435 | #ifndef AV_COPY16 | ||
436 | # define AV_COPY16(d, s) AV_COPY(16, d, s) | ||
437 | #endif | ||
438 | |||
439 | #ifndef AV_COPY32 | ||
440 | # define AV_COPY32(d, s) AV_COPY(32, d, s) | ||
441 | #endif | ||
442 | |||
443 | #ifndef AV_COPY64 | ||
444 | # define AV_COPY64(d, s) AV_COPY(64, d, s) | ||
445 | #endif | ||
446 | |||
447 | #ifndef AV_COPY128 | ||
448 | # define AV_COPY128(d, s) \ | ||
449 | do { \ | ||
450 | AV_COPY64(d, s); \ | ||
451 | AV_COPY64((char*)(d)+8, (char*)(s)+8); \ | ||
452 | } while(0) | ||
453 | #endif | ||
454 | |||
455 | #define AV_SWAP(n, a, b) FFSWAP(av_alias##n, *(av_alias##n*)(a), *(av_alias##n*)(b)) | ||
456 | |||
457 | #ifndef AV_SWAP64 | ||
458 | # define AV_SWAP64(a, b) AV_SWAP(64, a, b) | ||
459 | #endif | ||
460 | |||
461 | #define AV_ZERO(n, d) (((av_alias##n*)(d))->u##n = 0) | ||
462 | |||
463 | #ifndef AV_ZERO16 | ||
464 | # define AV_ZERO16(d) AV_ZERO(16, d) | ||
465 | #endif | ||
466 | |||
467 | #ifndef AV_ZERO32 | ||
468 | # define AV_ZERO32(d) AV_ZERO(32, d) | ||
469 | #endif | ||
470 | |||
471 | #ifndef AV_ZERO64 | ||
472 | # define AV_ZERO64(d) AV_ZERO(64, d) | ||
473 | #endif | ||
474 | |||
475 | #ifndef AV_ZERO128 | ||
476 | # define AV_ZERO128(d) \ | ||
477 | do { \ | ||
478 | AV_ZERO64(d); \ | ||
479 | AV_ZERO64((char*)(d)+8); \ | ||
480 | } while(0) | ||
481 | #endif | ||
482 | |||
483 | #endif /* AVUTIL_INTREADWRITE_H */ | ||
diff --git a/apps/codecs/libwmapro/put_bits.h b/apps/codecs/libwmapro/put_bits.h deleted file mode 100644 index a3c458b0be..0000000000 --- a/apps/codecs/libwmapro/put_bits.h +++ /dev/null | |||
@@ -1,328 +0,0 @@ | |||
1 | /* | ||
2 | * copyright (c) 2004 Michael Niedermayer <michaelni@gmx.at> | ||
3 | * | ||
4 | * This file is part of FFmpeg. | ||
5 | * | ||
6 | * FFmpeg is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU Lesser General Public | ||
8 | * License as published by the Free Software Foundation; either | ||
9 | * version 2.1 of the License, or (at your option) any later version. | ||
10 | * | ||
11 | * FFmpeg is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | * Lesser General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU Lesser General Public | ||
17 | * License along with FFmpeg; if not, write to the Free Software | ||
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file libavcodec/put_bits.h | ||
23 | * bitstream writer API | ||
24 | */ | ||
25 | |||
26 | #ifndef AVCODEC_PUT_BITS_H | ||
27 | #define AVCODEC_PUT_BITS_H | ||
28 | |||
29 | #include <stdint.h> | ||
30 | #include <stdlib.h> | ||
31 | //#include <assert.h> | ||
32 | #include "libavutil/bswap.h" | ||
33 | //#include "libavutil/common.h" | ||
34 | //#include "libavutil/intreadwrite.h" | ||
35 | //#include "libavutil/log.h" | ||
36 | |||
37 | #define av_log(...) | ||
38 | |||
39 | //#define ALT_BITSTREAM_WRITER | ||
40 | //#define ALIGNED_BITSTREAM_WRITER | ||
41 | #define HAVE_FAST_UNALIGNED 0 | ||
42 | /* buf and buf_end must be present and used by every alternative writer. */ | ||
43 | typedef struct PutBitContext { | ||
44 | #ifdef ALT_BITSTREAM_WRITER | ||
45 | uint8_t *buf, *buf_end; | ||
46 | int index; | ||
47 | #else | ||
48 | uint32_t bit_buf; | ||
49 | int bit_left; | ||
50 | uint8_t *buf, *buf_ptr, *buf_end; | ||
51 | #endif | ||
52 | int size_in_bits; | ||
53 | } PutBitContext; | ||
54 | |||
55 | /** | ||
56 | * Initializes the PutBitContext s. | ||
57 | * | ||
58 | * @param buffer the buffer where to put bits | ||
59 | * @param buffer_size the size in bytes of buffer | ||
60 | */ | ||
61 | static inline void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size) | ||
62 | { | ||
63 | if(buffer_size < 0) { | ||
64 | buffer_size = 0; | ||
65 | buffer = NULL; | ||
66 | } | ||
67 | |||
68 | s->size_in_bits= 8*buffer_size; | ||
69 | s->buf = buffer; | ||
70 | s->buf_end = s->buf + buffer_size; | ||
71 | #ifdef ALT_BITSTREAM_WRITER | ||
72 | s->index=0; | ||
73 | ((uint32_t*)(s->buf))[0]=0; | ||
74 | // memset(buffer, 0, buffer_size); | ||
75 | #else | ||
76 | s->buf_ptr = s->buf; | ||
77 | s->bit_left=32; | ||
78 | s->bit_buf=0; | ||
79 | #endif | ||
80 | } | ||
81 | |||
82 | /** | ||
83 | * Returns the total number of bits written to the bitstream. | ||
84 | */ | ||
85 | static inline int put_bits_count(PutBitContext *s) | ||
86 | { | ||
87 | #ifdef ALT_BITSTREAM_WRITER | ||
88 | return s->index; | ||
89 | #else | ||
90 | return (s->buf_ptr - s->buf) * 8 + 32 - s->bit_left; | ||
91 | #endif | ||
92 | } | ||
93 | |||
94 | /** | ||
95 | * Pads the end of the output stream with zeros. | ||
96 | */ | ||
97 | static inline void flush_put_bits(PutBitContext *s) | ||
98 | { | ||
99 | #ifdef ALT_BITSTREAM_WRITER | ||
100 | align_put_bits(s); | ||
101 | #else | ||
102 | #ifndef BITSTREAM_WRITER_LE | ||
103 | s->bit_buf<<= s->bit_left; | ||
104 | #endif | ||
105 | while (s->bit_left < 32) { | ||
106 | /* XXX: should test end of buffer */ | ||
107 | #ifdef BITSTREAM_WRITER_LE | ||
108 | *s->buf_ptr++=s->bit_buf; | ||
109 | s->bit_buf>>=8; | ||
110 | #else | ||
111 | *s->buf_ptr++=s->bit_buf >> 24; | ||
112 | s->bit_buf<<=8; | ||
113 | #endif | ||
114 | s->bit_left+=8; | ||
115 | } | ||
116 | s->bit_left=32; | ||
117 | s->bit_buf=0; | ||
118 | #endif | ||
119 | } | ||
120 | |||
121 | #if defined(ALT_BITSTREAM_WRITER) || defined(BITSTREAM_WRITER_LE) | ||
122 | #define align_put_bits align_put_bits_unsupported_here | ||
123 | #define ff_put_string ff_put_string_unsupported_here | ||
124 | #define ff_copy_bits ff_copy_bits_unsupported_here | ||
125 | #else | ||
126 | /** | ||
127 | * Pads the bitstream with zeros up to the next byte boundary. | ||
128 | */ | ||
129 | void align_put_bits(PutBitContext *s); | ||
130 | |||
131 | /** | ||
132 | * Puts the string string in the bitstream. | ||
133 | * | ||
134 | * @param terminate_string 0-terminates the written string if value is 1 | ||
135 | */ | ||
136 | void ff_put_string(PutBitContext *pb, const char *string, int terminate_string); | ||
137 | |||
138 | /** | ||
139 | * Copies the content of src to the bitstream. | ||
140 | * | ||
141 | * @param length the number of bits of src to copy | ||
142 | */ | ||
143 | void ff_copy_bits(PutBitContext *pb, const uint8_t *src, int length); | ||
144 | #endif | ||
145 | |||
146 | /** | ||
147 | * Writes up to 31 bits into a bitstream. | ||
148 | * Use put_bits32 to write 32 bits. | ||
149 | */ | ||
150 | static inline void put_bits(PutBitContext *s, int n, unsigned int value) | ||
151 | #ifndef ALT_BITSTREAM_WRITER | ||
152 | { | ||
153 | unsigned int bit_buf; | ||
154 | int bit_left; | ||
155 | |||
156 | // printf("put_bits=%d %x\n", n, value); | ||
157 | //assert(n <= 31 && value < (1U << n)); | ||
158 | |||
159 | bit_buf = s->bit_buf; | ||
160 | bit_left = s->bit_left; | ||
161 | |||
162 | // printf("n=%d value=%x cnt=%d buf=%x\n", n, value, bit_cnt, bit_buf); | ||
163 | /* XXX: optimize */ | ||
164 | #ifdef BITSTREAM_WRITER_LE | ||
165 | bit_buf |= value << (32 - bit_left); | ||
166 | if (n >= bit_left) { | ||
167 | #if !HAVE_FAST_UNALIGNED | ||
168 | if (3 & (intptr_t) s->buf_ptr) { | ||
169 | AV_WL32(s->buf_ptr, bit_buf); | ||
170 | } else | ||
171 | #endif | ||
172 | *(uint32_t *)s->buf_ptr = le2me_32(bit_buf); | ||
173 | s->buf_ptr+=4; | ||
174 | bit_buf = (bit_left==32)?0:value >> bit_left; | ||
175 | bit_left+=32; | ||
176 | } | ||
177 | bit_left-=n; | ||
178 | #else | ||
179 | if (n < bit_left) { | ||
180 | bit_buf = (bit_buf<<n) | value; | ||
181 | bit_left-=n; | ||
182 | } else { | ||
183 | bit_buf<<=bit_left; | ||
184 | bit_buf |= value >> (n - bit_left); | ||
185 | #if !HAVE_FAST_UNALIGNED | ||
186 | if (3 & (intptr_t) s->buf_ptr) { | ||
187 | AV_WB32(s->buf_ptr, bit_buf); | ||
188 | } else | ||
189 | #endif | ||
190 | *(uint32_t *)s->buf_ptr = be2me_32(bit_buf); | ||
191 | //printf("bitbuf = %08x\n", bit_buf); | ||
192 | s->buf_ptr+=4; | ||
193 | bit_left+=32 - n; | ||
194 | bit_buf = value; | ||
195 | } | ||
196 | #endif | ||
197 | |||
198 | s->bit_buf = bit_buf; | ||
199 | s->bit_left = bit_left; | ||
200 | } | ||
201 | #else /* ALT_BITSTREAM_WRITER defined */ | ||
202 | { | ||
203 | # ifdef ALIGNED_BITSTREAM_WRITER | ||
204 | # if ARCH_X86 | ||
205 | __asm__ volatile( | ||
206 | "movl %0, %%ecx \n\t" | ||
207 | "xorl %%eax, %%eax \n\t" | ||
208 | "shrdl %%cl, %1, %%eax \n\t" | ||
209 | "shrl %%cl, %1 \n\t" | ||
210 | "movl %0, %%ecx \n\t" | ||
211 | "shrl $3, %%ecx \n\t" | ||
212 | "andl $0xFFFFFFFC, %%ecx \n\t" | ||
213 | "bswapl %1 \n\t" | ||
214 | "orl %1, (%2, %%ecx) \n\t" | ||
215 | "bswapl %%eax \n\t" | ||
216 | "addl %3, %0 \n\t" | ||
217 | "movl %%eax, 4(%2, %%ecx) \n\t" | ||
218 | : "=&r" (s->index), "=&r" (value) | ||
219 | : "r" (s->buf), "r" (n), "0" (s->index), "1" (value<<(-n)) | ||
220 | : "%eax", "%ecx" | ||
221 | ); | ||
222 | # else | ||
223 | int index= s->index; | ||
224 | uint32_t *ptr= ((uint32_t *)s->buf)+(index>>5); | ||
225 | |||
226 | value<<= 32-n; | ||
227 | |||
228 | ptr[0] |= be2me_32(value>>(index&31)); | ||
229 | ptr[1] = be2me_32(value<<(32-(index&31))); | ||
230 | //if(n>24) printf("%d %d\n", n, value); | ||
231 | index+= n; | ||
232 | s->index= index; | ||
233 | # endif | ||
234 | # else //ALIGNED_BITSTREAM_WRITER | ||
235 | # if ARCH_X86 | ||
236 | __asm__ volatile( | ||
237 | "movl $7, %%ecx \n\t" | ||
238 | "andl %0, %%ecx \n\t" | ||
239 | "addl %3, %%ecx \n\t" | ||
240 | "negl %%ecx \n\t" | ||
241 | "shll %%cl, %1 \n\t" | ||
242 | "bswapl %1 \n\t" | ||
243 | "movl %0, %%ecx \n\t" | ||
244 | "shrl $3, %%ecx \n\t" | ||
245 | "orl %1, (%%ecx, %2) \n\t" | ||
246 | "addl %3, %0 \n\t" | ||
247 | "movl $0, 4(%%ecx, %2) \n\t" | ||
248 | : "=&r" (s->index), "=&r" (value) | ||
249 | : "r" (s->buf), "r" (n), "0" (s->index), "1" (value) | ||
250 | : "%ecx" | ||
251 | ); | ||
252 | # else | ||
253 | int index= s->index; | ||
254 | uint32_t *ptr= (uint32_t*)(((uint8_t *)s->buf)+(index>>3)); | ||
255 | |||
256 | ptr[0] |= be2me_32(value<<(32-n-(index&7) )); | ||
257 | ptr[1] = 0; | ||
258 | //if(n>24) printf("%d %d\n", n, value); | ||
259 | index+= n; | ||
260 | s->index= index; | ||
261 | # endif | ||
262 | # endif //!ALIGNED_BITSTREAM_WRITER | ||
263 | } | ||
264 | #endif | ||
265 | |||
266 | static inline void put_sbits(PutBitContext *pb, int n, int32_t value) | ||
267 | { | ||
268 | //assert(n >= 0 && n <= 31); | ||
269 | |||
270 | put_bits(pb, n, value & ((1<<n)-1)); | ||
271 | } | ||
272 | |||
273 | /** | ||
274 | * Returns the pointer to the byte where the bitstream writer will put | ||
275 | * the next bit. | ||
276 | */ | ||
277 | static inline uint8_t* put_bits_ptr(PutBitContext *s) | ||
278 | { | ||
279 | #ifdef ALT_BITSTREAM_WRITER | ||
280 | return s->buf + (s->index>>3); | ||
281 | #else | ||
282 | return s->buf_ptr; | ||
283 | #endif | ||
284 | } | ||
285 | |||
286 | /** | ||
287 | * Skips the given number of bytes. | ||
288 | * PutBitContext must be flushed & aligned to a byte boundary before calling this. | ||
289 | */ | ||
290 | static inline void skip_put_bytes(PutBitContext *s, int n) | ||
291 | { | ||
292 | //assert((put_bits_count(s)&7)==0); | ||
293 | #ifdef ALT_BITSTREAM_WRITER | ||
294 | FIXME may need some cleaning of the buffer | ||
295 | s->index += n<<3; | ||
296 | #else | ||
297 | //assert(s->bit_left==32); | ||
298 | s->buf_ptr += n; | ||
299 | #endif | ||
300 | } | ||
301 | |||
302 | /** | ||
303 | * Skips the given number of bits. | ||
304 | * Must only be used if the actual values in the bitstream do not matter. | ||
305 | * If n is 0 the behavior is undefined. | ||
306 | */ | ||
307 | static inline void skip_put_bits(PutBitContext *s, int n) | ||
308 | { | ||
309 | #ifdef ALT_BITSTREAM_WRITER | ||
310 | s->index += n; | ||
311 | #else | ||
312 | s->bit_left -= n; | ||
313 | s->buf_ptr-= 4*(s->bit_left>>5); | ||
314 | s->bit_left &= 31; | ||
315 | #endif | ||
316 | } | ||
317 | |||
318 | /** | ||
319 | * Changes the end of the buffer. | ||
320 | * | ||
321 | * @param size the new size in bytes of the buffer where to put bits | ||
322 | */ | ||
323 | static inline void set_put_bits_buffer_size(PutBitContext *s, int size) | ||
324 | { | ||
325 | s->buf_end= s->buf + size; | ||
326 | } | ||
327 | |||
328 | #endif /* AVCODEC_PUT_BITS_H */ | ||
diff --git a/apps/codecs/libwmapro/wma.h b/apps/codecs/libwmapro/wma.h index 6586d74b7e..40ca6e1303 100644 --- a/apps/codecs/libwmapro/wma.h +++ b/apps/codecs/libwmapro/wma.h | |||
@@ -22,8 +22,8 @@ | |||
22 | #ifndef AVCODEC_WMA_H | 22 | #ifndef AVCODEC_WMA_H |
23 | #define AVCODEC_WMA_H | 23 | #define AVCODEC_WMA_H |
24 | 24 | ||
25 | #include "get_bits.h" | 25 | #include "ffmpeg_get_bits.h" |
26 | #include "put_bits.h" | 26 | #include "ffmpeg_put_bits.h" |
27 | 27 | ||
28 | /* size of blocks */ | 28 | /* size of blocks */ |
29 | #define BLOCK_MIN_BITS 7 | 29 | #define BLOCK_MIN_BITS 7 |
diff --git a/apps/codecs/libwmapro/wmaprodec.c b/apps/codecs/libwmapro/wmaprodec.c index 1fc4386bd5..ea4cbe3a44 100644 --- a/apps/codecs/libwmapro/wmaprodec.c +++ b/apps/codecs/libwmapro/wmaprodec.c | |||
@@ -86,8 +86,8 @@ | |||
86 | * subframe in order to reconstruct the output samples. | 86 | * subframe in order to reconstruct the output samples. |
87 | */ | 87 | */ |
88 | 88 | ||
89 | #include "get_bits.h" | 89 | #include "ffmpeg_get_bits.h" |
90 | #include "put_bits.h" | 90 | #include "ffmpeg_put_bits.h" |
91 | #include "wmaprodata.h" | 91 | #include "wmaprodata.h" |
92 | #include "wma.h" | 92 | #include "wma.h" |
93 | #include "wmaprodec.h" | 93 | #include "wmaprodec.h" |