Commit 69665bd6 authored by Mans Rullgard's avatar Mans Rullgard

g723.1: do not pass large structs by value

Signed-off-by: 's avatarMans Rullgard <mans@mansr.com>
parent 138914dc
......@@ -498,7 +498,7 @@ static void gen_dirac_train(int16_t *buf, int pitch_lag)
* @param pitch_lag closed loop pitch lag
* @param index current subframe index
*/
static void gen_fcb_excitation(int16_t *vector, G723_1_Subframe subfrm,
static void gen_fcb_excitation(int16_t *vector, G723_1_Subframe *subfrm,
enum Rate cur_rate, int pitch_lag, int index)
{
int temp, i, j;
......@@ -506,34 +506,34 @@ static void gen_fcb_excitation(int16_t *vector, G723_1_Subframe subfrm,
memset(vector, 0, SUBFRAME_LEN * sizeof(*vector));
if (cur_rate == RATE_6300) {
if (subfrm.pulse_pos >= max_pos[index])
if (subfrm->pulse_pos >= max_pos[index])
return;
/* Decode amplitudes and positions */
j = PULSE_MAX - pulses[index];
temp = subfrm.pulse_pos;
temp = subfrm->pulse_pos;
for (i = 0; i < SUBFRAME_LEN / GRID_SIZE; i++) {
temp -= combinatorial_table[j][i];
if (temp >= 0)
continue;
temp += combinatorial_table[j++][i];
if (subfrm.pulse_sign & (1 << (PULSE_MAX - j))) {
vector[subfrm.grid_index + GRID_SIZE * i] =
-fixed_cb_gain[subfrm.amp_index];
if (subfrm->pulse_sign & (1 << (PULSE_MAX - j))) {
vector[subfrm->grid_index + GRID_SIZE * i] =
-fixed_cb_gain[subfrm->amp_index];
} else {
vector[subfrm.grid_index + GRID_SIZE * i] =
fixed_cb_gain[subfrm.amp_index];
vector[subfrm->grid_index + GRID_SIZE * i] =
fixed_cb_gain[subfrm->amp_index];
}
if (j == PULSE_MAX)
break;
}
if (subfrm.dirac_train == 1)
if (subfrm->dirac_train == 1)
gen_dirac_train(vector, pitch_lag);
} else { /* 5300 bps */
int cb_gain = fixed_cb_gain[subfrm.amp_index];
int cb_shift = subfrm.grid_index;
int cb_sign = subfrm.pulse_sign;
int cb_pos = subfrm.pulse_pos;
int cb_gain = fixed_cb_gain[subfrm->amp_index];
int cb_shift = subfrm->grid_index;
int cb_sign = subfrm->pulse_sign;
int cb_pos = subfrm->pulse_pos;
int offset, beta, lag;
for (i = 0; i < 8; i += 2) {
......@@ -544,9 +544,9 @@ static void gen_fcb_excitation(int16_t *vector, G723_1_Subframe subfrm,
}
/* Enhance harmonic components */
lag = pitch_contrib[subfrm.ad_cb_gain << 1] + pitch_lag +
subfrm.ad_cb_lag - 1;
beta = pitch_contrib[(subfrm.ad_cb_gain << 1) + 1];
lag = pitch_contrib[subfrm->ad_cb_gain << 1] + pitch_lag +
subfrm->ad_cb_lag - 1;
beta = pitch_contrib[(subfrm->ad_cb_gain << 1) + 1];
if (lag < SUBFRAME_LEN - 2) {
for (i = lag; i < SUBFRAME_LEN; i++)
......@@ -586,12 +586,12 @@ static int dot_product(const int16_t *a, const int16_t *b, int length)
* Generate adaptive codebook excitation.
*/
static void gen_acb_excitation(int16_t *vector, int16_t *prev_excitation,
int pitch_lag, G723_1_Subframe subfrm,
int pitch_lag, G723_1_Subframe *subfrm,
enum Rate cur_rate)
{
int16_t residual[SUBFRAME_LEN + PITCH_ORDER - 1];
const int16_t *cb_ptr;
int lag = pitch_lag + subfrm.ad_cb_lag - 1;
int lag = pitch_lag + subfrm->ad_cb_lag - 1;
int i;
int sum;
......@@ -605,7 +605,7 @@ static void gen_acb_excitation(int16_t *vector, int16_t *prev_excitation,
cb_ptr = adaptive_cb_gain170;
/* Calculate adaptive vector */
cb_ptr += subfrm.ad_cb_gain * 20;
cb_ptr += subfrm->ad_cb_gain * 20;
for (i = 0; i < SUBFRAME_LEN; i++) {
sum = dot_product(residual + i, cb_ptr, PITCH_ORDER);
vector[i] = av_sat_dadd32(1 << 15, sum) >> 16;
......@@ -1057,10 +1057,10 @@ static int g723_1_decode_frame(AVCodecContext *avctx, void *data,
p->interp_gain = fixed_cb_gain[(p->subframe[2].amp_index +
p->subframe[3].amp_index) >> 1];
for (i = 0; i < SUBFRAMES; i++) {
gen_fcb_excitation(vector_ptr, p->subframe[i], p->cur_rate,
gen_fcb_excitation(vector_ptr, &p->subframe[i], p->cur_rate,
p->pitch_lag[i >> 1], i);
gen_acb_excitation(acb_vector, &p->excitation[SUBFRAME_LEN * i],
p->pitch_lag[i >> 1], p->subframe[i],
p->pitch_lag[i >> 1], &p->subframe[i],
p->cur_rate);
/* Get the total excitation */
for (j = 0; j < SUBFRAME_LEN; j++) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment