template<typename TS, int NSTATES, typename TUS, int NUS, typename TCS, int NCS, typename TBM, typename TPM, typename TP>
struct leansdr::viterbi_dec< TS, NSTATES, TUS, NUS, TCS, NCS, TBM, TPM, TP >
Definition at line 136 of file viterbi.h.
template<typename TS , int NSTATES, typename TUS , int NUS, typename TCS , int NCS, typename TBM , typename TPM , typename TP >
template<typename TS , int NSTATES, typename TUS , int NUS, typename TCS , int NCS, typename TBM , typename TPM , typename TP >
leansdr::viterbi_dec< TS, NSTATES, TUS, NUS, TCS, NCS, TBM, TPM, TP >::viterbi_dec |
( |
trellis< TS, NSTATES, TUS, NUS, NCS > * |
_trellis | ) |
|
|
inline |
Definition at line 150 of file viterbi.h.
References leansdr::viterbi_dec< TS, NSTATES, TUS, NUS, TCS, NCS, TBM, TPM, TP >::state::cost.
154 for (TS s = 0; s < NSTATES; ++s)
state statebanks[2][NSTATES]
trellis< TS, NSTATES, TUS, NUS, NCS > * trell
template<typename TS , int NSTATES, typename TUS , int NUS, typename TCS , int NCS, typename TBM , typename TPM , typename TP >
TUS leansdr::viterbi_dec< TS, NSTATES, TUS, NUS, TCS, NCS, TBM, TPM, TP >::update |
( |
TBM |
costs[NCS], |
|
|
TPM * |
quality = NULL |
|
) |
| |
|
inline |
Definition at line 168 of file viterbi.h.
References leansdr::trellis< TS, NSTATES, TUS, NUS, NCS >::state::branches, leansdr::trellis< TS, NSTATES, TUS, NUS, NCS >::NOSTATE, leansdr::trellis< TS, NSTATES, TUS, NUS, NCS >::state::branch::pred, leansdr::trellis< TS, NSTATES, TUS, NUS, NCS >::states, and leansdr::trellis< TS, NSTATES, TUS, NUS, NCS >::state::branch::us.
173 for (
int s = 0; s < NSTATES; ++s)
176 typename trellis<TS, NSTATES, TUS, NUS, NCS>::state::branch *best_b = NULL;
178 for (
int cs = 0; cs < NCS; ++cs)
180 typename trellis<TS, NSTATES, TUS, NUS, NCS>::state::branch *b =
181 &
trell->states[s].branches[cs];
182 if (b->pred ==
trell->NOSTATE)
184 TPM m = (*states)[b->pred].cost + costs[cs];
191 (*newstates)[s].path = (*states)[best_b->pred].path;
192 (*newstates)[s].path.append(best_b->us);
193 (*newstates)[s].cost = best_m;
195 if (best_m < best_tpm)
198 best2_tpm = best_tpm;
201 else if (best_m < best2_tpm)
211 for (TS s = 0; s < NSTATES; ++s)
212 (*
states)[s].cost -= best_tpm;
215 fprintf(stderr,
"-%2d = [", best_tpm);
216 for ( TS s=0; s<NSTATES; ++s ) fprintf(stderr,
" %d", (*
states)[s].cost);
217 fprintf(stderr,
" ]\n");
221 *quality = best2_tpm - best_tpm;
223 return (*
states)[best_state].path.read();
trellis< TS, NSTATES, TUS, NUS, NCS > * trell
template<typename TS , int NSTATES, typename TUS , int NUS, typename TCS , int NCS, typename TBM , typename TPM , typename TP >
TUS leansdr::viterbi_dec< TS, NSTATES, TUS, NUS, TCS, NCS, TBM, TPM, TP >::update |
( |
int |
nm, |
|
|
TCS |
cs[], |
|
|
TBM |
costs[], |
|
|
TPM * |
quality = NULL |
|
) |
| |
|
inline |
Definition at line 230 of file viterbi.h.
References leansdr::trellis< TS, NSTATES, TUS, NUS, NCS >::state::branches, leansdr::trellis< TS, NSTATES, TUS, NUS, NCS >::NOSTATE, leansdr::trellis< TS, NSTATES, TUS, NUS, NCS >::state::branch::pred, leansdr::trellis< TS, NSTATES, TUS, NUS, NCS >::states, and leansdr::trellis< TS, NSTATES, TUS, NUS, NCS >::state::branch::us.
235 for (
int s = 0; s < NSTATES; ++s)
239 typename trellis<TS, NSTATES, TUS, NUS, NCS>::state::branch *best_b = NULL;
240 for (
int im = 0; im < nm; ++im)
242 typename trellis<TS, NSTATES, TUS, NUS, NCS>::state::branch *b =
243 &
trell->states[s].branches[cs[im]];
244 if (b->pred ==
trell->NOSTATE)
246 TPM m = (*states)[b->pred].cost + costs[im];
258 for (
int cs = 0; cs < NCS; ++cs)
260 typename trellis<TS, NSTATES, TUS, NUS, NCS>::state::branch *b =
261 &
trell->states[s].branches[cs];
262 if (b->pred ==
trell->NOSTATE)
264 TPM m = (*states)[b->pred].cost;
272 (*newstates)[s].path = (*states)[best_b->pred].path;
273 (*newstates)[s].path.append(best_b->us);
274 (*newstates)[s].cost = best_m;
276 if (best_m < best_tpm)
279 best2_tpm = best_tpm;
282 else if (best_m < best2_tpm)
292 for (TS s = 0; s < NSTATES; ++s)
293 (*
states)[s].cost -= best_tpm;
296 fprintf(stderr,
"-%2d = [", best_tpm);
297 for ( TS s=0; s<NSTATES; ++s ) fprintf(stderr,
" %d", (*
states)[s].cost);
298 fprintf(stderr,
" ]\n");
302 *quality = best2_tpm - best_tpm;
304 return (*
states)[best_state].path.read();
trellis< TS, NSTATES, TUS, NUS, NCS > * trell
template<typename TS , int NSTATES, typename TUS , int NUS, typename TCS , int NCS, typename TBM , typename TPM , typename TP >
TUS leansdr::viterbi_dec< TS, NSTATES, TUS, NUS, TCS, NCS, TBM, TPM, TP >::update |
( |
TCS |
cs, |
|
|
TBM |
cost, |
|
|
TPM * |
quality = NULL |
|
) |
| |
|
inlinevirtual |
template<typename TS , int NSTATES, typename TUS , int NUS, typename TCS , int NCS, typename TBM , typename TPM , typename TP >
template<typename TS , int NSTATES, typename TUS , int NUS, typename TCS , int NCS, typename TBM , typename TPM , typename TP >
template<typename TS , int NSTATES, typename TUS , int NUS, typename TCS , int NCS, typename TBM , typename TPM , typename TP >
trellis<TS, NSTATES, TUS, NUS, NCS>* leansdr::viterbi_dec< TS, NSTATES, TUS, NUS, TCS, NCS, TBM, TPM, TP >::trell |