Coverage Report

Created: 2026-12-01 07:39

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/opus/celt/mathops.h
Line
Count
Source
1
/* Copyright (c) 2002-2008 Jean-Marc Valin
2
   Copyright (c) 2007-2008 CSIRO
3
   Copyright (c) 2007-2009 Xiph.Org Foundation
4
   Copyright (c) 2024 Arm Limited
5
   Written by Jean-Marc Valin, and Yunho Huh */
6
/**
7
   @file mathops.h
8
   @brief Various math functions
9
*/
10
/*
11
   Redistribution and use in source and binary forms, with or without
12
   modification, are permitted provided that the following conditions
13
   are met:
14
15
   - Redistributions of source code must retain the above copyright
16
   notice, this list of conditions and the following disclaimer.
17
18
   - Redistributions in binary form must reproduce the above copyright
19
   notice, this list of conditions and the following disclaimer in the
20
   documentation and/or other materials provided with the distribution.
21
22
   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23
   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24
   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25
   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
26
   OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
27
   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
28
   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
29
   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
30
   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
31
   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32
   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
*/
34
35
#ifndef MATHOPS_H
36
#define MATHOPS_H
37
38
#include "arch.h"
39
#include "entcode.h"
40
#include "os_support.h"
41
42
43
#if defined(OPUS_ARM_MAY_HAVE_NEON_INTR)
44
#include "arm/mathops_arm.h"
45
#endif
46
47
115M
#define PI 3.1415926535897931
48
49
/* Multiplies two 16-bit fractional values. Bit-exactness of this macro is important */
50
13.1M
#define FRAC_MUL16(a,b) ((16384+((opus_int32)(opus_int16)(a)*(opus_int16)(b)))>>15)
51
52
unsigned isqrt32(opus_uint32 _val);
53
54
/* CELT doesn't need it for fixed-point, by analysis.c does. */
55
#if !defined(FIXED_POINT) || defined(ANALYSIS_C)
56
75.6M
#define cA 0.43157974f
57
75.6M
#define cB 0.67848403f
58
75.6M
#define cC 0.08595542f
59
113M
#define cE ((float)PI/2)
60
77.2M
static OPUS_INLINE float fast_atan2f(float y, float x) {
61
77.2M
   float x2, y2;
62
77.2M
   x2 = x*x;
63
77.2M
   y2 = y*y;
64
   /* For very small values, we don't care about the answer, so
65
      we can just return 0. */
66
77.2M
   if (x2 + y2 < 1e-18f)
67
1.62M
   {
68
1.62M
      return 0;
69
1.62M
   }
70
75.6M
   if(x2<y2){
71
37.5M
      float den = (y2 + cB*x2) * (y2 + cC*x2);
72
37.5M
      return -x*y*(y2 + cA*x2) / den + (y<0 ? -cE : cE);
73
38.1M
   }else{
74
38.1M
      float den = (x2 + cB*y2) * (x2 + cC*y2);
75
38.1M
      return  x*y*(x2 + cA*y2) / den + (y<0 ? -cE : cE) - (x*y<0 ? -cE : cE);
76
38.1M
   }
77
75.6M
}
analysis.c:fast_atan2f
Line
Count
Source
60
77.2M
static OPUS_INLINE float fast_atan2f(float y, float x) {
61
77.2M
   float x2, y2;
62
77.2M
   x2 = x*x;
63
77.2M
   y2 = y*y;
64
   /* For very small values, we don't care about the answer, so
65
      we can just return 0. */
66
77.2M
   if (x2 + y2 < 1e-18f)
67
1.62M
   {
68
1.62M
      return 0;
69
1.62M
   }
70
75.6M
   if(x2<y2){
71
37.5M
      float den = (y2 + cB*x2) * (y2 + cC*x2);
72
37.5M
      return -x*y*(y2 + cA*x2) / den + (y<0 ? -cE : cE);
73
38.1M
   }else{
74
38.1M
      float den = (x2 + cB*y2) * (x2 + cC*y2);
75
38.1M
      return  x*y*(x2 + cA*y2) / den + (y<0 ? -cE : cE) - (x*y<0 ? -cE : cE);
76
38.1M
   }
77
75.6M
}
Unexecuted instantiation: opus_encoder.c:fast_atan2f
Unexecuted instantiation: celt.c:fast_atan2f
Unexecuted instantiation: celt_encoder.c:fast_atan2f
Unexecuted instantiation: kiss_fft.c:fast_atan2f
Unexecuted instantiation: mdct.c:fast_atan2f
Unexecuted instantiation: modes.c:fast_atan2f
Unexecuted instantiation: pitch.c:fast_atan2f
Unexecuted instantiation: celt_lpc.c:fast_atan2f
Unexecuted instantiation: quant_bands.c:fast_atan2f
Unexecuted instantiation: rate.c:fast_atan2f
Unexecuted instantiation: pitch_sse.c:fast_atan2f
Unexecuted instantiation: opus.c:fast_atan2f
Unexecuted instantiation: opus_decoder.c:fast_atan2f
Unexecuted instantiation: bands.c:fast_atan2f
Unexecuted instantiation: celt_decoder.c:fast_atan2f
Unexecuted instantiation: laplace.c:fast_atan2f
Unexecuted instantiation: mathops.c:fast_atan2f
Unexecuted instantiation: vq.c:fast_atan2f
Unexecuted instantiation: vq_sse2.c:fast_atan2f
Unexecuted instantiation: cwrs.c:fast_atan2f
Unexecuted instantiation: opus_projection_encoder.c:fast_atan2f
Unexecuted instantiation: opus_multistream_encoder.c:fast_atan2f
Unexecuted instantiation: opus_multistream_decode_fuzzer.cc:fast_atan2f(float, float)
Unexecuted instantiation: opus_projection_decoder_fuzzer.cc:fast_atan2f(float, float)
Unexecuted instantiation: opus_projection_decoder.c:fast_atan2f
78
#undef cA
79
#undef cB
80
#undef cC
81
#undef cE
82
#endif
83
84
85
#ifndef OVERRIDE_CELT_MAXABS16
86
static OPUS_INLINE opus_val32 celt_maxabs16(const opus_val16 *x, int len)
87
1.83M
{
88
1.83M
   int i;
89
1.83M
   opus_val16 maxval = 0;
90
1.83M
   opus_val16 minval = 0;
91
818M
   for (i=0;i<len;i++)
92
816M
   {
93
816M
      maxval = MAX16(maxval, x[i]);
94
816M
      minval = MIN16(minval, x[i]);
95
816M
   }
96
1.83M
   return MAX32(EXTEND32(maxval),-EXTEND32(minval));
97
1.83M
}
Unexecuted instantiation: celt.c:celt_maxabs16
Unexecuted instantiation: opus.c:celt_maxabs16
Unexecuted instantiation: opus_decoder.c:celt_maxabs16
celt_decoder.c:celt_maxabs16
Line
Count
Source
87
186k
{
88
186k
   int i;
89
186k
   opus_val16 maxval = 0;
90
186k
   opus_val16 minval = 0;
91
111M
   for (i=0;i<len;i++)
92
111M
   {
93
111M
      maxval = MAX16(maxval, x[i]);
94
111M
      minval = MIN16(minval, x[i]);
95
111M
   }
96
186k
   return MAX32(EXTEND32(maxval),-EXTEND32(minval));
97
186k
}
Unexecuted instantiation: mathops.c:celt_maxabs16
Unexecuted instantiation: mdct.c:celt_maxabs16
Unexecuted instantiation: modes.c:celt_maxabs16
pitch.c:celt_maxabs16
Line
Count
Source
87
290k
{
88
290k
   int i;
89
290k
   opus_val16 maxval = 0;
90
290k
   opus_val16 minval = 0;
91
94.8M
   for (i=0;i<len;i++)
92
94.5M
   {
93
94.5M
      maxval = MAX16(maxval, x[i]);
94
94.5M
      minval = MIN16(minval, x[i]);
95
94.5M
   }
96
290k
   return MAX32(EXTEND32(maxval),-EXTEND32(minval));
97
290k
}
Unexecuted instantiation: celt_lpc.c:celt_maxabs16
Unexecuted instantiation: quant_bands.c:celt_maxabs16
Unexecuted instantiation: rate.c:celt_maxabs16
Unexecuted instantiation: vq.c:celt_maxabs16
Unexecuted instantiation: pitch_sse2.c:celt_maxabs16
Unexecuted instantiation: celt_lpc_sse4_1.c:celt_maxabs16
Unexecuted instantiation: pitch_sse4_1.c:celt_maxabs16
Unexecuted instantiation: bands.c:celt_maxabs16
Unexecuted instantiation: cwrs.c:celt_maxabs16
Unexecuted instantiation: kiss_fft.c:celt_maxabs16
Unexecuted instantiation: laplace.c:celt_maxabs16
Unexecuted instantiation: opus_projection_encoder.c:celt_maxabs16
Unexecuted instantiation: opus_multistream_encoder.c:celt_maxabs16
Unexecuted instantiation: analysis.c:celt_maxabs16
celt_encoder.c:celt_maxabs16
Line
Count
Source
87
918k
{
88
918k
   int i;
89
918k
   opus_val16 maxval = 0;
90
918k
   opus_val16 minval = 0;
91
361M
   for (i=0;i<len;i++)
92
360M
   {
93
360M
      maxval = MAX16(maxval, x[i]);
94
360M
      minval = MIN16(minval, x[i]);
95
360M
   }
96
918k
   return MAX32(EXTEND32(maxval),-EXTEND32(minval));
97
918k
}
opus_encoder.c:celt_maxabs16
Line
Count
Source
87
434k
{
88
434k
   int i;
89
434k
   opus_val16 maxval = 0;
90
434k
   opus_val16 minval = 0;
91
250M
   for (i=0;i<len;i++)
92
249M
   {
93
249M
      maxval = MAX16(maxval, x[i]);
94
249M
      minval = MIN16(minval, x[i]);
95
249M
   }
96
434k
   return MAX32(EXTEND32(maxval),-EXTEND32(minval));
97
434k
}
Unexecuted instantiation: pitch_sse.c:celt_maxabs16
Unexecuted instantiation: vq_sse2.c:celt_maxabs16
Unexecuted instantiation: opus_multistream_decode_fuzzer.cc:celt_maxabs16(float const*, int)
Unexecuted instantiation: opus_projection_decoder_fuzzer.cc:celt_maxabs16(float const*, int)
Unexecuted instantiation: opus_projection_decoder.c:celt_maxabs16
98
#endif
99
100
#if defined(ENABLE_RES24) && defined(FIXED_POINT)
101
static OPUS_INLINE opus_res celt_maxabs_res(const opus_res *x, int len)
102
1.50M
{
103
1.50M
   int i;
104
1.50M
   opus_res maxval = 0;
105
1.50M
   opus_res minval = 0;
106
491M
   for (i=0;i<len;i++)
107
490M
   {
108
490M
      maxval = MAX32(maxval, x[i]);
109
490M
      minval = MIN32(minval, x[i]);
110
490M
   }
111
   /* opus_res should never reach such amplitude, so we should be safe. */
112
1.50M
   celt_sig_assert(minval != -2147483648);
113
1.50M
   return MAX32(maxval,-minval);
114
1.50M
}
Unexecuted instantiation: celt.c:celt_maxabs_res
Unexecuted instantiation: opus.c:celt_maxabs_res
Unexecuted instantiation: opus_decoder.c:celt_maxabs_res
Unexecuted instantiation: celt_decoder.c:celt_maxabs_res
Unexecuted instantiation: mathops.c:celt_maxabs_res
Unexecuted instantiation: mdct.c:celt_maxabs_res
Unexecuted instantiation: modes.c:celt_maxabs_res
Unexecuted instantiation: pitch.c:celt_maxabs_res
Unexecuted instantiation: celt_lpc.c:celt_maxabs_res
Unexecuted instantiation: quant_bands.c:celt_maxabs_res
Unexecuted instantiation: rate.c:celt_maxabs_res
Unexecuted instantiation: vq.c:celt_maxabs_res
Unexecuted instantiation: pitch_sse2.c:celt_maxabs_res
Unexecuted instantiation: celt_lpc_sse4_1.c:celt_maxabs_res
Unexecuted instantiation: pitch_sse4_1.c:celt_maxabs_res
Unexecuted instantiation: bands.c:celt_maxabs_res
Unexecuted instantiation: cwrs.c:celt_maxabs_res
Unexecuted instantiation: kiss_fft.c:celt_maxabs_res
Unexecuted instantiation: laplace.c:celt_maxabs_res
Unexecuted instantiation: opus_projection_encoder.c:celt_maxabs_res
opus_encoder.c:celt_maxabs_res
Line
Count
Source
102
970k
{
103
970k
   int i;
104
970k
   opus_res maxval = 0;
105
970k
   opus_res minval = 0;
106
424M
   for (i=0;i<len;i++)
107
423M
   {
108
423M
      maxval = MAX32(maxval, x[i]);
109
423M
      minval = MIN32(minval, x[i]);
110
423M
   }
111
   /* opus_res should never reach such amplitude, so we should be safe. */
112
970k
   celt_sig_assert(minval != -2147483648);
113
970k
   return MAX32(maxval,-minval);
114
970k
}
Unexecuted instantiation: opus_multistream_encoder.c:celt_maxabs_res
Unexecuted instantiation: analysis.c:celt_maxabs_res
celt_encoder.c:celt_maxabs_res
Line
Count
Source
102
530k
{
103
530k
   int i;
104
530k
   opus_res maxval = 0;
105
530k
   opus_res minval = 0;
106
67.3M
   for (i=0;i<len;i++)
107
66.8M
   {
108
66.8M
      maxval = MAX32(maxval, x[i]);
109
66.8M
      minval = MIN32(minval, x[i]);
110
66.8M
   }
111
   /* opus_res should never reach such amplitude, so we should be safe. */
112
530k
   celt_sig_assert(minval != -2147483648);
113
530k
   return MAX32(maxval,-minval);
114
530k
}
Unexecuted instantiation: opus_projection_decoder.c:celt_maxabs_res
115
#else
116
601k
#define celt_maxabs_res celt_maxabs16
117
#endif
118
119
120
#ifndef OVERRIDE_CELT_MAXABS32
121
#ifdef FIXED_POINT
122
static OPUS_INLINE opus_val32 celt_maxabs32(const opus_val32 *x, int len)
123
5.40M
{
124
5.40M
   int i;
125
5.40M
   opus_val32 maxval = 0;
126
5.40M
   opus_val32 minval = 0;
127
829M
   for (i=0;i<len;i++)
128
823M
   {
129
823M
      maxval = MAX32(maxval, x[i]);
130
823M
      minval = MIN32(minval, x[i]);
131
823M
   }
132
5.40M
   return MAX32(maxval, -minval);
133
5.40M
}
Unexecuted instantiation: celt.c:celt_maxabs32
Unexecuted instantiation: opus.c:celt_maxabs32
Unexecuted instantiation: opus_decoder.c:celt_maxabs32
Unexecuted instantiation: celt_decoder.c:celt_maxabs32
Unexecuted instantiation: mathops.c:celt_maxabs32
Unexecuted instantiation: mdct.c:celt_maxabs32
Unexecuted instantiation: modes.c:celt_maxabs32
pitch.c:celt_maxabs32
Line
Count
Source
123
222k
{
124
222k
   int i;
125
222k
   opus_val32 maxval = 0;
126
222k
   opus_val32 minval = 0;
127
428M
   for (i=0;i<len;i++)
128
428M
   {
129
428M
      maxval = MAX32(maxval, x[i]);
130
428M
      minval = MIN32(minval, x[i]);
131
428M
   }
132
222k
   return MAX32(maxval, -minval);
133
222k
}
Unexecuted instantiation: celt_lpc.c:celt_maxabs32
Unexecuted instantiation: quant_bands.c:celt_maxabs32
Unexecuted instantiation: rate.c:celt_maxabs32
Unexecuted instantiation: vq.c:celt_maxabs32
Unexecuted instantiation: pitch_sse2.c:celt_maxabs32
Unexecuted instantiation: celt_lpc_sse4_1.c:celt_maxabs32
Unexecuted instantiation: pitch_sse4_1.c:celt_maxabs32
bands.c:celt_maxabs32
Line
Count
Source
123
4.82M
{
124
4.82M
   int i;
125
4.82M
   opus_val32 maxval = 0;
126
4.82M
   opus_val32 minval = 0;
127
59.0M
   for (i=0;i<len;i++)
128
54.1M
   {
129
54.1M
      maxval = MAX32(maxval, x[i]);
130
54.1M
      minval = MIN32(minval, x[i]);
131
54.1M
   }
132
4.82M
   return MAX32(maxval, -minval);
133
4.82M
}
Unexecuted instantiation: cwrs.c:celt_maxabs32
Unexecuted instantiation: kiss_fft.c:celt_maxabs32
Unexecuted instantiation: laplace.c:celt_maxabs32
Unexecuted instantiation: opus_projection_encoder.c:celt_maxabs32
Unexecuted instantiation: opus_encoder.c:celt_maxabs32
Unexecuted instantiation: opus_multistream_encoder.c:celt_maxabs32
analysis.c:celt_maxabs32
Line
Count
Source
123
85.4k
{
124
85.4k
   int i;
125
85.4k
   opus_val32 maxval = 0;
126
85.4k
   opus_val32 minval = 0;
127
61.6M
   for (i=0;i<len;i++)
128
61.5M
   {
129
61.5M
      maxval = MAX32(maxval, x[i]);
130
61.5M
      minval = MIN32(minval, x[i]);
131
61.5M
   }
132
85.4k
   return MAX32(maxval, -minval);
133
85.4k
}
celt_encoder.c:celt_maxabs32
Line
Count
Source
123
280k
{
124
280k
   int i;
125
280k
   opus_val32 maxval = 0;
126
280k
   opus_val32 minval = 0;
127
279M
   for (i=0;i<len;i++)
128
279M
   {
129
279M
      maxval = MAX32(maxval, x[i]);
130
279M
      minval = MIN32(minval, x[i]);
131
279M
   }
132
280k
   return MAX32(maxval, -minval);
133
280k
}
Unexecuted instantiation: opus_projection_decoder.c:celt_maxabs32
134
#else
135
#define celt_maxabs32(x,len) celt_maxabs16(x,len)
136
#endif
137
#endif
138
139
#ifndef FIXED_POINT
140
/* Calculates the arctangent of x using a Remez approximation of order 15,
141
 * incorporating only odd-powered terms. */
