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

Side by Side Diff: third_party/opus/src/celt/arch.h

Issue 2962373002: [Opus] Update to v1.2.1 (Closed)
Patch Set: Pre-increment instead of post-increment Created 3 years, 5 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
« no previous file with comments | « third_party/opus/src/celt/_kiss_fft_guts.h ('k') | third_party/opus/src/celt/arm/arm2gnu.pl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* Copyright (c) 2003-2008 Jean-Marc Valin 1 /* Copyright (c) 2003-2008 Jean-Marc Valin
2 Copyright (c) 2007-2008 CSIRO 2 Copyright (c) 2007-2008 CSIRO
3 Copyright (c) 2007-2009 Xiph.Org Foundation 3 Copyright (c) 2007-2009 Xiph.Org Foundation
4 Written by Jean-Marc Valin */ 4 Written by Jean-Marc Valin */
5 /** 5 /**
6 @file arch.h 6 @file arch.h
7 @brief Various architecture definitions for CELT 7 @brief Various architecture definitions for CELT
8 */ 8 */
9 /* 9 /*
10 Redistribution and use in source and binary forms, with or without 10 Redistribution and use in source and binary forms, with or without
(...skipping 28 matching lines...) Expand all
39 39
40 # if !defined(__GNUC_PREREQ) 40 # if !defined(__GNUC_PREREQ)
41 # if defined(__GNUC__)&&defined(__GNUC_MINOR__) 41 # if defined(__GNUC__)&&defined(__GNUC_MINOR__)
42 # define __GNUC_PREREQ(_maj,_min) \ 42 # define __GNUC_PREREQ(_maj,_min) \
43 ((__GNUC__<<16)+__GNUC_MINOR__>=((_maj)<<16)+(_min)) 43 ((__GNUC__<<16)+__GNUC_MINOR__>=((_maj)<<16)+(_min))
44 # else 44 # else
45 # define __GNUC_PREREQ(_maj,_min) 0 45 # define __GNUC_PREREQ(_maj,_min) 0
46 # endif 46 # endif
47 # endif 47 # endif
48 48
49 #if OPUS_GNUC_PREREQ(3, 0)
50 #define opus_likely(x) (__builtin_expect(!!(x), 1))
51 #define opus_unlikely(x) (__builtin_expect(!!(x), 0))
52 #else
53 #define opus_likely(x) (!!(x))
54 #define opus_unlikely(x) (!!(x))
55 #endif
56
49 #define CELT_SIG_SCALE 32768.f 57 #define CELT_SIG_SCALE 32768.f
50 58
51 #define celt_fatal(str) _celt_fatal(str, __FILE__, __LINE__); 59 #define celt_fatal(str) _celt_fatal(str, __FILE__, __LINE__);
52 #ifdef ENABLE_ASSERTIONS 60 #ifdef ENABLE_ASSERTIONS
53 #include <stdio.h> 61 #include <stdio.h>
54 #include <stdlib.h> 62 #include <stdlib.h>
55 #ifdef __GNUC__ 63 #ifdef __GNUC__
56 __attribute__((noreturn)) 64 __attribute__((noreturn))
57 #endif 65 #endif
58 static OPUS_INLINE void _celt_fatal(const char *str, const char *file, int line) 66 static OPUS_INLINE void _celt_fatal(const char *str, const char *file, int line)
(...skipping 27 matching lines...) Expand all
86 #else 94 #else
87 #define OPUS_FAST_INT64 0 95 #define OPUS_FAST_INT64 0
88 #endif 96 #endif
89 97
90 #define PRINT_MIPS(file) 98 #define PRINT_MIPS(file)
91 99
92 #ifdef FIXED_POINT 100 #ifdef FIXED_POINT
93 101
94 typedef opus_int16 opus_val16; 102 typedef opus_int16 opus_val16;
95 typedef opus_int32 opus_val32; 103 typedef opus_int32 opus_val32;
104 typedef opus_int64 opus_val64;
96 105
97 typedef opus_val32 celt_sig; 106 typedef opus_val32 celt_sig;
98 typedef opus_val16 celt_norm; 107 typedef opus_val16 celt_norm;
99 typedef opus_val32 celt_ener; 108 typedef opus_val32 celt_ener;
100 109
101 #define Q15ONE 32767 110 #define Q15ONE 32767
102 111
103 #define SIG_SHIFT 12 112 #define SIG_SHIFT 12
113 /* Safe saturation value for 32-bit signals. Should be less than
114 2^31*(1-0.85) to avoid blowing up on DC at deemphasis.*/
115 #define SIG_SAT (300000000)
104 116
105 #define NORM_SCALING 16384 117 #define NORM_SCALING 16384
106 118
107 #define DB_SHIFT 10 119 #define DB_SHIFT 10
108 120
109 #define EPSILON 1 121 #define EPSILON 1
110 #define VERY_SMALL 0 122 #define VERY_SMALL 0
111 #define VERY_LARGE16 ((opus_val16)32767) 123 #define VERY_LARGE16 ((opus_val16)32767)
112 #define Q15_ONE ((opus_val16)32767) 124 #define Q15_ONE ((opus_val16)32767)
113 125
(...skipping 26 matching lines...) Expand all
140 #elif defined (TI_C6X_ASM) 152 #elif defined (TI_C6X_ASM)
141 #include "fixed_c6x.h" 153 #include "fixed_c6x.h"
142 #endif 154 #endif
143 155
144 #endif 156 #endif
145 157
146 #else /* FIXED_POINT */ 158 #else /* FIXED_POINT */
147 159
148 typedef float opus_val16; 160 typedef float opus_val16;
149 typedef float opus_val32; 161 typedef float opus_val32;
162 typedef float opus_val64;
150 163
151 typedef float celt_sig; 164 typedef float celt_sig;
152 typedef float celt_norm; 165 typedef float celt_norm;
153 typedef float celt_ener; 166 typedef float celt_ener;
154 167
155 #ifdef FLOAT_APPROX 168 #ifdef FLOAT_APPROX
156 /* This code should reliably detect NaN/inf even when -ffast-math is used. 169 /* This code should reliably detect NaN/inf even when -ffast-math is used.
157 Assumes IEEE 754 format. */ 170 Assumes IEEE 754 format. */
158 static OPUS_INLINE int celt_isnan(float x) 171 static OPUS_INLINE int celt_isnan(float x)
159 { 172 {
(...skipping 19 matching lines...) Expand all
179 192
180 /* This appears to be the same speed as C99's fabsf() but it's more portable. */ 193 /* This appears to be the same speed as C99's fabsf() but it's more portable. */
181 #define ABS16(x) ((float)fabs(x)) 194 #define ABS16(x) ((float)fabs(x))
182 #define ABS32(x) ((float)fabs(x)) 195 #define ABS32(x) ((float)fabs(x))
183 196
184 #define QCONST16(x,bits) (x) 197 #define QCONST16(x,bits) (x)
185 #define QCONST32(x,bits) (x) 198 #define QCONST32(x,bits) (x)
186 199
187 #define NEG16(x) (-(x)) 200 #define NEG16(x) (-(x))
188 #define NEG32(x) (-(x)) 201 #define NEG32(x) (-(x))
202 #define NEG32_ovflw(x) (-(x))
189 #define EXTRACT16(x) (x) 203 #define EXTRACT16(x) (x)
190 #define EXTEND32(x) (x) 204 #define EXTEND32(x) (x)
191 #define SHR16(a,shift) (a) 205 #define SHR16(a,shift) (a)
192 #define SHL16(a,shift) (a) 206 #define SHL16(a,shift) (a)
193 #define SHR32(a,shift) (a) 207 #define SHR32(a,shift) (a)
194 #define SHL32(a,shift) (a) 208 #define SHL32(a,shift) (a)
195 #define PSHR32(a,shift) (a) 209 #define PSHR32(a,shift) (a)
196 #define VSHR32(a,shift) (a) 210 #define VSHR32(a,shift) (a)
197 211
198 #define PSHR(a,shift) (a) 212 #define PSHR(a,shift) (a)
199 #define SHR(a,shift) (a) 213 #define SHR(a,shift) (a)
200 #define SHL(a,shift) (a) 214 #define SHL(a,shift) (a)
201 #define SATURATE(x,a) (x) 215 #define SATURATE(x,a) (x)
202 #define SATURATE16(x) (x) 216 #define SATURATE16(x) (x)
203 217
204 #define ROUND16(a,shift) (a) 218 #define ROUND16(a,shift) (a)
219 #define SROUND16(a,shift) (a)
205 #define HALF16(x) (.5f*(x)) 220 #define HALF16(x) (.5f*(x))
206 #define HALF32(x) (.5f*(x)) 221 #define HALF32(x) (.5f*(x))
207 222
208 #define ADD16(a,b) ((a)+(b)) 223 #define ADD16(a,b) ((a)+(b))
209 #define SUB16(a,b) ((a)-(b)) 224 #define SUB16(a,b) ((a)-(b))
210 #define ADD32(a,b) ((a)+(b)) 225 #define ADD32(a,b) ((a)+(b))
211 #define SUB32(a,b) ((a)-(b)) 226 #define SUB32(a,b) ((a)-(b))
227 #define ADD32_ovflw(a,b) ((a)+(b))
228 #define SUB32_ovflw(a,b) ((a)-(b))
212 #define MULT16_16_16(a,b) ((a)*(b)) 229 #define MULT16_16_16(a,b) ((a)*(b))
213 #define MULT16_16(a,b) ((opus_val32)(a)*(opus_val32)(b)) 230 #define MULT16_16(a,b) ((opus_val32)(a)*(opus_val32)(b))
214 #define MAC16_16(c,a,b) ((c)+(opus_val32)(a)*(opus_val32)(b)) 231 #define MAC16_16(c,a,b) ((c)+(opus_val32)(a)*(opus_val32)(b))
215 232
216 #define MULT16_32_Q15(a,b) ((a)*(b)) 233 #define MULT16_32_Q15(a,b) ((a)*(b))
217 #define MULT16_32_Q16(a,b) ((a)*(b)) 234 #define MULT16_32_Q16(a,b) ((a)*(b))
218 235
219 #define MULT32_32_Q31(a,b) ((a)*(b)) 236 #define MULT32_32_Q31(a,b) ((a)*(b))
220 237
221 #define MAC16_32_Q15(c,a,b) ((c)+(a)*(b)) 238 #define MAC16_32_Q15(c,a,b) ((c)+(a)*(b))
(...skipping 14 matching lines...) Expand all
236 253
237 #define SCALEIN(a) ((a)*CELT_SIG_SCALE) 254 #define SCALEIN(a) ((a)*CELT_SIG_SCALE)
238 #define SCALEOUT(a) ((a)*(1/CELT_SIG_SCALE)) 255 #define SCALEOUT(a) ((a)*(1/CELT_SIG_SCALE))
239 256
240 #define SIG2WORD16(x) (x) 257 #define SIG2WORD16(x) (x)
241 258
242 #endif /* !FIXED_POINT */ 259 #endif /* !FIXED_POINT */
243 260
244 #ifndef GLOBAL_STACK_SIZE 261 #ifndef GLOBAL_STACK_SIZE
245 #ifdef FIXED_POINT 262 #ifdef FIXED_POINT
246 #define GLOBAL_STACK_SIZE 100000 263 #define GLOBAL_STACK_SIZE 120000
247 #else 264 #else
248 #define GLOBAL_STACK_SIZE 100000 265 #define GLOBAL_STACK_SIZE 120000
249 #endif 266 #endif
250 #endif 267 #endif
251 268
252 #endif /* ARCH_H */ 269 #endif /* ARCH_H */
OLDNEW
« no previous file with comments | « third_party/opus/src/celt/_kiss_fft_guts.h ('k') | third_party/opus/src/celt/arm/arm2gnu.pl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698