Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: silk/PLC.c

Issue 12388030: Update Opus to 1.0.2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/opus
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « silk/NLSF_stabilize.c ('k') | silk/SigProc_FIX.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 12 matching lines...) Expand all
23 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 POSSIBILITY OF SUCH DAMAGE. 25 POSSIBILITY OF SUCH DAMAGE.
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.h" 32 #include "main.h"
33 #include "stack_alloc.h"
33 #include "PLC.h" 34 #include "PLC.h"
34 35
35 #define NB_ATT 2 36 #define NB_ATT 2
36 static const opus_int16 HARM_ATT_Q15[NB_ATT] = { 32440, 31130 }; /* 0.99, 0.95 */ 37 static const opus_int16 HARM_ATT_Q15[NB_ATT] = { 32440, 31130 }; /* 0.99, 0.95 */
37 static const opus_int16 PLC_RAND_ATTENUATE_V_Q15[NB_ATT] = { 31130, 26214 }; /* 0.95, 0.8 */ 38 static const opus_int16 PLC_RAND_ATTENUATE_V_Q15[NB_ATT] = { 31130, 26214 }; /* 0.95, 0.8 */
38 static const opus_int16 PLC_RAND_ATTENUATE_UV_Q15[NB_ATT] = { 32440, 29491 }; /* 0.99, 0.9 */ 39 static const opus_int16 PLC_RAND_ATTENUATE_UV_Q15[NB_ATT] = { 32440, 29491 }; /* 0.99, 0.9 */
39 40
40 static inline void silk_PLC_update( 41 static inline void silk_PLC_update(
41 silk_decoder_state *psDec, /* I/O Decoder state */ 42 silk_decoder_state *psDec, /* I/O Decoder state */
42 silk_decoder_control *psDecCtrl /* I/O Decoder contr ol */ 43 silk_decoder_control *psDecCtrl /* I/O Decoder contr ol */
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 ) 172 )
172 { 173 {
173 opus_int i, j, k; 174 opus_int i, j, k;
174 opus_int lag, idx, sLTP_buf_idx, shift1, shift2; 175 opus_int lag, idx, sLTP_buf_idx, shift1, shift2;
175 opus_int32 rand_seed, harm_Gain_Q15, rand_Gain_Q15, inv_gain_Q30; 176 opus_int32 rand_seed, harm_Gain_Q15, rand_Gain_Q15, inv_gain_Q30;
176 opus_int32 energy1, energy2, *rand_ptr, *pred_lag_ptr; 177 opus_int32 energy1, energy2, *rand_ptr, *pred_lag_ptr;
177 opus_int32 LPC_pred_Q10, LTP_pred_Q12; 178 opus_int32 LPC_pred_Q10, LTP_pred_Q12;
178 opus_int16 rand_scale_Q14; 179 opus_int16 rand_scale_Q14;
179 opus_int16 *B_Q14, *exc_buf_ptr; 180 opus_int16 *B_Q14, *exc_buf_ptr;
180 opus_int32 *sLPC_Q14_ptr; 181 opus_int32 *sLPC_Q14_ptr;
181 opus_int16 exc_buf[ 2 * MAX_SUB_FRAME_LENGTH ]; 182 VARDECL( opus_int16, exc_buf );
182 opus_int16 A_Q12[ MAX_LPC_ORDER ]; 183 opus_int16 A_Q12[ MAX_LPC_ORDER ];
183 opus_int16 sLTP[ MAX_FRAME_LENGTH ]; 184 VARDECL( opus_int16, sLTP );
184 opus_int32 sLTP_Q14[ 2 * MAX_FRAME_LENGTH ]; 185 VARDECL( opus_int32, sLTP_Q14 );
185 silk_PLC_struct *psPLC = &psDec->sPLC; 186 silk_PLC_struct *psPLC = &psDec->sPLC;
186 opus_int32 prevGain_Q10[2]; 187 opus_int32 prevGain_Q10[2];
188 SAVE_STACK;
189
190 ALLOC( exc_buf, 2*psPLC->subfr_length, opus_int16 );
191 ALLOC( sLTP, psDec->ltp_mem_length, opus_int16 );
192 ALLOC( sLTP_Q14, psDec->ltp_mem_length + psDec->frame_length, opus_int32 );
187 193
188 prevGain_Q10[0] = silk_RSHIFT( psPLC->prevGain_Q16[ 0 ], 6); 194 prevGain_Q10[0] = silk_RSHIFT( psPLC->prevGain_Q16[ 0 ], 6);
189 prevGain_Q10[1] = silk_RSHIFT( psPLC->prevGain_Q16[ 1 ], 6); 195 prevGain_Q10[1] = silk_RSHIFT( psPLC->prevGain_Q16[ 1 ], 6);
190 196
191 if( psDec->first_frame_after_reset ) { 197 if( psDec->first_frame_after_reset ) {
192 silk_memset( psPLC->prevLPC_Q12, 0, sizeof( psPLC->prevLPC_Q12 ) ); 198 silk_memset( psPLC->prevLPC_Q12, 0, sizeof( psPLC->prevLPC_Q12 ) );
193 } 199 }
194 200
195 /* Find random noise component */ 201 /* Find random noise component */
196 /* Scale previous excitation signal */ 202 /* Scale previous excitation signal */
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 silk_memcpy( psDec->sLPC_Q14_buf, &sLPC_Q14_ptr[ psDec->frame_length ], MAX_ LPC_ORDER * sizeof( opus_int32 ) ); 353 silk_memcpy( psDec->sLPC_Q14_buf, &sLPC_Q14_ptr[ psDec->frame_length ], MAX_ LPC_ORDER * sizeof( opus_int32 ) );
348 354
349 /**************************************/ 355 /**************************************/
350 /* Update states */ 356 /* Update states */
351 /**************************************/ 357 /**************************************/
352 psPLC->rand_seed = rand_seed; 358 psPLC->rand_seed = rand_seed;
353 psPLC->randScale_Q14 = rand_scale_Q14; 359 psPLC->randScale_Q14 = rand_scale_Q14;
354 for( i = 0; i < MAX_NB_SUBFR; i++ ) { 360 for( i = 0; i < MAX_NB_SUBFR; i++ ) {
355 psDecCtrl->pitchL[ i ] = lag; 361 psDecCtrl->pitchL[ i ] = lag;
356 } 362 }
363 RESTORE_STACK;
357 } 364 }
358 365
359 /* Glues concealed frames with new good recieved frames */ 366 /* Glues concealed frames with new good received frames */
360 void silk_PLC_glue_frames( 367 void silk_PLC_glue_frames(
361 silk_decoder_state *psDec, /* I/O decoder state */ 368 silk_decoder_state *psDec, /* I/O decoder state */
362 opus_int16 frame[], /* I/O signal */ 369 opus_int16 frame[], /* I/O signal */
363 opus_int length /* I length of signa l */ 370 opus_int length /* I length of signa l */
364 ) 371 )
365 { 372 {
366 opus_int i, energy_shift; 373 opus_int i, energy_shift;
367 opus_int32 energy; 374 opus_int32 energy;
368 silk_PLC_struct *psPLC; 375 silk_PLC_struct *psPLC;
369 psPLC = &psDec->sPLC; 376 psPLC = &psDec->sPLC;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 gain_Q16 += slope_Q16; 414 gain_Q16 += slope_Q16;
408 if( gain_Q16 > (opus_int32)1 << 16 ) { 415 if( gain_Q16 > (opus_int32)1 << 16 ) {
409 break; 416 break;
410 } 417 }
411 } 418 }
412 } 419 }
413 } 420 }
414 psPLC->last_frame_lost = 0; 421 psPLC->last_frame_lost = 0;
415 } 422 }
416 } 423 }
OLDNEW
« no previous file with comments | « silk/NLSF_stabilize.c ('k') | silk/SigProc_FIX.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698