142
static OPUS_INLINE float celt_atan_norm(float x)
143
1.34M
{
144
1.34M
   #define ATAN2_2_OVER_PI 0.636619772367581f
145
1.34M
   float x_sq = x * x;
146
147
   /* Polynomial coefficients approximated in the [0, 1] range.
148
    * Lolremez command: lolremez --degree 6 --range "0:1"
149
    *                   "(atan(sqrt(x))-sqrt(x))/(x*sqrt(x))" "1/(sqrt(x)*x)"
150
    * Please note that ATAN2_COEFF_A01 is fixed to 1.0f. */
151
1.34M
   #define ATAN2_COEFF_A03 -3.3331659436225891113281250000e-01f
152
1.34M
   #define ATAN2_COEFF_A05 1.99627041816711425781250000000e-01f
153
1.34M
   #define ATAN2_COEFF_A07 -1.3976582884788513183593750000e-01f
154
1.34M
   #define ATAN2_COEFF_A09 9.79423448443412780761718750000e-02f
155
1.34M
   #define ATAN2_COEFF_A11 -5.7773590087890625000000000000e-02f
156
1.34M
   #define ATAN2_COEFF_A13 2.30401363223791122436523437500e-02f
157
1.34M
   #define ATAN2_COEFF_A15 -4.3554059229791164398193359375e-03f
158
1.34M
   return ATAN2_2_OVER_PI * (x + x * x_sq * (ATAN2_COEFF_A03
159
1.34M
                + x_sq * (ATAN2_COEFF_A05
160
1.34M
                + x_sq * (ATAN2_COEFF_A07
161
1.34M
                + x_sq * (ATAN2_COEFF_A09
162
1.34M
                + x_sq * (ATAN2_COEFF_A11
163
1.34M
                + x_sq * (ATAN2_COEFF_A13
164
1.34M
                + x_sq * (ATAN2_COEFF_A15))))))));
165
1.34M
}
Unexecuted instantiation: pitch_sse.c:celt_atan_norm
vq.c:celt_atan_norm
Line
Count
Source
143
1.34M
{
144
1.34M
   #define ATAN2_2_OVER_PI 0.636619772367581f
145
1.34M
   float x_sq = x * x;
146
147
   /* Polynomial coefficients approximated in the [0, 1] range.
148
    * Lolremez command: lolremez --degree 6 --range "0:1"
149
    *                   "(atan(sqrt(x))-sqrt(x))/(x*sqrt(x))" "1/(sqrt(x)*x)"
150
    * Please note that ATAN2_COEFF_A01 is fixed to 1.0f. */
151
1.34M
   #define ATAN2_COEFF_A03 -3.3331659436225891113281250000e-01f
152
1.34M
   #define ATAN2_COEFF_A05 1.99627041816711425781250000000e-01f
153
1.34M
   #define ATAN2_COEFF_A07 -1.3976582884788513183593750000e-01f
154
1.34M
   #define ATAN2_COEFF_A09 9.79423448443412780761718750000e-02f
155
1.34M
   #define ATAN2_COEFF_A11 -5.7773590087890625000000000000e-02f
156
1.34M
   #define ATAN2_COEFF_A13 2.30401363223791122436523437500e-02f
157
1.34M
   #define ATAN2_COEFF_A15 -4.3554059229791164398193359375e-03f
158
1.34M
   return ATAN2_2_OVER_PI * (x + x * x_sq * (ATAN2_COEFF_A03
159
1.34M
                + x_sq * (ATAN2_COEFF_A05
160
1.34M
                + x_sq * (ATAN2_COEFF_A07
161
1.34M
                + x_sq * (ATAN2_COEFF_A09
162
1.34M
                + x_sq * (ATAN2_COEFF_A11
163
1.34M
                + x_sq * (ATAN2_COEFF_A13
164
1.34M
                + x_sq * (ATAN2_COEFF_A15))))))));
165
1.34M
}
Unexecuted instantiation: vq_sse2.c:celt_atan_norm
Unexecuted instantiation: opus_multistream_decode_fuzzer.cc:celt_atan_norm(float)
Unexecuted instantiation: opus_projection_decoder_fuzzer.cc:celt_atan_norm(float)
166
167
/* Calculates the arctangent of y/x, returning an approximate value in radians.
168
 * Please refer to the linked wiki page (https://en.wikipedia.org/wiki/Atan2)
169
 * to learn how atan2 results are computed. */
170
static OPUS_INLINE float celt_atan2p_norm(float y, float x)
171
1.38M
{
172
1.38M
   celt_sig_assert(x>=0 && y>=0);
173
174
   /* For very small values, we don't care about the answer. */
175
1.38M
   if ((x*x + y*y) < 1e-18f)
176
36.4k
   {
177
36.4k
      return 0;
178
36.4k
   }
179
180
1.34M
   if (y < x)
181
657k
   {
182
657k
      return celt_atan_norm(y / x);
183
690k
   } else {
184
690k
      return 1.f - celt_atan_norm(x / y);
185
690k
   }
186
1.34M
}
Unexecuted instantiation: pitch_sse.c:celt_atan2p_norm
vq.c:celt_atan2p_norm
Line
Count
Source
171
1.38M
{
172
1.38M
   celt_sig_assert(x>=0 && y>=0);
173
174
   /* For very small values, we don't care about the answer. */
175
1.38M
   if ((x*x + y*y) < 1e-18f)
176
36.4k
   {
177
36.4k
      return 0;
178
36.4k
   }
179
180
1.34M
   if (y < x)
181
657k
   {
182
657k
      return celt_atan_norm(y / x);
183
690k
   } else {
184
690k
      return 1.f - celt_atan_norm(x / y);
185
690k
   }
186
1.34M
}
Unexecuted instantiation: vq_sse2.c:celt_atan2p_norm
Unexecuted instantiation: opus_multistream_decode_fuzzer.cc:celt_atan2p_norm(float, float)
Unexecuted instantiation: opus_projection_decoder_fuzzer.cc:celt_atan2p_norm(float, float)
187
#endif
188
189
#if !defined(FIXED_POINT) || defined(ENABLE_QEXT)
190
/* Computes estimated cosine values for (PI/2 * x) using only terms with even
191
 * exponents. */
