22
22
#include " pitsync1.h"
23
23
24
24
ELISTIZE (FPSEGPT) CLISTIZE (FPSEGPT_LIST)
25
- #define EXTERN
26
- EXTERN
27
- INT_VAR (pitsync_linear_version, 6 , " Use new fast algorithm" );
28
- EXTERN
29
- double_VAR (pitsync_joined_edge, 0.75 ,
30
- " Dist inside big blob for chopping" );
31
- EXTERN
32
- double_VAR (pitsync_offset_freecut_fraction, 0.25 ,
33
- " Fraction of cut for free cuts" );
34
- EXTERN
35
- INT_VAR (pitsync_fake_depth, 1 , " Max advance fake generation" );
25
+
26
+ INT_VAR(pitsync_linear_version, 6 , " Use new fast algorithm" );
27
+ double_VAR (pitsync_joined_edge, 0.75 , " Dist inside big blob for chopping" );
28
+ double_VAR (pitsync_offset_freecut_fraction, 0.25 ,
29
+ " Fraction of cut for free cuts" );
30
+ INT_VAR (pitsync_fake_depth, 1 , " Max advance fake generation" );
36
31
37
32
/* *********************************************************************
38
33
* FPSEGPT::FPSEGPT
@@ -63,7 +58,7 @@ FPSEGPT::FPSEGPT( //constructor
63
58
**********************************************************************/
64
59
65
60
FPSEGPT::FPSEGPT ( // constructor
66
- int16_t x // position
61
+ int16_t x // position
67
62
):xpos (x) {
68
63
pred = nullptr ;
69
64
mean_sum = 0 ;
@@ -83,17 +78,22 @@ int16_t x //position
83
78
**********************************************************************/
84
79
85
80
FPSEGPT::FPSEGPT ( // constructor
86
- int16_t x, // position
81
+ int16_t x, // position
87
82
BOOL8 faking, // faking this one
88
- int16_t offset, // dist to gap
89
- int16_t region_index, // segment number
90
- int16_t pitch, // proposed pitch
91
- int16_t pitch_error, // allowed tolerance
83
+ int16_t offset, // dist to gap
84
+ int16_t region_index, // segment number
85
+ int16_t pitch, // proposed pitch
86
+ int16_t pitch_error, // allowed tolerance
92
87
FPSEGPT_LIST * prev_list // previous segment
93
- ):xpos (x) {
94
- int16_t best_fake; // on previous
88
+ )
89
+ : fake_count(0 ),
90
+ xpos(x),
91
+ mean_sum(0.0 ),
92
+ sq_sum(0.0 )
93
+ {
94
+ int16_t best_fake; // on previous
95
95
FPSEGPT *segpt; // segment point
96
- int32_t dist; // from prev segment
96
+ int32_t dist; // from prev segment
97
97
double sq_dist; // squared distance
98
98
double mean; // mean pitch
99
99
double total; // total dists
@@ -133,7 +133,6 @@ FPSEGPT_LIST * prev_list //previous segment
133
133
pred = nullptr ; // fail it
134
134
}
135
135
136
-
137
136
/* *********************************************************************
138
137
* check_pitch_sync
139
138
*
@@ -144,28 +143,28 @@ FPSEGPT_LIST * prev_list //previous segment
144
143
145
144
double check_pitch_sync ( // find segmentation
146
145
BLOBNBOX_IT *blob_it, // blobs to do
147
- int16_t blob_count, // no of blobs
148
- int16_t pitch, // pitch estimate
149
- int16_t pitch_error, // tolerance
146
+ int16_t blob_count, // no of blobs
147
+ int16_t pitch, // pitch estimate
148
+ int16_t pitch_error, // tolerance
150
149
STATS *projection, // vertical
151
150
FPSEGPT_LIST *seg_list // output list
152
151
) {
153
- int16_t x; // current coord
154
- int16_t min_index; // blob number
155
- int16_t max_index; // blob number
156
- int16_t left_edge; // of word
157
- int16_t right_edge; // of word
158
- int16_t right_max; // max allowed x
159
- int16_t min_x; // in this region
152
+ int16_t x; // current coord
153
+ int16_t min_index; // blob number
154
+ int16_t max_index; // blob number
155
+ int16_t left_edge; // of word
156
+ int16_t right_edge; // of word
157
+ int16_t right_max; // max allowed x
158
+ int16_t min_x; // in this region
160
159
int16_t max_x;
161
160
int16_t region_index;
162
- int16_t best_region_index = 0 ; // for best result
163
- int16_t offset; // dist to legal area
164
- int16_t left_best_x; // edge of good region
165
- int16_t right_best_x; // right edge
166
- TBOX min_box; // bounding box
167
- TBOX max_box; // bounding box
168
- TBOX next_box; // box of next blob
161
+ int16_t best_region_index = 0 ; // for best result
162
+ int16_t offset; // dist to legal area
163
+ int16_t left_best_x; // edge of good region
164
+ int16_t right_best_x; // right edge
165
+ TBOX min_box; // bounding box
166
+ TBOX max_box; // bounding box
167
+ TBOX next_box; // box of next blob
169
168
FPSEGPT *segpt; // segment point
170
169
FPSEGPT_LIST *segpts; // points in a segment
171
170
double best_cost; // best path
@@ -362,17 +361,17 @@ double check_pitch_sync( //find segmentation
362
361
363
362
void make_illegal_segment ( // find segmentation
364
363
FPSEGPT_LIST *prev_list, // previous segments
365
- TBOX blob_box, // bounding box
364
+ TBOX blob_box, // bounding box
366
365
BLOBNBOX_IT blob_it, // iterator
367
- int16_t region_index, // number of segment
368
- int16_t pitch, // pitch estimate
369
- int16_t pitch_error, // tolerance
366
+ int16_t region_index, // number of segment
367
+ int16_t pitch, // pitch estimate
368
+ int16_t pitch_error, // tolerance
370
369
FPSEGPT_LIST *seg_list // output list
371
370
) {
372
- int16_t x; // current coord
373
- int16_t min_x = 0 ; // in this region
371
+ int16_t x; // current coord
372
+ int16_t min_x = 0 ; // in this region
374
373
int16_t max_x = 0 ;
375
- int16_t offset; // dist to edge
374
+ int16_t offset; // dist to edge
376
375
FPSEGPT *segpt; // segment point
377
376
FPSEGPT *prevpt; // previous point
378
377
float best_cost; // best path
0 commit comments