Merge lp:~logan/ubuntu/quantal/alac-decoder/new-upstream into lp:ubuntu/quantal/alac-decoder
- Quantal (12.10)
- new-upstream
- Merge into quantal
Proposed by
Logan Rosen
Status: | Merged |
---|---|
Merged at revision: | 5 |
Proposed branch: | lp:~logan/ubuntu/quantal/alac-decoder/new-upstream |
Merge into: | lp:ubuntu/quantal/alac-decoder |
Diff against target: |
1357 lines (+833/-200) 14 files modified
alac.c (+298/-187) alac.xcodeproj/project.pbxproj (+223/-0) alac_decoder.sln (+20/-0) alac_decoder.vcproj (+229/-0) debian/changelog (+9/-0) debian/control (+2/-2) debian/rules (+3/-1) demux.c (+5/-1) demux.h (+6/-1) main.c (+9/-5) stdint_win.h (+14/-0) stream.c (+5/-1) stream.h (+5/-1) wavwriter.c (+5/-1) |
To merge this branch: | bzr merge lp:~logan/ubuntu/quantal/alac-decoder/new-upstream |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Daniel Holbach (community) | Approve | ||
Ubuntu branches | Pending | ||
Review via email:
|
Commit message
Description of the change
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'alac.c' |
2 | --- alac.c 2006-11-25 20:58:34 +0000 |
3 | +++ alac.c 2012-06-21 13:30:26 +0000 |
4 | @@ -33,7 +33,11 @@ |
5 | #include <stdio.h> |
6 | #include <stdlib.h> |
7 | #include <string.h> |
8 | -#include <stdint.h> |
9 | +#ifdef _WIN32 |
10 | + #include "stdint_win.h" |
11 | +#else |
12 | + #include <stdint.h> |
13 | +#endif |
14 | |
15 | #include "decomp.h" |
16 | |
17 | @@ -47,6 +51,8 @@ |
18 | v = (((v) & 0x00FF) << 0x08) | \ |
19 | (((v) & 0xFF00) >> 0x08); } while (0) |
20 | |
21 | +struct {signed int x:24;} se_struct_24; |
22 | +#define SignExtend24(val) (se_struct_24.x = val) |
23 | |
24 | extern int host_bigendian; |
25 | |
26 | @@ -67,6 +73,10 @@ |
27 | |
28 | int32_t *outputsamples_buffer_a; |
29 | int32_t *outputsamples_buffer_b; |
30 | + |
31 | + int32_t *uncompressed_bytes_buffer_a; |
32 | + int32_t *uncompressed_bytes_buffer_b; |
33 | + |
34 | |
35 | |
36 | /* stuff from setinfo */ |
37 | @@ -93,6 +103,9 @@ |
38 | |
39 | alac->outputsamples_buffer_a = malloc(alac->setinfo_max_samples_per_frame * 4); |
40 | alac->outputsamples_buffer_b = malloc(alac->setinfo_max_samples_per_frame * 4); |
41 | + |
42 | + alac->uncompressed_bytes_buffer_a = malloc(alac->setinfo_max_samples_per_frame * 4); |
43 | + alac->uncompressed_bytes_buffer_b = malloc(alac->setinfo_max_samples_per_frame * 4); |
44 | } |
45 | |
46 | void alac_set_info(alac_file *alac, char *inputbuffer) |
47 | @@ -254,7 +267,7 @@ |
48 | { |
49 | int output = 0; |
50 | if (!input) return 32; |
51 | - asm("bsr %1, %0\n" |
52 | + __asm("bsr %1, %0\n" |
53 | : "=r" (output) |
54 | : "r" (input)); |
55 | return (0x1f - output); |
56 | @@ -321,137 +334,120 @@ |
57 | } |
58 | #endif |
59 | |
60 | -void basterdised_rice_decompress(alac_file *alac, |
61 | - int32_t *output_buffer, |
62 | - int output_size, |
63 | - int readsamplesize, /* arg_10 */ |
64 | - int rice_initialhistory, /* arg424->b */ |
65 | - int rice_kmodifier, /* arg424->d */ |
66 | - int rice_historymult, /* arg424->c */ |
67 | - int rice_kmodifier_mask /* arg424->e */ |
68 | - ) |
69 | -{ |
70 | - int output_count; |
71 | - unsigned int history = rice_initialhistory; |
72 | - int sign_modifier = 0; |
73 | - |
74 | - for (output_count = 0; output_count < output_size; output_count++) |
75 | - { |
76 | - int32_t x = 0; |
77 | - int32_t x_modified; |
78 | - int32_t final_val; |
79 | - |
80 | - /* read x - number of 1s before 0 represent the rice */ |
81 | - while (x <= 8 && readbit(alac)) |
82 | - { |
83 | - x++; |
84 | - } |
85 | - |
86 | - |
87 | - if (x > 8) /* RICE THRESHOLD */ |
88 | - { /* use alternative encoding */ |
89 | - int32_t value; |
90 | - |
91 | - value = readbits(alac, readsamplesize); |
92 | - |
93 | - /* mask value to readsamplesize size */ |
94 | - if (readsamplesize != 32) |
95 | - value &= (0xffffffff >> (32 - readsamplesize)); |
96 | - |
97 | - x = value; |
98 | - } |
99 | - else |
100 | - { /* standard rice encoding */ |
101 | - int extrabits; |
102 | - int k; /* size of extra bits */ |
103 | - |
104 | - /* read k, that is bits as is */ |
105 | - k = 31 - rice_kmodifier - count_leading_zeros((history >> 9) + 3); |
106 | - |
107 | - if (k < 0) k += rice_kmodifier; |
108 | - else k = rice_kmodifier; |
109 | - |
110 | - if (k != 1) |
111 | - { |
112 | - extrabits = readbits(alac, k); |
113 | - |
114 | - /* multiply x by 2^k - 1, as part of their strange algorithm */ |
115 | - x = (x << k) - x; |
116 | - |
117 | - if (extrabits > 1) |
118 | - { |
119 | - x += extrabits - 1; |
120 | - } |
121 | - else unreadbits(alac, 1); |
122 | - } |
123 | - } |
124 | - |
125 | - x_modified = sign_modifier + x; |
126 | - final_val = (x_modified + 1) / 2; |
127 | - if (x_modified & 1) final_val *= -1; |
128 | - |
129 | - output_buffer[output_count] = final_val; |
130 | - |
131 | - sign_modifier = 0; |
132 | - |
133 | - /* now update the history */ |
134 | - history += (x_modified * rice_historymult) |
135 | - - ((history * rice_historymult) >> 9); |
136 | - |
137 | - if (x_modified > 0xffff) |
138 | - history = 0xffff; |
139 | - |
140 | - /* special case: there may be compressed blocks of 0 */ |
141 | - if ((history < 128) && (output_count+1 < output_size)) |
142 | - { |
143 | - int block_size; |
144 | - |
145 | - sign_modifier = 1; |
146 | - |
147 | - x = 0; |
148 | - while (x <= 8 && readbit(alac)) |
149 | - { |
150 | - x++; |
151 | - } |
152 | - |
153 | - if (x > 8) |
154 | - { |
155 | - block_size = readbits(alac, 16); |
156 | - block_size &= 0xffff; |
157 | - } |
158 | - else |
159 | - { |
160 | - int k; |
161 | - int extrabits; |
162 | - |
163 | - k = count_leading_zeros(history) + ((history + 16) >> 6 /* / 64 */) - 24; |
164 | - |
165 | - extrabits = readbits(alac, k); |
166 | - |
167 | - block_size = (((1 << k) - 1) & rice_kmodifier_mask) * x |
168 | - + extrabits - 1; |
169 | - |
170 | - if (extrabits < 2) |
171 | - { |
172 | - x = 1 - extrabits; |
173 | - block_size += x; |
174 | - unreadbits(alac, 1); |
175 | - } |
176 | - } |
177 | - |
178 | - if (block_size > 0) |
179 | - { |
180 | - memset(&output_buffer[output_count+1], 0, block_size * 4); |
181 | - output_count += block_size; |
182 | - |
183 | - } |
184 | - |
185 | - if (block_size > 0xffff) |
186 | - sign_modifier = 0; |
187 | - |
188 | - history = 0; |
189 | - } |
190 | - } |
191 | +#define RICE_THRESHOLD 8 // maximum number of bits for a rice prefix. |
192 | + |
193 | +int32_t entropy_decode_value(alac_file* alac, |
194 | + int readSampleSize, |
195 | + int k, |
196 | + int rice_kmodifier_mask) |
197 | +{ |
198 | + int32_t x = 0; // decoded value |
199 | + |
200 | + // read x, number of 1s before 0 represent the rice value. |
201 | + while (x <= RICE_THRESHOLD && readbit(alac)) |
202 | + { |
203 | + x++; |
204 | + } |
205 | + |
206 | + if (x > RICE_THRESHOLD) |
207 | + { |
208 | + // read the number from the bit stream (raw value) |
209 | + int32_t value; |
210 | + |
211 | + value = readbits(alac, readSampleSize); |
212 | + |
213 | + // mask value |
214 | + value &= (((uint32_t)0xffffffff) >> (32 - readSampleSize)); |
215 | + |
216 | + x = value; |
217 | + } |
218 | + else |
219 | + { |
220 | + if (k != 1) |
221 | + { |
222 | + int extraBits = readbits(alac, k); |
223 | + |
224 | + // x = x * (2^k - 1) |
225 | + x *= (((1 << k) - 1) & rice_kmodifier_mask); |
226 | + |
227 | + if (extraBits > 1) |
228 | + x += extraBits - 1; |
229 | + else |
230 | + unreadbits(alac, 1); |
231 | + } |
232 | + } |
233 | + |
234 | + return x; |
235 | +} |
236 | + |
237 | +void entropy_rice_decode(alac_file* alac, |
238 | + int32_t* outputBuffer, |
239 | + int outputSize, |
240 | + int readSampleSize, |
241 | + int rice_initialhistory, |
242 | + int rice_kmodifier, |
243 | + int rice_historymult, |
244 | + int rice_kmodifier_mask) |
245 | +{ |
246 | + int outputCount; |
247 | + int history = rice_initialhistory; |
248 | + int signModifier = 0; |
249 | + |
250 | + for (outputCount = 0; outputCount < outputSize; outputCount++) |
251 | + { |
252 | + int32_t decodedValue; |
253 | + int32_t finalValue; |
254 | + int32_t k; |
255 | + |
256 | + k = 31 - rice_kmodifier - count_leading_zeros((history >> 9) + 3); |
257 | + |
258 | + if (k < 0) k += rice_kmodifier; |
259 | + else k = rice_kmodifier; |
260 | + |
261 | + // note: don't use rice_kmodifier_mask here (set mask to 0xFFFFFFFF) |
262 | + decodedValue = entropy_decode_value(alac, readSampleSize, k, 0xFFFFFFFF); |
263 | + |
264 | + decodedValue += signModifier; |
265 | + finalValue = (decodedValue + 1) / 2; // inc by 1 and shift out sign bit |
266 | + if (decodedValue & 1) // the sign is stored in the low bit |
267 | + finalValue *= -1; |
268 | + |
269 | + outputBuffer[outputCount] = finalValue; |
270 | + |
271 | + signModifier = 0; |
272 | + |
273 | + // update history |
274 | + history += (decodedValue * rice_historymult) |
275 | + - ((history * rice_historymult) >> 9); |
276 | + |
277 | + if (decodedValue > 0xFFFF) |
278 | + history = 0xFFFF; |
279 | + |
280 | + // special case, for compressed blocks of 0 |
281 | + if ((history < 128) && (outputCount + 1 < outputSize)) |
282 | + { |
283 | + int32_t blockSize; |
284 | + |
285 | + signModifier = 1; |
286 | + |
287 | + k = count_leading_zeros(history) + ((history + 16) / 64) - 24; |
288 | + |
289 | + // note: blockSize is always 16bit |
290 | + blockSize = entropy_decode_value(alac, 16, k, rice_kmodifier_mask); |
291 | + |
292 | + // got blockSize 0s |
293 | + if (blockSize > 0) |
294 | + { |
295 | + memset(&outputBuffer[outputCount + 1], 0, blockSize * sizeof(*outputBuffer)); |
296 | + outputCount += blockSize; |
297 | + } |
298 | + |
299 | + if (blockSize > 0xFFFF) |
300 | + signModifier = 0; |
301 | + |
302 | + history = 0; |
303 | + } |
304 | + } |
305 | } |
306 | |
307 | #define SIGN_EXTENDED32(val, bits) ((val << (32 - bits)) >> (32 - bits)) |
308 | @@ -660,6 +656,84 @@ |
309 | } |
310 | } |
311 | |
312 | +void deinterlace_24(int32_t *buffer_a, int32_t *buffer_b, |
313 | + int uncompressed_bytes, |
314 | + int32_t *uncompressed_bytes_buffer_a, int32_t *uncompressed_bytes_buffer_b, |
315 | + void *buffer_out, |
316 | + int numchannels, int numsamples, |
317 | + uint8_t interlacing_shift, |
318 | + uint8_t interlacing_leftweight) |
319 | +{ |
320 | + int i; |
321 | + if (numsamples <= 0) return; |
322 | + |
323 | + /* weighted interlacing */ |
324 | + if (interlacing_leftweight) |
325 | + { |
326 | + for (i = 0; i < numsamples; i++) |
327 | + { |
328 | + int32_t difference, midright; |
329 | + int32_t left; |
330 | + int32_t right; |
331 | + |
332 | + midright = buffer_a[i]; |
333 | + difference = buffer_b[i]; |
334 | + |
335 | + right = midright - ((difference * interlacing_leftweight) >> interlacing_shift); |
336 | + left = right + difference; |
337 | + |
338 | + if (uncompressed_bytes) |
339 | + { |
340 | + uint32_t mask = ~(0xFFFFFFFF << (uncompressed_bytes * 8)); |
341 | + left <<= (uncompressed_bytes * 8); |
342 | + right <<= (uncompressed_bytes * 8); |
343 | + |
344 | + left |= uncompressed_bytes_buffer_a[i] & mask; |
345 | + right |= uncompressed_bytes_buffer_b[i] & mask; |
346 | + } |
347 | + |
348 | + ((uint8_t*)buffer_out)[i * numchannels * 3] = (left) & 0xFF; |
349 | + ((uint8_t*)buffer_out)[i * numchannels * 3 + 1] = (left >> 8) & 0xFF; |
350 | + ((uint8_t*)buffer_out)[i * numchannels * 3 + 2] = (left >> 16) & 0xFF; |
351 | + |
352 | + ((uint8_t*)buffer_out)[i * numchannels * 3 + 3] = (right) & 0xFF; |
353 | + ((uint8_t*)buffer_out)[i * numchannels * 3 + 4] = (right >> 8) & 0xFF; |
354 | + ((uint8_t*)buffer_out)[i * numchannels * 3 + 5] = (right >> 16) & 0xFF; |
355 | + } |
356 | + |
357 | + return; |
358 | + } |
359 | + |
360 | + /* otherwise basic interlacing took place */ |
361 | + for (i = 0; i < numsamples; i++) |
362 | + { |
363 | + int32_t left, right; |
364 | + |
365 | + left = buffer_a[i]; |
366 | + right = buffer_b[i]; |
367 | + |
368 | + if (uncompressed_bytes) |
369 | + { |
370 | + uint32_t mask = ~(0xFFFFFFFF << (uncompressed_bytes * 8)); |
371 | + left <<= (uncompressed_bytes * 8); |
372 | + right <<= (uncompressed_bytes * 8); |
373 | + |
374 | + left |= uncompressed_bytes_buffer_a[i] & mask; |
375 | + right |= uncompressed_bytes_buffer_b[i] & mask; |
376 | + } |
377 | + |
378 | + ((uint8_t*)buffer_out)[i * numchannels * 3] = (left) & 0xFF; |
379 | + ((uint8_t*)buffer_out)[i * numchannels * 3 + 1] = (left >> 8) & 0xFF; |
380 | + ((uint8_t*)buffer_out)[i * numchannels * 3 + 2] = (left >> 16) & 0xFF; |
381 | + |
382 | + ((uint8_t*)buffer_out)[i * numchannels * 3 + 3] = (right) & 0xFF; |
383 | + ((uint8_t*)buffer_out)[i * numchannels * 3 + 4] = (right >> 8) & 0xFF; |
384 | + ((uint8_t*)buffer_out)[i * numchannels * 3 + 5] = (right >> 16) & 0xFF; |
385 | + |
386 | + } |
387 | + |
388 | +} |
389 | + |
390 | void decode_frame(alac_file *alac, |
391 | unsigned char *inbuffer, |
392 | void *outbuffer, int *outputsize) |
393 | @@ -683,10 +757,9 @@ |
394 | int isnotcompressed; |
395 | int readsamplesize; |
396 | |
397 | - int wasted_bytes; |
398 | + int uncompressed_bytes; |
399 | int ricemodifier; |
400 | |
401 | - |
402 | /* 2^result = something to do with output waiting. |
403 | * perhaps matters if we read > 1 frame in a pass? |
404 | */ |
405 | @@ -696,7 +769,7 @@ |
406 | |
407 | hassize = readbits(alac, 1); /* the output sample size is stored soon */ |
408 | |
409 | - wasted_bytes = readbits(alac, 2); /* unknown ? */ |
410 | + uncompressed_bytes = readbits(alac, 2); /* number of bytes in the (compressed) stream that are not compressed */ |
411 | |
412 | isnotcompressed = readbits(alac, 1); /* whether the frame is compressed */ |
413 | |
414 | @@ -708,7 +781,7 @@ |
415 | *outputsize = outputsamples * alac->bytespersample; |
416 | } |
417 | |
418 | - readsamplesize = alac->setinfo_sample_size - (wasted_bytes * 8); |
419 | + readsamplesize = alac->setinfo_sample_size - (uncompressed_bytes * 8); |
420 | |
421 | if (!isnotcompressed) |
422 | { /* so it is compressed */ |
423 | @@ -735,22 +808,23 @@ |
424 | predictor_coef_table[i] = (int16_t)readbits(alac, 16); |
425 | } |
426 | |
427 | - if (wasted_bytes) |
428 | + if (uncompressed_bytes) |
429 | { |
430 | - /* these bytes seem to have something to do with |
431 | - * > 2 channel files. |
432 | - */ |
433 | - fprintf(stderr, "FIXME: unimplemented, unhandling of wasted_bytes\n"); |
434 | + int i; |
435 | + for (i = 0; i < outputsamples; i++) |
436 | + { |
437 | + alac->uncompressed_bytes_buffer_a[i] = readbits(alac, uncompressed_bytes * 8); |
438 | + } |
439 | } |
440 | |
441 | - basterdised_rice_decompress(alac, |
442 | - alac->predicterror_buffer_a, |
443 | - outputsamples, |
444 | - readsamplesize, |
445 | - alac->setinfo_rice_initialhistory, |
446 | - alac->setinfo_rice_kmodifier, |
447 | - ricemodifier * alac->setinfo_rice_historymult / 4, |
448 | - (1 << alac->setinfo_rice_kmodifier) - 1); |
449 | + entropy_rice_decode(alac, |
450 | + alac->predicterror_buffer_a, |
451 | + outputsamples, |
452 | + readsamplesize, |
453 | + alac->setinfo_rice_initialhistory, |
454 | + alac->setinfo_rice_kmodifier, |
455 | + ricemodifier * alac->setinfo_rice_historymult / 4, |
456 | + (1 << alac->setinfo_rice_kmodifier) - 1); |
457 | |
458 | if (prediction_type == 0) |
459 | { /* adaptive fir */ |
460 | @@ -776,14 +850,14 @@ |
461 | } |
462 | else |
463 | { /* not compressed, easy case */ |
464 | - if (readsamplesize <= 16) |
465 | + if (alac->setinfo_sample_size <= 16) |
466 | { |
467 | int i; |
468 | for (i = 0; i < outputsamples; i++) |
469 | { |
470 | - int32_t audiobits = readbits(alac, readsamplesize); |
471 | + int32_t audiobits = readbits(alac, alac->setinfo_sample_size); |
472 | |
473 | - audiobits = SIGN_EXTENDED32(audiobits, readsamplesize); |
474 | + audiobits = SIGN_EXTENDED32(audiobits, alac->setinfo_sample_size); |
475 | |
476 | alac->outputsamples_buffer_a[i] = audiobits; |
477 | } |
478 | @@ -798,15 +872,14 @@ |
479 | audiobits = readbits(alac, 16); |
480 | /* special case of sign extension.. |
481 | * as we'll be ORing the low 16bits into this */ |
482 | - audiobits = audiobits << 16; |
483 | - audiobits = audiobits >> (32 - readsamplesize); |
484 | - |
485 | - audiobits |= readbits(alac, readsamplesize - 16); |
486 | + audiobits = audiobits << (alac->setinfo_sample_size - 16); |
487 | + audiobits |= readbits(alac, alac->setinfo_sample_size - 16); |
488 | + audiobits = SignExtend24(audiobits); |
489 | |
490 | alac->outputsamples_buffer_a[i] = audiobits; |
491 | } |
492 | } |
493 | - /* wasted_bytes = 0; // unused */ |
494 | + uncompressed_bytes = 0; // always 0 for uncompressed |
495 | } |
496 | |
497 | switch(alac->setinfo_sample_size) |
498 | @@ -823,8 +896,28 @@ |
499 | } |
500 | break; |
501 | } |
502 | + case 24: |
503 | + { |
504 | + int i; |
505 | + for (i = 0; i < outputsamples; i++) |
506 | + { |
507 | + int32_t sample = alac->outputsamples_buffer_a[i]; |
508 | + |
509 | + if (uncompressed_bytes) |
510 | + { |
511 | + uint32_t mask; |
512 | + sample = sample << (uncompressed_bytes * 8); |
513 | + mask = ~(0xFFFFFFFF << (uncompressed_bytes * 8)); |
514 | + sample |= alac->uncompressed_bytes_buffer_a[i] & mask; |
515 | + } |
516 | + |
517 | + ((uint8_t*)outbuffer)[i * alac->numchannels * 3] = (sample) & 0xFF; |
518 | + ((uint8_t*)outbuffer)[i * alac->numchannels * 3 + 1] = (sample >> 8) & 0xFF; |
519 | + ((uint8_t*)outbuffer)[i * alac->numchannels * 3 + 2] = (sample >> 16) & 0xFF; |
520 | + } |
521 | + break; |
522 | + } |
523 | case 20: |
524 | - case 24: |
525 | case 32: |
526 | fprintf(stderr, "FIXME: unimplemented sample size %i\n", alac->setinfo_sample_size); |
527 | break; |
528 | @@ -839,7 +932,7 @@ |
529 | int isnotcompressed; |
530 | int readsamplesize; |
531 | |
532 | - int wasted_bytes; |
533 | + int uncompressed_bytes; |
534 | |
535 | uint8_t interlacing_shift; |
536 | uint8_t interlacing_leftweight; |
537 | @@ -853,7 +946,7 @@ |
538 | |
539 | hassize = readbits(alac, 1); /* the output sample size is stored soon */ |
540 | |
541 | - wasted_bytes = readbits(alac, 2); /* unknown ? */ |
542 | + uncompressed_bytes = readbits(alac, 2); /* the number of bytes in the (compressed) stream that are not compressed */ |
543 | |
544 | isnotcompressed = readbits(alac, 1); /* whether the frame is compressed */ |
545 | |
546 | @@ -865,7 +958,7 @@ |
547 | *outputsize = outputsamples * alac->bytespersample; |
548 | } |
549 | |
550 | - readsamplesize = alac->setinfo_sample_size - (wasted_bytes * 8) + 1; |
551 | + readsamplesize = alac->setinfo_sample_size - (uncompressed_bytes * 8) + 1; |
552 | |
553 | if (!isnotcompressed) |
554 | { /* compressed */ |
555 | @@ -913,20 +1006,25 @@ |
556 | } |
557 | |
558 | /*********************/ |
559 | - if (wasted_bytes) |
560 | + if (uncompressed_bytes) |
561 | { /* see mono case */ |
562 | - fprintf(stderr, "FIXME: unimplemented, unhandling of wasted_bytes\n"); |
563 | + int i; |
564 | + for (i = 0; i < outputsamples; i++) |
565 | + { |
566 | + alac->uncompressed_bytes_buffer_a[i] = readbits(alac, uncompressed_bytes * 8); |
567 | + alac->uncompressed_bytes_buffer_b[i] = readbits(alac, uncompressed_bytes * 8); |
568 | + } |
569 | } |
570 | |
571 | /* channel 1 */ |
572 | - basterdised_rice_decompress(alac, |
573 | - alac->predicterror_buffer_a, |
574 | - outputsamples, |
575 | - readsamplesize, |
576 | - alac->setinfo_rice_initialhistory, |
577 | - alac->setinfo_rice_kmodifier, |
578 | - ricemodifier_a * alac->setinfo_rice_historymult / 4, |
579 | - (1 << alac->setinfo_rice_kmodifier) - 1); |
580 | + entropy_rice_decode(alac, |
581 | + alac->predicterror_buffer_a, |
582 | + outputsamples, |
583 | + readsamplesize, |
584 | + alac->setinfo_rice_initialhistory, |
585 | + alac->setinfo_rice_kmodifier, |
586 | + ricemodifier_a * alac->setinfo_rice_historymult / 4, |
587 | + (1 << alac->setinfo_rice_kmodifier) - 1); |
588 | |
589 | if (prediction_type_a == 0) |
590 | { /* adaptive fir */ |
591 | @@ -944,14 +1042,14 @@ |
592 | } |
593 | |
594 | /* channel 2 */ |
595 | - basterdised_rice_decompress(alac, |
596 | - alac->predicterror_buffer_b, |
597 | - outputsamples, |
598 | - readsamplesize, |
599 | - alac->setinfo_rice_initialhistory, |
600 | - alac->setinfo_rice_kmodifier, |
601 | - ricemodifier_b * alac->setinfo_rice_historymult / 4, |
602 | - (1 << alac->setinfo_rice_kmodifier) - 1); |
603 | + entropy_rice_decode(alac, |
604 | + alac->predicterror_buffer_b, |
605 | + outputsamples, |
606 | + readsamplesize, |
607 | + alac->setinfo_rice_initialhistory, |
608 | + alac->setinfo_rice_kmodifier, |
609 | + ricemodifier_b * alac->setinfo_rice_historymult / 4, |
610 | + (1 << alac->setinfo_rice_kmodifier) - 1); |
611 | |
612 | if (prediction_type_b == 0) |
613 | { /* adaptive fir */ |
614 | @@ -995,20 +1093,20 @@ |
615 | int32_t audiobits_a, audiobits_b; |
616 | |
617 | audiobits_a = readbits(alac, 16); |
618 | - audiobits_a = audiobits_a << 16; |
619 | - audiobits_a = audiobits_a >> (32 - alac->setinfo_sample_size); |
620 | + audiobits_a = audiobits_a << (alac->setinfo_sample_size - 16); |
621 | audiobits_a |= readbits(alac, alac->setinfo_sample_size - 16); |
622 | + audiobits_a = SignExtend24(audiobits_a); |
623 | |
624 | audiobits_b = readbits(alac, 16); |
625 | - audiobits_b = audiobits_b << 16; |
626 | - audiobits_b = audiobits_b >> (32 - alac->setinfo_sample_size); |
627 | + audiobits_b = audiobits_b << (alac->setinfo_sample_size - 16); |
628 | audiobits_b |= readbits(alac, alac->setinfo_sample_size - 16); |
629 | - |
630 | + audiobits_b = SignExtend24(audiobits_b); |
631 | + |
632 | alac->outputsamples_buffer_a[i] = audiobits_a; |
633 | alac->outputsamples_buffer_b[i] = audiobits_b; |
634 | } |
635 | } |
636 | - /* wasted_bytes = 0; */ |
637 | + uncompressed_bytes = 0; // always 0 for uncompressed |
638 | interlacing_shift = 0; |
639 | interlacing_leftweight = 0; |
640 | } |
641 | @@ -1026,8 +1124,21 @@ |
642 | interlacing_leftweight); |
643 | break; |
644 | } |
645 | + case 24: |
646 | + { |
647 | + deinterlace_24(alac->outputsamples_buffer_a, |
648 | + alac->outputsamples_buffer_b, |
649 | + uncompressed_bytes, |
650 | + alac->uncompressed_bytes_buffer_a, |
651 | + alac->uncompressed_bytes_buffer_b, |
652 | + (int16_t*)outbuffer, |
653 | + alac->numchannels, |
654 | + outputsamples, |
655 | + interlacing_shift, |
656 | + interlacing_leftweight); |
657 | + break; |
658 | + } |
659 | case 20: |
660 | - case 24: |
661 | case 32: |
662 | fprintf(stderr, "FIXME: unimplemented sample size %i\n", alac->setinfo_sample_size); |
663 | break; |
664 | |
665 | === added directory 'alac.xcodeproj' |
666 | === added file 'alac.xcodeproj/project.pbxproj' |
667 | --- alac.xcodeproj/project.pbxproj 1970-01-01 00:00:00 +0000 |
668 | +++ alac.xcodeproj/project.pbxproj 2012-06-21 13:30:26 +0000 |
669 | @@ -0,0 +1,223 @@ |
670 | +// !$*UTF8*$! |
671 | +{ |
672 | + archiveVersion = 1; |
673 | + classes = { |
674 | + }; |
675 | + objectVersion = 45; |
676 | + objects = { |
677 | + |
678 | +/* Begin PBXBuildFile section */ |
679 | + 7230FB301007508400AD35CD /* stream.c in Sources */ = {isa = PBXBuildFile; fileRef = 7230FB291007508400AD35CD /* stream.c */; }; |
680 | + 7230FB311007508400AD35CD /* wavwriter.c in Sources */ = {isa = PBXBuildFile; fileRef = 7230FB2B1007508400AD35CD /* wavwriter.c */; }; |
681 | + 7230FB321007508400AD35CD /* demux.c in Sources */ = {isa = PBXBuildFile; fileRef = 7230FB2D1007508400AD35CD /* demux.c */; }; |
682 | + 7230FB331007508400AD35CD /* alac.c in Sources */ = {isa = PBXBuildFile; fileRef = 7230FB2E1007508400AD35CD /* alac.c */; }; |
683 | + 8DD76FAC0486AB0100D96B5E /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = 08FB7796FE84155DC02AAC07 /* main.c */; settings = {ATTRIBUTES = (); }; }; |
684 | +/* End PBXBuildFile section */ |
685 | + |
686 | +/* Begin PBXCopyFilesBuildPhase section */ |
687 | + 8DD76FAF0486AB0100D96B5E /* CopyFiles */ = { |
688 | + isa = PBXCopyFilesBuildPhase; |
689 | + buildActionMask = 8; |
690 | + dstPath = /usr/share/man/man1/; |
691 | + dstSubfolderSpec = 0; |
692 | + files = ( |
693 | + ); |
694 | + runOnlyForDeploymentPostprocessing = 1; |
695 | + }; |
696 | +/* End PBXCopyFilesBuildPhase section */ |
697 | + |
698 | +/* Begin PBXFileReference section */ |
699 | + 08FB7796FE84155DC02AAC07 /* main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = "<group>"; }; |
700 | + 7230FB281007508400AD35CD /* wavwriter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wavwriter.h; sourceTree = "<group>"; }; |
701 | + 7230FB291007508400AD35CD /* stream.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = stream.c; sourceTree = "<group>"; }; |
702 | + 7230FB2A1007508400AD35CD /* stream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = stream.h; sourceTree = "<group>"; }; |
703 | + 7230FB2B1007508400AD35CD /* wavwriter.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = wavwriter.c; sourceTree = "<group>"; }; |
704 | + 7230FB2C1007508400AD35CD /* demux.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = demux.h; sourceTree = "<group>"; }; |
705 | + 7230FB2D1007508400AD35CD /* demux.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = demux.c; sourceTree = "<group>"; }; |
706 | + 7230FB2E1007508400AD35CD /* alac.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = alac.c; sourceTree = "<group>"; }; |
707 | + 7230FB2F1007508400AD35CD /* decomp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = decomp.h; sourceTree = "<group>"; }; |
708 | + 7230FB501007527B00AD35CD /* alac */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = alac; sourceTree = BUILT_PRODUCTS_DIR; }; |
709 | +/* End PBXFileReference section */ |
710 | + |
711 | +/* Begin PBXFrameworksBuildPhase section */ |
712 | + 8DD76FAD0486AB0100D96B5E /* Frameworks */ = { |
713 | + isa = PBXFrameworksBuildPhase; |
714 | + buildActionMask = 2147483647; |
715 | + files = ( |
716 | + ); |
717 | + runOnlyForDeploymentPostprocessing = 0; |
718 | + }; |
719 | +/* End PBXFrameworksBuildPhase section */ |
720 | + |
721 | +/* Begin PBXGroup section */ |
722 | + 08FB7794FE84155DC02AAC07 /* alac */ = { |
723 | + isa = PBXGroup; |
724 | + children = ( |
725 | + 08FB7795FE84155DC02AAC07 /* Source */, |
726 | + C6A0FF2B0290797F04C91782 /* Documentation */, |
727 | + 1AB674ADFE9D54B511CA2CBB /* Products */, |
728 | + ); |
729 | + name = alac; |
730 | + sourceTree = "<group>"; |
731 | + }; |
732 | + 08FB7795FE84155DC02AAC07 /* Source */ = { |
733 | + isa = PBXGroup; |
734 | + children = ( |
735 | + 7230FB281007508400AD35CD /* wavwriter.h */, |
736 | + 7230FB291007508400AD35CD /* stream.c */, |
737 | + 7230FB2A1007508400AD35CD /* stream.h */, |
738 | + 7230FB2B1007508400AD35CD /* wavwriter.c */, |
739 | + 7230FB2C1007508400AD35CD /* demux.h */, |
740 | + 7230FB2D1007508400AD35CD /* demux.c */, |
741 | + 7230FB2E1007508400AD35CD /* alac.c */, |
742 | + 7230FB2F1007508400AD35CD /* decomp.h */, |
743 | + 08FB7796FE84155DC02AAC07 /* main.c */, |
744 | + ); |
745 | + name = Source; |
746 | + sourceTree = "<group>"; |
747 | + }; |
748 | + 1AB674ADFE9D54B511CA2CBB /* Products */ = { |
749 | + isa = PBXGroup; |
750 | + children = ( |
751 | + 7230FB501007527B00AD35CD /* alac */, |
752 | + ); |
753 | + name = Products; |
754 | + sourceTree = "<group>"; |
755 | + }; |
756 | + C6A0FF2B0290797F04C91782 /* Documentation */ = { |
757 | + isa = PBXGroup; |
758 | + children = ( |
759 | + ); |
760 | + name = Documentation; |
761 | + sourceTree = "<group>"; |
762 | + }; |
763 | +/* End PBXGroup section */ |
764 | + |
765 | +/* Begin PBXNativeTarget section */ |
766 | + 8DD76FA90486AB0100D96B5E /* alac */ = { |
767 | + isa = PBXNativeTarget; |
768 | + buildConfigurationList = 1DEB928508733DD80010E9CD /* Build configuration list for PBXNativeTarget "alac" */; |
769 | + buildPhases = ( |
770 | + 8DD76FAB0486AB0100D96B5E /* Sources */, |
771 | + 8DD76FAD0486AB0100D96B5E /* Frameworks */, |
772 | + 8DD76FAF0486AB0100D96B5E /* CopyFiles */, |
773 | + ); |
774 | + buildRules = ( |
775 | + ); |
776 | + dependencies = ( |
777 | + ); |
778 | + name = alac; |
779 | + productInstallPath = "$(HOME)/bin"; |
780 | + productName = alac; |
781 | + productReference = 7230FB501007527B00AD35CD /* alac */; |
782 | + productType = "com.apple.product-type.tool"; |
783 | + }; |
784 | +/* End PBXNativeTarget section */ |
785 | + |
786 | +/* Begin PBXProject section */ |
787 | + 08FB7793FE84155DC02AAC07 /* Project object */ = { |
788 | + isa = PBXProject; |
789 | + buildConfigurationList = 1DEB928908733DD80010E9CD /* Build configuration list for PBXProject "alac" */; |
790 | + compatibilityVersion = "Xcode 3.1"; |
791 | + hasScannedForEncodings = 1; |
792 | + mainGroup = 08FB7794FE84155DC02AAC07 /* alac */; |
793 | + projectDirPath = ""; |
794 | + projectRoot = ""; |
795 | + targets = ( |
796 | + 8DD76FA90486AB0100D96B5E /* alac */, |
797 | + ); |
798 | + }; |
799 | +/* End PBXProject section */ |
800 | + |
801 | +/* Begin PBXSourcesBuildPhase section */ |
802 | + 8DD76FAB0486AB0100D96B5E /* Sources */ = { |
803 | + isa = PBXSourcesBuildPhase; |
804 | + buildActionMask = 2147483647; |
805 | + files = ( |
806 | + 8DD76FAC0486AB0100D96B5E /* main.c in Sources */, |
807 | + 7230FB301007508400AD35CD /* stream.c in Sources */, |
808 | + 7230FB311007508400AD35CD /* wavwriter.c in Sources */, |
809 | + 7230FB321007508400AD35CD /* demux.c in Sources */, |
810 | + 7230FB331007508400AD35CD /* alac.c in Sources */, |
811 | + ); |
812 | + runOnlyForDeploymentPostprocessing = 0; |
813 | + }; |
814 | +/* End PBXSourcesBuildPhase section */ |
815 | + |
816 | +/* Begin XCBuildConfiguration section */ |
817 | + 1DEB928608733DD80010E9CD /* Debug */ = { |
818 | + isa = XCBuildConfiguration; |
819 | + buildSettings = { |
820 | + ALWAYS_SEARCH_USER_PATHS = NO; |
821 | + COPY_PHASE_STRIP = NO; |
822 | + GCC_DYNAMIC_NO_PIC = NO; |
823 | + GCC_ENABLE_FIX_AND_CONTINUE = YES; |
824 | + GCC_MODEL_TUNING = G5; |
825 | + GCC_OPTIMIZATION_LEVEL = 0; |
826 | + INSTALL_PATH = /usr/local/bin; |
827 | + PRODUCT_NAME = alac; |
828 | + }; |
829 | + name = Debug; |
830 | + }; |
831 | + 1DEB928708733DD80010E9CD /* Release */ = { |
832 | + isa = XCBuildConfiguration; |
833 | + buildSettings = { |
834 | + ALWAYS_SEARCH_USER_PATHS = NO; |
835 | + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; |
836 | + GCC_MODEL_TUNING = G5; |
837 | + INSTALL_PATH = /usr/local/bin; |
838 | + PRODUCT_NAME = alac; |
839 | + }; |
840 | + name = Release; |
841 | + }; |
842 | + 1DEB928A08733DD80010E9CD /* Debug */ = { |
843 | + isa = XCBuildConfiguration; |
844 | + buildSettings = { |
845 | + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; |
846 | + GCC_C_LANGUAGE_STANDARD = c99; |
847 | + GCC_OPTIMIZATION_LEVEL = 0; |
848 | + GCC_WARN_ABOUT_RETURN_TYPE = YES; |
849 | + GCC_WARN_UNUSED_VARIABLE = YES; |
850 | + ONLY_ACTIVE_ARCH = YES; |
851 | + PREBINDING = NO; |
852 | + SDKROOT = macosx10.5; |
853 | + }; |
854 | + name = Debug; |
855 | + }; |
856 | + 1DEB928B08733DD80010E9CD /* Release */ = { |
857 | + isa = XCBuildConfiguration; |
858 | + buildSettings = { |
859 | + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; |
860 | + GCC_C_LANGUAGE_STANDARD = c99; |
861 | + GCC_WARN_ABOUT_RETURN_TYPE = YES; |
862 | + GCC_WARN_UNUSED_VARIABLE = YES; |
863 | + PREBINDING = NO; |
864 | + SDKROOT = macosx10.5; |
865 | + }; |
866 | + name = Release; |
867 | + }; |
868 | +/* End XCBuildConfiguration section */ |
869 | + |
870 | +/* Begin XCConfigurationList section */ |
871 | + 1DEB928508733DD80010E9CD /* Build configuration list for PBXNativeTarget "alac" */ = { |
872 | + isa = XCConfigurationList; |
873 | + buildConfigurations = ( |
874 | + 1DEB928608733DD80010E9CD /* Debug */, |
875 | + 1DEB928708733DD80010E9CD /* Release */, |
876 | + ); |
877 | + defaultConfigurationIsVisible = 0; |
878 | + defaultConfigurationName = Release; |
879 | + }; |
880 | + 1DEB928908733DD80010E9CD /* Build configuration list for PBXProject "alac" */ = { |
881 | + isa = XCConfigurationList; |
882 | + buildConfigurations = ( |
883 | + 1DEB928A08733DD80010E9CD /* Debug */, |
884 | + 1DEB928B08733DD80010E9CD /* Release */, |
885 | + ); |
886 | + defaultConfigurationIsVisible = 0; |
887 | + defaultConfigurationName = Release; |
888 | + }; |
889 | +/* End XCConfigurationList section */ |
890 | + }; |
891 | + rootObject = 08FB7793FE84155DC02AAC07 /* Project object */; |
892 | +} |
893 | |
894 | === added file 'alac_decoder.sln' |
895 | --- alac_decoder.sln 1970-01-01 00:00:00 +0000 |
896 | +++ alac_decoder.sln 2012-06-21 13:30:26 +0000 |
897 | @@ -0,0 +1,20 @@ |
898 | + |
899 | +Microsoft Visual Studio Solution File, Format Version 10.00 |
900 | +# Visual Studio 2008 |
901 | +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "alac_decoder", "alac_decoder.vcproj", "{CC45D55D-11C8-401A-BAF0-00ABF23597C8}" |
902 | +EndProject |
903 | +Global |
904 | + GlobalSection(SolutionConfigurationPlatforms) = preSolution |
905 | + Debug|Win32 = Debug|Win32 |
906 | + Release|Win32 = Release|Win32 |
907 | + EndGlobalSection |
908 | + GlobalSection(ProjectConfigurationPlatforms) = postSolution |
909 | + {CC45D55D-11C8-401A-BAF0-00ABF23597C8}.Debug|Win32.ActiveCfg = Debug|Win32 |
910 | + {CC45D55D-11C8-401A-BAF0-00ABF23597C8}.Debug|Win32.Build.0 = Debug|Win32 |
911 | + {CC45D55D-11C8-401A-BAF0-00ABF23597C8}.Release|Win32.ActiveCfg = Release|Win32 |
912 | + {CC45D55D-11C8-401A-BAF0-00ABF23597C8}.Release|Win32.Build.0 = Release|Win32 |
913 | + EndGlobalSection |
914 | + GlobalSection(SolutionProperties) = preSolution |
915 | + HideSolutionNode = FALSE |
916 | + EndGlobalSection |
917 | +EndGlobal |
918 | |
919 | === added file 'alac_decoder.vcproj' |
920 | --- alac_decoder.vcproj 1970-01-01 00:00:00 +0000 |
921 | +++ alac_decoder.vcproj 2012-06-21 13:30:26 +0000 |
922 | @@ -0,0 +1,229 @@ |
923 | +<?xml version="1.0" encoding="Windows-1252"?> |
924 | +<VisualStudioProject |
925 | + ProjectType="Visual C++" |
926 | + Version="9.00" |
927 | + Name="alac_decoder" |
928 | + ProjectGUID="{CC45D55D-11C8-401A-BAF0-00ABF23597C8}" |
929 | + RootNamespace="alac_decoder" |
930 | + Keyword="Win32Proj" |
931 | + TargetFrameworkVersion="131072" |
932 | + > |
933 | + <Platforms> |
934 | + <Platform |
935 | + Name="Win32" |
936 | + /> |
937 | + </Platforms> |
938 | + <ToolFiles> |
939 | + </ToolFiles> |
940 | + <Configurations> |
941 | + <Configuration |
942 | + Name="Debug|Win32" |
943 | + OutputDirectory="$(SolutionDir)$(ConfigurationName)" |
944 | + IntermediateDirectory="$(ConfigurationName)" |
945 | + ConfigurationType="1" |
946 | + CharacterSet="2" |
947 | + > |
948 | + <Tool |
949 | + Name="VCPreBuildEventTool" |
950 | + /> |
951 | + <Tool |
952 | + Name="VCCustomBuildTool" |
953 | + /> |
954 | + <Tool |
955 | + Name="VCXMLDataGeneratorTool" |
956 | + /> |
957 | + <Tool |
958 | + Name="VCWebServiceProxyGeneratorTool" |
959 | + /> |
960 | + <Tool |
961 | + Name="VCMIDLTool" |
962 | + /> |
963 | + <Tool |
964 | + Name="VCCLCompilerTool" |
965 | + Optimization="0" |
966 | + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" |
967 | + MinimalRebuild="true" |
968 | + BasicRuntimeChecks="3" |
969 | + RuntimeLibrary="3" |
970 | + UsePrecompiledHeader="0" |
971 | + WarningLevel="3" |
972 | + DebugInformationFormat="4" |
973 | + /> |
974 | + <Tool |
975 | + Name="VCManagedResourceCompilerTool" |
976 | + /> |
977 | + <Tool |
978 | + Name="VCResourceCompilerTool" |
979 | + /> |
980 | + <Tool |
981 | + Name="VCPreLinkEventTool" |
982 | + /> |
983 | + <Tool |
984 | + Name="VCLinkerTool" |
985 | + LinkIncremental="2" |
986 | + GenerateDebugInformation="true" |
987 | + SubSystem="1" |
988 | + TargetMachine="1" |
989 | + /> |
990 | + <Tool |
991 | + Name="VCALinkTool" |
992 | + /> |
993 | + <Tool |
994 | + Name="VCManifestTool" |
995 | + /> |
996 | + <Tool |
997 | + Name="VCXDCMakeTool" |
998 | + /> |
999 | + <Tool |
1000 | + Name="VCBscMakeTool" |
1001 | + /> |
1002 | + <Tool |
1003 | + Name="VCFxCopTool" |
1004 | + /> |
1005 | + <Tool |
1006 | + Name="VCAppVerifierTool" |
1007 | + /> |
1008 | + <Tool |
1009 | + Name="VCPostBuildEventTool" |
1010 | + /> |
1011 | + </Configuration> |
1012 | + <Configuration |
1013 | + Name="Release|Win32" |
1014 | + OutputDirectory="$(SolutionDir)$(ConfigurationName)" |
1015 | + IntermediateDirectory="$(ConfigurationName)" |
1016 | + ConfigurationType="1" |
1017 | + CharacterSet="2" |
1018 | + WholeProgramOptimization="1" |
1019 | + > |
1020 | + <Tool |
1021 | + Name="VCPreBuildEventTool" |
1022 | + /> |
1023 | + <Tool |
1024 | + Name="VCCustomBuildTool" |
1025 | + /> |
1026 | + <Tool |
1027 | + Name="VCXMLDataGeneratorTool" |
1028 | + /> |
1029 | + <Tool |
1030 | + Name="VCWebServiceProxyGeneratorTool" |
1031 | + /> |
1032 | + <Tool |
1033 | + Name="VCMIDLTool" |
1034 | + /> |
1035 | + <Tool |
1036 | + Name="VCCLCompilerTool" |
1037 | + Optimization="2" |
1038 | + EnableIntrinsicFunctions="true" |
1039 | + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" |
1040 | + RuntimeLibrary="2" |
1041 | + EnableFunctionLevelLinking="true" |
1042 | + UsePrecompiledHeader="0" |
1043 | + WarningLevel="3" |
1044 | + DebugInformationFormat="3" |
1045 | + /> |
1046 | + <Tool |
1047 | + Name="VCManagedResourceCompilerTool" |
1048 | + /> |
1049 | + <Tool |
1050 | + Name="VCResourceCompilerTool" |
1051 | + /> |
1052 | + <Tool |
1053 | + Name="VCPreLinkEventTool" |
1054 | + /> |
1055 | + <Tool |
1056 | + Name="VCLinkerTool" |
1057 | + LinkIncremental="1" |
1058 | + GenerateDebugInformation="true" |
1059 | + SubSystem="1" |
1060 | + OptimizeReferences="2" |
1061 | + EnableCOMDATFolding="2" |
1062 | + TargetMachine="1" |
1063 | + /> |
1064 | + <Tool |
1065 | + Name="VCALinkTool" |
1066 | + /> |
1067 | + <Tool |
1068 | + Name="VCManifestTool" |
1069 | + /> |
1070 | + <Tool |
1071 | + Name="VCXDCMakeTool" |
1072 | + /> |
1073 | + <Tool |
1074 | + Name="VCBscMakeTool" |
1075 | + /> |
1076 | + <Tool |
1077 | + Name="VCFxCopTool" |
1078 | + /> |
1079 | + <Tool |
1080 | + Name="VCAppVerifierTool" |
1081 | + /> |
1082 | + <Tool |
1083 | + Name="VCPostBuildEventTool" |
1084 | + /> |
1085 | + </Configuration> |
1086 | + </Configurations> |
1087 | + <References> |
1088 | + </References> |
1089 | + <Files> |
1090 | + <Filter |
1091 | + Name="Source Files" |
1092 | + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" |
1093 | + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" |
1094 | + > |
1095 | + <File |
1096 | + RelativePath=".\alac.c" |
1097 | + > |
1098 | + </File> |
1099 | + <File |
1100 | + RelativePath=".\demux.c" |
1101 | + > |
1102 | + </File> |
1103 | + <File |
1104 | + RelativePath=".\main.c" |
1105 | + > |
1106 | + </File> |
1107 | + <File |
1108 | + RelativePath=".\stream.c" |
1109 | + > |
1110 | + </File> |
1111 | + <File |
1112 | + RelativePath=".\wavwriter.c" |
1113 | + > |
1114 | + </File> |
1115 | + </Filter> |
1116 | + <Filter |
1117 | + Name="Header Files" |
1118 | + Filter="h;hpp;hxx;hm;inl;inc;xsd" |
1119 | + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" |
1120 | + > |
1121 | + <File |
1122 | + RelativePath=".\decomp.h" |
1123 | + > |
1124 | + </File> |
1125 | + <File |
1126 | + RelativePath=".\demux.h" |
1127 | + > |
1128 | + </File> |
1129 | + <File |
1130 | + RelativePath=".\stdint_win.h" |
1131 | + > |
1132 | + </File> |
1133 | + <File |
1134 | + RelativePath=".\stream.h" |
1135 | + > |
1136 | + </File> |
1137 | + <File |
1138 | + RelativePath=".\wavwriter.h" |
1139 | + > |
1140 | + </File> |
1141 | + </Filter> |
1142 | + <Filter |
1143 | + Name="Resource Files" |
1144 | + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" |
1145 | + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" |
1146 | + > |
1147 | + </Filter> |
1148 | + </Files> |
1149 | + <Globals> |
1150 | + </Globals> |
1151 | +</VisualStudioProject> |
1152 | |
1153 | === modified file 'debian/changelog' |
1154 | --- debian/changelog 2008-12-16 17:19:08 +0000 |
1155 | +++ debian/changelog 2012-06-21 13:30:26 +0000 |
1156 | @@ -1,3 +1,12 @@ |
1157 | +alac-decoder (0.2.0-0ubuntu1) quantal; urgency=low |
1158 | + |
1159 | + * New upstream release (LP: #803945). |
1160 | + * Update standards version to 3.9.3. |
1161 | + * Add ${misc:Depends} to dependencies. |
1162 | + * Update build structure in debian/rules. |
1163 | + |
1164 | + -- Logan Rosen <logatronico@gmail.com> Thu, 21 Jun 2012 09:16:08 -0400 |
1165 | + |
1166 | alac-decoder (0.1.3-0ubuntu3) jaunty; urgency=low |
1167 | |
1168 | * debian/control: |
1169 | |
1170 | === modified file 'debian/control' |
1171 | --- debian/control 2008-12-16 17:19:08 +0000 |
1172 | +++ debian/control 2012-06-21 13:30:26 +0000 |
1173 | @@ -4,11 +4,11 @@ |
1174 | Maintainer: Ubuntu MOTU Developers <ubuntu-motu@lists.ubuntu.com> |
1175 | XSBC-Original-Maintainer: Lukas Fittl <lfittl@fsfe.org> |
1176 | Build-Depends: debhelper (>= 5.0.0) |
1177 | -Standards-Version: 3.8.0 |
1178 | +Standards-Version: 3.9.3 |
1179 | Homepage: http://craz.net/programs/itunes/alac.html |
1180 | |
1181 | Package: alac-decoder |
1182 | Architecture: any |
1183 | -Depends: ${shlibs:Depends} |
1184 | +Depends: ${shlibs:Depends}, ${misc:Depends} |
1185 | Description: Apple Lossless audio codec decoder |
1186 | A simple decoder for the Apple Lossless audio codec. |
1187 | |
1188 | === modified file 'debian/rules' |
1189 | --- debian/rules 2006-11-25 20:58:34 +0000 |
1190 | +++ debian/rules 2012-06-21 13:30:26 +0000 |
1191 | @@ -13,7 +13,9 @@ |
1192 | CFLAGS += -O2 |
1193 | endif |
1194 | |
1195 | -build: build-stamp |
1196 | +build: build-arch build-indep |
1197 | +build-arch: build-stamp |
1198 | +build-indep: build-stamp |
1199 | build-stamp: |
1200 | dh_testdir |
1201 | |
1202 | |
1203 | === modified file 'demux.c' |
1204 | --- demux.c 2006-11-25 20:58:34 +0000 |
1205 | +++ demux.c 2012-06-21 13:30:26 +0000 |
1206 | @@ -32,8 +32,12 @@ |
1207 | |
1208 | #include <string.h> |
1209 | #include <stdio.h> |
1210 | -#include <stdint.h> |
1211 | #include <stdlib.h> |
1212 | +#ifdef _WIN32 |
1213 | + #include "stdint_win.h" |
1214 | +#else |
1215 | + #include <stdint.h> |
1216 | +#endif |
1217 | |
1218 | #include "stream.h" |
1219 | #include "demux.h" |
1220 | |
1221 | === modified file 'demux.h' |
1222 | --- demux.h 2006-11-25 20:58:34 +0000 |
1223 | +++ demux.h 2012-06-21 13:30:26 +0000 |
1224 | @@ -1,7 +1,12 @@ |
1225 | #ifndef DEMUX_H |
1226 | #define DEMUX_H |
1227 | |
1228 | -#include <stdint.h> |
1229 | +#ifdef _WIN32 |
1230 | + #include "stdint_win.h" |
1231 | +#else |
1232 | + #include <stdint.h> |
1233 | +#endif |
1234 | + |
1235 | #include "stream.h" |
1236 | |
1237 | typedef uint32_t fourcc_t; |
1238 | |
1239 | === modified file 'main.c' |
1240 | --- main.c 2006-11-25 20:58:34 +0000 |
1241 | +++ main.c 2012-06-21 13:30:26 +0000 |
1242 | @@ -34,10 +34,14 @@ |
1243 | |
1244 | #include <ctype.h> |
1245 | #include <stdio.h> |
1246 | -#include <stdint.h> |
1247 | #include <stdlib.h> |
1248 | #include <errno.h> |
1249 | #include <string.h> |
1250 | +#ifdef _WIN32 |
1251 | + #include "stdint_win.h" |
1252 | +#else |
1253 | + #include <stdint.h> |
1254 | +#endif |
1255 | |
1256 | #include "demux.h" |
1257 | #include "decomp.h" |
1258 | @@ -97,11 +101,11 @@ |
1259 | |
1260 | static void GetBuffer(demux_res_t *demux_res) |
1261 | { |
1262 | - unsigned long destBufferSize = 1024*16; /* 16kb buffer = 4096 frames = 1 alac sample */ |
1263 | + unsigned long destBufferSize = 1024*24; /* 24kb buffer = 4096 frames = 1 alac sample (we support max 24bps) */ |
1264 | void *pDestBuffer = malloc(destBufferSize); |
1265 | int bytes_read = 0; |
1266 | |
1267 | - unsigned int buffer_size = 1024*64; |
1268 | + unsigned int buffer_size = 1024*80; /* sample big enough to hold any input for a single alac frame */ |
1269 | void *buffer; |
1270 | |
1271 | unsigned int i; |
1272 | @@ -288,10 +292,10 @@ |
1273 | |
1274 | setup_environment(argc, argv); |
1275 | |
1276 | -#ifdef WIN32 |
1277 | +/*#ifdef _WIN32 |
1278 | setmode(fileno(stdout), O_BINARY); |
1279 | setmode(fileno(stdin), O_BINARY); |
1280 | -#endif |
1281 | +#endif*/ |
1282 | |
1283 | input_stream = stream_create_file(input_file, 1); |
1284 | if (!input_stream) |
1285 | |
1286 | === added file 'stdint_win.h' |
1287 | --- stdint_win.h 1970-01-01 00:00:00 +0000 |
1288 | +++ stdint_win.h 2012-06-21 13:30:26 +0000 |
1289 | @@ -0,0 +1,14 @@ |
1290 | + |
1291 | +#ifndef ALAC_STDINT_WIN_H__ |
1292 | +#define ALAC_STDINT_WIN_H__ |
1293 | + |
1294 | +typedef signed char int8_t; |
1295 | +typedef signed short int16_t; |
1296 | +typedef signed int int32_t; |
1297 | +typedef signed __int64 int64_t; |
1298 | +typedef unsigned char uint8_t; |
1299 | +typedef unsigned short uint16_t; |
1300 | +typedef unsigned int uint32_t; |
1301 | +typedef unsigned __int64 uint64_t; |
1302 | + |
1303 | +#endif // ALAC_STDINT_WIN_H__ |
1304 | \ No newline at end of file |
1305 | |
1306 | === modified file 'stream.c' |
1307 | --- stream.c 2006-11-25 20:58:34 +0000 |
1308 | +++ stream.c 2012-06-21 13:30:26 +0000 |
1309 | @@ -31,9 +31,13 @@ |
1310 | |
1311 | |
1312 | #include <stdio.h> |
1313 | -#include <stdint.h> |
1314 | #include <stdlib.h> |
1315 | #include <errno.h> |
1316 | +#ifdef _WIN32 |
1317 | + #include "stdint_win.h" |
1318 | +#else |
1319 | + #include <stdint.h> |
1320 | +#endif |
1321 | |
1322 | #include "stream.h" |
1323 | |
1324 | |
1325 | === modified file 'stream.h' |
1326 | --- stream.h 2006-11-25 20:58:34 +0000 |
1327 | +++ stream.h 2012-06-21 13:30:26 +0000 |
1328 | @@ -3,7 +3,11 @@ |
1329 | |
1330 | /* stream.h */ |
1331 | |
1332 | -#include <stdint.h> |
1333 | +#ifdef _WIN32 |
1334 | + #include "stdint_win.h" |
1335 | +#else |
1336 | + #include <stdint.h> |
1337 | +#endif |
1338 | |
1339 | typedef struct stream_tTAG stream_t; |
1340 | |
1341 | |
1342 | === modified file 'wavwriter.c' |
1343 | --- wavwriter.c 2006-11-25 20:58:34 +0000 |
1344 | +++ wavwriter.c 2012-06-21 13:30:26 +0000 |
1345 | @@ -32,7 +32,11 @@ |
1346 | |
1347 | #include <stdio.h> |
1348 | #include <stdlib.h> |
1349 | -#include <stdint.h> |
1350 | +#ifdef _WIN32 |
1351 | + #include "stdint_win.h" |
1352 | +#else |
1353 | + #include <stdint.h> |
1354 | +#endif |
1355 | |
1356 | #ifndef MAKEFOURCC |
1357 | #define MAKEFOURCC(ch0, ch1, ch2, ch3) ( \ |
Good work.