applied some patch to CELT library

This commit is contained in:
Volker Fischer 2009-08-23 07:03:28 +00:00
parent a0584119c2
commit 73607a465a
3 changed files with 33 additions and 16 deletions

View file

@ -1,3 +1,11 @@
3.0.1
- bug fix: buzzing occurred when audio stream was interrupted (e.g. in case
of network trouble)
- in case "Open Chat on New Message" is not enabled, a hint in the status bar
is shown when a message is received
3.0.0
- introduced new audio codec "CELT", not compatible to old versions

View file

@ -1,4 +1,5 @@
The CELT library version 0.6.1 is used.
The CELT library version 0.6.1 is uses, including git patch "0f0da999ae82a2b73974cc73a1a19d79a23ba8cd"
of celt.c by Jean-Marc "Better fading for PLC: no fading for the first loss, muting after 6".
Basically the files in celt-0.6.1/libcelt are used.

View file

@ -1111,6 +1111,7 @@ struct CELTDecoder {
celt_word16_t *oldBandE;
int last_pitch_index;
int loss_count;
};
int check_decoder(const CELTDecoder *st)
@ -1157,7 +1158,7 @@ CELTDecoder *celt_decoder_create(const CELTMode *mode)
st->preemph_memD = (celt_sig_t*)celt_alloc(C*sizeof(celt_sig_t));
st->last_pitch_index = 0;
st->loss_count = 0;
if ((st->decode_mem!=NULL) && (st->out_mem!=NULL) && (st->oldBandE!=NULL) &&
(st->preemph_memD!=NULL))
@ -1214,6 +1215,7 @@ static void celt_decode_lost(CELTDecoder * __restrict st, celt_word16_t * __rest
{
int c, N;
int pitch_index;
celt_word16_t fade = Q15ONE;
int i, len;
VARDECL(celt_sig_t, freq);
const int C = CHANNELS(st->mode);
@ -1223,24 +1225,26 @@ static void celt_decode_lost(CELTDecoder * __restrict st, celt_word16_t * __rest
ALLOC(freq,C*N, celt_sig_t); /**< Interleaved signal MDCTs */
len = N+st->mode->overlap;
#if 0
pitch_index = st->last_pitch_index;
/* Use the pitch MDCT as the "guessed" signal */
compute_mdcts(st->mode, st->mode->window, st->out_mem+pitch_index*C, freq);
if (st->loss_count == 0)
{
find_spectral_pitch(st->mode, st->mode->fft, &st->mode->psy, st->out_mem+MAX_PERIOD-len, st->out_mem, st->mode->window, NULL, len, MAX_PERIOD-len-100, &pitch_index);
pitch_index = MAX_PERIOD-len-pitch_index;
st->last_pitch_index = pitch_index;
} else {
pitch_index = st->last_pitch_index;
if (st->loss_count < 5)
fade = QCONST16(.8f,15);
else
fade = 0;
}
#else
find_spectral_pitch(st->mode, st->mode->fft, &st->mode->psy, st->out_mem+MAX_PERIOD-len, st->out_mem, st->mode->window, NULL, len, MAX_PERIOD-len-100, &pitch_index);
pitch_index = MAX_PERIOD-len-pitch_index;
offset = MAX_PERIOD-pitch_index;
while (offset+len >= MAX_PERIOD)
offset -= pitch_index;
compute_mdcts(st->mode, 0, st->out_mem+offset*C, freq);
for (i=0;i<C*N;i++)
freq[i] = ADD32(EPSILON, MULT16_32_Q15(QCONST16(.9f,15),freq[i]));
#endif
freq[i] = ADD32(VERY_SMALL, MULT16_32_Q15(fade,freq[i]));
CELT_MOVE(st->out_mem, st->out_mem+C*N, C*(MAX_PERIOD+st->mode->overlap-N));
/* Compute inverse MDCTs */
@ -1257,6 +1261,9 @@ static void celt_decode_lost(CELTDecoder * __restrict st, celt_word16_t * __rest
pcm[C*j+c] = SCALEOUT(SIG2WORD16(tmp));
}
}
st->loss_count++;
RESTORE_STACK;
}
#endif
@ -1316,6 +1323,8 @@ int celt_decode_float(CELTDecoder * __restrict st, const unsigned char *data, in
celt_decode_lost(st, pcm);
RESTORE_STACK;
return 0;
} else {
st->loss_count = 0;
}
if (len<0) {
RESTORE_STACK;
@ -1347,7 +1356,6 @@ int celt_decode_float(CELTDecoder * __restrict st, const unsigned char *data, in
if (has_pitch)
{
pitch_index = ec_dec_uint(&dec, MAX_PERIOD-(2*N-2*N4));
st->last_pitch_index = pitch_index;
} else {
pitch_index = 0;
for (i=0;i<st->mode->nbPBands;i++)
@ -1524,7 +1532,7 @@ int celt_decoder_ctl(CELTDecoder * __restrict st, int request, ...)
CELT_MEMSET(st->preemph_memD, 0, C);
st->last_pitch_index = 0;
st->loss_count = 0;
}
break;
default: