Initial import
git-svn-id: http://moon:8086/svn/software/trunk/libsrc/radio@1 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
Executable
+94
@@ -0,0 +1,94 @@
|
||||
// --------------------------------------------------------------
|
||||
#ifndef STATISTICS_H
|
||||
#define 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, 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, 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, char *pFilename);
|
||||
void TraceClose(trace_t *pObj);
|
||||
void TracePrint(trace_t *pObj, char *fmt, ... );
|
||||
|
||||
// --------------------------------------------------------------
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
|
||||
// --------------------------------------------------------------
|
||||
#endif // STATISTICS_H
|
||||
Reference in New Issue
Block a user