optimized samplebuffer copying

master
Clyne 3 years ago
parent d002746e25
commit e4a8d6eefc

@ -8,7 +8,7 @@ TARGET_PLATFORM = L4
# Compiler options here. # Compiler options here.
ifeq ($(USE_OPT),) ifeq ($(USE_OPT),)
USE_OPT = -Os -g3 -ggdb -fomit-frame-pointer -falign-functions=16 --specs=nosys.specs USE_OPT = -O0 -g3 -ggdb -fomit-frame-pointer -falign-functions=16 --specs=nosys.specs
endif endif
# C specific options here (added to USE_OPT). # C specific options here (added to USE_OPT).

@ -19,8 +19,8 @@ void SampleBuffer::clear() {
} }
__attribute__((section(".convcode"))) __attribute__((section(".convcode")))
void SampleBuffer::modify(Sample *data, unsigned int srcsize) { void SampleBuffer::modify(Sample *data, unsigned int srcsize) {
auto size = std::min(srcsize, m_size); auto size = srcsize < m_size ? srcsize : m_size;
size = (size + 15) & 0xFF0; size = (size + 15) & (~15);
m_modified = m_buffer; m_modified = m_buffer;
const int *src = reinterpret_cast<const int *>(data); const int *src = reinterpret_cast<const int *>(data);
@ -49,8 +49,8 @@ void SampleBuffer::modify(Sample *data, unsigned int srcsize) {
} }
__attribute__((section(".convcode"))) __attribute__((section(".convcode")))
void SampleBuffer::midmodify(Sample *data, unsigned int srcsize) { void SampleBuffer::midmodify(Sample *data, unsigned int srcsize) {
auto size = std::min(srcsize, m_size / 2); auto size = srcsize < m_size / 2 ? srcsize : m_size / 2;
size = (size + 15) & 0xFF0; size = (size + 15) & (~15);
m_modified = middata(); m_modified = middata();
const int *src = reinterpret_cast<const int *>(data); const int *src = reinterpret_cast<const int *>(data);

Loading…
Cancel
Save