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

Side by Side Diff: silk/fixed/burg_modified_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, 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/fixed/autocorr_FIX.c ('k') | silk/fixed/corrMatrix_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 "SigProc_FIX.h" 32 #include "SigProc_FIX.h"
33 #include "define.h" 33 #include "define.h"
34 #include "tuning_parameters.h" 34 #include "tuning_parameters.h"
35 #include "pitch.h"
35 36
36 #define MAX_FRAME_SIZE 384 /* subfr_length * nb_subfr = ( 0.005 * 16000 + 16 ) * 4 = 384 */ 37 #define MAX_FRAME_SIZE 384 /* subfr_length * nb_subfr = ( 0.005 * 16000 + 16 ) * 4 = 384 */
37 38
38 #define QA 25 39 #define QA 25
39 #define N_BITS_HEAD_ROOM 2 40 #define N_BITS_HEAD_ROOM 2
40 #define MIN_RSHIFTS -16 41 #define MIN_RSHIFTS -16
41 #define MAX_RSHIFTS (32 - QA) 42 #define MAX_RSHIFTS (32 - QA)
42 43
43 /* Compute reflection coefficients from input signal */ 44 /* Compute reflection coefficients from input signal */
44 void silk_burg_modified( 45 void silk_burg_modified(
45 opus_int32 *res_nrg, /* O Residual energy */ 46 opus_int32 *res_nrg, /* O Residual energy */
46 opus_int *res_nrg_Q, /* O Residual energy Q va lue */ 47 opus_int *res_nrg_Q, /* O Residual energy Q va lue */
47 opus_int32 A_Q16[], /* O Prediction coefficie nts (length order) */ 48 opus_int32 A_Q16[], /* O Prediction coefficie nts (length order) */
48 const opus_int16 x[], /* I Input signal, length : nb_subfr * ( D + subfr_length ) */ 49 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 */ 50 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 preceding samples) */ 51 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 */ 52 const opus_int nb_subfr, /* I Number of subframes stacked in x */
52 const opus_int D /* I Order */ 53 const opus_int D /* I Order */
53 ) 54 )
54 { 55 {
55 opus_int k, n, s, lz, rshifts, rshifts_extra, reached_max_gain; 56 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; 57 opus_int32 C0, num, nrg, rc_Q31, invGain_Q30, Atmp_QA, Atmp1, tmp1, tm p2, x1, x2;
57 const opus_int16 *x_ptr; 58 const opus_int16 *x_ptr;
58 opus_int32 C_first_row[ SILK_MAX_ORDER_LPC ]; 59 opus_int32 C_first_row[ SILK_MAX_ORDER_LPC ];
59 opus_int32 C_last_row[ SILK_MAX_ORDER_LPC ]; 60 opus_int32 C_last_row[ SILK_MAX_ORDER_LPC ];
60 opus_int32 Af_QA[ SILK_MAX_ORDER_LPC ]; 61 opus_int32 Af_QA[ SILK_MAX_ORDER_LPC ];
61 opus_int32 CAf[ SILK_MAX_ORDER_LPC + 1 ]; 62 opus_int32 CAf[ SILK_MAX_ORDER_LPC + 1 ];
62 opus_int32 CAb[ SILK_MAX_ORDER_LPC + 1 ]; 63 opus_int32 CAb[ SILK_MAX_ORDER_LPC + 1 ];
64 opus_int32 xcorr[ SILK_MAX_ORDER_LPC ];
63 65
64 silk_assert( subfr_length * nb_subfr <= MAX_FRAME_SIZE ); 66 silk_assert( subfr_length * nb_subfr <= MAX_FRAME_SIZE );
65 67
66 /* Compute autocorrelations, added over subframes */ 68 /* Compute autocorrelations, added over subframes */
67 silk_sum_sqr_shift( &C0, &rshifts, x, nb_subfr * subfr_length ); 69 silk_sum_sqr_shift( &C0, &rshifts, x, nb_subfr * subfr_length );
68 if( rshifts > MAX_RSHIFTS ) { 70 if( rshifts > MAX_RSHIFTS ) {
69 C0 = silk_LSHIFT32( C0, rshifts - MAX_RSHIFTS ); 71 C0 = silk_LSHIFT32( C0, rshifts - MAX_RSHIFTS );
70 silk_assert( C0 > 0 ); 72 silk_assert( C0 > 0 );
71 rshifts = MAX_RSHIFTS; 73 rshifts = MAX_RSHIFTS;
72 } else { 74 } else {
(...skipping 13 matching lines...) Expand all
86 if( rshifts > 0 ) { 88 if( rshifts > 0 ) {
87 for( s = 0; s < nb_subfr; s++ ) { 89 for( s = 0; s < nb_subfr; s++ ) {
88 x_ptr = x + s * subfr_length; 90 x_ptr = x + s * subfr_length;
89 for( n = 1; n < D + 1; n++ ) { 91 for( n = 1; n < D + 1; n++ ) {
90 C_first_row[ n - 1 ] += (opus_int32)silk_RSHIFT64( 92 C_first_row[ n - 1 ] += (opus_int32)silk_RSHIFT64(
91 silk_inner_prod16_aligned_64( x_ptr, x_ptr + n, subfr_length - n ), rshifts ); 93 silk_inner_prod16_aligned_64( x_ptr, x_ptr + n, subfr_length - n ), rshifts );
92 } 94 }
93 } 95 }
94 } else { 96 } else {
95 for( s = 0; s < nb_subfr; s++ ) { 97 for( s = 0; s < nb_subfr; s++ ) {
98 int i;
99 opus_int32 d;
96 x_ptr = x + s * subfr_length; 100 x_ptr = x + s * subfr_length;
101 celt_pitch_xcorr(x_ptr, x_ptr + 1, xcorr, subfr_length - D, D );
97 for( n = 1; n < D + 1; n++ ) { 102 for( n = 1; n < D + 1; n++ ) {
98 C_first_row[ n - 1 ] += silk_LSHIFT32( 103 for ( i = n + subfr_length - D, d = 0; i < subfr_length; i++ )
99 silk_inner_prod_aligned( x_ptr, x_ptr + n, subfr_length - n ), -rshifts ); 104 d = MAC16_16( d, x_ptr[ i ], x_ptr[ i - n ] );
105 xcorr[ n - 1 ] += d;
106 }
107 for( n = 1; n < D + 1; n++ ) {
108 C_first_row[ n - 1 ] += silk_LSHIFT32( xcorr[ n - 1 ], -rshifts );
100 } 109 }
101 } 110 }
102 } 111 }
103 silk_memcpy( C_last_row, C_first_row, SILK_MAX_ORDER_LPC * sizeof( opus_int3 2 ) ); 112 silk_memcpy( C_last_row, C_first_row, SILK_MAX_ORDER_LPC * sizeof( opus_int3 2 ) );
104 113
105 /* Initialize */ 114 /* Initialize */
106 CAb[ 0 ] = CAf[ 0 ] = C0 + silk_SMMUL( SILK_FIX_CONST( FIND_LPC_COND_FAC, 32 ), C0 ) + 1; /* Q(-rshifts) */ 115 CAb[ 0 ] = CAf[ 0 ] = C0 + silk_SMMUL( SILK_FIX_CONST( FIND_LPC_COND_FAC, 32 ), C0 ) + 1; /* Q(-rshifts) */
107 116
108 invGain_Q30 = (opus_int32)1 << 30; 117 invGain_Q30 = (opus_int32)1 << 30;
109 reached_max_gain = 0; 118 reached_max_gain = 0;
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 } else { 265 } else {
257 /* Return residual energy */ 266 /* Return residual energy */
258 nrg = CAf[ 0 ]; /* Q( -rshifts ) */ 267 nrg = CAf[ 0 ]; /* Q( -rshifts ) */
259 tmp1 = (opus_int32)1 << 16; /* Q16 */ 268 tmp1 = (opus_int32)1 << 16; /* Q16 */
260 for( k = 0; k < D; k++ ) { 269 for( k = 0; k < D; k++ ) {
261 Atmp1 = silk_RSHIFT_ROUND( Af_QA[ k ], QA - 16 ); /* Q16 */ 270 Atmp1 = silk_RSHIFT_ROUND( Af_QA[ k ], QA - 16 ); /* Q16 */
262 nrg = silk_SMLAWW( nrg, CAf[ k + 1 ], Atmp1 ); /* Q( -rshifts ) */ 271 nrg = silk_SMLAWW( nrg, CAf[ k + 1 ], Atmp1 ); /* Q( -rshifts ) */
263 tmp1 = silk_SMLAWW( tmp1, Atmp1, Atmp1 ); /* Q16 */ 272 tmp1 = silk_SMLAWW( tmp1, Atmp1, Atmp1 ); /* Q16 */
264 A_Q16[ k ] = -Atmp1; 273 A_Q16[ k ] = -Atmp1;
265 } 274 }
266 *res_nrg = silk_SMLAWW( nrg, silk_SMMUL( FIND_LPC_COND_FAC, C0 ), -tmp1 ); /* Q( -rshifts ) */ 275 *res_nrg = silk_SMLAWW( nrg, silk_SMMUL( SILK_FIX_CONST( FIND_LPC_COND_F AC, 32 ), C0 ), -tmp1 );/* Q( -rshifts ) */
267 *res_nrg_Q = -rshifts; 276 *res_nrg_Q = -rshifts;
268 } 277 }
269 } 278 }
OLDNEW
« no previous file with comments | « silk/fixed/autocorr_FIX.c ('k') | silk/fixed/corrMatrix_FIX.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698