46 # define MAX_DELTA_ORDER 2 48 # define MAX_REGRESSION_LENGTH 4 50 static float compute_gradient(
const EST_FVector &x,
int num_points);
58 cerr <<
"delta(EST_Track&, int) : ERROR : regression_length is " 59 << regression_length << endl;
70 for (reg_index=0; reg_index<regression_length; reg_index++)
74 this_index = i - reg_index;
76 temp[reg_index] = tr.
a(this_index, j);
82 else if (i < regression_length - 1)
85 d.
a(i, j) = compute_gradient(temp, i + 1);
88 d.
a(i, j) = compute_gradient(temp, regression_length);
94 int reg_index, this_index;
98 cerr <<
"delta(EST_Track&, int) : ERROR : regression_length is " 99 << regression_length << endl;
110 for (reg_index=0; reg_index<regression_length; reg_index++)
114 this_index = i - reg_index;
116 temp.
a_no_check(reg_index) = (float)tr.
a(this_index, j);
122 else if (i < regression_length - 1)
125 d.
a(i, j) = (short)compute_gradient(temp, i + 1);
128 d.
a(i, j) = (short)compute_gradient(temp, regression_length);
132 static float compute_gradient(
const EST_FVector &x,
int num_points)
150 gradient = x(0) - x(1);
154 gradient = (x(0) -x(2)) / 2.0;
158 gradient = ( (3.0*x(0)) + x(1) - x(2) - (3.0 * x(3)) ) / 10.0;
163 cerr <<
"compute_gradient(float*, int) : ERROR : num_points is" 164 << num_points << endl;
A class for storing digital waveforms. The waveform is stored as an array of 16 bit shorts...
void delta(EST_Track &tr, EST_Track &d, int regression_length)
#define MAX_REGRESSION_LENGTH
max. number of points on which the delta co-eff is based
A vector class for floating point numbers. EST_FVector x should be used instead of float *x wherever ...
int num_channels() const
return number of channels in track
INLINE const T & a_no_check(ssize_t n) const
read-only const access operator: without bounds checking
ssize_t num_samples() const
return the number of samples in the waveform
short & a(ssize_t i, ssize_t channel=0)
float & a(ssize_t i, int c=0)
ssize_t num_frames() const
return number of frames in track
ssize_t num_channels() const
return the number of channels in the waveform