convolve: Remove support for step, offset parameters

- Those are not used any where
 - Those are not supported by the sse/neon accelerated versions
 - And I see very little use cases for those.

Change-Id: Ic850269a0ed5d98c0ea68980afd31016ed555b48
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
This commit is contained in:
Sylvain Munaut 2018-12-20 19:10:26 +01:00
parent acf804c034
commit a3934a11a4
11 changed files with 124 additions and 166 deletions

View File

@ -88,7 +88,7 @@ bool Channelizer::rotate(const float *in, size_t len)
convolve_real(hInputs[i], blockLen, convolve_real(hInputs[i], blockLen,
subFilters[i], hLen, subFilters[i], hLen,
hOutputs[i], blockLen, hOutputs[i], blockLen,
0, blockLen, 1, 0); 0, blockLen);
} }
cxvec_fft(fftHandle); cxvec_fft(fftHandle);

View File

@ -143,7 +143,7 @@ int Resampler::rotate(const float *in, size_t in_len, float *out, size_t out_len
convolve_real(in, in_len, convolve_real(in, in_len,
reinterpret_cast<float *>(partitions[path]), reinterpret_cast<float *>(partitions[path]),
filt_len, &out[2 * i], out_len - i, filt_len, &out[2 * i], out_len - i,
n, 1, 1, 0); n, 1);
} }
return out_len; return out_len;

View File

@ -102,7 +102,7 @@ bool Synthesis::rotate(float *out, size_t len)
convolve_real(hInputs[i], blockLen, convolve_real(hInputs[i], blockLen,
subFilters[i], hLen, subFilters[i], hLen,
hOutputs[i], blockLen, hOutputs[i], blockLen,
0, blockLen, 1, 0); 0, blockLen);
} }
/* Interleave into output vector */ /* Interleave into output vector */

View File

