-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathspline_light.h
64 lines (56 loc) · 1.64 KB
/
spline_light.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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#pragma once
#include <stdint.h>
#define FLY_DATA_BUF_SIZE (3)
#define PARTS_RESULTS_COUNT (50)
typedef struct SplineFlyContextE
{
int16_t dataIdx;
int16_t resId;
uint16_t totalIdx;//id of global buf, contains number of current value
uint16_t bufIdx; //id of x,y buffer last value in bufIdx-1
bool extrsProcessed;
bool processLastExtremum;
double m_b;
double m_c;
double m_d[FLY_DATA_BUF_SIZE];
double x[FLY_DATA_BUF_SIZE];
double y[FLY_DATA_BUF_SIZE];
double lastRes;
uint16_t curOutDataIdx;
uint16_t i;
uint16_t j;
uint16_t state;
}SplineFlyContextE;
typedef struct MinMaxFlyContextE
{
int16_t dataIdx;
double kS0;
double kS1;
double kS2;
double oldxv;
double oldyv;
double minVal;
double maxVal;
uint16_t dataOutIdx;//number of min or max that exists in buffers after return from function
double x[FLY_DATA_BUF_SIZE];
double y[FLY_DATA_BUF_SIZE];
double splRes[PARTS_RESULTS_COUNT];
uint16_t splResWrId;
uint16_t splResReId;
uint16_t totalIdx;//id of global buf, contains number of current value
uint16_t bufIdx;
bool firstElemProcessed;
}MinMaxFlyContextE;
typedef struct FlyContextE
{
SplineFlyContextE splMin;
SplineFlyContextE splMax;
MinMaxFlyContextE mmMin;
MinMaxFlyContextE mmMax;
uint16_t MMContextIdx;
uint16_t bufIdx;
}FlyContextE;
void cleanContext(FlyContextE* fc);
//-1 loop detected, should never happens
//-2 broken by callback, if callback returns false execution stopped
int rParabEmd__LFlyEmb(SOURCE_TYPE* kc, SOURCE_TYPE* tBuf, int dataCnt, int qResol, int qResid, FlyContextE* fce, bool(*imfCallback)(SOURCE_TYPE* data, size_t size, size_t imf));