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 15 matching lines...) Expand all Loading... |
26 ***********************************************************************/ | 26 ***********************************************************************/ |
27 | 27 |
28 #ifdef HAVE_CONFIG_H | 28 #ifdef HAVE_CONFIG_H |
29 #include "config.h" | 29 #include "config.h" |
30 #endif | 30 #endif |
31 | 31 |
32 #include "main_FLP.h" | 32 #include "main_FLP.h" |
33 #include "tuning_parameters.h" | 33 #include "tuning_parameters.h" |
34 | 34 |
35 /* Low Bitrate Redundancy (LBRR) encoding. Reuse all parameters but encode with
lower bitrate */ | 35 /* Low Bitrate Redundancy (LBRR) encoding. Reuse all parameters but encode with
lower bitrate */ |
36 static inline void silk_LBRR_encode_FLP( | 36 static OPUS_INLINE void silk_LBRR_encode_FLP( |
37 silk_encoder_state_FLP *psEnc, /* I/O
Encoder state FLP */ | 37 silk_encoder_state_FLP *psEnc, /* I/O
Encoder state FLP */ |
38 silk_encoder_control_FLP *psEncCtrl, /* I/O
Encoder control FLP */ | 38 silk_encoder_control_FLP *psEncCtrl, /* I/O
Encoder control FLP */ |
39 const silk_float xfw[], /* I
Input signal */ | 39 const silk_float xfw[], /* I
Input signal */ |
40 opus_int condCoding /* I
The type of conditional coding used so far for this frame */ | 40 opus_int condCoding /* I
The type of conditional coding used so far for this frame */ |
41 ); | 41 ); |
42 | 42 |
43 void silk_encode_do_VAD_FLP( | 43 void silk_encode_do_VAD_FLP( |
44 silk_encoder_state_FLP *psEnc /* I/O
Encoder state FLP */ | 44 silk_encoder_state_FLP *psEnc /* I/O
Encoder state FLP */ |
45 ) | 45 ) |
46 { | 46 { |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 | 122 |
123 /* Add tiny signal to avoid high CPU load from denormalized floating point n
umbers */ | 123 /* Add tiny signal to avoid high CPU load from denormalized floating point n
umbers */ |
124 for( i = 0; i < 8; i++ ) { | 124 for( i = 0; i < 8; i++ ) { |
125 x_frame[ LA_SHAPE_MS * psEnc->sCmn.fs_kHz + i * ( psEnc->sCmn.frame_leng
th >> 3 ) ] += ( 1 - ( i & 2 ) ) * 1e-6f; | 125 x_frame[ LA_SHAPE_MS * psEnc->sCmn.fs_kHz + i * ( psEnc->sCmn.frame_leng
th >> 3 ) ] += ( 1 - ( i & 2 ) ) * 1e-6f; |
126 } | 126 } |
127 | 127 |
128 if( !psEnc->sCmn.prefillFlag ) { | 128 if( !psEnc->sCmn.prefillFlag ) { |
129 /*****************************************/ | 129 /*****************************************/ |
130 /* Find pitch lags, initial LPC analysis */ | 130 /* Find pitch lags, initial LPC analysis */ |
131 /*****************************************/ | 131 /*****************************************/ |
132 silk_find_pitch_lags_FLP( psEnc, &sEncCtrl, res_pitch, x_frame ); | 132 silk_find_pitch_lags_FLP( psEnc, &sEncCtrl, res_pitch, x_frame, psEnc->s
Cmn.arch ); |
133 | 133 |
134 /************************/ | 134 /************************/ |
135 /* Noise shape analysis */ | 135 /* Noise shape analysis */ |
136 /************************/ | 136 /************************/ |
137 silk_noise_shape_analysis_FLP( psEnc, &sEncCtrl, res_pitch_frame, x_fram
e ); | 137 silk_noise_shape_analysis_FLP( psEnc, &sEncCtrl, res_pitch_frame, x_fram
e ); |
138 | 138 |
139 /***************************************************/ | 139 /***************************************************/ |
140 /* Find linear prediction coefficients (LPC + LTP) */ | 140 /* Find linear prediction coefficients (LPC + LTP) */ |
141 /***************************************************/ | 141 /***************************************************/ |
142 silk_find_pred_coefs_FLP( psEnc, &sEncCtrl, res_pitch, x_frame, condCodi
ng ); | 142 silk_find_pred_coefs_FLP( psEnc, &sEncCtrl, res_pitch, x_frame, condCodi
ng ); |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 for( i = 0; i < psEnc->sCmn.nb_subfr; i++ ) { | 287 for( i = 0; i < psEnc->sCmn.nb_subfr; i++ ) { |
288 sEncCtrl.Gains[ i ] = pGains_Q16[ i ] / 65536.0f; | 288 sEncCtrl.Gains[ i ] = pGains_Q16[ i ] / 65536.0f; |
289 } | 289 } |
290 } | 290 } |
291 } | 291 } |
292 | 292 |
293 /* Update input buffer */ | 293 /* Update input buffer */ |
294 silk_memmove( psEnc->x_buf, &psEnc->x_buf[ psEnc->sCmn.frame_length ], | 294 silk_memmove( psEnc->x_buf, &psEnc->x_buf[ psEnc->sCmn.frame_length ], |
295 ( psEnc->sCmn.ltp_mem_length + LA_SHAPE_MS * psEnc->sCmn.fs_kHz ) * size
of( silk_float ) ); | 295 ( psEnc->sCmn.ltp_mem_length + LA_SHAPE_MS * psEnc->sCmn.fs_kHz ) * size
of( silk_float ) ); |
296 | 296 |
297 /* Parameters needed for next frame */ | |
298 psEnc->sCmn.prevLag = sEncCtrl.pitchL[ psEnc->sCmn.nb_subfr - 1 ]; | |
299 psEnc->sCmn.prevSignalType = psEnc->sCmn.indices.signalType; | |
300 | |
301 /* Exit without entropy coding */ | 297 /* Exit without entropy coding */ |
302 if( psEnc->sCmn.prefillFlag ) { | 298 if( psEnc->sCmn.prefillFlag ) { |
303 /* No payload */ | 299 /* No payload */ |
304 *pnBytesOut = 0; | 300 *pnBytesOut = 0; |
305 return ret; | 301 return ret; |
306 } | 302 } |
307 | 303 |
| 304 /* Parameters needed for next frame */ |
| 305 psEnc->sCmn.prevLag = sEncCtrl.pitchL[ psEnc->sCmn.nb_subfr - 1 ]; |
| 306 psEnc->sCmn.prevSignalType = psEnc->sCmn.indices.signalType; |
| 307 |
308 /****************************************/ | 308 /****************************************/ |
309 /* Finalize payload */ | 309 /* Finalize payload */ |
310 /****************************************/ | 310 /****************************************/ |
311 psEnc->sCmn.first_frame_after_reset = 0; | 311 psEnc->sCmn.first_frame_after_reset = 0; |
312 /* Payload size */ | 312 /* Payload size */ |
313 *pnBytesOut = silk_RSHIFT( ec_tell( psRangeEnc ) + 7, 3 ); | 313 *pnBytesOut = silk_RSHIFT( ec_tell( psRangeEnc ) + 7, 3 ); |
314 | 314 |
315 return ret; | 315 return ret; |
316 } | 316 } |
317 | 317 |
318 /* Low-Bitrate Redundancy (LBRR) encoding. Reuse all parameters but encode excit
ation at lower bitrate */ | 318 /* Low-Bitrate Redundancy (LBRR) encoding. Reuse all parameters but encode excit
ation at lower bitrate */ |
319 static inline void silk_LBRR_encode_FLP( | 319 static OPUS_INLINE void silk_LBRR_encode_FLP( |
320 silk_encoder_state_FLP *psEnc, /* I/O
Encoder state FLP */ | 320 silk_encoder_state_FLP *psEnc, /* I/O
Encoder state FLP */ |
321 silk_encoder_control_FLP *psEncCtrl, /* I/O
Encoder control FLP */ | 321 silk_encoder_control_FLP *psEncCtrl, /* I/O
Encoder control FLP */ |
322 const silk_float xfw[], /* I
Input signal */ | 322 const silk_float xfw[], /* I
Input signal */ |
323 opus_int condCoding /* I
The type of conditional coding used so far for this frame */ | 323 opus_int condCoding /* I
The type of conditional coding used so far for this frame */ |
324 ) | 324 ) |
325 { | 325 { |
326 opus_int k; | 326 opus_int k; |
327 opus_int32 Gains_Q16[ MAX_NB_SUBFR ]; | 327 opus_int32 Gains_Q16[ MAX_NB_SUBFR ]; |
328 silk_float TempGains[ MAX_NB_SUBFR ]; | 328 silk_float TempGains[ MAX_NB_SUBFR ]; |
329 SideInfoIndices *psIndices_LBRR = &psEnc->sCmn.indices_LBRR[ psEnc->sCmn.nFr
amesEncoded ]; | 329 SideInfoIndices *psIndices_LBRR = &psEnc->sCmn.indices_LBRR[ psEnc->sCmn.nFr
amesEncoded ]; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 /*****************************************/ | 363 /*****************************************/ |
364 /* Noise shaping quantization */ | 364 /* Noise shaping quantization */ |
365 /*****************************************/ | 365 /*****************************************/ |
366 silk_NSQ_wrapper_FLP( psEnc, psEncCtrl, psIndices_LBRR, &sNSQ_LBRR, | 366 silk_NSQ_wrapper_FLP( psEnc, psEncCtrl, psIndices_LBRR, &sNSQ_LBRR, |
367 psEnc->sCmn.pulses_LBRR[ psEnc->sCmn.nFramesEncoded ], xfw ); | 367 psEnc->sCmn.pulses_LBRR[ psEnc->sCmn.nFramesEncoded ], xfw ); |
368 | 368 |
369 /* Restore original gains */ | 369 /* Restore original gains */ |
370 silk_memcpy( psEncCtrl->Gains, TempGains, psEnc->sCmn.nb_subfr * sizeof(
silk_float ) ); | 370 silk_memcpy( psEncCtrl->Gains, TempGains, psEnc->sCmn.nb_subfr * sizeof(
silk_float ) ); |
371 } | 371 } |
372 } | 372 } |
OLD | NEW |