@ -29,17 +29,15 @@
int _base_convolve_real(float *x, int x_len, int _base_convolve_real(float *x, int x_len,
float *h, int h_len, float *h, int h_len,
float *y, int y_len, float *y, int y_len,
int start, int len, int start, int len);
int step, int offset);
int _base_convolve_complex(float *x, int x_len, int _base_convolve_complex(float *x, int x_len,
float *h, int h_len, float *h, int h_len,
float *y, int y_len, float *y, int y_len,
int start, int len, int start, int len);
int step, int offset);
int bounds_check(int x_len, int h_len, int y_len, int bounds_check(int x_len, int h_len, int y_len,
int start, int len, int step); int start, int len);
#ifdef HAVE_NEON #ifdef HAVE_NEON
/* Calls into NEON assembler */ /* Calls into NEON assembler */
@ -69,18 +67,16 @@ void convolve_init(void)
int convolve_real(float *x, int x_len, int convolve_real(float *x, int x_len,
float *h, int h_len, float *h, int h_len,
float *y, int y_len, float *y, int y_len,
int start, int len, int start, int len)
int step, int offset)
{ {
void (*conv_func)(float *, float *, float *, int) = NULL; void (*conv_func)(float *, float *, float *, int) = NULL;
if (bounds_check(x_len, h_len, y_len, start, len, step) < 0) if (bounds_check(x_len, h_len, y_len, start, len) < 0)
return -1; return -1;
memset(y, 0, len * 2 * sizeof(float)); memset(y, 0, len * 2 * sizeof(float));
#ifdef HAVE_NEON #ifdef HAVE_NEON
if (step <= 4) {
switch (h_len) { switch (h_len) {
case 4: case 4:
conv_func = neon_conv_real4; conv_func = neon_conv_real4;
@ -98,7 +94,6 @@ int convolve_real(float *x, int x_len,
conv_func = neon_conv_real20; conv_func = neon_conv_real20;
break; break;
} }
}
#endif #endif
if (conv_func) { if (conv_func) {
conv_func(&x[2 * (-(h_len - 1) + start)], conv_func(&x[2 * (-(h_len - 1) + start)],
@ -107,7 +102,7 @@ int convolve_real(float *x, int x_len,
_base_convolve_real(x, x_len, _base_convolve_real(x, x_len,
h, h_len, h, h_len,
y, y_len, y, y_len,
start, len, step, offset); start, len);
} }
return len; return len;
@ -118,18 +113,17 @@ int convolve_real(float *x, int x_len,
int convolve_complex(float *x, int x_len, int convolve_complex(float *x, int x_len,
float *h, int h_len, float *h, int h_len,
float *y, int y_len, float *y, int y_len,
int start, int len, int start, int len)
int step, int offset)
{ {
void (*conv_func)(float *, float *, float *, int, int) = NULL; void (*conv_func)(float *, float *, float *, int, int) = NULL;
if (bounds_check(x_len, h_len, y_len, start, len, step) < 0) if (bounds_check(x_len, h_len, y_len, start, len) < 0)
return -1; return -1;
memset(y, 0, len * 2 * sizeof(float)); memset(y, 0, len * 2 * sizeof(float));
#ifdef HAVE_NEON #ifdef HAVE_NEON
if (step <= 4 && !(h_len % 4)) if (!(h_len % 4))
conv_func = neon_conv_cmplx_4n; conv_func = neon_conv_cmplx_4n;
#endif #endif
if (conv_func) { if (conv_func) {
@ -139,7 +133,7 @@ int convolve_complex(float *x, int x_len,
_base_convolve_complex(x, x_len, _base_convolve_complex(x, x_len,
h, h_len, h, h_len,
y, y_len, y, y_len,
start, len, step, offset); start, len);
} }
return len; return len;

View File

@ -6,26 +6,22 @@ void *convolve_h_alloc(size_t num);
int convolve_real(const float *x, int x_len, int convolve_real(const float *x, int x_len,
const float *h, int h_len, const float *h, int h_len,
float *y, int y_len, float *y, int y_len,
int start, int len, int start, int len);
int step, int offset);
int convolve_complex(const float *x, int x_len, int convolve_complex(const float *x, int x_len,
const float *h, int h_len, const float *h, int h_len,
float *y, int y_len, float *y, int y_len,
int start, int len, int start, int len);
int step, int offset);
int base_convolve_real(const float *x, int x_len, int base_convolve_real(const float *x, int x_len,
const float *h, int h_len, const float *h, int h_len,
float *y, int y_len, float *y, int y_len,
int start, int len, int start, int len);
int step, int offset);
int base_convolve_complex(const float *x, int x_len, int base_convolve_complex(const float *x, int x_len,
const float *h, int h_len, const float *h, int h_len,
float *y, int y_len, float *y, int y_len,
int start, int len, int start, int len);
int step, int offset);
void convolve_init(void); void convolve_init(void);

View File

@ -41,17 +41,17 @@ static void mac_cmplx(const float *x, const float *h, float *y)
/* Base vector complex-complex multiply and accumulate */ /* Base vector complex-complex multiply and accumulate */
static void mac_real_vec_n(const float *x, const float *h, float *y, static void mac_real_vec_n(const float *x, const float *h, float *y,
int len, int step, int offset) int len)
{ {
for (int i = offset; i < len; i += step) for (int i=0; i<len; i++)
mac_real(&x[2 * i], &h[2 * i], y); mac_real(&x[2 * i], &h[2 * i], y);
} }
/* Base vector complex-complex multiply and accumulate */ /* Base vector complex-complex multiply and accumulate */
static void mac_cmplx_vec_n(const float *x, const float *h, float *y, static void mac_cmplx_vec_n(const float *x, const float *h, float *y,
int len, int step, int offset) int len)
{ {
for (int i = offset; i < len; i += step) for (int i=0; i<len; i++)
mac_cmplx(&x[2 * i], &h[2 * i], y); mac_cmplx(&x[2 * i], &h[2 * i], y);
} }
@ -59,14 +59,12 @@ static void mac_cmplx_vec_n(const float *x, const float *h, float *y,
int _base_convolve_real(const float *x, int x_len, int _base_convolve_real(const float *x, int x_len,
const float *h, int h_len, const float *h, int h_len,
float *y, int y_len, float *y, int y_len,
int start, int len, int start, int len)
int step, int offset)
{ {
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
mac_real_vec_n(&x[2 * (i - (h_len - 1) + start)], mac_real_vec_n(&x[2 * (i - (h_len - 1) + start)],
h, h,
&y[2 * i], h_len, &y[2 * i], h_len);
step, offset);
} }
return len; return len;
@ -76,14 +74,13 @@ int _base_convolve_real(const float *x, int x_len,
int _base_convolve_complex(const float *x, int x_len, int _base_convolve_complex(const float *x, int x_len,
const float *h, int h_len, const float *h, int h_len,
float *y, int y_len, float *y, int y_len,
int start, int len, int start, int len)
int step, int offset)
{ {
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
mac_cmplx_vec_n(&x[2 * (i - (h_len - 1) + start)], mac_cmplx_vec_n(&x[2 * (i - (h_len - 1) + start)],
h, h,
&y[2 * i], &y[2 * i],
h_len, step, offset); h_len);
} }
return len; return len;
@ -91,10 +88,10 @@ int _base_convolve_complex(const float *x, int x_len,
/* Buffer validity checks */ /* Buffer validity checks */
int bounds_check(int x_len, int h_len, int y_len, int bounds_check(int x_len, int h_len, int y_len,
int start, int len, int step) int start, int len)
{ {
if ((x_len < 1) || (h_len < 1) || if ((x_len < 1) || (h_len < 1) ||
(y_len < 1) || (len < 1) || (step < 1)) { (y_len < 1) || (len < 1)) {
fprintf(stderr, "Convolve: Invalid input\n"); fprintf(stderr, "Convolve: Invalid input\n");
return -1; return -1;
} }
@ -113,10 +110,9 @@ int bounds_check(int x_len, int h_len, int y_len,
int base_convolve_real(const float *x, int x_len, int base_convolve_real(const float *x, int x_len,
const float *h, int h_len, const float *h, int h_len,
float *y, int y_len, float *y, int y_len,
int start, int len, int start, int len)
int step, int offset)
{ {
if (bounds_check(x_len, h_len, y_len, start, len, step) < 0) if (bounds_check(x_len, h_len, y_len, start, len) < 0)
return -1; return -1;
memset(y, 0, len * 2 * sizeof(float)); memset(y, 0, len * 2 * sizeof(float));
@ -124,17 +120,16 @@ int base_convolve_real(const float *x, int x_len,
return _base_convolve_real(x, x_len, return _base_convolve_real(x, x_len,
h, h_len, h, h_len,
y, y_len, y, y_len,
start, len, step, offset); start, len);
} }
/* API: Non-aligned (no SSE) complex-complex */ /* API: Non-aligned (no SSE) complex-complex */
int base_convolve_complex(const float *x, int x_len, int base_convolve_complex(const float *x, int x_len,
const float *h, int h_len, const float *h, int h_len,
float *y, int y_len, float *y, int y_len,
int start, int len, int start, int len)
int step, int offset)
{ {
if (bounds_check(x_len, h_len, y_len, start, len, step) < 0) if (bounds_check(x_len, h_len, y_len, start, len) < 0)
return -1; return -1;
memset(y, 0, len * 2 * sizeof(float)); memset(y, 0, len * 2 * sizeof(float));
@ -142,7 +137,7 @@ int base_convolve_complex(const float *x, int x_len,
return _base_convolve_complex(x, x_len, return _base_convolve_complex(x, x_len,
h, h_len, h, h_len,
y, y_len, y, y_len,
start, len, step, offset); start, len);
} }
/* Aligned filter tap allocation */ /* Aligned filter tap allocation */

View File

@ -30,25 +30,25 @@
/* Architecture dependant function pointers */ /* Architecture dependant function pointers */
struct convolve_cpu_context { struct convolve_cpu_context {
void (*conv_cmplx_4n) (const float *, int, const float *, int, float *, void (*conv_cmplx_4n) (const float *, int, const float *, int, float *,
int, int, int, int, int); int, int, int);
void (*conv_cmplx_8n) (const float *, int, const float *, int, float *, void (*conv_cmplx_8n) (const float *, int, const float *, int, float *,
int, int, int, int, int); int, int, int);
void (*conv_cmplx) (const float *, int, const float *, int, float *, void (*conv_cmplx) (const float *, int, const float *, int, float *,
int, int, int, int, int); int, int, int);
void (*conv_real4) (const float *, int, const float *, int, float *, void (*conv_real4) (const float *, int, const float *, int, float *,
int, int, int, int, int); int, int, int);
void (*conv_real8) (const float *, int, const float *, int, float *, void (*conv_real8) (const float *, int, const float *, int, float *,
int, int, int, int, int); int, int, int);
void (*conv_real12) (const float *, int, const float *, int, float *, void (*conv_real12) (const float *, int, const float *, int, float *,
int, int, int, int, int); int, int, int);
void (*conv_real16) (const float *, int, const float *, int, float *, void (*conv_real16) (const float *, int, const float *, int, float *,
int, int, int, int, int); int, int, int);
void (*conv_real20) (const float *, int, const float *, int, float *, void (*conv_real20) (const float *, int, const float *, int, float *,
int, int, int, int, int); int, int, int);
void (*conv_real4n) (const float *, int, const float *, int, float *, void (*conv_real4n) (const float *, int, const float *, int, float *,
int, int, int, int, int); int, int, int);
void (*conv_real) (const float *, int, const float *, int, float *, int, void (*conv_real) (const float *, int, const float *, int, float *, int,
int, int, int, int); int, int);
}; };
static struct convolve_cpu_context c; static struct convolve_cpu_context c;
@ -56,17 +56,15 @@ static struct convolve_cpu_context c;
int _base_convolve_real(const float *x, int x_len, int _base_convolve_real(const float *x, int x_len,
const float *h, int h_len, const float *h, int h_len,
float *y, int y_len, float *y, int y_len,
int start, int len, int start, int len);
int step, int offset);
int _base_convolve_complex(const float *x, int x_len, int _base_convolve_complex(const float *x, int x_len,
const float *h, int h_len, const float *h, int h_len,
float *y, int y_len, float *y, int y_len,
int start, int len, int start, int len);
int step, int offset);
int bounds_check(int x_len, int h_len, int y_len, int bounds_check(int x_len, int h_len, int y_len,
int start, int len, int step); int start, int len);
/* API: Initalize convolve module */ /* API: Initalize convolve module */
void convolve_init(void) void convolve_init(void)
@ -99,46 +97,37 @@ void convolve_init(void)
/* API: Aligned complex-real */ /* API: Aligned complex-real */
int convolve_real(const float *x, int x_len, int convolve_real(const float *x, int x_len,
const float *h, int h_len, const float *h, int h_len,
float *y, int y_len, int start, int len, int step, int offset) float *y, int y_len, int start, int len)
{ {
if (bounds_check(x_len, h_len, y_len, start, len, step) < 0) if (bounds_check(x_len, h_len, y_len, start, len) < 0)
return -1; return -1;
memset(y, 0, len * 2 * sizeof(float)); memset(y, 0, len * 2 * sizeof(float));
if (step <= 4) {
switch (h_len) { switch (h_len) {
case 4: case 4:
c.conv_real4(x, x_len, h, h_len, y, y_len, start, len, c.conv_real4(x, x_len, h, h_len, y, y_len, start, len);
step, offset);
break; break;
case 8: case 8:
c.conv_real8(x, x_len, h, h_len, y, y_len, start, len, c.conv_real8(x, x_len, h, h_len, y, y_len, start, len);
step, offset);
break; break;
case 12: case 12:
c.conv_real12(x, x_len, h, h_len, y, y_len, start, len, c.conv_real12(x, x_len, h, h_len, y, y_len, start, len);
step, offset);
break; break;
case 16: case 16:
c.conv_real16(x, x_len, h, h_len, y, y_len, start, len, c.conv_real16(x, x_len, h, h_len, y, y_len, start, len);
step, offset);
break; break;
case 20: case 20:
c.conv_real20(x, x_len, h, h_len, y, y_len, start, len, c.conv_real20(x, x_len, h, h_len, y, y_len, start, len);
step, offset);
break; break;
default: default:
if (!(h_len % 4)) if (!(h_len % 4))
c.conv_real4n(x, x_len, h, h_len, y, y_len, c.conv_real4n(x, x_len, h, h_len, y, y_len,
start, len, step, offset); start, len);
else else
c.conv_real(x, x_len, h, h_len, y, y_len, start, c.conv_real(x, x_len, h, h_len, y, y_len, start,
len, step, offset); len);
} }
} else
c.conv_real(x, x_len, h, h_len, y, y_len, start, len, step,
offset);
return len; return len;
} }
@ -147,26 +136,19 @@ int convolve_real(const float *x, int x_len,
int convolve_complex(const float *x, int x_len, int convolve_complex(const float *x, int x_len,
const float *h, int h_len, const float *h, int h_len,
float *y, int y_len, float *y, int y_len,
int start, int len, int step, int offset) int start, int len)
{ {
if (bounds_check(x_len, h_len, y_len, start, len, step) < 0) if (bounds_check(x_len, h_len, y_len, start, len) < 0)
return -1; return -1;
memset(y, 0, len * 2 * sizeof(float)); memset(y, 0, len * 2 * sizeof(float));
if (step <= 4) {
if (!(h_len % 8)) if (!(h_len % 8))
c.conv_cmplx_8n(x, x_len, h, h_len, y, y_len, start, c.conv_cmplx_8n(x, x_len, h, h_len, y, y_len, start, len);
len, step, offset);
else if (!(h_len % 4)) else if (!(h_len % 4))
c.conv_cmplx_4n(x, x_len, h, h_len, y, y_len, start, c.conv_cmplx_4n(x, x_len, h, h_len, y, y_len, start, len);
len, step, offset);
else else
c.conv_cmplx(x, x_len, h, h_len, y, y_len, start, len, c.conv_cmplx(x, x_len, h, h_len, y, y_len, start, len);
step, offset);
} else
c.conv_cmplx(x, x_len, h, h_len, y, y_len, start, len, step,
offset);
return len; return len;
} }

View File

@ -34,12 +34,12 @@
void sse_conv_real4(const float *x, int x_len, void sse_conv_real4(const float *x, int x_len,
const float *h, int h_len, const float *h, int h_len,
float *y, int y_len, float *y, int y_len,
int start, int len, int step, int offset) int start, int len)
{ {
/* NOTE: The parameter list of this function has to match the parameter /* NOTE: The parameter list of this function has to match the parameter
* list of _base_convolve_real() in convolve_base.c. This specific * list of _base_convolve_real() in convolve_base.c. This specific
* implementation, ignores some of the parameters of * implementation, ignores some of the parameters of
* _base_convolve_complex(), which are: x_len, y_len, offset, step */ * _base_convolve_complex(), which are: x_len, y_len. */
__m128 m0, m1, m2, m3, m4, m5, m6, m7; __m128 m0, m1, m2, m3, m4, m5, m6, m7;
@ -75,7 +75,7 @@ void sse_conv_real4(const float *x, int x_len,
void sse_conv_real8(const float *x, int x_len, void sse_conv_real8(const float *x, int x_len,
const float *h, int h_len, const float *h, int h_len,
float *y, int y_len, float *y, int y_len,
int start, int len, int step, int offset) int start, int len)
{ {
/* See NOTE in sse_conv_real4() */ /* See NOTE in sse_conv_real4() */
@ -126,7 +126,7 @@ void sse_conv_real8(const float *x, int x_len,
void sse_conv_real12(const float *x, int x_len, void sse_conv_real12(const float *x, int x_len,
const float *h, int h_len, const float *h, int h_len,
float *y, int y_len, float *y, int y_len,
int start, int len, int step, int offset) int start, int len)
{ {
/* See NOTE in sse_conv_real4() */ /* See NOTE in sse_conv_real4() */
@ -192,7 +192,7 @@ void sse_conv_real12(const float *x, int x_len,
void sse_conv_real16(const float *x, int x_len, void sse_conv_real16(const float *x, int x_len,
const float *h, int h_len, const float *h, int h_len,
float *y, int y_len, float *y, int y_len,
int start, int len, int step, int offset) int start, int len)
{ {
/* See NOTE in sse_conv_real4() */ /* See NOTE in sse_conv_real4() */
@ -271,7 +271,7 @@ void sse_conv_real16(const float *x, int x_len,
void sse_conv_real20(const float *x, int x_len, void sse_conv_real20(const float *x, int x_len,
const float *h, int h_len, const float *h, int h_len,
float *y, int y_len, float *y, int y_len,
int start, int len, int step, int offset) int start, int len)
{ {
/* See NOTE in sse_conv_real4() */ /* See NOTE in sse_conv_real4() */
@ -361,7 +361,7 @@ void sse_conv_real20(const float *x, int x_len,
void sse_conv_real4n(const float *x, int x_len, void sse_conv_real4n(const float *x, int x_len,
const float *h, int h_len, const float *h, int h_len,
float *y, int y_len, float *y, int y_len,
int start, int len, int step, int offset) int start, int len)
{ {
/* See NOTE in sse_conv_real4() */ /* See NOTE in sse_conv_real4() */
@ -408,12 +408,12 @@ void sse_conv_real4n(const float *x, int x_len,
void sse_conv_cmplx_4n(const float *x, int x_len, void sse_conv_cmplx_4n(const float *x, int x_len,
const float *h, int h_len, const float *h, int h_len,
float *y, int y_len, float *y, int y_len,
int start, int len, int step, int offset) int start, int len)
{ {
/* NOTE: The parameter list of this function has to match the parameter /* NOTE: The parameter list of this function has to match the parameter
* list of _base_convolve_complex() in convolve_base.c. This specific * list of _base_convolve_complex() in convolve_base.c. This specific
* implementation, ignores some of the parameters of * implementation, ignores some of the parameters of
* _base_convolve_complex(), which are: x_len, y_len, offset, step. */ * _base_convolve_complex(), which are: x_len, y_len. */
__m128 m0, m1, m2, m3, m4, m5, m6, m7; __m128 m0, m1, m2, m3, m4, m5, m6, m7;
@ -466,7 +466,7 @@ void sse_conv_cmplx_4n(const float *x, int x_len,
void sse_conv_cmplx_8n(const float *x, int x_len, void sse_conv_cmplx_8n(const float *x, int x_len,
const float *h, int h_len, const float *h, int h_len,
float *y, int y_len, float *y, int y_len,
int start, int len, int step, int offset) int start, int len)
{ {
/* See NOTE in sse_conv_cmplx_4n() */ /* See NOTE in sse_conv_cmplx_4n() */

View File

@ -23,46 +23,46 @@
void sse_conv_real4(const float *x, int x_len, void sse_conv_real4(const float *x, int x_len,
const float *h, int h_len, const float *h, int h_len,
float *y, int y_len, float *y, int y_len,
int start, int len, int step, int offset); int start, int len);
/* 8-tap SSE complex-real convolution */ /* 8-tap SSE complex-real convolution */
void sse_conv_real8(const float *x, int x_len, void sse_conv_real8(const float *x, int x_len,
const float *h, int h_len, const float *h, int h_len,
float *y, int y_len, float *y, int y_len,
int start, int len, int step, int offset); int start, int len);
/* 12-tap SSE complex-real convolution */ /* 12-tap SSE complex-real convolution */
void sse_conv_real12(const float *x, int x_len, void sse_conv_real12(const float *x, int x_len,
const float *h, int h_len, const float *h, int h_len,
float *y, int y_len, float *y, int y_len,
int start, int len, int step, int offset); int start, int len);
/* 16-tap SSE complex-real convolution */ /* 16-tap SSE complex-real convolution */
void sse_conv_real16(const float *x, int x_len, void sse_conv_real16(const float *x, int x_len,
const float *h, int h_len, const float *h, int h_len,
float *y, int y_len, float *y, int y_len,
int start, int len, int step, int offset); int start, int len);
/* 20-tap SSE complex-real convolution */ /* 20-tap SSE complex-real convolution */
void sse_conv_real20(const float *x, int x_len, void sse_conv_real20(const float *x, int x_len,
const float *h, int h_len, const float *h, int h_len,
float *y, int y_len, float *y, int y_len,
int start, int len, int step, int offset); int start, int len);
/* 4*N-tap SSE complex-real convolution */ /* 4*N-tap SSE complex-real convolution */
void sse_conv_real4n(const float *x, int x_len, void sse_conv_real4n(const float *x, int x_len,
const float *h, int h_len, const float *h, int h_len,
float *y, int y_len, float *y, int y_len,
int start, int len, int step, int offset); int start, int len);
/* 4*N-tap SSE complex-complex convolution */ /* 4*N-tap SSE complex-complex convolution */
void sse_conv_cmplx_4n(const float *x, int x_len, void sse_conv_cmplx_4n(const float *x, int x_len,
const float *h, int h_len, const float *h, int h_len,
float *y, int y_len, float *y, int y_len,
int start, int len, int step, int offset); int start, int len);
/* 8*N-tap SSE complex-complex convolution */ /* 8*N-tap SSE complex-complex convolution */
void sse_conv_cmplx_8n(const float *x, int x_len, void sse_conv_cmplx_8n(const float *x, int x_len,
const float *h, int h_len, const float *h, int h_len,
float *y, int y_len, float *y, int y_len,
int start, int len, int step, int offset); int start, int len);

View File

@ -285,8 +285,7 @@ enum ConvType {
static signalVector *convolve(const signalVector *x, const signalVector *h, static signalVector *convolve(const signalVector *x, const signalVector *h,
signalVector *y, ConvType spanType, signalVector *y, ConvType spanType,
size_t start = 0, size_t len = 0, size_t start = 0, size_t len = 0)
size_t step = 1, int offset = 0)
{ {
int rc; int rc;
size_t head = 0, tail = 0; size_t head = 0, tail = 0;
@ -354,22 +353,22 @@ static signalVector *convolve(const signalVector *x, const signalVector *h,
rc = convolve_real((float *) _x->begin(), _x->size(), rc = convolve_real((float *) _x->begin(), _x->size(),
(float *) h->begin(), h->size(), (float *) h->begin(), h->size(),
(float *) y->begin(), y->size(), (float *) y->begin(), y->size(),
start, len, step, offset); start, len);
} else if (!h->isReal() && h->isAligned()) { } else if (!h->isReal() && h->isAligned()) {
rc = convolve_complex((float *) _x->begin(), _x->size(), rc = convolve_complex((float *) _x->begin(), _x->size(),
(float *) h->begin(), h->size(), (float *) h->begin(), h->size(),
(float *) y->begin(), y->size(), (float *) y->begin(), y->size(),
start, len, step, offset); start, len);
} else if (h->isReal() && !h->isAligned()) { } else if (h->isReal() && !h->isAligned()) {
rc = base_convolve_real((float *) _x->begin(), _x->size(), rc = base_convolve_real((float *) _x->begin(), _x->size(),
(float *) h->begin(), h->size(), (float *) h->begin(), h->size(),
(float *) y->begin(), y->size(), (float *) y->begin(), y->size(),
start, len, step, offset); start, len);
} else if (!h->isReal() && !h->isAligned()) { } else if (!h->isReal() && !h->isAligned()) {
rc = base_convolve_complex((float *) _x->begin(), _x->size(), rc = base_convolve_complex((float *) _x->begin(), _x->size(),
(float *) h->begin(), h->size(), (float *) h->begin(), h->size(),
(float *) y->begin(), y->size(), (float *) y->begin(), y->size(),
start, len, step, offset); start, len);
} else { } else {
rc = -1; rc = -1;
} }
@ -1482,7 +1481,7 @@ static int detectBurst(const signalVector &burst,
/* Correlate */ /* Correlate */
if (!convolve(corr_in, sync->sequence, &corr, if (!convolve(corr_in, sync->sequence, &corr,
CUSTOM, start, len, 1, 0)) { CUSTOM, start, len)) {
delete dec; delete dec;
return -1; return -1;
} }

View File

@ -62,21 +62,17 @@ static void test_convolve_complex(int h_len)
int y_len; int y_len;
int start; int start;
int len; int len;
int step;
int offset;
x_len=34; x_len=34;
y_len=26; y_len=26;
start=8; start=8;
len=26; len=26;
step=1;
offset=1;
reset_testvec(0); reset_testvec(0);
dump_floats(x,x_len,"x"); dump_floats(x,x_len,"x");
printf("\n"); printf("\n");
dump_floats(h,h_len,"h"); dump_floats(h,h_len,"h");
printf("\n"); printf("\n");
convolve_complex(x, x_len, h, h_len, y, y_len, start, len, step, offset); convolve_complex(x, x_len, h, h_len, y, y_len, start, len);
dump_floats(y,y_len,"y"); dump_floats(y,y_len,"y");
printf("\n"); printf("\n");
} }
@ -88,21 +84,17 @@ static void test_convolve_real(int h_len)
int y_len; int y_len;
int start; int start;
int len; int len;
int step;
int offset;
x_len=34; x_len=34;
y_len=26; y_len=26;
start=8; start=8;
len=26; len=26;
step=1;
offset=1;
reset_testvec(0); reset_testvec(0);
dump_floats(x,x_len,"x"); dump_floats(x-30,2*x_len+30,"x");
printf("\n"); printf("\n");
dump_floats(h,h_len,"h"); dump_floats(h,2*h_len,"h");
printf("\n"); printf("\n");
convolve_real(x, x_len, h, h_len, y, y_len, start, len, step, offset); convolve_real(x, x_len, h, h_len, y, y_len, start, len);
dump_floats(y,y_len,"y"); dump_floats(y,y_len,"y");
printf("\n"); printf("\n");
} }