30
30
#define PITCH_DELAY_MAX 143
33
* \brief Decode pitch delay of the first subframe encoded by 8 bits with 1/3
33
* @brief Decode pitch delay of the first subframe encoded by 8 bits with 1/3
35
* \param ac_index adaptive codebook index (8 bits)
35
* @param ac_index adaptive codebook index (8 bits)
37
* \return pitch delay in 1/3 units
37
* @return pitch delay in 1/3 units
39
39
* Pitch delay is coded:
40
40
* with 1/3 resolution, 19 < pitch_delay < 85
43
43
int ff_acelp_decode_8bit_to_1st_delay3(int ac_index);
46
* \brief Decode pitch delay of the second subframe encoded by 5 or 6 bits
46
* @brief Decode pitch delay of the second subframe encoded by 5 or 6 bits
47
47
* with 1/3 precision.
48
* \param ac_index adaptive codebook index (5 or 6 bits)
49
* \param pitch_delay_min lower bound (integer) of pitch delay interval
48
* @param ac_index adaptive codebook index (5 or 6 bits)
49
* @param pitch_delay_min lower bound (integer) of pitch delay interval
50
50
* for second subframe
52
* \return pitch delay in 1/3 units
52
* @return pitch delay in 1/3 units
54
54
* Pitch delay is coded:
55
55
* with 1/3 resolution, -6 < pitch_delay - int(prev_pitch_delay) < 5
57
* \remark The routine is used in G.729 @@8k, AMR @@10.2k, AMR @@7.95k,
57
* @remark The routine is used in G.729 @@8k, AMR @@10.2k, AMR @@7.95k,
58
58
* AMR @@7.4k for the second subframe.
60
60
int ff_acelp_decode_5_6_bit_to_2nd_delay3(
62
62
int pitch_delay_min);
65
* \brief Decode pitch delay with 1/3 precision.
66
* \param ac_index adaptive codebook index (4 bits)
67
* \param pitch_delay_min lower bound (integer) of pitch delay interval for
65
* @brief Decode pitch delay with 1/3 precision.
66
* @param ac_index adaptive codebook index (4 bits)
67
* @param pitch_delay_min lower bound (integer) of pitch delay interval for
70
* \return pitch delay in 1/3 units
70
* @return pitch delay in 1/3 units
72
72
* Pitch delay is coded:
73
73
* integers only, -6 < pitch_delay - int(prev_pitch_delay) <= -2
74
74
* with 1/3 resolution, -2 < pitch_delay - int(prev_pitch_delay) < 1
75
75
* integers only, 1 <= pitch_delay - int(prev_pitch_delay) < 5
77
* \remark The routine is used in G.729 @@6.4k, AMR @@6.7k, AMR @@5.9k,
77
* @remark The routine is used in G.729 @@6.4k, AMR @@6.7k, AMR @@5.9k,
78
78
* AMR @@5.15k, AMR @@4.75k for the second subframe.
80
80
int ff_acelp_decode_4bit_to_2nd_delay3(
82
82
int pitch_delay_min);
85
* \brief Decode pitch delay of the first subframe encoded by 9 bits
85
* @brief Decode pitch delay of the first subframe encoded by 9 bits
86
86
* with 1/6 precision.
87
* \param ac_index adaptive codebook index (9 bits)
87
* @param ac_index adaptive codebook index (9 bits)
89
* \return pitch delay in 1/6 units
89
* @return pitch delay in 1/6 units
91
91
* Pitch delay is coded:
92
92
* with 1/6 resolution, 17 < pitch_delay < 95
93
93
* integers only, 95 <= pitch_delay <= 143
95
* \remark The routine is used in AMR @@12.2k for the first and third subframes.
95
* @remark The routine is used in AMR @@12.2k for the first and third subframes.
97
97
int ff_acelp_decode_9bit_to_1st_delay6(int ac_index);
100
* \brief Decode pitch delay of the second subframe encoded by 6 bits
100
* @brief Decode pitch delay of the second subframe encoded by 6 bits
101
101
* with 1/6 precision.
102
* \param ac_index adaptive codebook index (6 bits)
103
* \param pitch_delay_min lower bound (integer) of pitch delay interval for
102
* @param ac_index adaptive codebook index (6 bits)
103
* @param pitch_delay_min lower bound (integer) of pitch delay interval for
104
104
* second subframe
106
* \return pitch delay in 1/6 units
106
* @return pitch delay in 1/6 units
108
108
* Pitch delay is coded:
109
109
* with 1/6 resolution, -6 < pitch_delay - int(prev_pitch_delay) < 5
111
* \remark The routine is used in AMR @@12.2k for the second and fourth subframes.
111
* @remark The routine is used in AMR @@12.2k for the second and fourth subframes.
113
113
int ff_acelp_decode_6bit_to_2nd_delay6(
115
115
int pitch_delay_min);
118
* \brief Update past quantized energies
119
* \param[in,out] quant_energy past quantized energies (5.10)
120
* \param gain_corr_factor gain correction factor
121
* \param log2_ma_pred_order log2() of MA prediction order
122
* \param erasure frame erasure flag
118
* @brief Update past quantized energies
119
* @param[in,out] quant_energy past quantized energies (5.10)
120
* @param gain_corr_factor gain correction factor
121
* @param log2_ma_pred_order log2() of MA prediction order
122
* @param erasure frame erasure flag
124
124
* If frame erasure flag is not equal to zero, memory is updated with
125
125
* averaged energy, attenuated by 4dB:
128
128
* In normal mode memory is updated with
129
129
* Er - Ep = 20 * log10(gain_corr_factor)
131
* \remark The routine is used in G.729 and AMR (all modes).
131
* @remark The routine is used in G.729 and AMR (all modes).
133
133
void ff_acelp_update_past_gain(
134
134
int16_t* quant_energy,
140
* \brief Decode the adaptive codebook gain and add
140
* @brief Decode the adaptive codebook gain and add
141
141
* correction (4.1.5 and 3.9.1 of G.729).
142
* \param dsp initialized dsputil context
143
* \param gain_corr_factor gain correction factor (2.13)
144
* \param fc_v fixed-codebook vector (2.13)
145
* \param mr_energy mean innovation energy and fixed-point correction (7.13)
146
* \param[in,out] quant_energy past quantized energies (5.10)
147
* \param subframe_size length of subframe
142
* @param dsp initialized dsputil context
143
* @param gain_corr_factor gain correction factor (2.13)
144
* @param fc_v fixed-codebook vector (2.13)
145
* @param mr_energy mean innovation energy and fixed-point correction (7.13)
146
* @param[in,out] quant_energy past quantized energies (5.10)
147
* @param subframe_size length of subframe
149
* \return quantized fixed-codebook gain (14.1)
149
* @return quantized fixed-codebook gain (14.1)
151
151
* The routine implements equations 69, 66 and 71 of the G.729 specification (3.9.1)