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

Side by Side Diff: third_party/opus/src/silk/CNG.c

Issue 2349213003: Opus: Fixes overflow in CNG (Closed)
Patch Set: Rebasing Created 4 years, 3 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
« no previous file with comments | « third_party/opus/README.chromium ('k') | no next file » | 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 if( psDec->LPC_order == 16 ) { 163 if( psDec->LPC_order == 16 ) {
164 LPC_pred_Q10 = silk_SMLAWB( LPC_pred_Q10, CNG_sig_Q14[ MAX_LPC_O RDER + i - 11 ], A_Q12[ 10 ] ); 164 LPC_pred_Q10 = silk_SMLAWB( LPC_pred_Q10, CNG_sig_Q14[ MAX_LPC_O RDER + i - 11 ], A_Q12[ 10 ] );
165 LPC_pred_Q10 = silk_SMLAWB( LPC_pred_Q10, CNG_sig_Q14[ MAX_LPC_O RDER + i - 12 ], A_Q12[ 11 ] ); 165 LPC_pred_Q10 = silk_SMLAWB( LPC_pred_Q10, CNG_sig_Q14[ MAX_LPC_O RDER + i - 12 ], A_Q12[ 11 ] );
166 LPC_pred_Q10 = silk_SMLAWB( LPC_pred_Q10, CNG_sig_Q14[ MAX_LPC_O RDER + i - 13 ], A_Q12[ 12 ] ); 166 LPC_pred_Q10 = silk_SMLAWB( LPC_pred_Q10, CNG_sig_Q14[ MAX_LPC_O RDER + i - 13 ], A_Q12[ 12 ] );
167 LPC_pred_Q10 = silk_SMLAWB( LPC_pred_Q10, CNG_sig_Q14[ MAX_LPC_O RDER + i - 14 ], A_Q12[ 13 ] ); 167 LPC_pred_Q10 = silk_SMLAWB( LPC_pred_Q10, CNG_sig_Q14[ MAX_LPC_O RDER + i - 14 ], A_Q12[ 13 ] );
168 LPC_pred_Q10 = silk_SMLAWB( LPC_pred_Q10, CNG_sig_Q14[ MAX_LPC_O RDER + i - 15 ], A_Q12[ 14 ] ); 168 LPC_pred_Q10 = silk_SMLAWB( LPC_pred_Q10, CNG_sig_Q14[ MAX_LPC_O RDER + i - 15 ], A_Q12[ 14 ] );
169 LPC_pred_Q10 = silk_SMLAWB( LPC_pred_Q10, CNG_sig_Q14[ MAX_LPC_O RDER + i - 16 ], A_Q12[ 15 ] ); 169 LPC_pred_Q10 = silk_SMLAWB( LPC_pred_Q10, CNG_sig_Q14[ MAX_LPC_O RDER + i - 16 ], A_Q12[ 15 ] );
170 } 170 }
171 171
172 /* Update states */ 172 /* Update states */
173 CNG_sig_Q14[ MAX_LPC_ORDER + i ] = silk_ADD_LSHIFT( CNG_sig_Q14[ MAX _LPC_ORDER + i ], LPC_pred_Q10, 4 ); 173 CNG_sig_Q14[ MAX_LPC_ORDER + i ] = silk_ADD_SAT32( CNG_sig_Q14[ MAX_ LPC_ORDER + i ], silk_LSHIFT_SAT32( LPC_pred_Q10, 4 ) );
174 174
175 /* Scale with Gain and add to input signal */ 175 /* Scale with Gain and add to input signal */
176 frame[ i ] = (opus_int16)silk_ADD_SAT16( frame[ i ], silk_SAT16( sil k_RSHIFT_ROUND( silk_SMULWW( CNG_sig_Q14[ MAX_LPC_ORDER + i ], gain_Q10 ), 8 ) ) ); 176 frame[ i ] = (opus_int16)silk_ADD_SAT16( frame[ i ], silk_SAT16( sil k_RSHIFT_ROUND( silk_SMULWW( CNG_sig_Q14[ MAX_LPC_ORDER + i ], gain_Q10 ), 8 ) ) );
177 177
178 } 178 }
179 silk_memcpy( psCNG->CNG_synth_state, &CNG_sig_Q14[ length ], MAX_LPC_ORD ER * sizeof( opus_int32 ) ); 179 silk_memcpy( psCNG->CNG_synth_state, &CNG_sig_Q14[ length ], MAX_LPC_ORD ER * sizeof( opus_int32 ) );
180 } else { 180 } else {
181 silk_memset( psCNG->CNG_synth_state, 0, psDec->LPC_order * sizeof( opus _int32 ) ); 181 silk_memset( psCNG->CNG_synth_state, 0, psDec->LPC_order * sizeof( opus _int32 ) );
182 } 182 }
183 RESTORE_STACK; 183 RESTORE_STACK;
184 } 184 }
OLDNEW
« no previous file with comments | « third_party/opus/README.chromium ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698