Skip to content
Snippets Groups Projects
Commit e84a9347 authored by Erik von Reis's avatar Erik von Reis
Browse files

Removed erronious include <math.h> and fix a user-space name collision

parent f7ad9be8
No related branches found
No related tags found
2 merge requests!439RCG 5.0 release fro deb 10,!409RCG: avx demod parts added
......@@ -4,7 +4,7 @@
#include <stdio.h>
#include <stdatomic.h>
atomic_int g_usp_rtslog_level = ATOMIC_VAR_INIT( RTSLOG_LOG_LEVEL_INFO );
atomic_int g_usp_rtslog_level = ATOMIC_VAR_INIT( RTSLOG_LOG_LEVEL_DEBUG );
void rtslog_print(int level, const char * fmt, ...)
......
#include "Biquad.h"
#include <x86intrin.h>
#include "drv/rts-logger.h"
///* iir_filter_biquad
// ************************************************************************/
......@@ -171,11 +172,9 @@ void biquad_stride2_std(const double* inp, double* out, const double* coeff,
{
// intrinsic stride width is 2
#define stride2_intrinsic 2
if (samples < 1) return;
if ((stride < stride2_intrinsic) || (stride % stride2_intrinsic != 0)) return;
if (stride_ofs <= 0) stride_ofs = stride;
// loop over stride
size_t i, n, j;
for (i = 0; i + stride2_intrinsic <= stride; i = i + stride2_intrinsic)
......
......@@ -5,7 +5,6 @@
#include <x86intrin.h>
double section3_decim_coeffs[13] ={ 0.00162185538923, 0.73342532779703,
-0.02862365091314, 1.44110125961504,
1.67905228090487, 0.77657563380963,
......@@ -54,7 +53,7 @@ void avx_stride_struct_init(avx_stride_struct* self, double rate)
void avx_stride_struct_set_frequency(avx_stride_struct* self, double freq)
{
self->freqhist = freq;
sincos(freq * self->two_pi_over_rate, self->anglexy + 1, self->anglexy + 0);
sincos(freq * self->two_pi_over_rate, self->anglexy + 1, self->anglexy + 0);
}
/* avx_stride_struct_cordic
......@@ -136,9 +135,9 @@ void demodulation_decimation_rotation8_section3_std(double inp, const double* fr
#define stride_mm64_max 32
// number of sections are 3
#define sections3_intrinsic 3
RTSLOG_DEBUG("decim_rot_std: freq[13]=%d freq[14]=%d", (int)freq[13], (int)freq[14]);
if ((stride < stride8_mm64) || (stride % stride8_mm64 != 0) || (stride > stride_mm64_max)) return;
// loop over stride to check for a frequency change
// recalculate cordic angle if necessary
// but do only one every 16th cycle
......@@ -148,6 +147,7 @@ void demodulation_decimation_rotation8_section3_std(double inp, const double* fr
if (hist->idx >= stride) hist->idx = 0;
if (fabs(freq[hist->idx] - hist->freqhist[hist->idx]) > 1E-6)
{
RTSLOG_DEBUG("setting frequencies for id %d\n", hist->idx);
avx_rotation_struct_set_frequency(hist, freq[hist->idx], hist->idx);
}
++hist->idx;
......@@ -162,8 +162,6 @@ void demodulation_decimation_rotation8_section3_std(double inp, const double* fr
x[2 * i + 1] = hist->rotation[2 * i + 1] * inp;
cordic_step(hist->rotation + 2 * i, hist->anglexy + 2 * i);
// out[2 * i + 0] = inp;
// out[2 * i + 1] = inp;
}
biquad_stride2_std(x, out, coeff, hist->hist, sections3_intrinsic, 2 * stride, 1, 0);
}
......@@ -549,7 +547,6 @@ void demodulation_decimation_stride8_section3(const double* inp, double freq,
void demodulation_decimation_rotation8_section3(double inp, const double* freq,
double* out, const double* coeff, avx_rotation_struct* hist, size_t stride)
{
RTSLOG_DEBUG("demod_rotate: input = %d, stride = %d", (int)(inp*1000.0), stride);
#if USE_AVX512
demodulation_decimation_rotation8_section3_avx512(inp, freq, out, coeff, hist, stride);
#elif USE_AVX2
......
......@@ -3,7 +3,6 @@
//
#include <string.h>
#include <math.h>
#include "Biquad.c"
#include "Demodulation.c"
......
......@@ -118,10 +118,10 @@
#define R_D_Cval(p) (lower_tail ? (0.5 - (p) + 0.5) : (p)) /* 1 - p */
#define R_DT_qIv(p) (log_p ? (lower_tail ? taylor_9th_exp(p) : - expm1(p)) \
#define R_DT_qIv(p) (log_p ? (lower_tail ? taylor_9th_exp(p) : - expm1_taylor(p)) \
: R_D_Lval(p))
#define R_DT_CIv(p) (log_p ? (lower_tail ? -expm1(p) : taylor_9th_exp(p)) \
#define R_DT_CIv(p) (log_p ? (lower_tail ? -expm1_taylor(p) : taylor_9th_exp(p)) \
: R_D_Cval(p))
// This is a simplified 9th order Taylor polynomial for e^x
......@@ -135,7 +135,7 @@ static inline double taylor_9th_exp(double x)
(15120+x*(3024+x*(504+x*(72+x*(9+x)))))))))*2.75573192e-6;
}
static inline double expm1( double x)
static inline double expm1_taylor( double x)
{
return taylor_9th_exp(x) - 1.0;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment