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

Side by Side Diff: silk/CNG.c

Issue 28553003: Updating Opus to a pre-release of 1.1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/opus
Patch Set: Removing failing file Created 7 years, 1 month 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/API.h ('k') | silk/HP_variable_cutoff.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.
11 - Neither the name of Internet Society, IETF or IETF Trust, nor the 11 - Neither the name of Internet Society, IETF or IETF Trust, nor the
12 names of specific contributors, may be used to endorse or promote 12 names of specific contributors, may be used to endorse or promote
13 products derived from this software without specific prior written 13 products derived from this software without specific prior written
14 permission. 14 permission.
15 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS 15 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 18 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
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 34
34 /* Generates excitation for CNG LPC synthesis */ 35 /* Generates excitation for CNG LPC synthesis */
35 static inline void silk_CNG_exc( 36 static inline void silk_CNG_exc(
36 opus_int32 residual_Q10[], /* O CNG residual si gnal Q10 */ 37 opus_int32 residual_Q10[], /* O CNG residual si gnal Q10 */
37 opus_int32 exc_buf_Q14[], /* I Random samples buffer Q10 */ 38 opus_int32 exc_buf_Q14[], /* I Random samples buffer Q10 */
38 opus_int32 Gain_Q16, /* I Gain to apply */ 39 opus_int32 Gain_Q16, /* I Gain to apply */
39 opus_int length, /* I Length */ 40 opus_int length, /* I Length */
40 opus_int32 *rand_seed /* I/O Seed to random index generator */ 41 opus_int32 *rand_seed /* I/O Seed to random index generator */
41 ) 42 )
42 { 43 {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 void silk_CNG( 80 void silk_CNG(
80 silk_decoder_state *psDec, /* I/O Decoder state */ 81 silk_decoder_state *psDec, /* I/O Decoder state */
81 silk_decoder_control *psDecCtrl, /* I/O Decoder control */ 82 silk_decoder_control *psDecCtrl, /* I/O Decoder control */
82 opus_int16 frame[], /* I/O Signal */ 83 opus_int16 frame[], /* I/O Signal */
83 opus_int length /* I Length o f residual */ 84 opus_int length /* I Length o f residual */
84 ) 85 )
85 { 86 {
86 opus_int i, subfr; 87 opus_int i, subfr;
87 opus_int32 sum_Q6, max_Gain_Q16; 88 opus_int32 sum_Q6, max_Gain_Q16;
88 opus_int16 A_Q12[ MAX_LPC_ORDER ]; 89 opus_int16 A_Q12[ MAX_LPC_ORDER ];
89 opus_int32 CNG_sig_Q10[ MAX_FRAME_LENGTH + MAX_LPC_ORDER ];
90 silk_CNG_struct *psCNG = &psDec->sCNG; 90 silk_CNG_struct *psCNG = &psDec->sCNG;
91 SAVE_STACK;
91 92
92 if( psDec->fs_kHz != psCNG->fs_kHz ) { 93 if( psDec->fs_kHz != psCNG->fs_kHz ) {
93 /* Reset state */ 94 /* Reset state */
94 silk_CNG_Reset( psDec ); 95 silk_CNG_Reset( psDec );
95 96
96 psCNG->fs_kHz = psDec->fs_kHz; 97 psCNG->fs_kHz = psDec->fs_kHz;
97 } 98 }
98 if( psDec->lossCnt == 0 && psDec->prevSignalType == TYPE_NO_VOICE_ACTIVITY ) { 99 if( psDec->lossCnt == 0 && psDec->prevSignalType == TYPE_NO_VOICE_ACTIVITY ) {
99 /* Update CNG parameters */ 100 /* Update CNG parameters */
100 101
(...skipping 15 matching lines...) Expand all
116 silk_memcpy( psCNG->CNG_exc_buf_Q14, &psDec->exc_Q14[ subfr * psDec->s ubfr_length ], psDec->subfr_length * sizeof( opus_int32 ) ); 117 silk_memcpy( psCNG->CNG_exc_buf_Q14, &psDec->exc_Q14[ subfr * psDec->s ubfr_length ], psDec->subfr_length * sizeof( opus_int32 ) );
117 118
118 /* Smooth gains */ 119 /* Smooth gains */
119 for( i = 0; i < psDec->nb_subfr; i++ ) { 120 for( i = 0; i < psDec->nb_subfr; i++ ) {
120 psCNG->CNG_smth_Gain_Q16 += silk_SMULWB( psDecCtrl->Gains_Q16[ i ] - psCNG->CNG_smth_Gain_Q16, CNG_GAIN_SMTH_Q16 ); 121 psCNG->CNG_smth_Gain_Q16 += silk_SMULWB( psDecCtrl->Gains_Q16[ i ] - psCNG->CNG_smth_Gain_Q16, CNG_GAIN_SMTH_Q16 );
121 } 122 }
122 } 123 }
123 124
124 /* Add CNG when packet is lost or during DTX */ 125 /* Add CNG when packet is lost or during DTX */
125 if( psDec->lossCnt ) { 126 if( psDec->lossCnt ) {
127 VARDECL( opus_int32, CNG_sig_Q10 );
128
129 ALLOC( CNG_sig_Q10, length + MAX_LPC_ORDER, opus_int32 );
126 130
127 /* Generate CNG excitation */ 131 /* Generate CNG excitation */
128 silk_CNG_exc( CNG_sig_Q10 + MAX_LPC_ORDER, psCNG->CNG_exc_buf_Q14, psCNG ->CNG_smth_Gain_Q16, length, &psCNG->rand_seed ); 132 silk_CNG_exc( CNG_sig_Q10 + MAX_LPC_ORDER, psCNG->CNG_exc_buf_Q14, psCNG ->CNG_smth_Gain_Q16, length, &psCNG->rand_seed );
129 133
130 /* Convert CNG NLSF to filter representation */ 134 /* Convert CNG NLSF to filter representation */
131 silk_NLSF2A( A_Q12, psCNG->CNG_smth_NLSF_Q15, psDec->LPC_order ); 135 silk_NLSF2A( A_Q12, psCNG->CNG_smth_NLSF_Q15, psDec->LPC_order );
132 136
133 /* Generate CNG signal, by synthesis filtering */ 137 /* Generate CNG signal, by synthesis filtering */
134 silk_memcpy( CNG_sig_Q10, psCNG->CNG_synth_state, MAX_LPC_ORDER * sizeof ( opus_int32 ) ); 138 silk_memcpy( CNG_sig_Q10, psCNG->CNG_synth_state, MAX_LPC_ORDER * sizeof ( opus_int32 ) );
135 for( i = 0; i < length; i++ ) { 139 for( i = 0; i < length; i++ ) {
(...skipping 21 matching lines...) Expand all
157 161
158 /* Update states */ 162 /* Update states */
159 CNG_sig_Q10[ MAX_LPC_ORDER + i ] = silk_ADD_LSHIFT( CNG_sig_Q10[ MAX _LPC_ORDER + i ], sum_Q6, 4 ); 163 CNG_sig_Q10[ MAX_LPC_ORDER + i ] = silk_ADD_LSHIFT( CNG_sig_Q10[ MAX _LPC_ORDER + i ], sum_Q6, 4 );
160 164
161 frame[ i ] = silk_ADD_SAT16( frame[ i ], silk_RSHIFT_ROUND( sum_Q6, 6 ) ); 165 frame[ i ] = silk_ADD_SAT16( frame[ i ], silk_RSHIFT_ROUND( sum_Q6, 6 ) );
162 } 166 }
163 silk_memcpy( psCNG->CNG_synth_state, &CNG_sig_Q10[ length ], MAX_LPC_ORD ER * sizeof( opus_int32 ) ); 167 silk_memcpy( psCNG->CNG_synth_state, &CNG_sig_Q10[ length ], MAX_LPC_ORD ER * sizeof( opus_int32 ) );
164 } else { 168 } else {
165 silk_memset( psCNG->CNG_synth_state, 0, psDec->LPC_order * sizeof( opus _int32 ) ); 169 silk_memset( psCNG->CNG_synth_state, 0, psDec->LPC_order * sizeof( opus _int32 ) );
166 } 170 }
171 RESTORE_STACK;
167 } 172 }
OLDNEW
« no previous file with comments | « silk/API.h ('k') | silk/HP_variable_cutoff.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698