more refactoring, splitting calibrate code out of sprrow struct
[sparrow.git] / calibrate.h
blob3c3f5584e04c8f12b76cd6bcddc288ad3e2cc59a
1 #ifndef __SPARROW_CALIBRATE_H__
2 #define __SPARROW_CALIBRATE_H__
5 #define CALIBRATE_ON_MIN_T 2
6 #define CALIBRATE_ON_MAX_T 7
7 #define CALIBRATE_OFF_MIN_T 2
8 #define CALIBRATE_OFF_MAX_T 9
9 #define CALIBRATE_SELF_SIZE 24
11 #define CALIBRATE_MAX_VOTE_ERROR 5
12 #define CALIBRATE_MAX_BEST_ERROR 2
13 #define CALIBRATE_INITIAL_WAIT 72
14 #define CALIBRATE_RETRY_WAIT 16
16 #define CALIBRATE_SIGNAL_THRESHOLD 200
18 #define MAX_CALIBRATE_SHAPES 4
20 #define WAIT_COUNTDOWN (MAX(CALIBRATE_OFF_MAX_T, CALIBRATE_ON_MAX_T) + 3)
22 #define MAX_CALIBRATION_LAG 12
23 typedef struct lag_times_s {
24 //guint32 hits;
25 guint64 record;
26 } lag_times_t;
28 enum calibration_shape {
29 NO_SHAPE = 0,
30 VERTICAL_LINE,
31 HORIZONTAL_LINE,
32 FULLSCREEN,
33 RECTANGLE,
36 typedef struct sparrow_shape_s {
37 /*Calibration shape definition -- a rectangle.*/
38 enum calibration_shape shape;
39 gint x;
40 gint y;
41 gint w;
42 gint h;
43 } sparrow_shape_t;
46 typedef struct sparrow_calibrate_s {
47 /*calibration state, and shape and pattern definition */
48 gboolean on; /*for calibration pattern */
49 gint wait;
50 guint32 transitions;
51 guint32 incolour;
52 guint32 outcolour;
53 sparrow_shape_t shapes[MAX_CALIBRATE_SHAPES];
54 int n_shapes;
56 IplImage *in_ipl[SPARROW_N_IPL_IN];
57 lag_times_t *lag_table;
58 guint64 lag_record;
60 } sparrow_calibrate_t;
63 #endif