f1d6fe277a660f0fd92cfab532d60cecec6d2e76
[openwrt/svn-archive/archive.git] / libs / flac / patches / 001-no_encoder.patch
1 diff -ru flac-1.1.2.OLD/build/lib.mk flac-1.1.2.NEW/build/lib.mk
2 --- flac-1.1.2.OLD/build/lib.mk 2005-01-25 15:10:47.000000000 +1100
3 +++ flac-1.1.2.NEW/build/lib.mk 2005-10-16 10:10:43.000000000 +1000
4 @@ -58,7 +58,7 @@
5
6 debug : CFLAGS = -g -O0 -DDEBUG $(CONFIG_CFLAGS) $(DEBUG_CFLAGS) -Wall -W -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES)
7 valgrind: CFLAGS = -g -O0 -DDEBUG $(CONFIG_CFLAGS) $(DEBUG_CFLAGS) -DFLAC__VALGRIND_TESTING -Wall -W -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES)
8 -release : CFLAGS = -O3 -fomit-frame-pointer -funroll-loops -finline-functions -DNDEBUG $(CONFIG_CFLAGS) $(RELEASE_CFLAGS) -Wall -W -Winline -DFLaC__INLINE=__inline__ -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES)
9 +release : CFLAGS = -fomit-frame-pointer -funroll-loops -finline-functions -DNDEBUG $(CONFIG_CFLAGS) $(RELEASE_CFLAGS) -Wall -W -Winline -DFLaC__INLINE=__inline__ -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES)
10
11 LFLAGS = -L$(LIBPATH)
12
13 diff -ru flac-1.1.2.OLD/src/libFLAC/lpc.c flac-1.1.2.NEW/src/libFLAC/lpc.c
14 --- flac-1.1.2.OLD/src/libFLAC/lpc.c 2005-01-26 15:31:36.000000000 +1100
15 +++ flac-1.1.2.NEW/src/libFLAC/lpc.c 2005-10-16 10:44:58.000000000 +1000
16 @@ -293,6 +293,209 @@
17
18 void FLAC__lpc_restore_signal(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[])
19 {
20 + register const FLAC__int32 *qlp0 = &qlp_coeff[(order-1)];
21 + register FLAC__int32 sum;
22 + register const FLAC__int32 *history, *qlp;
23 +
24 + history = &data[(-order)];
25 +
26 + switch (order) {
27 + case 12:
28 + for( ; data_len != 0; --data_len) {
29 + sum = (qlp0[0] * history[0])
30 + + (qlp0[-1] * history[1])
31 + + (qlp0[-2] * history[2])
32 + + (qlp0[-3] * history[3])
33 + + (qlp0[-4] * history[4])
34 + + (qlp0[-5] * history[5])
35 + + (qlp0[-6] * history[6])
36 + + (qlp0[-7] * history[7])
37 + + (qlp0[-8] * history[8])
38 + + (qlp0[-9] * history[9])
39 + + (qlp0[-10] * history[10])
40 + + (qlp0[-11] * history[11])
41 + ;
42 + ++history;
43 + *(data++) = *(residual++) + (sum >> lp_quantization);
44 + }
45 + return;
46 + case 11:
47 + for( ; data_len != 0; --data_len) {
48 + sum = (qlp0[0] * history[0])
49 + + (qlp0[-1] * history[1])
50 + + (qlp0[-2] * history[2])
51 + + (qlp0[-3] * history[3])
52 + + (qlp0[-4] * history[4])
53 + + (qlp0[-5] * history[5])
54 + + (qlp0[-6] * history[6])
55 + + (qlp0[-7] * history[7])
56 + + (qlp0[-8] * history[8])
57 + + (qlp0[-9] * history[9])
58 + + (qlp0[-10] * history[10])
59 + ;
60 + ++history;
61 + *(data++) = *(residual++) + (sum >> lp_quantization);
62 + }
63 + return;
64 + case 10:
65 + for( ; data_len != 0; --data_len) {
66 + sum = (qlp0[0] * history[0])
67 + + (qlp0[-1] * history[1])
68 + + (qlp0[-2] * history[2])
69 + + (qlp0[-3] * history[3])
70 + + (qlp0[-4] * history[4])
71 + + (qlp0[-5] * history[5])
72 + + (qlp0[-6] * history[6])
73 + + (qlp0[-7] * history[7])
74 + + (qlp0[-8] * history[8])
75 + + (qlp0[-9] * history[9])
76 + ;
77 + ++history;
78 + *(data++) = *(residual++) + (sum >> lp_quantization);
79 + }
80 + return;
81 + case 9:
82 + for( ; data_len != 0; --data_len) {
83 + sum = (qlp0[0] * history[0])
84 + + (qlp0[-1] * history[1])
85 + + (qlp0[-2] * history[2])
86 + + (qlp0[-3] * history[3])
87 + + (qlp0[-4] * history[4])
88 + + (qlp0[-5] * history[5])
89 + + (qlp0[-6] * history[6])
90 + + (qlp0[-7] * history[7])
91 + + (qlp0[-8] * history[8])
92 + ;
93 + ++history;
94 + *(data++) = *(residual++) + (sum >> lp_quantization);
95 + }
96 + return;
97 + case 8:
98 + for( ; data_len != 0; --data_len) {
99 + sum = (qlp0[0] * history[0])
100 + + (qlp0[-1] * history[1])
101 + + (qlp0[-2] * history[2])
102 + + (qlp0[-3] * history[3])
103 + + (qlp0[-4] * history[4])
104 + + (qlp0[-5] * history[5])
105 + + (qlp0[-6] * history[6])
106 + + (qlp0[-7] * history[7])
107 + ;
108 + ++history;
109 + *(data++) = *(residual++) + (sum >> lp_quantization);
110 + }
111 + return;
112 + case 7:
113 + for( ; data_len != 0; --data_len) {
114 + sum = (qlp0[0] * history[0])
115 + + (qlp0[-1] * history[1])
116 + + (qlp0[-2] * history[2])
117 + + (qlp0[-3] * history[3])
118 + + (qlp0[-4] * history[4])
119 + + (qlp0[-5] * history[5])
120 + + (qlp0[-6] * history[6])
121 + ;
122 + ++history;
123 + *(data++) = *(residual++) + (sum >> lp_quantization);
124 + }
125 + return;
126 + case 6:
127 + for( ; data_len != 0; --data_len) {
128 + sum = (qlp0[0] * history[0])
129 + + (qlp0[-1] * history[1])
130 + + (qlp0[-2] * history[2])
131 + + (qlp0[-3] * history[3])
132 + + (qlp0[-4] * history[4])
133 + + (qlp0[-5] * history[5])
134 + ;
135 + ++history;
136 + *(data++) = *(residual++) + (sum >> lp_quantization);
137 + }
138 + return;
139 + case 5:
140 + for( ; data_len != 0; --data_len) {
141 + sum = (qlp0[0] * history[0])
142 + + (qlp0[-1] * history[1])
143 + + (qlp0[-2] * history[2])
144 + + (qlp0[-3] * history[3])
145 + + (qlp0[-4] * history[4])
146 + ;
147 + ++history;
148 + *(data++) = *(residual++) + (sum >> lp_quantization);
149 + }
150 + return;
151 + case 4:
152 + for( ; data_len != 0; --data_len) {
153 + sum = (qlp0[0] * history[0])
154 + + (qlp0[-1] * history[1])
155 + + (qlp0[-2] * history[2])
156 + + (qlp0[-3] * history[3])
157 + ;
158 + ++history;
159 + *(data++) = *(residual++) + (sum >> lp_quantization);
160 + }
161 + return;
162 + case 3:
163 + for( ; data_len != 0; --data_len) {
164 + sum = (qlp0[0] * history[0])
165 + + (qlp0[-1] * history[1])
166 + + (qlp0[-2] * history[2])
167 + ;
168 + ++history;
169 + *(data++) = *(residual++) + (sum >> lp_quantization);
170 + }
171 + return;
172 + case 2:
173 + for( ; data_len != 0; --data_len) {
174 + sum = (qlp0[0] * history[0])
175 + + (qlp0[-1] * history[1])
176 + ;
177 + ++history;
178 + *(data++) = *(residual++) + (sum >> lp_quantization);
179 + }
180 + return;
181 + case 1:
182 + for( ; data_len != 0; --data_len) {
183 + sum = (qlp0[0] * (*(history++)));
184 + *(data++) = *(residual++) + (sum >> lp_quantization);
185 + }
186 + return;
187 + default:
188 + {
189 + /* handle everything else: (order > 12)
190 + * with Duff's Device to reduce jumps */
191 + const unsigned n0 = (order + 7)/8;
192 + const int tmp = 0 - order - 1;
193 + register const FLAC__int32 *qlpd = &qlp_coeff[order];
194 + for( ; data_len != 0; --data_len) {
195 + register unsigned n = n0;
196 + sum = 0;
197 + qlp = qlpd;
198 + history = &data[tmp];
199 +
200 + switch(order%8) {
201 + case 0: do {
202 + sum += (*(--qlp)) * (*(++history));
203 + case 7: sum += (*(--qlp)) * (*(++history));
204 + case 6: sum += (*(--qlp)) * (*(++history));
205 + case 5: sum += (*(--qlp)) * (*(++history));
206 + case 4: sum += (*(--qlp)) * (*(++history));
207 + case 3: sum += (*(--qlp)) * (*(++history));
208 + case 2: sum += (*(--qlp)) * (*(++history));
209 + case 1: sum += (*(--qlp)) * (*(++history));
210 + } while (--n);
211 + }
212 +
213 + *(data++) = *(residual++) + (sum >> lp_quantization);
214 + }
215 + return;
216 + }
217 + }
218 +}
219 +
220 +#if 0
221 +void FLAC__lpc_restore_signal_orig(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[])
222 +{
223 #ifdef FLAC__OVERFLOW_DETECT
224 FLAC__int64 sumo;
225 #endif
226 @@ -339,6 +542,7 @@
227 }
228 */
229 }
230 +#endif /* 0 */
231
232 void FLAC__lpc_restore_signal_wide(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[])
233 {
234 diff -ru flac-1.1.2.OLD/src/libFLAC/Makefile.lite flac-1.1.2.NEW/src/libFLAC/Makefile.lite
235 --- flac-1.1.2.OLD/src/libFLAC/Makefile.lite 2005-01-27 11:08:35.000000000 +1100
236 +++ flac-1.1.2.NEW/src/libFLAC/Makefile.lite 2005-10-16 10:13:29.000000000 +1000
237 @@ -41,7 +41,7 @@
238 ifeq ($(SOLARIS_BUILD),yes)
239 DEFINES = -DFLAC__NO_ASM -DFLAC__ALIGN_MALLOC_DATA
240 else
241 -DEFINES = -DFLAC__CPU_IA32 -DFLAC__USE_3DNOW -DFLAC__HAS_NASM -DFLAC__ALIGN_MALLOC_DATA
242 +DEFINES = -DFLAC__CPU_UNKNOWN -DFLAC__NO_ASM -DFLAC__ALIGN_MALLOC_DATA -DFLAC__INTEGER_ONLY_LIBRARY
243 endif
244 endif
245 INCLUDES = -I./include -I$(topdir)/include
246 @@ -50,14 +50,6 @@
247 ifeq ($(DARWIN_BUILD),yes)
248 SRCS_S = \
249 ppc/as/lpc_asm.s
250 -else
251 -ifeq ($(SOLARIS_BUILD),yes)
252 -else
253 -SRCS_NASM = \
254 - ia32/cpu_asm.nasm \
255 - ia32/fixed_asm.nasm \
256 - ia32/lpc_asm.nasm
257 -endif
258 endif
259
260 SRCS_C = \
261 @@ -66,7 +58,6 @@
262 cpu.c \
263 crc.c \
264 file_decoder.c \
265 - file_encoder.c \
266 fixed.c \
267 float.c \
268 format.c \
269 @@ -76,10 +67,7 @@
270 metadata_iterators.c \
271 metadata_object.c \
272 seekable_stream_decoder.c \
273 - seekable_stream_encoder.c \
274 - stream_decoder.c \
275 - stream_encoder.c \
276 - stream_encoder_framing.c
277 + stream_decoder.c
278
279 include $(topdir)/build/lib.mk
280