Mercurial > audlegacy-plugins
annotate src/aac/libfaad2/bits.c @ 3047:4434b4c4a715
ported EsounD plugin
author | Andrew O. Shadoura <bugzilla@tut.by> |
---|---|
date | Fri, 17 Apr 2009 16:17:10 +0300 |
parents | 7a7060caef14 |
children |
rev | line source |
---|---|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
2 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
3 ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
4 ** |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
5 ** This program is free software; you can redistribute it and/or modify |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
6 ** it under the terms of the GNU General Public License as published by |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
7 ** the Free Software Foundation; either version 2 of the License, or |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
8 ** (at your option) any later version. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
9 ** |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
10 ** This program is distributed in the hope that it will be useful, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
11 ** but WITHOUT ANY WARRANTY; without even the implied warranty of |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
12 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
13 ** GNU General Public License for more details. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
14 ** |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
15 ** You should have received a copy of the GNU General Public License |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
16 ** along with this program; if not, write to the Free Software |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
17 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
18 ** |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
19 ** Any non-GPL usage of this software or parts of this software is strictly |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
20 ** forbidden. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
21 ** |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
22 ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
23 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
24 ** |
691 | 25 ** Commercial non-GPL licensing of this software is possible. |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
26 ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. |
681 | 27 ** |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
28 ** $Id: bits.c,v 1.44 2007/11/01 12:33:29 menno Exp $ |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
29 **/ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
30 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
31 #include "common.h" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
32 #include "structs.h" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
33 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
34 #include <stdlib.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
35 #include "bits.h" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
36 |
3007
7a7060caef14
Yes, and another of those "inline" functions moved to where it belongs.
Tony Vroon <chainsaw@gentoo.org>
parents:
3004
diff
changeset
|
37 /* reads only n bytes from the stream instead of the standard 4 */ |
7a7060caef14
Yes, and another of those "inline" functions moved to where it belongs.
Tony Vroon <chainsaw@gentoo.org>
parents:
3004
diff
changeset
|
38 static /*INLINE*/ uint32_t getdword_n(void *mem, int n) |
7a7060caef14
Yes, and another of those "inline" functions moved to where it belongs.
Tony Vroon <chainsaw@gentoo.org>
parents:
3004
diff
changeset
|
39 { |
7a7060caef14
Yes, and another of those "inline" functions moved to where it belongs.
Tony Vroon <chainsaw@gentoo.org>
parents:
3004
diff
changeset
|
40 uint32_t tmp = 0; |
7a7060caef14
Yes, and another of those "inline" functions moved to where it belongs.
Tony Vroon <chainsaw@gentoo.org>
parents:
3004
diff
changeset
|
41 #ifndef ARCH_IS_BIG_ENDIAN |
7a7060caef14
Yes, and another of those "inline" functions moved to where it belongs.
Tony Vroon <chainsaw@gentoo.org>
parents:
3004
diff
changeset
|
42 switch (n) |
7a7060caef14
Yes, and another of those "inline" functions moved to where it belongs.
Tony Vroon <chainsaw@gentoo.org>
parents:
3004
diff
changeset
|
43 { |
7a7060caef14
Yes, and another of those "inline" functions moved to where it belongs.
Tony Vroon <chainsaw@gentoo.org>
parents:
3004
diff
changeset
|
44 case 3: |
7a7060caef14
Yes, and another of those "inline" functions moved to where it belongs.
Tony Vroon <chainsaw@gentoo.org>
parents:
3004
diff
changeset
|
45 ((uint8_t*)&tmp)[1] = ((uint8_t*)mem)[2]; |
7a7060caef14
Yes, and another of those "inline" functions moved to where it belongs.
Tony Vroon <chainsaw@gentoo.org>
parents:
3004
diff
changeset
|
46 case 2: |
7a7060caef14
Yes, and another of those "inline" functions moved to where it belongs.
Tony Vroon <chainsaw@gentoo.org>
parents:
3004
diff
changeset
|
47 ((uint8_t*)&tmp)[2] = ((uint8_t*)mem)[1]; |
7a7060caef14
Yes, and another of those "inline" functions moved to where it belongs.
Tony Vroon <chainsaw@gentoo.org>
parents:
3004
diff
changeset
|
48 case 1: |
7a7060caef14
Yes, and another of those "inline" functions moved to where it belongs.
Tony Vroon <chainsaw@gentoo.org>
parents:
3004
diff
changeset
|
49 ((uint8_t*)&tmp)[3] = ((uint8_t*)mem)[0]; |
7a7060caef14
Yes, and another of those "inline" functions moved to where it belongs.
Tony Vroon <chainsaw@gentoo.org>
parents:
3004
diff
changeset
|
50 default: |
7a7060caef14
Yes, and another of those "inline" functions moved to where it belongs.
Tony Vroon <chainsaw@gentoo.org>
parents:
3004
diff
changeset
|
51 break; |
7a7060caef14
Yes, and another of those "inline" functions moved to where it belongs.
Tony Vroon <chainsaw@gentoo.org>
parents:
3004
diff
changeset
|
52 } |
7a7060caef14
Yes, and another of those "inline" functions moved to where it belongs.
Tony Vroon <chainsaw@gentoo.org>
parents:
3004
diff
changeset
|
53 #else |
7a7060caef14
Yes, and another of those "inline" functions moved to where it belongs.
Tony Vroon <chainsaw@gentoo.org>
parents:
3004
diff
changeset
|
54 switch (n) |
7a7060caef14
Yes, and another of those "inline" functions moved to where it belongs.
Tony Vroon <chainsaw@gentoo.org>
parents:
3004
diff
changeset
|
55 { |
7a7060caef14
Yes, and another of those "inline" functions moved to where it belongs.
Tony Vroon <chainsaw@gentoo.org>
parents:
3004
diff
changeset
|
56 case 3: |
7a7060caef14
Yes, and another of those "inline" functions moved to where it belongs.
Tony Vroon <chainsaw@gentoo.org>
parents:
3004
diff
changeset
|
57 ((uint8_t*)&tmp)[2] = ((uint8_t*)mem)[2]; |
7a7060caef14
Yes, and another of those "inline" functions moved to where it belongs.
Tony Vroon <chainsaw@gentoo.org>
parents:
3004
diff
changeset
|
58 case 2: |
7a7060caef14
Yes, and another of those "inline" functions moved to where it belongs.
Tony Vroon <chainsaw@gentoo.org>
parents:
3004
diff
changeset
|
59 ((uint8_t*)&tmp)[1] = ((uint8_t*)mem)[1]; |
7a7060caef14
Yes, and another of those "inline" functions moved to where it belongs.
Tony Vroon <chainsaw@gentoo.org>
parents:
3004
diff
changeset
|
60 case 1: |
7a7060caef14
Yes, and another of those "inline" functions moved to where it belongs.
Tony Vroon <chainsaw@gentoo.org>
parents:
3004
diff
changeset
|
61 ((uint8_t*)&tmp)[0] = ((uint8_t*)mem)[0]; |
7a7060caef14
Yes, and another of those "inline" functions moved to where it belongs.
Tony Vroon <chainsaw@gentoo.org>
parents:
3004
diff
changeset
|
62 default: |
7a7060caef14
Yes, and another of those "inline" functions moved to where it belongs.
Tony Vroon <chainsaw@gentoo.org>
parents:
3004
diff
changeset
|
63 break; |
7a7060caef14
Yes, and another of those "inline" functions moved to where it belongs.
Tony Vroon <chainsaw@gentoo.org>
parents:
3004
diff
changeset
|
64 } |
7a7060caef14
Yes, and another of those "inline" functions moved to where it belongs.
Tony Vroon <chainsaw@gentoo.org>
parents:
3004
diff
changeset
|
65 #endif |
7a7060caef14
Yes, and another of those "inline" functions moved to where it belongs.
Tony Vroon <chainsaw@gentoo.org>
parents:
3004
diff
changeset
|
66 |
7a7060caef14
Yes, and another of those "inline" functions moved to where it belongs.
Tony Vroon <chainsaw@gentoo.org>
parents:
3004
diff
changeset
|
67 return tmp; |
7a7060caef14
Yes, and another of those "inline" functions moved to where it belongs.
Tony Vroon <chainsaw@gentoo.org>
parents:
3004
diff
changeset
|
68 } |
7a7060caef14
Yes, and another of those "inline" functions moved to where it belongs.
Tony Vroon <chainsaw@gentoo.org>
parents:
3004
diff
changeset
|
69 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
70 /* initialize buffer, call once before first getbits or showbits */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
71 void faad_initbits(bitfile *ld, const void *_buffer, const uint32_t buffer_size) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
72 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
73 uint32_t tmp; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
74 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
75 if (ld == NULL) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
76 return; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
77 |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
78 // useless |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
79 //memset(ld, 0, sizeof(bitfile)); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
80 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
81 if (buffer_size == 0 || _buffer == NULL) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
82 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
83 ld->error = 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
84 return; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
85 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
86 |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
87 ld->buffer = _buffer; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
88 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
89 ld->buffer_size = buffer_size; |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
90 ld->bytes_left = buffer_size; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
91 |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
92 if (ld->bytes_left >= 4) |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
93 { |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
94 tmp = getdword((uint32_t*)ld->buffer); |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
95 ld->bytes_left -= 4; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
96 } else { |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
97 tmp = getdword_n((uint32_t*)ld->buffer, ld->bytes_left); |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
98 ld->bytes_left = 0; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
99 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
100 ld->bufa = tmp; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
101 |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
102 if (ld->bytes_left >= 4) |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
103 { |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
104 tmp = getdword((uint32_t*)ld->buffer + 1); |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
105 ld->bytes_left -= 4; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
106 } else { |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
107 tmp = getdword_n((uint32_t*)ld->buffer + 1, ld->bytes_left); |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
108 ld->bytes_left = 0; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
109 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
110 ld->bufb = tmp; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
111 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
112 ld->start = (uint32_t*)ld->buffer; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
113 ld->tail = ((uint32_t*)ld->buffer + 2); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
114 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
115 ld->bits_left = 32; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
116 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
117 ld->error = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
118 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
119 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
120 void faad_endbits(bitfile *ld) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
121 { |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
122 // void |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
123 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
124 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
125 uint32_t faad_get_processed_bits(bitfile *ld) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
126 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
127 return (uint32_t)(8 * (4*(ld->tail - ld->start) - 4) - (ld->bits_left)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
128 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
129 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
130 uint8_t faad_byte_align(bitfile *ld) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
131 { |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
132 int remainder = (32 - ld->bits_left) & 0x7; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
133 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
134 if (remainder) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
135 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
136 faad_flushbits(ld, 8 - remainder); |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
137 return (uint8_t)(8 - remainder); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
138 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
139 return 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
140 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
141 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
142 void faad_flushbits_ex(bitfile *ld, uint32_t bits) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
143 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
144 uint32_t tmp; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
145 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
146 ld->bufa = ld->bufb; |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
147 if (ld->bytes_left >= 4) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
148 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
149 tmp = getdword(ld->tail); |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
150 ld->bytes_left -= 4; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
151 } else { |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
152 tmp = getdword_n(ld->tail, ld->bytes_left); |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
153 ld->bytes_left = 0; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
154 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
155 ld->bufb = tmp; |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
156 ld->tail++; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
157 ld->bits_left += (32 - bits); |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
158 //ld->bytes_left -= 4; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
159 // if (ld->bytes_left == 0) |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
160 // ld->no_more_reading = 1; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
161 // if (ld->bytes_left < 0) |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
162 // ld->error = 1; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
163 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
164 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
165 /* rewind to beginning */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
166 void faad_rewindbits(bitfile *ld) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
167 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
168 uint32_t tmp; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
169 |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
170 ld->bytes_left = ld->buffer_size; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
171 |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
172 if (ld->bytes_left >= 4) |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
173 { |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
174 tmp = getdword((uint32_t*)&ld->start[0]); |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
175 ld->bytes_left -= 4; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
176 } else { |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
177 tmp = getdword_n((uint32_t*)&ld->start[0], ld->bytes_left); |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
178 ld->bytes_left = 0; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
179 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
180 ld->bufa = tmp; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
181 |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
182 if (ld->bytes_left >= 4) |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
183 { |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
184 tmp = getdword((uint32_t*)&ld->start[1]); |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
185 ld->bytes_left -= 4; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
186 } else { |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
187 tmp = getdword_n((uint32_t*)&ld->start[1], ld->bytes_left); |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
188 ld->bytes_left = 0; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
189 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
190 ld->bufb = tmp; |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
191 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
192 ld->bits_left = 32; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
193 ld->tail = &ld->start[2]; |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
194 } |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
195 |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
196 /* reset to a certain point */ |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
197 void faad_resetbits(bitfile *ld, int bits) |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
198 { |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
199 uint32_t tmp; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
200 int words = bits >> 5; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
201 int remainder = bits & 0x1F; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
202 |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
203 ld->bytes_left = ld->buffer_size - words*4; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
204 |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
205 if (ld->bytes_left >= 4) |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
206 { |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
207 tmp = getdword(&ld->start[words]); |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
208 ld->bytes_left -= 4; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
209 } else { |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
210 tmp = getdword_n(&ld->start[words], ld->bytes_left); |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
211 ld->bytes_left = 0; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
212 } |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
213 ld->bufa = tmp; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
214 |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
215 if (ld->bytes_left >= 4) |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
216 { |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
217 tmp = getdword(&ld->start[words+1]); |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
218 ld->bytes_left -= 4; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
219 } else { |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
220 tmp = getdword_n(&ld->start[words+1], ld->bytes_left); |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
221 ld->bytes_left = 0; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
222 } |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
223 ld->bufb = tmp; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
224 |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
225 ld->bits_left = 32 - remainder; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
226 ld->tail = &ld->start[words+2]; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
227 |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
228 /* recheck for reading too many bytes */ |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
229 ld->error = 0; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
230 // if (ld->bytes_left == 0) |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
231 // ld->no_more_reading = 1; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
232 // if (ld->bytes_left < 0) |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
233 // ld->error = 1; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
234 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
235 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
236 uint8_t *faad_getbitbuffer(bitfile *ld, uint32_t bits |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
237 DEBUGDEC) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
238 { |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
239 int i; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
240 unsigned int temp; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
241 int bytes = bits >> 3; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
242 int remainder = bits & 0x7; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
243 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
244 uint8_t *buffer = (uint8_t*)faad_malloc((bytes+1)*sizeof(uint8_t)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
245 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
246 for (i = 0; i < bytes; i++) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
247 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
248 buffer[i] = (uint8_t)faad_getbits(ld, 8 DEBUGVAR(print,var,dbg)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
249 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
250 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
251 if (remainder) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
252 { |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
253 temp = faad_getbits(ld, remainder DEBUGVAR(print,var,dbg)) << (8-remainder); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
254 |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
255 buffer[bytes] = (uint8_t)temp; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
256 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
257 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
258 return buffer; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
259 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
260 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
261 #ifdef DRM |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
262 /* return the original data buffer */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
263 void *faad_origbitbuffer(bitfile *ld) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
264 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
265 return (void*)ld->start; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
266 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
267 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
268 /* return the original data buffer size */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
269 uint32_t faad_origbitbuffer_size(bitfile *ld) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
270 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
271 return ld->buffer_size; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
272 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
273 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
274 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
275 /* reversed bit reading routines, used for RVLC and HCR */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
276 void faad_initbits_rev(bitfile *ld, void *buffer, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
277 uint32_t bits_in_buffer) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
278 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
279 uint32_t tmp; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
280 int32_t index; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
281 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
282 ld->buffer_size = bit2byte(bits_in_buffer); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
283 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
284 index = (bits_in_buffer+31)/32 - 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
285 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
286 ld->start = (uint32_t*)buffer + index - 2; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
287 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
288 tmp = getdword((uint32_t*)buffer + index); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
289 ld->bufa = tmp; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
290 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
291 tmp = getdword((uint32_t*)buffer + index - 1); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
292 ld->bufb = tmp; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
293 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
294 ld->tail = (uint32_t*)buffer + index; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
295 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
296 ld->bits_left = bits_in_buffer % 32; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
297 if (ld->bits_left == 0) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
298 ld->bits_left = 32; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
299 |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
300 ld->bytes_left = ld->buffer_size; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
301 ld->error = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
302 } |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
303 |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
304 /* EOF */ |