| 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 } | 154 } |
| 155 | 155 |
| 156 /* Convert input to fix */ | 156 /* Convert input to fix */ |
| 157 for( i = 0; i < psEnc->sCmn.frame_length; i++ ) { | 157 for( i = 0; i < psEnc->sCmn.frame_length; i++ ) { |
| 158 x_Q3[ i ] = silk_float2int( 8.0f * x[ i ] ); | 158 x_Q3[ i ] = silk_float2int( 8.0f * x[ i ] ); |
| 159 } | 159 } |
| 160 | 160 |
| 161 /* Call NSQ */ | 161 /* Call NSQ */ |
| 162 if( psEnc->sCmn.nStatesDelayedDecision > 1 || psEnc->sCmn.warping_Q16 > 0 )
{ | 162 if( psEnc->sCmn.nStatesDelayedDecision > 1 || psEnc->sCmn.warping_Q16 > 0 )
{ |
| 163 silk_NSQ_del_dec( &psEnc->sCmn, psNSQ, psIndices, x_Q3, pulses, PredCoef
_Q12[ 0 ], LTPCoef_Q14, | 163 silk_NSQ_del_dec( &psEnc->sCmn, psNSQ, psIndices, x_Q3, pulses, PredCoef
_Q12[ 0 ], LTPCoef_Q14, |
| 164 AR2_Q13, HarmShapeGain_Q14, Tilt_Q14, LF_shp_Q14, Gains_Q16, psEncCt
rl->pitchL, Lambda_Q10, LTP_scale_Q14 ); | 164 AR2_Q13, HarmShapeGain_Q14, Tilt_Q14, LF_shp_Q14, Gains_Q16, psEncCt
rl->pitchL, Lambda_Q10, LTP_scale_Q14, psEnc->sCmn.arch ); |
| 165 } else { | 165 } else { |
| 166 silk_NSQ( &psEnc->sCmn, psNSQ, psIndices, x_Q3, pulses, PredCoef_Q12[ 0
], LTPCoef_Q14, | 166 silk_NSQ( &psEnc->sCmn, psNSQ, psIndices, x_Q3, pulses, PredCoef_Q12[ 0
], LTPCoef_Q14, |
| 167 AR2_Q13, HarmShapeGain_Q14, Tilt_Q14, LF_shp_Q14, Gains_Q16, psEncCt
rl->pitchL, Lambda_Q10, LTP_scale_Q14 ); | 167 AR2_Q13, HarmShapeGain_Q14, Tilt_Q14, LF_shp_Q14, Gains_Q16, psEncCt
rl->pitchL, Lambda_Q10, LTP_scale_Q14, psEnc->sCmn.arch ); |
| 168 } | 168 } |
| 169 } | 169 } |
| 170 | 170 |
| 171 /***********************************************/ | 171 /***********************************************/ |
| 172 /* Floating-point Silk LTP quantiation wrapper */ | 172 /* Floating-point Silk LTP quantiation wrapper */ |
| 173 /***********************************************/ | 173 /***********************************************/ |
| 174 void silk_quant_LTP_gains_FLP( | 174 void silk_quant_LTP_gains_FLP( |
| 175 silk_float B[ MAX_NB_SUBFR * LTP_ORDER ], /* I/O
(Un-)quantized LTP gains */ | 175 silk_float B[ MAX_NB_SUBFR * LTP_ORDER ], /* I/O
(Un-)quantized LTP gains */ |
| 176 opus_int8 cbk_index[ MAX_NB_SUBFR ], /* O
Codebook index */ | 176 opus_int8 cbk_index[ MAX_NB_SUBFR ], /* O
Codebook index */ |
| 177 opus_int8 *periodicity_index, /* O
Periodicity index */ | 177 opus_int8 *periodicity_index, /* O
Periodicity index */ |
| 178 opus_int32 *sum_log_gain_Q7, /* I/O
Cumulative max prediction gain */ | 178 opus_int32 *sum_log_gain_Q7, /* I/O
Cumulative max prediction gain */ |
| 179 const silk_float W[ MAX_NB_SUBFR * LTP_ORDER * LTP_ORDER ], /
* I Error weights */ | 179 const silk_float W[ MAX_NB_SUBFR * LTP_ORDER * LTP_ORDER ], /
* I Error weights */ |
| 180 const opus_int mu_Q10, /* I
Mu value (R/D tradeoff) */ | 180 const opus_int mu_Q10, /* I
Mu value (R/D tradeoff) */ |
| 181 const opus_int lowComplexity, /* I
Flag for low complexity */ | 181 const opus_int lowComplexity, /* I
Flag for low complexity */ |
| 182 const opus_int nb_subfr /* I
number of subframes */ | 182 const opus_int nb_subfr, /* I
number of subframes */ |
| 183 int arch /* I
Run-time architecture */ |
| 183 ) | 184 ) |
| 184 { | 185 { |
| 185 opus_int i; | 186 opus_int i; |
| 186 opus_int16 B_Q14[ MAX_NB_SUBFR * LTP_ORDER ]; | 187 opus_int16 B_Q14[ MAX_NB_SUBFR * LTP_ORDER ]; |
| 187 opus_int32 W_Q18[ MAX_NB_SUBFR*LTP_ORDER*LTP_ORDER ]; | 188 opus_int32 W_Q18[ MAX_NB_SUBFR*LTP_ORDER*LTP_ORDER ]; |
| 188 | 189 |
| 189 for( i = 0; i < nb_subfr * LTP_ORDER; i++ ) { | 190 for( i = 0; i < nb_subfr * LTP_ORDER; i++ ) { |
| 190 B_Q14[ i ] = (opus_int16)silk_float2int( B[ i ] * 16384.0f ); | 191 B_Q14[ i ] = (opus_int16)silk_float2int( B[ i ] * 16384.0f ); |
| 191 } | 192 } |
| 192 for( i = 0; i < nb_subfr * LTP_ORDER * LTP_ORDER; i++ ) { | 193 for( i = 0; i < nb_subfr * LTP_ORDER * LTP_ORDER; i++ ) { |
| 193 W_Q18[ i ] = (opus_int32)silk_float2int( W[ i ] * 262144.0f ); | 194 W_Q18[ i ] = (opus_int32)silk_float2int( W[ i ] * 262144.0f ); |
| 194 } | 195 } |
| 195 | 196 |
| 196 silk_quant_LTP_gains( B_Q14, cbk_index, periodicity_index, sum_log_gain_Q7,
W_Q18, mu_Q10, lowComplexity, nb_subfr ); | 197 silk_quant_LTP_gains( B_Q14, cbk_index, periodicity_index, sum_log_gain_Q7,
W_Q18, mu_Q10, lowComplexity, nb_subfr, arch ); |
| 197 | 198 |
| 198 for( i = 0; i < nb_subfr * LTP_ORDER; i++ ) { | 199 for( i = 0; i < nb_subfr * LTP_ORDER; i++ ) { |
| 199 B[ i ] = (silk_float)B_Q14[ i ] * ( 1.0f / 16384.0f ); | 200 B[ i ] = (silk_float)B_Q14[ i ] * ( 1.0f / 16384.0f ); |
| 200 } | 201 } |
| 201 } | 202 } |
| OLD | NEW |