1 diff -Naur libdca/include/audio_out.h libdca_patched/include/audio_out.h
2 --- libdca/include/audio_out.h 2007-05-02 10:05:03.000000000 +0100
3 +++ libdca_patched/include/audio_out.h 2007-05-02 10:09:42.000000000 +0100
7 int (* setup) (ao_instance_t * instance, int sample_rate, int * flags,
8 - level_t * level, sample_t * bias);
9 - int (* play) (ao_instance_t * instance, int flags, sample_t * samples);
10 + dca_level_t * level, dca_sample_t * bias);
11 + int (* play) (ao_instance_t * instance, int flags, dca_sample_t * samples);
12 void (* close) (ao_instance_t * instance);
15 diff -Naur libdca/include/dca.h libdca_patched/include/dca.h
16 --- libdca/include/dca.h 2007-05-02 10:05:03.000000000 +0100
17 +++ libdca_patched/include/dca.h 2007-05-02 10:09:36.000000000 +0100
19 uint32_t mm_accel (void);
21 #if defined(LIBDCA_FIXED)
22 -typedef int32_t sample_t;
23 -typedef int32_t level_t;
24 +typedef int32_t dca_sample_t;
25 +typedef int32_t dca_level_t;
26 #elif defined(LIBDCA_DOUBLE)
27 -typedef double sample_t;
28 -typedef double level_t;
29 +typedef double dca_sample_t;
30 +typedef double dca_level_t;
32 -typedef float sample_t;
33 -typedef float level_t;
34 +typedef float dca_sample_t;
35 +typedef float dca_level_t;
38 typedef struct dca_state_s dca_state_t;
41 #define DCA_ADJUST_LEVEL 0x100
43 +#define DCA_OUT_DPLI 0x200
44 +#define DCA_OUT_DPLII 0x400
46 dca_state_t * dca_init (uint32_t mm_accel);
48 int dca_syncinfo (dca_state_t *state, uint8_t * buf, int * flags,
49 int * sample_rate, int * bit_rate, int *frame_length);
51 int dca_frame (dca_state_t * state, uint8_t * buf, int * flags,
52 - level_t * level, sample_t bias);
53 + dca_level_t * level, dca_sample_t bias);
55 void dca_dynrng (dca_state_t * state,
56 - level_t (* call) (level_t, void *), void * data);
57 + dca_level_t (* call) (dca_level_t, void *), void * data);
59 int dca_blocks_num (dca_state_t * state);
60 int dca_block (dca_state_t * state);
62 -sample_t * dca_samples (dca_state_t * state);
63 +dca_sample_t * dca_samples (dca_state_t * state);
65 void dca_free (dca_state_t * state);
67 diff -Naur libdca/libao/audio_out_aif.c libdca_patched/libao/audio_out_aif.c
68 --- libdca/libao/audio_out_aif.c 2007-05-02 10:05:04.000000000 +0100
69 +++ libdca_patched/libao/audio_out_aif.c 2007-05-02 10:09:41.000000000 +0100
73 static int aif_setup (ao_instance_t * _instance, int sample_rate, int * flags,
74 - level_t * level, sample_t * bias)
75 + dca_level_t * level, dca_sample_t * bias)
77 aif_instance_t * instance = (aif_instance_t *) _instance;
83 -static int aif_play (ao_instance_t * _instance, int flags, sample_t * _samples)
84 +static int aif_play (ao_instance_t * _instance, int flags, dca_sample_t * _samples)
86 aif_instance_t * instance = (aif_instance_t *) _instance;
87 int16_t int16_samples[256*2];
88 diff -Naur libdca/libao/audio_out_al.c libdca_patched/libao/audio_out_al.c
89 --- libdca/libao/audio_out_al.c 2007-05-02 10:05:04.000000000 +0100
90 +++ libdca_patched/libao/audio_out_al.c 2007-05-02 10:09:41.000000000 +0100
94 static int al_setup (ao_instance_t * _instance, int sample_rate, int * flags,
95 - level_t * level, sample_t * bias)
96 + dca_level_t * level, dca_sample_t * bias)
98 al_instance_t * instance = (al_instance_t *) _instance;
104 -static int al_play (ao_instance_t * _instance, int flags, sample_t * _samples)
105 +static int al_play (ao_instance_t * _instance, int flags, dca_sample_t * _samples)
107 al_instance_t * instance = (al_instance_t *) _instance;
108 int16_t int16_samples[256*6];
109 diff -Naur libdca/libao/audio_out_float.c libdca_patched/libao/audio_out_float.c
110 --- libdca/libao/audio_out_float.c 2007-05-02 10:05:04.000000000 +0100
111 +++ libdca_patched/libao/audio_out_float.c 2007-05-02 10:09:40.000000000 +0100
113 #include "audio_out_internal.h"
115 static int float_setup (ao_instance_t * instance, int sample_rate, int * flags,
116 - level_t * level, sample_t * bias)
117 + dca_level_t * level, dca_sample_t * bias)
124 static int float_play (ao_instance_t * instance, int flags,
125 - sample_t * _samples)
126 + dca_sample_t * _samples)
128 #if defined(LIBDCA_FIXED)
129 float samples[256 * 2];
130 diff -Naur libdca/libao/audio_out_internal.h libdca_patched/libao/audio_out_internal.h
131 --- libdca/libao/audio_out_internal.h 2007-05-02 10:05:04.000000000 +0100
132 +++ libdca_patched/libao/audio_out_internal.h 2007-05-02 10:09:40.000000000 +0100
135 typedef float convert_t;
137 -typedef sample_t convert_t;
138 +typedef dca_sample_t convert_t;
142 diff -Naur libdca/libao/audio_out_null.c libdca_patched/libao/audio_out_null.c
143 --- libdca/libao/audio_out_null.c 2007-05-02 10:05:04.000000000 +0100
144 +++ libdca_patched/libao/audio_out_null.c 2007-05-02 10:09:39.000000000 +0100
148 static int null_setup (ao_instance_t * _instance, int sample_rate, int * flags,
149 - level_t * level, sample_t * bias)
150 + dca_level_t * level, dca_sample_t * bias)
152 null_instance_t * instance = (null_instance_t *) _instance;
158 -static int null_play (ao_instance_t * instance, int flags, sample_t * samples)
159 +static int null_play (ao_instance_t * instance, int flags, dca_sample_t * samples)
161 (void)instance; (void)flags; (void)samples;
163 diff -Naur libdca/libao/audio_out_oss.c libdca_patched/libao/audio_out_oss.c
164 --- libdca/libao/audio_out_oss.c 2007-05-02 10:05:04.000000000 +0100
165 +++ libdca_patched/libao/audio_out_oss.c 2007-05-02 10:09:38.000000000 +0100
169 static int oss_setup (ao_instance_t * _instance, int sample_rate, int * flags,
170 - level_t * level, sample_t * bias)
171 + dca_level_t * level, dca_sample_t * bias)
173 oss_instance_t * instance = (oss_instance_t *) _instance;
179 -static int oss_play (ao_instance_t * _instance, int flags, sample_t * _samples)
180 +static int oss_play (ao_instance_t * _instance, int flags, dca_sample_t * _samples)
182 oss_instance_t * instance = (oss_instance_t *) _instance;
183 int16_t int16_samples[256*6];
184 diff -Naur libdca/libao/audio_out_peak.c libdca_patched/libao/audio_out_peak.c
185 --- libdca/libao/audio_out_peak.c 2007-05-02 10:05:04.000000000 +0100
186 +++ libdca_patched/libao/audio_out_peak.c 2007-05-02 10:09:38.000000000 +0100
190 static int peak_setup (ao_instance_t * _instance, int sample_rate, int * flags,
191 - level_t * level, sample_t * bias)
192 + dca_level_t * level, dca_sample_t * bias)
194 peak_instance_t * instance = (peak_instance_t *) _instance;
200 -static int peak_play (ao_instance_t * _instance, int flags, sample_t * samples)
201 +static int peak_play (ao_instance_t * _instance, int flags, dca_sample_t * samples)
203 peak_instance_t * instance = (peak_instance_t *) _instance;
205 diff -Naur libdca/libao/audio_out_solaris.c libdca_patched/libao/audio_out_solaris.c
206 --- libdca/libao/audio_out_solaris.c 2007-05-02 10:05:04.000000000 +0100
207 +++ libdca_patched/libao/audio_out_solaris.c 2007-05-02 10:09:37.000000000 +0100
209 } solaris_instance_t;
211 static int solaris_setup (ao_instance_t * _instance, int sample_rate,
212 - int * flags, level_t * level, sample_t * bias)
213 + int * flags, dca_level_t * level, dca_sample_t * bias)
215 solaris_instance_t * instance = (solaris_instance_t *) _instance;
220 static int solaris_play (ao_instance_t * _instance, int flags,
221 - sample_t * _samples)
222 + dca_sample_t * _samples)
224 solaris_instance_t * instance = (solaris_instance_t *) _instance;
225 int16_t int16_samples[256*2];
226 diff -Naur libdca/libao/audio_out_wav.c libdca_patched/libao/audio_out_wav.c
227 --- libdca/libao/audio_out_wav.c 2007-05-02 10:05:04.000000000 +0100
228 +++ libdca_patched/libao/audio_out_wav.c 2007-05-02 10:09:37.000000000 +0100
232 static int wav_setup (ao_instance_t * _instance, int sample_rate, int * flags,
233 - level_t * level, sample_t * bias)
234 + dca_level_t * level, dca_sample_t * bias)
236 wav_instance_t * instance = (wav_instance_t *) _instance;
242 -static int wav_play (ao_instance_t * _instance, int flags, sample_t * _samples)
243 +static int wav_play (ao_instance_t * _instance, int flags, dca_sample_t * _samples)
245 wav_instance_t * instance = (wav_instance_t *) _instance;
247 diff -Naur libdca/libao/audio_out_win.c libdca_patched/libao/audio_out_win.c
248 --- libdca/libao/audio_out_win.c 2007-05-02 10:05:04.000000000 +0100
249 +++ libdca_patched/libao/audio_out_win.c 2007-05-02 10:09:36.000000000 +0100
253 static int win_setup (ao_instance_t * _instance, int sample_rate, int * flags,
254 - level_t * level, sample_t * bias)
255 + dca_level_t * level, dca_sample_t * bias)
257 win_instance_t * instance = (win_instance_t *) _instance;
263 -static int win_play (ao_instance_t * _instance, int flags, sample_t * _samples)
264 +static int win_play (ao_instance_t * _instance, int flags, dca_sample_t * _samples)
266 win_instance_t * instance = (win_instance_t *) _instance;
268 diff -Naur libdca/libdca/dca_internal.h libdca_patched/libdca/dca_internal.h
269 --- libdca/libdca/dca_internal.h 2007-05-02 10:05:05.000000000 +0100
270 +++ libdca_patched/libdca/dca_internal.h 2007-05-02 10:09:35.000000000 +0100
271 @@ -116,20 +116,20 @@
272 double subband_fir_noidea[DCA_PRIM_CHANNELS_MAX][64];
275 - level_t clev; /* centre channel mix level */
276 - level_t slev; /* surround channels mix level */
277 + dca_level_t clev; /* centre channel mix level */
278 + dca_level_t slev; /* surround channels mix level */
280 int output; /* type of output */
281 - level_t level; /* output level */
282 - sample_t bias; /* output bias */
283 + dca_level_t level; /* output level */
284 + dca_sample_t bias; /* output bias */
286 - sample_t * samples; /* pointer to the internal audio samples buffer */
287 + dca_sample_t * samples; /* pointer to the internal audio samples buffer */
290 int dynrnge; /* apply dynamic range */
291 - level_t dynrng; /* dynamic range */
292 + dca_level_t dynrng; /* dynamic range */
293 void * dynrngdata; /* dynamic range callback funtion and data */
294 - level_t (* dynrngcall) (level_t range, void * dynrngdata);
295 + dca_level_t (* dynrngcall) (dca_level_t range, void * dynrngdata);
297 /* Bitstream handling */
298 uint32_t * buffer_start;
299 @@ -155,19 +155,23 @@
300 #define LEVEL_45DB 0.5946035575013605
301 #define LEVEL_6DB 0.5
303 -int dca_downmix_init (int input, int flags, level_t * level,
304 - level_t clev, level_t slev);
305 -int dca_downmix_coeff (level_t * coeff, int acmod, int output, level_t level,
306 - level_t clev, level_t slev);
307 -void dca_downmix (sample_t * samples, int acmod, int output, sample_t bias,
308 - level_t clev, level_t slev);
309 -void dca_upmix (sample_t * samples, int acmod, int output);
310 +// these next two constants are used for DPL matrix encoding in downmix.c
311 +#define LEVEL_SQRT_1_2 0.5
312 +#define LEVEL_SQRT_3_4 0.8660254037844386
314 +int dca_downmix_init (int input, int flags, dca_level_t * level,
315 + dca_level_t clev, dca_level_t slev);
316 +int dca_downmix_coeff (dca_level_t * coeff, int acmod, int output, dca_level_t level,
317 + dca_level_t clev, dca_level_t slev);
318 +void dca_downmix (dca_sample_t * samples, int acmod, int output, dca_sample_t bias,
319 + dca_level_t clev, dca_level_t slev);
320 +void dca_upmix (dca_sample_t * samples, int acmod, int output);
322 #define ROUND(x) ((int)((x) + ((x) > 0 ? 0.5 : -0.5)))
326 -typedef sample_t quantizer_t;
327 +typedef dca_sample_t quantizer_t;
328 #define SAMPLE(x) (x)
330 #define MUL(a,b) ((a) * (b))
332 #else /* LIBDCA_FIXED */
334 typedef int16_t quantizer_t;
335 -#define SAMPLE(x) (sample_t)((x) * (1 << 30))
336 -#define LEVEL(x) (level_t)((x) * (1 << 26))
337 +#define SAMPLE(x) (dca_sample_t)((x) * (1 << 30))
338 +#define LEVEL(x) (dca_level_t)((x) * (1 << 26))
341 #define MUL(a,b) ((int)(((int64_t)(a) * (b) + (1 << 29)) >> 30))
342 diff -Naur libdca/libdca/downmix.c libdca_patched/libdca/downmix.c
343 --- libdca/libdca/downmix.c 2007-05-02 10:05:05.000000000 +0100
344 +++ libdca_patched/libdca/downmix.c 2007-05-06 19:45:54.000000000 +0100
347 #define CONVERT(acmod,output) (((output) << DCA_CHANNEL_BITS) + (acmod))
349 -int dca_downmix_init (int input, int flags, level_t * level,
350 - level_t clev, level_t slev)
351 +int dca_downmix_init (int input, int flags, dca_level_t * level,
352 + dca_level_t clev, dca_level_t slev)
354 static uint8_t table[11][10] = {
359 if (flags & DCA_ADJUST_LEVEL) {
361 + dca_level_t adjust;
363 switch (CONVERT (input & 7, output)) {
365 @@ -181,13 +181,16 @@
366 *level = MUL_L (*level, adjust);
369 + // add the DPLI/DPLII flag back into the output if one was passed in
370 + output = output | (flags & DCA_OUT_DPLI) | (flags & DCA_OUT_DPLII);
375 -int dca_downmix_coeff (level_t * coeff, int acmod, int output, level_t level,
376 - level_t clev, level_t slev)
377 +int dca_downmix_coeff (dca_level_t * coeff, int acmod, int output, dca_level_t level,
378 + dca_level_t clev, dca_level_t slev)
381 + dca_level_t level_3db;
383 level_3db = MUL_C (level, LEVEL_3DB);
386 return -1; /* NOTREACHED */
389 -static void mix2to1 (sample_t * dest, sample_t * src, sample_t bias)
390 +static void mix2to1 (dca_sample_t * dest, dca_sample_t * src, dca_sample_t bias)
395 dest[i] += BIAS (src[i]);
398 -static void mix3to1 (sample_t * samples, sample_t bias)
399 +static void mix3to1 (dca_sample_t * samples, dca_sample_t bias)
404 samples[i] += BIAS (samples[i + 256] + samples[i + 512]);
407 -static void mix4to1 (sample_t * samples, sample_t bias)
408 +static void mix4to1 (dca_sample_t * samples, dca_sample_t bias)
416 -static void mix5to1 (sample_t * samples, sample_t bias)
417 +static void mix5to1 (dca_sample_t * samples, dca_sample_t bias)
421 @@ -378,10 +381,10 @@
422 samples[i + 768] + samples[i + 1024]);
425 -static void mix3to2 (sample_t * samples, sample_t bias)
426 +static void mix3to2 (dca_sample_t * samples, dca_sample_t bias)
430 + dca_sample_t common;
432 for (i = 0; i < 256; i++) {
433 common = BIAS (samples[i]);
434 @@ -390,10 +393,10 @@
438 -static void mix21to2 (sample_t * left, sample_t * right, sample_t bias)
439 +static void mix21to2 (dca_sample_t * left, dca_sample_t * right, dca_sample_t bias)
443 + dca_sample_t common;
445 for (i = 0; i < 256; i++) {
446 common = BIAS (right[i + 256]);
447 @@ -402,10 +405,10 @@
451 -static void mix21toS (sample_t * samples, sample_t bias)
452 +static void mix21toS (dca_sample_t * samples, dca_sample_t bias)
456 + dca_sample_t surround;
458 for (i = 0; i < 256; i++) {
459 surround = samples[i + 512];
460 @@ -414,10 +417,10 @@
464 -static void mix31to2 (sample_t * samples, sample_t bias)
465 +static void mix31to2 (dca_sample_t * samples, dca_sample_t bias)
469 + dca_sample_t common;
471 for (i = 0; i < 256; i++) {
472 common = BIAS (samples[i] + samples[i + 768]);
473 @@ -426,23 +429,32 @@
477 -static void mix31toS (sample_t * samples, sample_t bias)
478 +static void mix31toS (dca_sample_t * samples, dca_sample_t bias)
481 - sample_t common, surround;
483 - for (i = 0; i < 256; i++) {
484 - common = BIAS (samples[i]);
485 - surround = samples[i + 768];
486 - samples[i] = samples[i + 256] + common - surround;
487 - samples[i + 256] = samples[i + 512] + common + surround;
490 + dca_sample_t cc, surround, Lt, Rt;
492 + for (i = 0; i < 256; i++) {
494 + cc = samples[i] * LEVEL_3DB;
496 + surround = samples[i + 768];
498 + Lt = samples[i + 256] + cc;
499 + Rt = samples[i + 512] + cc;
501 + samples[i] = Lt - surround;
502 + samples[i + 256] = Rt + surround;
508 -static void mix22toS (sample_t * samples, sample_t bias)
509 +static void mix22toS (dca_sample_t * samples, dca_sample_t bias)
513 + dca_sample_t surround;
515 for (i = 0; i < 256; i++) {
516 surround = samples[i + 512] + samples[i + 768];
517 @@ -451,10 +463,10 @@
521 -static void mix32to2 (sample_t * samples, sample_t bias)
522 +static void mix32to2 (dca_sample_t * samples, dca_sample_t bias)
526 + dca_sample_t common;
528 for (i = 0; i < 256; i++) {
529 common = BIAS (samples[i]);
530 @@ -463,20 +475,55 @@
534 -static void mix32toS (sample_t * samples, sample_t bias)
535 +static void mix32toS (dca_sample_t * samples, dca_sample_t bias, int use_dpl2)
538 - sample_t common, surround;
540 - for (i = 0; i < 256; i++) {
541 - common = BIAS (samples[i]);
542 - surround = samples[i + 768] + samples[i + 1024];
543 - samples[i] = samples[i + 256] + common - surround;
544 - samples[i + 256] = samples[i + 512] + common + surround;
547 + if (use_dpl2 == 1) {
549 -static void move2to1 (sample_t * src, sample_t * dest, sample_t bias)
551 + dca_sample_t cc, Lt, Rt, Ls, Rs, Lss, Rss;
553 + for (i = 0; i < 256; i++) {
555 + cc = samples[i] * LEVEL_3DB;
557 + Lt = samples[i + 256] + cc;
558 + Rt = samples[i + 512] + cc;
560 + Ls = samples[i + 768];
561 + Rs = samples[i + 1024];
563 + Lss = (LEVEL_SQRT_3_4 * Ls) - (LEVEL_SQRT_1_2 * Rs);
564 + Rss = -(LEVEL_SQRT_1_2 * Ls) + (LEVEL_SQRT_3_4 * Rs);
566 + samples[i] = Lt + Lss;
567 + samples[i + 256] = Rt + Rss;
574 + dca_sample_t cc, surround, Lt, Rt;
576 + for (i = 0; i < 256; i++) {
578 + cc = samples[i] * LEVEL_3DB;
580 + surround = samples[i + 768] + samples[i + 1024];
582 + Lt = samples[i + 256] + cc;
583 + Rt = samples[i + 512] + cc;
585 + samples[i] = Lt - surround;
586 + samples[i + 256] = Rt + surround;
593 +static void move2to1 (dca_sample_t * src, dca_sample_t * dest, dca_sample_t bias)
598 dest[i] = BIAS (src[i] + src[i + 256]);
601 -static void zero (sample_t * samples)
602 +static void zero (dca_sample_t * samples)
610 -void dca_downmix (sample_t * samples, int acmod, int output, sample_t bias,
611 - level_t clev, level_t slev)
612 +void dca_downmix (dca_sample_t * samples, int acmod, int output, dca_sample_t bias,
613 + dca_level_t clev, dca_level_t slev)
620 case CONVERT (DCA_MONO, DCA_DOLBY):
621 - memcpy (samples + 256, samples, 256 * sizeof (sample_t));
622 + memcpy (samples + 256, samples, 256 * sizeof (dca_sample_t));
625 case CONVERT (DCA_3F, DCA_STEREO):
629 case CONVERT (DCA_3F2R, DCA_DOLBY):
630 - mix32toS (samples, bias);
631 + mix32toS (samples, bias, 0);
634 case CONVERT (DCA_3F1R, DCA_3F):
637 case CONVERT (DCA_3F1R, DCA_2F1R):
638 mix3to2 (samples, bias);
639 - memcpy (samples + 512, samples + 768, 256 * sizeof (sample_t));
640 + memcpy (samples + 512, samples + 768, 256 * sizeof (dca_sample_t));
643 case CONVERT (DCA_2F2R, DCA_2F1R):
644 @@ -608,30 +655,52 @@
646 case CONVERT (DCA_3F2R, DCA_3F1R):
647 mix2to1 (samples + 768, samples + 1024, bias);
648 + /* deal with the special-case 5.0 to 4.0 DPL mix */
649 + if (output & DCA_OUT_DPLI)
651 + mix31toS (samples, bias);
655 case CONVERT (DCA_2F1R, DCA_2F2R):
656 - memcpy (samples + 768, samples + 512, 256 * sizeof (sample_t));
657 + memcpy (samples + 768, samples + 512, 256 * sizeof (dca_sample_t));
660 case CONVERT (DCA_3F1R, DCA_2F2R):
661 mix3to2 (samples, bias);
662 - memcpy (samples + 512, samples + 768, 256 * sizeof (sample_t));
663 + memcpy (samples + 512, samples + 768, 256 * sizeof (dca_sample_t));
666 case CONVERT (DCA_3F2R, DCA_2F2R):
667 mix3to2 (samples, bias);
668 - memcpy (samples + 512, samples + 768, 256 * sizeof (sample_t));
669 - memcpy (samples + 768, samples + 1024, 256 * sizeof (sample_t));
670 + memcpy (samples + 512, samples + 768, 256 * sizeof (dca_sample_t));
671 + memcpy (samples + 768, samples + 1024, 256 * sizeof (dca_sample_t));
674 case CONVERT (DCA_3F1R, DCA_3F2R):
675 - memcpy (samples + 1024, samples + 768, 256 * sizeof (sample_t));
676 + memcpy (samples + 1024, samples + 768, 256 * sizeof (dca_sample_t));
679 + /* deal with the special-case DPL mixes */
681 + case CONVERT (DCA_3F1R, DCA_3F1R):
682 + if (output & DCA_OUT_DPLI)
684 + mix31toS (samples, bias);
688 + case CONVERT (DCA_3F2R, DCA_3F2R):
689 + if (output & DCA_OUT_DPLII)
691 + mix32toS (samples, bias, 1);
698 -void dca_upmix (sample_t * samples, int acmod, int output)
699 +void dca_upmix (dca_sample_t * samples, int acmod, int output)
701 switch (CONVERT (acmod, output & DCA_CHANNEL_MASK)) {
704 case CONVERT (DCA_3F, DCA_STEREO):
705 case CONVERT (DCA_3F, DCA_DOLBY):
707 - memcpy (samples + 512, samples + 256, 256 * sizeof (sample_t));
708 + memcpy (samples + 512, samples + 256, 256 * sizeof (dca_sample_t));
709 zero (samples + 256);
712 @@ -684,11 +753,11 @@
713 zero (samples + 1024);
714 case CONVERT (DCA_3F1R, DCA_2F1R):
716 - memcpy (samples + 768, samples + 512, 256 * sizeof (sample_t));
717 + memcpy (samples + 768, samples + 512, 256 * sizeof (dca_sample_t));
720 case CONVERT (DCA_3F2R, DCA_2F2R):
721 - memcpy (samples + 1024, samples + 768, 256 * sizeof (sample_t));
722 + memcpy (samples + 1024, samples + 768, 256 * sizeof (dca_sample_t));
726 diff -Naur libdca/libdca/parse.c libdca_patched/libdca/parse.c
727 --- libdca/libdca/parse.c 2007-05-02 10:05:05.000000000 +0100
728 +++ libdca_patched/libdca/parse.c 2007-05-02 10:09:33.000000000 +0100
730 static int decode_blockcode (int code, int levels, int *values);
732 static void qmf_32_subbands (dca_state_t * state, int chans,
733 - double samples_in[32][8], sample_t *samples_out,
734 - double rScale, sample_t bias);
735 + double samples_in[32][8], dca_sample_t *samples_out,
736 + double rScale, dca_sample_t bias);
738 static void lfe_interpolation_fir (int nDecimationSelect, int nNumDeciSample,
739 - double *samples_in, sample_t *samples_out,
740 - double rScale, sample_t bias );
741 + double *samples_in, dca_sample_t *samples_out,
742 + double rScale, dca_sample_t bias );
744 static void pre_calc_cosmod( dca_state_t * state );
748 memset (state, 0, sizeof(dca_state_t));
750 - state->samples = (sample_t *) memalign (16, 256 * 12 * sizeof (sample_t));
751 + state->samples = (dca_sample_t *) memalign (16, 256 * 12 * sizeof (dca_sample_t));
752 if (state->samples == NULL) {
759 -sample_t * dca_samples (dca_state_t * state)
760 +dca_sample_t * dca_samples (dca_state_t * state)
762 return state->samples;
767 int dca_frame (dca_state_t * state, uint8_t * buf, int * flags,
768 - level_t * level, sample_t bias)
769 + dca_level_t * level, dca_sample_t bias)
772 static float adj_table[] = { 1.0, 1.1250, 1.2500, 1.4375 };
775 dca_upmix (state->samples, state->amode, state->output);
777 - if (state->prim_channels > dca_channels[state->output & DCA_CHANNEL_MASK])
778 + if (state->prim_channels >= dca_channels[state->output & DCA_CHANNEL_MASK])
780 dca_downmix (state->samples, state->amode, state->output, state->bias,
781 state->clev, state->slev);
782 @@ -1142,8 +1142,8 @@
785 static void qmf_32_subbands (dca_state_t * state, int chans,
786 - double samples_in[32][8], sample_t *samples_out,
787 - double scale, sample_t bias)
788 + double samples_in[32][8], dca_sample_t *samples_out,
789 + double scale, dca_sample_t bias)
793 @@ -1224,8 +1224,8 @@
796 static void lfe_interpolation_fir (int nDecimationSelect, int nNumDeciSample,
797 - double *samples_in, sample_t *samples_out,
798 - double scale, sample_t bias)
799 + double *samples_in, dca_sample_t *samples_out,
800 + double scale, dca_sample_t bias)
802 /* samples_in: An array holding decimated samples.
803 * Samples in current subframe starts from samples_in[0],
804 @@ -1275,7 +1275,7 @@
807 void dca_dynrng (dca_state_t * state,
808 - level_t (* call) (level_t, void *), void * data)
809 + dca_level_t (* call) (dca_level_t, void *), void * data)
813 diff -Naur libdca/src/dcadec.c libdca_patched/src/dcadec.c
814 --- libdca/src/dcadec.c 2007-05-02 10:05:04.000000000 +0100
815 +++ libdca_patched/src/dcadec.c 2007-05-02 10:09:35.000000000 +0100
816 @@ -280,15 +280,15 @@
818 bufpos = buf + length;
826 if (output->setup (output, sample_rate, &flags, &level, &bias))
829 flags |= DCA_ADJUST_LEVEL;
830 - level = (level_t) (level * gain);
831 + level = (dca_level_t) (level * gain);
832 if (dca_frame (state, buf, &flags, &level, bias))