Go to the documentation of this file.
44 dst[
i] = (vector[
i] * (1 <<
bits)) >> 3;
57 return av_sat_add32(sum, sum);
82 buf[
i + j] += vector[j];
91 const int16_t *cb_ptr;
92 int lag = pitch_lag + subfrm->
ad_cb_lag - 1;
109 vector[
i] = av_sat_dadd32(1 << 15, av_sat_add32(sum, sum)) >> 16;
126 int index = (lpc[j] >> 7) & 0x1FF;
127 int offset = lpc[j] & 0x7f;
130 (((
offset << 8) + 0x80) << 1);
132 lpc[j] = -(av_sat_dadd32(1 << 15, temp1 + temp2) >> 16);
141 f1[1] = (lpc[0] + lpc[2]) * (1 << 14);
142 f1[2] = lpc[0] * lpc[2] + (2 << 28);
145 f2[1] = (lpc[1] + lpc[3]) * (1 << 14);
146 f2[2] = lpc[1] * lpc[3] + (2 << 28);
153 f1[
i + 1] = av_clipl_int32(f1[
i - 1] + (int64_t)
MULL2(f1[
i], lpc[2 *
i]));
154 f2[
i + 1] = av_clipl_int32(f2[
i - 1] + (int64_t)
MULL2(f2[
i], lpc[2 *
i + 1]));
156 for (j =
i; j >= 2; j--) {
157 f1[j] =
MULL2(f1[j - 1], lpc[2 *
i]) +
158 (f1[j] >> 1) + (f1[j - 2] >> 1);
159 f2[j] =
MULL2(f2[j - 1], lpc[2 *
i + 1]) +
160 (f2[j] >> 1) + (f2[j - 2] >> 1);
165 f1[1] = ((lpc[2 *
i] * 65536 >>
i) + f1[1]) >> 1;
166 f2[1] = ((lpc[2 *
i + 1] * 65536 >>
i) + f2[1]) >> 1;
171 int64_t ff1 = f1[
i + 1] + f1[
i];
172 int64_t ff2 = f2[
i + 1] - f2[
i];
174 lpc[
i] = av_clipl_int32(((ff1 + ff2) * 8) + (1 << 15)) >> 16;
175 lpc[
LPC_ORDER -
i - 1] = av_clipl_int32(((ff1 - ff2) * 8) +
184 int16_t *lpc_ptr = lpc;
202 uint8_t *lsp_index,
int bad_frame)
205 int i, j,
temp, stable;
214 lsp_index[0] = lsp_index[1] = lsp_index[2] = 0;
236 cur_lsp[0] =
FFMAX(cur_lsp[0], 0x180);
241 temp = min_dist + cur_lsp[j - 1] - cur_lsp[j];
244 cur_lsp[j - 1] -=
temp;
250 temp = cur_lsp[j - 1] + min_dist - cur_lsp[j] - 4;
260 memcpy(cur_lsp, prev_lsp,
LPC_ORDER *
sizeof(*cur_lsp));
static const int16_t lsp_band0[LSP_CB_SIZE][3]
LSP VQ tables.
int av_log2_16bit(unsigned v)
int ad_cb_lag
adaptive codebook lag
static void lsp2lpc(int16_t *lpc)
Convert LSP frequencies to LPC coefficients.
void ff_g723_1_inverse_quant(int16_t *cur_lsp, int16_t *prev_lsp, uint8_t *lsp_index, int bad_frame)
Perform inverse quantization of LSP frequencies.
int ff_g723_1_normalize_bits(int num, int width)
Calculate the number of left-shifts required for normalizing the input.
static const int16_t adaptive_cb_gain85[85 *20]
void ff_g723_1_gen_dirac_train(int16_t *buf, int pitch_lag)
Generate a train of dirac functions with period as pitch lag.
static const int16_t lsp_band1[LSP_CB_SIZE][3]
static const int16_t adaptive_cb_gain170[170 *20]
void ff_g723_1_gen_acb_excitation(int16_t *vector, int16_t *prev_excitation, int pitch_lag, G723_1_Subframe *subfrm, enum Rate cur_rate)
Generate adaptive codebook excitation.
static const int16_t lsp_band2[LSP_CB_SIZE][4]
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
void ff_g723_1_lsp_interpolate(int16_t *lpc, int16_t *cur_lsp, int16_t *prev_lsp)
Quantize LSP frequencies by interpolation and convert them to the corresponding LPC coefficients.
void ff_g723_1_get_residual(int16_t *residual, int16_t *prev_excitation, int lag)
Get delayed contribution from the previous excitation vector.
int ff_g723_1_dot_product(const int16_t *a, const int16_t *b, int length)
G723.1 unpacked data subframe.
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
#define i(width, name, range_min, range_max)
int64_t ff_dot_product(const int16_t *a, const int16_t *b, int length)
Calculate the dot product of 2 int16_t vectors.
int ff_g723_1_scale_vector(int16_t *dst, const int16_t *vector, int length)
Scale vector contents based on the largest of their absolutes.
static const float pred[4]
static const int16_t dc_lsp[LPC_ORDER]
LSP DC component.
void ff_acelp_weighted_vector_sum(int16_t *out, const int16_t *in_a, const int16_t *in_b, int16_t weight_coeff_a, int16_t weight_coeff_b, int16_t rounder, int shift, int length)
weighted sum of two vectors with rounding.
#define MULL2(a, b)
Bitexact implementation of 2ab scaled by 1/2^16.
static float cos_tab[256]