OLD | NEW |
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 23 matching lines...) Expand all Loading... |
34 #endif | 34 #endif |
35 | 35 |
36 /*#define silk_MACRO_COUNT */ /* Used to enable WMOPS counting */ | 36 /*#define silk_MACRO_COUNT */ /* Used to enable WMOPS counting */ |
37 | 37 |
38 #define SILK_MAX_ORDER_LPC 16 /* max order of the LPC anal
ysis in schur() and k2a() */ | 38 #define SILK_MAX_ORDER_LPC 16 /* max order of the LPC anal
ysis in schur() and k2a() */ |
39 | 39 |
40 #include <string.h> /* for memset(), memcpy(), m
emmove() */ | 40 #include <string.h> /* for memset(), memcpy(), m
emmove() */ |
41 #include "typedef.h" | 41 #include "typedef.h" |
42 #include "resampler_structs.h" | 42 #include "resampler_structs.h" |
43 #include "macros.h" | 43 #include "macros.h" |
| 44 #include "cpu_support.h" |
44 | 45 |
| 46 #if defined(OPUS_X86_MAY_HAVE_SSE4_1) |
| 47 #include "x86/SigProc_FIX_sse.h" |
| 48 #endif |
45 | 49 |
46 /********************************************************************/ | 50 /********************************************************************/ |
47 /* SIGNAL PROCESSING FUNCTIONS */ | 51 /* SIGNAL PROCESSING FUNCTIONS */ |
48 /********************************************************************/ | 52 /********************************************************************/ |
49 | 53 |
50 /*! | 54 /*! |
51 * Initialize/reset the resampler state for a given pair of input/output samplin
g rates | 55 * Initialize/reset the resampler state for a given pair of input/output samplin
g rates |
52 */ | 56 */ |
53 opus_int silk_resampler_init( | 57 opus_int silk_resampler_init( |
54 silk_resampler_state_struct *S, /* I/O Resampler state
*/ | 58 silk_resampler_state_struct *S, /* I/O Resampler state
*/ |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 const opus_int32 len, /* I signal length (must
be even) */ | 105 const opus_int32 len, /* I signal length (must
be even) */ |
102 opus_int stride /* I Operate on interlea
ved signal if > 1 */ | 106 opus_int stride /* I Operate on interlea
ved signal if > 1 */ |
103 ); | 107 ); |
104 | 108 |
105 /* Variable order MA prediction error filter. */ | 109 /* Variable order MA prediction error filter. */ |
106 void silk_LPC_analysis_filter( | 110 void silk_LPC_analysis_filter( |
107 opus_int16 *out, /* O Output signal
*/ | 111 opus_int16 *out, /* O Output signal
*/ |
108 const opus_int16 *in, /* I Input signal
*/ | 112 const opus_int16 *in, /* I Input signal
*/ |
109 const opus_int16 *B, /* I MA prediction coeffi
cients, Q12 [order] */ | 113 const opus_int16 *B, /* I MA prediction coeffi
cients, Q12 [order] */ |
110 const opus_int32 len, /* I Signal length
*/ | 114 const opus_int32 len, /* I Signal length
*/ |
111 const opus_int32 d /* I Filter order
*/ | 115 const opus_int32 d, /* I Filter order
*/ |
| 116 int arch /* I Run-time architectur
e */ |
112 ); | 117 ); |
113 | 118 |
114 /* Chirp (bandwidth expand) LP AR filter */ | 119 /* Chirp (bandwidth expand) LP AR filter */ |
115 void silk_bwexpander( | 120 void silk_bwexpander( |
116 opus_int16 *ar, /* I/O AR filter to be expa
nded (without leading 1) */ | 121 opus_int16 *ar, /* I/O AR filter to be expa
nded (without leading 1) */ |
117 const opus_int d, /* I Length of ar
*/ | 122 const opus_int d, /* I Length of ar
*/ |
118 opus_int32 chirp_Q16 /* I Chirp factor (typica
lly in the range 0 to 1) */ | 123 opus_int32 chirp_Q16 /* I Chirp factor (typica
lly in the range 0 to 1) */ |
119 ); | 124 ); |
120 | 125 |
121 /* Chirp (bandwidth expand) LP AR filter */ | 126 /* Chirp (bandwidth expand) LP AR filter */ |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 ); | 301 ); |
297 | 302 |
298 /* Laroia low complexity NLSF weights */ | 303 /* Laroia low complexity NLSF weights */ |
299 void silk_NLSF_VQ_weights_laroia( | 304 void silk_NLSF_VQ_weights_laroia( |
300 opus_int16 *pNLSFW_Q_OUT, /* O Pointer to input ve
ctor weights [D] */ | 305 opus_int16 *pNLSFW_Q_OUT, /* O Pointer to input ve
ctor weights [D] */ |
301 const opus_int16 *pNLSF_Q15, /* I Pointer to input ve
ctor [D] */ | 306 const opus_int16 *pNLSF_Q15, /* I Pointer to input ve
ctor [D] */ |
302 const opus_int D /* I Input vector dimens
ion (even) */ | 307 const opus_int D /* I Input vector dimens
ion (even) */ |
303 ); | 308 ); |
304 | 309 |
305 /* Compute reflection coefficients from input signal */ | 310 /* Compute reflection coefficients from input signal */ |
306 void silk_burg_modified( | 311 void silk_burg_modified_c( |
307 opus_int32 *res_nrg, /* O Residual energy
*/ | 312 opus_int32 *res_nrg, /* O Residual energy
*/ |
308 opus_int *res_nrg_Q, /* O Residual energy Q va
lue */ | 313 opus_int *res_nrg_Q, /* O Residual energy Q va
lue */ |
309 opus_int32 A_Q16[], /* O Prediction coefficie
nts (length order) */ | 314 opus_int32 A_Q16[], /* O Prediction coefficie
nts (length order) */ |
310 const opus_int16 x[], /* I Input signal, length
: nb_subfr * ( D + subfr_length ) */ | 315 const opus_int16 x[], /* I Input signal, length
: nb_subfr * ( D + subfr_length ) */ |
311 const opus_int32 minInvGain_Q30, /* I Inverse of max predi
ction gain */ | 316 const opus_int32 minInvGain_Q30, /* I Inverse of max predi
ction gain */ |
312 const opus_int subfr_length, /* I Input signal subfram
e length (incl. D preceding samples) */ | 317 const opus_int subfr_length, /* I Input signal subfram
e length (incl. D preceding samples) */ |
313 const opus_int nb_subfr, /* I Number of subframes
stacked in x */ | 318 const opus_int nb_subfr, /* I Number of subframes
stacked in x */ |
314 const opus_int D, /* I Order
*/ | 319 const opus_int D, /* I Order
*/ |
315 int arch /* I Run-time architectur
e */ | 320 int arch /* I Run-time architectur
e */ |
316 ); | 321 ); |
(...skipping 11 matching lines...) Expand all Loading... |
328 opus_int32 *data1, /* I/O Q0/Q18
*/ | 333 opus_int32 *data1, /* I/O Q0/Q18
*/ |
329 opus_int32 gain_Q26, /* I Q26
*/ | 334 opus_int32 gain_Q26, /* I Q26
*/ |
330 opus_int dataSize /* I length
*/ | 335 opus_int dataSize /* I length
*/ |
331 ); | 336 ); |
332 | 337 |
333 /********************************************************************/ | 338 /********************************************************************/ |
334 /* INLINE ARM MATH */ | 339 /* INLINE ARM MATH */ |
335 /********************************************************************/ | 340 /********************************************************************/ |
336 | 341 |
337 /* return sum( inVec1[i] * inVec2[i] ) */ | 342 /* return sum( inVec1[i] * inVec2[i] ) */ |
| 343 |
338 opus_int32 silk_inner_prod_aligned( | 344 opus_int32 silk_inner_prod_aligned( |
339 const opus_int16 *const inVec1, /* I input vector 1
*/ | 345 const opus_int16 *const inVec1, /* I input vector 1
*/ |
340 const opus_int16 *const inVec2, /* I input vector 2
*/ | 346 const opus_int16 *const inVec2, /* I input vector 2
*/ |
341 const opus_int len /* I vector lengths
*/ | 347 const opus_int len, /* I vector lengths
*/ |
| 348 int arch /* I Run-time architectur
e */ |
342 ); | 349 ); |
343 | 350 |
| 351 |
344 opus_int32 silk_inner_prod_aligned_scale( | 352 opus_int32 silk_inner_prod_aligned_scale( |
345 const opus_int16 *const inVec1, /* I input vector 1
*/ | 353 const opus_int16 *const inVec1, /* I input vector 1
*/ |
346 const opus_int16 *const inVec2, /* I input vector 2
*/ | 354 const opus_int16 *const inVec2, /* I input vector 2
*/ |
347 const opus_int scale, /* I number of bits to sh
ift */ | 355 const opus_int scale, /* I number of bits to sh
ift */ |
348 const opus_int len /* I vector lengths
*/ | 356 const opus_int len /* I vector lengths
*/ |
349 ); | 357 ); |
350 | 358 |
351 opus_int64 silk_inner_prod16_aligned_64( | 359 opus_int64 silk_inner_prod16_aligned_64_c( |
352 const opus_int16 *inVec1, /* I input vector 1
*/ | 360 const opus_int16 *inVec1, /* I input vector 1
*/ |
353 const opus_int16 *inVec2, /* I input vector 2
*/ | 361 const opus_int16 *inVec2, /* I input vector 2
*/ |
354 const opus_int len /* I vector lengths
*/ | 362 const opus_int len /* I vector lengths
*/ |
355 ); | 363 ); |
356 | 364 |
357 /********************************************************************/ | 365 /********************************************************************/ |
358 /* MACROS */ | 366 /* MACROS */ |
359 /********************************************************************/ | 367 /********************************************************************/ |
360 | 368 |
361 /* Rotate a32 right by 'rot' bits. Negative rot values result in rotating | 369 /* Rotate a32 right by 'rot' bits. Negative rot values result in rotating |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 | 576 |
569 /* Add some multiplication functions that can be easily mapped to ARM. */ | 577 /* Add some multiplication functions that can be easily mapped to ARM. */ |
570 | 578 |
571 /* silk_SMMUL: Signed top word multiply. | 579 /* silk_SMMUL: Signed top word multiply. |
572 ARMv6 2 instruction cycles. | 580 ARMv6 2 instruction cycles. |
573 ARMv3M+ 3 instruction cycles. use SMULL and ignore LSB registers.
(except xM)*/ | 581 ARMv3M+ 3 instruction cycles. use SMULL and ignore LSB registers.
(except xM)*/ |
574 /*#define silk_SMMUL(a32, b32) (opus_int32)silk_RSHIFT(silk_SMLAL
(silk_SMULWB((a32), (b32)), (a32), silk_RSHIFT_ROUND((b32), 16)), 16)*/ | 582 /*#define silk_SMMUL(a32, b32) (opus_int32)silk_RSHIFT(silk_SMLAL
(silk_SMULWB((a32), (b32)), (a32), silk_RSHIFT_ROUND((b32), 16)), 16)*/ |
575 /* the following seems faster on x86 */ | 583 /* the following seems faster on x86 */ |
576 #define silk_SMMUL(a32, b32) (opus_int32)silk_RSHIFT64(silk_SMULL
((a32), (b32)), 32) | 584 #define silk_SMMUL(a32, b32) (opus_int32)silk_RSHIFT64(silk_SMULL
((a32), (b32)), 32) |
577 | 585 |
| 586 #if !defined(OPUS_X86_MAY_HAVE_SSE4_1) |
| 587 #define silk_burg_modified(res_nrg, res_nrg_Q, A_Q16, x, minInvGain_Q30, subfr_l
ength, nb_subfr, D, arch) \ |
| 588 ((void)(arch), silk_burg_modified_c(res_nrg, res_nrg_Q, A_Q16, x, minInvGain
_Q30, subfr_length, nb_subfr, D, arch)) |
| 589 |
| 590 #define silk_inner_prod16_aligned_64(inVec1, inVec2, len, arch) \ |
| 591 ((void)(arch),silk_inner_prod16_aligned_64_c(inVec1, inVec2, len)) |
| 592 #endif |
| 593 |
578 #include "Inlines.h" | 594 #include "Inlines.h" |
579 #include "MacroCount.h" | 595 #include "MacroCount.h" |
580 #include "MacroDebug.h" | 596 #include "MacroDebug.h" |
581 | 597 |
582 #ifdef OPUS_ARM_INLINE_ASM | 598 #ifdef OPUS_ARM_INLINE_ASM |
583 #include "arm/SigProc_FIX_armv4.h" | 599 #include "arm/SigProc_FIX_armv4.h" |
584 #endif | 600 #endif |
585 | 601 |
586 #ifdef OPUS_ARM_INLINE_EDSP | 602 #ifdef OPUS_ARM_INLINE_EDSP |
587 #include "arm/SigProc_FIX_armv5e.h" | 603 #include "arm/SigProc_FIX_armv5e.h" |
588 #endif | 604 #endif |
589 | 605 |
| 606 #if defined(MIPSr1_ASM) |
| 607 #include "mips/sigproc_fix_mipsr1.h" |
| 608 #endif |
| 609 |
| 610 |
590 #ifdef __cplusplus | 611 #ifdef __cplusplus |
591 } | 612 } |
592 #endif | 613 #endif |
593 | 614 |
594 #endif /* SILK_SIGPROC_FIX_H */ | 615 #endif /* SILK_SIGPROC_FIX_H */ |
OLD | NEW |