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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 void silk_find_LTP_FIX( | 43 void silk_find_LTP_FIX( |
44 opus_int16 b_Q14[ MAX_NB_SUBFR * LTP_ORDER ], /* O
LTP coefs
*/ | 44 opus_int16 b_Q14[ MAX_NB_SUBFR * LTP_ORDER ], /* O
LTP coefs
*/ |
45 opus_int32 WLTP[ MAX_NB_SUBFR * LTP_ORDER * LTP_ORDER ]
, /* O Weight for LTP quantization
*/ | 45 opus_int32 WLTP[ MAX_NB_SUBFR * LTP_ORDER * LTP_ORDER ]
, /* O Weight for LTP quantization
*/ |
46 opus_int *LTPredCodGain_Q7, /* O
LTP coding gain
*/ | 46 opus_int *LTPredCodGain_Q7, /* O
LTP coding gain
*/ |
47 const opus_int16 r_lpc[], /* I
residual signal after LPC signal + state for first 10 ms
*/ | 47 const opus_int16 r_lpc[], /* I
residual signal after LPC signal + state for first 10 ms
*/ |
48 const opus_int lag[ MAX_NB_SUBFR ], /* I
LTP lags
*/ | 48 const opus_int lag[ MAX_NB_SUBFR ], /* I
LTP lags
*/ |
49 const opus_int32 Wght_Q15[ MAX_NB_SUBFR ], /* I
weights
*/ | 49 const opus_int32 Wght_Q15[ MAX_NB_SUBFR ], /* I
weights
*/ |
50 const opus_int subfr_length, /* I
subframe length
*/ | 50 const opus_int subfr_length, /* I
subframe length
*/ |
51 const opus_int nb_subfr, /* I
number of subframes
*/ | 51 const opus_int nb_subfr, /* I
number of subframes
*/ |
52 const opus_int mem_offset, /* I
number of samples in LTP memory
*/ | 52 const opus_int mem_offset, /* I
number of samples in LTP memory
*/ |
53 opus_int corr_rshifts[ MAX_NB_SUBFR ] /* O
right shifts applied to correlations
*/ | 53 opus_int corr_rshifts[ MAX_NB_SUBFR ], /* O
right shifts applied to correlations
*/ |
| 54 int arch /* I
Run-time architecture
*/ |
54 ) | 55 ) |
55 { | 56 { |
56 opus_int i, k, lshift; | 57 opus_int i, k, lshift; |
57 const opus_int16 *r_ptr, *lag_ptr; | 58 const opus_int16 *r_ptr, *lag_ptr; |
58 opus_int16 *b_Q14_ptr; | 59 opus_int16 *b_Q14_ptr; |
59 | 60 |
60 opus_int32 regu; | 61 opus_int32 regu; |
61 opus_int32 *WLTP_ptr; | 62 opus_int32 *WLTP_ptr; |
62 opus_int32 b_Q16[ LTP_ORDER ], delta_b_Q14[ LTP_ORDER ], d_Q14[ MAX_NB_SUBFR
], nrg[ MAX_NB_SUBFR ], g_Q26; | 63 opus_int32 b_Q16[ LTP_ORDER ], delta_b_Q14[ LTP_ORDER ], d_Q14[ MAX_NB_SUBFR
], nrg[ MAX_NB_SUBFR ], g_Q26; |
63 opus_int32 w[ MAX_NB_SUBFR ], WLTP_max, max_abs_d_Q14, max_w_bits; | 64 opus_int32 w[ MAX_NB_SUBFR ], WLTP_max, max_abs_d_Q14, max_w_bits; |
(...skipping 13 matching lines...) Expand all Loading... |
77 | 78 |
78 silk_sum_sqr_shift( &rr[ k ], &rr_shifts, r_ptr, subfr_length ); /* rr[
k ] in Q( -rr_shifts ) */ | 79 silk_sum_sqr_shift( &rr[ k ], &rr_shifts, r_ptr, subfr_length ); /* rr[
k ] in Q( -rr_shifts ) */ |
79 | 80 |
80 /* Assure headroom */ | 81 /* Assure headroom */ |
81 LZs = silk_CLZ32( rr[k] ); | 82 LZs = silk_CLZ32( rr[k] ); |
82 if( LZs < LTP_CORRS_HEAD_ROOM ) { | 83 if( LZs < LTP_CORRS_HEAD_ROOM ) { |
83 rr[ k ] = silk_RSHIFT_ROUND( rr[ k ], LTP_CORRS_HEAD_ROOM - LZs ); | 84 rr[ k ] = silk_RSHIFT_ROUND( rr[ k ], LTP_CORRS_HEAD_ROOM - LZs ); |
84 rr_shifts += ( LTP_CORRS_HEAD_ROOM - LZs ); | 85 rr_shifts += ( LTP_CORRS_HEAD_ROOM - LZs ); |
85 } | 86 } |
86 corr_rshifts[ k ] = rr_shifts; | 87 corr_rshifts[ k ] = rr_shifts; |
87 silk_corrMatrix_FIX( lag_ptr, subfr_length, LTP_ORDER, LTP_CORRS_HEAD_RO
OM, WLTP_ptr, &corr_rshifts[ k ] ); /* WLTP_fix_ptr in Q( -corr_rshifts[ k ] )
*/ | 88 silk_corrMatrix_FIX( lag_ptr, subfr_length, LTP_ORDER, LTP_CORRS_HEAD_RO
OM, WLTP_ptr, &corr_rshifts[ k ], arch ); /* WLTP_fix_ptr in Q( -corr_rshifts[
k ] ) */ |
88 | 89 |
89 /* The correlation vector always has lower max abs value than rr and/or
RR so head room is assured */ | 90 /* The correlation vector always has lower max abs value than rr and/or
RR so head room is assured */ |
90 silk_corrVector_FIX( lag_ptr, r_ptr, subfr_length, LTP_ORDER, Rr, corr_r
shifts[ k ] ); /* Rr_fix_ptr in Q( -corr_rshifts[ k ] ) */ | 91 silk_corrVector_FIX( lag_ptr, r_ptr, subfr_length, LTP_ORDER, Rr, corr_r
shifts[ k ], arch ); /* Rr_fix_ptr in Q( -corr_rshifts[ k ] ) */ |
91 if( corr_rshifts[ k ] > rr_shifts ) { | 92 if( corr_rshifts[ k ] > rr_shifts ) { |
92 rr[ k ] = silk_RSHIFT( rr[ k ], corr_rshifts[ k ] - rr_shifts ); /*
rr[ k ] in Q( -corr_rshifts[ k ] ) */ | 93 rr[ k ] = silk_RSHIFT( rr[ k ], corr_rshifts[ k ] - rr_shifts ); /*
rr[ k ] in Q( -corr_rshifts[ k ] ) */ |
93 } | 94 } |
94 silk_assert( rr[ k ] >= 0 ); | 95 silk_assert( rr[ k ] >= 0 ); |
95 | 96 |
96 regu = 1; | 97 regu = 1; |
97 regu = silk_SMLAWB( regu, rr[ k ], SILK_FIX_CONST( LTP_DAMPING/3, 16 ) )
; | 98 regu = silk_SMLAWB( regu, rr[ k ], SILK_FIX_CONST( LTP_DAMPING/3, 16 ) )
; |
98 regu = silk_SMLAWB( regu, matrix_ptr( WLTP_ptr, 0, 0, LTP_ORDER ), SILK_
FIX_CONST( LTP_DAMPING/3, 16 ) ); | 99 regu = silk_SMLAWB( regu, matrix_ptr( WLTP_ptr, 0, 0, LTP_ORDER ), SILK_
FIX_CONST( LTP_DAMPING/3, 16 ) ); |
99 regu = silk_SMLAWB( regu, matrix_ptr( WLTP_ptr, LTP_ORDER-1, LTP_ORDER-1
, LTP_ORDER ), SILK_FIX_CONST( LTP_DAMPING/3, 16 ) ); | 100 regu = silk_SMLAWB( regu, matrix_ptr( WLTP_ptr, LTP_ORDER-1, LTP_ORDER-1
, LTP_ORDER ), SILK_FIX_CONST( LTP_DAMPING/3, 16 ) ); |
100 silk_regularize_correlations_FIX( WLTP_ptr, &rr[k], regu, LTP_ORDER ); | 101 silk_regularize_correlations_FIX( WLTP_ptr, &rr[k], regu, LTP_ORDER ); |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 opus_int32 LTP_coefs_Q16[ LTP_ORDER ], | 236 opus_int32 LTP_coefs_Q16[ LTP_ORDER ], |
236 opus_int16 LTP_coefs_Q14[ LTP_ORDER ] | 237 opus_int16 LTP_coefs_Q14[ LTP_ORDER ] |
237 ) | 238 ) |
238 { | 239 { |
239 opus_int i; | 240 opus_int i; |
240 | 241 |
241 for( i = 0; i < LTP_ORDER; i++ ) { | 242 for( i = 0; i < LTP_ORDER; i++ ) { |
242 LTP_coefs_Q14[ i ] = (opus_int16)silk_SAT16( silk_RSHIFT_ROUND( LTP_coef
s_Q16[ i ], 2 ) ); | 243 LTP_coefs_Q14[ i ] = (opus_int16)silk_SAT16( silk_RSHIFT_ROUND( LTP_coef
s_Q16[ i ], 2 ) ); |
243 } | 244 } |
244 } | 245 } |
OLD | NEW |