192
static OPUS_INLINE float celt_cos_norm2(float x)
193
2.47M
{
194
2.47M
   float x_norm_sq;
195
2.47M
   int output_sign;
196
   /* Restrict x to [-1, 3]. */
197
2.47M
   x -= 4*floor(.25*(x+1));
198
   /* Negative sign for [1, 3]. */
199
2.47M
   output_sign = 1 - 2*(x>1);
200
   /* Restrict to [-1, 1]. */
201
2.47M
   x -= 2*(x>1);
202
203
   /* The cosine function, cos(x), has a Taylor series representation consisting
204
    * exclusively of even-powered polynomial terms. */
205
2.47M
   x_norm_sq = x * x;
206
207
   /* Polynomial coefficients approximated in the [0, 1] range using only terms
208
    * with even exponents.
209
    * Lolremez command: lolremez --degree 4 --range 0:1 "cos(sqrt(x)*pi*0.5)" */
210
2.47M
   #define COS_COEFF_A0 9.999999403953552246093750000000e-01f
211
2.47M
   #define COS_COEFF_A2 -1.233698248863220214843750000000000f
212
2.47M
   #define COS_COEFF_A4 2.536507546901702880859375000000e-01f
213
2.47M
   #define COS_COEFF_A6 -2.08106283098459243774414062500e-02f
214
2.47M
   #define COS_COEFF_A8 8.581906440667808055877685546875e-04f
215
2.47M
   return output_sign * (COS_COEFF_A0 + x_norm_sq * (COS_COEFF_A2 +
216
2.47M
                               x_norm_sq * (COS_COEFF_A4 +
217
2.47M
                               x_norm_sq * (COS_COEFF_A6 +
218
2.47M
                               x_norm_sq * (COS_COEFF_A8)))));
219
2.47M
}
Unexecuted instantiation: opus_projection_encoder.c:celt_cos_norm2
Unexecuted instantiation: celt.c:celt_cos_norm2
Unexecuted instantiation: mathops.c:celt_cos_norm2
Unexecuted instantiation: opus_encoder.c:celt_cos_norm2
Unexecuted instantiation: opus_multistream_encoder.c:celt_cos_norm2
Unexecuted instantiation: analysis.c:celt_cos_norm2
Unexecuted instantiation: celt_encoder.c:celt_cos_norm2
Unexecuted instantiation: kiss_fft.c:celt_cos_norm2
Unexecuted instantiation: mdct.c:celt_cos_norm2
Unexecuted instantiation: modes.c:celt_cos_norm2
Unexecuted instantiation: pitch.c:celt_cos_norm2
Unexecuted instantiation: celt_lpc.c:celt_cos_norm2
Unexecuted instantiation: quant_bands.c:celt_cos_norm2
Unexecuted instantiation: rate.c:celt_cos_norm2
Unexecuted instantiation: vq.c:celt_cos_norm2
Unexecuted instantiation: pitch_sse2.c:celt_cos_norm2
Unexecuted instantiation: celt_lpc_sse4_1.c:celt_cos_norm2
Unexecuted instantiation: pitch_sse4_1.c:celt_cos_norm2
Unexecuted instantiation: opus.c:celt_cos_norm2
Unexecuted instantiation: opus_decoder.c:celt_cos_norm2
Unexecuted instantiation: celt_decoder.c:celt_cos_norm2
Unexecuted instantiation: cwrs.c:celt_cos_norm2
Unexecuted instantiation: laplace.c:celt_cos_norm2
Unexecuted instantiation: pitch_sse.c:celt_cos_norm2
bands.c:celt_cos_norm2
Line
Count
Source
193
2.47M
{
194
2.47M
   float x_norm_sq;
195
2.47M
   int output_sign;
196
   /* Restrict x to [-1, 3]. */
197
2.47M
   x -= 4*floor(.25*(x+1));
198
   /* Negative sign for [1, 3]. */
199
2.47M
   output_sign = 1 - 2*(x>1);
200
   /* Restrict to [-1, 1]. */
201
2.47M
   x -= 2*(x>1);
202
203
   /* The cosine function, cos(x), has a Taylor series representation consisting
204
    * exclusively of even-powered polynomial terms. */
205
2.47M
   x_norm_sq = x * x;
206
207
   /* Polynomial coefficients approximated in the [0, 1] range using only terms
208
    * with even exponents.
209
    * Lolremez command: lolremez --degree 4 --range 0:1 "cos(sqrt(x)*pi*0.5)" */
210
2.47M
   #define COS_COEFF_A0 9.999999403953552246093750000000e-01f
211
2.47M
   #define COS_COEFF_A2 -1.233698248863220214843750000000000f
212
2.47M
   #define COS_COEFF_A4 2.536507546901702880859375000000e-01f
213
2.47M
   #define COS_COEFF_A6 -2.08106283098459243774414062500e-02f
214
2.47M
   #define COS_COEFF_A8 8.581906440667808055877685546875e-04f
215
2.47M
   return output_sign * (COS_COEFF_A0 + x_norm_sq * (COS_COEFF_A2 +
216
2.47M
                               x_norm_sq * (COS_COEFF_A4 +
217
2.47M
                               x_norm_sq * (COS_COEFF_A6 +
218
2.47M
                               x_norm_sq * (COS_COEFF_A8)))));
219
2.47M
}
Unexecuted instantiation: vq_sse2.c:celt_cos_norm2
Unexecuted instantiation: opus_multistream_decode_fuzzer.cc:celt_cos_norm2(float)
Unexecuted instantiation: opus_projection_decoder_fuzzer.cc:celt_cos_norm2(float)
Unexecuted instantiation: opus_projection_decoder.c:celt_cos_norm2
220
221
#endif
222
223
#ifndef FIXED_POINT
224
225
11.8M
#define celt_sqrt(x) ((float)sqrt(x))
226
5.95M
#define celt_sqrt32(x) ((float)sqrt(x))
227
1.51M
#define celt_rsqrt(x) (1.f/celt_sqrt(x))
228
#define celt_rsqrt_norm(x) (celt_rsqrt(x))
229
1.46M
#define celt_rsqrt_norm32(x) (celt_rsqrt(x))
230
2.04M
#define celt_cos_norm(x) ((float)cos((.5f*PI)*(x)))
231
128k
#define celt_rcp(x) (1.f/(x))
232
1.02M
#define celt_div(a,b) ((a)/(b))
233
1.35M
#define frac_div32(a,b) ((float)(a)/(b))
234
288k
#define frac_div32_q29(a,b) frac_div32(a,b)
235
236
#ifdef FLOAT_APPROX
237
/* Calculates the base-2 logarithm (log2(x)) of a number. It is designed for
238
 * systems using radix-2 floating-point representation, with the exponent
239
 * located at bits 23 to 30 and an offset of 127. Note that special cases like
240
 * denormalized numbers, positive/negative infinity, and NaN are not handled.
241
 * log2(x) = log2(x^exponent * mantissa)
242
 *         = exponent + log2(mantissa) */
243
244
/* Log2 x normalization single precision coefficients calculated by
245
 * 1 / (1 + 0.125 * index).
246
 * Coefficients in Double Precision
247
 * double log2_x_norm_coeff[8] = {
248
 *    1.0000000000000000000, 8.888888888888888e-01,
249
 *    8.000000000000000e-01, 7.272727272727273e-01,
250
 *    6.666666666666666e-01, 6.153846153846154e-01,
251
 *    5.714285714285714e-01, 5.333333333333333e-01} */
252
static const float log2_x_norm_coeff[8] = {
253
   1.000000000000000000000000000f, 8.88888895511627197265625e-01f,
254
   8.00000000000000000000000e-01f, 7.27272748947143554687500e-01f,
255
   6.66666686534881591796875e-01f, 6.15384638309478759765625e-01f,
256
   5.71428596973419189453125e-01f, 5.33333361148834228515625e-01f};
257
258
/* Log2 y normalization single precision coefficients calculated by
259
 * log2(1 + 0.125 * index).
260
 * Coefficients in Double Precision
261
 * double log2_y_norm_coeff[8] = {
262
 *    0.0000000000000000000, 1.699250014423124e-01,
263
 *    3.219280948873623e-01, 4.594316186372973e-01,
264
 *    5.849625007211562e-01, 7.004397181410922e-01,
265
 *    8.073549220576041e-01, 9.068905956085185e-01}; */
266
static const float log2_y_norm_coeff[8] = {
267
   0.0000000000000000000000000000f, 1.699250042438507080078125e-01f,
268
   3.219280838966369628906250e-01f, 4.594316184520721435546875e-01f,
269
   5.849624872207641601562500e-01f, 7.004396915435791015625000e-01f,
270
   8.073549270629882812500000e-01f, 9.068905711174011230468750e-01f};
271
272
static OPUS_INLINE float celt_log2(float x)
273
4.04M
{
274
4.04M
   opus_int32 integer;
275
4.04M
   opus_int32 range_idx;
276
4.04M
   union {
277
4.04M
      float f;
278
4.04M
      opus_uint32 i;
279
4.04M
   } in;
280
4.04M
   in.f = x;
281
4.04M
   integer = (opus_int32)(in.i>>23)-127;
282
4.04M
   in.i = (opus_int32)in.i - (opus_int32)((opus_uint32)integer<<23);
283
284
   /* Normalize the mantissa range from [1, 2] to [1,1.125], and then shift x
285
    * by 1.0625 to [-0.0625, 0.0625]. */
286
4.04M
   range_idx = (in.i >> 20) & 0x7;
287
4.04M
   in.f = in.f * log2_x_norm_coeff[range_idx] - 1.0625f;
288
289
   /* Polynomial coefficients approximated in the [1, 1.125] range.
290
    * Lolremez command: lolremez --degree 4 --range -0.0625:0.0625
291
    *                   "log(x+1.0625)/log(2)"
292
    * Coefficients in Double Precision
293
    * A0: 8.7462840624502679e-2    A1: 1.3578296070972002
294
    * A2: -6.3897703690210047e-1   A3: 4.0197125617419959e-1
295
    * A4: -2.8415445877832832e-1 */
296
4.04M
   #define LOG2_COEFF_A0 8.74628424644470214843750000e-02f
297
4.04M
   #define LOG2_COEFF_A1 1.357829570770263671875000000000f
298
4.04M
   #define LOG2_COEFF_A2 -6.3897705078125000000000000e-01f
299
4.04M
   #define LOG2_COEFF_A3 4.01971250772476196289062500e-01f
300
4.04M
   #define LOG2_COEFF_A4 -2.8415444493293762207031250e-01f
301
4.04M
   in.f = LOG2_COEFF_A0 + in.f * (LOG2_COEFF_A1
302
4.04M
               + in.f * (LOG2_COEFF_A2
303
4.04M
               + in.f * (LOG2_COEFF_A3
304
4.04M
               + in.f * (LOG2_COEFF_A4))));
305
4.04M
   return integer + in.f + log2_y_norm_coeff[range_idx];
306
4.04M
}
celt_encoder.c:celt_log2
Line
Count
Source
273
93.4k
{
274
93.4k
   opus_int32 integer;
275
93.4k
   opus_int32 range_idx;
276
93.4k
   union {
277
93.4k
      float f;
278
93.4k
      opus_uint32 i;
279
93.4k
   } in;
280
93.4k
   in.f = x;
281
93.4k
   integer = (opus_int32)(in.i>>23)-127;
282
93.4k
   in.i = (opus_int32)in.i - (opus_int32)((opus_uint32)integer<<23);
283
284
   /* Normalize the mantissa range from [1, 2] to [1,1.125], and then shift x
285
    * by 1.0625 to [-0.0625, 0.0625]. */
286
93.4k
   range_idx = (in.i >> 20) & 0x7;
287
93.4k
   in.f = in.f * log2_x_norm_coeff[range_idx] - 1.0625f;
288
289
   /* Polynomial coefficients approximated in the [1, 1.125] range.
290
    * Lolremez command: lolremez --degree 4 --range -0.0625:0.0625
291
    *                   "log(x+1.0625)/log(2)"
292
    * Coefficients in Double Precision
293
    * A0: 8.7462840624502679e-2    A1: 1.3578296070972002
294
    * A2: -6.3897703690210047e-1   A3: 4.0197125617419959e-1
295
    * A4: -2.8415445877832832e-1 */
296
93.4k
   #define LOG2_COEFF_A0 8.74628424644470214843750000e-02f
297
93.4k
   #define LOG2_COEFF_A1 1.357829570770263671875000000000f
298
93.4k
   #define LOG2_COEFF_A2 -6.3897705078125000000000000e-01f
299
93.4k
   #define LOG2_COEFF_A3 4.01971250772476196289062500e-01f
300
93.4k
   #define LOG2_COEFF_A4 -2.8415444493293762207031250e-01f
301
93.4k
   in.f = LOG2_COEFF_A0 + in.f * (LOG2_COEFF_A1
302
93.4k
               + in.f * (LOG2_COEFF_A2
303
93.4k
               + in.f * (LOG2_COEFF_A3
304
93.4k
               + in.f * (LOG2_COEFF_A4))));
305
93.4k
   return integer + in.f + log2_y_norm_coeff[range_idx];
306
93.4k
}
quant_bands.c:celt_log2
Line
Count
Source
273
3.94M
{
274
3.94M
   opus_int32 integer;
275
3.94M
   opus_int32 range_idx;
276
3.94M
   union {
277
3.94M
      float f;
278
3.94M
      opus_uint32 i;
279
3.94M
   } in;
280
3.94M
   in.f = x;
281
3.94M
   integer = (opus_int32)(in.i>>23)-127;
282
3.94M
   in.i = (opus_int32)in.i - (opus_int32)((opus_uint32)integer<<23);
283
284
   /* Normalize the mantissa range from [1, 2] to [1,1.125], and then shift x
285
    * by 1.0625 to [-0.0625, 0.0625]. */
286
3.94M
   range_idx = (in.i >> 20) & 0x7;
287
3.94M
   in.f = in.f * log2_x_norm_coeff[range_idx] - 1.0625f;
288
289
   /* Polynomial coefficients approximated in the [1, 1.125] range.
290
    * Lolremez command: lolremez --degree 4 --range -0.0625:0.0625
291
    *                   "log(x+1.0625)/log(2)"
292
    * Coefficients in Double Precision
293
    * A0: 8.7462840624502679e-2    A1: 1.3578296070972002
294
    * A2: -6.3897703690210047e-1   A3: 4.0197125617419959e-1
295
    * A4: -2.8415445877832832e-1 */
296
3.94M
   #define LOG2_COEFF_A0 8.74628424644470214843750000e-02f
297
3.94M
   #define LOG2_COEFF_A1 1.357829570770263671875000000000f
298
3.94M
   #define LOG2_COEFF_A2 -6.3897705078125000000000000e-01f
299
3.94M
   #define LOG2_COEFF_A3 4.01971250772476196289062500e-01f
300
3.94M
   #define LOG2_COEFF_A4 -2.8415444493293762207031250e-01f
301
3.94M
   in.f = LOG2_COEFF_A0 + in.f * (LOG2_COEFF_A1
302
3.94M
               + in.f * (LOG2_COEFF_A2
303
3.94M
               + in.f * (LOG2_COEFF_A3
304
3.94M
               + in.f * (LOG2_COEFF_A4))));
305
3.94M
   return integer + in.f + log2_y_norm_coeff[range_idx];
306
3.94M
}
Unexecuted instantiation: pitch_sse.c:celt_log2
Unexecuted instantiation: vq_sse2.c:celt_log2
opus_multistream_encoder.c:celt_log2
Line
Count
Source
273
990
{
274
990
   opus_int32 integer;
275
990
   opus_int32 range_idx;
276
990
   union {
277
990
      float f;
278
990
      opus_uint32 i;
279
990
   } in;
280
990
   in.f = x;
281
990
   integer = (opus_int32)(in.i>>23)-127;
282
990
   in.i = (opus_int32)in.i - (opus_int32)((opus_uint32)integer<<23);
283
284
   /* Normalize the mantissa range from [1, 2] to [1,1.125], and then shift x
285
    * by 1.0625 to [-0.0625, 0.0625]. */
286
990
   range_idx = (in.i >> 20) & 0x7;
287
990
   in.f = in.f * log2_x_norm_coeff[range_idx] - 1.0625f;
288
289
   /* Polynomial coefficients approximated in the [1, 1.125] range.
290
    * Lolremez command: lolremez --degree 4 --range -0.0625:0.0625
291
    *                   "log(x+1.0625)/log(2)"
292
    * Coefficients in Double Precision
293
    * A0: 8.7462840624502679e-2    A1: 1.3578296070972002
294
    * A2: -6.3897703690210047e-1   A3: 4.0197125617419959e-1
295
    * A4: -2.8415445877832832e-1 */
296
990
   #define LOG2_COEFF_A0 8.74628424644470214843750000e-02f
297
990
   #define LOG2_COEFF_A1 1.357829570770263671875000000000f
298
990
   #define LOG2_COEFF_A2 -6.3897705078125000000000000e-01f
299
990
   #define LOG2_COEFF_A3 4.01971250772476196289062500e-01f
300
990
   #define LOG2_COEFF_A4 -2.8415444493293762207031250e-01f
301
990
   in.f = LOG2_COEFF_A0 + in.f * (LOG2_COEFF_A1
302
990
               + in.f * (LOG2_COEFF_A2
303
990
               + in.f * (LOG2_COEFF_A3
304
990
               + in.f * (LOG2_COEFF_A4))));
305
990
   return integer + in.f + log2_y_norm_coeff[range_idx];
306
990
}
307
308
/* Calculates an approximation of 2^x. The approximation was achieved by
309
 * employing a base-2 exponential function and utilizing a Remez approximation
310
 * of order 5, ensuring a controlled relative error.
311
 * exp2(x) = exp2(integer + fraction)
312
 *         = exp2(integer) * exp2(fraction) */
