Efficient Computation of Viterbi Decoder Reliability With an Application to Variable-Length Coding