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

Side by Side Diff: third_party/opus/src/silk/gain_quant.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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 double_step_size_threshold = 2 * MAX_DELTA_GAIN_QUANT - N_LEVELS_QGA IN + *prev_ind; 69 double_step_size_threshold = 2 * MAX_DELTA_GAIN_QUANT - N_LEVELS_QGA IN + *prev_ind;
70 if( ind[ k ] > double_step_size_threshold ) { 70 if( ind[ k ] > double_step_size_threshold ) {
71 ind[ k ] = double_step_size_threshold + silk_RSHIFT( ind[ k ] - double_step_size_threshold + 1, 1 ); 71 ind[ k ] = double_step_size_threshold + silk_RSHIFT( ind[ k ] - double_step_size_threshold + 1, 1 );
72 } 72 }
73 73
74 ind[ k ] = silk_LIMIT_int( ind[ k ], MIN_DELTA_GAIN_QUANT, MAX_DELTA _GAIN_QUANT ); 74 ind[ k ] = silk_LIMIT_int( ind[ k ], MIN_DELTA_GAIN_QUANT, MAX_DELTA _GAIN_QUANT );
75 75
76 /* Accumulate deltas */ 76 /* Accumulate deltas */
77 if( ind[ k ] > double_step_size_threshold ) { 77 if( ind[ k ] > double_step_size_threshold ) {
78 *prev_ind += silk_LSHIFT( ind[ k ], 1 ) - double_step_size_thres hold; 78 *prev_ind += silk_LSHIFT( ind[ k ], 1 ) - double_step_size_thres hold;
79 *prev_ind = silk_min_int( *prev_ind, N_LEVELS_QGAIN - 1 );
79 } else { 80 } else {
80 *prev_ind += ind[ k ]; 81 *prev_ind += ind[ k ];
81 } 82 }
82 83
83 /* Shift to make non-negative */ 84 /* Shift to make non-negative */
84 ind[ k ] -= MIN_DELTA_GAIN_QUANT; 85 ind[ k ] -= MIN_DELTA_GAIN_QUANT;
85 } 86 }
86 87
87 /* Scale and convert to linear scale */ 88 /* Scale and convert to linear scale */
88 gain_Q16[ k ] = silk_log2lin( silk_min_32( silk_SMULWB( INV_SCALE_Q16, * prev_ind ) + OFFSET, 3967 ) ); /* 3967 = 31 in Q7 */ 89 gain_Q16[ k ] = silk_log2lin( silk_min_32( silk_SMULWB( INV_SCALE_Q16, * prev_ind ) + OFFSET, 3967 ) ); /* 3967 = 31 in Q7 */
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 opus_int k; 133 opus_int k;
133 opus_int32 gainsID; 134 opus_int32 gainsID;
134 135
135 gainsID = 0; 136 gainsID = 0;
136 for( k = 0; k < nb_subfr; k++ ) { 137 for( k = 0; k < nb_subfr; k++ ) {
137 gainsID = silk_ADD_LSHIFT32( ind[ k ], gainsID, 8 ); 138 gainsID = silk_ADD_LSHIFT32( ind[ k ], gainsID, 8 );
138 } 139 }
139 140
140 return gainsID; 141 return gainsID;
141 } 142 }
OLDNEW
« no previous file with comments | « third_party/opus/src/silk/float/wrappers_FLP.c ('k') | third_party/opus/src/silk/init_decoder.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698