move process() to its own file

This commit is contained in:
Connor Olding 2015-04-05 17:15:35 -07:00
parent 4a4e4f20d0
commit db0cd0a7dd
2 changed files with 39 additions and 32 deletions

View file

@ -125,38 +125,7 @@ process_double(personal *data,
}
}
INNER void
process(personal *data,
float *in_L, float *in_R,
float *out_L, float *out_R,
ulong count)
{
double in_L2[BLOCK_SIZE], in_R2[BLOCK_SIZE];
double out_L2[BLOCK_SIZE], out_R2[BLOCK_SIZE];
for (ulong pos = 0; pos < count; pos += BLOCK_SIZE) {
ulong rem = BLOCK_SIZE;
if (pos + BLOCK_SIZE > count)
rem = count - pos;
for (ulong i = 0; i < rem; i++)
in_L2[i] = in_L[i];
for (ulong i = 0; i < rem; i++)
in_R2[i] = in_R[i];
process_double(data, in_L2, in_R2, out_L2, out_R2, rem);
for (ulong i = 0; i < rem; i++)
out_L[i] = out_L2[i];
for (ulong i = 0; i < rem; i++)
out_R[i] = out_R2[i];
in_L += BLOCK_SIZE;
in_R += BLOCK_SIZE;
out_L += BLOCK_SIZE;
out_R += BLOCK_SIZE;
}
}
#include "process.h"
INNER void
resume(personal *data)

38
include/process.h Normal file
View file

@ -0,0 +1,38 @@
// provides a generic wrapper around process_double
#ifndef BLOCK_SIZE
#define BLOCK_SIZE 256
#endif
static void
process(personal *data,
float *in_L, float *in_R,
float *out_L, float *out_R,
ulong count)
{
double in_L2[BLOCK_SIZE], in_R2[BLOCK_SIZE];
double out_L2[BLOCK_SIZE], out_R2[BLOCK_SIZE];
for (ulong pos = 0; pos < count; pos += BLOCK_SIZE) {
ulong rem = BLOCK_SIZE;
if (pos + BLOCK_SIZE > count)
rem = count - pos;
for (ulong i = 0; i < rem; i++)
in_L2[i] = in_L[i];
for (ulong i = 0; i < rem; i++)
in_R2[i] = in_R[i];
process_double(data, in_L2, in_R2, out_L2, out_R2, rem);
for (ulong i = 0; i < rem; i++)
out_L[i] = out_L2[i];
for (ulong i = 0; i < rem; i++)
out_R[i] = out_R2[i];
in_L += BLOCK_SIZE;
in_R += BLOCK_SIZE;
out_L += BLOCK_SIZE;
out_R += BLOCK_SIZE;
}
}