Line | Count | Source (jump to first uncovered line) |
1 | | /* Copyright (c) 2003-2008 Jean-Marc Valin |
2 | | Copyright (c) 2007-2008 CSIRO |
3 | | Copyright (c) 2007-2009 Xiph.Org Foundation |
4 | | Written by Jean-Marc Valin */ |
5 | | /** |
6 | | @file arch.h |
7 | | @brief Various architecture definitions for CELT |
8 | | */ |
9 | | /* |
10 | | Redistribution and use in source and binary forms, with or without |
11 | | modification, are permitted provided that the following conditions |
12 | | are met: |
13 | | |
14 | | - Redistributions of source code must retain the above copyright |
15 | | notice, this list of conditions and the following disclaimer. |
16 | | |
17 | | - Redistributions in binary form must reproduce the above copyright |
18 | | notice, this list of conditions and the following disclaimer in the |
19 | | documentation and/or other materials provided with the distribution. |
20 | | |
21 | | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
22 | | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
23 | | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
24 | | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER |
25 | | OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
26 | | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
27 | | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
28 | | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
29 | | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
30 | | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
31 | | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
32 | | */ |
33 | | |
34 | | #ifndef ARCH_H |
35 | | #define ARCH_H |
36 | | |
37 | | #include "opus_types.h" |
38 | | #include "opus_defines.h" |
39 | | |
40 | | # if !defined(__GNUC_PREREQ) |
41 | | # if defined(__GNUC__)&&defined(__GNUC_MINOR__) |
42 | | # define __GNUC_PREREQ(_maj,_min) \ |
43 | | ((__GNUC__<<16)+__GNUC_MINOR__>=((_maj)<<16)+(_min)) |
44 | | # else |
45 | | # define __GNUC_PREREQ(_maj,_min) 0 |
46 | | # endif |
47 | | # endif |
48 | | |
49 | | #if OPUS_GNUC_PREREQ(3, 0) |
50 | 7.51G | #define opus_likely(x) (__builtin_expect(!!(x), 1)) |
51 | 56.9M | #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 | | |
57 | 52.8G | #define CELT_SIG_SCALE 32768.f |
58 | | |
59 | 0 | #define CELT_FATAL(str) celt_fatal(str, __FILE__, __LINE__) |
60 | | |
61 | | #if defined(ENABLE_ASSERTIONS) || defined(ENABLE_HARDENING) |
62 | | #ifdef __GNUC__ |
63 | | __attribute__((noreturn)) |
64 | | #endif |
65 | | void celt_fatal(const char *str, const char *file, int line); |
66 | | |
67 | | #if defined(CELT_C) && !defined(OVERRIDE_celt_fatal) |
68 | | #include <stdio.h> |
69 | | #include <stdlib.h> |
70 | | #ifdef __GNUC__ |
71 | | __attribute__((noreturn)) |
72 | | #endif |
73 | | void celt_fatal(const char *str, const char *file, int line) |
74 | 0 | { |
75 | 0 | fprintf (stderr, "Fatal (internal) error in %s, line %d: %s\n", file, line, str); |
76 | | #if defined(_MSC_VER) |
77 | | _set_abort_behavior( 0, _WRITE_ABORT_MSG); |
78 | | #endif |
79 | 0 | abort(); |
80 | 0 | } |
81 | | #endif |
82 | | |
83 | 17.5G | #define celt_assert(cond) {if (!(cond)) {CELT_FATAL("assertion failed: " #cond);}} |
84 | 163M | #define celt_assert2(cond, message) {if (!(cond)) {CELT_FATAL("assertion failed: " #cond "\n" message);}} |
85 | 2.36M | #define MUST_SUCCEED(call) celt_assert((call) == OPUS_OK) |
86 | | #else |
87 | | #define celt_assert(cond) |
88 | | #define celt_assert2(cond, message) |
89 | | #define MUST_SUCCEED(call) do {if((call) != OPUS_OK) {RESTORE_STACK; return OPUS_INTERNAL_ERROR;} } while (0) |
90 | | #endif |
91 | | |
92 | | #if defined(ENABLE_ASSERTIONS) |
93 | 2.89G | #define celt_sig_assert(cond) {if (!(cond)) {CELT_FATAL("signal assertion failed: " #cond);}} |
94 | | #else |
95 | | #define celt_sig_assert(cond) |
96 | | #endif |
97 | | |
98 | 3.82G | #define IMUL32(a,b) ((a)*(b)) |
99 | | |
100 | 55.3G | #define MIN16(a,b) ((a) < (b) ? (a) : (b)) /**< Minimum 16-bit value. */ |
101 | 70.7G | #define MAX16(a,b) ((a) > (b) ? (a) : (b)) /**< Maximum 16-bit value. */ |
102 | 14.2G | #define MIN32(a,b) ((a) < (b) ? (a) : (b)) /**< Minimum 32-bit value. */ |
103 | 29.9G | #define MAX32(a,b) ((a) > (b) ? (a) : (b)) /**< Maximum 32-bit value. */ |
104 | 13.2G | #define IMIN(a,b) ((a) < (b) ? (a) : (b)) /**< Minimum int value. */ |
105 | 10.1G | #define IMAX(a,b) ((a) > (b) ? (a) : (b)) /**< Maximum int value. */ |
106 | 103M | #define FMIN(a,b) ((a) < (b) ? (a) : (b)) /**< Minimum float value. */ |
107 | 103M | #define FMAX(a,b) ((a) > (b) ? (a) : (b)) /**< Maximum float value. */ |
108 | | #define UADD32(a,b) ((a)+(b)) |
109 | | #define USUB32(a,b) ((a)-(b)) |
110 | 10.6G | #define MAXG(a,b) MAX32(a, b) |
111 | 1.05G | #define MING(a,b) MIN32(a, b) |
112 | | |
113 | | /* Throughout the code, we use the following scaling for signals: |
114 | | FLOAT: used for float API, normalized to +/-1. |
115 | | INT16: used for 16-bit API, normalized to +/- 32768 |
116 | | RES: internal Opus resolution, defined as +/-1. in float builds, or either 16-bit or 24-bit int for fixed-point builds |
117 | | SIG: internal CELT resolution: defined as +/- 32768. in float builds, or Q27 in fixed-point builds (int16 shifted by 12) |
118 | | */ |
119 | | |
120 | | |
121 | | /* Set this if opus_int64 is a native type of the CPU. */ |
122 | | /* Assume that all LP64 architectures have fast 64-bit types; also x86_64 |
123 | | (which can be ILP32 for x32) and Win64 (which is LLP64). */ |
124 | | #if defined(__x86_64__) || defined(__LP64__) || defined(_WIN64) |
125 | | #define OPUS_FAST_INT64 1 |
126 | | #else |
127 | | #define OPUS_FAST_INT64 0 |
128 | | #endif |
129 | | |
130 | | #ifdef FIXED_POINT |
131 | 2.73M | #define ARG_FIXED(arg) , arg |
132 | | #else |
133 | | #define ARG_FIXED(arg) |
134 | | #endif |
135 | | |
136 | | #define PRINT_MIPS(file) |
137 | | |
138 | | #ifdef FIXED_POINT |
139 | | |
140 | | typedef opus_int16 opus_val16; |
141 | | typedef opus_int32 opus_val32; |
142 | | typedef opus_int64 opus_val64; |
143 | | |
144 | | typedef opus_val32 celt_sig; |
145 | | typedef opus_val32 celt_norm; |
146 | | typedef opus_val32 celt_ener; |
147 | | typedef opus_val32 celt_glog; |
148 | | |
149 | | #ifdef ENABLE_RES24 |
150 | | typedef opus_val32 opus_res; |
151 | | #define RES_SHIFT 8 |
152 | 32.5M | #define SIG2RES(a) PSHR32(a, SIG_SHIFT-RES_SHIFT) |
153 | 12.0G | #define RES2INT16(a) SAT16(PSHR32(a, RES_SHIFT)) |
154 | 0 | #define RES2INT24(a) (a) |
155 | 63.1M | #define RES2FLOAT(a) ((1.f/32768.f/256.)*(a)) |
156 | 26.0G | #define INT16TORES(a) SHL32(EXTEND32(a), RES_SHIFT) |
157 | 0 | #define INT24TORES(a) (a) |
158 | 9.13M | #define ADD_RES(a, b) ADD32(a, b) |
159 | 0 | #define FLOAT2RES(a) float2int(32768.f*256.f*(a)) |
160 | 24.6M | #define RES2SIG(a) SHL32((a), SIG_SHIFT-RES_SHIFT) |
161 | 3.24G | #define MULT16_RES_Q15(a,b) MULT16_32_Q15(a,b) |
162 | 0 | #define MAX_ENCODING_DEPTH 24 |
163 | | #else |
164 | | typedef opus_val16 opus_res; |
165 | | #define RES_SHIFT 0 |
166 | 23.2M | #define SIG2RES(a) SIG2WORD16(a) |
167 | 11.9G | #define RES2INT16(a) (a) |
168 | 0 | #define RES2INT24(a) SHL32(EXTEND32(a), 8) |
169 | 0 | #define RES2FLOAT(a) ((1.f/32768.f)*(a)) |
170 | 333M | #define INT16TORES(a) (a) |
171 | 0 | #define INT24TORES(a) SAT16(PSHR32(a, 8)) |
172 | 7.96M | #define ADD_RES(a, b) SAT16(ADD32((a), (b))); |
173 | | #define FLOAT2RES(a) FLOAT2INT16(a) |
174 | 21.1M | #define RES2SIG(a) SHL32(EXTEND32(a), SIG_SHIFT) |
175 | 3.24G | #define MULT16_RES_Q15(a,b) MULT16_16_Q15(a,b) |
176 | 0 | #define MAX_ENCODING_DEPTH 16 |
177 | | #endif |
178 | | |
179 | 116M | #define RES2VAL16(a) RES2INT16(a) |
180 | 0 | #define FLOAT2SIG(a) float2int(((opus_int32)32768<<SIG_SHIFT)*(a)) |
181 | 10.6G | #define INT16TOSIG(a) SHL32(EXTEND32(a), SIG_SHIFT) |
182 | 0 | #define INT24TOSIG(a) SHL32(a, SIG_SHIFT-8) |
183 | | |
184 | 145M | #define NORM_SHIFT 24 |
185 | | #ifdef ENABLE_QEXT |
186 | | typedef opus_val32 celt_coef; |
187 | | #define COEF_ONE Q31ONE |
188 | 24.0M | #define MULT_COEF_32(a, b) MULT32_32_P31(a,b) |
189 | | #define MAC_COEF_32_ARM(c, a, b) ADD32((c), MULT32_32_Q32(a,b)) |
190 | 7.80M | #define MULT_COEF(a, b) MULT32_32_Q31(a,b) |
191 | 322k | #define MULT_COEF_TAPS(a, b) SHL32(MULT16_16(a,b), 1) |
192 | 655M | #define COEF2VAL16(x) EXTRACT16(SHR32(x, 16)) |
193 | | #else |
194 | | typedef opus_val16 celt_coef; |
195 | | #define COEF_ONE Q15ONE |
196 | 87.2M | #define MULT_COEF_32(a, b) MULT16_32_Q15(a,b) |
197 | | #define MAC_COEF_32_ARM(a, b, c) MAC16_32_Q16(a,b,c) |
198 | 4.09M | #define MULT_COEF(a, b) MULT16_16_Q15(a,b) |
199 | 315k | #define MULT_COEF_TAPS(a, b) MULT16_16_P15(a,b) |
200 | 655M | #define COEF2VAL16(x) (x) |
201 | | #endif |
202 | | |
203 | | #define celt_isnan(x) 0 |
204 | | |
205 | 70.2M | #define Q15ONE 32767 |
206 | 874M | #define Q31ONE 2147483647 |
207 | | |
208 | 60.1M | #define SIG_SHIFT 12 |
209 | | /* Safe saturation value for 32-bit signals. We need to make sure that we can |
210 | | add two sig values and that the first stages of the MDCT don't cause an overflow. |
211 | | The most constraining is the ARM_ASM comb filter where we shift left by one |
212 | | and then add two values. Because of that, we use 2^29-1. SIG_SAT must be large |
213 | | enough to fit a full-scale high-freq tone through the prefilter and comb filter, |
214 | | meaning 1.85*1.75*2^(15+SIG_SHIFT) = 434529895. |
215 | | so the limit should be about 2^31*sqrt(.5). */ |
216 | | #define SIG_SAT (536870911) |
217 | | |
218 | 71.3M | #define NORM_SCALING (1<<NORM_SHIFT) |
219 | | |
220 | 8.34M | #define DB_SHIFT 24 |
221 | | |
222 | 4.23M | #define EPSILON 1 |
223 | | #define VERY_SMALL 0 |
224 | | #define VERY_LARGE16 ((opus_val16)32767) |
225 | | #define Q15_ONE ((opus_val16)32767) |
226 | | |
227 | | |
228 | 59.1M | #define ABS16(x) ((x) < 0 ? (-(x)) : (x)) |
229 | 275M | #define ABS32(x) ((x) < 0 ? (-(x)) : (x)) |
230 | | |
231 | 236M | static OPUS_INLINE opus_int16 SAT16(opus_int32 x) { |
232 | 236M | return x > 32767 ? 32767 : x < -32768 ? -32768 : (opus_int16)x; |
233 | 236M | } Unexecuted instantiation: repacketizer.c:SAT16 Unexecuted instantiation: celt.c:SAT16 Unexecuted instantiation: opus.c:SAT16 Unexecuted instantiation: opus_decoder.c:SAT16 Unexecuted instantiation: extensions.c:SAT16 Line | Count | Source | 231 | 7.96M | static OPUS_INLINE opus_int16 SAT16(opus_int32 x) { | 232 | 7.96M | return x > 32767 ? 32767 : x < -32768 ? -32768 : (opus_int16)x; | 233 | 7.96M | } |
Unexecuted instantiation: entcode.c:SAT16 Unexecuted instantiation: entdec.c:SAT16 Unexecuted instantiation: mathops.c:SAT16 Unexecuted instantiation: mdct.c:SAT16 Unexecuted instantiation: modes.c:SAT16 Unexecuted instantiation: pitch.c:SAT16 Unexecuted instantiation: celt_lpc.c:SAT16 Unexecuted instantiation: quant_bands.c:SAT16 Unexecuted instantiation: rate.c:SAT16 Unexecuted instantiation: vq.c:SAT16 Unexecuted instantiation: x86cpu.c:SAT16 Unexecuted instantiation: x86_celt_map.c:SAT16 Unexecuted instantiation: pitch_sse2.c:SAT16 Unexecuted instantiation: celt_lpc_sse4_1.c:SAT16 Unexecuted instantiation: pitch_sse4_1.c:SAT16 Unexecuted instantiation: dec_API.c:SAT16 Unexecuted instantiation: tables_other.c:SAT16 Unexecuted instantiation: stereo_MS_to_LR.c:SAT16 Unexecuted instantiation: resampler.c:SAT16 Unexecuted instantiation: resampler_private_down_FIR.c:SAT16 Unexecuted instantiation: resampler_private_IIR_FIR.c:SAT16 Unexecuted instantiation: resampler_private_up2_HQ.c:SAT16 Unexecuted instantiation: resampler_rom.c:SAT16 Unexecuted instantiation: stereo_decode_pred.c:SAT16 Unexecuted instantiation: bands.c:SAT16 Unexecuted instantiation: cwrs.c:SAT16 Unexecuted instantiation: entenc.c:SAT16 Unexecuted instantiation: kiss_fft.c:SAT16 Unexecuted instantiation: laplace.c:SAT16 Unexecuted instantiation: init_decoder.c:SAT16 Unexecuted instantiation: decode_frame.c:SAT16 Unexecuted instantiation: decode_parameters.c:SAT16 Unexecuted instantiation: decode_indices.c:SAT16 Unexecuted instantiation: decode_pulses.c:SAT16 Unexecuted instantiation: decoder_set_fs.c:SAT16 Unexecuted instantiation: gain_quant.c:SAT16 Unexecuted instantiation: NLSF_decode.c:SAT16 Unexecuted instantiation: PLC.c:SAT16 Unexecuted instantiation: shell_coder.c:SAT16 Unexecuted instantiation: tables_gain.c:SAT16 Unexecuted instantiation: tables_LTP.c:SAT16 Unexecuted instantiation: tables_NLSF_CB_NB_MB.c:SAT16 Unexecuted instantiation: tables_NLSF_CB_WB.c:SAT16 Unexecuted instantiation: tables_pitch_lag.c:SAT16 Unexecuted instantiation: tables_pulses_per_block.c:SAT16 Unexecuted instantiation: NLSF_unpack.c:SAT16 Unexecuted instantiation: bwexpander.c:SAT16 Unexecuted instantiation: decode_pitch.c:SAT16 Unexecuted instantiation: lin2log.c:SAT16 Unexecuted instantiation: log2lin.c:SAT16 Unexecuted instantiation: LPC_analysis_filter.c:SAT16 Unexecuted instantiation: LPC_inv_pred_gain.c:SAT16 Unexecuted instantiation: NLSF2A.c:SAT16 Unexecuted instantiation: NLSF_stabilize.c:SAT16 Unexecuted instantiation: pitch_est_tables.c:SAT16 Unexecuted instantiation: resampler_private_AR2.c:SAT16 Unexecuted instantiation: sort.c:SAT16 Unexecuted instantiation: sum_sqr_shift.c:SAT16 Unexecuted instantiation: LPC_fit.c:SAT16 Unexecuted instantiation: CNG.c:SAT16 Unexecuted instantiation: code_signs.c:SAT16 Unexecuted instantiation: decode_core.c:SAT16 Unexecuted instantiation: bwexpander_32.c:SAT16 Unexecuted instantiation: table_LSF_cos.c:SAT16 Unexecuted instantiation: opus_projection_encoder.c:SAT16 Line | Count | Source | 231 | 9.82M | static OPUS_INLINE opus_int16 SAT16(opus_int32 x) { | 232 | 9.82M | return x > 32767 ? 32767 : x < -32768 ? -32768 : (opus_int16)x; | 233 | 9.82M | } |
Line | Count | Source | 231 | 145M | static OPUS_INLINE opus_int16 SAT16(opus_int32 x) { | 232 | 145M | return x > 32767 ? 32767 : x < -32768 ? -32768 : (opus_int16)x; | 233 | 145M | } |
Unexecuted instantiation: opus_multistream_encoder.c:SAT16 Unexecuted instantiation: analysis.c:SAT16 Unexecuted instantiation: mlp.c:SAT16 Unexecuted instantiation: celt_encoder.c:SAT16 Line | Count | Source | 231 | 28.3M | static OPUS_INLINE opus_int16 SAT16(opus_int32 x) { | 232 | 28.3M | return x > 32767 ? 32767 : x < -32768 ? -32768 : (opus_int16)x; | 233 | 28.3M | } |
Unexecuted instantiation: encode_indices.c:SAT16 Unexecuted instantiation: encode_pulses.c:SAT16 Unexecuted instantiation: HP_variable_cutoff.c:SAT16 Unexecuted instantiation: stereo_LR_to_MS.c:SAT16 Unexecuted instantiation: check_control_input.c:SAT16 Unexecuted instantiation: control_SNR.c:SAT16 Unexecuted instantiation: init_encoder.c:SAT16 Unexecuted instantiation: control_codec.c:SAT16 Unexecuted instantiation: stereo_encode_pred.c:SAT16 Unexecuted instantiation: stereo_find_predictor.c:SAT16 Unexecuted instantiation: stereo_quant_pred.c:SAT16 Unexecuted instantiation: encode_frame_FIX.c:SAT16 Unexecuted instantiation: find_pitch_lags_FIX.c:SAT16 Unexecuted instantiation: find_pred_coefs_FIX.c:SAT16 Unexecuted instantiation: noise_shape_analysis_FIX.c:SAT16 Unexecuted instantiation: process_gains_FIX.c:SAT16 Unexecuted instantiation: residual_energy_FIX.c:SAT16 Unexecuted instantiation: warped_autocorrelation_FIX.c:SAT16 Unexecuted instantiation: apply_sine_window_FIX.c:SAT16 Unexecuted instantiation: autocorr_FIX.c:SAT16 Unexecuted instantiation: k2a_FIX.c:SAT16 Unexecuted instantiation: k2a_Q16_FIX.c:SAT16 Unexecuted instantiation: pitch_analysis_core_FIX.c:SAT16 Unexecuted instantiation: vector_ops_FIX.c:SAT16 Unexecuted instantiation: schur64_FIX.c:SAT16 Unexecuted instantiation: schur_FIX.c:SAT16 Unexecuted instantiation: x86_silk_map.c:SAT16 Unexecuted instantiation: NSQ_del_dec_avx2.c:SAT16 Unexecuted instantiation: opus_multistream.c:SAT16 Unexecuted instantiation: LP_variable_cutoff.c:SAT16 Unexecuted instantiation: NSQ.c:SAT16 Unexecuted instantiation: NSQ_del_dec.c:SAT16 Unexecuted instantiation: VAD.c:SAT16 Unexecuted instantiation: control_audio_bandwidth.c:SAT16 Unexecuted instantiation: quant_LTP_gains.c:SAT16 Unexecuted instantiation: VQ_WMat_EC.c:SAT16 Unexecuted instantiation: process_NLSFs.c:SAT16 Unexecuted instantiation: ana_filt_bank_1.c:SAT16 Unexecuted instantiation: biquad_alt.c:SAT16 Unexecuted instantiation: inner_prod_aligned.c:SAT16 Unexecuted instantiation: NLSF_VQ_weights_laroia.c:SAT16 Unexecuted instantiation: resampler_down2_3.c:SAT16 Unexecuted instantiation: resampler_down2.c:SAT16 Unexecuted instantiation: sigm_Q15.c:SAT16 Unexecuted instantiation: LTP_analysis_filter_FIX.c:SAT16 Unexecuted instantiation: LTP_scale_ctrl_FIX.c:SAT16 Unexecuted instantiation: find_LPC_FIX.c:SAT16 Unexecuted instantiation: find_LTP_FIX.c:SAT16 Unexecuted instantiation: burg_modified_FIX.c:SAT16 Unexecuted instantiation: NSQ_sse4_1.c:SAT16 Unexecuted instantiation: NSQ_del_dec_sse4_1.c:SAT16 Unexecuted instantiation: VAD_sse4_1.c:SAT16 Unexecuted instantiation: VQ_WMat_EC_sse4_1.c:SAT16 Unexecuted instantiation: vector_ops_FIX_sse4_1.c:SAT16 Unexecuted instantiation: burg_modified_FIX_sse4_1.c:SAT16 Unexecuted instantiation: interpolate.c:SAT16 Unexecuted instantiation: NLSF_encode.c:SAT16 Unexecuted instantiation: NLSF_VQ.c:SAT16 Unexecuted instantiation: NLSF_del_dec_quant.c:SAT16 Unexecuted instantiation: A2NLSF.c:SAT16 Unexecuted instantiation: corrMatrix_FIX.c:SAT16 opus_multistream_decoder.c:SAT16 Line | Count | Source | 231 | 44.9M | static OPUS_INLINE opus_int16 SAT16(opus_int32 x) { | 232 | 44.9M | return x > 32767 ? 32767 : x < -32768 ? -32768 : (opus_int16)x; | 233 | 44.9M | } |
Unexecuted instantiation: opus_projection_decoder.c:SAT16 |
234 | | |
235 | | #ifdef FIXED_DEBUG |
236 | | #include "fixed_debug.h" |
237 | | #else |
238 | | |
239 | | #include "fixed_generic.h" |
240 | | |
241 | | #ifdef OPUS_ARM_PRESUME_AARCH64_NEON_INTR |
242 | | #include "arm/fixed_arm64.h" |
243 | | #elif defined (OPUS_ARM_INLINE_EDSP) |
244 | | #include "arm/fixed_armv5e.h" |
245 | | #elif defined (OPUS_ARM_INLINE_ASM) |
246 | | #include "arm/fixed_armv4.h" |
247 | | #elif defined (BFIN_ASM) |
248 | | #include "fixed_bfin.h" |
249 | | #elif defined (TI_C5X_ASM) |
250 | | #include "fixed_c5x.h" |
251 | | #elif defined (TI_C6X_ASM) |
252 | | #include "fixed_c6x.h" |
253 | | #endif |
254 | | |
255 | | #endif |
256 | | |
257 | | #else /* FIXED_POINT */ |
258 | | |
259 | | typedef float opus_val16; |
260 | | typedef float opus_val32; |
261 | | typedef float opus_val64; |
262 | | |
263 | | typedef float celt_sig; |
264 | | typedef float celt_norm; |
265 | | typedef float celt_ener; |
266 | | typedef float celt_glog; |
267 | | |
268 | | typedef float opus_res; |
269 | | typedef float celt_coef; |
270 | | |
271 | | #ifdef FLOAT_APPROX |
272 | | /* This code should reliably detect NaN/inf even when -ffast-math is used. |
273 | | Assumes IEEE 754 format. */ |
274 | | static OPUS_INLINE int celt_isnan(float x) |
275 | 380M | { |
276 | 380M | union {float f; opus_uint32 i;} in; |
277 | 380M | in.f = x; |
278 | 380M | return ((in.i>>23)&0xFF)==0xFF && (in.i&0x007FFFFF)!=0; |
279 | 380M | } opus_encoder.c:celt_isnan Line | Count | Source | 275 | 139M | { | 276 | 139M | union {float f; opus_uint32 i;} in; | 277 | 139M | in.f = x; | 278 | 139M | return ((in.i>>23)&0xFF)==0xFF && (in.i&0x007FFFFF)!=0; | 279 | 139M | } |
Unexecuted instantiation: repacketizer.c:celt_isnan Line | Count | Source | 275 | 13.6M | { | 276 | 13.6M | union {float f; opus_uint32 i;} in; | 277 | 13.6M | in.f = x; | 278 | 13.6M | return ((in.i>>23)&0xFF)==0xFF && (in.i&0x007FFFFF)!=0; | 279 | 13.6M | } |
Unexecuted instantiation: mlp.c:celt_isnan Unexecuted instantiation: celt.c:celt_isnan celt_encoder.c:celt_isnan Line | Count | Source | 275 | 226M | { | 276 | 226M | union {float f; opus_uint32 i;} in; | 277 | 226M | in.f = x; | 278 | 226M | return ((in.i>>23)&0xFF)==0xFF && (in.i&0x007FFFFF)!=0; | 279 | 226M | } |
Unexecuted instantiation: entcode.c:celt_isnan Unexecuted instantiation: entenc.c:celt_isnan Unexecuted instantiation: kiss_fft.c:celt_isnan Unexecuted instantiation: mdct.c:celt_isnan Unexecuted instantiation: modes.c:celt_isnan Unexecuted instantiation: pitch.c:celt_isnan Unexecuted instantiation: celt_lpc.c:celt_isnan Unexecuted instantiation: quant_bands.c:celt_isnan Unexecuted instantiation: rate.c:celt_isnan Unexecuted instantiation: x86cpu.c:celt_isnan Unexecuted instantiation: x86_celt_map.c:celt_isnan Unexecuted instantiation: pitch_sse.c:celt_isnan Unexecuted instantiation: pitch_avx.c:celt_isnan Unexecuted instantiation: enc_API.c:celt_isnan Unexecuted instantiation: encode_indices.c:celt_isnan Unexecuted instantiation: encode_pulses.c:celt_isnan Unexecuted instantiation: shell_coder.c:celt_isnan Unexecuted instantiation: tables_gain.c:celt_isnan Unexecuted instantiation: tables_LTP.c:celt_isnan Unexecuted instantiation: tables_other.c:celt_isnan Unexecuted instantiation: tables_pitch_lag.c:celt_isnan Unexecuted instantiation: tables_pulses_per_block.c:celt_isnan Unexecuted instantiation: HP_variable_cutoff.c:celt_isnan Unexecuted instantiation: NLSF_unpack.c:celt_isnan Unexecuted instantiation: stereo_LR_to_MS.c:celt_isnan Unexecuted instantiation: check_control_input.c:celt_isnan Unexecuted instantiation: control_SNR.c:celt_isnan Unexecuted instantiation: init_encoder.c:celt_isnan Unexecuted instantiation: control_codec.c:celt_isnan Unexecuted instantiation: lin2log.c:celt_isnan Unexecuted instantiation: log2lin.c:celt_isnan Unexecuted instantiation: resampler.c:celt_isnan Unexecuted instantiation: resampler_private_down_FIR.c:celt_isnan Unexecuted instantiation: resampler_private_IIR_FIR.c:celt_isnan Unexecuted instantiation: resampler_private_up2_HQ.c:celt_isnan Unexecuted instantiation: resampler_rom.c:celt_isnan Unexecuted instantiation: stereo_encode_pred.c:celt_isnan Unexecuted instantiation: stereo_find_predictor.c:celt_isnan Unexecuted instantiation: stereo_quant_pred.c:celt_isnan Unexecuted instantiation: encode_frame_FLP.c:celt_isnan Unexecuted instantiation: find_pitch_lags_FLP.c:celt_isnan Unexecuted instantiation: find_pred_coefs_FLP.c:celt_isnan Unexecuted instantiation: LPC_analysis_filter_FLP.c:celt_isnan Unexecuted instantiation: LTP_analysis_filter_FLP.c:celt_isnan Unexecuted instantiation: LTP_scale_ctrl_FLP.c:celt_isnan Unexecuted instantiation: noise_shape_analysis_FLP.c:celt_isnan Unexecuted instantiation: process_gains_FLP.c:celt_isnan Unexecuted instantiation: residual_energy_FLP.c:celt_isnan Unexecuted instantiation: warped_autocorrelation_FLP.c:celt_isnan Unexecuted instantiation: wrappers_FLP.c:celt_isnan Unexecuted instantiation: autocorrelation_FLP.c:celt_isnan Unexecuted instantiation: bwexpander_FLP.c:celt_isnan Unexecuted instantiation: energy_FLP.c:celt_isnan Unexecuted instantiation: k2a_FLP.c:celt_isnan Unexecuted instantiation: pitch_analysis_core_FLP.c:celt_isnan Unexecuted instantiation: scale_copy_vector_FLP.c:celt_isnan Unexecuted instantiation: schur_FLP.c:celt_isnan Unexecuted instantiation: sort_FLP.c:celt_isnan Unexecuted instantiation: x86_silk_map.c:celt_isnan Unexecuted instantiation: NSQ_del_dec_avx2.c:celt_isnan Unexecuted instantiation: opus.c:celt_isnan Unexecuted instantiation: opus_decoder.c:celt_isnan Unexecuted instantiation: extensions.c:celt_isnan Unexecuted instantiation: bands.c:celt_isnan Unexecuted instantiation: celt_decoder.c:celt_isnan Unexecuted instantiation: entdec.c:celt_isnan Unexecuted instantiation: laplace.c:celt_isnan Unexecuted instantiation: mathops.c:celt_isnan Unexecuted instantiation: vq.c:celt_isnan Unexecuted instantiation: vq_sse2.c:celt_isnan Unexecuted instantiation: code_signs.c:celt_isnan Unexecuted instantiation: dec_API.c:celt_isnan Unexecuted instantiation: gain_quant.c:celt_isnan Unexecuted instantiation: LP_variable_cutoff.c:celt_isnan Unexecuted instantiation: NSQ.c:celt_isnan Unexecuted instantiation: NSQ_del_dec.c:celt_isnan Unexecuted instantiation: tables_NLSF_CB_NB_MB.c:celt_isnan Unexecuted instantiation: tables_NLSF_CB_WB.c:celt_isnan Unexecuted instantiation: VAD.c:celt_isnan Unexecuted instantiation: control_audio_bandwidth.c:celt_isnan Unexecuted instantiation: quant_LTP_gains.c:celt_isnan Unexecuted instantiation: VQ_WMat_EC.c:celt_isnan Unexecuted instantiation: process_NLSFs.c:celt_isnan Unexecuted instantiation: stereo_MS_to_LR.c:celt_isnan Unexecuted instantiation: A2NLSF.c:celt_isnan Unexecuted instantiation: ana_filt_bank_1.c:celt_isnan Unexecuted instantiation: biquad_alt.c:celt_isnan Unexecuted instantiation: bwexpander_32.c:celt_isnan Unexecuted instantiation: inner_prod_aligned.c:celt_isnan Unexecuted instantiation: LPC_analysis_filter.c:celt_isnan Unexecuted instantiation: table_LSF_cos.c:celt_isnan Unexecuted instantiation: NLSF2A.c:celt_isnan Unexecuted instantiation: NLSF_VQ_weights_laroia.c:celt_isnan Unexecuted instantiation: pitch_est_tables.c:celt_isnan Unexecuted instantiation: resampler_down2_3.c:celt_isnan Unexecuted instantiation: resampler_down2.c:celt_isnan Unexecuted instantiation: resampler_private_AR2.c:celt_isnan Unexecuted instantiation: sigm_Q15.c:celt_isnan Unexecuted instantiation: sum_sqr_shift.c:celt_isnan Unexecuted instantiation: stereo_decode_pred.c:celt_isnan Unexecuted instantiation: LPC_fit.c:celt_isnan Unexecuted instantiation: apply_sine_window_FLP.c:celt_isnan Unexecuted instantiation: find_LPC_FLP.c:celt_isnan Unexecuted instantiation: find_LTP_FLP.c:celt_isnan Unexecuted instantiation: burg_modified_FLP.c:celt_isnan Unexecuted instantiation: inner_product_FLP.c:celt_isnan Unexecuted instantiation: scale_vector_FLP.c:celt_isnan Unexecuted instantiation: NSQ_sse4_1.c:celt_isnan Unexecuted instantiation: NSQ_del_dec_sse4_1.c:celt_isnan Unexecuted instantiation: VAD_sse4_1.c:celt_isnan Unexecuted instantiation: VQ_WMat_EC_sse4_1.c:celt_isnan Unexecuted instantiation: inner_product_FLP_avx2.c:celt_isnan Unexecuted instantiation: cwrs.c:celt_isnan Unexecuted instantiation: init_decoder.c:celt_isnan Unexecuted instantiation: decode_frame.c:celt_isnan Unexecuted instantiation: decode_parameters.c:celt_isnan Unexecuted instantiation: decode_indices.c:celt_isnan Unexecuted instantiation: decode_pulses.c:celt_isnan Unexecuted instantiation: decoder_set_fs.c:celt_isnan Unexecuted instantiation: interpolate.c:celt_isnan Unexecuted instantiation: NLSF_decode.c:celt_isnan Unexecuted instantiation: PLC.c:celt_isnan Unexecuted instantiation: NLSF_encode.c:celt_isnan Unexecuted instantiation: NLSF_VQ.c:celt_isnan Unexecuted instantiation: NLSF_del_dec_quant.c:celt_isnan Unexecuted instantiation: bwexpander.c:celt_isnan Unexecuted instantiation: decode_pitch.c:celt_isnan Unexecuted instantiation: LPC_inv_pred_gain.c:celt_isnan Unexecuted instantiation: NLSF_stabilize.c:celt_isnan Unexecuted instantiation: sort.c:celt_isnan Unexecuted instantiation: corrMatrix_FLP.c:celt_isnan Unexecuted instantiation: CNG.c:celt_isnan Unexecuted instantiation: decode_core.c:celt_isnan Unexecuted instantiation: opus_projection_encoder.c:celt_isnan Unexecuted instantiation: mapping_matrix.c:celt_isnan opus_multistream_encoder.c:celt_isnan Line | Count | Source | 275 | 6.94k | { | 276 | 6.94k | union {float f; opus_uint32 i;} in; | 277 | 6.94k | in.f = x; | 278 | 6.94k | return ((in.i>>23)&0xFF)==0xFF && (in.i&0x007FFFFF)!=0; | 279 | 6.94k | } |
Unexecuted instantiation: opus_multistream.c:celt_isnan Unexecuted instantiation: opus_projection_decoder.c:celt_isnan Unexecuted instantiation: opus_multistream_decoder.c:celt_isnan |
280 | | #else |
281 | | #ifdef __FAST_MATH__ |
282 | | #error Cannot build libopus with -ffast-math unless FLOAT_APPROX is defined. This could result in crashes on extreme (e.g. NaN) input |
283 | | #endif |
284 | | #define celt_isnan(x) ((x)!=(x)) |
285 | | #endif |
286 | | |
287 | 383M | #define Q15ONE 1.0f |
288 | 874M | #define Q31ONE 1.0f |
289 | | #define COEF_ONE 1.0f |
290 | 651M | #define COEF2VAL16(x) (x) |
291 | | |
292 | 71.3M | #define NORM_SCALING 1.f |
293 | | |
294 | 378M | #define EPSILON 1e-15f |
295 | 25.8G | #define VERY_SMALL 1e-30f |
296 | | #define VERY_LARGE16 1e15f |
297 | | #define Q15_ONE ((opus_val16)1.f) |
298 | | |
299 | | /* This appears to be the same speed as C99's fabsf() but it's more portable. */ |
300 | 344M | #define ABS16(x) ((float)fabs(x)) |
301 | 50.6G | #define ABS32(x) ((float)fabs(x)) |
302 | | |
303 | 3.08G | #define QCONST16(x,bits) (x) |
304 | 740M | #define QCONST32(x,bits) (x) |
305 | 6.89G | #define GCONST(x) (x) |
306 | | |
307 | 31.3M | #define NEG16(x) (-(x)) |
308 | | #define NEG32(x) (-(x)) |
309 | 3.59G | #define NEG32_ovflw(x) (-(x)) |
310 | 1.79G | #define EXTRACT16(x) (x) |
311 | 7.97G | #define EXTEND32(x) (x) |
312 | 4.55M | #define SHR16(a,shift) (a) |
313 | | #define SHL16(a,shift) (a) |
314 | 58.9G | #define SHR32(a,shift) (a) |
315 | 6.73G | #define SHL32(a,shift) (a) |
316 | 109G | #define PSHR32(a,shift) (a) |
317 | 2.50G | #define VSHR32(a,shift) (a) |
318 | | |
319 | 4.10G | #define SHR64(a,shift) (a) |
320 | | |
321 | | #define PSHR(a,shift) (a) |
322 | | #define SHR(a,shift) (a) |
323 | | #define SHL(a,shift) (a) |
324 | 201M | #define SATURATE(x,a) (x) |
325 | | #define SATURATE16(x) (x) |
326 | | |
327 | 674M | #define ROUND16(a,shift) (a) |
328 | 30.3G | #define SROUND16(a,shift) (a) |
329 | 8.53M | #define HALF16(x) (.5f*(x)) |
330 | 9.14G | #define HALF32(x) (.5f*(x)) |
331 | | |
332 | 154M | #define ADD16(a,b) ((a)+(b)) |
333 | | #define SUB16(a,b) ((a)-(b)) |
334 | 72.4G | #define ADD32(a,b) ((a)+(b)) |
335 | 16.3G | #define SUB32(a,b) ((a)-(b)) |
336 | 37.2G | #define ADD32_ovflw(a,b) ((a)+(b)) |
337 | 32.8G | #define SUB32_ovflw(a,b) ((a)-(b)) |
338 | 82.3M | #define SHL32_ovflw(a,shift) (a) |
339 | 82.3M | #define PSHR32_ovflw(a,shift) (a) |
340 | | |
341 | | #define MULT16_16_16(a,b) ((a)*(b)) |
342 | 77.1G | #define MULT16_16(a,b) ((opus_val32)(a)*(opus_val32)(b)) |
343 | 9.75G | #define MAC16_16(c,a,b) ((c)+(opus_val32)(a)*(opus_val32)(b)) |
344 | | |
345 | 41.2G | #define MULT16_32_Q15(a,b) ((a)*(b)) |
346 | | #define MULT16_32_Q16(a,b) ((a)*(b)) |
347 | | |
348 | | #define MULT32_32_Q16(a,b) ((a)*(b)) |
349 | 8.13G | #define MULT32_32_Q31(a,b) ((a)*(b)) |
350 | | #define MULT32_32_P31(a,b) ((a)*(b)) |
351 | | |
352 | 657M | #define MAC16_32_Q15(c,a,b) ((c)+(a)*(b)) |
353 | | #define MAC16_32_Q16(c,a,b) ((c)+(a)*(b)) |
354 | | #define MAC_COEF_32_ARM(c,a,b) ((c)+(a)*(b)) |
355 | | |
356 | | #define MULT16_16_Q11_32(a,b) ((a)*(b)) |
357 | | #define MULT16_16_Q11(a,b) ((a)*(b)) |
358 | | #define MULT16_16_Q13(a,b) ((a)*(b)) |
359 | 30.1M | #define MULT16_16_Q14(a,b) ((a)*(b)) |
360 | 4.01G | #define MULT16_16_Q15(a,b) ((a)*(b)) |
361 | 0 | #define MULT16_16_P15(a,b) ((a)*(b)) |
362 | | #define MULT16_16_P13(a,b) ((a)*(b)) |
363 | | #define MULT16_16_P14(a,b) ((a)*(b)) |
364 | 0 | #define MULT16_32_P16(a,b) ((a)*(b)) |
365 | | |
366 | 92.5M | #define MULT_COEF_32(a, b) ((a)*(b)) |
367 | 15.4M | #define MULT_COEF(a, b) ((a)*(b)) |
368 | 1.08M | #define MULT_COEF_TAPS(a, b) ((a)*(b)) |
369 | | |
370 | 421M | #define DIV32_16(a,b) (((opus_val32)(a))/(opus_val16)(b)) |
371 | 804k | #define DIV32(a,b) (((opus_val32)(a))/(opus_val32)(b)) |
372 | | |
373 | 42.2M | #define SIG2RES(a) ((1/CELT_SIG_SCALE)*(a)) |
374 | 12.0G | #define RES2INT16(a) FLOAT2INT16(a) |
375 | 0 | #define RES2INT24(a) float2int(32768.f*256.f*(a)) |
376 | | #define RES2FLOAT(a) (a) |
377 | 26.1G | #define INT16TORES(a) ((a)*(1/CELT_SIG_SCALE)) |
378 | 0 | #define INT24TORES(a) ((1.f/32768.f/256.)*(a)) |
379 | 15.5M | #define ADD_RES(a, b) ADD32(a, b) |
380 | | #define FLOAT2RES(a) (a) |
381 | 14.9G | #define RES2SIG(a) (CELT_SIG_SCALE*(a)) |
382 | 3.24G | #define MULT16_RES_Q15(a,b) MULT16_16_Q15(a,b) |
383 | | |
384 | 12.4G | #define RES2VAL16(a) (a) |
385 | | #define FLOAT2SIG(a) ((a)*CELT_SIG_SCALE) |
386 | 10.6G | #define INT16TOSIG(a) ((float)(a)) |
387 | 0 | #define INT24TOSIG(a) ((float)(a)*(1.f/256.f)) |
388 | 0 | #define MAX_ENCODING_DEPTH 24 |
389 | | |
390 | | #endif /* !FIXED_POINT */ |
391 | | |
392 | | #ifndef GLOBAL_STACK_SIZE |
393 | | #ifdef FIXED_POINT |
394 | | #define GLOBAL_STACK_SIZE 120000 |
395 | | #else |
396 | | #define GLOBAL_STACK_SIZE 120000 |
397 | | #endif |
398 | | #endif |
399 | | |
400 | | #endif /* ARCH_H */ |