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

Side by Side Diff: silk/macros.h

Issue 28553003: Updating Opus to a pre-release of 1.1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/opus
Patch Set: Removing failing file Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « silk/log2lin.c ('k') | silk/main.h » ('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.
11 - Neither the name of Internet Society, IETF or IETF Trust, nor the 11 - Neither the name of Internet Society, IETF or IETF Trust, nor the
12 names of specific contributors, may be used to endorse or promote 12 names of specific contributors, may be used to endorse or promote
13 products derived from this software without specific prior written 13 products derived from this software without specific prior written
14 permission. 14 permission.
15 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS 15 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 18 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
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.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 69
70 /* add/subtract with output saturated */ 70 /* add/subtract with output saturated */
71 #define silk_ADD_SAT32(a, b) ((((opus_uint32)(a) + (opus_uint32)(b)) & 0x80000000) == 0 ? \ 71 #define silk_ADD_SAT32(a, b) ((((opus_uint32)(a) + (opus_uint32)(b)) & 0x80000000) == 0 ? \
72 ((((a) & (b)) & 0x80000000) != 0 ? silk_ int32_MIN : (a)+(b)) : \ 72 ((((a) & (b)) & 0x80000000) != 0 ? silk_ int32_MIN : (a)+(b)) : \
73 ((((a) | (b)) & 0x80000000) == 0 ? silk_ int32_MAX : (a)+(b)) ) 73 ((((a) | (b)) & 0x80000000) == 0 ? silk_ int32_MAX : (a)+(b)) )
74 74
75 #define silk_SUB_SAT32(a, b) ((((opus_uint32)(a)-(opus_uint32)(b)) & 0x80000000) == 0 ? \ 75 #define silk_SUB_SAT32(a, b) ((((opus_uint32)(a)-(opus_uint32)(b)) & 0x80000000) == 0 ? \
76 (( (a) & ((b)^0x80000000) & 0x80000000) ? silk_int32_MIN : (a)-(b)) : \ 76 (( (a) & ((b)^0x80000000) & 0x80000000) ? silk_int32_MIN : (a)-(b)) : \
77 ((((a)^0x80000000) & (b) & 0x80000000) ? silk_int32_MAX : (a)-(b)) ) 77 ((((a)^0x80000000) & (b) & 0x80000000) ? silk_int32_MAX : (a)-(b)) )
78 78
79 #include "ecintrin.h"
80
79 static inline opus_int32 silk_CLZ16(opus_int16 in16) 81 static inline opus_int32 silk_CLZ16(opus_int16 in16)
80 { 82 {
81 opus_int32 out32 = 0; 83 return 32 - EC_ILOG(in16<<16|0x8000);
82 if( in16 == 0 ) {
83 return 16;
84 }
85 /* test nibbles */
86 if( in16 & 0xFF00 ) {
87 if( in16 & 0xF000 ) {
88 in16 >>= 12;
89 } else {
90 out32 += 4;
91 in16 >>= 8;
92 }
93 } else {
94 if( in16 & 0xFFF0 ) {
95 out32 += 8;
96 in16 >>= 4;
97 } else {
98 out32 += 12;
99 }
100 }
101 /* test bits and return */
102 if( in16 & 0xC ) {
103 if( in16 & 0x8 )
104 return out32 + 0;
105 else
106 return out32 + 1;
107 } else {
108 if( in16 & 0xE )
109 return out32 + 2;
110 else
111 return out32 + 3;
112 }
113 } 84 }
114 85
115 static inline opus_int32 silk_CLZ32(opus_int32 in32) 86 static inline opus_int32 silk_CLZ32(opus_int32 in32)
116 { 87 {
117 /* test highest 16 bits and convert to opus_int16 */ 88 return in32 ? 32 - EC_ILOG(in32) : 32;
118 if( in32 & 0xFFFF0000 ) {
119 return silk_CLZ16((opus_int16)(in32 >> 16));
120 } else {
121 return silk_CLZ16((opus_int16)in32) + 16;
122 }
123 } 89 }
124 90
125 /* Row based */ 91 /* Row based */
126 #define matrix_ptr(Matrix_base_adr, row, column, N) *(Matrix_base_adr + ((row)*(N)+(column))) 92 #define matrix_ptr(Matrix_base_adr, row, column, N) \
127 #define matrix_adr(Matrix_base_adr, row, column, N) (Matrix_base_adr + ((row)*(N)+(column))) 93 (*((Matrix_base_adr) + ((row)*(N)+(column))))
94 #define matrix_adr(Matrix_base_adr, row, column, N) \
95 ((Matrix_base_adr) + ((row)*(N)+(column)))
128 96
129 /* Column based */ 97 /* Column based */
130 #ifndef matrix_c_ptr 98 #ifndef matrix_c_ptr
131 # define matrix_c_ptr(Matrix_base_adr, row, column, M) *(Matrix_base_adr + ((row)+(M)*(column))) 99 # define matrix_c_ptr(Matrix_base_adr, row, column, M) \
100 (*((Matrix_base_adr) + ((row)+(M)*(column))))
101 #endif
102
103 #ifdef ARMv4_ASM
104 #include "arm/macros_armv4.h"
105 #endif
106
107 #ifdef ARMv5E_ASM
108 #include "arm/macros_armv5e.h"
132 #endif 109 #endif
133 110
134 #endif /* SILK_MACROS_H */ 111 #endif /* SILK_MACROS_H */
135 112
OLDNEW
« no previous file with comments | « silk/log2lin.c ('k') | silk/main.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698