| 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 20 matching lines...) Expand all Loading... |
| 31 #ifdef FIXED_POINT | 31 #ifdef FIXED_POINT |
| 32 #include "main_FIX.h" | 32 #include "main_FIX.h" |
| 33 #define silk_encoder_state_Fxx silk_encoder_state_FIX | 33 #define silk_encoder_state_Fxx silk_encoder_state_FIX |
| 34 #else | 34 #else |
| 35 #include "main_FLP.h" | 35 #include "main_FLP.h" |
| 36 #define silk_encoder_state_Fxx silk_encoder_state_FLP | 36 #define silk_encoder_state_Fxx silk_encoder_state_FLP |
| 37 #endif | 37 #endif |
| 38 #include "tuning_parameters.h" | 38 #include "tuning_parameters.h" |
| 39 #include "pitch_est_defines.h" | 39 #include "pitch_est_defines.h" |
| 40 | 40 |
| 41 opus_int silk_setup_resamplers( | 41 static opus_int silk_setup_resamplers( |
| 42 silk_encoder_state_Fxx *psEnc, /* I/O
*/ | 42 silk_encoder_state_Fxx *psEnc, /* I/O
*/ |
| 43 opus_int fs_kHz /* I
*/ | 43 opus_int fs_kHz /* I
*/ |
| 44 ); | 44 ); |
| 45 | 45 |
| 46 opus_int silk_setup_fs( | 46 static opus_int silk_setup_fs( |
| 47 silk_encoder_state_Fxx *psEnc, /* I/O
*/ | 47 silk_encoder_state_Fxx *psEnc, /* I/O
*/ |
| 48 opus_int fs_kHz, /* I
*/ | 48 opus_int fs_kHz, /* I
*/ |
| 49 opus_int PacketSize_ms /* I
*/ | 49 opus_int PacketSize_ms /* I
*/ |
| 50 ); | 50 ); |
| 51 | 51 |
| 52 opus_int silk_setup_complexity( | 52 static opus_int silk_setup_complexity( |
| 53 silk_encoder_state *psEncC, /* I/O
*/ | 53 silk_encoder_state *psEncC, /* I/O
*/ |
| 54 opus_int Complexity /* I
*/ | 54 opus_int Complexity /* I
*/ |
| 55 ); | 55 ); |
| 56 | 56 |
| 57 static inline opus_int silk_setup_LBRR( | 57 static inline opus_int silk_setup_LBRR( |
| 58 silk_encoder_state *psEncC, /* I/O
*/ | 58 silk_encoder_state *psEncC, /* I/O
*/ |
| 59 const opus_int32 TargetRate_bps /* I
*/ | 59 const opus_int32 TargetRate_bps /* I
*/ |
| 60 ); | 60 ); |
| 61 | 61 |
| 62 | 62 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 /********************************************/ | 124 /********************************************/ |
| 125 /* Set LBRR usage */ | 125 /* Set LBRR usage */ |
| 126 /********************************************/ | 126 /********************************************/ |
| 127 ret += silk_setup_LBRR( &psEnc->sCmn, TargetRate_bps ); | 127 ret += silk_setup_LBRR( &psEnc->sCmn, TargetRate_bps ); |
| 128 | 128 |
| 129 psEnc->sCmn.controlled_since_last_payload = 1; | 129 psEnc->sCmn.controlled_since_last_payload = 1; |
| 130 | 130 |
| 131 return ret; | 131 return ret; |
| 132 } | 132 } |
| 133 | 133 |
| 134 opus_int silk_setup_resamplers( | 134 static opus_int silk_setup_resamplers( |
| 135 silk_encoder_state_Fxx *psEnc, /* I/O
*/ | 135 silk_encoder_state_Fxx *psEnc, /* I/O
*/ |
| 136 opus_int fs_kHz /* I
*/ | 136 opus_int fs_kHz /* I
*/ |
| 137 ) | 137 ) |
| 138 { | 138 { |
| 139 opus_int ret = SILK_NO_ERROR; | 139 opus_int ret = SILK_NO_ERROR; |
| 140 opus_int32 nSamples_temp; | 140 opus_int32 nSamples_temp; |
| 141 | 141 |
| 142 if( psEnc->sCmn.fs_kHz != fs_kHz || psEnc->sCmn.prev_API_fs_Hz != psEnc->sCm
n.API_fs_Hz ) | 142 if( psEnc->sCmn.fs_kHz != fs_kHz || psEnc->sCmn.prev_API_fs_Hz != psEnc->sCm
n.API_fs_Hz ) |
| 143 { | 143 { |
| 144 if( psEnc->sCmn.fs_kHz == 0 ) { | 144 if( psEnc->sCmn.fs_kHz == 0 ) { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 silk_short2float_array( psEnc->x_buf, x_bufFIX, ( 2 * MAX_FRAME_LENG
TH_MS + LA_SHAPE_MS ) * fs_kHz ); | 179 silk_short2float_array( psEnc->x_buf, x_bufFIX, ( 2 * MAX_FRAME_LENG
TH_MS + LA_SHAPE_MS ) * fs_kHz ); |
| 180 #endif | 180 #endif |
| 181 } | 181 } |
| 182 } | 182 } |
| 183 | 183 |
| 184 psEnc->sCmn.prev_API_fs_Hz = psEnc->sCmn.API_fs_Hz; | 184 psEnc->sCmn.prev_API_fs_Hz = psEnc->sCmn.API_fs_Hz; |
| 185 | 185 |
| 186 return ret; | 186 return ret; |
| 187 } | 187 } |
| 188 | 188 |
| 189 opus_int silk_setup_fs( | 189 static opus_int silk_setup_fs( |
| 190 silk_encoder_state_Fxx *psEnc, /* I/O
*/ | 190 silk_encoder_state_Fxx *psEnc, /* I/O
*/ |
| 191 opus_int fs_kHz, /* I
*/ | 191 opus_int fs_kHz, /* I
*/ |
| 192 opus_int PacketSize_ms /* I
*/ | 192 opus_int PacketSize_ms /* I
*/ |
| 193 ) | 193 ) |
| 194 { | 194 { |
| 195 opus_int ret = SILK_NO_ERROR; | 195 opus_int ret = SILK_NO_ERROR; |
| 196 | 196 |
| 197 /* Set packet size */ | 197 /* Set packet size */ |
| 198 if( PacketSize_ms != psEnc->sCmn.PacketSize_ms ) { | 198 if( PacketSize_ms != psEnc->sCmn.PacketSize_ms ) { |
| 199 if( ( PacketSize_ms != 10 ) && | 199 if( ( PacketSize_ms != 10 ) && |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 psEnc->sCmn.pitch_lag_low_bits_iCDF = silk_uniform4_iCDF; | 292 psEnc->sCmn.pitch_lag_low_bits_iCDF = silk_uniform4_iCDF; |
| 293 } | 293 } |
| 294 } | 294 } |
| 295 | 295 |
| 296 /* Check that settings are valid */ | 296 /* Check that settings are valid */ |
| 297 silk_assert( ( psEnc->sCmn.subfr_length * psEnc->sCmn.nb_subfr ) == psEnc->s
Cmn.frame_length ); | 297 silk_assert( ( psEnc->sCmn.subfr_length * psEnc->sCmn.nb_subfr ) == psEnc->s
Cmn.frame_length ); |
| 298 | 298 |
| 299 return ret; | 299 return ret; |
| 300 } | 300 } |
| 301 | 301 |
| 302 opus_int silk_setup_complexity( | 302 static opus_int silk_setup_complexity( |
| 303 silk_encoder_state *psEncC, /* I/O
*/ | 303 silk_encoder_state *psEncC, /* I/O
*/ |
| 304 opus_int Complexity /* I
*/ | 304 opus_int Complexity /* I
*/ |
| 305 ) | 305 ) |
| 306 { | 306 { |
| 307 opus_int ret = 0; | 307 opus_int ret = 0; |
| 308 | 308 |
| 309 /* Set encoding complexity */ | 309 /* Set encoding complexity */ |
| 310 silk_assert( Complexity >= 0 && Complexity <= 10 ); | 310 silk_assert( Complexity >= 0 && Complexity <= 10 ); |
| 311 if( Complexity < 2 ) { | 311 if( Complexity < 2 ) { |
| 312 psEncC->pitchEstimationComplexity = SILK_PE_MIN_COMPLEX; | 312 psEncC->pitchEstimationComplexity = SILK_PE_MIN_COMPLEX; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 | 402 |
| 403 if( TargetRate_bps > LBRR_rate_thres_bps ) { | 403 if( TargetRate_bps > LBRR_rate_thres_bps ) { |
| 404 /* Set gain increase for coding LBRR excitation */ | 404 /* Set gain increase for coding LBRR excitation */ |
| 405 psEncC->LBRR_enabled = 1; | 405 psEncC->LBRR_enabled = 1; |
| 406 psEncC->LBRR_GainIncreases = silk_max_int( 7 - silk_SMULWB( (opus_in
t32)psEncC->PacketLoss_perc, SILK_FIX_CONST( 0.4, 16 ) ), 2 ); | 406 psEncC->LBRR_GainIncreases = silk_max_int( 7 - silk_SMULWB( (opus_in
t32)psEncC->PacketLoss_perc, SILK_FIX_CONST( 0.4, 16 ) ), 2 ); |
| 407 } | 407 } |
| 408 } | 408 } |
| 409 | 409 |
| 410 return ret; | 410 return ret; |
| 411 } | 411 } |
| OLD | NEW |