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

Side by Side Diff: silk/fixed/find_LPC_FIX.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, 2 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/encode_frame_FIX.c ('k') | silk/fixed/find_LTP_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.
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_FIX.h" 32 #include "main_FIX.h"
33 #include "stack_alloc.h"
33 #include "tuning_parameters.h" 34 #include "tuning_parameters.h"
34 35
35 /* Finds LPC vector from correlations, and converts to NLSF */ 36 /* Finds LPC vector from correlations, and converts to NLSF */
36 void silk_find_LPC_FIX( 37 void silk_find_LPC_FIX(
37 silk_encoder_state *psEncC, /* I /O Encoder state */ 38 silk_encoder_state *psEncC, /* I /O Encoder state */
38 opus_int16 NLSF_Q15[], /* O NLSFs */ 39 opus_int16 NLSF_Q15[], /* O NLSFs */
39 const opus_int16 x[], /* I Input signal */ 40 const opus_int16 x[], /* I Input signal */
40 const opus_int32 minInvGain_Q30 /* I Inverse of max prediction gain */ 41 const opus_int32 minInvGain_Q30 /* I Inverse of max prediction gain */
41 ) 42 )
42 { 43 {
43 opus_int k, subfr_length; 44 opus_int k, subfr_length;
44 opus_int32 a_Q16[ MAX_LPC_ORDER ]; 45 opus_int32 a_Q16[ MAX_LPC_ORDER ];
45 opus_int isInterpLower, shift; 46 opus_int isInterpLower, shift;
46 opus_int32 res_nrg0, res_nrg1; 47 opus_int32 res_nrg0, res_nrg1;
47 opus_int rshift0, rshift1; 48 opus_int rshift0, rshift1;
48 49
49 /* Used only for LSF interpolation */ 50 /* Used only for LSF interpolation */
50 opus_int32 a_tmp_Q16[ MAX_LPC_ORDER ], res_nrg_interp, res_nrg, res_tmp_nr g; 51 opus_int32 a_tmp_Q16[ MAX_LPC_ORDER ], res_nrg_interp, res_nrg, res_tmp_nr g;
51 opus_int res_nrg_interp_Q, res_nrg_Q, res_tmp_nrg_Q; 52 opus_int res_nrg_interp_Q, res_nrg_Q, res_tmp_nrg_Q;
52 opus_int16 a_tmp_Q12[ MAX_LPC_ORDER ]; 53 opus_int16 a_tmp_Q12[ MAX_LPC_ORDER ];
53 opus_int16 NLSF0_Q15[ MAX_LPC_ORDER ]; 54 opus_int16 NLSF0_Q15[ MAX_LPC_ORDER ];
54 opus_int16 LPC_res[ MAX_FRAME_LENGTH + MAX_NB_SUBFR * MAX_LPC_ORDER ]; 55 SAVE_STACK;
55 56
56 subfr_length = psEncC->subfr_length + psEncC->predictLPCOrder; 57 subfr_length = psEncC->subfr_length + psEncC->predictLPCOrder;
57 58
58 /* Default: no interpolation */ 59 /* Default: no interpolation */
59 psEncC->indices.NLSFInterpCoef_Q2 = 4; 60 psEncC->indices.NLSFInterpCoef_Q2 = 4;
60 61
61 /* Burg AR analysis for the full frame */ 62 /* Burg AR analysis for the full frame */
62 silk_burg_modified( &res_nrg, &res_nrg_Q, a_Q16, x, minInvGain_Q30, subfr_le ngth, psEncC->nb_subfr, psEncC->predictLPCOrder ); 63 silk_burg_modified( &res_nrg, &res_nrg_Q, a_Q16, x, minInvGain_Q30, subfr_le ngth, psEncC->nb_subfr, psEncC->predictLPCOrder );
63 64
64 if( psEncC->useInterpolatedNLSFs && !psEncC->first_frame_after_reset && psEn cC->nb_subfr == MAX_NB_SUBFR ) { 65 if( psEncC->useInterpolatedNLSFs && !psEncC->first_frame_after_reset && psEn cC->nb_subfr == MAX_NB_SUBFR ) {
66 VARDECL( opus_int16, LPC_res );
67
65 /* Optimal solution for last 10 ms */ 68 /* Optimal solution for last 10 ms */
66 silk_burg_modified( &res_tmp_nrg, &res_tmp_nrg_Q, a_tmp_Q16, x + 2 * sub fr_length, minInvGain_Q30, subfr_length, 2, psEncC->predictLPCOrder ); 69 silk_burg_modified( &res_tmp_nrg, &res_tmp_nrg_Q, a_tmp_Q16, x + 2 * sub fr_length, minInvGain_Q30, subfr_length, 2, psEncC->predictLPCOrder );
67 70
68 /* subtract residual energy here, as that's easier than adding it to the */ 71 /* subtract residual energy here, as that's easier than adding it to the */
69 /* residual energy of the first 10 ms in each iteration of the search be low */ 72 /* residual energy of the first 10 ms in each iteration of the search be low */
70 shift = res_tmp_nrg_Q - res_nrg_Q; 73 shift = res_tmp_nrg_Q - res_nrg_Q;
71 if( shift >= 0 ) { 74 if( shift >= 0 ) {
72 if( shift < 32 ) { 75 if( shift < 32 ) {
73 res_nrg = res_nrg - silk_RSHIFT( res_tmp_nrg, shift ); 76 res_nrg = res_nrg - silk_RSHIFT( res_tmp_nrg, shift );
74 } 77 }
75 } else { 78 } else {
76 silk_assert( shift > -32 ); 79 silk_assert( shift > -32 );
77 res_nrg = silk_RSHIFT( res_nrg, -shift ) - res_tmp_nrg; 80 res_nrg = silk_RSHIFT( res_nrg, -shift ) - res_tmp_nrg;
78 res_nrg_Q = res_tmp_nrg_Q; 81 res_nrg_Q = res_tmp_nrg_Q;
79 } 82 }
80 83
81 /* Convert to NLSFs */ 84 /* Convert to NLSFs */
82 silk_A2NLSF( NLSF_Q15, a_tmp_Q16, psEncC->predictLPCOrder ); 85 silk_A2NLSF( NLSF_Q15, a_tmp_Q16, psEncC->predictLPCOrder );
83 86
87 ALLOC( LPC_res, 2 * subfr_length, opus_int16 );
88
84 /* Search over interpolation indices to find the one with lowest residua l energy */ 89 /* Search over interpolation indices to find the one with lowest residua l energy */
85 for( k = 3; k >= 0; k-- ) { 90 for( k = 3; k >= 0; k-- ) {
86 /* Interpolate NLSFs for first half */ 91 /* Interpolate NLSFs for first half */
87 silk_interpolate( NLSF0_Q15, psEncC->prev_NLSFq_Q15, NLSF_Q15, k, ps EncC->predictLPCOrder ); 92 silk_interpolate( NLSF0_Q15, psEncC->prev_NLSFq_Q15, NLSF_Q15, k, ps EncC->predictLPCOrder );
88 93
89 /* Convert to LPC for residual energy evaluation */ 94 /* Convert to LPC for residual energy evaluation */
90 silk_NLSF2A( a_tmp_Q12, NLSF0_Q15, psEncC->predictLPCOrder ); 95 silk_NLSF2A( a_tmp_Q12, NLSF0_Q15, psEncC->predictLPCOrder );
91 96
92 /* Calculate residual energy with NLSF interpolation */ 97 /* Calculate residual energy with NLSF interpolation */
93 silk_LPC_analysis_filter( LPC_res, x, a_tmp_Q12, 2 * subfr_length, p sEncC->predictLPCOrder ); 98 silk_LPC_analysis_filter( LPC_res, x, a_tmp_Q12, 2 * subfr_length, p sEncC->predictLPCOrder );
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 } 140 }
136 } 141 }
137 } 142 }
138 143
139 if( psEncC->indices.NLSFInterpCoef_Q2 == 4 ) { 144 if( psEncC->indices.NLSFInterpCoef_Q2 == 4 ) {
140 /* NLSF interpolation is currently inactive, calculate NLSFs from full f rame AR coefficients */ 145 /* NLSF interpolation is currently inactive, calculate NLSFs from full f rame AR coefficients */
141 silk_A2NLSF( NLSF_Q15, a_Q16, psEncC->predictLPCOrder ); 146 silk_A2NLSF( NLSF_Q15, a_Q16, psEncC->predictLPCOrder );
142 } 147 }
143 148
144 silk_assert( psEncC->indices.NLSFInterpCoef_Q2 == 4 || ( psEncC->useInterpol atedNLSFs && !psEncC->first_frame_after_reset && psEncC->nb_subfr == MAX_NB_SUBF R ) ); 149 silk_assert( psEncC->indices.NLSFInterpCoef_Q2 == 4 || ( psEncC->useInterpol atedNLSFs && !psEncC->first_frame_after_reset && psEncC->nb_subfr == MAX_NB_SUBF R ) );
150 RESTORE_STACK;
145 } 151 }
OLDNEW
« no previous file with comments | « silk/fixed/encode_frame_FIX.c ('k') | silk/fixed/find_LTP_FIX.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698