diff options
Diffstat (limited to 'gr-trellis/src/lib/trellis_viterbi_s.cc')
-rw-r--r-- | gr-trellis/src/lib/trellis_viterbi_s.cc | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/gr-trellis/src/lib/trellis_viterbi_s.cc b/gr-trellis/src/lib/trellis_viterbi_s.cc index e352a2604..ccdd11558 100644 --- a/gr-trellis/src/lib/trellis_viterbi_s.cc +++ b/gr-trellis/src/lib/trellis_viterbi_s.cc @@ -77,8 +77,8 @@ trellis_viterbi_s::forecast (int noutput_items, gr_vector_int &ninput_items_requ void viterbi_algorithm(int I, int S, int O, const std::vector<int> &NS, const std::vector<int> &OS, - const std::vector<int> &PS, - const std::vector<int> &PI, + const std::vector< std::vector<int> > &PS, + const std::vector< std::vector<int> > &PI, int K, int S0,int SK, const float *in, short *out)//, @@ -106,9 +106,9 @@ void viterbi_algorithm(int I, int S, int O, for(int j=0;j<S;j++) { // for each next state do ACS minm=INF; minmi=0; - for(int i=0;i<I;i++) { - int i0 = j*I+i; - if((mm=alpha[alphai*S+PS[i0]]+in[k*O+OS[PS[i0]*I+PI[i0]]])<minm) + for(int i=0;i<PS[j].size();i++) { + //int i0 = j*I+i; + if((mm=alpha[alphai*S+PS[j][i]]+in[k*O+OS[PS[j][i]*I+PI[j][i]]])<minm) minm=mm,minmi=i; } trace[k*S+j]=minmi; @@ -132,9 +132,9 @@ void viterbi_algorithm(int I, int S, int O, } for(int k=K-1;k>=0;k--) { // traceback - int i0=st*I+trace[k*S+st]; - out[k]= (short) PI[i0]; - st=PS[i0]; + int i0=trace[k*S+st]; + out[k]= (short) PI[st][i0]; + st=PS[st][i0]; } } |