summaryrefslogtreecommitdiff
path: root/lib/rbcodec/codecs/libopus/silk/LPC_analysis_filter.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rbcodec/codecs/libopus/silk/LPC_analysis_filter.c')
-rw-r--r--lib/rbcodec/codecs/libopus/silk/LPC_analysis_filter.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/lib/rbcodec/codecs/libopus/silk/LPC_analysis_filter.c b/lib/rbcodec/codecs/libopus/silk/LPC_analysis_filter.c
index 9d1f16cb7d..d34b5eb709 100644
--- a/lib/rbcodec/codecs/libopus/silk/LPC_analysis_filter.c
+++ b/lib/rbcodec/codecs/libopus/silk/LPC_analysis_filter.c
@@ -39,17 +39,24 @@ POSSIBILITY OF SUCH DAMAGE.
39/* first d output samples are set to zero */ 39/* first d output samples are set to zero */
40/*******************************************/ 40/*******************************************/
41 41
42/* OPT: Using celt_fir() for this function should be faster, but it may cause
43 integer overflows in intermediate values (not final results), which the
44 current implementation silences by casting to unsigned. Enabling
45 this should be safe in pretty much all cases, even though it is not technically
46 C89-compliant. */
47#define USE_CELT_FIR 0
48
42void silk_LPC_analysis_filter( 49void silk_LPC_analysis_filter(
43 opus_int16 *out, /* O Output signal */ 50 opus_int16 *out, /* O Output signal */
44 const opus_int16 *in, /* I Input signal */ 51 const opus_int16 *in, /* I Input signal */
45 const opus_int16 *B, /* I MA prediction coefficients, Q12 [order] */ 52 const opus_int16 *B, /* I MA prediction coefficients, Q12 [order] */
46 const opus_int32 len, /* I Signal length */ 53 const opus_int32 len, /* I Signal length */
47 const opus_int32 d /* I Filter order */ 54 const opus_int32 d, /* I Filter order */
55 int arch /* I Run-time architecture */
48) 56)
49{ 57{
50 opus_int j; 58 opus_int j;
51#ifdef FIXED_POINT 59#if defined(FIXED_POINT) && USE_CELT_FIR
52 opus_int16 mem[SILK_MAX_ORDER_LPC];
53 opus_int16 num[SILK_MAX_ORDER_LPC]; 60 opus_int16 num[SILK_MAX_ORDER_LPC];
54#else 61#else
55 int ix; 62 int ix;
@@ -57,23 +64,21 @@ void silk_LPC_analysis_filter(
57 const opus_int16 *in_ptr; 64 const opus_int16 *in_ptr;
58#endif 65#endif
59 66
60 silk_assert( d >= 6 ); 67 celt_assert( d >= 6 );
61 silk_assert( (d & 1) == 0 ); 68 celt_assert( (d & 1) == 0 );
62 silk_assert( d <= len ); 69 celt_assert( d <= len );
63 70
64#ifdef FIXED_POINT 71#if defined(FIXED_POINT) && USE_CELT_FIR
65 silk_assert( d <= SILK_MAX_ORDER_LPC ); 72 celt_assert( d <= SILK_MAX_ORDER_LPC );
66 for ( j = 0; j < d; j++ ) { 73 for ( j = 0; j < d; j++ ) {
67 num[ j ] = -B[ j ]; 74 num[ j ] = -B[ j ];
68 } 75 }
69 for (j=0;j<d;j++) { 76 celt_fir( in + d, num, out + d, len - d, d, arch );
70 mem[ j ] = in[ d - j - 1 ];
71 }
72 celt_fir( in + d, num, out + d, len - d, d, mem );
73 for ( j = 0; j < d; j++ ) { 77 for ( j = 0; j < d; j++ ) {
74 out[ j ] = 0; 78 out[ j ] = 0;
75 } 79 }
76#else 80#else
81 (void)arch;
77 for( ix = d; ix < len; ix++ ) { 82 for( ix = d; ix < len; ix++ ) {
78 in_ptr = &in[ ix - 1 ]; 83 in_ptr = &in[ ix - 1 ];
79 84