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

Side by Side Diff: third_party/opus/src/silk/fixed/schur_FIX.c

Issue 2962373002: [Opus] Update to v1.2.1 (Closed)
Patch Set: Pre-increment instead of post-increment Created 3 years, 5 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
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 25 matching lines...) Expand all
36 opus_int32 silk_schur( /* O Returns residual ene rgy */ 36 opus_int32 silk_schur( /* O Returns residual ene rgy */
37 opus_int16 *rc_Q15, /* O reflection coefficie nts [order] Q15 */ 37 opus_int16 *rc_Q15, /* O reflection coefficie nts [order] Q15 */
38 const opus_int32 *c, /* I correlations [order+ 1] */ 38 const opus_int32 *c, /* I correlations [order+ 1] */
39 const opus_int32 order /* I prediction order */ 39 const opus_int32 order /* I prediction order */
40 ) 40 )
41 { 41 {
42 opus_int k, n, lz; 42 opus_int k, n, lz;
43 opus_int32 C[ SILK_MAX_ORDER_LPC + 1 ][ 2 ]; 43 opus_int32 C[ SILK_MAX_ORDER_LPC + 1 ][ 2 ];
44 opus_int32 Ctmp1, Ctmp2, rc_tmp_Q15; 44 opus_int32 Ctmp1, Ctmp2, rc_tmp_Q15;
45 45
46 silk_assert( order==6||order==8||order==10||order==12||order==14||order==16 ); 46 silk_assert( order >= 0 && order <= SILK_MAX_ORDER_LPC );
47 47
48 /* Get number of leading zeros */ 48 /* Get number of leading zeros */
49 lz = silk_CLZ32( c[ 0 ] ); 49 lz = silk_CLZ32( c[ 0 ] );
50 50
51 /* Copy correlations and adjust level to Q30 */ 51 /* Copy correlations and adjust level to Q30 */
52 k = 0;
52 if( lz < 2 ) { 53 if( lz < 2 ) {
53 /* lz must be 1, so shift one to the right */ 54 /* lz must be 1, so shift one to the right */
54 for( k = 0; k < order + 1; k++ ) { 55 do {
55 C[ k ][ 0 ] = C[ k ][ 1 ] = silk_RSHIFT( c[ k ], 1 ); 56 C[ k ][ 0 ] = C[ k ][ 1 ] = silk_RSHIFT( c[ k ], 1 );
56 } 57 } while( ++k <= order );
57 } else if( lz > 2 ) { 58 } else if( lz > 2 ) {
58 /* Shift to the left */ 59 /* Shift to the left */
59 lz -= 2; 60 lz -= 2;
60 for( k = 0; k < order + 1; k++ ) { 61 do {
61 C[ k ][ 0 ] = C[ k ][ 1 ] = silk_LSHIFT( c[ k ], lz ); 62 C[ k ][ 0 ] = C[ k ][ 1 ] = silk_LSHIFT( c[ k ], lz );
62 } 63 } while( ++k <= order );
63 } else { 64 } else {
64 /* No need to shift */ 65 /* No need to shift */
65 for( k = 0; k < order + 1; k++ ) { 66 do {
66 C[ k ][ 0 ] = C[ k ][ 1 ] = c[ k ]; 67 C[ k ][ 0 ] = C[ k ][ 1 ] = c[ k ];
67 } 68 } while( ++k <= order );
68 } 69 }
69 70
70 for( k = 0; k < order; k++ ) { 71 for( k = 0; k < order; k++ ) {
71 /* Check that we won't be getting an unstable rc, otherwise stop here. * / 72 /* Check that we won't be getting an unstable rc, otherwise stop here. * /
72 if (silk_abs_int32(C[ k + 1 ][ 0 ]) >= C[ 0 ][ 1 ]) { 73 if (silk_abs_int32(C[ k + 1 ][ 0 ]) >= C[ 0 ][ 1 ]) {
73 if ( C[ k + 1 ][ 0 ] > 0 ) { 74 if ( C[ k + 1 ][ 0 ] > 0 ) {
74 rc_Q15[ k ] = -SILK_FIX_CONST( .99f, 15 ); 75 rc_Q15[ k ] = -SILK_FIX_CONST( .99f, 15 );
75 } else { 76 } else {
76 rc_Q15[ k ] = SILK_FIX_CONST( .99f, 15 ); 77 rc_Q15[ k ] = SILK_FIX_CONST( .99f, 15 );
77 } 78 }
(...skipping 19 matching lines...) Expand all
97 } 98 }
98 } 99 }
99 100
100 for(; k < order; k++ ) { 101 for(; k < order; k++ ) {
101 rc_Q15[ k ] = 0; 102 rc_Q15[ k ] = 0;
102 } 103 }
103 104
104 /* return residual energy */ 105 /* return residual energy */
105 return silk_max_32( 1, C[ 0 ][ 1 ] ); 106 return silk_max_32( 1, C[ 0 ][ 1 ] );
106 } 107 }
OLDNEW
« no previous file with comments | « third_party/opus/src/silk/fixed/schur64_FIX.c ('k') | third_party/opus/src/silk/fixed/solve_LS_FIX.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698