313
static OPUS_INLINE float celt_exp2(float x)
314
3.88M
{
315
3.88M
   opus_int32 integer;
316
3.88M
   float frac;
317
3.88M
   union {
318
3.88M
      float f;
319
3.88M
      opus_uint32 i;
320
3.88M
   } res;
321
3.88M
   integer = (int)floor(x);
322
3.88M
   if (integer < -50)
323
3.82k
      return 0;
324
3.88M
   frac = x-integer;
325
326
   /* Polynomial coefficients approximated in the [0, 1] range.
327
    * Lolremez command: lolremez --degree 5 --range 0:1
328
    *                   "exp(x*0.693147180559945)" "exp(x*0.693147180559945)"
329
    * NOTE: log(2) ~ 0.693147180559945 */
330
3.88M
   #define EXP2_COEFF_A0 9.999999403953552246093750000000e-01f
331
3.88M
   #define EXP2_COEFF_A1 6.931530833244323730468750000000e-01f
332
3.88M
   #define EXP2_COEFF_A2 2.401536107063293457031250000000e-01f
333
3.88M
   #define EXP2_COEFF_A3 5.582631751894950866699218750000e-02f
334
3.88M
   #define EXP2_COEFF_A4 8.989339694380760192871093750000e-03f
335
3.88M
   #define EXP2_COEFF_A5 1.877576694823801517486572265625e-03f
336
3.88M
   res.f = EXP2_COEFF_A0 + frac * (EXP2_COEFF_A1
337
3.88M
               + frac * (EXP2_COEFF_A2
338
3.88M
               + frac * (EXP2_COEFF_A3
339
3.88M
               + frac * (EXP2_COEFF_A4
340
3.88M
               + frac * (EXP2_COEFF_A5)))));
341
3.88M
   res.i = (opus_uint32)((opus_int32)res.i + (opus_int32)((opus_uint32)integer<<23)) & 0x7fffffff;
342
3.88M
   return res.f;
343
3.88M
}
opus_encoder.c:celt_exp2
Line
Count
Source
314
8.59k
{
315
8.59k
   opus_int32 integer;
316
8.59k
   float frac;
317
8.59k
   union {
318
8.59k
      float f;
319
8.59k
      opus_uint32 i;
320
8.59k
   } res;
321
8.59k
   integer = (int)floor(x);
322
8.59k
   if (integer < -50)
323
166
      return 0;
324
8.43k
   frac = x-integer;
325
326
   /* Polynomial coefficients approximated in the [0, 1] range.
327
    * Lolremez command: lolremez --degree 5 --range 0:1
328
    *                   "exp(x*0.693147180559945)" "exp(x*0.693147180559945)"
329
    * NOTE: log(2) ~ 0.693147180559945 */
330
8.43k
   #define EXP2_COEFF_A0 9.999999403953552246093750000000e-01f
331
8.43k
   #define EXP2_COEFF_A1 6.931530833244323730468750000000e-01f
332
8.43k
   #define EXP2_COEFF_A2 2.401536107063293457031250000000e-01f
333
8.43k
   #define EXP2_COEFF_A3 5.582631751894950866699218750000e-02f
334
8.43k
   #define EXP2_COEFF_A4 8.989339694380760192871093750000e-03f
335
8.43k
   #define EXP2_COEFF_A5 1.877576694823801517486572265625e-03f
336
8.43k
   res.f = EXP2_COEFF_A0 + frac * (EXP2_COEFF_A1
337
8.43k
               + frac * (EXP2_COEFF_A2
338
8.43k
               + frac * (EXP2_COEFF_A3
339
8.43k
               + frac * (EXP2_COEFF_A4
340
8.43k
               + frac * (EXP2_COEFF_A5)))));
341
8.43k
   res.i = (opus_uint32)((opus_int32)res.i + (opus_int32)((opus_uint32)integer<<23)) & 0x7fffffff;
342
8.43k
   return res.f;
343
8.59k
}
celt_encoder.c:celt_exp2
Line
Count
Source
314
887k
{
315
887k
   opus_int32 integer;
316
887k
   float frac;
317
887k
   union {
318
887k
      float f;
319
887k
      opus_uint32 i;
320
887k
   } res;
321
887k
   integer = (int)floor(x);
322
887k
   if (integer < -50)
323
0
      return 0;
324
887k
   frac = x-integer;
325
326
   /* Polynomial coefficients approximated in the [0, 1] range.
327
    * Lolremez command: lolremez --degree 5 --range 0:1
328
    *                   "exp(x*0.693147180559945)" "exp(x*0.693147180559945)"
329
    * NOTE: log(2) ~ 0.693147180559945 */
330
887k
   #define EXP2_COEFF_A0 9.999999403953552246093750000000e-01f
331
887k
   #define EXP2_COEFF_A1 6.931530833244323730468750000000e-01f
332
887k
   #define EXP2_COEFF_A2 2.401536107063293457031250000000e-01f
333
887k
   #define EXP2_COEFF_A3 5.582631751894950866699218750000e-02f
334
887k
   #define EXP2_COEFF_A4 8.989339694380760192871093750000e-03f
335
887k
   #define EXP2_COEFF_A5 1.877576694823801517486572265625e-03f
336
887k
   res.f = EXP2_COEFF_A0 + frac * (EXP2_COEFF_A1
337
887k
               + frac * (EXP2_COEFF_A2
338
887k
               + frac * (EXP2_COEFF_A3
339
887k
               + frac * (EXP2_COEFF_A4
340
887k
               + frac * (EXP2_COEFF_A5)))));
341
887k
   res.i = (opus_uint32)((opus_int32)res.i + (opus_int32)((opus_uint32)integer<<23)) & 0x7fffffff;
342
887k
   return res.f;
343
887k
}
Unexecuted instantiation: pitch_sse.c:celt_exp2
Unexecuted instantiation: opus_decoder.c:celt_exp2
bands.c:celt_exp2
Line
Count
Source
314
2.99M
{
315
2.99M
   opus_int32 integer;
316
2.99M
   float frac;
317
2.99M
   union {
318
2.99M
      float f;
319
2.99M
      opus_uint32 i;
320
2.99M
   } res;
321
2.99M
   integer = (int)floor(x);
322
2.99M
   if (integer < -50)
323
3.65k
      return 0;
324
2.98M
   frac = x-integer;
325
326
   /* Polynomial coefficients approximated in the [0, 1] range.
327
    * Lolremez command: lolremez --degree 5 --range 0:1
328
    *                   "exp(x*0.693147180559945)" "exp(x*0.693147180559945)"
329
    * NOTE: log(2) ~ 0.693147180559945 */
330
2.98M
   #define EXP2_COEFF_A0 9.999999403953552246093750000000e-01f
331
2.98M
   #define EXP2_COEFF_A1 6.931530833244323730468750000000e-01f
332
2.98M
   #define EXP2_COEFF_A2 2.401536107063293457031250000000e-01f
333
2.98M
   #define EXP2_COEFF_A3 5.582631751894950866699218750000e-02f
334
2.98M
   #define EXP2_COEFF_A4 8.989339694380760192871093750000e-03f
335
2.98M
   #define EXP2_COEFF_A5 1.877576694823801517486572265625e-03f
336
2.98M
   res.f = EXP2_COEFF_A0 + frac * (EXP2_COEFF_A1
337
2.98M
               + frac * (EXP2_COEFF_A2
338
2.98M
               + frac * (EXP2_COEFF_A3
339
2.98M
               + frac * (EXP2_COEFF_A4
340
2.98M
               + frac * (EXP2_COEFF_A5)))));
341
2.98M
   res.i = (opus_uint32)((opus_int32)res.i + (opus_int32)((opus_uint32)integer<<23)) & 0x7fffffff;
342
2.98M
   return res.f;
343
2.99M
}
Unexecuted instantiation: vq_sse2.c:celt_exp2
344
345
#else
346
#define celt_log2(x) ((float)(1.442695040888963387*log(x)))
347
#define celt_exp2(x) ((float)exp(0.6931471805599453094*(x)))
348
#endif
349
350
3.83M
#define celt_exp2_db celt_exp2
351
8.61M
#define celt_log2_db celt_log2
352
353
#define celt_sin(x) celt_cos_norm2((0.5f*PI) * (x) - 1.0f)
354
#define celt_log(x) (celt_log2(x) * 0.6931471805599453f)
355
#define celt_exp(x) (celt_exp2((x) * 1.4426950408889634f))
356
357
#endif
358
359
#ifdef FIXED_POINT
360
361
#include "os_support.h"
362
363
#ifndef OVERRIDE_CELT_ILOG2
364
/** Integer log in base2. Undefined for zero and negative numbers */
365
static OPUS_INLINE opus_int16 celt_ilog2(opus_int32 x)
366
68.8M
{
367
68.8M
   celt_sig_assert(x>0);
368
68.8M
   return EC_ILOG(x)-1;
369
68.8M
}
Unexecuted instantiation: celt.c:celt_ilog2
Unexecuted instantiation: opus.c:celt_ilog2
Unexecuted instantiation: opus_decoder.c:celt_ilog2
celt_decoder.c:celt_ilog2
Line
Count
Source
366
141k
{
367
141k
   celt_sig_assert(x>0);
368
   return EC_ILOG(x)-1;
369
141k
}
mathops.c:celt_ilog2
Line
Count
Source
366
26.5M
{
367
26.5M
   celt_sig_assert(x>0);
368
   return EC_ILOG(x)-1;
369
26.5M
}
mdct.c:celt_ilog2
Line
Count
Source
366
3.63M
{
367
3.63M
   celt_sig_assert(x>0);
368
   return EC_ILOG(x)-1;
369
3.63M
}
Unexecuted instantiation: modes.c:celt_ilog2
pitch.c:celt_ilog2
Line
Count
Source
366
2.05M
{
367
2.05M
   celt_sig_assert(x>0);
368
   return EC_ILOG(x)-1;
369
2.05M
}
celt_lpc.c:celt_ilog2
Line
Count
Source
366
1.43M
{
367
1.43M
   celt_sig_assert(x>0);
368
   return EC_ILOG(x)-1;
369
1.43M
}
quant_bands.c:celt_ilog2
Line
Count
Source
366
4.66M
{
367
4.66M
   celt_sig_assert(x>0);
368
   return EC_ILOG(x)-1;
369
4.66M
}
Unexecuted instantiation: rate.c:celt_ilog2
vq.c:celt_ilog2
Line
Count
Source
366
13.2M
{
367
13.2M
   celt_sig_assert(x>0);
368
   return EC_ILOG(x)-1;
369
13.2M
}
Unexecuted instantiation: pitch_sse2.c:celt_ilog2
Unexecuted instantiation: celt_lpc_sse4_1.c:celt_ilog2
Unexecuted instantiation: pitch_sse4_1.c:celt_ilog2
bands.c:celt_ilog2
Line
Count
Source
366
14.1M
{
367
14.1M
   celt_sig_assert(x>0);
368
   return EC_ILOG(x)-1;
369
14.1M
}
Unexecuted instantiation: cwrs.c:celt_ilog2
Unexecuted instantiation: kiss_fft.c:celt_ilog2
Unexecuted instantiation: laplace.c:celt_ilog2
Unexecuted instantiation: opus_projection_encoder.c:celt_ilog2
opus_encoder.c:celt_ilog2
Line
Count
Source
366
2.05M
{
367
2.05M
   celt_sig_assert(x>0);
368
   return EC_ILOG(x)-1;
369
2.05M
}
opus_multistream_encoder.c:celt_ilog2
Line
Count
Source
366
1.43k
{
367
1.43k
   celt_sig_assert(x>0);
368
   return EC_ILOG(x)-1;
369
1.43k
}
Unexecuted instantiation: analysis.c:celt_ilog2
celt_encoder.c:celt_ilog2
Line
Count
Source
366
852k
{
367
852k
   celt_sig_assert(x>0);
368
   return EC_ILOG(x)-1;
369
852k
}
Unexecuted instantiation: opus_projection_decoder.c:celt_ilog2
370
#endif
371
372
373
/** Integer log in base2. Defined for zero, but not for negative numbers */
374
static OPUS_INLINE opus_int16 celt_zlog2(opus_val32 x)
375
4.83M
{
376
4.83M
   return x <= 0 ? 0 : celt_ilog2(x);
377
4.83M
}
Unexecuted instantiation: celt.c:celt_zlog2
Unexecuted instantiation: opus.c:celt_zlog2
Unexecuted instantiation: opus_decoder.c:celt_zlog2
celt_decoder.c:celt_zlog2
Line
Count
Source
375
186k
{
376
186k
   return x <= 0 ? 0 : celt_ilog2(x);
377
186k
}
Unexecuted instantiation: mathops.c:celt_zlog2
mdct.c:celt_zlog2
Line
Count
Source
375
696k
{
376
696k
   return x <= 0 ? 0 : celt_ilog2(x);
377
696k
}
Unexecuted instantiation: modes.c:celt_zlog2
Unexecuted instantiation: pitch.c:celt_zlog2
Unexecuted instantiation: celt_lpc.c:celt_zlog2
Unexecuted instantiation: quant_bands.c:celt_zlog2
Unexecuted instantiation: rate.c:celt_zlog2
Unexecuted instantiation: vq.c:celt_zlog2
Unexecuted instantiation: pitch_sse2.c:celt_zlog2
Unexecuted instantiation: celt_lpc_sse4_1.c:celt_zlog2
Unexecuted instantiation: pitch_sse4_1.c:celt_zlog2
bands.c:celt_zlog2
Line
Count
Source
375
3.94M
{
376
3.94M
   return x <= 0 ? 0 : celt_ilog2(x);
377
3.94M
}
Unexecuted instantiation: cwrs.c:celt_zlog2
Unexecuted instantiation: kiss_fft.c:celt_zlog2
Unexecuted instantiation: laplace.c:celt_zlog2
Unexecuted instantiation: opus_projection_encoder.c:celt_zlog2
Unexecuted instantiation: opus_encoder.c:celt_zlog2
Unexecuted instantiation: opus_multistream_encoder.c:celt_zlog2
Unexecuted instantiation: analysis.c:celt_zlog2
Unexecuted instantiation: celt_encoder.c:celt_zlog2
Unexecuted instantiation: opus_projection_decoder.c:celt_zlog2
378
379
opus_val16 celt_rsqrt_norm(opus_val32 x);
380
381
opus_val32 celt_rsqrt_norm32(opus_val32 x);
382
383
opus_val32 celt_sqrt(opus_val32 x);
384
385
opus_val32 celt_sqrt32(opus_val32 x);
386
387
opus_val16 celt_cos_norm(opus_val32 x);
388
389
opus_val32 celt_cos_norm32(opus_val32 x);
390
391
/** Base-2 logarithm approximation (log2(x)). (Q14 input, Q10 output) */
392
static OPUS_INLINE opus_val16 celt_log2(opus_val32 x)
393
2.50M
{
394
2.50M
   int i;
395
2.50M
   opus_val16 n, frac;
396
   /* -0.41509302963303146, 0.9609890551383969, -0.31836011537636605,
397
       0.15530808010959576, -0.08556153059057618 */
398
2.50M
   static const opus_val16 C[5] = {-6801+(1<<(13-10)), 15746, -5217, 2545, -1401};
399
2.50M
   if (x==0)
400
0
      return -32767;
401
2.50M
   i = celt_ilog2(x);
402
2.50M
   n = VSHR32(x,i-15)-32768-16384;
403
2.50M
   frac = ADD16(C[0], MULT16_16_Q15(n, ADD16(C[1], MULT16_16_Q15(n, ADD16(C[2], MULT16_16_Q15(n, ADD16(C[3], MULT16_16_Q15(n, C[4]))))))));
404
2.50M
   return SHL32(i-13,10)+SHR32(frac,14-10);
405
2.50M
}
Unexecuted instantiation: celt.c:celt_log2
Unexecuted instantiation: opus.c:celt_log2
Unexecuted instantiation: opus_decoder.c:celt_log2
Unexecuted instantiation: celt_decoder.c:celt_log2
Unexecuted instantiation: mathops.c:celt_log2
Unexecuted instantiation: mdct.c:celt_log2
Unexecuted instantiation: modes.c:celt_log2
Unexecuted instantiation: pitch.c:celt_log2
Unexecuted instantiation: celt_lpc.c:celt_log2
quant_bands.c:celt_log2
Line
Count
Source
393
2.34M
{
394
2.34M
   int i;
395
2.34M
   opus_val16 n, frac;
396
   /* -0.41509302963303146, 0.9609890551383969, -0.31836011537636605,
397
       0.15530808010959576, -0.08556153059057618 */
398
2.34M
   static const opus_val16 C[5] = {-6801+(1<<(13-10)), 15746, -5217, 2545, -1401};
399
2.34M
   if (x==0)
400
0
      return -32767;
401
2.34M
   i = celt_ilog2(x);
402
2.34M
   n = VSHR32(x,i-15)-32768-16384;
403
2.34M
   frac = ADD16(C[0], MULT16_16_Q15(n, ADD16(C[1], MULT16_16_Q15(n, ADD16(C[2], MULT16_16_Q15(n, ADD16(C[3], MULT16_16_Q15(n, C[4]))))))));
404
2.34M
   return SHL32(i-13,10)+SHR32(frac,14-10);
405
2.34M
}
Unexecuted instantiation: rate.c:celt_log2
Unexecuted instantiation: vq.c:celt_log2
Unexecuted instantiation: pitch_sse2.c:celt_log2
Unexecuted instantiation: celt_lpc_sse4_1.c:celt_log2
Unexecuted instantiation: pitch_sse4_1.c:celt_log2
Unexecuted instantiation: bands.c:celt_log2
Unexecuted instantiation: cwrs.c:celt_log2
Unexecuted instantiation: kiss_fft.c:celt_log2
Unexecuted instantiation: laplace.c:celt_log2
Unexecuted instantiation: opus_projection_encoder.c:celt_log2
Unexecuted instantiation: opus_encoder.c:celt_log2
opus_multistream_encoder.c:celt_log2
Line
Count
Source
393
1.43k
{
394
1.43k
   int i;
395
1.43k
   opus_val16 n, frac;
396
   /* -0.41509302963303146, 0.9609890551383969, -0.31836011537636605,
397
       0.15530808010959576, -0.08556153059057618 */
398
1.43k
   static const opus_val16 C[5] = {-6801+(1<<(13-10)), 15746, -5217, 2545, -1401};
399
1.43k
   if (x==0)
400
0
      return -32767;
401
1.43k
   i = celt_ilog2(x);
402
1.43k
   n = VSHR32(x,i-15)-32768-16384;
403
1.43k
   frac = ADD16(C[0], MULT16_16_Q15(n, ADD16(C[1], MULT16_16_Q15(n, ADD16(C[2], MULT16_16_Q15(n, ADD16(C[3], MULT16_16_Q15(n, C[4]))))))));
404
1.43k
   return SHL32(i-13,10)+SHR32(frac,14-10);
405
1.43k
}
Unexecuted instantiation: analysis.c:celt_log2
celt_encoder.c:celt_log2
Line
Count
Source
393
156k
{
394
156k
   int i;
395
156k
   opus_val16 n, frac;
396
   /* -0.41509302963303146, 0.9609890551383969, -0.31836011537636605,
397
       0.15530808010959576, -0.08556153059057618 */
398
156k
   static const opus_val16 C[5] = {-6801+(1<<(13-10)), 15746, -5217, 2545, -1401};
399
156k
   if (x==0)
400
0
      return -32767;
401
156k
   i = celt_ilog2(x);
402
156k
   n = VSHR32(x,i-15)-32768-16384;
403
156k
   frac = ADD16(C[0], MULT16_16_Q15(n, ADD16(C[1], MULT16_16_Q15(n, ADD16(C[2], MULT16_16_Q15(n, ADD16(C[3], MULT16_16_Q15(n, C[4]))))))));
404
156k
   return SHL32(i-13,10)+SHR32(frac,14-10);
405
156k
}
Unexecuted instantiation: opus_projection_decoder.c:celt_log2
406
407
/*
408
 K0 = 1
409
 K1 = log(2)
410
 K2 = 3-4*log(2)
411
 K3 = 3*log(2) - 2
412
*/
413
#define D0 16383
414
#define D1 22804
415
#define D2 14819
416
#define D3 10204
417
418
static OPUS_INLINE opus_val32 celt_exp2_frac(opus_val16 x)
419
2.29M
{
420
2.29M
   opus_val16 frac;
421
2.29M
   frac = SHL16(x, 4);
422
2.29M
   return ADD16(D0, MULT16_16_Q15(frac, ADD16(D1, MULT16_16_Q15(frac, ADD16(D2 , MULT16_16_Q15(D3,frac))))));
423
2.29M
}
Unexecuted instantiation: celt.c:celt_exp2_frac
Unexecuted instantiation: opus.c:celt_exp2_frac
Unexecuted instantiation: opus_decoder.c:celt_exp2_frac
Unexecuted instantiation: celt_decoder.c:celt_exp2_frac
Unexecuted instantiation: mathops.c:celt_exp2_frac
Unexecuted instantiation: mdct.c:celt_exp2_frac
Unexecuted instantiation: modes.c:celt_exp2_frac
Unexecuted instantiation: pitch.c:celt_exp2_frac
Unexecuted instantiation: celt_lpc.c:celt_exp2_frac
Unexecuted instantiation: quant_bands.c:celt_exp2_frac
Unexecuted instantiation: rate.c:celt_exp2_frac
Unexecuted instantiation: vq.c:celt_exp2_frac
Unexecuted instantiation: pitch_sse2.c:celt_exp2_frac
Unexecuted instantiation: celt_lpc_sse4_1.c:celt_exp2_frac
Unexecuted instantiation: pitch_sse4_1.c:celt_exp2_frac
bands.c:celt_exp2_frac
Line
Count
Source
419
1.75M
{
420
1.75M
   opus_val16 frac;
421
1.75M
   frac = SHL16(x, 4);
422
1.75M
   return ADD16(D0, MULT16_16_Q15(frac, ADD16(D1, MULT16_16_Q15(frac, ADD16(D2 , MULT16_16_Q15(D3,frac))))));
423
1.75M
}
Unexecuted instantiation: cwrs.c:celt_exp2_frac
Unexecuted instantiation: kiss_fft.c:celt_exp2_frac
Unexecuted instantiation: laplace.c:celt_exp2_frac
Unexecuted instantiation: opus_projection_encoder.c:celt_exp2_frac
opus_encoder.c:celt_exp2_frac
Line
Count
Source
419
7.64k
{
420
7.64k
   opus_val16 frac;
421
7.64k
   frac = SHL16(x, 4);
422
7.64k
   return ADD16(D0, MULT16_16_Q15(frac, ADD16(D1, MULT16_16_Q15(frac, ADD16(D2 , MULT16_16_Q15(D3,frac))))));
423
7.64k
}
Unexecuted instantiation: opus_multistream_encoder.c:celt_exp2_frac
Unexecuted instantiation: analysis.c:celt_exp2_frac
Unexecuted instantiation: opus_projection_decoder.c:celt_exp2_frac
celt_encoder.c:celt_exp2_frac
Line
Count
Source
419
530k
{
420
530k
   opus_val16 frac;
421
530k
   frac = SHL16(x, 4);
422
530k
   return ADD16(D0, MULT16_16_Q15(frac, ADD16(D1, MULT16_16_Q15(frac, ADD16(D2 , MULT16_16_Q15(D3,frac))))));
423
530k
}
424
425
#undef D0
426
#undef D1
427
#undef D2
428
#undef D3
429
430
/** Base-2 exponential approximation (2^x). (Q10 input, Q16 output) */
431
static OPUS_INLINE opus_val32 celt_exp2(opus_val16 x)
432
605k
{
433
605k
   int integer;
434
605k
   opus_val16 frac;
435
605k
   integer = SHR16(x,10);
436
605k
   if (integer>14)
437
225
      return 0x7f000000;
438
605k
   else if (integer < -15)
439
2.46k
      return 0;
440
602k
   frac = celt_exp2_frac(x-SHL16(integer,10));
441
602k
   return VSHR32(EXTEND32(frac), -integer-2);
442
605k
}
Unexecuted instantiation: celt.c:celt_exp2
Unexecuted instantiation: opus.c:celt_exp2
Unexecuted instantiation: opus_decoder.c:celt_exp2
Unexecuted instantiation: celt_decoder.c:celt_exp2
Unexecuted instantiation: mathops.c:celt_exp2
Unexecuted instantiation: mdct.c:celt_exp2
Unexecuted instantiation: modes.c:celt_exp2
Unexecuted instantiation: pitch.c:celt_exp2
Unexecuted instantiation: celt_lpc.c:celt_exp2
Unexecuted instantiation: quant_bands.c:celt_exp2
Unexecuted instantiation: rate.c:celt_exp2
Unexecuted instantiation: vq.c:celt_exp2
Unexecuted instantiation: pitch_sse2.c:celt_exp2
Unexecuted instantiation: celt_lpc_sse4_1.c:celt_exp2
Unexecuted instantiation: pitch_sse4_1.c:celt_exp2
bands.c:celt_exp2
Line
Count
Source
432
65.8k
{
433
65.8k
   int integer;
434
65.8k
   opus_val16 frac;
435
65.8k
   integer = SHR16(x,10);
436
65.8k
   if (integer>14)
437
0
      return 0x7f000000;
438
65.8k
   else if (integer < -15)
439
861
      return 0;
440
64.9k
   frac = celt_exp2_frac(x-SHL16(integer,10));
441
64.9k
   return VSHR32(EXTEND32(frac), -integer-2);
442
65.8k
}
Unexecuted instantiation: cwrs.c:celt_exp2
Unexecuted instantiation: kiss_fft.c:celt_exp2
Unexecuted instantiation: laplace.c:celt_exp2
Unexecuted instantiation: opus_projection_encoder.c:celt_exp2
opus_encoder.c:celt_exp2
Line
Count
Source
432
9.46k
{
433
9.46k
   int integer;
434
9.46k
   opus_val16 frac;
435
9.46k
   integer = SHR16(x,10);
436
9.46k
   if (integer>14)
437
225
      return 0x7f000000;
438
9.24k
   else if (integer < -15)
439
1.59k
      return 0;
440
7.64k
   frac = celt_exp2_frac(x-SHL16(integer,10));
441
7.64k
   return VSHR32(EXTEND32(frac), -integer-2);
442
9.46k
}
Unexecuted instantiation: opus_multistream_encoder.c:celt_exp2
Unexecuted instantiation: analysis.c:celt_exp2
Unexecuted instantiation: opus_projection_decoder.c:celt_exp2
celt_encoder.c:celt_exp2
Line
Count
Source
432
530k
{
433
530k
   int integer;
434
530k
   opus_val16 frac;
435
530k
   integer = SHR16(x,10);
436
530k
   if (integer>14)
437
0
      return 0x7f000000;
438
530k
   else if (integer < -15)
439
0
      return 0;
440
530k
   frac = celt_exp2_frac(x-SHL16(integer,10));
441
530k
   return VSHR32(EXTEND32(frac), -integer-2);
442
530k
}
443
444
#ifdef ENABLE_QEXT
445
446
/* Calculates the base-2 logarithm of a Q14 input value. The result is returned
447
 * in Q(DB_SHIFT). If the input value is 0, the function will output -32.0f. */
