## 7 Example ECU/BFH Solution 2

06.913GPPSubstitution and muting of lost frames for AMR speech traffic channelsTS

This is an alternative example solution which is a simplified version of Example ECU/BFH Solution 1.

## 7.1 State Machine

This example solution for substitution and muting is based on a state machine with seven states (Figure 1, same state machine as in Example 1).

The system starts in state 0. Each time a bad frame is detected, the state counter is incremented by one and is saturated when it reaches 6. Each time a good speech frame is detected, the state counter is reset to zero, except when we are in state 6, where we set the state counter to 5. The state indicates the quality of the channel: the larger the state counter, the worse the channel quality is. The control flow of the state machine can be described by the following C code (BFI = bad frame indicator, State = state variable):

if(BFI != 0 )

State = State + 1;

else if(State == 6)

State = 5;

else

State = 0;

if(State > 6 )

State = 6;

In addition to this state machine, the Bad Frame Flag from the previous frame is checked (prevBFI). The processing depends on the value of the State-variable. In states 0 and 5, the processing depends also on the two flags BFI and prevBFI.

## 7.2 Substitution and muting of lost speech frames

### 7.2.1 BFI = 0, prevBFI = 0, State = 0

No error is detected in the received or in the previous received speech frame. The received speech parameters are used normally in the speech synthesis. The current frame of speech parameters is saved.

### 7.2.2 BFI = 0, prevBFI = 1, State = 0 or 5

No error is detected in the received speech frame but the previous received speech frame was bad. The LTP gain and fixed codebook gain are limited below the values used for the last received good subframe:

(7)

where = current decoded LTP gain,= LTP gain used for the last good subframe (BFI = 0), and

(8)

where = current decoded fixed codebook-gain and = fixed codebook gain used for the last good subframe (BFI = 0).

The rest of the received speech parameters are used normally in the speech synthesis. The current frame of speech parameters is saved.

### 7.2.3 BFI = 1, prevBFI = 0 or 1, State = 1…6

An error is detected in the received speech frame and the substitution and muting procedure is started. The LTP gain and fixed codebook gain are replaced by attenuated values from the previous subframes:

(9)

where = current decoded LTP gain, = LTP gains used for the last n subframes, median5() = 5-point median operation, P(state) = attenuation factor (P(1) = 0.98, P(2) = 0.98, P(3) = 0.8, P(4) = 0.3, P(5) = 0.2, P(6) = 0.2), state = state number, and

(10)

where = current decoded fixed codebook gain, = fixed codebook gains used for the last n subframes, median5() = 5-point median operation, C(state) = attenuation factor (C(1) = 0.98, C(2) = 0.98, C(3) = 0.98, C(4) = 0.98, C(5) = 0.98, C(6) = 0.7), and state = state number.

The higher the state value is, the more the gains are attenuated. Also the memory of the predictive fixed codebook gain is updated by using the average value of the past four values in the memory:

(11)

The past LSFs are used by shifting their values towards their mean:

(12)

where  = 0.95, lsf_q1 and lsf_q2 are two sets of LSF-vectors for current frame, past_lsf_q is lsf_q2 from the previous frame, and mean_lsf is the average LSF-vector. Note that two sets of LSFs are available only in the 12.2 mode.

#### 7.2.3.1 LTP-lag update

The LTP-lag values are replaced by the past value from the 4th subframe of the previous frame (12.2 mode) or slightly modified values based on the last correctly received value (all other modes).

### 7.2.4 Innovation sequence

The received fixed codebook innovation pulses from the erroneous frame are always used in the state in which they were received when corrupted data are received. In the case when no data were received random fixed codebook indices should be employed.

## 7.3 Substitution and muting of lost SID frames

In the speech decoder a single frame classified as SID_BAD shall be substituted by the last valid SID frame information and the procedure for valid SID frames be applied. If the time between SID information updates (updates are specified by SID_UPDATE arrivals and occasionally by SID_FIRST arrivals see 06.92) is greater than one second this shall lead to attenuation.

Annex A (informative):
Document change history

 SMG# SPEC CR PHASE VERS NEW_VERS SUBJECT 30 06.91 A001 R98 7.0.1 7.1.0 Use of random excitation when RX_NODATA and not in DTX 06.91 7.1.0 7.1.1 Version update to 7.1.1 for Publication