mirror of
https://github.com/xiph/opus.git
synced 2025-06-07 16:00:56 +00:00
Fixes CELT PLC
The regression was introduced in 783ad76766
by changes to celt_fir() that make it no longer in-place.
This commit is contained in:
parent
b30f45b9a8
commit
072d133f78
2 changed files with 14 additions and 15 deletions
|
@ -554,6 +554,7 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, int N, int LM)
|
||||||
|
|
||||||
celt_synthesis(mode, X, out_syn, oldBandE, start, effEnd, C, C, 0, LM, st->downsample, 0, st->arch);
|
celt_synthesis(mode, X, out_syn, oldBandE, start, effEnd, C, C, 0, LM, st->downsample, 0, st->arch);
|
||||||
} else {
|
} else {
|
||||||
|
int exc_length;
|
||||||
/* Pitch-based PLC */
|
/* Pitch-based PLC */
|
||||||
const opus_val16 *window;
|
const opus_val16 *window;
|
||||||
opus_val16 *exc;
|
opus_val16 *exc;
|
||||||
|
@ -561,6 +562,7 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, int N, int LM)
|
||||||
int pitch_index;
|
int pitch_index;
|
||||||
VARDECL(opus_val32, etmp);
|
VARDECL(opus_val32, etmp);
|
||||||
VARDECL(opus_val16, _exc);
|
VARDECL(opus_val16, _exc);
|
||||||
|
VARDECL(opus_val16, fir_tmp);
|
||||||
|
|
||||||
if (loss_count == 0)
|
if (loss_count == 0)
|
||||||
{
|
{
|
||||||
|
@ -570,8 +572,13 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, int N, int LM)
|
||||||
fade = QCONST16(.8f,15);
|
fade = QCONST16(.8f,15);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* We want the excitation for 2 pitch periods in order to look for a
|
||||||
|
decaying signal, but we can't get more than MAX_PERIOD. */
|
||||||
|
exc_length = IMIN(2*pitch_index, MAX_PERIOD);
|
||||||
|
|
||||||
ALLOC(etmp, overlap, opus_val32);
|
ALLOC(etmp, overlap, opus_val32);
|
||||||
ALLOC(_exc, MAX_PERIOD+LPC_ORDER, opus_val16);
|
ALLOC(_exc, MAX_PERIOD+LPC_ORDER, opus_val16);
|
||||||
|
ALLOC(fir_tmp, exc_length, opus_val16);
|
||||||
exc = _exc+LPC_ORDER;
|
exc = _exc+LPC_ORDER;
|
||||||
window = mode->window;
|
window = mode->window;
|
||||||
c=0; do {
|
c=0; do {
|
||||||
|
@ -581,13 +588,11 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, int N, int LM)
|
||||||
celt_sig *buf;
|
celt_sig *buf;
|
||||||
int extrapolation_offset;
|
int extrapolation_offset;
|
||||||
int extrapolation_len;
|
int extrapolation_len;
|
||||||
int exc_length;
|
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
buf = decode_mem[c];
|
buf = decode_mem[c];
|
||||||
for (i=0;i<MAX_PERIOD;i++) {
|
for (i=0;i<MAX_PERIOD+LPC_ORDER;i++)
|
||||||
exc[i] = ROUND16(buf[DECODE_BUFFER_SIZE-MAX_PERIOD+i], SIG_SHIFT);
|
exc[i-LPC_ORDER] = ROUND16(buf[DECODE_BUFFER_SIZE-MAX_PERIOD-LPC_ORDER+i], SIG_SHIFT);
|
||||||
}
|
|
||||||
|
|
||||||
if (loss_count == 0)
|
if (loss_count == 0)
|
||||||
{
|
{
|
||||||
|
@ -631,20 +636,14 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, int N, int LM)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
/* We want the excitation for 2 pitch periods in order to look for a
|
|
||||||
decaying signal, but we can't get more than MAX_PERIOD. */
|
|
||||||
exc_length = IMIN(2*pitch_index, MAX_PERIOD);
|
|
||||||
/* Initialize the LPC history with the samples just before the start
|
/* Initialize the LPC history with the samples just before the start
|
||||||
of the region for which we're computing the excitation. */
|
of the region for which we're computing the excitation. */
|
||||||
{
|
{
|
||||||
for (i=0;i<LPC_ORDER;i++)
|
/* Compute the excitation for exc_length samples before the loss. We need the copy
|
||||||
{
|
because celt_fir() cannot filter in-place. */
|
||||||
exc[MAX_PERIOD-exc_length-LPC_ORDER+i] =
|
|
||||||
ROUND16(buf[DECODE_BUFFER_SIZE-exc_length-LPC_ORDER+i], SIG_SHIFT);
|
|
||||||
}
|
|
||||||
/* Compute the excitation for exc_length samples before the loss. */
|
|
||||||
celt_fir(exc+MAX_PERIOD-exc_length, lpc+c*LPC_ORDER,
|
celt_fir(exc+MAX_PERIOD-exc_length, lpc+c*LPC_ORDER,
|
||||||
exc+MAX_PERIOD-exc_length, exc_length, LPC_ORDER, st->arch);
|
fir_tmp, exc_length, LPC_ORDER, st->arch);
|
||||||
|
OPUS_COPY(exc+MAX_PERIOD-exc_length, fir_tmp, exc_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if the waveform is decaying, and if so how fast.
|
/* Check if the waveform is decaying, and if so how fast.
|
||||||
|
|
|
@ -99,7 +99,7 @@ void celt_fir_c(
|
||||||
int i,j;
|
int i,j;
|
||||||
VARDECL(opus_val16, rnum);
|
VARDECL(opus_val16, rnum);
|
||||||
SAVE_STACK;
|
SAVE_STACK;
|
||||||
|
celt_assert(x != y);
|
||||||
ALLOC(rnum, ord, opus_val16);
|
ALLOC(rnum, ord, opus_val16);
|
||||||
for(i=0;i<ord;i++)
|
for(i=0;i<ord;i++)
|
||||||
rnum[i] = num[ord-i-1];
|
rnum[i] = num[ord-i-1];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue