summaryrefslogtreecommitdiff
path: root/lib/rbcodec/dsp/dsp_sample_input.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2012-05-04 22:00:44 -0400
committerMichael Sevakis <jethead71@rockbox.org>2012-05-04 22:00:44 -0400
commit88aeef91275dd121f2e8663ec79729412aaa2fa2 (patch)
treeb8edc9365cfd8e73744f279724eede910adf53bb /lib/rbcodec/dsp/dsp_sample_input.c
parentdbe5e5f2df24a0dbe650561c0b42ce982346534c (diff)
downloadrockbox-88aeef91275dd121f2e8663ec79729412aaa2fa2.zip
rockbox-88aeef91275dd121f2e8663ec79729412aaa2fa2.tar.gz
rockbox-88aeef91275dd121f2e8663ec79729412aaa2fa2.tar.bz2
rockbox-88aeef91275dd121f2e8663ec79729412aaa2fa2.tar.xz
Remove pointless IRAM allocation from voice DSP.
It's always used in MONO mode and doesn't need the IRAM sample/ resample buffers and 1280 bytes can be freed. M5 can now have its PCM mixer downmix buffer in IRAM. Change-Id: I0af08be5b212b7dfe382bba588a6585eb328a038
Diffstat (limited to 'lib/rbcodec/dsp/dsp_sample_input.c')
-rw-r--r--lib/rbcodec/dsp/dsp_sample_input.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/lib/rbcodec/dsp/dsp_sample_input.c b/lib/rbcodec/dsp/dsp_sample_input.c
index 97b4ec2..df0b01f 100644
--- a/lib/rbcodec/dsp/dsp_sample_input.c
+++ b/lib/rbcodec/dsp/dsp_sample_input.c
@@ -51,6 +51,10 @@
extern void dsp_sample_output_init(struct sample_io_data *this);
extern void dsp_sample_output_flush(struct sample_io_data *this);
+#define SAMPLE_BUF_COUNT 128 /* Per channel, per DSP */
+/* CODEC_IDX_AUDIO = left and right, CODEC_IDX_VOICE = mono */
+static int32_t sample_bufs[3][SAMPLE_BUF_COUNT] IBSS_ATTR;
+
/* convert count 16-bit mono to 32-bit mono */
static void sample_input_mono16(struct sample_io_data *this,
struct dsp_buffer **buf_p)
@@ -269,8 +273,31 @@ static void dsp_sample_input_format_change(struct sample_io_data *this,
format_change_ack(&src->format);
}
-static void dsp_sample_input_init(struct sample_io_data *this)
+static void dsp_sample_input_init(struct sample_io_data *this,
+ enum dsp_ids dsp_id)
{
+ int32_t *lbuf, *rbuf;
+
+ switch (dsp_id)
+ {
+ case CODEC_IDX_AUDIO:
+ lbuf = sample_bufs[0];
+ rbuf = sample_bufs[1];
+ break;
+
+ case CODEC_IDX_VOICE:
+ lbuf = rbuf = sample_bufs[2]; /* Always mono */
+ break;
+
+ default:
+ /* orly */
+ DEBUGF("DSP Input- unknown dsp %d\n", (int)dsp_id);
+ return;
+ }
+
+ this->sample_buf_arr[0] = lbuf;
+ this->sample_buf_arr[1] = rbuf;
+
this->input_samples[0] = sample_input_ni_stereo32;
this->input_samples[1] = dsp_sample_input_format_change;
}
@@ -288,7 +315,7 @@ void dsp_sample_io_configure(struct sample_io_data *this,
switch (setting)
{
case DSP_INIT:
- dsp_sample_input_init(this);
+ dsp_sample_input_init(this, (enum dsp_ids)value);
dsp_sample_output_init(this);
break;