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

Side by Side Diff: silk/fixed/burg_modified_FIX.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/fixed/LTP_analysis_filter_FIX.c ('k') | silk/fixed/find_pitch_lags_FIX.c » ('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 29 matching lines...) Expand all
40 #define MIN_RSHIFTS -16 40 #define MIN_RSHIFTS -16
41 #define MAX_RSHIFTS (32 - QA) 41 #define MAX_RSHIFTS (32 - QA)
42 42
43 /* Compute reflection coefficients from input signal */ 43 /* Compute reflection coefficients from input signal */
44 void silk_burg_modified( 44 void silk_burg_modified(
45 opus_int32 *res_nrg, /* O Residual energy */ 45 opus_int32 *res_nrg, /* O Residual energy */
46 opus_int *res_nrg_Q, /* O Residual energy Q va lue */ 46 opus_int *res_nrg_Q, /* O Residual energy Q va lue */
47 opus_int32 A_Q16[], /* O Prediction coefficie nts (length order) */ 47 opus_int32 A_Q16[], /* O Prediction coefficie nts (length order) */
48 const opus_int16 x[], /* I Input signal, length : nb_subfr * ( D + subfr_length ) */ 48 const opus_int16 x[], /* I Input signal, length : nb_subfr * ( D + subfr_length ) */
49 const opus_int32 minInvGain_Q30, /* I Inverse of max predi ction gain */ 49 const opus_int32 minInvGain_Q30, /* I Inverse of max predi ction gain */
50 const opus_int subfr_length, /* I Input signal subfram e length (incl. D preceeding samples) */ 50 const opus_int subfr_length, /* I Input signal subfram e length (incl. D preceding samples) */
51 const opus_int nb_subfr, /* I Number of subframes stacked in x */ 51 const opus_int nb_subfr, /* I Number of subframes stacked in x */
52 const opus_int D /* I Order */ 52 const opus_int D /* I Order */
53 ) 53 )
54 { 54 {
55 opus_int k, n, s, lz, rshifts, rshifts_extra, reached_max_gain; 55 opus_int k, n, s, lz, rshifts, rshifts_extra, reached_max_gain;
56 opus_int32 C0, num, nrg, rc_Q31, invGain_Q30, Atmp_QA, Atmp1, tmp1, tm p2, x1, x2; 56 opus_int32 C0, num, nrg, rc_Q31, invGain_Q30, Atmp_QA, Atmp1, tmp1, tm p2, x1, x2;
57 const opus_int16 *x_ptr; 57 const opus_int16 *x_ptr;
58 opus_int32 C_first_row[ SILK_MAX_ORDER_LPC ]; 58 opus_int32 C_first_row[ SILK_MAX_ORDER_LPC ];
59 opus_int32 C_last_row[ SILK_MAX_ORDER_LPC ]; 59 opus_int32 C_last_row[ SILK_MAX_ORDER_LPC ];
60 opus_int32 Af_QA[ SILK_MAX_ORDER_LPC ]; 60 opus_int32 Af_QA[ SILK_MAX_ORDER_LPC ];
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 CAf[ k ] = silk_ADD_LSHIFT32( tmp1, silk_SMMUL( tmp2, rc_Q31 ), 1 ); /* Q( -rshifts ) */ 231 CAf[ k ] = silk_ADD_LSHIFT32( tmp1, silk_SMMUL( tmp2, rc_Q31 ), 1 ); /* Q( -rshifts ) */
232 CAb[ n - k + 1 ] = silk_ADD_LSHIFT32( tmp2, silk_SMMUL( tmp1, rc_Q31 ), 1 ); /* Q( -rshifts ) */ 232 CAb[ n - k + 1 ] = silk_ADD_LSHIFT32( tmp2, silk_SMMUL( tmp1, rc_Q31 ), 1 ); /* Q( -rshifts ) */
233 } 233 }
234 } 234 }
235 235
236 if( reached_max_gain ) { 236 if( reached_max_gain ) {
237 for( k = 0; k < D; k++ ) { 237 for( k = 0; k < D; k++ ) {
238 /* Scale coefficients */ 238 /* Scale coefficients */
239 A_Q16[ k ] = -silk_RSHIFT_ROUND( Af_QA[ k ], QA - 16 ); 239 A_Q16[ k ] = -silk_RSHIFT_ROUND( Af_QA[ k ], QA - 16 );
240 } 240 }
241 /* Subtract energy of preceeding samples from C0 */ 241 /* Subtract energy of preceding samples from C0 */
242 if( rshifts > 0 ) { 242 if( rshifts > 0 ) {
243 for( s = 0; s < nb_subfr; s++ ) { 243 for( s = 0; s < nb_subfr; s++ ) {
244 x_ptr = x + s * subfr_length; 244 x_ptr = x + s * subfr_length;
245 C0 -= (opus_int32)silk_RSHIFT64( silk_inner_prod16_aligned_64( x _ptr, x_ptr, D ), rshifts ); 245 C0 -= (opus_int32)silk_RSHIFT64( silk_inner_prod16_aligned_64( x _ptr, x_ptr, D ), rshifts );
246 } 246 }
247 } else { 247 } else {
248 for( s = 0; s < nb_subfr; s++ ) { 248 for( s = 0; s < nb_subfr; s++ ) {
249 x_ptr = x + s * subfr_length; 249 x_ptr = x + s * subfr_length;
250 C0 -= silk_LSHIFT32( silk_inner_prod_aligned( x_ptr, x_ptr, D ), -rshifts ); 250 C0 -= silk_LSHIFT32( silk_inner_prod_aligned( x_ptr, x_ptr, D ), -rshifts );
251 } 251 }
252 } 252 }
253 /* Approximate residual energy */ 253 /* Approximate residual energy */
254 *res_nrg = silk_LSHIFT( silk_SMMUL( invGain_Q30, C0 ), 2 ); 254 *res_nrg = silk_LSHIFT( silk_SMMUL( invGain_Q30, C0 ), 2 );
255 *res_nrg_Q = -rshifts; 255 *res_nrg_Q = -rshifts;
256 } else { 256 } else {
257 /* Return residual energy */ 257 /* Return residual energy */
258 nrg = CAf[ 0 ]; /* Q( -rshifts ) */ 258 nrg = CAf[ 0 ]; /* Q( -rshifts ) */
259 tmp1 = (opus_int32)1 << 16; /* Q16 */ 259 tmp1 = (opus_int32)1 << 16; /* Q16 */
260 for( k = 0; k < D; k++ ) { 260 for( k = 0; k < D; k++ ) {
261 Atmp1 = silk_RSHIFT_ROUND( Af_QA[ k ], QA - 16 ); /* Q16 */ 261 Atmp1 = silk_RSHIFT_ROUND( Af_QA[ k ], QA - 16 ); /* Q16 */
262 nrg = silk_SMLAWW( nrg, CAf[ k + 1 ], Atmp1 ); /* Q( -rshifts ) */ 262 nrg = silk_SMLAWW( nrg, CAf[ k + 1 ], Atmp1 ); /* Q( -rshifts ) */
263 tmp1 = silk_SMLAWW( tmp1, Atmp1, Atmp1 ); /* Q16 */ 263 tmp1 = silk_SMLAWW( tmp1, Atmp1, Atmp1 ); /* Q16 */
264 A_Q16[ k ] = -Atmp1; 264 A_Q16[ k ] = -Atmp1;
265 } 265 }
266 *res_nrg = silk_SMLAWW( nrg, silk_SMMUL( FIND_LPC_COND_FAC, C0 ), -tmp1 ); /* Q( -rshifts ) */ 266 *res_nrg = silk_SMLAWW( nrg, silk_SMMUL( FIND_LPC_COND_FAC, C0 ), -tmp1 ); /* Q( -rshifts ) */
267 *res_nrg_Q = -rshifts; 267 *res_nrg_Q = -rshifts;
268 } 268 }
269 } 269 }
OLDNEW
« no previous file with comments | « silk/fixed/LTP_analysis_filter_FIX.c ('k') | silk/fixed/find_pitch_lags_FIX.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698