36void mad_synth_init(
struct mad_synth *synth)
38 mad_synth_mute(synth);
42 synth->pcm.samplerate = 0;
43 synth->pcm.channels = 0;
44 synth->pcm.length = 0;
51void mad_synth_mute(
struct mad_synth *synth)
53 unsigned int ch, s, v;
55 for (ch = 0; ch < 2; ++ch) {
56 for (s = 0; s < 16; ++s) {
57 for (v = 0; v < 8; ++v) {
58 synth->filter[ch][0][0][s][v] = synth->filter[ch][0][1][s][v] =
59 synth->filter[ch][1][0][s][v] = synth->filter[ch][1][1][s][v] = 0;
91# if defined(FPM_DEFAULT) && !defined(OPT_SSO)
98# define SHIFT(x) (((x) + (1L << 11)) >> 12)
105# if defined(OPT_SPEED) && defined(MAD_F_MLX)
108 ({ mad_fixed64hi_t hi; \
109 mad_fixed64lo_t lo; \
110 MAD_F_MLX(hi, lo, (x), (y)); \
111 hi << (32 - MAD_F_SCALEBITS - 3); \
115# define MUL(x, y) mad_f_mul((x), (y))
123void dct32(mad_fixed_t
const in[32],
unsigned int slot,
124 mad_fixed_t lo[16][8], mad_fixed_t hi[16][8])
126 mad_fixed_t t0, t1, t2, t3, t4, t5, t6, t7;
127 mad_fixed_t t8, t9, t10, t11, t12, t13, t14, t15;
128 mad_fixed_t t16, t17, t18, t19, t20, t21, t22, t23;
129 mad_fixed_t t24, t25, t26, t27, t28, t29, t30, t31;
130 mad_fixed_t t32, t33, t34, t35, t36, t37, t38, t39;
131 mad_fixed_t t40, t41, t42, t43, t44, t45, t46, t47;
132 mad_fixed_t t48, t49, t50, t51, t52, t53, t54, t55;
133 mad_fixed_t t56, t57, t58, t59, t60, t61, t62, t63;
134 mad_fixed_t t64, t65, t66, t67, t68, t69, t70, t71;
135 mad_fixed_t t72, t73, t74, t75, t76, t77, t78, t79;
136 mad_fixed_t t80, t81, t82, t83, t84, t85, t86, t87;
137 mad_fixed_t t88, t89, t90, t91, t92, t93, t94, t95;
138 mad_fixed_t t96, t97, t98, t99, t100, t101, t102, t103;
139 mad_fixed_t t104, t105, t106, t107, t108, t109, t110, t111;
140 mad_fixed_t t112, t113, t114, t115, t116, t117, t118, t119;
141 mad_fixed_t t120, t121, t122, t123, t124, t125, t126, t127;
142 mad_fixed_t t128, t129, t130, t131, t132, t133, t134, t135;
143 mad_fixed_t t136, t137, t138, t139, t140, t141, t142, t143;
144 mad_fixed_t t144, t145, t146, t147, t148, t149, t150, t151;
145 mad_fixed_t t152, t153, t154, t155, t156, t157, t158, t159;
146 mad_fixed_t t160, t161, t162, t163, t164, t165, t166, t167;
147 mad_fixed_t t168, t169, t170, t171, t172, t173, t174, t175;
152# if defined(OPT_DCTO)
153# define costab1 MAD_F(0x7fd8878e)
154# define costab2 MAD_F(0x7f62368f)
155# define costab3 MAD_F(0x7e9d55fc)
156# define costab4 MAD_F(0x7d8a5f40)
157# define costab5 MAD_F(0x7c29fbee)
158# define costab6 MAD_F(0x7a7d055b)
159# define costab7 MAD_F(0x78848414)
160# define costab8 MAD_F(0x7641af3d)
161# define costab9 MAD_F(0x73b5ebd1)
162# define costab10 MAD_F(0x70e2cbc6)
163# define costab11 MAD_F(0x6dca0d14)
164# define costab12 MAD_F(0x6a6d98a4)
165# define costab13 MAD_F(0x66cf8120)
166# define costab14 MAD_F(0x62f201ac)
167# define costab15 MAD_F(0x5ed77c8a)
168# define costab16 MAD_F(0x5a82799a)
169# define costab17 MAD_F(0x55f5a4d2)
170# define costab18 MAD_F(0x5133cc94)
171# define costab19 MAD_F(0x4c3fdff4)
172# define costab20 MAD_F(0x471cece7)
173# define costab21 MAD_F(0x41ce1e65)
174# define costab22 MAD_F(0x3c56ba70)
175# define costab23 MAD_F(0x36ba2014)
176# define costab24 MAD_F(0x30fbc54d)
177# define costab25 MAD_F(0x2b1f34eb)
178# define costab26 MAD_F(0x25280c5e)
179# define costab27 MAD_F(0x1f19f97b)
180# define costab28 MAD_F(0x18f8b83c)
181# define costab29 MAD_F(0x12c8106f)
182# define costab30 MAD_F(0x0c8bd35e)
183# define costab31 MAD_F(0x0647d97c)
185# define costab1 MAD_F(0x0ffb10f2)
186# define costab2 MAD_F(0x0fec46d2)
187# define costab3 MAD_F(0x0fd3aac0)
188# define costab4 MAD_F(0x0fb14be8)
189# define costab5 MAD_F(0x0f853f7e)
190# define costab6 MAD_F(0x0f4fa0ab)
191# define costab7 MAD_F(0x0f109082)
192# define costab8 MAD_F(0x0ec835e8)
193# define costab9 MAD_F(0x0e76bd7a)
194# define costab10 MAD_F(0x0e1c5979)
195# define costab11 MAD_F(0x0db941a3)
196# define costab12 MAD_F(0x0d4db315)
197# define costab13 MAD_F(0x0cd9f024)
198# define costab14 MAD_F(0x0c5e4036)
199# define costab15 MAD_F(0x0bdaef91)
200# define costab16 MAD_F(0x0b504f33)
201# define costab17 MAD_F(0x0abeb49a)
202# define costab18 MAD_F(0x0a267993)
203# define costab19 MAD_F(0x0987fbfe)
204# define costab20 MAD_F(0x08e39d9d)
205# define costab21 MAD_F(0x0839c3cd)
206# define costab22 MAD_F(0x078ad74e)
207# define costab23 MAD_F(0x06d74402)
208# define costab24 MAD_F(0x061f78aa)
209# define costab25 MAD_F(0x0563e69d)
210# define costab26 MAD_F(0x04a5018c)
211# define costab27 MAD_F(0x03e33f2f)
212# define costab28 MAD_F(0x031f1708)
213# define costab29 MAD_F(0x0259020e)
214# define costab30 MAD_F(0x01917a6c)
215# define costab31 MAD_F(0x00c8fb30)
218 t0 = in[0] + in[31]; t16 = MUL(in[0] - in[31], costab1);
219 t1 = in[15] + in[16]; t17 = MUL(in[15] - in[16], costab31);
222 t59 = MUL(t16 - t17, costab2);
224 t50 = MUL(t0 - t1, costab2);
226 t2 = in[7] + in[24]; t18 = MUL(in[7] - in[24], costab15);
227 t3 = in[8] + in[23]; t19 = MUL(in[8] - in[23], costab17);
230 t60 = MUL(t18 - t19, costab30);
232 t51 = MUL(t2 - t3, costab30);
234 t4 = in[3] + in[28]; t20 = MUL(in[3] - in[28], costab7);
235 t5 = in[12] + in[19]; t21 = MUL(in[12] - in[19], costab25);
238 t61 = MUL(t20 - t21, costab14);
240 t52 = MUL(t4 - t5, costab14);
242 t6 = in[4] + in[27]; t22 = MUL(in[4] - in[27], costab9);
243 t7 = in[11] + in[20]; t23 = MUL(in[11] - in[20], costab23);
246 t62 = MUL(t22 - t23, costab18);
248 t53 = MUL(t6 - t7, costab18);
250 t8 = in[1] + in[30]; t24 = MUL(in[1] - in[30], costab3);
251 t9 = in[14] + in[17]; t25 = MUL(in[14] - in[17], costab29);
254 t63 = MUL(t24 - t25, costab6);
256 t54 = MUL(t8 - t9, costab6);
258 t10 = in[6] + in[25]; t26 = MUL(in[6] - in[25], costab13);
259 t11 = in[9] + in[22]; t27 = MUL(in[9] - in[22], costab19);
262 t64 = MUL(t26 - t27, costab26);
264 t55 = MUL(t10 - t11, costab26);
266 t12 = in[2] + in[29]; t28 = MUL(in[2] - in[29], costab5);
267 t13 = in[13] + in[18]; t29 = MUL(in[13] - in[18], costab27);
270 t65 = MUL(t28 - t29, costab10);
272 t56 = MUL(t12 - t13, costab10);
274 t14 = in[5] + in[26]; t30 = MUL(in[5] - in[26], costab11);
275 t15 = in[10] + in[21]; t31 = MUL(in[10] - in[21], costab21);
278 t66 = MUL(t30 - t31, costab22);
280 t57 = MUL(t14 - t15, costab22);
282 t69 = t33 + t34; t89 = MUL(t33 - t34, costab4);
283 t70 = t35 + t36; t90 = MUL(t35 - t36, costab28);
284 t71 = t37 + t38; t91 = MUL(t37 - t38, costab12);
285 t72 = t39 + t40; t92 = MUL(t39 - t40, costab20);
286 t73 = t41 + t42; t94 = MUL(t41 - t42, costab4);
287 t74 = t43 + t44; t95 = MUL(t43 - t44, costab28);
288 t75 = t45 + t46; t96 = MUL(t45 - t46, costab12);
289 t76 = t47 + t48; t97 = MUL(t47 - t48, costab20);
291 t78 = t50 + t51; t100 = MUL(t50 - t51, costab4);
292 t79 = t52 + t53; t101 = MUL(t52 - t53, costab28);
293 t80 = t54 + t55; t102 = MUL(t54 - t55, costab12);
294 t81 = t56 + t57; t103 = MUL(t56 - t57, costab20);
296 t83 = t59 + t60; t106 = MUL(t59 - t60, costab4);
297 t84 = t61 + t62; t107 = MUL(t61 - t62, costab28);
298 t85 = t63 + t64; t108 = MUL(t63 - t64, costab12);
299 t86 = t65 + t66; t109 = MUL(t65 - t66, costab20);
304 hi[15][slot] = SHIFT(t113 + t114);
305 lo[ 0][slot] = SHIFT(MUL(t113 - t114, costab16));
312 hi[14][slot] = SHIFT(t32);
319 hi[13][slot] = SHIFT(t58);
326 t49 = (t67 * 2) - t32;
328 hi[12][slot] = SHIFT(t49);
335 hi[11][slot] = SHIFT(t93);
342 t68 = (t98 * 2) - t49;
344 hi[10][slot] = SHIFT(t68);
351 t82 = (t104 * 2) - t58;
353 hi[ 9][slot] = SHIFT(t82);
360 t87 = (t110 * 2) - t67;
362 t77 = (t87 * 2) - t68;
364 hi[ 8][slot] = SHIFT(t77);
366 t141 = MUL(t69 - t70, costab8);
367 t142 = MUL(t71 - t72, costab24);
370 hi[ 7][slot] = SHIFT(t143);
372 SHIFT((MUL(t141 - t142, costab16) * 2) - t143);
374 t144 = MUL(t73 - t74, costab8);
375 t145 = MUL(t75 - t76, costab24);
378 t88 = (t146 * 2) - t77;
380 hi[ 6][slot] = SHIFT(t88);
382 t148 = MUL(t78 - t79, costab8);
383 t149 = MUL(t80 - t81, costab24);
386 t105 = (t150 * 2) - t82;
388 hi[ 5][slot] = SHIFT(t105);
390 t152 = MUL(t83 - t84, costab8);
391 t153 = MUL(t85 - t86, costab24);
394 t111 = (t154 * 2) - t87;
396 t99 = (t111 * 2) - t88;
398 hi[ 4][slot] = SHIFT(t99);
400 t157 = MUL(t89 - t90, costab8);
401 t158 = MUL(t91 - t92, costab24);
404 t127 = (t159 * 2) - t93;
406 hi[ 3][slot] = SHIFT(t127);
408 t160 = (MUL(t125 - t126, costab16) * 2) - t127;
410 lo[ 4][slot] = SHIFT(t160);
412 SHIFT((((MUL(t157 - t158, costab16) * 2) - t159) * 2) - t160);
414 t161 = MUL(t94 - t95, costab8);
415 t162 = MUL(t96 - t97, costab24);
418 t130 = (t163 * 2) - t98;
420 t112 = (t130 * 2) - t99;
422 hi[ 2][slot] = SHIFT(t112);
424 t164 = (MUL(t128 - t129, costab16) * 2) - t130;
426 t166 = MUL(t100 - t101, costab8);
427 t167 = MUL(t102 - t103, costab24);
430 t134 = (t168 * 2) - t104;
432 t120 = (t134 * 2) - t105;
434 hi[ 1][slot] = SHIFT(t120);
436 t135 = (MUL(t118 - t119, costab16) * 2) - t120;
438 lo[ 2][slot] = SHIFT(t135);
440 t169 = (MUL(t132 - t133, costab16) * 2) - t134;
442 t151 = (t169 * 2) - t135;
444 lo[ 6][slot] = SHIFT(t151);
446 t170 = (((MUL(t148 - t149, costab16) * 2) - t150) * 2) - t151;
448 lo[10][slot] = SHIFT(t170);
450 SHIFT((((((MUL(t166 - t167, costab16) * 2) -
451 t168) * 2) - t169) * 2) - t170);
453 t171 = MUL(t106 - t107, costab8);
454 t172 = MUL(t108 - t109, costab24);
457 t138 = (t173 * 2) - t110;
459 t123 = (t138 * 2) - t111;
461 t139 = (MUL(t121 - t122, costab16) * 2) - t123;
463 t117 = (t123 * 2) - t112;
465 hi[ 0][slot] = SHIFT(t117);
467 t124 = (MUL(t115 - t116, costab16) * 2) - t117;
469 lo[ 1][slot] = SHIFT(t124);
471 t131 = (t139 * 2) - t124;
473 lo[ 3][slot] = SHIFT(t131);
475 t140 = (t164 * 2) - t131;
477 lo[ 5][slot] = SHIFT(t140);
479 t174 = (MUL(t136 - t137, costab16) * 2) - t138;
481 t155 = (t174 * 2) - t139;
483 t147 = (t155 * 2) - t140;
485 lo[ 7][slot] = SHIFT(t147);
487 t156 = (((MUL(t144 - t145, costab16) * 2) - t146) * 2) - t147;
489 lo[ 9][slot] = SHIFT(t156);
491 t175 = (((MUL(t152 - t153, costab16) * 2) - t154) * 2) - t155;
493 t165 = (t175 * 2) - t156;
495 lo[11][slot] = SHIFT(t165);
497 t176 = (((((MUL(t161 - t162, costab16) * 2) -
498 t163) * 2) - t164) * 2) - t165;
500 lo[13][slot] = SHIFT(t176);
502 SHIFT((((((((MUL(t171 - t172, costab16) * 2) -
503 t173) * 2) - t174) * 2) - t175) * 2) - t176);
520# if MAD_F_FRACBITS != 28
521# error "MAD_F_FRACBITS must be 28 to use OPT_SSO"
523# define ML0(hi, lo, x, y) ((lo) = (x) * (y))
524# define MLA(hi, lo, x, y) ((lo) += (x) * (y))
525# define MLN(hi, lo) ((lo) = -(lo))
526# define MLZ(hi, lo) ((void) (hi), (mad_fixed_t) (lo))
527# define SHIFT(x) ((x) >> 2)
528# define PRESHIFT(x) ((MAD_F(x) + (1L << 13)) >> 14)
530# define ML0(hi, lo, x, y) MAD_F_ML0((hi), (lo), (x), (y))
531# define MLA(hi, lo, x, y) MAD_F_MLA((hi), (lo), (x), (y))
532# define MLN(hi, lo) MAD_F_MLN((hi), (lo))
533# define MLZ(hi, lo) MAD_F_MLZ((hi), (lo))
535# if defined(MAD_F_SCALEBITS)
536# undef MAD_F_SCALEBITS
537# define MAD_F_SCALEBITS (MAD_F_FRACBITS - 12)
538# define PRESHIFT(x) (MAD_F(x) >> 12)
540# define PRESHIFT(x) MAD_F(x)
545mad_fixed_t
const D[17][32] = {
549# if defined(ASO_SYNTH)
551 unsigned int,
unsigned int);
559 unsigned int nch,
unsigned int ns)
561 unsigned int phase, ch, s, sb, pe, po;
562 mad_fixed_t *pcm1, *pcm2, (*filter)[2][2][16][8];
563 mad_fixed_t
const (*sbsample)[36][32];
564 register mad_fixed_t (*fe)[8], (*fx)[8], (*fo)[8];
565 register mad_fixed_t
const (*Dptr)[32], *ptr;
566 register mad_fixed64hi_t hi;
567 register mad_fixed64lo_t lo;
569 for (ch = 0; ch < nch; ++ch) {
570 sbsample = &frame->sbsample[ch];
571 filter = &synth->filter[ch];
572 phase = synth->phase;
573 pcm1 = synth->pcm.samples[ch];
575 for (s = 0; s < ns; ++s) {
576 dct32((*sbsample)[s], phase >> 1,
577 (*filter)[0][phase & 1], (*filter)[1][phase & 1]);
580 po = ((phase - 1) & 0xf) | 1;
584 fe = &(*filter)[0][ phase & 1][0];
585 fx = &(*filter)[0][~phase & 1][0];
586 fo = &(*filter)[1][~phase & 1][0];
591 ML0(hi, lo, (*fx)[0], ptr[ 0]);
592 MLA(hi, lo, (*fx)[1], ptr[14]);
593 MLA(hi, lo, (*fx)[2], ptr[12]);
594 MLA(hi, lo, (*fx)[3], ptr[10]);
595 MLA(hi, lo, (*fx)[4], ptr[ 8]);
596 MLA(hi, lo, (*fx)[5], ptr[ 6]);
597 MLA(hi, lo, (*fx)[6], ptr[ 4]);
598 MLA(hi, lo, (*fx)[7], ptr[ 2]);
602 MLA(hi, lo, (*fe)[0], ptr[ 0]);
603 MLA(hi, lo, (*fe)[1], ptr[14]);
604 MLA(hi, lo, (*fe)[2], ptr[12]);
605 MLA(hi, lo, (*fe)[3], ptr[10]);
606 MLA(hi, lo, (*fe)[4], ptr[ 8]);
607 MLA(hi, lo, (*fe)[5], ptr[ 6]);
608 MLA(hi, lo, (*fe)[6], ptr[ 4]);
609 MLA(hi, lo, (*fe)[7], ptr[ 2]);
611 *pcm1++ = SHIFT(MLZ(hi, lo));
615 for (sb = 1; sb < 16; ++sb) {
622 ML0(hi, lo, (*fo)[0], ptr[ 0]);
623 MLA(hi, lo, (*fo)[1], ptr[14]);
624 MLA(hi, lo, (*fo)[2], ptr[12]);
625 MLA(hi, lo, (*fo)[3], ptr[10]);
626 MLA(hi, lo, (*fo)[4], ptr[ 8]);
627 MLA(hi, lo, (*fo)[5], ptr[ 6]);
628 MLA(hi, lo, (*fo)[6], ptr[ 4]);
629 MLA(hi, lo, (*fo)[7], ptr[ 2]);
633 MLA(hi, lo, (*fe)[7], ptr[ 2]);
634 MLA(hi, lo, (*fe)[6], ptr[ 4]);
635 MLA(hi, lo, (*fe)[5], ptr[ 6]);
636 MLA(hi, lo, (*fe)[4], ptr[ 8]);
637 MLA(hi, lo, (*fe)[3], ptr[10]);
638 MLA(hi, lo, (*fe)[2], ptr[12]);
639 MLA(hi, lo, (*fe)[1], ptr[14]);
640 MLA(hi, lo, (*fe)[0], ptr[ 0]);
642 *pcm1++ = SHIFT(MLZ(hi, lo));
645 ML0(hi, lo, (*fe)[0], ptr[31 - 16]);
646 MLA(hi, lo, (*fe)[1], ptr[31 - 14]);
647 MLA(hi, lo, (*fe)[2], ptr[31 - 12]);
648 MLA(hi, lo, (*fe)[3], ptr[31 - 10]);
649 MLA(hi, lo, (*fe)[4], ptr[31 - 8]);
650 MLA(hi, lo, (*fe)[5], ptr[31 - 6]);
651 MLA(hi, lo, (*fe)[6], ptr[31 - 4]);
652 MLA(hi, lo, (*fe)[7], ptr[31 - 2]);
655 MLA(hi, lo, (*fo)[7], ptr[31 - 2]);
656 MLA(hi, lo, (*fo)[6], ptr[31 - 4]);
657 MLA(hi, lo, (*fo)[5], ptr[31 - 6]);
658 MLA(hi, lo, (*fo)[4], ptr[31 - 8]);
659 MLA(hi, lo, (*fo)[3], ptr[31 - 10]);
660 MLA(hi, lo, (*fo)[2], ptr[31 - 12]);
661 MLA(hi, lo, (*fo)[1], ptr[31 - 14]);
662 MLA(hi, lo, (*fo)[0], ptr[31 - 16]);
664 *pcm2-- = SHIFT(MLZ(hi, lo));
672 ML0(hi, lo, (*fo)[0], ptr[ 0]);
673 MLA(hi, lo, (*fo)[1], ptr[14]);
674 MLA(hi, lo, (*fo)[2], ptr[12]);
675 MLA(hi, lo, (*fo)[3], ptr[10]);
676 MLA(hi, lo, (*fo)[4], ptr[ 8]);
677 MLA(hi, lo, (*fo)[5], ptr[ 6]);
678 MLA(hi, lo, (*fo)[6], ptr[ 4]);
679 MLA(hi, lo, (*fo)[7], ptr[ 2]);
681 *pcm1 = SHIFT(-MLZ(hi, lo));
684 phase = (phase + 1) % 16;
696 unsigned int nch,
unsigned int ns)
698 unsigned int phase, ch, s, sb, pe, po;
699 mad_fixed_t *pcm1, *pcm2, (*filter)[2][2][16][8];
700 mad_fixed_t
const (*sbsample)[36][32];
701 register mad_fixed_t (*fe)[8], (*fx)[8], (*fo)[8];
702 register mad_fixed_t
const (*Dptr)[32], *ptr;
703 register mad_fixed64hi_t hi;
704 register mad_fixed64lo_t lo;
706 for (ch = 0; ch < nch; ++ch) {
707 sbsample = &frame->sbsample[ch];
708 filter = &synth->filter[ch];
709 phase = synth->phase;
710 pcm1 = synth->pcm.samples[ch];
712 for (s = 0; s < ns; ++s) {
713 dct32((*sbsample)[s], phase >> 1,
714 (*filter)[0][phase & 1], (*filter)[1][phase & 1]);
717 po = ((phase - 1) & 0xf) | 1;
721 fe = &(*filter)[0][ phase & 1][0];
722 fx = &(*filter)[0][~phase & 1][0];
723 fo = &(*filter)[1][~phase & 1][0];
728 ML0(hi, lo, (*fx)[0], ptr[ 0]);
729 MLA(hi, lo, (*fx)[1], ptr[14]);
730 MLA(hi, lo, (*fx)[2], ptr[12]);
731 MLA(hi, lo, (*fx)[3], ptr[10]);
732 MLA(hi, lo, (*fx)[4], ptr[ 8]);
733 MLA(hi, lo, (*fx)[5], ptr[ 6]);
734 MLA(hi, lo, (*fx)[6], ptr[ 4]);
735 MLA(hi, lo, (*fx)[7], ptr[ 2]);
739 MLA(hi, lo, (*fe)[0], ptr[ 0]);
740 MLA(hi, lo, (*fe)[1], ptr[14]);
741 MLA(hi, lo, (*fe)[2], ptr[12]);
742 MLA(hi, lo, (*fe)[3], ptr[10]);
743 MLA(hi, lo, (*fe)[4], ptr[ 8]);
744 MLA(hi, lo, (*fe)[5], ptr[ 6]);
745 MLA(hi, lo, (*fe)[6], ptr[ 4]);
746 MLA(hi, lo, (*fe)[7], ptr[ 2]);
748 *pcm1++ = SHIFT(MLZ(hi, lo));
752 for (sb = 1; sb < 16; ++sb) {
760 ML0(hi, lo, (*fo)[0], ptr[ 0]);
761 MLA(hi, lo, (*fo)[1], ptr[14]);
762 MLA(hi, lo, (*fo)[2], ptr[12]);
763 MLA(hi, lo, (*fo)[3], ptr[10]);
764 MLA(hi, lo, (*fo)[4], ptr[ 8]);
765 MLA(hi, lo, (*fo)[5], ptr[ 6]);
766 MLA(hi, lo, (*fo)[6], ptr[ 4]);
767 MLA(hi, lo, (*fo)[7], ptr[ 2]);
771 MLA(hi, lo, (*fe)[7], ptr[ 2]);
772 MLA(hi, lo, (*fe)[6], ptr[ 4]);
773 MLA(hi, lo, (*fe)[5], ptr[ 6]);
774 MLA(hi, lo, (*fe)[4], ptr[ 8]);
775 MLA(hi, lo, (*fe)[3], ptr[10]);
776 MLA(hi, lo, (*fe)[2], ptr[12]);
777 MLA(hi, lo, (*fe)[1], ptr[14]);
778 MLA(hi, lo, (*fe)[0], ptr[ 0]);
780 *pcm1++ = SHIFT(MLZ(hi, lo));
783 ML0(hi, lo, (*fo)[7], ptr[31 - 2]);
784 MLA(hi, lo, (*fo)[6], ptr[31 - 4]);
785 MLA(hi, lo, (*fo)[5], ptr[31 - 6]);
786 MLA(hi, lo, (*fo)[4], ptr[31 - 8]);
787 MLA(hi, lo, (*fo)[3], ptr[31 - 10]);
788 MLA(hi, lo, (*fo)[2], ptr[31 - 12]);
789 MLA(hi, lo, (*fo)[1], ptr[31 - 14]);
790 MLA(hi, lo, (*fo)[0], ptr[31 - 16]);
793 MLA(hi, lo, (*fe)[0], ptr[31 - 16]);
794 MLA(hi, lo, (*fe)[1], ptr[31 - 14]);
795 MLA(hi, lo, (*fe)[2], ptr[31 - 12]);
796 MLA(hi, lo, (*fe)[3], ptr[31 - 10]);
797 MLA(hi, lo, (*fe)[4], ptr[31 - 8]);
798 MLA(hi, lo, (*fe)[5], ptr[31 - 6]);
799 MLA(hi, lo, (*fe)[6], ptr[31 - 4]);
800 MLA(hi, lo, (*fe)[7], ptr[31 - 2]);
802 *pcm2-- = SHIFT(MLZ(hi, lo));
811 ML0(hi, lo, (*fo)[0], ptr[ 0]);
812 MLA(hi, lo, (*fo)[1], ptr[14]);
813 MLA(hi, lo, (*fo)[2], ptr[12]);
814 MLA(hi, lo, (*fo)[3], ptr[10]);
815 MLA(hi, lo, (*fo)[4], ptr[ 8]);
816 MLA(hi, lo, (*fo)[5], ptr[ 6]);
817 MLA(hi, lo, (*fo)[6], ptr[ 4]);
818 MLA(hi, lo, (*fo)[7], ptr[ 2]);
820 *pcm1 = SHIFT(-MLZ(hi, lo));
823 phase = (phase + 1) % 16;
834 unsigned int nch, ns;
836 unsigned int,
unsigned int);
838 nch = MAD_NCHANNELS(&frame->header);
839 ns = MAD_NSBSAMPLES(&frame->header);
841 synth->pcm.samplerate = frame->header.samplerate;
842 synth->pcm.channels = nch;
843 synth->pcm.length = 32 * ns;
845 synth_frame = synth_full;
847 if (frame->options & MAD_OPTION_HALFSAMPLERATE) {
848 synth->pcm.samplerate /= 2;
849 synth->pcm.length /= 2;
851 synth_frame = synth_half;
854 synth_frame(synth, frame, nch, ns);
856 synth->phase = (synth->phase + ns) % 16;