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

Side by Side Diff: silk/SigProc_FIX.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/PLC.c ('k') | silk/VAD.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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 const opus_int win_type, /* I Selects a window typ e */ 220 const opus_int win_type, /* I Selects a window typ e */
221 const opus_int length /* I Window length, multi ple of 4 */ 221 const opus_int length /* I Window length, multi ple of 4 */
222 ); 222 );
223 223
224 /* Compute autocorrelation */ 224 /* Compute autocorrelation */
225 void silk_autocorr( 225 void silk_autocorr(
226 opus_int32 *results, /* O Result (length corre lationCount) */ 226 opus_int32 *results, /* O Result (length corre lationCount) */
227 opus_int *scale, /* O Scaling of the corre lation vector */ 227 opus_int *scale, /* O Scaling of the corre lation vector */
228 const opus_int16 *inputData, /* I Input data to correl ate */ 228 const opus_int16 *inputData, /* I Input data to correl ate */
229 const opus_int inputDataSize, /* I Length of input */ 229 const opus_int inputDataSize, /* I Length of input */
230 const opus_int correlationCount /* I Number of correlatio n taps to compute */ 230 const opus_int correlationCount, /* I Number of correlatio n taps to compute */
231 int arch /* I Run-time architectur e */
231 ); 232 );
232 233
233 void silk_decode_pitch( 234 void silk_decode_pitch(
234 opus_int16 lagIndex, /* I */ 235 opus_int16 lagIndex, /* I */
235 opus_int8 contourIndex, /* O */ 236 opus_int8 contourIndex, /* O */
236 opus_int pitch_lags[], /* O 4 pitch values */ 237 opus_int pitch_lags[], /* O 4 pitch values */
237 const opus_int Fs_kHz, /* I sampling frequency ( kHz) */ 238 const opus_int Fs_kHz, /* I sampling frequency ( kHz) */
238 const opus_int nb_subfr /* I number of sub frames */ 239 const opus_int nb_subfr /* I number of sub frames */
239 ); 240 );
240 241
241 opus_int silk_pitch_analysis_core( /* O Voicing estimate: 0 voiced, 1 unvoiced */ 242 opus_int silk_pitch_analysis_core( /* O Voicing estimate: 0 voiced, 1 unvoiced */
242 const opus_int16 *frame, /* I Signal of length PE_ FRAME_LENGTH_MS*Fs_kHz */ 243 const opus_int16 *frame, /* I Signal of length PE_ FRAME_LENGTH_MS*Fs_kHz */
243 opus_int *pitch_out, /* O 4 pitch lag values */ 244 opus_int *pitch_out, /* O 4 pitch lag values */
244 opus_int16 *lagIndex, /* O Lag Index */ 245 opus_int16 *lagIndex, /* O Lag Index */
245 opus_int8 *contourIndex, /* O Pitch contour Index */ 246 opus_int8 *contourIndex, /* O Pitch contour Index */
246 opus_int *LTPCorr_Q15, /* I/O Normalized correlati on; input: value from previous frame */ 247 opus_int *LTPCorr_Q15, /* I/O Normalized correlati on; input: value from previous frame */
247 opus_int prevLag, /* I Last lag of previous frame; set to zero is unvoiced */ 248 opus_int prevLag, /* I Last lag of previous frame; set to zero is unvoiced */
248 const opus_int32 search_thres1_Q16, /* I First stage threshol d for lag candidates 0 - 1 */ 249 const opus_int32 search_thres1_Q16, /* I First stage threshol d for lag candidates 0 - 1 */
249 const opus_int search_thres2_Q13, /* I Final threshold for lag candidates 0 - 1 */ 250 const opus_int search_thres2_Q13, /* I Final threshold for lag candidates 0 - 1 */
250 const opus_int Fs_kHz, /* I Sample frequency (kH z) */ 251 const opus_int Fs_kHz, /* I Sample frequency (kH z) */
251 const opus_int complexity, /* I Complexity setting, 0-2, where 2 is highest */ 252 const opus_int complexity, /* I Complexity setting, 0-2, where 2 is highest */
252 const opus_int nb_subfr /* I number of 5 ms subfr ames */ 253 const opus_int nb_subfr, /* I number of 5 ms subfr ames */
254 int arch /* I Run-time architectur e */
253 ); 255 );
254 256
255 /* Compute Normalized Line Spectral Frequencies (NLSFs) from whitening filter co efficients */ 257 /* Compute Normalized Line Spectral Frequencies (NLSFs) from whitening filter co efficients */
256 /* If not all roots are found, the a_Q16 coefficients are bandwidth expanded unt il convergence. */ 258 /* If not all roots are found, the a_Q16 coefficients are bandwidth expanded unt il convergence. */
257 void silk_A2NLSF( 259 void silk_A2NLSF(
258 opus_int16 *NLSF, /* O Normalized Line Spec tral Frequencies in Q15 (0..2^15-1) [d] */ 260 opus_int16 *NLSF, /* O Normalized Line Spec tral Frequencies in Q15 (0..2^15-1) [d] */
259 opus_int32 *a_Q16, /* I/O Monic whitening filt er coefficients in Q16 [d] */ 261 opus_int32 *a_Q16, /* I/O Monic whitening filt er coefficients in Q16 [d] */
260 const opus_int d /* I Filter order (must b e even) */ 262 const opus_int d /* I Filter order (must b e even) */
261 ); 263 );
262 264
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 304
303 /* Compute reflection coefficients from input signal */ 305 /* Compute reflection coefficients from input signal */
304 void silk_burg_modified( 306 void silk_burg_modified(
305 opus_int32 *res_nrg, /* O Residual energy */ 307 opus_int32 *res_nrg, /* O Residual energy */
306 opus_int *res_nrg_Q, /* O Residual energy Q va lue */ 308 opus_int *res_nrg_Q, /* O Residual energy Q va lue */
307 opus_int32 A_Q16[], /* O Prediction coefficie nts (length order) */ 309 opus_int32 A_Q16[], /* O Prediction coefficie nts (length order) */
308 const opus_int16 x[], /* I Input signal, length : nb_subfr * ( D + subfr_length ) */ 310 const opus_int16 x[], /* I Input signal, length : nb_subfr * ( D + subfr_length ) */
309 const opus_int32 minInvGain_Q30, /* I Inverse of max predi ction gain */ 311 const opus_int32 minInvGain_Q30, /* I Inverse of max predi ction gain */
310 const opus_int subfr_length, /* I Input signal subfram e length (incl. D preceding samples) */ 312 const opus_int subfr_length, /* I Input signal subfram e length (incl. D preceding samples) */
311 const opus_int nb_subfr, /* I Number of subframes stacked in x */ 313 const opus_int nb_subfr, /* I Number of subframes stacked in x */
312 const opus_int D /* I Order */ 314 const opus_int D, /* I Order */
315 int arch /* I Run-time architectur e */
313 ); 316 );
314 317
315 /* Copy and multiply a vector by a constant */ 318 /* Copy and multiply a vector by a constant */
316 void silk_scale_copy_vector16( 319 void silk_scale_copy_vector16(
317 opus_int16 *data_out, 320 opus_int16 *data_out,
318 const opus_int16 *data_in, 321 const opus_int16 *data_in,
319 opus_int32 gain_Q16, /* I Gain in Q16 */ 322 opus_int32 gain_Q16, /* I Gain in Q16 */
320 const opus_int dataSize /* I Length */ 323 const opus_int dataSize /* I Length */
321 ); 324 );
322 325
(...skipping 28 matching lines...) Expand all
351 const opus_int len /* I vector lengths */ 354 const opus_int len /* I vector lengths */
352 ); 355 );
353 356
354 /********************************************************************/ 357 /********************************************************************/
355 /* MACROS */ 358 /* MACROS */
356 /********************************************************************/ 359 /********************************************************************/
357 360
358 /* Rotate a32 right by 'rot' bits. Negative rot values result in rotating 361 /* Rotate a32 right by 'rot' bits. Negative rot values result in rotating
359 left. Output is 32bit int. 362 left. Output is 32bit int.
360 Note: contemporary compilers recognize the C expression below and 363 Note: contemporary compilers recognize the C expression below and
361 compile it into a 'ror' instruction if available. No need for inline ASM! */ 364 compile it into a 'ror' instruction if available. No need for OPUS_INLINE ASM ! */
362 static inline opus_int32 silk_ROR32( opus_int32 a32, opus_int rot ) 365 static OPUS_INLINE opus_int32 silk_ROR32( opus_int32 a32, opus_int rot )
363 { 366 {
364 opus_uint32 x = (opus_uint32) a32; 367 opus_uint32 x = (opus_uint32) a32;
365 opus_uint32 r = (opus_uint32) rot; 368 opus_uint32 r = (opus_uint32) rot;
366 opus_uint32 m = (opus_uint32) -rot; 369 opus_uint32 m = (opus_uint32) -rot;
367 if( rot == 0 ) { 370 if( rot == 0 ) {
368 return a32; 371 return a32;
369 } else if( rot < 0 ) { 372 } else if( rot < 0 ) {
370 return (opus_int32) ((x << m) | (x >> (32 - m))); 373 return (opus_int32) ((x << m) | (x >> (32 - m)));
371 } else { 374 } else {
372 return (opus_int32) ((x << (32 - r)) | (x >> r)); 375 return (opus_int32) ((x << (32 - r)) | (x >> r));
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 #define silk_NSHIFT_MUL_16_16(a, b) ( -(15- (16-silk_CLZ16(silk_abs(a)) + (16-silk_CLZ16(silk_abs(b))))) ) 504 #define silk_NSHIFT_MUL_16_16(a, b) ( -(15- (16-silk_CLZ16(silk_abs(a)) + (16-silk_CLZ16(silk_abs(b))))) )
502 505
503 506
504 #define silk_min(a, b) (((a) < (b)) ? (a) : (b)) 507 #define silk_min(a, b) (((a) < (b)) ? (a) : (b))
505 #define silk_max(a, b) (((a) > (b)) ? (a) : (b)) 508 #define silk_max(a, b) (((a) > (b)) ? (a) : (b))
506 509
507 /* Macro to convert floating-point constants to fixed-point */ 510 /* Macro to convert floating-point constants to fixed-point */
508 #define SILK_FIX_CONST( C, Q ) ((opus_int32)((C) * ((opus_int64)1 < < (Q)) + 0.5)) 511 #define SILK_FIX_CONST( C, Q ) ((opus_int32)((C) * ((opus_int64)1 < < (Q)) + 0.5))
509 512
510 /* silk_min() versions with typecast in the function call */ 513 /* silk_min() versions with typecast in the function call */
511 static inline opus_int silk_min_int(opus_int a, opus_int b) 514 static OPUS_INLINE opus_int silk_min_int(opus_int a, opus_int b)
512 { 515 {
513 return (((a) < (b)) ? (a) : (b)); 516 return (((a) < (b)) ? (a) : (b));
514 } 517 }
515 static inline opus_int16 silk_min_16(opus_int16 a, opus_int16 b) 518 static OPUS_INLINE opus_int16 silk_min_16(opus_int16 a, opus_int16 b)
516 { 519 {
517 return (((a) < (b)) ? (a) : (b)); 520 return (((a) < (b)) ? (a) : (b));
518 } 521 }
519 static inline opus_int32 silk_min_32(opus_int32 a, opus_int32 b) 522 static OPUS_INLINE opus_int32 silk_min_32(opus_int32 a, opus_int32 b)
520 { 523 {
521 return (((a) < (b)) ? (a) : (b)); 524 return (((a) < (b)) ? (a) : (b));
522 } 525 }
523 static inline opus_int64 silk_min_64(opus_int64 a, opus_int64 b) 526 static OPUS_INLINE opus_int64 silk_min_64(opus_int64 a, opus_int64 b)
524 { 527 {
525 return (((a) < (b)) ? (a) : (b)); 528 return (((a) < (b)) ? (a) : (b));
526 } 529 }
527 530
528 /* silk_min() versions with typecast in the function call */ 531 /* silk_min() versions with typecast in the function call */
529 static inline opus_int silk_max_int(opus_int a, opus_int b) 532 static OPUS_INLINE opus_int silk_max_int(opus_int a, opus_int b)
530 { 533 {
531 return (((a) > (b)) ? (a) : (b)); 534 return (((a) > (b)) ? (a) : (b));
532 } 535 }
533 static inline opus_int16 silk_max_16(opus_int16 a, opus_int16 b) 536 static OPUS_INLINE opus_int16 silk_max_16(opus_int16 a, opus_int16 b)
534 { 537 {
535 return (((a) > (b)) ? (a) : (b)); 538 return (((a) > (b)) ? (a) : (b));
536 } 539 }
537 static inline opus_int32 silk_max_32(opus_int32 a, opus_int32 b) 540 static OPUS_INLINE opus_int32 silk_max_32(opus_int32 a, opus_int32 b)
538 { 541 {
539 return (((a) > (b)) ? (a) : (b)); 542 return (((a) > (b)) ? (a) : (b));
540 } 543 }
541 static inline opus_int64 silk_max_64(opus_int64 a, opus_int64 b) 544 static OPUS_INLINE opus_int64 silk_max_64(opus_int64 a, opus_int64 b)
542 { 545 {
543 return (((a) > (b)) ? (a) : (b)); 546 return (((a) > (b)) ? (a) : (b));
544 } 547 }
545 548
546 #define silk_LIMIT( a, limit1, limit2) ((limit1) > (limit2) ? ((a) > (limit 1) ? (limit1) : ((a) < (limit2) ? (limit2) : (a))) \ 549 #define silk_LIMIT( a, limit1, limit2) ((limit1) > (limit2) ? ((a) > (limit 1) ? (limit1) : ((a) < (limit2) ? (limit2) : (a))) \
547 : ((a) > (limit 2) ? (limit2) : ((a) < (limit1) ? (limit1) : (a)))) 550 : ((a) > (limit 2) ? (limit2) : ((a) < (limit1) ? (limit1) : (a))))
548 551
549 #define silk_LIMIT_int silk_LIMIT 552 #define silk_LIMIT_int silk_LIMIT
550 #define silk_LIMIT_16 silk_LIMIT 553 #define silk_LIMIT_16 silk_LIMIT
551 #define silk_LIMIT_32 silk_LIMIT 554 #define silk_LIMIT_32 silk_LIMIT
(...skipping 17 matching lines...) Expand all
569 ARMv6 2 instruction cycles. 572 ARMv6 2 instruction cycles.
570 ARMv3M+ 3 instruction cycles. use SMULL and ignore LSB registers. (except xM)*/ 573 ARMv3M+ 3 instruction cycles. use SMULL and ignore LSB registers. (except xM)*/
571 /*#define silk_SMMUL(a32, b32) (opus_int32)silk_RSHIFT(silk_SMLAL (silk_SMULWB((a32), (b32)), (a32), silk_RSHIFT_ROUND((b32), 16)), 16)*/ 574 /*#define silk_SMMUL(a32, b32) (opus_int32)silk_RSHIFT(silk_SMLAL (silk_SMULWB((a32), (b32)), (a32), silk_RSHIFT_ROUND((b32), 16)), 16)*/
572 /* the following seems faster on x86 */ 575 /* the following seems faster on x86 */
573 #define silk_SMMUL(a32, b32) (opus_int32)silk_RSHIFT64(silk_SMULL ((a32), (b32)), 32) 576 #define silk_SMMUL(a32, b32) (opus_int32)silk_RSHIFT64(silk_SMULL ((a32), (b32)), 32)
574 577
575 #include "Inlines.h" 578 #include "Inlines.h"
576 #include "MacroCount.h" 579 #include "MacroCount.h"
577 #include "MacroDebug.h" 580 #include "MacroDebug.h"
578 581
579 #ifdef ARMv4_ASM 582 #ifdef OPUS_ARM_INLINE_ASM
580 #include "arm/SigProc_FIX_armv4.h" 583 #include "arm/SigProc_FIX_armv4.h"
581 #endif 584 #endif
582 585
583 #ifdef ARMv5E_ASM 586 #ifdef OPUS_ARM_INLINE_EDSP
584 #include "arm/SigProc_FIX_armv5e.h" 587 #include "arm/SigProc_FIX_armv5e.h"
585 #endif 588 #endif
586 589
587 #ifdef __cplusplus 590 #ifdef __cplusplus
588 } 591 }
589 #endif 592 #endif
590 593
591 #endif /* SILK_SIGPROC_FIX_H */ 594 #endif /* SILK_SIGPROC_FIX_H */
OLDNEW
« no previous file with comments | « silk/PLC.c ('k') | silk/VAD.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698