further tomfoolery

This commit is contained in:
Connor Olding 2015-06-10 23:53:13 -07:00
parent bc72410062
commit aa77c87c28
14 changed files with 47 additions and 44 deletions

View File

@ -94,11 +94,11 @@ $(UTILS): %: $(BIN)/%
$(BIN)/%.exe: $(BIN)/% $(BIN)/%.exe: $(BIN)/%
@echo ' OBJCOPY '$@ @echo ' OBJCOPY '$@
@$(OBJCOPY) $< $@ @$(OBJCOPY) -S $< $@
$(BIN)/%.dll: $(BIN)/%.so $(BIN)/%.dll: $(BIN)/%.so
@echo ' OBJCOPY '$@ @echo ' OBJCOPY '$@
@$(OBJCOPY) $< $@ @$(OBJCOPY) -S $< $@
$(BIN)/ladspa/%.so: $(BIN)/ladspa/%.o $(BIN)/ladspa/%.so: $(BIN)/ladspa/%.o
@echo ' CXXLD '$@ @echo ' CXXLD '$@

View File

@ -1,5 +1,3 @@
#define BLOCK_SIZE 256
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>

View File

@ -1,5 +1,3 @@
#define BLOCK_SIZE 256
#include <string.h> #include <string.h>
#include "util.hpp" #include "util.hpp"

View File

@ -1,5 +1,3 @@
#define BLOCK_SIZE 256
#include <string.h> #include <string.h>
#include "util.hpp" #include "util.hpp"

View File

@ -1,5 +1,3 @@
#define BLOCK_SIZE 256
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <assert.h> #include <assert.h>

View File

@ -1,7 +1,3 @@
#define BLOCK_SIZE 256
#define OVERSAMPLING 2
#define FULL_SIZE (BLOCK_SIZE*OVERSAMPLING)
/* /*
an implementation of: an implementation of:
S. D Angelo and V. Välimäki. Generalized Moog Ladder Filter: Part II S. D Angelo and V. Välimäki. Generalized Moog Ladder Filter: Part II
@ -18,6 +14,9 @@ https://aaltodoc.aalto.fi/bitstream/handle/123456789/14420/article6.pdf
#include "Param.hpp" #include "Param.hpp"
#include "Crap.hpp" #include "Crap.hpp"
#include "os2piir.hpp" #include "os2piir.hpp"
#define OVERSAMPLING 2
#define FULL_SIZE (BLOCK_SIZE*OVERSAMPLING)
#include "Buffer2OS2.hpp" #include "Buffer2OS2.hpp"
#define VT 0.026 #define VT 0.026

View File

@ -1,7 +1,3 @@
#define OVERSAMPLING 2
#define BLOCK_SIZE 256
#define FULL_SIZE (BLOCK_SIZE*OVERSAMPLING)
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
@ -9,6 +5,9 @@
#include "Param.hpp" #include "Param.hpp"
#include "Crap.hpp" #include "Crap.hpp"
#include "os2piir.hpp" #include "os2piir.hpp"
#define OVERSAMPLING 2
#define FULL_SIZE (BLOCK_SIZE*OVERSAMPLING)
#include "Buffer2OS2.hpp" #include "Buffer2OS2.hpp"
typedef struct { typedef struct {

View File

@ -16,15 +16,15 @@ struct Buffer2 : public Mixin {
rem = count - pos; rem = count - pos;
for (ulong i = 0; i < rem; i++) { for (ulong i = 0; i < rem; i++) {
buf[i].v[0] = in_L[i]; buf[i][0] = in_L[i];
buf[i].v[1] = in_R[i]; buf[i][1] = in_R[i];
} }
process2(buf, rem); process2(buf, rem);
for (ulong i = 0; i < rem; i++) { for (ulong i = 0; i < rem; i++) {
out_L[i] = buf[i].v[0]; out_L[i] = buf[i][0];
out_R[i] = buf[i].v[1]; out_R[i] = buf[i][1];
} }
in_L += BLOCK_SIZE; in_L += BLOCK_SIZE;

View File

@ -19,19 +19,19 @@ struct Buffer4 : public Mixin {
rem = count - pos; rem = count - pos;
for (ulong i = 0, j = 0; i < rem; i += 2, j++) { for (ulong i = 0, j = 0; i < rem; i += 2, j++) {
buf_L[j].v[0] = in_L[i+0]; buf_L[j][0] = in_L[i+0];
buf_L[j].v[1] = in_L[i+1]; buf_L[j][1] = in_L[i+1];
buf_R[j].v[0] = in_R[i+0]; buf_R[j][0] = in_R[i+0];
buf_R[j].v[1] = in_R[i+1]; buf_R[j][1] = in_R[i+1];
} }
process2(buf_L, buf_R, rem); process2(buf_L, buf_R, rem);
for (ulong i = 0, j = 0; i < rem; i += 2, j++) { for (ulong i = 0, j = 0; i < rem; i += 2, j++) {
out_L[i+0] = buf_L[j].v[0]; out_L[i+0] = buf_L[j][0];
out_L[i+1] = buf_L[j].v[1]; out_L[i+1] = buf_L[j][1];
out_R[i+0] = buf_R[j].v[0]; out_R[i+0] = buf_R[j][0];
out_R[i+1] = buf_R[j].v[1]; out_R[i+1] = buf_R[j][1];
} }
in_L += BLOCK_SIZE; in_L += BLOCK_SIZE;

View File

@ -83,4 +83,3 @@ struct Dumber : public DumberBase<T> {
Dumber(DumberBase<T> v2) : DumberBase<T>(v2) Dumber(DumberBase<T> v2) : DumberBase<T>(v2)
{} {}
}; };

View File

@ -123,18 +123,18 @@ svf_run_block_mat(svf_matrix<T> *RESTRICT mat, T *RESTRICT buf, ulong count)
T t1, t2, t3, t4; T t1, t2, t3, t4;
T memory = mat->memory; T memory = mat->memory;
for (ulong i = 0; i < count/2; i++) { for (ulong i = 0; i < count/2; i++) {
memory.v[0] = buf[i].v[0]; memory[0] = buf[i][0];
memory.v[1] = buf[i].v[1]; memory[1] = buf[i][1];
t1 = mat->a*memory; t1 = mat->a*memory;
t2 = mat->b*memory; t2 = mat->b*memory;
t3 = mat->c*memory; t3 = mat->c*memory;
t4 = mat->d*memory; t4 = mat->d*memory;
memory.v[0] = t1.v[0] + t1.v[1] + t1.v[2] + t1.v[3]; memory[0] = t1[0] + t1[1] + t1[2] + t1[3];
memory.v[1] = t2.v[0] + t2.v[1] + t2.v[2] + t2.v[3]; memory[1] = t2[0] + t2[1] + t2[2] + t2[3];
memory.v[2] = t3.v[0] + t3.v[1] + t3.v[2] + t3.v[3]; memory[2] = t3[0] + t3[1] + t3[2] + t3[3];
memory.v[3] = t4.v[0] + t4.v[1] + t4.v[2] + t4.v[3]; memory[3] = t4[0] + t4[1] + t4[2] + t4[3];
buf[i].v[0] = memory.v[0]; buf[i][0] = memory[0];
buf[i].v[1] = memory.v[1]; buf[i][1] = memory[1];
} }
mat->memory = memory; mat->memory = memory;
} }

View File

@ -14,6 +14,10 @@
typedef unsigned long ulong; // __attribute((aligned(16))); typedef unsigned long ulong; // __attribute((aligned(16)));
#ifndef BLOCK_SIZE
#define BLOCK_SIZE 256
#endif
#include "Dumber.hpp" #include "Dumber.hpp"
#include "vectors.hpp" #include "vectors.hpp"

View File

@ -73,6 +73,16 @@ struct Dumber<_v4sf> : public DumberBase<_v4sf> {
TEMPLATE inline TEMPLATE inline
Dumber(T x) Dumber(T x)
{ v = (_v4sf){float(x), float(x), float(x), float(x)}; } { v = (_v4sf){float(x), float(x), float(x), float(x)}; }
inline float &
operator[](int index) {
return ((float *)&v)[index];
}
inline const float &
operator[](int index) const {
return ((float *)&v)[index];
}
}; };
typedef Dumber<_v2df> v2df; typedef Dumber<_v2df> v2df;

View File

@ -9,7 +9,7 @@
#include "ladspa.hpp" #include "ladspa.hpp"
#include "util.hpp" #include "util.hpp"
#define BLOCK_SIZE 2048 #define BENCH_BLOCK 2048
void *plug = NULL; void *plug = NULL;
static float *audio_buffer; static float *audio_buffer;
@ -109,12 +109,12 @@ main(int argc, char **argv)
if (LADSPA_IS_PORT_AUDIO(d->PortDescriptors[i])) if (LADSPA_IS_PORT_AUDIO(d->PortDescriptors[i]))
audio_count++; audio_count++;
audio_buffer = (decltype(audio_buffer)) calloc(audio_count*BLOCK_SIZE, sizeof(float)); audio_buffer = (decltype(audio_buffer)) calloc(audio_count*BENCH_BLOCK, sizeof(float));
int a = 0; int a = 0;
for (int i = 0; i < d->PortCount; i++) { for (int i = 0; i < d->PortCount; i++) {
if (LADSPA_IS_PORT_AUDIO(d->PortDescriptors[i])) { if (LADSPA_IS_PORT_AUDIO(d->PortDescriptors[i])) {
d->connect_port(h, i, audio_buffer + a++*BLOCK_SIZE); d->connect_port(h, i, audio_buffer + a++*BENCH_BLOCK);
} else { } else {
float *x; float *x;
x = (decltype(x)) alloca(sizeof(float)); x = (decltype(x)) alloca(sizeof(float));
@ -124,12 +124,12 @@ main(int argc, char **argv)
} }
unsigned int mirand = time(NULL); unsigned int mirand = time(NULL);
for (int i = 0; i < audio_count*BLOCK_SIZE; i++) for (int i = 0; i < audio_count*BENCH_BLOCK; i++)
audio_buffer[i] = whitenoise(mirand); audio_buffer[i] = whitenoise(mirand);
if (d->activate) d->activate(h); if (d->activate) d->activate(h);
for (int i = 0; i < 64*64*8; i++) for (int i = 0; i < 64*64*8; i++)
d->run(h, BLOCK_SIZE); d->run(h, BENCH_BLOCK);
if (d->deactivate) d->deactivate(h); if (d->deactivate) d->deactivate(h);
d->cleanup(h); d->cleanup(h);