summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThom Johansen <thomj@rockbox.org>2006-04-17 17:24:02 +0000
committerThom Johansen <thomj@rockbox.org>2006-04-17 17:24:02 +0000
commit239564c80e1edbc6641c03c636233c9ec813aa9a (patch)
tree8c4d7bfaabb0cc0b8e6052732cf9545a6ebd45d4
parent98097d23ec15cb1978e0e75dc8d02753e73ad73d (diff)
downloadrockbox-239564c80e1edbc6641c03c636233c9ec813aa9a.tar.gz
rockbox-239564c80e1edbc6641c03c636233c9ec813aa9a.zip
Fix/add some comments and remove some old leftover crossfeed code.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9705 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/dsp.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/apps/dsp.c b/apps/dsp.c
index b6d24824b5..0ef5e0ebf6 100644
--- a/apps/dsp.c
+++ b/apps/dsp.c
@@ -209,7 +209,7 @@ struct crossfeed_data
209 209
210/* Current setup is one lowshelf filters, three peaking filters and one 210/* Current setup is one lowshelf filters, three peaking filters and one
211 highshelf filter. Varying the number of shelving filters make no sense, 211 highshelf filter. Varying the number of shelving filters make no sense,
212 but adding peaking filters are possible. */ 212 but adding peaking filters is possible. */
213struct eq_state { 213struct eq_state {
214 char enabled[5]; /* Flags for active filters */ 214 char enabled[5]; /* Flags for active filters */
215 struct eqfilter filters[5]; 215 struct eqfilter filters[5];
@@ -342,8 +342,8 @@ static void resampler_set_delta(int frequency)
342 frequency * 65536LL / NATIVE_FREQUENCY; 342 frequency * 65536LL / NATIVE_FREQUENCY;
343} 343}
344 344
345/* Linear resampling that introduces a one sample delay, because of our 345/* Linear interpolation resampling that introduces a one sample delay because
346 * inability to look into the future at the end of a frame. 346 * of our inability to look into the future at the end of a frame.
347 */ 347 */
348 348
349/* TODO: we really should have a separate set of resample functions for both 349/* TODO: we really should have a separate set of resample functions for both
@@ -551,33 +551,40 @@ void apply_crossfeed(int32_t* src[], int count)
551 int32_t *coefs = &crossfeed_data.coefs[0]; 551 int32_t *coefs = &crossfeed_data.coefs[0];
552 int32_t gain = crossfeed_data.gain; 552 int32_t gain = crossfeed_data.gain;
553 int di = crossfeed_data.index; 553 int di = crossfeed_data.index;
554 554
555 int32_t acc; 555 int32_t acc;
556 int32_t left, right; 556 int32_t left, right;
557 int i; 557 int i;
558 558
559 for (i = 0; i < count; i++) { 559 for (i = 0; i < count; i++) {
560 left = src[0][i]; 560 left = src[0][i];
561 right = src[1][i]; 561 right = src[1][i];
562 562
563 /* Filter delayed sample from left speaker */
563 ACC_INIT(acc, delay[di*2], coefs[0]); 564 ACC_INIT(acc, delay[di*2], coefs[0]);
564 ACC(acc, hist_l[0], coefs[1]); 565 ACC(acc, hist_l[0], coefs[1]);
565 ACC(acc, hist_l[1], coefs[2]); 566 ACC(acc, hist_l[1], coefs[2]);
566 hist_l[1] = GET_ACC(acc) << 0; 567 /* Save filter history for left speaker */
568 hist_l[1] = GET_ACC(acc);
567 hist_l[0] = delay[di*2]; 569 hist_l[0] = delay[di*2];
570 /* Filter delayed sample from right speaker */
568 ACC_INIT(acc, delay[di*2 + 1], coefs[0]); 571 ACC_INIT(acc, delay[di*2 + 1], coefs[0]);
569 ACC(acc, hist_r[0], coefs[1]); 572 ACC(acc, hist_r[0], coefs[1]);
570 ACC(acc, hist_r[1], coefs[2]); 573 ACC(acc, hist_r[1], coefs[2]);
571 hist_r[1] = GET_ACC(acc) << 0; 574 /* Save filter history for right speaker */
575 hist_r[1] = GET_ACC(acc);
572 hist_r[0] = delay[di*2 + 1]; 576 hist_r[0] = delay[di*2 + 1];
573 delay[di*2] = left; 577 delay[di*2] = left;
574 delay[di*2 + 1] = right; 578 delay[di*2 + 1] = right;
579 /* Now add the attenuated direct sound and write to outputs */
575 src[0][i] = FRACMUL(left, gain) + hist_r[1]; 580 src[0][i] = FRACMUL(left, gain) + hist_r[1];
576 src[1][i] = FRACMUL(right, gain) + hist_l[1]; 581 src[1][i] = FRACMUL(right, gain) + hist_l[1];
577 582
583 /* Wrap delay line index if bigger than delay line size */
578 if (++di > 12) 584 if (++di > 12)
579 di = 0; 585 di = 0;
580 } 586 }
587 /* Write back local copies of data we've modified */
581 crossfeed_data.index = di; 588 crossfeed_data.index = di;
582} 589}
583#endif 590#endif