448
2.31M
static OPUS_INLINE opus_val32 celt_log2_db(opus_val32 x) {
449
   /* Q30 */
450
2.31M
   static const opus_val32 log2_x_norm_coeff[8] = {
451
2.31M
      1073741824, 954437184, 858993472, 780903168,
452
2.31M
      715827904,  660764224, 613566784, 572662336};
453
   /* Q24 */
454
2.31M
   static const opus_val32 log2_y_norm_coeff[8] = {
455
2.31M
      0,       2850868,  5401057,  7707983,
456
2.31M
      9814042, 11751428, 13545168, 15215099};
457
2.31M
   static const opus_val32 LOG2_COEFF_A0 = 1467383;     /* Q24 */
458
2.31M
   static const opus_val32 LOG2_COEFF_A1 = 182244800;   /* Q27 */
459
2.31M
   static const opus_val32 LOG2_COEFF_A2 = -21440512;   /* Q25 */
460
2.31M
   static const opus_val32 LOG2_COEFF_A3 = 107903336;   /* Q28 */
461
2.31M
   static const opus_val32 LOG2_COEFF_A4 = -610217024;  /* Q31 */
462
463
2.31M
   opus_int32 integer, norm_coeff_idx, tmp;
464
2.31M
   opus_val32 mantissa;
465
2.31M
   if (x==0) {
466
0
      return -536870912; /* -32.0f */
467
0
   }
468
2.31M
   integer =  SUB32(celt_ilog2(x), 14);  /* Q0 */
469
2.31M
   mantissa = VSHR32(x, integer + 14 - 29);  /* Q29 */
470
2.31M
   norm_coeff_idx = SHR32(mantissa, 29 - 3) & 0x7;
471
   /* mantissa is in Q28 (29 + Q_NORM_CONST - 31 where Q_NORM_CONST is Q30)
472
    * 285212672 (Q28) is 1.0625f. */
473
2.31M
   mantissa = SUB32(MULT32_32_Q31(mantissa, log2_x_norm_coeff[norm_coeff_idx]),
474
2.31M
                    285212672);
475
476
   /* q_a3(Q28): q_mantissa + q_a4 - 31
477
    * q_a2(Q25): q_mantissa + q_a3 - 31
478
    * q_a1(Q27): q_mantissa + q_a2 - 31 + 5
479
    * q_a0(Q24): q_mantissa + q_a1 - 31
480
    * where  q_mantissa is Q28 */
481
   /* Split evaluation in steps to avoid exploding macro expansion. */
482
2.31M
   tmp = MULT32_32_Q31(mantissa, LOG2_COEFF_A4);
483
2.31M
   tmp = MULT32_32_Q31(mantissa, ADD32(LOG2_COEFF_A3, tmp));
484
2.31M
   tmp = SHL32(MULT32_32_Q31(mantissa, ADD32(LOG2_COEFF_A2, tmp)), 5 /* SHL32 for LOG2_COEFF_A1 */);
485
2.31M
   tmp = MULT32_32_Q31(mantissa, ADD32(LOG2_COEFF_A1, tmp));
486
2.31M
   return ADD32(log2_y_norm_coeff[norm_coeff_idx],
487
2.31M
          ADD32(SHL32(integer, DB_SHIFT),
488
2.31M
          ADD32(LOG2_COEFF_A0, tmp)));
489
2.31M
}
Unexecuted instantiation: opus_projection_encoder.c:celt_log2_db
Unexecuted instantiation: celt.c:celt_log2_db
Unexecuted instantiation: mathops.c:celt_log2_db
Unexecuted instantiation: opus_encoder.c:celt_log2_db
Unexecuted instantiation: opus_multistream_encoder.c:celt_log2_db
Unexecuted instantiation: analysis.c:celt_log2_db
Unexecuted instantiation: bands.c:celt_log2_db
Unexecuted instantiation: celt_encoder.c:celt_log2_db
Unexecuted instantiation: kiss_fft.c:celt_log2_db
Unexecuted instantiation: mdct.c:celt_log2_db
Unexecuted instantiation: modes.c:celt_log2_db
Unexecuted instantiation: pitch.c:celt_log2_db
Unexecuted instantiation: celt_lpc.c:celt_log2_db
quant_bands.c:celt_log2_db
Line
Count
Source
448
2.31M
static OPUS_INLINE opus_val32 celt_log2_db(opus_val32 x) {
449
   /* Q30 */
450
2.31M
   static const opus_val32 log2_x_norm_coeff[8] = {
451
2.31M
      1073741824, 954437184, 858993472, 780903168,
452
2.31M
      715827904,  660764224, 613566784, 572662336};
453
   /* Q24 */
454
2.31M
   static const opus_val32 log2_y_norm_coeff[8] = {
455
2.31M
      0,       2850868,  5401057,  7707983,
456
2.31M
      9814042, 11751428, 13545168, 15215099};
457
2.31M
   static const opus_val32 LOG2_COEFF_A0 = 1467383;     /* Q24 */
458
2.31M
   static const opus_val32 LOG2_COEFF_A1 = 182244800;   /* Q27 */
459
2.31M
   static const opus_val32 LOG2_COEFF_A2 = -21440512;   /* Q25 */
460
2.31M
   static const opus_val32 LOG2_COEFF_A3 = 107903336;   /* Q28 */
461
2.31M
   static const opus_val32 LOG2_COEFF_A4 = -610217024;  /* Q31 */
462
463
2.31M
   opus_int32 integer, norm_coeff_idx, tmp;
464
2.31M
   opus_val32 mantissa;
465
2.31M
   if (x==0) {
466
0
      return -536870912; /* -32.0f */
467
0
   }
468
2.31M
   integer =  SUB32(celt_ilog2(x), 14);  /* Q0 */
469
2.31M
   mantissa = VSHR32(x, integer + 14 - 29);  /* Q29 */
470
2.31M
   norm_coeff_idx = SHR32(mantissa, 29 - 3) & 0x7;
471
   /* mantissa is in Q28 (29 + Q_NORM_CONST - 31 where Q_NORM_CONST is Q30)
472
    * 285212672 (Q28) is 1.0625f. */
473
2.31M
   mantissa = SUB32(MULT32_32_Q31(mantissa, log2_x_norm_coeff[norm_coeff_idx]),
474
2.31M
                    285212672);
475
476
   /* q_a3(Q28): q_mantissa + q_a4 - 31
477
    * q_a2(Q25): q_mantissa + q_a3 - 31
478
    * q_a1(Q27): q_mantissa + q_a2 - 31 + 5
479
    * q_a0(Q24): q_mantissa + q_a1 - 31
480
    * where  q_mantissa is Q28 */
481
   /* Split evaluation in steps to avoid exploding macro expansion. */
482
2.31M
   tmp = MULT32_32_Q31(mantissa, LOG2_COEFF_A4);
483
2.31M
   tmp = MULT32_32_Q31(mantissa, ADD32(LOG2_COEFF_A3, tmp));
484
2.31M
   tmp = SHL32(MULT32_32_Q31(mantissa, ADD32(LOG2_COEFF_A2, tmp)), 5 /* SHL32 for LOG2_COEFF_A1 */);
485
2.31M
   tmp = MULT32_32_Q31(mantissa, ADD32(LOG2_COEFF_A1, tmp));
486
2.31M
   return ADD32(log2_y_norm_coeff[norm_coeff_idx],
487
2.31M
          ADD32(SHL32(integer, DB_SHIFT),
488
2.31M
          ADD32(LOG2_COEFF_A0, tmp)));
489
2.31M
}
Unexecuted instantiation: rate.c:celt_log2_db
Unexecuted instantiation: vq.c:celt_log2_db
Unexecuted instantiation: pitch_sse2.c:celt_log2_db
Unexecuted instantiation: celt_lpc_sse4_1.c:celt_log2_db
Unexecuted instantiation: pitch_sse4_1.c:celt_log2_db
Unexecuted instantiation: opus.c:celt_log2_db
Unexecuted instantiation: opus_decoder.c:celt_log2_db
Unexecuted instantiation: celt_decoder.c:celt_log2_db
Unexecuted instantiation: cwrs.c:celt_log2_db
Unexecuted instantiation: laplace.c:celt_log2_db
Unexecuted instantiation: opus_projection_decoder.c:celt_log2_db
490
491
/* Calculates exp2 for Q28 within a specific range (0 to 1.0) using fixed-point
492
 * arithmetic. The input number must be adjusted for Q DB_SHIFT. */
