-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMedianFilter.h
25 lines (21 loc) · 912 Bytes
/
MedianFilter.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#ifndef MEDIANFILTER_H_
#define MEDIANFILTER_H_
typedef struct sMedianNode
{
int value; //sample value
struct sMedianNode *nextAge; //pointer to next oldest value
struct sMedianNode *nextValue; //pointer to next smallest value
struct sMedianNode *prevValue; //pointer to previous smallest value
}sMedianNode_t;
typedef struct
{
unsigned int numNodes; //median node buffer length
sMedianNode_t *medianBuffer; //median node buffer
sMedianNode_t *ageHead; //pointer to oldest value
sMedianNode_t *valueHead; //pointer to smallest value
sMedianNode_t *medianHead; //pointer to median value
unsigned char init; //initilizated filter (fill with first value)
}sMedianFilter_t;
int MEDIANFILTER_Init(sMedianFilter_t *medianFilter);
int MEDIANFILTER_Insert(sMedianFilter_t *medianFilter, int sample);
#endif