| OLD | NEW |
| 1 /*********************************************************************** | 1 /*********************************************************************** |
| 2 Copyright (c) 2006-2011, Skype Limited. All rights reserved. | 2 Copyright (c) 2006-2011, Skype Limited. All rights reserved. |
| 3 Redistribution and use in source and binary forms, with or without | 3 Redistribution and use in source and binary forms, with or without |
| 4 modification, are permitted provided that the following conditions | 4 modification, are permitted provided that the following conditions |
| 5 are met: | 5 are met: |
| 6 - Redistributions of source code must retain the above copyright notice, | 6 - Redistributions of source code must retain the above copyright notice, |
| 7 this list of conditions and the following disclaimer. | 7 this list of conditions and the following disclaimer. |
| 8 - Redistributions in binary form must reproduce the above copyright | 8 - Redistributions in binary form must reproduce the above copyright |
| 9 notice, this list of conditions and the following disclaimer in the | 9 notice, this list of conditions and the following disclaimer in the |
| 10 documentation and/or other materials provided with the distribution. | 10 documentation and/or other materials provided with the distribution. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 #include "SigProc_FIX.h" | 38 #include "SigProc_FIX.h" |
| 39 #include "tables.h" | 39 #include "tables.h" |
| 40 | 40 |
| 41 /* Number of binary divisions, when not in low complexity mode */ | 41 /* Number of binary divisions, when not in low complexity mode */ |
| 42 #define BIN_DIV_STEPS_A2NLSF_FIX 3 /* must be no higher than 16 - log2( LSF
_COS_TAB_SZ_FIX ) */ | 42 #define BIN_DIV_STEPS_A2NLSF_FIX 3 /* must be no higher than 16 - log2( LSF
_COS_TAB_SZ_FIX ) */ |
| 43 #define MAX_ITERATIONS_A2NLSF_FIX 30 | 43 #define MAX_ITERATIONS_A2NLSF_FIX 30 |
| 44 | 44 |
| 45 /* Helper function for A2NLSF(..) */ | 45 /* Helper function for A2NLSF(..) */ |
| 46 /* Transforms polynomials from cos(n*f) to cos(f)^n */ | 46 /* Transforms polynomials from cos(n*f) to cos(f)^n */ |
| 47 static inline void silk_A2NLSF_trans_poly( | 47 static OPUS_INLINE void silk_A2NLSF_trans_poly( |
| 48 opus_int32 *p, /* I/O Polynomial
*/ | 48 opus_int32 *p, /* I/O Polynomial
*/ |
| 49 const opus_int dd /* I Polynomial order (= fi
lter order / 2 ) */ | 49 const opus_int dd /* I Polynomial order (= fi
lter order / 2 ) */ |
| 50 ) | 50 ) |
| 51 { | 51 { |
| 52 opus_int k, n; | 52 opus_int k, n; |
| 53 | 53 |
| 54 for( k = 2; k <= dd; k++ ) { | 54 for( k = 2; k <= dd; k++ ) { |
| 55 for( n = dd; n > k; n-- ) { | 55 for( n = dd; n > k; n-- ) { |
| 56 p[ n - 2 ] -= p[ n ]; | 56 p[ n - 2 ] -= p[ n ]; |
| 57 } | 57 } |
| 58 p[ k - 2 ] -= silk_LSHIFT( p[ k ], 1 ); | 58 p[ k - 2 ] -= silk_LSHIFT( p[ k ], 1 ); |
| 59 } | 59 } |
| 60 } | 60 } |
| 61 /* Helper function for A2NLSF(..) */ | 61 /* Helper function for A2NLSF(..) */ |
| 62 /* Polynomial evaluation */ | 62 /* Polynomial evaluation */ |
| 63 static inline opus_int32 silk_A2NLSF_eval_poly( /* return the polynomial evaluat
ion, in Q16 */ | 63 static OPUS_INLINE opus_int32 silk_A2NLSF_eval_poly( /* return the polynomial ev
aluation, in Q16 */ |
| 64 opus_int32 *p, /* I Polynomial, Q16
*/ | 64 opus_int32 *p, /* I Polynomial, Q16
*/ |
| 65 const opus_int32 x, /* I Evaluation point, Q12
*/ | 65 const opus_int32 x, /* I Evaluation point, Q12
*/ |
| 66 const opus_int dd /* I Order
*/ | 66 const opus_int dd /* I Order
*/ |
| 67 ) | 67 ) |
| 68 { | 68 { |
| 69 opus_int n; | 69 opus_int n; |
| 70 opus_int32 x_Q16, y32; | 70 opus_int32 x_Q16, y32; |
| 71 | 71 |
| 72 y32 = p[ dd ]; /* Q16 */ | 72 y32 = p[ dd ]; /* Q16 */ |
| 73 x_Q16 = silk_LSHIFT( x, 4 ); | 73 x_Q16 = silk_LSHIFT( x, 4 ); |
| 74 for( n = dd - 1; n >= 0; n-- ) { | 74 for( n = dd - 1; n >= 0; n-- ) { |
| 75 y32 = silk_SMLAWW( p[ n ], y32, x_Q16 ); /* Q16 */ | 75 y32 = silk_SMLAWW( p[ n ], y32, x_Q16 ); /* Q16 */ |
| 76 } | 76 } |
| 77 return y32; | 77 return y32; |
| 78 } | 78 } |
| 79 | 79 |
| 80 static inline void silk_A2NLSF_init( | 80 static OPUS_INLINE void silk_A2NLSF_init( |
| 81 const opus_int32 *a_Q16, | 81 const opus_int32 *a_Q16, |
| 82 opus_int32 *P, | 82 opus_int32 *P, |
| 83 opus_int32 *Q, | 83 opus_int32 *Q, |
| 84 const opus_int dd | 84 const opus_int dd |
| 85 ) | 85 ) |
| 86 { | 86 { |
| 87 opus_int k; | 87 opus_int k; |
| 88 | 88 |
| 89 /* Convert filter coefs to even and odd polynomials */ | 89 /* Convert filter coefs to even and odd polynomials */ |
| 90 P[dd] = silk_LSHIFT( 1, 16 ); | 90 P[dd] = silk_LSHIFT( 1, 16 ); |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 ylo = silk_A2NLSF_eval_poly( p, xlo, dd ); | 243 ylo = silk_A2NLSF_eval_poly( p, xlo, dd ); |
| 244 root_ix = 1; /* Index of current root */ | 244 root_ix = 1; /* Index of current root */ |
| 245 } else { | 245 } else { |
| 246 root_ix = 0; /* Index of current root */ | 246 root_ix = 0; /* Index of current root */ |
| 247 } | 247 } |
| 248 k = 1; /* Reset loop counter */ | 248 k = 1; /* Reset loop counter */ |
| 249 } | 249 } |
| 250 } | 250 } |
| 251 } | 251 } |
| 252 } | 252 } |
| OLD | NEW |