493
static OPUS_INLINE opus_val32 celt_exp2_db_frac(opus_val32 x)
494
2.37M
{
495
   /* Approximation constants. */
496
2.37M
   static const opus_int32 EXP2_COEFF_A0 = 268435440;   /* Q28 */
497
2.37M
   static const opus_int32 EXP2_COEFF_A1 = 744267456;   /* Q30 */
498
2.37M
   static const opus_int32 EXP2_COEFF_A2 = 1031451904;  /* Q32 */
499
2.37M
   static const opus_int32 EXP2_COEFF_A3 = 959088832;   /* Q34 */
500
2.37M
   static const opus_int32 EXP2_COEFF_A4 = 617742720;   /* Q36 */
501
2.37M
   static const opus_int32 EXP2_COEFF_A5 = 516104352;   /* Q38 */
502
2.37M
   opus_int32 tmp;
503
   /* Converts input value from Q24 to Q29. */
504
2.37M
   opus_val32 x_q29 = SHL32(x, 29 - 24);
505
   /* Split evaluation in steps to avoid exploding macro expansion. */
506
2.37M
   tmp = ADD32(EXP2_COEFF_A4, MULT32_32_Q31(x_q29, EXP2_COEFF_A5));
507
2.37M
   tmp = ADD32(EXP2_COEFF_A3, MULT32_32_Q31(x_q29, tmp));
508
2.37M
   tmp = ADD32(EXP2_COEFF_A2, MULT32_32_Q31(x_q29, tmp));
509
2.37M
   tmp = ADD32(EXP2_COEFF_A1, MULT32_32_Q31(x_q29, tmp));
510
2.37M
   return ADD32(EXP2_COEFF_A0, MULT32_32_Q31(x_q29, tmp));
511
2.37M
}
Unexecuted instantiation: opus_projection_encoder.c:celt_exp2_db_frac
Unexecuted instantiation: celt.c:celt_exp2_db_frac
Unexecuted instantiation: mathops.c:celt_exp2_db_frac
Unexecuted instantiation: opus_encoder.c:celt_exp2_db_frac
Unexecuted instantiation: opus_multistream_encoder.c:celt_exp2_db_frac
Unexecuted instantiation: analysis.c:celt_exp2_db_frac
bands.c:celt_exp2_db_frac
Line
Count
Source
494
1.82M
{
495
   /* Approximation constants. */
496
1.82M
   static const opus_int32 EXP2_COEFF_A0 = 268435440;   /* Q28 */
497
1.82M
   static const opus_int32 EXP2_COEFF_A1 = 744267456;   /* Q30 */
498
1.82M
   static const opus_int32 EXP2_COEFF_A2 = 1031451904;  /* Q32 */
499
1.82M
   static const opus_int32 EXP2_COEFF_A3 = 959088832;   /* Q34 */
500
1.82M
   static const opus_int32 EXP2_COEFF_A4 = 617742720;   /* Q36 */
501
1.82M
   static const opus_int32 EXP2_COEFF_A5 = 516104352;   /* Q38 */
502
1.82M
   opus_int32 tmp;
503
   /* Converts input value from Q24 to Q29. */
504
1.82M
   opus_val32 x_q29 = SHL32(x, 29 - 24);
505
   /* Split evaluation in steps to avoid exploding macro expansion. */
506
1.82M
   tmp = ADD32(EXP2_COEFF_A4, MULT32_32_Q31(x_q29, EXP2_COEFF_A5));
507
1.82M
   tmp = ADD32(EXP2_COEFF_A3, MULT32_32_Q31(x_q29, tmp));
508
1.82M
   tmp = ADD32(EXP2_COEFF_A2, MULT32_32_Q31(x_q29, tmp));
509
1.82M
   tmp = ADD32(EXP2_COEFF_A1, MULT32_32_Q31(x_q29, tmp));
510
1.82M
   return ADD32(EXP2_COEFF_A0, MULT32_32_Q31(x_q29, tmp));
511
1.82M
}
celt_encoder.c:celt_exp2_db_frac
Line
Count
Source
494
543k
{
495
   /* Approximation constants. */
496
543k
   static const opus_int32 EXP2_COEFF_A0 = 268435440;   /* Q28 */
497
543k
   static const opus_int32 EXP2_COEFF_A1 = 744267456;   /* Q30 */
498
543k
   static const opus_int32 EXP2_COEFF_A2 = 1031451904;  /* Q32 */
499
543k
   static const opus_int32 EXP2_COEFF_A3 = 959088832;   /* Q34 */
500
543k
   static const opus_int32 EXP2_COEFF_A4 = 617742720;   /* Q36 */
501
543k
   static const opus_int32 EXP2_COEFF_A5 = 516104352;   /* Q38 */
502
543k
   opus_int32 tmp;
503
   /* Converts input value from Q24 to Q29. */
504
543k
   opus_val32 x_q29 = SHL32(x, 29 - 24);
505
   /* Split evaluation in steps to avoid exploding macro expansion. */
506
543k
   tmp = ADD32(EXP2_COEFF_A4, MULT32_32_Q31(x_q29, EXP2_COEFF_A5));
507
543k
   tmp = ADD32(EXP2_COEFF_A3, MULT32_32_Q31(x_q29, tmp));
508
543k
   tmp = ADD32(EXP2_COEFF_A2, MULT32_32_Q31(x_q29, tmp));
509
543k
   tmp = ADD32(EXP2_COEFF_A1, MULT32_32_Q31(x_q29, tmp));
510
543k
   return ADD32(EXP2_COEFF_A0, MULT32_32_Q31(x_q29, tmp));
511
543k
}
Unexecuted instantiation: kiss_fft.c:celt_exp2_db_frac
Unexecuted instantiation: mdct.c:celt_exp2_db_frac
Unexecuted instantiation: modes.c:celt_exp2_db_frac
Unexecuted instantiation: pitch.c:celt_exp2_db_frac
Unexecuted instantiation: celt_lpc.c:celt_exp2_db_frac
Unexecuted instantiation: quant_bands.c:celt_exp2_db_frac
Unexecuted instantiation: rate.c:celt_exp2_db_frac
Unexecuted instantiation: vq.c:celt_exp2_db_frac
Unexecuted instantiation: pitch_sse2.c:celt_exp2_db_frac
Unexecuted instantiation: celt_lpc_sse4_1.c:celt_exp2_db_frac
Unexecuted instantiation: pitch_sse4_1.c:celt_exp2_db_frac
Unexecuted instantiation: opus.c:celt_exp2_db_frac
Unexecuted instantiation: opus_decoder.c:celt_exp2_db_frac
Unexecuted instantiation: celt_decoder.c:celt_exp2_db_frac
Unexecuted instantiation: cwrs.c:celt_exp2_db_frac
Unexecuted instantiation: laplace.c:celt_exp2_db_frac
Unexecuted instantiation: opus_projection_decoder.c:celt_exp2_db_frac
512
513
/* Calculates exp2 for Q16 using fixed-point arithmetic. The input number must
514
 * be adjusted for Q DB_SHIFT. */
