Skip to content

Commit 850a642

Browse files
committed
Don't advance active successor's frame in phone_transition
When phone_transition fires and the successor HMM is already active (hmm_frame >= frame_idx), calling hmm_enter() overwrites hmm_frame with nf even though the phone is already being tracked at the current frame. Split the entry into two cases: inactive successors get a full hmm_enter() with the new frame assignment; active ones only have their in_score and in_history updated if the incoming score is better. This is the correct Viterbi competition rule.
1 parent 7a9785a commit 850a642

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/state_align_search.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,14 @@ phone_transition(state_align_search_t *sas, int frame_idx)
121121
continue;
122122

123123
newphone_score = hmm_out_score(hmm);
124-
/* Transition into next phone using the usual Viterbi rule. */
125124
nhmm = hmm + 1;
126-
if (hmm_frame(nhmm) < frame_idx
127-
|| newphone_score BETTER_THAN hmm_in_score(nhmm)) {
125+
if (hmm_frame(nhmm) < frame_idx) {
128126
hmm_enter(nhmm, newphone_score, hmm_out_history(hmm), nf);
127+
continue;
128+
}
129+
if (newphone_score BETTER_THAN hmm_in_score(nhmm)) {
130+
hmm_in_score(nhmm) = newphone_score;
131+
hmm_in_history(nhmm) = hmm_out_history(hmm);
129132
}
130133
}
131134
}

0 commit comments

Comments
 (0)