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 12 matching lines...) Expand all Loading... |
23 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 23 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
24 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 24 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
25 POSSIBILITY OF SUCH DAMAGE. | 25 POSSIBILITY OF SUCH DAMAGE. |
26 ***********************************************************************/ | 26 ***********************************************************************/ |
27 | 27 |
28 #ifdef HAVE_CONFIG_H | 28 #ifdef HAVE_CONFIG_H |
29 #include "config.h" | 29 #include "config.h" |
30 #endif | 30 #endif |
31 | 31 |
32 #include "SigProc_FIX.h" | 32 #include "SigProc_FIX.h" |
| 33 #include "pitch.h" |
33 | 34 |
34 /* Copy and multiply a vector by a constant */ | 35 /* Copy and multiply a vector by a constant */ |
35 void silk_scale_copy_vector16( | 36 void silk_scale_copy_vector16( |
36 opus_int16 *data_out, | 37 opus_int16 *data_out, |
37 const opus_int16 *data_in, | 38 const opus_int16 *data_in, |
38 opus_int32 gain_Q16, /* I Gain in Q16
*/ | 39 opus_int32 gain_Q16, /* I Gain in Q16
*/ |
39 const opus_int dataSize /* I Length
*/ | 40 const opus_int dataSize /* I Length
*/ |
40 ) | 41 ) |
41 { | 42 { |
42 opus_int i; | 43 opus_int i; |
(...skipping 20 matching lines...) Expand all Loading... |
63 } | 64 } |
64 | 65 |
65 /* sum = for(i=0;i<len;i++)inVec1[i]*inVec2[i]; --- inner product
*/ | 66 /* sum = for(i=0;i<len;i++)inVec1[i]*inVec2[i]; --- inner product
*/ |
66 /* Note for ARM asm:
*/ | 67 /* Note for ARM asm:
*/ |
67 /* * inVec1 and inVec2 should be at least 2 byte aligned.
*/ | 68 /* * inVec1 and inVec2 should be at least 2 byte aligned.
*/ |
68 /* * len should be positive 16bit integer.
*/ | 69 /* * len should be positive 16bit integer.
*/ |
69 /* * only when len>6, memory access can be reduced by half.
*/ | 70 /* * only when len>6, memory access can be reduced by half.
*/ |
70 opus_int32 silk_inner_prod_aligned( | 71 opus_int32 silk_inner_prod_aligned( |
71 const opus_int16 *const inVec1, /* I input vector 1
*/ | 72 const opus_int16 *const inVec1, /* I input vector 1
*/ |
72 const opus_int16 *const inVec2, /* I input vector 2
*/ | 73 const opus_int16 *const inVec2, /* I input vector 2
*/ |
73 const opus_int len /* I vector lengths
*/ | 74 const opus_int len, /* I vector lengths
*/ |
| 75 int arch /* I Run-time architectur
e */ |
74 ) | 76 ) |
75 { | 77 { |
| 78 #ifdef FIXED_POINT |
| 79 return celt_inner_prod(inVec1, inVec2, len, arch); |
| 80 #else |
76 opus_int i; | 81 opus_int i; |
77 opus_int32 sum = 0; | 82 opus_int32 sum = 0; |
78 for( i = 0; i < len; i++ ) { | 83 for( i = 0; i < len; i++ ) { |
79 sum = silk_SMLABB( sum, inVec1[ i ], inVec2[ i ] ); | 84 sum = silk_SMLABB( sum, inVec1[ i ], inVec2[ i ] ); |
80 } | 85 } |
81 return sum; | 86 return sum; |
| 87 #endif |
82 } | 88 } |
83 | 89 |
84 opus_int64 silk_inner_prod16_aligned_64( | 90 opus_int64 silk_inner_prod16_aligned_64_c( |
85 const opus_int16 *inVec1, /* I input vector 1
*/ | 91 const opus_int16 *inVec1, /* I input vector 1
*/ |
86 const opus_int16 *inVec2, /* I input vector 2
*/ | 92 const opus_int16 *inVec2, /* I input vector 2
*/ |
87 const opus_int len /* I vector lengths
*/ | 93 const opus_int len /* I vector lengths
*/ |
88 ) | 94 ) |
89 { | 95 { |
90 opus_int i; | 96 opus_int i; |
91 opus_int64 sum = 0; | 97 opus_int64 sum = 0; |
92 for( i = 0; i < len; i++ ) { | 98 for( i = 0; i < len; i++ ) { |
93 sum = silk_SMLALBB( sum, inVec1[ i ], inVec2[ i ] ); | 99 sum = silk_SMLALBB( sum, inVec1[ i ], inVec2[ i ] ); |
94 } | 100 } |
95 return sum; | 101 return sum; |
96 } | 102 } |
OLD | NEW |