515
static OPUS_INLINE opus_val32 celt_exp2_db(opus_val32 x)
516
549k
{
517
549k
   int integer;
518
549k
   opus_val32 frac;
519
549k
   integer = SHR32(x,DB_SHIFT);
520
549k
   if (integer>14)
521
0
      return 0x7f000000;
522
549k
   else if (integer <= -17)
523
0
      return 0;
524
549k
   frac = celt_exp2_db_frac(x-SHL32(integer, DB_SHIFT));  /* Q28 */
525
549k
   return VSHR32(frac, -integer + 28 - 16);  /* Q16 */
526
549k
}
Unexecuted instantiation: opus_projection_encoder.c:celt_exp2_db
Unexecuted instantiation: celt.c:celt_exp2_db
Unexecuted instantiation: mathops.c:celt_exp2_db
Unexecuted instantiation: opus_encoder.c:celt_exp2_db
Unexecuted instantiation: opus_multistream_encoder.c:celt_exp2_db
Unexecuted instantiation: analysis.c:celt_exp2_db
bands.c:celt_exp2_db
Line
Count
Source
516
6.52k
{
517
6.52k
   int integer;
518
6.52k
   opus_val32 frac;
519
6.52k
   integer = SHR32(x,DB_SHIFT);
520
6.52k
   if (integer>14)
521
0
      return 0x7f000000;
522
6.52k
   else if (integer <= -17)
523
0
      return 0;
524
6.52k
   frac = celt_exp2_db_frac(x-SHL32(integer, DB_SHIFT));  /* Q28 */
525
6.52k
   return VSHR32(frac, -integer + 28 - 16);  /* Q16 */
526
6.52k
}
celt_encoder.c:celt_exp2_db
Line
Count
Source
516
543k
{
517
543k
   int integer;
518
543k
   opus_val32 frac;
519
543k
   integer = SHR32(x,DB_SHIFT);
520
543k
   if (integer>14)
521
0
      return 0x7f000000;
522
543k
   else if (integer <= -17)
523
0
      return 0;
524
543k
   frac = celt_exp2_db_frac(x-SHL32(integer, DB_SHIFT));  /* Q28 */
525
543k
   return VSHR32(frac, -integer + 28 - 16);  /* Q16 */
526
543k
}
Unexecuted instantiation: kiss_fft.c:celt_exp2_db
Unexecuted instantiation: mdct.c:celt_exp2_db
Unexecuted instantiation: modes.c:celt_exp2_db
Unexecuted instantiation: pitch.c:celt_exp2_db
Unexecuted instantiation: celt_lpc.c:celt_exp2_db
Unexecuted instantiation: quant_bands.c:celt_exp2_db
Unexecuted instantiation: rate.c:celt_exp2_db
Unexecuted instantiation: vq.c:celt_exp2_db
Unexecuted instantiation: pitch_sse2.c:celt_exp2_db
Unexecuted instantiation: celt_lpc_sse4_1.c:celt_exp2_db
Unexecuted instantiation: pitch_sse4_1.c:celt_exp2_db
Unexecuted instantiation: opus.c:celt_exp2_db
Unexecuted instantiation: opus_decoder.c:celt_exp2_db
Unexecuted instantiation: celt_decoder.c:celt_exp2_db
Unexecuted instantiation: cwrs.c:celt_exp2_db
Unexecuted instantiation: laplace.c:celt_exp2_db
Unexecuted instantiation: opus_projection_decoder.c:celt_exp2_db
527
#else
528
529
8.61M
#define celt_log2_db(x) SHL32(EXTEND32(celt_log2(x)), DB_SHIFT-10)
530
#define celt_exp2_db_frac(x) SHL32(celt_exp2_frac(PSHR32(x, DB_SHIFT-10)), 14)
531
#define celt_exp2_db(x) celt_exp2(PSHR32(x, DB_SHIFT-10))
532
533
#endif
534
535
536
opus_val32 celt_rcp(opus_val32 x);
537
opus_val32 celt_rcp_norm32(opus_val32 x);
538
539
1.02M
#define celt_div(a,b) MULT32_32_Q31((opus_val32)(a),celt_rcp(b))
540
541
opus_val32 frac_div32_q29(opus_val32 a, opus_val32 b);
542
opus_val32 frac_div32(opus_val32 a, opus_val32 b);
543
544
/* Computes atan(x) multiplied by 2/PI. The input value (x) should be within the
545
 * range of -1 to 1 and represented in Q30 format. The function will return the
546
 * result in Q30 format. */
