aboutsummaryrefslogtreecommitdiffstats
path: root/Transceiver52M
diff options
context:
space:
mode:
authorSylvain Munaut <tnt@246tNt.com>2018-12-20 19:10:26 +0100
committerSylvain Munaut <tnt@246tNt.com>2019-01-21 10:34:51 +0100
commita3934a11a4a9cd7f510cc188192bf27302695ef5 (patch)
tree021d613ccf745d86803e4fcb4791ecedc9a2dcaf /Transceiver52M
parentacf804c0347ac279e2909359a36f48e752d0e485 (diff)
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>
Diffstat (limited to 'Transceiver52M')
-rw-r--r--Transceiver52M/Channelizer.cpp2
-rw-r--r--Transceiver52M/Resampler.cpp2
-rw-r--r--Transceiver52M/Synthesis.cpp2
-rw-r--r--Transceiver52M/arch/arm/convolve.c58
-rw-r--r--Transceiver52M/arch/common/convolve.h12
-rw-r--r--Transceiver52M/arch/common/convolve_base.c37
-rw-r--r--Transceiver52M/arch/x86/convolve.c112
-rw-r--r--Transceiver52M/arch/x86/convolve_sse_3.c20
-rw-r--r--Transceiver52M/arch/x86/convolve_sse_3.h16
-rw-r--r--Transceiver52M/sigProcLib.cpp13
10 files changed, 120 insertions, 154 deletions
diff --git a/Transceiver52M/Channelizer.cpp b/Transceiver52M/Channelizer.cpp
index 2d817b0..a18dd03 100644
--- a/Transceiver52M/Channelizer.cpp
+++ b/Transceiver52M/Channelizer.cpp
@@ -88,7 +88,7 @@ bool Channelizer::rotate(const float *in, size_t len)
convolve_real(hInputs[i], blockLen,
subFilters[i], hLen,
hOutputs[i], blockLen,
- 0, blockLen, 1, 0);
+ 0, blockLen);
}
cxvec_fft(fftHandle);
diff --git a/Transceiver52M/Resampler.cpp b/Transceiver52M/Resampler.cpp
index 6b9621c..ecd8865 100644
--- a/Transceiver52M/Resampler.cpp
+++ b/Transceiver52M/Resampler.cpp
@@ -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,
reinterpret_cast<float *>(partitions[path]),
filt_len, &out[2 * i], out_len - i,
- n, 1, 1, 0);
+ n, 1);
}
return out_len;
diff --git a/Transceiver52M/Synthesis.cpp b/Transceiver52M/Synthesis.cpp
index 262c638..6b62156 100644
--- a/Transceiver52M/Synthesis.cpp
+++ b/Transceiver52M/Synthesis.cpp
@@ -102,7 +102,7 @@ bool Synthesis::rotate(float *out, size_t len)
convolve_real(hInputs[i], blockLen,
subFilters[i], hLen,
hOutputs[i], blockLen,
- 0, blockLen, 1, 0);
+ 0, blockLen);
}
/* Interleave into output vector */
diff --git a/Transceiver52M/arch/arm/convolve.c b/Transceiver52M/arch/arm/convolve.c
index 912d0c2..5b5bce5 100644
--- a/Transceiver52M/arch/arm/convolve.c
+++ b/Transceiver52M/arch/arm/convolve.c
@@ -29,17 +29,15 @@
int _base_convolve_real(float *x, int x_len,
float *h, int h_len,
float *y, int y_len,
- int start, int len,
- int step, int offset);
+ int start, int len);
int _base_convolve_complex(float *x, int x_len,
float *h, int h_len,
float *y, int y_len,
- int start, int len,
- int step, int offset);
+ int start, int 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
/* Calls into NEON assembler */
@@ -69,35 +67,32 @@ void convolve_init(void)
int convolve_real(float *x, int x_len,
float *h, int h_len,
float *y, int y_len,
- int start, int len,
- int step, int offset)
+ int start, int len)
{
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;
memset(y, 0, len * 2 * sizeof(float));
#ifdef HAVE_NEON
- if (step <= 4) {
- switch (h_len) {
- case 4:
- conv_func = neon_conv_real4;
- break;
- case 8:
- conv_func = neon_conv_real8;
- break;
- case 12:
- conv_func = neon_conv_real12;
- break;
- case 16:
- conv_func = neon_conv_real16;
- break;
- case 20:
- conv_func = neon_conv_real20;
- break;
- }
+ switch (h_len) {
+ case 4:
+ conv_func = neon_conv_real4;
+ break;
+ case 8:
+ conv_func = neon_conv_real8;
+ break;
+ case 12:
+ conv_func = neon_conv_real12;
+ break;
+ case 16:
+ conv_func = neon_conv_real16;
+ break;
+ case 20:
+ conv_func = neon_conv_real20;
+ break;
}
#endif
if (conv_func) {
@@ -107,7 +102,7 @@ int convolve_real(float *x, int x_len,
_base_convolve_real(x, x_len,
h, h_len,
y, y_len,
- start, len, step, offset);
+ start, len);
}
return len;
@@ -118,18 +113,17 @@ int convolve_real(float *x, int x_len,
int convolve_complex(float *x, int x_len,
float *h, int h_len,
float *y, int y_len,
- int start, int len,
- int step, int offset)
+ int start, int len)
{
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;
memset(y, 0, len * 2 * sizeof(float));
#ifdef HAVE_NEON
- if (step <= 4 && !(h_len % 4))
+ if (!(h_len % 4))
conv_func = neon_conv_cmplx_4n;
#endif
if (conv_func) {
@@ -139,7 +133,7 @@ int convolve_complex(float *x, int x_len,
_base_convolve_complex(x, x_len,
h, h_len,
y, y_len,
- start, len, step, offset);
+ start, len);
}
return len;
diff --git a/Transceiver52M/arch/common/convolve.h b/Transceiver52M/arch/common/convolve.h
index 095b04c..e30f7ec 100644
--- a/Transceiver52M/arch/common/convolve.h
+++ b/Transceiver52M/arch/common/convolve.h
@@ -6,26 +6,22 @@ void *convolve_h_alloc(size_t num);
int convolve_real(const float *x, int x_len,
const float *h, int h_len,
float *y, int y_len,
- int start, int len,
- int step, int offset);
+ int start, int len);
int convolve_complex(const float *x, int x_len,
const float *h, int h_len,
float *y, int y_len,
- int start, int len,
- int step, int offset);
+ int start, int len);
int base_convolve_real(const float *x, int x_len,
const float *h, int h_len,
float *y, int y_len,
- int start, int len,
- int step, int offset);
+ int start, int len);
int base_convolve_complex(const float *x, int x_len,
const float *h, int h_len,
float *y, int y_len,
- int start, int len,
- int step, int offset);
+ int start, int len);
void convolve_init(void);
diff --git a/Transceiver52M/arch/common/convolve_base.c b/Transceiver52M/arch/common/convolve_base.c
index 2eb7124..9bb8d3d 100644
--- a/Transceiver52M/arch/common/convolve_base.c
+++ b/Transceiver52M/arch/common/convolve_base.c
@@ -41,17 +41,17 @@ static void mac_cmplx(const float *x, const float *h, float *y)
/* Base vector complex-complex multiply and accumulate */
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);
}
/* Base vector complex-complex multiply and accumulate */
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);
}
@@ -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,
const float *h, int h_len,
float *y, int y_len,
- int start, int len,
- int step, int offset)
+ int start, int len)
{
for (int i = 0; i < len; i++) {
mac_real_vec_n(&x[2 * (i - (h_len - 1) + start)],
h,
- &y[2 * i], h_len,
- step, offset);
+ &y[2 * i], h_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,
const float *h, int h_len,
float *y, int y_len,
- int start, int len,
- int step, int offset)
+ int start, int len)
{
for (int i = 0; i < len; i++) {
mac_cmplx_vec_n(&x[2 * (i - (h_len - 1) + start)],
h,
&y[2 * i],
- h_len, step, offset);
+ h_len);
}
return len;
@@ -91,10 +88,10 @@ int _base_convolve_complex(const float *x, int x_len,
/* Buffer validity checks */
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) ||
- (y_len < 1) || (len < 1) || (step < 1)) {
+ (y_len < 1) || (len < 1)) {
fprintf(stderr, "Convolve: Invalid input\n");
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,
const float *h, int h_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;
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,
h, h_len,
y, y_len,
- start, len, step, offset);
+ start, len);
}
/* API: Non-aligned (no SSE) complex-complex */
int base_convolve_complex(const float *x, int x_len,
const float *h, int h_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;
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,
h, h_len,
y, y_len,
- start, len, step, offset);
+ start, len);
}
/* Aligned filter tap allocation */
diff --git a/Transceiver52M/arch/x86/convolve.c b/Transceiver52M/arch/x86/convolve.c
index eb38f64..209d377 100644
--- a/Transceiver52M/arch/x86/convolve.c
+++ b/Transceiver52M/arch/x86/convolve.c
@@ -30,25 +30,25 @@
/* Architecture dependant function pointers */
struct convolve_cpu_context {
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 *,
- int, int, int, int, int);
+ int, int, int);
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 *,
- int, int, int, int, int);
+ int, int, int);
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 *,
- int, int, int, int, int);
+ int, int, int);
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 *,
- int, int, int, int, int);
+ int, int, int);
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,
- int, int, int, int);
+ int, int);
};
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,
const float *h, int h_len,
float *y, int y_len,
- int start, int len,
- int step, int offset);
+ int start, int len);
int _base_convolve_complex(const float *x, int x_len,
const float *h, int h_len,
float *y, int y_len,
- int start, int len,
- int step, int offset);
+ int start, int 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 */
void convolve_init(void)
@@ -99,46 +97,37 @@ void convolve_init(void)
/* API: Aligned complex-real */
int convolve_real(const float *x, int x_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;
memset(y, 0, len * 2 * sizeof(float));
- if (step <= 4) {
- switch (h_len) {
- case 4:
- c.conv_real4(x, x_len, h, h_len, y, y_len, start, len,
- step, offset);
- break;
- case 8:
- c.conv_real8(x, x_len, h, h_len, y, y_len, start, len,
- step, offset);
- break;
- case 12:
- c.conv_real12(x, x_len, h, h_len, y, y_len, start, len,
- step, offset);
- break;
- case 16:
- c.conv_real16(x, x_len, h, h_len, y, y_len, start, len,
- step, offset);
- break;
- case 20:
- c.conv_real20(x, x_len, h, h_len, y, y_len, start, len,
- step, offset);
- break;
- default:
- if (!(h_len % 4))
- c.conv_real4n(x, x_len, h, h_len, y, y_len,
- start, len, step, offset);
- else
- c.conv_real(x, x_len, h, h_len, y, y_len, start,
- len, step, offset);
- }
- } else
- c.conv_real(x, x_len, h, h_len, y, y_len, start, len, step,
- offset);
+ switch (h_len) {
+ case 4:
+ c.conv_real4(x, x_len, h, h_len, y, y_len, start, len);
+ break;
+ case 8:
+ c.conv_real8(x, x_len, h, h_len, y, y_len, start, len);
+ break;
+ case 12:
+ c.conv_real12(x, x_len, h, h_len, y, y_len, start, len);
+ break;
+ case 16:
+ c.conv_real16(x, x_len, h, h_len, y, y_len, start, len);
+ break;
+ case 20:
+ c.conv_real20(x, x_len, h, h_len, y, y_len, start, len);
+ break;
+ default:
+ if (!(h_len % 4))
+ c.conv_real4n(x, x_len, h, h_len, y, y_len,
+ start, len);
+ else
+ c.conv_real(x, x_len, h, h_len, y, y_len, start,
+ 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,
const float *h, int h_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;
memset(y, 0, len * 2 * sizeof(float));
- if (step <= 4) {
- if (!(h_len % 8))
- c.conv_cmplx_8n(x, x_len, h, h_len, y, y_len, start,
- len, step, offset);
- else if (!(h_len % 4))
- c.conv_cmplx_4n(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);
- } else
- c.conv_cmplx(x, x_len, h, h_len, y, y_len, start, len, step,
- offset);
+ if (!(h_len % 8))
+ c.conv_cmplx_8n(x, x_len, h, h_len, y, y_len, start, len);
+ else if (!(h_len % 4))
+ c.conv_cmplx_4n(x, x_len, h, h_len, y, y_len, start, len);
+ else
+ c.conv_cmplx(x, x_len, h, h_len, y, y_len, start, len);
return len;
}
diff --git a/Transceiver52M/arch/x86/convolve_sse_3.c b/Transceiver52M/arch/x86/convolve_sse_3.c
index dbee3cc..8fd3b5e 100644
--- a/Transceiver52M/arch/x86/convolve_sse_3.c
+++ b/Transceiver52M/arch/x86/convolve_sse_3.c
@@ -34,12 +34,12 @@
void sse_conv_real4(const float *x, int x_len,
const float *h, int h_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
* list of _base_convolve_real() in convolve_base.c. This specific
* 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;
@@ -75,7 +75,7 @@ void sse_conv_real4(const float *x, int x_len,
void sse_conv_real8(const float *x, int x_len,
const float *h, int h_len,
float *y, int y_len,
- int start, int len, int step, int offset)
+ int start, int len)
{
/* 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,
const float *h, int h_len,
float *y, int y_len,
- int start, int len, int step, int offset)
+ int start, int len)
{
/* 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,
const float *h, int h_len,
float *y, int y_len,
- int start, int len, int step, int offset)
+ int start, int len)
{
/* 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,
const float *h, int h_len,
float *y, int y_len,
- int start, int len, int step, int offset)
+ int start, int len)
{
/* 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,
const float *h, int h_len,
float *y, int y_len,
- int start, int len, int step, int offset)
+ int start, int len)
{
/* 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,
const float *h, int h_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
* list of _base_convolve_complex() in convolve_base.c. This specific
* 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;
@@ -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,
const float *h, int h_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() */
diff --git a/Transceiver52M/arch/x86/convolve_sse_3.h b/Transceiver52M/arch/x86/convolve_sse_3.h
index ac30ca5..d929ef6 100644
--- a/Transceiver52M/arch/x86/convolve_sse_3.h
+++ b/Transceiver52M/arch/x86/convolve_sse_3.h
@@ -23,46 +23,46 @@
void sse_conv_real4(const float *x, int x_len,
const float *h, int h_len,
float *y, int y_len,
- int start, int len, int step, int offset);
+ int start, int len);
/* 8-tap SSE complex-real convolution */
void sse_conv_real8(const float *x, int x_len,
const float *h, int h_len,
float *y, int y_len,
- int start, int len, int step, int offset);
+ int start, int len);
/* 12-tap SSE complex-real convolution */
void sse_conv_real12(const float *x, int x_len,
const float *h, int h_len,
float *y, int y_len,
- int start, int len, int step, int offset);
+ int start, int len);
/* 16-tap SSE complex-real convolution */
void sse_conv_real16(const float *x, int x_len,
const float *h, int h_len,
float *y, int y_len,
- int start, int len, int step, int offset);
+ int start, int len);
/* 20-tap SSE complex-real convolution */
void sse_conv_real20(const float *x, int x_len,
const float *h, int h_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 */
void sse_conv_real4n(const float *x, int x_len,
const float *h, int h_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 */
void sse_conv_cmplx_4n(const float *x, int x_len,
const float *h, int h_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 */
void sse_conv_cmplx_8n(const float *x, int x_len,
const float *h, int h_len,
float *y, int y_len,
- int start, int len, int step, int offset);
+ int start, int len);
diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp
index f720828..fcda5fa 100644
--- a/Transceiver52M/sigProcLib.cpp
+++ b/Transceiver52M/sigProcLib.cpp
@@ -285,8 +285,7 @@ enum ConvType {
static signalVector *convolve(const signalVector *x, const signalVector *h,
signalVector *y, ConvType spanType,
- size_t start = 0, size_t len = 0,
- size_t step = 1, int offset = 0)
+ size_t start = 0, size_t len = 0)
{
int rc;
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(),
(float *) h->begin(), h->size(),
(float *) y->begin(), y->size(),
- start, len, step, offset);
+ start, len);
} else if (!h->isReal() && h->isAligned()) {
rc = convolve_complex((float *) _x->begin(), _x->size(),
(float *) h->begin(), h->size(),
(float *) y->begin(), y->size(),
- start, len, step, offset);
+ start, len);
} else if (h->isReal() && !h->isAligned()) {
rc = base_convolve_real((float *) _x->begin(), _x->size(),
(float *) h->begin(), h->size(),
(float *) y->begin(), y->size(),
- start, len, step, offset);
+ start, len);
} else if (!h->isReal() && !h->isAligned()) {
rc = base_convolve_complex((float *) _x->begin(), _x->size(),
(float *) h->begin(), h->size(),
(float *) y->begin(), y->size(),
- start, len, step, offset);
+ start, len);
} else {
rc = -1;
}
@@ -1482,7 +1481,7 @@ static int detectBurst(const signalVector &burst,
/* Correlate */
if (!convolve(corr_in, sync->sequence, &corr,
- CUSTOM, start, len, 1, 0)) {
+ CUSTOM, start, len)) {
delete dec;
return -1;
}