class library: SynthDesc - gui fix
[supercollider.git] / server / plugins / MulAddUGens.cpp
blob7cb85e7ca32854cec7d2be97fa3dc69f286df7a6
1 /*
2 SuperCollider real time audio synthesis system
3 Copyright (c) 2002 James McCartney. All rights reserved.
4 http://www.audiosynth.com
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 #include "SC_PlugIn.h"
26 #ifdef NOVA_SIMD
27 #include "simd_memory.hpp"
28 #include "simd_binary_arithmetic.hpp"
29 #include "simd_ternary_arithmetic.hpp"
31 using nova::wrap_argument;
33 #if defined(__GNUC__) && !defined(__clang__)
34 #define inline_functions __attribute__ ((flatten))
35 #else
36 #define inline_functions
37 #endif
40 #endif
44 static InterfaceTable *ft;
46 //////////////////////////////////////////////////////////////////////////////////////////////////
48 #define MULIN IN(1)
49 #define ADDIN IN(2)
51 struct MulAdd : public Unit
53 float mPrevMul, mPrevAdd;
56 extern "C"
58 void MulAdd_Ctor(MulAdd *unit);
60 // mul add functions for every occasion:
61 void ampmix_k(MulAdd *unit, int inNumSamples);
63 void ampmix_aa(MulAdd *unit, int inNumSamples);
64 void ampmix_ak(MulAdd *unit, int inNumSamples);
65 void ampmix_ai(MulAdd *unit, int inNumSamples);
67 void ampmix_ka(MulAdd *unit, int inNumSamples);
68 void ampmix_kk(MulAdd *unit, int inNumSamples);
69 void ampmix_ki(MulAdd *unit, int inNumSamples);
71 void ampmix_ia(MulAdd *unit, int inNumSamples);
72 void ampmix_ik(MulAdd *unit, int inNumSamples);
73 void ampmix_ii(MulAdd *unit, int inNumSamples);
76 ////////////////////////////////////////////////////////////////////////////////////////////////////////
79 void ampmix_k(MulAdd *unit, int inNumSamples);
80 void ampmix_k(MulAdd *unit, int inNumSamples)
82 ZOUT0(0) = ZIN0(0) * MULIN[0] + ADDIN[0];
85 void ampmix_aa(MulAdd *unit, int inNumSamples);
86 void ampmix_aa(MulAdd *unit, int inNumSamples)
88 float *in = ZIN(0);
89 float *out = ZOUT(0);
90 float *amp = MULIN - ZOFF;
91 float *mix = ADDIN - ZOFF;
93 LOOP1(inNumSamples, ZXP(out) = ZXP(amp) * ZXP(in) + ZXP(mix); );
96 void ampmix_ak(MulAdd *unit, int inNumSamples);
97 void ampmix_ak(MulAdd *unit, int inNumSamples)
99 float *in = ZIN(0);
100 float *out = ZOUT(0);
101 float *amp = MULIN - ZOFF;
103 float mix_cur = unit->mPrevAdd;
104 float nextMix = ADDIN[0];
105 float mix_slope = CALCSLOPE(nextMix, mix_cur);
106 if (mix_slope == 0.f) {
107 if (mix_cur == 0.f) {
108 LOOP1(inNumSamples, ZXP(out) = ZXP(amp) * ZXP(in); );
109 } else {
110 LOOP1(inNumSamples, ZXP(out) = ZXP(amp) * ZXP(in) + mix_cur; );
112 } else {
113 LOOP1(inNumSamples, ZXP(out) = ZXP(amp) * ZXP(in) + mix_cur; mix_cur += mix_slope; );
114 unit->mPrevAdd = nextMix;
118 void ampmix_ai(MulAdd *unit, int inNumSamples);
119 void ampmix_ai(MulAdd *unit, int inNumSamples)
121 float *in = ZIN(0);
122 float *out = ZOUT(0);
123 float *amp = MULIN - ZOFF;
124 float mix_cur = unit->mPrevAdd;
126 LOOP1(inNumSamples, ZXP(out) = ZXP(amp) * ZXP(in) + mix_cur; );
129 void ampmix_ka(MulAdd *unit, int inNumSamples);
130 void ampmix_ka(MulAdd *unit, int inNumSamples)
132 float *in = ZIN(0);
133 float *out = ZOUT(0);
134 float *mix = ADDIN - ZOFF;
135 float amp_cur = unit->mPrevMul;
136 float nextAmp = MULIN[0];
137 float amp_slope = CALCSLOPE(nextAmp, amp_cur);
139 if (amp_slope == 0.f) {
140 if (amp_cur == 0.f) {
141 ZCopy(inNumSamples, out, mix);
142 } else if (amp_cur == 1.f) {
143 LOOP1(inNumSamples, ZXP(out) = ZXP(in) + ZXP(mix); );
144 } else {
145 LOOP1(inNumSamples, ZXP(out) = amp_cur * ZXP(in) + ZXP(mix); );
147 } else {
148 LOOP1(inNumSamples, ZXP(out) = amp_cur * ZXP(in) + ZXP(mix); amp_cur += amp_slope; );
149 unit->mPrevMul = nextAmp;
153 void ampmix_kk(MulAdd *unit, int inNumSamples);
154 void ampmix_kk(MulAdd *unit, int inNumSamples)
156 float *in = ZIN(0);
157 float *out = ZOUT(0);
159 float amp_cur = unit->mPrevMul;
160 float nextAmp = MULIN[0];
161 float amp_slope = CALCSLOPE(nextAmp, amp_cur);
162 float mix_cur = unit->mPrevAdd;
163 float nextMix = ADDIN[0];
164 float mix_slope = CALCSLOPE(nextMix, mix_cur);
166 if (amp_slope == 0.f) {
167 if (mix_slope == 0.f) {
168 if (mix_cur == 0.f) {
169 if (amp_cur == 1.f) {
170 // do nothing!
171 } else if (amp_cur == 0.f) {
172 ZClear(inNumSamples, out);
173 } else {
174 LOOP1(inNumSamples, ZXP(out) = ZXP(in) * amp_cur;);
176 } else {
177 if (amp_cur == 1.f) {
178 LOOP1(inNumSamples, ZXP(out) = ZXP(in) + mix_cur;);
179 } else if (amp_cur == 0.f) {
180 LOOP1(inNumSamples, ZXP(out) = mix_cur;);
181 } else {
182 LOOP1(inNumSamples, ZXP(out) = amp_cur * ZXP(in) + mix_cur; );
185 } else {
186 if (amp_cur == 1.f) {
187 LOOP1(inNumSamples, ZXP(out) = ZXP(in) + mix_cur; mix_cur += mix_slope;);
188 } else if (amp_cur == 0.f) {
189 LOOP1(inNumSamples, ZXP(out) = mix_cur; mix_cur += mix_slope;);
190 } else {
191 LOOP1(inNumSamples, ZXP(out) = amp_cur * ZXP(in) + mix_cur; mix_cur += mix_slope; );
193 unit->mPrevAdd = nextMix;
195 } else {
196 if (mix_slope == 0.f) {
197 if (mix_cur == 0.f) {
198 LOOP1(inNumSamples, ZXP(out) = ZXP(in) * amp_cur; amp_cur += amp_slope; );
199 } else {
200 LOOP1(inNumSamples, ZXP(out) = amp_cur * ZXP(in) + mix_cur; amp_cur += amp_slope; );
202 } else {
203 LOOP1(inNumSamples, ZXP(out) = amp_cur * ZXP(in) + mix_cur; amp_cur += amp_slope; mix_cur += mix_slope; );
204 unit->mPrevAdd = nextMix;
206 unit->mPrevMul = nextAmp;
210 void ampmix_ki(MulAdd *unit, int inNumSamples);
211 void ampmix_ki(MulAdd *unit, int inNumSamples)
213 float *in = ZIN(0);
214 float *out = ZOUT(0);
216 float amp_cur = unit->mPrevMul;
217 float nextAmp = MULIN[0];
218 float amp_slope = CALCSLOPE(nextAmp, amp_cur);
219 float mix_cur = unit->mPrevAdd;
220 //postbuf("ampmix_ki %p %g %g\n", out, amp_cur, mix_cur);
222 if (amp_slope == 0.f) {
223 if (amp_cur == 1.f) {
224 LOOP1(inNumSamples, ZXP(out) = ZXP(in) + mix_cur;);
225 } else if (amp_cur == 0.f) {
226 LOOP1(inNumSamples, ZXP(out) = mix_cur;);
227 } else {
228 LOOP1(inNumSamples, ZXP(out) = amp_cur * ZXP(in) + mix_cur; );
230 } else {
231 LOOP1(inNumSamples, ZXP(out) = amp_cur * ZXP(in) + mix_cur; amp_cur += amp_slope; );
232 unit->mPrevMul = nextAmp;
236 void ampmix_ia(MulAdd *unit, int inNumSamples);
237 void ampmix_ia(MulAdd *unit, int inNumSamples)
239 float *in = ZIN(0);
240 float *out = ZOUT(0);
241 float *mix = ADDIN - ZOFF;
242 float amp_cur = unit->mPrevMul;
244 #ifdef IPHONE_VEC
245 in++;
246 out++;
247 mix++;
248 vscalarmul(in, amp_cur, in, inNumSamples);
249 vadd(out, in, mix, inNumSamples);
250 #else
251 LOOP1(inNumSamples, ZXP(out) = amp_cur * ZXP(in) + ZXP(mix); );
252 #endif
256 void ampmix_ik(MulAdd *unit, int inNumSamples);
257 void ampmix_ik(MulAdd *unit, int inNumSamples)
259 float *in = ZIN(0);
260 float *out = ZOUT(0);
262 float amp_cur = unit->mPrevMul;
263 float mix_cur = unit->mPrevAdd;
264 float nextMix = ADDIN[0];
265 float mix_slope = CALCSLOPE(nextMix, mix_cur);
267 if (mix_slope == 0.f) {
268 if (mix_cur == 0.f) {
269 LOOP1(inNumSamples, ZXP(out) = amp_cur * ZXP(in); );
270 } else {
271 LOOP1(inNumSamples, ZXP(out) = amp_cur * ZXP(in) + mix_cur; );
273 } else {
274 LOOP1(inNumSamples, ZXP(out) = amp_cur * ZXP(in) + mix_cur; mix_cur += mix_slope; );
275 unit->mPrevAdd = nextMix;
279 void ampmix_ii(MulAdd *unit, int inNumSamples);
280 void ampmix_ii(MulAdd *unit, int inNumSamples)
282 float *in = ZIN(0);
283 float *out = ZOUT(0);
285 float amp_cur = unit->mPrevMul;
286 float mix_cur = unit->mPrevAdd;
287 LOOP1(inNumSamples, ZXP(out) = amp_cur * ZXP(in) + mix_cur; );
290 #ifdef NOVA_SIMD
291 inline_functions void ampmix_aa_nova(MulAdd *unit, int inNumSamples)
293 nova::muladd_vec_simd(OUT(0), wrap_argument(IN(0)), wrap_argument(MULIN),
294 wrap_argument(ADDIN), inNumSamples);
297 inline_functions void ampmix_aa_nova_64(MulAdd *unit, int inNumSamples)
299 nova::muladd_vec_simd<64>(OUT(0), wrap_argument(IN(0)), wrap_argument(MULIN), wrap_argument(ADDIN));
302 inline_functions void ampmix_ak_nova(MulAdd *unit, int inNumSamples)
304 float mix_cur = unit->mPrevAdd;
305 float nextMix = ADDIN[0];
306 if (nextMix == mix_cur) {
307 if (mix_cur == 0.f)
308 nova::times_vec_simd(OUT(0), IN(0), MULIN, inNumSamples);
309 else
310 nova::muladd_vec_simd(OUT(0), wrap_argument(IN(0)), wrap_argument(MULIN),
311 wrap_argument(mix_cur), inNumSamples);
312 } else {
313 float mix_slope = CALCSLOPE(nextMix, mix_cur);
314 unit->mPrevAdd = nextMix;
315 nova::muladd_vec_simd(OUT(0), wrap_argument(IN(0)), wrap_argument(MULIN),
316 wrap_argument(mix_cur, mix_slope),inNumSamples);
320 inline_functions void ampmix_ak_nova_64(MulAdd *unit, int inNumSamples)
322 float mix_cur = unit->mPrevAdd;
323 float nextMix = ADDIN[0];
324 if (nextMix == mix_cur) {
325 if (mix_cur == 0.f)
326 nova::times_vec_simd<64>(OUT(0), IN(0), MULIN);
327 else
328 nova::muladd_vec_simd<64>(OUT(0), wrap_argument(IN(0)), wrap_argument(MULIN),
329 wrap_argument(mix_cur));
330 } else {
331 float mix_slope = CALCSLOPE(nextMix, mix_cur);
332 unit->mPrevAdd = nextMix;
333 nova::muladd_vec_simd<64>(OUT(0), wrap_argument(IN(0)), wrap_argument(MULIN),
334 wrap_argument(mix_cur, mix_slope));
338 inline_functions void ampmix_ai_nova(MulAdd *unit, int inNumSamples)
340 nova::muladd_vec_simd(OUT(0), wrap_argument(IN(0)), wrap_argument(MULIN),
341 wrap_argument(unit->mPrevAdd), inNumSamples);
344 inline_functions void ampmix_ai_nova_64(MulAdd *unit, int inNumSamples)
346 nova::muladd_vec_simd<64>(OUT(0), wrap_argument(IN(0)), wrap_argument(MULIN),
347 wrap_argument(unit->mPrevAdd));
350 inline_functions void ampmix_ka_nova(MulAdd *unit, int inNumSamples)
352 float amp_cur = unit->mPrevMul;
353 float nextAmp = MULIN[0];
355 if (amp_cur == nextAmp) {
356 if (amp_cur == 0.f)
357 nova::copyvec_simd(OUT(0), ADDIN, inNumSamples);
358 else if (amp_cur == 1.f)
359 nova::plus_vec_simd(OUT(0), IN(0), ADDIN, inNumSamples);
360 else
361 nova::muladd_vec_simd(OUT(0), wrap_argument(IN(0)), wrap_argument(amp_cur),
362 wrap_argument(ADDIN), inNumSamples);
363 } else {
364 float amp_slope = CALCSLOPE(nextAmp, amp_cur);
365 unit->mPrevMul = nextAmp;
366 nova::muladd_vec_simd(OUT(0), wrap_argument(IN(0)), wrap_argument(amp_cur, amp_slope),
367 wrap_argument(ADDIN), inNumSamples);
371 inline_functions void ampmix_ka_nova_64(MulAdd *unit, int inNumSamples)
373 float amp_cur = unit->mPrevMul;
374 float nextAmp = MULIN[0];
376 if (amp_cur == nextAmp) {
377 if (amp_cur == 0.f)
378 nova::copyvec_simd<64>(OUT(0), ADDIN);
379 else if (amp_cur == 1.f)
380 nova::plus_vec_simd<64>(OUT(0), IN(0), ADDIN);
381 else
382 nova::muladd_vec_simd<64>(OUT(0), wrap_argument(IN(0)), wrap_argument(amp_cur),
383 wrap_argument(ADDIN));
384 } else {
385 float amp_slope = CALCSLOPE(nextAmp, amp_cur);
386 unit->mPrevMul = nextAmp;
387 nova::muladd_vec_simd<64>(OUT(0), wrap_argument(IN(0)), wrap_argument(amp_cur, amp_slope),
388 wrap_argument(ADDIN));
392 inline_functions void ampmix_kk_nova(MulAdd *unit, int inNumSamples)
394 float amp_cur = unit->mPrevMul;
395 float nextAmp = MULIN[0];
396 float mix_cur = unit->mPrevAdd;
397 float nextMix = ADDIN[0];
399 if (nextAmp == amp_cur) {
400 if (nextMix == mix_cur) {
401 if (mix_cur == 0.f) {
402 if (amp_cur == 1.f) {
403 // do nothing!
404 } else if (amp_cur == 0.f)
405 nova::zerovec_simd(OUT(0), inNumSamples);
406 else
407 nova::times_vec_simd(OUT(0), IN(0), amp_cur, inNumSamples);
408 } else {
409 if (amp_cur == 1.f)
410 nova::plus_vec_simd(OUT(0), IN(0), mix_cur, inNumSamples);
411 else if (amp_cur == 0.f)
412 nova::setvec_simd(OUT(0), mix_cur, inNumSamples);
413 else
414 nova::muladd_vec_simd(OUT(0), wrap_argument(IN(0)), wrap_argument(amp_cur),
415 wrap_argument(mix_cur), inNumSamples);
417 } else {
418 float mix_slope = CALCSLOPE(nextMix, mix_cur);
419 if (amp_cur == 1.f)
420 nova::plus_vec_simd(OUT(0), IN(0), mix_cur, mix_slope, inNumSamples);
421 else if (amp_cur == 0.f)
422 nova::set_slope_vec_simd(OUT(0), mix_cur, mix_slope, inNumSamples);
423 else
424 nova::muladd_vec_simd(OUT(0), wrap_argument(IN(0)), wrap_argument(amp_cur),
425 wrap_argument(mix_cur, mix_slope), inNumSamples);
426 unit->mPrevAdd = nextMix;
428 } else {
429 float amp_slope = CALCSLOPE(nextAmp, amp_cur);
430 if (nextMix == mix_cur) {
431 if (mix_cur == 0.f)
432 nova::times_vec_simd(OUT(0), IN(0), amp_cur, amp_slope, inNumSamples);
433 else
434 nova::muladd_vec_simd(OUT(0), wrap_argument(IN(0)), wrap_argument(amp_cur, amp_slope),
435 wrap_argument(mix_cur), inNumSamples);
436 } else {
437 float mix_slope = CALCSLOPE(nextMix, mix_cur);
438 nova::muladd_vec_simd(OUT(0), wrap_argument(IN(0)), wrap_argument(amp_cur, amp_slope),
439 wrap_argument(mix_cur, mix_slope), inNumSamples);
440 unit->mPrevAdd = nextMix;
442 unit->mPrevMul = nextAmp;
446 inline_functions void ampmix_ki_nova(MulAdd *unit, int inNumSamples)
448 float amp_cur = unit->mPrevMul;
449 float nextAmp = MULIN[0];
450 float mix_cur = unit->mPrevAdd;
452 if (nextAmp == amp_cur) {
453 if (amp_cur == 1.f)
454 nova::plus_vec_simd(OUT(0), IN(0), mix_cur, inNumSamples);
455 else if (amp_cur == 0.f)
456 nova::setvec_simd(OUT(0), mix_cur, inNumSamples);
457 else
458 nova::muladd_vec_simd(OUT(0), wrap_argument(IN(0)), wrap_argument(amp_cur),
459 wrap_argument(mix_cur), inNumSamples);
460 } else {
461 float amp_slope = CALCSLOPE(nextAmp, amp_cur);
462 nova::muladd_vec_simd(OUT(0), wrap_argument(IN(0)), wrap_argument(amp_cur, amp_slope),
463 wrap_argument(mix_cur), inNumSamples);
464 unit->mPrevMul = nextAmp;
468 inline_functions void ampmix_ki_nova_64(MulAdd *unit, int inNumSamples)
470 float amp_cur = unit->mPrevMul;
471 float nextAmp = MULIN[0];
472 float mix_cur = unit->mPrevAdd;
474 if (nextAmp == amp_cur) {
475 if (amp_cur == 1.f)
476 nova::plus_vec_simd<64>(OUT(0), IN(0), mix_cur);
477 else if (amp_cur == 0.f)
478 nova::setvec_simd<64>(OUT(0), mix_cur);
479 else
480 nova::muladd_vec_simd<64>(OUT(0), wrap_argument(IN(0)), wrap_argument(amp_cur),
481 wrap_argument(mix_cur));
482 } else {
483 float amp_slope = CALCSLOPE(nextAmp, amp_cur);
484 nova::muladd_vec_simd<64>(OUT(0), wrap_argument(IN(0)), wrap_argument(amp_cur, amp_slope),
485 wrap_argument(mix_cur));
486 unit->mPrevMul = nextAmp;
490 inline_functions void ampmix_ia_nova(MulAdd *unit, int inNumSamples)
492 nova::muladd_vec_simd(OUT(0), wrap_argument(IN(0)), wrap_argument(unit->mPrevMul),
493 wrap_argument(ADDIN), inNumSamples);
496 inline_functions void ampmix_ia_nova_64(MulAdd *unit, int inNumSamples)
498 nova::muladd_vec_simd<64>(OUT(0), wrap_argument(IN(0)), wrap_argument(unit->mPrevMul),
499 wrap_argument(ADDIN));
502 inline_functions void ampmix_ik_nova(MulAdd *unit, int inNumSamples)
504 float amp_cur = unit->mPrevMul;
505 float mix_cur = unit->mPrevAdd;
506 float nextMix = ADDIN[0];
508 if (nextMix == mix_cur) {
509 if (mix_cur == 0.f)
510 nova::times_vec_simd(OUT(0), IN(0), amp_cur, inNumSamples);
511 else
512 nova::muladd_vec_simd(OUT(0), wrap_argument(IN(0)), wrap_argument(amp_cur),
513 wrap_argument(mix_cur), inNumSamples);
514 } else {
515 float mix_slope = CALCSLOPE(nextMix, mix_cur);
516 nova::muladd_vec_simd(OUT(0), wrap_argument(IN(0)), wrap_argument(amp_cur),
517 wrap_argument(mix_cur, mix_slope), inNumSamples);
518 unit->mPrevAdd = nextMix;
522 inline_functions void ampmix_ik_nova_64(MulAdd *unit, int inNumSamples)
524 float amp_cur = unit->mPrevMul;
525 float mix_cur = unit->mPrevAdd;
526 float nextMix = ADDIN[0];
528 if (nextMix == mix_cur) {
529 if (mix_cur == 0.f)
530 nova::times_vec_simd<64>(OUT(0), IN(0), amp_cur);
531 else
532 nova::muladd_vec_simd<64>(OUT(0), wrap_argument(IN(0)), wrap_argument(amp_cur), wrap_argument(mix_cur));
533 } else {
534 float mix_slope = CALCSLOPE(nextMix, mix_cur);
535 nova::muladd_vec_simd<64>(OUT(0), wrap_argument(IN(0)), wrap_argument(amp_cur),
536 wrap_argument(mix_cur, mix_slope));
537 unit->mPrevAdd = nextMix;
541 inline_functions void ampmix_ii_nova(MulAdd *unit, int inNumSamples)
543 nova::muladd_vec_simd(OUT(0), wrap_argument(IN(0)), wrap_argument(unit->mPrevMul),
544 wrap_argument(unit->mPrevAdd), inNumSamples);
547 inline_functions void ampmix_ii_nova_64(MulAdd *unit, int inNumSamples)
549 nova::muladd_vec_simd<64>(OUT(0), wrap_argument(IN(0)), wrap_argument(unit->mPrevMul),
550 wrap_argument(unit->mPrevAdd));
553 #endif
558 ////////////////////////////////////////////////////////////////////////////////////////////////////////
560 void MulAdd_Ctor(MulAdd *unit)
562 if (unit->mCalcRate != calc_FullRate) {
563 unit->mCalcFunc = (UnitCalcFunc)&ampmix_k;
564 ampmix_k(unit, 1);
565 return;
568 unit->mPrevMul = ZIN0(1);
569 unit->mPrevAdd = ZIN0(2);
571 int mulRate = INRATE(1);
572 int addRate = INRATE(2);
574 //Print("muladd %d %d %g %g\n", mulRate, addRate, unit->mPrevMul, unit->mPrevAdd);
575 //Print("**** %p %p %p %p\n", IN(0), IN(1), IN(2), OUT(0));
578 #if defined (NOVA_SIMD)
579 if ((BUFLENGTH & 15))
581 #endif
582 switch (mulRate) {
583 case calc_FullRate :
584 switch (addRate) {
585 case calc_FullRate :
586 unit->mCalcFunc = (UnitCalcFunc)&ampmix_aa;
587 break;
588 case calc_BufRate :
589 unit->mCalcFunc = (UnitCalcFunc)&ampmix_ak;
590 break;
591 case calc_ScalarRate :
592 unit->mCalcFunc = (UnitCalcFunc)&ampmix_ai;
593 break;
595 break;
596 case calc_BufRate :
597 switch (addRate) {
598 case calc_FullRate :
599 unit->mCalcFunc = (UnitCalcFunc)&ampmix_ka;
600 break;
601 case calc_BufRate :
602 unit->mCalcFunc = (UnitCalcFunc)&ampmix_kk;
603 break;
604 case calc_ScalarRate :
605 unit->mCalcFunc = (UnitCalcFunc)&ampmix_ki;
606 break;
608 break;
609 case calc_ScalarRate :
610 switch (addRate) {
611 case calc_FullRate :
612 unit->mCalcFunc = (UnitCalcFunc)&ampmix_ia;
613 break;
614 case calc_BufRate :
615 unit->mCalcFunc = (UnitCalcFunc)&ampmix_ik;
616 break;
617 case calc_ScalarRate :
618 unit->mCalcFunc = (UnitCalcFunc)&ampmix_ii;
619 break;
621 break;
624 #if defined (NOVA_SIMD)
625 } else {
626 if (BUFLENGTH == 64) {
627 switch (mulRate) {
628 case calc_FullRate :
629 switch (addRate) {
630 case calc_FullRate :
631 unit->mCalcFunc = (UnitCalcFunc)&ampmix_aa_nova_64;
632 break;
633 case calc_BufRate :
634 unit->mCalcFunc = (UnitCalcFunc)&ampmix_ak_nova_64;
635 break;
636 case calc_ScalarRate :
637 unit->mCalcFunc = (UnitCalcFunc)&ampmix_ai_nova_64;
638 break;
640 break;
641 case calc_BufRate :
642 switch (addRate) {
643 case calc_FullRate :
644 unit->mCalcFunc = (UnitCalcFunc)&ampmix_ka_nova_64;
645 break;
646 case calc_BufRate :
647 unit->mCalcFunc = (UnitCalcFunc)&ampmix_kk_nova;
648 break;
649 case calc_ScalarRate :
650 unit->mCalcFunc = (UnitCalcFunc)&ampmix_ki_nova_64;
651 break;
653 break;
654 case calc_ScalarRate :
655 switch (addRate) {
656 case calc_FullRate :
657 unit->mCalcFunc = (UnitCalcFunc)&ampmix_ia_nova_64;
658 break;
659 case calc_BufRate :
660 unit->mCalcFunc = (UnitCalcFunc)&ampmix_ik_nova_64;
661 break;
662 case calc_ScalarRate :
663 unit->mCalcFunc = (UnitCalcFunc)&ampmix_ii_nova_64;
664 break;
666 break;
668 } else {
669 switch (mulRate) {
670 case calc_FullRate :
671 switch (addRate) {
672 case calc_FullRate :
673 unit->mCalcFunc = (UnitCalcFunc)&ampmix_aa_nova;
674 break;
675 case calc_BufRate :
676 unit->mCalcFunc = (UnitCalcFunc)&ampmix_ak_nova;
677 break;
678 case calc_ScalarRate :
679 unit->mCalcFunc = (UnitCalcFunc)&ampmix_ai_nova;
680 break;
682 break;
683 case calc_BufRate :
684 switch (addRate) {
685 case calc_FullRate :
686 unit->mCalcFunc = (UnitCalcFunc)&ampmix_ka_nova;
687 break;
688 case calc_BufRate :
689 unit->mCalcFunc = (UnitCalcFunc)&ampmix_kk_nova;
690 break;
691 case calc_ScalarRate :
692 unit->mCalcFunc = (UnitCalcFunc)&ampmix_ki_nova;
693 break;
695 break;
696 case calc_ScalarRate :
697 switch (addRate) {
698 case calc_FullRate :
699 unit->mCalcFunc = (UnitCalcFunc)&ampmix_ia_nova;
700 break;
701 case calc_BufRate :
702 unit->mCalcFunc = (UnitCalcFunc)&ampmix_ik_nova;
703 break;
704 case calc_ScalarRate :
705 unit->mCalcFunc = (UnitCalcFunc)&ampmix_ii_nova;
706 break;
708 break;
712 #endif
713 ampmix_k(unit, 1);
717 ////////////////////////////////////////////////////////////////////////////////////////////////////////
719 PluginLoad(MulAdd)
721 ft = inTable;
723 DefineSimpleUnit(MulAdd);