547
static OPUS_INLINE opus_val32 celt_atan_norm(opus_val32 x)
548
1.45M
{
549
   /* Approximation constants. */
550
1.45M
   static const opus_int32 ATAN_2_OVER_PI = 1367130551;   /* Q31 */
551
1.45M
   static const opus_int32 ATAN_COEFF_A03 = -715791936;   /* Q31 */
552
1.45M
   static const opus_int32 ATAN_COEFF_A05 = 857391616;    /* Q32 */
553
1.45M
   static const opus_int32 ATAN_COEFF_A07 = -1200579328;  /* Q33 */
554
1.45M
   static const opus_int32 ATAN_COEFF_A09 = 1682636672;   /* Q34 */
555
1.45M
   static const opus_int32 ATAN_COEFF_A11 = -1985085440;  /* Q35 */
556
1.45M
   static const opus_int32 ATAN_COEFF_A13 = 1583306112;   /* Q36 */
557
1.45M
   static const opus_int32 ATAN_COEFF_A15 = -598602432;   /* Q37 */
558
1.45M
   opus_int32 x_sq_q30;
559
1.45M
   opus_int32 x_q31;
560
1.45M
   opus_int32 tmp;
561
   /* The expected x is in the range of [-1.0f, 1.0f] */
562
1.45M
   celt_sig_assert((x <= 1073741824) && (x >= -1073741824));
563
564
   /* If x = 1.0f, returns 0.5f */
565
1.45M
   if (x == 1073741824)
566
0
   {
567
0
      return 536870912; /* 0.5f (Q30) */
568
0
   }
569
   /* If x = 1.0f, returns 0.5f */
570
1.45M
   if (x == -1073741824)
571
0
   {
572
0
      return -536870912; /* -0.5f (Q30) */
573
0
   }
574
1.45M
   x_q31 = SHL32(x, 1);
575
1.45M
   x_sq_q30 = MULT32_32_Q31(x_q31, x);
576
   /* Split evaluation in steps to avoid exploding macro expansion. */
577
1.45M
   tmp = MULT32_32_Q31(x_sq_q30, ATAN_COEFF_A15);
578
1.45M
   tmp = MULT32_32_Q31(x_sq_q30, ADD32(ATAN_COEFF_A13, tmp));
579
1.45M
   tmp = MULT32_32_Q31(x_sq_q30, ADD32(ATAN_COEFF_A11, tmp));
580
1.45M
   tmp = MULT32_32_Q31(x_sq_q30, ADD32(ATAN_COEFF_A09, tmp));
581
1.45M
   tmp = MULT32_32_Q31(x_sq_q30, ADD32(ATAN_COEFF_A07, tmp));
582
1.45M
   tmp = MULT32_32_Q31(x_sq_q30, ADD32(ATAN_COEFF_A05, tmp));
583
1.45M
   tmp = MULT32_32_Q31(x_sq_q30, ADD32(ATAN_COEFF_A03, tmp));
584
1.45M
   tmp = ADD32(x, MULT32_32_Q31(x_q31, tmp));
585
1.45M
   return MULT32_32_Q31(ATAN_2_OVER_PI, tmp);
586
1.45M
}
Unexecuted instantiation: celt.c:celt_atan_norm
Unexecuted instantiation: opus.c:celt_atan_norm
Unexecuted instantiation: opus_decoder.c:celt_atan_norm
Unexecuted instantiation: celt_decoder.c:celt_atan_norm
Unexecuted instantiation: mathops.c:celt_atan_norm
Unexecuted instantiation: mdct.c:celt_atan_norm
Unexecuted instantiation: modes.c:celt_atan_norm
Unexecuted instantiation: pitch.c:celt_atan_norm
Unexecuted instantiation: celt_lpc.c:celt_atan_norm
Unexecuted instantiation: quant_bands.c:celt_atan_norm
Unexecuted instantiation: rate.c:celt_atan_norm
vq.c:celt_atan_norm
Line
Count
Source
548
1.45M
{
549
   /* Approximation constants. */
550
1.45M
   static const opus_int32 ATAN_2_OVER_PI = 1367130551;   /* Q31 */
551
1.45M
   static const opus_int32 ATAN_COEFF_A03 = -715791936;   /* Q31 */
552
1.45M
   static const opus_int32 ATAN_COEFF_A05 = 857391616;    /* Q32 */
553
1.45M
   static const opus_int32 ATAN_COEFF_A07 = -1200579328;  /* Q33 */
554
1.45M
   static const opus_int32 ATAN_COEFF_A09 = 1682636672;   /* Q34 */
555
1.45M
   static const opus_int32 ATAN_COEFF_A11 = -1985085440;  /* Q35 */
556
1.45M
   static const opus_int32 ATAN_COEFF_A13 = 1583306112;   /* Q36 */
557
1.45M
   static const opus_int32 ATAN_COEFF_A15 = -598602432;   /* Q37 */
558
1.45M
   opus_int32 x_sq_q30;
559
1.45M
   opus_int32 x_q31;
560
1.45M
   opus_int32 tmp;
561
   /* The expected x is in the range of [-1.0f, 1.0f] */
562
1.45M
   celt_sig_assert((x <= 1073741824) && (x >= -1073741824));
563
564
   /* If x = 1.0f, returns 0.5f */
565
1.45M
   if (x == 1073741824)
566
0
   {
567
0
      return 536870912; /* 0.5f (Q30) */
568
0
   }
569
   /* If x = 1.0f, returns 0.5f */
570
1.45M
   if (x == -1073741824)
571
0
   {
572
0
      return -536870912; /* -0.5f (Q30) */
573
0
   }
574
1.45M
   x_q31 = SHL32(x, 1);
575
1.45M
   x_sq_q30 = MULT32_32_Q31(x_q31, x);
576
   /* Split evaluation in steps to avoid exploding macro expansion. */
577
1.45M
   tmp = MULT32_32_Q31(x_sq_q30, ATAN_COEFF_A15);
578
1.45M
   tmp = MULT32_32_Q31(x_sq_q30, ADD32(ATAN_COEFF_A13, tmp));
579
1.45M
   tmp = MULT32_32_Q31(x_sq_q30, ADD32(ATAN_COEFF_A11, tmp));
580
1.45M
   tmp = MULT32_32_Q31(x_sq_q30, ADD32(ATAN_COEFF_A09, tmp));
581
1.45M
   tmp = MULT32_32_Q31(x_sq_q30, ADD32(ATAN_COEFF_A07, tmp));
582
1.45M
   tmp = MULT32_32_Q31(x_sq_q30, ADD32(ATAN_COEFF_A05, tmp));
583
1.45M
   tmp = MULT32_32_Q31(x_sq_q30, ADD32(ATAN_COEFF_A03, tmp));
584
1.45M
   tmp = ADD32(x, MULT32_32_Q31(x_q31, tmp));
585
1.45M
   return MULT32_32_Q31(ATAN_2_OVER_PI, tmp);
586
1.45M
}
Unexecuted instantiation: pitch_sse2.c:celt_atan_norm
Unexecuted instantiation: celt_lpc_sse4_1.c:celt_atan_norm
Unexecuted instantiation: pitch_sse4_1.c:celt_atan_norm
Unexecuted instantiation: bands.c:celt_atan_norm
Unexecuted instantiation: cwrs.c:celt_atan_norm
Unexecuted instantiation: kiss_fft.c:celt_atan_norm
Unexecuted instantiation: laplace.c:celt_atan_norm
Unexecuted instantiation: opus_projection_encoder.c:celt_atan_norm
Unexecuted instantiation: opus_encoder.c:celt_atan_norm
Unexecuted instantiation: opus_multistream_encoder.c:celt_atan_norm
Unexecuted instantiation: analysis.c:celt_atan_norm
Unexecuted instantiation: celt_encoder.c:celt_atan_norm
Unexecuted instantiation: opus_projection_decoder.c:celt_atan_norm
587
588
/* Calculates the arctangent of y/x, multiplies the result by 2/pi, and returns
589
 * the value in Q30 format. Both input values (x and y) must be within the range
590
 * of 0 to 1 and represented in Q30 format. Inputs must be zero or greater, and
591
 * at least one input must be non-zero. */
592
static OPUS_INLINE opus_val32 celt_atan2p_norm(opus_val32 y, opus_val32 x)
593
1.59M
{
594
1.59M
   celt_sig_assert(x>=0 && y>=0);
595
1.59M
   if (y==0 && x==0) {
596
137k
      return 0;
597
1.45M
   } else if (y < x) {
598
721k
      return celt_atan_norm(SHR32(frac_div32(y, x), 1));
599
732k
   } else {
600
732k
      celt_sig_assert(y > 0);
601
732k
      return 1073741824 /* 1.0f Q30 */ -
602
732k
             celt_atan_norm(SHR32(frac_div32(x, y), 1));
603
732k
   }
604
1.59M
}
Unexecuted instantiation: celt.c:celt_atan2p_norm
Unexecuted instantiation: opus.c:celt_atan2p_norm
Unexecuted instantiation: opus_decoder.c:celt_atan2p_norm
Unexecuted instantiation: celt_decoder.c:celt_atan2p_norm
Unexecuted instantiation: mathops.c:celt_atan2p_norm
Unexecuted instantiation: mdct.c:celt_atan2p_norm
Unexecuted instantiation: modes.c:celt_atan2p_norm
Unexecuted instantiation: pitch.c:celt_atan2p_norm
Unexecuted instantiation: celt_lpc.c:celt_atan2p_norm
Unexecuted instantiation: quant_bands.c:celt_atan2p_norm
Unexecuted instantiation: rate.c:celt_atan2p_norm
vq.c:celt_atan2p_norm
Line
Count
Source
593
1.59M
{
594
1.59M
   celt_sig_assert(x>=0 && y>=0);
595
1.59M
   if (y==0 && x==0) {
596
137k
      return 0;
597
1.45M
   } else if (y < x) {
598
721k
      return celt_atan_norm(SHR32(frac_div32(y, x), 1));
599
732k
   } else {
600
732k
      celt_sig_assert(y > 0);
601
732k
      return 1073741824 /* 1.0f Q30 */ -
602
732k
             celt_atan_norm(SHR32(frac_div32(x, y), 1));
603
732k
   }
604
1.59M
}
Unexecuted instantiation: pitch_sse2.c:celt_atan2p_norm
Unexecuted instantiation: celt_lpc_sse4_1.c:celt_atan2p_norm
Unexecuted instantiation: pitch_sse4_1.c:celt_atan2p_norm
Unexecuted instantiation: bands.c:celt_atan2p_norm
Unexecuted instantiation: cwrs.c:celt_atan2p_norm
Unexecuted instantiation: kiss_fft.c:celt_atan2p_norm
Unexecuted instantiation: laplace.c:celt_atan2p_norm
Unexecuted instantiation: opus_projection_encoder.c:celt_atan2p_norm
Unexecuted instantiation: opus_encoder.c:celt_atan2p_norm
Unexecuted instantiation: opus_multistream_encoder.c:celt_atan2p_norm
Unexecuted instantiation: analysis.c:celt_atan2p_norm
Unexecuted instantiation: celt_encoder.c:celt_atan2p_norm
Unexecuted instantiation: opus_projection_decoder.c:celt_atan2p_norm
605
606
#define M1 32767
607
#define M2 -21
608
#define M3 -11943
609
#define M4 4936
610
611
/* Atan approximation using a 4th order polynomial. Input is in Q15 format
612
   and normalized by pi/4. Output is in Q15 format */
613
static OPUS_INLINE opus_val16 celt_atan01(opus_val16 x)
614
0
{
615
0
   return MULT16_16_P15(x, ADD32(M1, MULT16_16_P15(x, ADD32(M2, MULT16_16_P15(x, ADD32(M3, MULT16_16_P15(M4, x)))))));
616
0
}
Unexecuted instantiation: celt.c:celt_atan01
Unexecuted instantiation: opus.c:celt_atan01
Unexecuted instantiation: opus_decoder.c:celt_atan01
Unexecuted instantiation: celt_decoder.c:celt_atan01
Unexecuted instantiation: mathops.c:celt_atan01
Unexecuted instantiation: mdct.c:celt_atan01
Unexecuted instantiation: modes.c:celt_atan01
Unexecuted instantiation: pitch.c:celt_atan01
Unexecuted instantiation: celt_lpc.c:celt_atan01
Unexecuted instantiation: quant_bands.c:celt_atan01
Unexecuted instantiation: rate.c:celt_atan01
Unexecuted instantiation: vq.c:celt_atan01
Unexecuted instantiation: pitch_sse2.c:celt_atan01
Unexecuted instantiation: celt_lpc_sse4_1.c:celt_atan01
Unexecuted instantiation: pitch_sse4_1.c:celt_atan01
Unexecuted instantiation: bands.c:celt_atan01
Unexecuted instantiation: cwrs.c:celt_atan01
Unexecuted instantiation: kiss_fft.c:celt_atan01
Unexecuted instantiation: laplace.c:celt_atan01
Unexecuted instantiation: opus_projection_encoder.c:celt_atan01
Unexecuted instantiation: opus_encoder.c:celt_atan01
Unexecuted instantiation: opus_multistream_encoder.c:celt_atan01
Unexecuted instantiation: analysis.c:celt_atan01
Unexecuted instantiation: celt_encoder.c:celt_atan01
Unexecuted instantiation: opus_projection_decoder.c:celt_atan01
617
618
#undef M1
619
#undef M2
620
#undef M3
621
#undef M4
622
623
/* atan2() approximation valid for positive input values */
624
static OPUS_INLINE opus_val16 celt_atan2p(opus_val16 y, opus_val16 x)
625
0
{
626
0
   if (x==0 && y==0) {
627
0
      return 0;
628
0
   } else if (y < x)
629
0
   {
630
0
      opus_val32 arg;
631
0
      arg = celt_div(SHL32(EXTEND32(y),15),x);
632
0
      if (arg >= 32767)
633
0
         arg = 32767;
634
0
      return SHR16(celt_atan01(EXTRACT16(arg)),1);
635
0
   } else {
636
0
      opus_val32 arg;
637
0
      arg = celt_div(SHL32(EXTEND32(x),15),y);
638
0
      if (arg >= 32767)
639
0
         arg = 32767;
640
0
      return 25736-SHR16(celt_atan01(EXTRACT16(arg)),1);
641
0
   }
642
0
}
Unexecuted instantiation: celt.c:celt_atan2p
Unexecuted instantiation: opus.c:celt_atan2p
Unexecuted instantiation: opus_decoder.c:celt_atan2p
Unexecuted instantiation: celt_decoder.c:celt_atan2p
Unexecuted instantiation: mathops.c:celt_atan2p
Unexecuted instantiation: mdct.c:celt_atan2p
Unexecuted instantiation: modes.c:celt_atan2p
Unexecuted instantiation: pitch.c:celt_atan2p
Unexecuted instantiation: celt_lpc.c:celt_atan2p
Unexecuted instantiation: quant_bands.c:celt_atan2p
Unexecuted instantiation: rate.c:celt_atan2p
Unexecuted instantiation: vq.c:celt_atan2p
Unexecuted instantiation: pitch_sse2.c:celt_atan2p
Unexecuted instantiation: celt_lpc_sse4_1.c:celt_atan2p
Unexecuted instantiation: pitch_sse4_1.c:celt_atan2p
Unexecuted instantiation: bands.c:celt_atan2p
Unexecuted instantiation: cwrs.c:celt_atan2p
Unexecuted instantiation: kiss_fft.c:celt_atan2p
Unexecuted instantiation: laplace.c:celt_atan2p
Unexecuted instantiation: opus_projection_encoder.c:celt_atan2p
Unexecuted instantiation: opus_encoder.c:celt_atan2p
Unexecuted instantiation: opus_multistream_encoder.c:celt_atan2p
Unexecuted instantiation: analysis.c:celt_atan2p
Unexecuted instantiation: celt_encoder.c:celt_atan2p
Unexecuted instantiation: opus_projection_decoder.c:celt_atan2p
643
644
#endif /* FIXED_POINT */
645
646
#ifndef DISABLE_FLOAT_API
647
648
void celt_float2int16_c(const float * OPUS_RESTRICT in, short * OPUS_RESTRICT out, int cnt);
649
650
#ifndef OVERRIDE_FLOAT2INT16
651
0
#define celt_float2int16(in, out, cnt, arch) ((void)(arch), celt_float2int16_c(in, out, cnt))
652
#endif
653
654
int opus_limit2_checkwithin1_c(float *samples, int cnt);
655
656
#ifndef OVERRIDE_LIMIT2_CHECKWITHIN1
657
0
#define opus_limit2_checkwithin1(samples, cnt, arch) ((void)(arch), opus_limit2_checkwithin1_c(samples, cnt))
658
#endif
659
660
#endif /* DISABLE_FLOAT_API */
661
662
#endif /* MATHOPS_H */