tesseract 4.1.1
Loading...
Searching...
No Matches
FPSEGPT Class Reference

#include <pitsync1.h>

Inheritance diagram for FPSEGPT:
ELIST_LINK

Public Member Functions

 FPSEGPT ()=default
 
 FPSEGPT (int16_t x)
 
 FPSEGPT (int16_t x, bool faking, int16_t offset, int16_t region_index, int16_t pitch, int16_t pitch_error, FPSEGPT_LIST *prev_list)
 
 FPSEGPT (FPCUTPT *cutpt)
 
int32_t position ()
 
double cost_function ()
 
double squares ()
 
double sum ()
 
FPSEGPTprevious ()
 
int16_t cheap_cuts () const
 
- Public Member Functions inherited from ELIST_LINK
 ELIST_LINK ()
 
 ELIST_LINK (const ELIST_LINK &)
 
void operator= (const ELIST_LINK &)
 

Public Attributes

bool faked
 
bool terminal
 
int16_t fake_count
 

Detailed Description

Definition at line 32 of file pitsync1.h.

Constructor & Destructor Documentation

◆ FPSEGPT() [1/4]

FPSEGPT::FPSEGPT ( )
default

◆ FPSEGPT() [2/4]

FPSEGPT::FPSEGPT ( int16_t  x)

Definition at line 59 of file pitsync1.cpp.

61 :xpos (x) {
62 pred = nullptr;
63 mean_sum = 0;
64 sq_sum = 0;
65 cost = 0;
66 faked = false;
67 terminal = false;
68 fake_count = 0;
69 mid_cuts = 0;
70}
bool terminal
Definition: pitsync1.h:68
int16_t fake_count
Definition: pitsync1.h:69
bool faked
Definition: pitsync1.h:67

◆ FPSEGPT() [3/4]

FPSEGPT::FPSEGPT ( int16_t  x,
bool  faking,
int16_t  offset,
int16_t  region_index,
int16_t  pitch,
int16_t  pitch_error,
FPSEGPT_LIST *  prev_list 
)

Definition at line 79 of file pitsync1.cpp.

88: fake_count(0),
89 xpos(x),
90 mean_sum(0.0),
91 sq_sum(0.0)
92{
93 int16_t best_fake; //on previous
94 FPSEGPT *segpt; //segment point
95 int32_t dist; //from prev segment
96 double sq_dist; //squared distance
97 double mean; //mean pitch
98 double total; //total dists
99 double factor; //cost function
100 FPSEGPT_IT pred_it = prev_list;//for previuos segment
101
102 cost = FLT_MAX;
103 pred = nullptr;
104 faked = faking;
105 terminal = false;
106 best_fake = INT16_MAX;
107 mid_cuts = 0;
108 for (pred_it.mark_cycle_pt (); !pred_it.cycled_list (); pred_it.forward ()) {
109 segpt = pred_it.data ();
110 if (segpt->fake_count < best_fake)
111 best_fake = segpt->fake_count;
112 dist = x - segpt->xpos;
113 if (dist >= pitch - pitch_error && dist <= pitch + pitch_error
114 && !segpt->terminal) {
115 total = segpt->mean_sum + dist;
116 sq_dist = dist * dist + segpt->sq_sum + offset * offset;
117 //sum of squarees
118 mean = total / region_index;
119 factor = mean - pitch;
120 factor *= factor;
121 factor += sq_dist / (region_index) - mean * mean;
122 if (factor < cost) {
123 cost = factor; //find least cost
124 pred = segpt; //save path
125 mean_sum = total;
126 sq_sum = sq_dist;
127 fake_count = segpt->fake_count + faked;
128 }
129 }
130 }
131 if (fake_count > best_fake + 1)
132 pred = nullptr; //fail it
133}

◆ FPSEGPT() [4/4]

FPSEGPT::FPSEGPT ( FPCUTPT cutpt)

Definition at line 38 of file pitsync1.cpp.

40 {
41 pred = nullptr;
42 mean_sum = cutpt->sum ();
43 sq_sum = cutpt->squares ();
44 cost = cutpt->cost_function ();
45 faked = cutpt->faked;
46 terminal = cutpt->terminal;
47 fake_count = cutpt->fake_count;
48 xpos = cutpt->position ();
49 mid_cuts = cutpt->cheap_cuts ();
50}
double squares()
Definition: pithsync.h:73
int16_t cheap_cuts() const
Definition: pithsync.h:82
int16_t fake_count
Definition: pithsync.h:91
bool faked
Definition: pithsync.h:89
double cost_function()
Definition: pithsync.h:70
double sum()
Definition: pithsync.h:76
bool terminal
Definition: pithsync.h:90
int32_t position()
Definition: pithsync.h:67

Member Function Documentation

◆ cheap_cuts()

int16_t FPSEGPT::cheap_cuts ( ) const
inline

Definition at line 63 of file pitsync1.h.

63 { //no of cheap cuts
64 return mid_cuts;
65 }

◆ cost_function()

double FPSEGPT::cost_function ( )
inline

Definition at line 51 of file pitsync1.h.

51 {
52 return cost;
53 }

◆ position()

int32_t FPSEGPT::position ( )
inline

Definition at line 48 of file pitsync1.h.

48 { // access func
49 return xpos;
50 }

◆ previous()

FPSEGPT * FPSEGPT::previous ( )
inline

Definition at line 60 of file pitsync1.h.

60 {
61 return pred;
62 }

◆ squares()

double FPSEGPT::squares ( )
inline

Definition at line 54 of file pitsync1.h.

54 {
55 return sq_sum;
56 }

◆ sum()

double FPSEGPT::sum ( )
inline

Definition at line 57 of file pitsync1.h.

57 {
58 return mean_sum;
59 }

Member Data Documentation

◆ fake_count

int16_t FPSEGPT::fake_count

Definition at line 69 of file pitsync1.h.

◆ faked

bool FPSEGPT::faked

Definition at line 67 of file pitsync1.h.

◆ terminal

bool FPSEGPT::terminal

Definition at line 68 of file pitsync1.h.


The documentation for this class was generated from the following files: