Fix compilation

master
Xavier Arteaga 4 years ago committed by Xavier Arteaga
parent 63de691351
commit 8743713bb1

@ -51,7 +51,11 @@ extern "C" {
#define SRSRAN_VEC_CMA(data, average, n) ((average) + ((data) - (average)) / ((n) + 1)) #define SRSRAN_VEC_CMA(data, average, n) ((average) + ((data) - (average)) / ((n) + 1))
// Cumulative moving average // Cumulative moving average
#ifdef __cplusplus
#define SRSRAN_VEC_SAFE_CMA(data, average, n) (std::isnormal(average) ? SRSRAN_VEC_CMA(data, average, n) : (data))
#else
#define SRSRAN_VEC_SAFE_CMA(data, average, n) (isnormal(average) ? SRSRAN_VEC_CMA(data, average, n) : (data)) #define SRSRAN_VEC_SAFE_CMA(data, average, n) (isnormal(average) ? SRSRAN_VEC_CMA(data, average, n) : (data))
#endif
// Proportional moving average // Proportional moving average
#define SRSRAN_VEC_PMA(average1, n1, average2, n2) (((average1) * (n1) + (average2) * (n2)) / ((n1) + (n2))) #define SRSRAN_VEC_PMA(average1, n1, average2, n2) (((average1) * (n1) + (average2) * (n2)) / ((n1) + (n2)))
@ -60,7 +64,12 @@ extern "C" {
#define SRSRAN_VEC_EMA(data, average, alpha) ((alpha) * (data) + (1 - alpha) * (average)) #define SRSRAN_VEC_EMA(data, average, alpha) ((alpha) * (data) + (1 - alpha) * (average))
// Safe exponential moving average // Safe exponential moving average
#ifdef __cplusplus
#define SRSRAN_VEC_SAFE_EMA(data, average, alpha) \
(std::isnormal(average) ? SRSRAN_VEC_EMA(data, average, alpha) : (data))
#else
#define SRSRAN_VEC_SAFE_EMA(data, average, alpha) (isnormal(average) ? SRSRAN_VEC_EMA(data, average, alpha) : (data)) #define SRSRAN_VEC_SAFE_EMA(data, average, alpha) (isnormal(average) ? SRSRAN_VEC_EMA(data, average, alpha) : (data))
#endif
static inline float srsran_convert_amplitude_to_dB(float v) static inline float srsran_convert_amplitude_to_dB(float v)
{ {

Loading…
Cancel
Save