mirror of
https://github.com/xenia-project/FFmpeg.git
synced 2024-11-24 20:19:55 +00:00
Optimize short-term prediction by reducing index arithmetic.
Originally committed as revision 21069 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
9a02c3e183
commit
99c5f5ccbe
@ -712,6 +712,8 @@ static int decode_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
|
|||||||
int32_t *quant_cof = bd->quant_cof;
|
int32_t *quant_cof = bd->quant_cof;
|
||||||
int32_t *lpc_cof = bd->lpc_cof;
|
int32_t *lpc_cof = bd->lpc_cof;
|
||||||
int32_t *raw_samples = bd->raw_samples;
|
int32_t *raw_samples = bd->raw_samples;
|
||||||
|
int32_t *raw_samples_end = bd->raw_samples + bd->block_length;
|
||||||
|
int32_t lpc_cof_reversed[opt_order];
|
||||||
|
|
||||||
// reverse long-term prediction
|
// reverse long-term prediction
|
||||||
if (*bd->use_ltp) {
|
if (*bd->use_ltp) {
|
||||||
@ -739,9 +741,9 @@ static int decode_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
|
|||||||
y = 1 << 19;
|
y = 1 << 19;
|
||||||
|
|
||||||
for (sb = 0; sb < smp; sb++)
|
for (sb = 0; sb < smp; sb++)
|
||||||
y += MUL64(lpc_cof[sb], *(raw_samples + smp - (sb + 1)));
|
y += MUL64(lpc_cof[sb], raw_samples[-(sb + 1)]);
|
||||||
|
|
||||||
raw_samples[smp] -= y >> 20;
|
*raw_samples++ -= y >> 20;
|
||||||
parcor_to_lpc(smp, quant_cof, lpc_cof);
|
parcor_to_lpc(smp, quant_cof, lpc_cof);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -775,16 +777,27 @@ static int decode_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
|
|||||||
raw_samples[sb] >>= bd->shift_lsbs;
|
raw_samples[sb] >>= bd->shift_lsbs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// reverse linear prediction coefficients for efficiency
|
||||||
|
lpc_cof = lpc_cof + opt_order;
|
||||||
|
|
||||||
|
for (sb = 0; sb < opt_order; sb++)
|
||||||
|
lpc_cof_reversed[sb] = lpc_cof[-(sb + 1)];
|
||||||
|
|
||||||
// reconstruct raw samples
|
// reconstruct raw samples
|
||||||
for (; smp < bd->block_length; smp++) {
|
raw_samples = bd->raw_samples + smp;
|
||||||
|
lpc_cof = lpc_cof_reversed + opt_order;
|
||||||
|
|
||||||
|
for (; raw_samples < raw_samples_end; raw_samples++) {
|
||||||
y = 1 << 19;
|
y = 1 << 19;
|
||||||
|
|
||||||
for (sb = 0; sb < opt_order; sb++)
|
for (sb = -opt_order; sb < 0; sb++)
|
||||||
y += MUL64(bd->lpc_cof[sb], *(raw_samples + smp - (sb + 1)));
|
y += MUL64(lpc_cof[sb], raw_samples[sb]);
|
||||||
|
|
||||||
raw_samples[smp] -= y >> 20;
|
*raw_samples -= y >> 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
raw_samples = bd->raw_samples;
|
||||||
|
|
||||||
// restore previous samples in case that they have been altered
|
// restore previous samples in case that they have been altered
|
||||||
if (bd->store_prev_samples)
|
if (bd->store_prev_samples)
|
||||||
memcpy(raw_samples - sconf->max_order, bd->prev_raw_samples,
|
memcpy(raw_samples - sconf->max_order, bd->prev_raw_samples,
|
||||||
|
Loading…
Reference in New Issue
Block a user