diff options
-rw-r--r-- | apps/dsp.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/apps/dsp.c b/apps/dsp.c index c490ed3824..0ccef679d0 100644 --- a/apps/dsp.c +++ b/apps/dsp.c | |||
@@ -95,7 +95,6 @@ | |||
95 | (t << 8) | (u & 0xff); \ | 95 | (t << 8) | (u & 0xff); \ |
96 | }) | 96 | }) |
97 | 97 | ||
98 | |||
99 | #define ACC(acc, x, y) \ | 98 | #define ACC(acc, x, y) \ |
100 | (void)acc; \ | 99 | (void)acc; \ |
101 | asm volatile ("mac.l %[a], %[b], %%acc0" \ | 100 | asm volatile ("mac.l %[a], %[b], %%acc0" \ |
@@ -109,8 +108,13 @@ | |||
109 | t; \ | 108 | t; \ |
110 | }) | 109 | }) |
111 | 110 | ||
111 | #define ACC_INIT(acc, x, y) ACC(acc, x, y) | ||
112 | |||
112 | #else | 113 | #else |
113 | 114 | ||
115 | #define ACC_INIT(acc, x, y) acc = FRACMUL(x, y) | ||
116 | #define ACC(acc, x, y) acc += FRACMUL(x, y) | ||
117 | #define GET_ACC(acc) acc | ||
114 | #define FRACMUL(x, y) (long) (((((long long) (x)) * ((long long) (y))) >> 31)) | 118 | #define FRACMUL(x, y) (long) (((((long long) (x)) * ((long long) (y))) >> 31)) |
115 | #define FRACMUL_8(x, y) (long) (((((long long) (x)) * ((long long) (y))) >> 23)) | 119 | #define FRACMUL_8(x, y) (long) (((((long long) (x)) * ((long long) (y))) >> 23)) |
116 | #define FRACMUL_8_LOOP(x, y, s) \ | 120 | #define FRACMUL_8_LOOP(x, y, s) \ |
@@ -447,7 +451,7 @@ static void apply_crossfeed(long* src[], int count) | |||
447 | 451 | ||
448 | if (dsp->crossfeed_enabled && src[0] != src[1]) | 452 | if (dsp->crossfeed_enabled && src[0] != src[1]) |
449 | { | 453 | { |
450 | long long a; | 454 | long a; /* accumulator */ |
451 | 455 | ||
452 | long low_left = crossfeed_data.lowpass[0]; | 456 | long low_left = crossfeed_data.lowpass[0]; |
453 | long low_right = crossfeed_data.lowpass[1]; | 457 | long low_right = crossfeed_data.lowpass[1]; |
@@ -468,27 +472,27 @@ static void apply_crossfeed(long* src[], int count) | |||
468 | left = src[0][i]; | 472 | left = src[0][i]; |
469 | right = src[1][i]; | 473 | right = src[1][i]; |
470 | 474 | ||
471 | ACC(a, LOW, low_left); ACC(a, LOW_COMP, left); | 475 | ACC_INIT(a, LOW, low_left); ACC(a, LOW_COMP, left); |
472 | low_left = GET_ACC(a); | 476 | low_left = GET_ACC(a); |
473 | 477 | ||
474 | ACC(a, LOW, low_right); ACC(a, LOW_COMP, right); | 478 | ACC_INIT(a, LOW, low_right); ACC(a, LOW_COMP, right); |
475 | low_right = GET_ACC(a); | 479 | low_right = GET_ACC(a); |
476 | 480 | ||
477 | /* use a high-pass filter on the signal */ | 481 | /* use a high-pass filter on the signal */ |
478 | 482 | ||
479 | ACC(a, HIGH_NEG, high_left); ACC(a, HIGH_COMP, left); | 483 | ACC_INIT(a, HIGH_NEG, high_left); ACC(a, HIGH_COMP, left); |
480 | high_left = GET_ACC(a); | 484 | high_left = GET_ACC(a); |
481 | 485 | ||
482 | ACC(a, HIGH_NEG, high_right); ACC(a, HIGH_COMP, right); | 486 | ACC_INIT(a, HIGH_NEG, high_right); ACC(a, HIGH_COMP, right); |
483 | high_right = GET_ACC(a); | 487 | high_right = GET_ACC(a); |
484 | 488 | ||
485 | /* New data is the high-passed signal + delayed and attenuated | 489 | /* New data is the high-passed signal + delayed and attenuated |
486 | * low-passed signal from the other channel */ | 490 | * low-passed signal from the other channel */ |
487 | 491 | ||
488 | ACC(a, ATT, delay_r[index]); ACC(a, ATT_COMP, high_left); | 492 | ACC_INIT(a, ATT, delay_r[index]); ACC(a, ATT_COMP, high_left); |
489 | src[0][i] = GET_ACC(a); | 493 | src[0][i] = GET_ACC(a); |
490 | 494 | ||
491 | ACC(a, ATT, delay_l[index]); ACC(a, ATT_COMP, high_right); | 495 | ACC_INIT(a, ATT, delay_l[index]); ACC(a, ATT_COMP, high_right); |
492 | src[1][i] = GET_ACC(a); | 496 | src[1][i] = GET_ACC(a); |
493 | 497 | ||
494 | /* Store the low-passed signal in the ringbuffer */ | 498 | /* Store the low-passed signal in the ringbuffer */ |