Tesseract  3.02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FPSEGPT Class Reference

#include <pitsync1.h>

Inheritance diagram for FPSEGPT:
ELIST_LINK

Public Member Functions

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

Public Attributes

BOOL8 faked
 
BOOL8 terminal
 
inT16 fake_count
 

Detailed Description

Definition at line 34 of file pitsync1.h.

Constructor & Destructor Documentation

FPSEGPT::FPSEGPT ( )
inline

Definition at line 37 of file pitsync1.h.

37  { //empty
38  }
FPSEGPT::FPSEGPT ( inT16  x)

Definition at line 71 of file pitsync1.cpp.

73  :xpos (x) {
74  pred = NULL;
75  mean_sum = 0;
76  sq_sum = 0;
77  cost = 0;
78  faked = FALSE;
79  terminal = FALSE;
80  fake_count = 0;
81  mid_cuts = 0;
82 }
BOOL8 faked
Definition: pitsync1.h:71
BOOL8 terminal
Definition: pitsync1.h:72
#define NULL
Definition: host.h:144
#define FALSE
Definition: capi.h:28
inT16 fake_count
Definition: pitsync1.h:73
FPSEGPT::FPSEGPT ( inT16  x,
BOOL8  faking,
inT16  offset,
inT16  region_index,
inT16  pitch,
inT16  pitch_error,
FPSEGPT_LIST *  prev_list 
)

Definition at line 91 of file pitsync1.cpp.

99  :xpos (x) {
100  inT16 best_fake; //on previous
101  FPSEGPT *segpt; //segment point
102  inT32 dist; //from prev segment
103  double sq_dist; //squared distance
104  double mean; //mean pitch
105  double total; //total dists
106  double factor; //cost function
107  FPSEGPT_IT pred_it = prev_list;//for previuos segment
108 
109  cost = MAX_FLOAT32;
110  pred = NULL;
111  faked = faking;
112  terminal = FALSE;
113  best_fake = MAX_INT16;
114  mid_cuts = 0;
115  for (pred_it.mark_cycle_pt (); !pred_it.cycled_list (); pred_it.forward ()) {
116  segpt = pred_it.data ();
117  if (segpt->fake_count < best_fake)
118  best_fake = segpt->fake_count;
119  dist = x - segpt->xpos;
120  if (dist >= pitch - pitch_error && dist <= pitch + pitch_error
121  && !segpt->terminal) {
122  total = segpt->mean_sum + dist;
123  sq_dist = dist * dist + segpt->sq_sum + offset * offset;
124  //sum of squarees
125  mean = total / region_index;
126  factor = mean - pitch;
127  factor *= factor;
128  factor += sq_dist / (region_index) - mean * mean;
129  if (factor < cost) {
130  cost = factor; //find least cost
131  pred = segpt; //save path
132  mean_sum = total;
133  sq_sum = sq_dist;
134  fake_count = segpt->fake_count + faked;
135  }
136  }
137  }
138  if (fake_count > best_fake + 1)
139  pred = NULL; //fail it
140 }
BOOL8 faked
Definition: pitsync1.h:71
BOOL8 terminal
Definition: pitsync1.h:72
#define NULL
Definition: host.h:144
int inT32
Definition: host.h:102
#define FALSE
Definition: capi.h:28
inT16 fake_count
Definition: pitsync1.h:73
#define MAX_FLOAT32
Definition: host.h:124
short inT16
Definition: host.h:100
#define MAX_INT16
Definition: host.h:119
FPSEGPT::FPSEGPT ( FPCUTPT cutpt)

Definition at line 50 of file pitsync1.cpp.

52  {
53  pred = NULL;
54  mean_sum = cutpt->sum ();
55  sq_sum = cutpt->squares ();
56  cost = cutpt->cost_function ();
57  faked = cutpt->faked;
58  terminal = cutpt->terminal;
59  fake_count = cutpt->fake_count;
60  xpos = cutpt->position ();
61  mid_cuts = cutpt->cheap_cuts ();
62 }
BOOL8 faked
Definition: pitsync1.h:71
inT32 position()
Definition: pithsync.h:70
BOOL8 terminal
Definition: pitsync1.h:72
BOOL8 faked
Definition: pithsync.h:92
double cost_function()
Definition: pithsync.h:73
#define NULL
Definition: host.h:144
double squares()
Definition: pithsync.h:76
inT16 fake_count
Definition: pitsync1.h:73
inT16 fake_count
Definition: pithsync.h:94
inT16 cheap_cuts() const
Definition: pithsync.h:85
BOOL8 terminal
Definition: pithsync.h:93
double sum()
Definition: pithsync.h:79

Member Function Documentation

inT16 FPSEGPT::cheap_cuts ( ) const
inline

Definition at line 66 of file pitsync1.h.

66  { //no of cheap cuts
67  return mid_cuts;
68  }
double FPSEGPT::cost_function ( )
inline

Definition at line 54 of file pitsync1.h.

54  {
55  return cost;
56  }
inT32 FPSEGPT::position ( )
inline

Definition at line 51 of file pitsync1.h.

51  { //acces func
52  return xpos;
53  }
FPSEGPT* FPSEGPT::previous ( )
inline

Definition at line 63 of file pitsync1.h.

63  {
64  return pred;
65  }
double FPSEGPT::squares ( )
inline

Definition at line 57 of file pitsync1.h.

57  {
58  return sq_sum;
59  }
double FPSEGPT::sum ( )
inline

Definition at line 60 of file pitsync1.h.

60  {
61  return mean_sum;
62  }

Member Data Documentation

inT16 FPSEGPT::fake_count

Definition at line 73 of file pitsync1.h.

BOOL8 FPSEGPT::faked

Definition at line 71 of file pitsync1.h.

BOOL8 FPSEGPT::terminal

Definition at line 72 of file pitsync1.h.


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