Shift some load of core1
This commit is contained in:
parent
12f94d2250
commit
df277c6556
|
@ -124,21 +124,24 @@ static void __no_inline_not_in_flash_func(_as_audio_packet)(struct usb_endpoint
|
||||||
int32_t *out = (int32_t *) userbuf;
|
int32_t *out = (int32_t *) userbuf;
|
||||||
int samples = usb_buffer->data_len / 2;
|
int samples = usb_buffer->data_len / 2;
|
||||||
|
|
||||||
|
for (int i = 0; i < samples; i ++) {
|
||||||
|
out[i] = fix16_mul(norm_fix3_28_from_s16sample(in[i]), preprocessing.preamp);
|
||||||
|
}
|
||||||
|
|
||||||
multicore_fifo_push_blocking(samples);
|
multicore_fifo_push_blocking(samples);
|
||||||
if (preprocessing.reverse_stereo) {
|
if (preprocessing.reverse_stereo) {
|
||||||
multicore_fifo_push_blocking((uintptr_t) (in - 1));
|
multicore_fifo_push_blocking((uintptr_t) (out - 1));
|
||||||
in ++;
|
out ++;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
multicore_fifo_push_blocking((uintptr_t) in);
|
multicore_fifo_push_blocking((uintptr_t) out);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < samples; i += 2) {
|
for (int i = 0; i < samples; i += 2) {
|
||||||
fix3_28_t sample = fix16_mul(norm_fix3_28_from_s16sample(in[i]), preprocessing.preamp);
|
|
||||||
for (int j = 0; j < filter_stages; j++) {
|
for (int j = 0; j < filter_stages; j++) {
|
||||||
sample = bqf_transform(sample, &bqf_filters_left[j], &bqf_filters_mem_left[j]);
|
out[i] = bqf_transform(out[i], &bqf_filters_left[j], &bqf_filters_mem_left[j]);
|
||||||
}
|
}
|
||||||
out[i] = (int32_t) norm_fix3_28_to_s16sample(sample);
|
out[i] = (int32_t) norm_fix3_28_to_s16sample(out[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Signal to core 1 that we have processed our samples, so it can write to I2S
|
// Signal to core 1 that we have processed our samples, so it can write to I2S
|
||||||
|
@ -154,21 +157,19 @@ static void __no_inline_not_in_flash_func(_as_audio_packet)(struct usb_endpoint
|
||||||
|
|
||||||
void __no_inline_not_in_flash_func(core1_entry)() {
|
void __no_inline_not_in_flash_func(core1_entry)() {
|
||||||
uint32_t *userbuf = (uint32_t *) multicore_fifo_pop_blocking();
|
uint32_t *userbuf = (uint32_t *) multicore_fifo_pop_blocking();
|
||||||
int32_t *out = (int32_t *) userbuf;
|
|
||||||
|
|
||||||
// Signal that the thread has started
|
// Signal that the thread has started
|
||||||
multicore_fifo_push_blocking(CORE1_READY);
|
multicore_fifo_push_blocking(CORE1_READY);
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
const uint32_t samples = multicore_fifo_pop_blocking();
|
const uint32_t samples = multicore_fifo_pop_blocking();
|
||||||
int16_t *in = (int16_t *) multicore_fifo_pop_blocking();
|
int32_t *out = (int32_t *) multicore_fifo_pop_blocking();
|
||||||
|
|
||||||
for (int i = 1; i < samples; i += 2) {
|
for (int i = 1; i < samples; i += 2) {
|
||||||
fix3_28_t sample = fix16_mul(norm_fix3_28_from_s16sample(in[i]), preprocessing.preamp);
|
|
||||||
for (int j = 0; j < filter_stages; j++) {
|
for (int j = 0; j < filter_stages; j++) {
|
||||||
sample = bqf_transform(sample, &bqf_filters_right[j], &bqf_filters_mem_right[j]);
|
out[i] = bqf_transform(out[i], &bqf_filters_right[j], &bqf_filters_mem_right[j]);
|
||||||
}
|
}
|
||||||
out[i] = (int32_t) norm_fix3_28_to_s16sample(sample);
|
out[i] = (int32_t) norm_fix3_28_to_s16sample(out[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait for Core 0 to finish running its filtering before we apply config updates
|
// Wait for Core 0 to finish running its filtering before we apply config updates
|
||||||
|
|
Loading…
Reference in New Issue