summaryrefslogtreecommitdiff
path: root/lib/rbcodec/codecs/libopus/celt/celt_decoder.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rbcodec/codecs/libopus/celt/celt_decoder.c')
-rw-r--r--lib/rbcodec/codecs/libopus/celt/celt_decoder.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/lib/rbcodec/codecs/libopus/celt/celt_decoder.c b/lib/rbcodec/codecs/libopus/celt/celt_decoder.c
index 3d8211b9b0..77fa2d01f7 100644
--- a/lib/rbcodec/codecs/libopus/celt/celt_decoder.c
+++ b/lib/rbcodec/codecs/libopus/celt/celt_decoder.c
@@ -175,7 +175,7 @@ void opus_custom_decoder_destroy(CELTDecoder *st)
175} 175}
176#endif /* CUSTOM_MODES */ 176#endif /* CUSTOM_MODES */
177 177
178static inline opus_val16 SIG2WORD16(celt_sig x) 178static OPUS_INLINE opus_val16 SIG2WORD16(celt_sig x)
179{ 179{
180#ifdef FIXED_POINT 180#ifdef FIXED_POINT
181 x = PSHR32(x, SIG_SHIFT); 181 x = PSHR32(x, SIG_SHIFT);
@@ -213,7 +213,7 @@ void deemphasis(celt_sig *in[], opus_val16 *pcm, int N, int C, int downsample, c
213 opus_val16 coef3 = coef[3]; 213 opus_val16 coef3 = coef[3];
214 for (j=0;j<N;j++) 214 for (j=0;j<N;j++)
215 { 215 {
216 celt_sig tmp = x[j] + m; 216 celt_sig tmp = x[j] + m + VERY_SMALL;
217 m = MULT16_32_Q15(coef0, tmp) 217 m = MULT16_32_Q15(coef0, tmp)
218 - MULT16_32_Q15(coef1, x[j]); 218 - MULT16_32_Q15(coef1, x[j]);
219 tmp = SHL32(MULT16_32_Q15(coef3, tmp), 2); 219 tmp = SHL32(MULT16_32_Q15(coef3, tmp), 2);
@@ -227,7 +227,7 @@ void deemphasis(celt_sig *in[], opus_val16 *pcm, int N, int C, int downsample, c
227 /* Shortcut for the standard (non-custom modes) case */ 227 /* Shortcut for the standard (non-custom modes) case */
228 for (j=0;j<N;j++) 228 for (j=0;j<N;j++)
229 { 229 {
230 celt_sig tmp = x[j] + m; 230 celt_sig tmp = x[j] + m + VERY_SMALL;
231 m = MULT16_32_Q15(coef0, tmp); 231 m = MULT16_32_Q15(coef0, tmp);
232 scratch[j] = tmp; 232 scratch[j] = tmp;
233 } 233 }
@@ -447,10 +447,11 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, opus_val16 * OPUS_R
447 { 447 {
448 VARDECL( opus_val16, lp_pitch_buf ); 448 VARDECL( opus_val16, lp_pitch_buf );
449 ALLOC( lp_pitch_buf, DECODE_BUFFER_SIZE>>1, opus_val16 ); 449 ALLOC( lp_pitch_buf, DECODE_BUFFER_SIZE>>1, opus_val16 );
450 pitch_downsample(decode_mem, lp_pitch_buf, DECODE_BUFFER_SIZE, C); 450 pitch_downsample(decode_mem, lp_pitch_buf,
451 DECODE_BUFFER_SIZE, C, st->arch);
451 pitch_search(lp_pitch_buf+(PLC_PITCH_LAG_MAX>>1), lp_pitch_buf, 452 pitch_search(lp_pitch_buf+(PLC_PITCH_LAG_MAX>>1), lp_pitch_buf,
452 DECODE_BUFFER_SIZE-PLC_PITCH_LAG_MAX, 453 DECODE_BUFFER_SIZE-PLC_PITCH_LAG_MAX,
453 PLC_PITCH_LAG_MAX-PLC_PITCH_LAG_MIN, &pitch_index); 454 PLC_PITCH_LAG_MAX-PLC_PITCH_LAG_MIN, &pitch_index, st->arch);
454 pitch_index = PLC_PITCH_LAG_MAX-pitch_index; 455 pitch_index = PLC_PITCH_LAG_MAX-pitch_index;
455 st->last_pitch_index = pitch_index; 456 st->last_pitch_index = pitch_index;
456 } else { 457 } else {
@@ -481,7 +482,8 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, opus_val16 * OPUS_R
481 opus_val32 ac[LPC_ORDER+1]; 482 opus_val32 ac[LPC_ORDER+1];
482 /* Compute LPC coefficients for the last MAX_PERIOD samples before 483 /* Compute LPC coefficients for the last MAX_PERIOD samples before
483 the first loss so we can work in the excitation-filter domain. */ 484 the first loss so we can work in the excitation-filter domain. */
484 _celt_autocorr(exc, ac, window, overlap, LPC_ORDER, MAX_PERIOD); 485 _celt_autocorr(exc, ac, window, overlap,
486 LPC_ORDER, MAX_PERIOD, st->arch);
485 /* Add a noise floor of -40 dB. */ 487 /* Add a noise floor of -40 dB. */
486#ifdef FIXED_POINT 488#ifdef FIXED_POINT
487 ac[0] += SHR32(ac[0],13); 489 ac[0] += SHR32(ac[0],13);
@@ -668,7 +670,6 @@ int celt_decode_with_ec(CELTDecoder * OPUS_RESTRICT st, const unsigned char *dat
668 VARDECL(int, fine_priority); 670 VARDECL(int, fine_priority);
669 VARDECL(int, tf_res); 671 VARDECL(int, tf_res);
670 VARDECL(unsigned char, collapse_masks); 672 VARDECL(unsigned char, collapse_masks);
671 celt_sig *out_mem[2] = {NULL, NULL};
672 celt_sig *decode_mem[2]; 673 celt_sig *decode_mem[2];
673 celt_sig *out_syn[2]; 674 celt_sig *out_syn[2];
674 opus_val16 *lpc; 675 opus_val16 *lpc;
@@ -709,7 +710,6 @@ int celt_decode_with_ec(CELTDecoder * OPUS_RESTRICT st, const unsigned char *dat
709 710
710 c=0; do { 711 c=0; do {
711 decode_mem[c] = st->_decode_mem + c*(DECODE_BUFFER_SIZE+overlap); 712 decode_mem[c] = st->_decode_mem + c*(DECODE_BUFFER_SIZE+overlap);
712 out_mem[c] = decode_mem[c]+DECODE_BUFFER_SIZE-MAX_PERIOD;
713 } while (++c<CC); 713 } while (++c<CC);
714 lpc = (opus_val16*)(st->_decode_mem+(DECODE_BUFFER_SIZE+overlap)*CC); 714 lpc = (opus_val16*)(st->_decode_mem+(DECODE_BUFFER_SIZE+overlap)*CC);
715 oldBandE = lpc+CC*LPC_ORDER; 715 oldBandE = lpc+CC*LPC_ORDER;
@@ -934,7 +934,6 @@ int celt_decode_with_ec(CELTDecoder * OPUS_RESTRICT st, const unsigned char *dat
934 /* Synthesis */ 934 /* Synthesis */
935 denormalise_bands(mode, X, freq, oldBandE, st->start, effEnd, C, M); 935 denormalise_bands(mode, X, freq, oldBandE, st->start, effEnd, C, M);
936 } 936 }
937
938 c=0; do { 937 c=0; do {
939 OPUS_MOVE(decode_mem[c], decode_mem[c]+N, DECODE_BUFFER_SIZE-N+overlap/2); 938 OPUS_MOVE(decode_mem[c], decode_mem[c]+N, DECODE_BUFFER_SIZE-N+overlap/2);
940 } while (++c<CC); 939 } while (++c<CC);
@@ -948,7 +947,7 @@ int celt_decode_with_ec(CELTDecoder * OPUS_RESTRICT st, const unsigned char *dat
948 } while (++c<C); 947 } while (++c<C);
949 948
950 c=0; do { 949 c=0; do {
951 out_syn[c] = out_mem[c]+MAX_PERIOD-N; 950 out_syn[c] = decode_mem[c]+DECODE_BUFFER_SIZE-N;
952 } while (++c<CC); 951 } while (++c<CC);
953 952
954 if (CC==2&&C==1) 953 if (CC==2&&C==1)