git-svn-id: http://moon:8086/svn/software/trunk/libsrc/radio@934 b431acfa-c32f-4a4a-93f1-934dc6c82436
95 lines
2.5 KiB
C
Executable File
95 lines
2.5 KiB
C
Executable File
// --------------------------------------------------------------
|
|
#ifndef _RADIO_STATISTICS_H_
|
|
#define _RADIO_STATISTICS_H_
|
|
|
|
#include <stdio.h> // Trace()
|
|
#include <stdarg.h> // Trace()
|
|
|
|
#include "radio_types.h"
|
|
#include "real.h"
|
|
#include "ringbuf.h"
|
|
|
|
// --------------------------------------------------------------
|
|
// Types
|
|
// --------------------------------------------------------------
|
|
typedef struct _sl_mean_t
|
|
{
|
|
rbuf_t buf;
|
|
uint32_t normalize_count;
|
|
radio_float_t Nr;
|
|
radio_float_t sum;
|
|
radio_float_t element_max;
|
|
radio_float_t mean;
|
|
|
|
} sl_mean_t;
|
|
|
|
typedef struct _sl_var_t
|
|
{
|
|
rbuf_t buf;
|
|
uint32_t normalize_count;
|
|
radio_float_t Nr;
|
|
radio_float_t sum;
|
|
radio_float_t var;
|
|
sl_mean_t sl_mean;
|
|
|
|
} sl_var_t;
|
|
|
|
typedef struct _sl_minmax_t
|
|
{
|
|
uint32_t L;
|
|
uint32_t N;
|
|
radio_float_t P;
|
|
radio_float_t *pU;
|
|
radio_float_t *pU_last;
|
|
uint32_t *pP;
|
|
uint32_t *pP_last;
|
|
radio_float_t max;
|
|
radio_float_t mode;
|
|
|
|
} sl_minmax_t;
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
// --------------------------------------------------------------
|
|
// Functions
|
|
// --------------------------------------------------------------
|
|
// Sliding Mean
|
|
void SlidingMeanInit(sl_mean_t *pObj, int N);
|
|
void SlidingMeanFree(sl_mean_t *pObj);
|
|
radio_float_t SlidingMeanProcess(sl_mean_t *pObj, radio_float_t x);
|
|
void SlidingMeanProcessV(sl_mean_t *pObj, const radio_float_t *pX, uint32_t len);
|
|
radio_float_t SlidingMeanGet(sl_mean_t *pObj);
|
|
|
|
// Sliding Variance
|
|
void SlidingVarInit(sl_var_t *pObj, int Npwr, int Nmean);
|
|
void SlidingVarFree(sl_var_t *pObj);
|
|
radio_float_t SlidingVarProcess(sl_var_t *pObj, radio_float_t x);
|
|
void SlidingVarProcessV(sl_var_t *pObj, const radio_float_t *pX, uint32_t len);
|
|
radio_float_t SlidingVarGet(sl_var_t *pObj);
|
|
|
|
// Sliding Min/Max
|
|
void SlidingMinMaxInit(sl_minmax_t *pObj, uint32_t L, radio_float_t P, radio_float_t mode);
|
|
void SlidingMinMaxFree(sl_minmax_t *pObj);
|
|
radio_float_t SlidingMinMaxProcess(sl_minmax_t *pObj, radio_float_t x);
|
|
void SlidingMinMaxProcessV(sl_minmax_t *pObj, radio_float_t *pX, uint32_t len);
|
|
radio_float_t SlidingMinMaxGet(sl_minmax_t *pObj);
|
|
|
|
typedef struct _trace_t
|
|
{
|
|
FILE *pFile;
|
|
} trace_t;
|
|
|
|
void TraceOpen(trace_t *pObj, const char *pFilename);
|
|
void TraceClose(trace_t *pObj);
|
|
void TracePrint(trace_t *pObj, const char *fmt, ... );
|
|
|
|
// --------------------------------------------------------------
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif // __cplusplus
|
|
|
|
// --------------------------------------------------------------
|
|
#endif // _RADIO_STATISTICS_H_
|