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

Side by Side Diff: silk/float/SigProc_FLP.h

Issue 107243004: Updating Opus to release 1.1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/opus
Patch Set: Created 7 years 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/float/LPC_analysis_filter_FLP.c ('k') | silk/float/encode_frame_FLP.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.
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 const silk_float *frame, /* I Signal of length PE_FRAME_LE NGTH_MS*Fs_kHz */ 87 const silk_float *frame, /* I Signal of length PE_FRAME_LE NGTH_MS*Fs_kHz */
88 opus_int *pitch_out, /* O Pitch lag values [nb_subfr] */ 88 opus_int *pitch_out, /* O Pitch lag values [nb_subfr] */
89 opus_int16 *lagIndex, /* O Lag Index */ 89 opus_int16 *lagIndex, /* O Lag Index */
90 opus_int8 *contourIndex, /* O Pitch contour Index */ 90 opus_int8 *contourIndex, /* O Pitch contour Index */
91 silk_float *LTPCorr, /* I/O Normalized correlation; inpu t: value from previous frame */ 91 silk_float *LTPCorr, /* I/O Normalized correlation; inpu t: value from previous frame */
92 opus_int prevLag, /* I Last lag of previous frame; set to zero is unvoiced */ 92 opus_int prevLag, /* I Last lag of previous frame; set to zero is unvoiced */
93 const silk_float search_thres1, /* I First stage threshold for la g candidates 0 - 1 */ 93 const silk_float search_thres1, /* I First stage threshold for la g candidates 0 - 1 */
94 const silk_float search_thres2, /* I Final threshold for lag cand idates 0 - 1 */ 94 const silk_float search_thres2, /* I Final threshold for lag cand idates 0 - 1 */
95 const opus_int Fs_kHz, /* I sample frequency (kHz) */ 95 const opus_int Fs_kHz, /* I sample frequency (kHz) */
96 const opus_int complexity, /* I Complexity setting, 0-2, whe re 2 is highest */ 96 const opus_int complexity, /* I Complexity setting, 0-2, whe re 2 is highest */
97 const opus_int nb_subfr /* I Number of 5 ms subframes */ 97 const opus_int nb_subfr, /* I Number of 5 ms subframes */
98 int arch /* I Run-time architecture */
98 ); 99 );
99 100
100 void silk_insertion_sort_decreasing_FLP( 101 void silk_insertion_sort_decreasing_FLP(
101 silk_float *a, /* I/O Unsorted / Sorted vector */ 102 silk_float *a, /* I/O Unsorted / Sorted vector */
102 opus_int *idx, /* O Index vector for the sorted elements */ 103 opus_int *idx, /* O Index vector for the sorted elements */
103 const opus_int L, /* I Vector length */ 104 const opus_int L, /* I Vector length */
104 const opus_int K /* I Number of correctly sorted p ositions */ 105 const opus_int K /* I Number of correctly sorted p ositions */
105 ); 106 );
106 107
107 /* Compute reflection coefficients from input signal */ 108 /* Compute reflection coefficients from input signal */
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 /* MACROS */ 147 /* MACROS */
147 /********************************************************************/ 148 /********************************************************************/
148 149
149 #define PI (3.1415926536f) 150 #define PI (3.1415926536f)
150 151
151 #define silk_min_float( a, b ) (((a) < (b)) ? (a) : (b)) 152 #define silk_min_float( a, b ) (((a) < (b)) ? (a) : (b))
152 #define silk_max_float( a, b ) (((a) > (b)) ? (a) : (b)) 153 #define silk_max_float( a, b ) (((a) > (b)) ? (a) : (b))
153 #define silk_abs_float( a ) ((silk_float)fabs(a)) 154 #define silk_abs_float( a ) ((silk_float)fabs(a))
154 155
155 /* sigmoid function */ 156 /* sigmoid function */
156 static inline silk_float silk_sigmoid( silk_float x ) 157 static OPUS_INLINE silk_float silk_sigmoid( silk_float x )
157 { 158 {
158 return (silk_float)(1.0 / (1.0 + exp(-x))); 159 return (silk_float)(1.0 / (1.0 + exp(-x)));
159 } 160 }
160 161
161 /* floating-point to integer conversion (rounding) */ 162 /* floating-point to integer conversion (rounding) */
162 static inline opus_int32 silk_float2int( silk_float x ) 163 static OPUS_INLINE opus_int32 silk_float2int( silk_float x )
163 { 164 {
164 return (opus_int32)float2int( x ); 165 return (opus_int32)float2int( x );
165 } 166 }
166 167
167 /* floating-point to integer conversion (rounding) */ 168 /* floating-point to integer conversion (rounding) */
168 static inline void silk_float2short_array( 169 static OPUS_INLINE void silk_float2short_array(
169 opus_int16 *out, 170 opus_int16 *out,
170 const silk_float *in, 171 const silk_float *in,
171 opus_int32 length 172 opus_int32 length
172 ) 173 )
173 { 174 {
174 opus_int32 k; 175 opus_int32 k;
175 for( k = length - 1; k >= 0; k-- ) { 176 for( k = length - 1; k >= 0; k-- ) {
176 out[k] = silk_SAT16( (opus_int32)float2int( in[k] ) ); 177 out[k] = silk_SAT16( (opus_int32)float2int( in[k] ) );
177 } 178 }
178 } 179 }
179 180
180 /* integer to floating-point conversion */ 181 /* integer to floating-point conversion */
181 static inline void silk_short2float_array( 182 static OPUS_INLINE void silk_short2float_array(
182 silk_float *out, 183 silk_float *out,
183 const opus_int16 *in, 184 const opus_int16 *in,
184 opus_int32 length 185 opus_int32 length
185 ) 186 )
186 { 187 {
187 opus_int32 k; 188 opus_int32 k;
188 for( k = length - 1; k >= 0; k-- ) { 189 for( k = length - 1; k >= 0; k-- ) {
189 out[k] = (silk_float)in[k]; 190 out[k] = (silk_float)in[k];
190 } 191 }
191 } 192 }
192 193
193 /* using log2() helps the fixed-point conversion */ 194 /* using log2() helps the fixed-point conversion */
194 static inline silk_float silk_log2( double x ) 195 static OPUS_INLINE silk_float silk_log2( double x )
195 { 196 {
196 return ( silk_float )( 3.32192809488736 * log10( x ) ); 197 return ( silk_float )( 3.32192809488736 * log10( x ) );
197 } 198 }
198 199
199 #ifdef __cplusplus 200 #ifdef __cplusplus
200 } 201 }
201 #endif 202 #endif
202 203
203 #endif /* SILK_SIGPROC_FLP_H */ 204 #endif /* SILK_SIGPROC_FLP_H */
OLDNEW
« no previous file with comments | « silk/float/LPC_analysis_filter_FLP.c ('k') | silk/float/encode_frame_FLP.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698