Coverage Report

Created: 2026-06-07 08:05

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/opus/silk/float/SigProc_FLP.h
Line
Count
Source
1
/***********************************************************************
2
Copyright (c) 2006-2011, Skype Limited. All rights reserved.
3
Redistribution and use in source and binary forms, with or without
4
modification, are permitted provided that the following conditions
5
are met:
6
- Redistributions of source code must retain the above copyright notice,
7
this list of conditions and the following disclaimer.
8
- Redistributions in binary form must reproduce the above copyright
9
notice, this list of conditions and the following disclaimer in the
10
documentation and/or other materials provided with the distribution.
11
- Neither the name of Internet Society, IETF or IETF Trust, nor the
12
names of specific contributors, may be used to endorse or promote
13
products derived from this software without specific prior written
14
permission.
15
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25
POSSIBILITY OF SUCH DAMAGE.
26
***********************************************************************/
27
28
#ifndef SILK_SIGPROC_FLP_H
29
#define SILK_SIGPROC_FLP_H
30
31
#include "SigProc_FIX.h"
32
#include "float_cast.h"
33
#include "main.h"
34
#include <math.h>
35
36
37
/********************************************************************/
38
/*                    SIGNAL PROCESSING FUNCTIONS                   */
39
/********************************************************************/
40
41
/* Chirp (bw expand) LP AR filter */
42
void silk_bwexpander_FLP(
43
    silk_float          *ar,                /* I/O  AR filter to be expanded (without leading 1)                */
44
    const opus_int      d,                  /* I    length of ar                                                */
45
    const silk_float    chirp               /* I    chirp factor (typically in range (0..1) )                   */
46
);
47
48
/* compute inverse of LPC prediction gain, and                          */
49
/* test if LPC coefficients are stable (all poles within unit circle)   */
50
/* this code is based on silk_FLP_a2k()                                 */
51
silk_float silk_LPC_inverse_pred_gain_FLP(  /* O    return inverse prediction gain, energy domain               */
52
    const silk_float    *A,                 /* I    prediction coefficients [order]                             */
53
    opus_int32          order               /* I    prediction order                                            */
54
);
55
56
silk_float silk_schur_FLP(                  /* O    returns residual energy                                     */
57
    silk_float          refl_coef[],        /* O    reflection coefficients (length order)                      */
58
    const silk_float    auto_corr[],        /* I    autocorrelation sequence (length order+1)                   */
59
    opus_int            order               /* I    order                                                       */
60
);
61
62
void silk_k2a_FLP(
63
    silk_float          *A,                 /* O     prediction coefficients [order]                            */
64
    const silk_float    *rc,                /* I     reflection coefficients [order]                            */
65
    opus_int32          order               /* I     prediction order                                           */
66
);
67
68
/* compute autocorrelation */
69
void silk_autocorrelation_FLP(
70
    silk_float          *results,           /* O    result (length correlationCount)                            */
71
    const silk_float    *inputData,         /* I    input data to correlate                                     */
72
    opus_int            inputDataSize,      /* I    length of input                                             */
73
    opus_int            correlationCount,    /* I    number of correlation taps to compute                       */
74
    int                 arch
75
);
76
77
opus_int silk_pitch_analysis_core_FLP(      /* O    Voicing estimate: 0 voiced, 1 unvoiced                      */
78
    const silk_float    *frame,             /* I    Signal of length PE_FRAME_LENGTH_MS*Fs_kHz                  */
79
    opus_int            *pitch_out,         /* O    Pitch lag values [nb_subfr]                                 */
80
    opus_int16          *lagIndex,          /* O    Lag Index                                                   */
81
    opus_int8           *contourIndex,      /* O    Pitch contour Index                                         */
82
    silk_float          *LTPCorr,           /* I/O  Normalized correlation; input: value from previous frame    */
83
    opus_int            prevLag,            /* I    Last lag of previous frame; set to zero is unvoiced         */
84
    const silk_float    search_thres1,      /* I    First stage threshold for lag candidates 0 - 1              */
85
    const silk_float    search_thres2,      /* I    Final threshold for lag candidates 0 - 1                    */
86
    const opus_int      Fs_kHz,             /* I    sample frequency (kHz)                                      */
87
    const opus_int      complexity,         /* I    Complexity setting, 0-2, where 2 is highest                 */
88
    const opus_int      nb_subfr,           /* I    Number of 5 ms subframes                                    */
89
    int                 arch                /* I    Run-time architecture                                       */
90
);
91
92
void silk_insertion_sort_decreasing_FLP(
93
    silk_float          *a,                 /* I/O  Unsorted / Sorted vector                                    */
94
    opus_int            *idx,               /* O    Index vector for the sorted elements                        */
95
    const opus_int      L,                  /* I    Vector length                                               */
96
    const opus_int      K                   /* I    Number of correctly sorted positions                        */
97
);
98
99
/* Compute reflection coefficients from input signal */
100
silk_float silk_burg_modified_FLP(          /* O    returns residual energy                                     */
101
    silk_float          A[],                /* O    prediction coefficients (length order)                      */
102
    const silk_float    x[],                /* I    input signal, length: nb_subfr*(D+L_sub)                    */
103
    const silk_float    minInvGain,         /* I    minimum inverse prediction gain                             */
104
    const opus_int      subfr_length,       /* I    input signal subframe length (incl. D preceding samples)    */
105
    const opus_int      nb_subfr,           /* I    number of subframes stacked in x                            */
106
    const opus_int      D,                  /* I    order                                                       */
107
    int                 arch
108
);
109
110
/* multiply a vector by a constant */
111
void silk_scale_vector_FLP(
112
    silk_float          *data1,
113
    silk_float          gain,
114
    opus_int            dataSize
115
);
116
117
/* copy and multiply a vector by a constant */
118
void silk_scale_copy_vector_FLP(
119
    silk_float          *data_out,
120
    const silk_float    *data_in,
121
    silk_float          gain,
122
    opus_int            dataSize
123
);
124
125
/* inner product of two silk_float arrays, with result as double */
126
double silk_inner_product_FLP_c(
127
    const silk_float    *data1,
128
    const silk_float    *data2,
129
    opus_int            dataSize
130
);
131
132
#ifndef OVERRIDE_inner_product_FLP
133
#define silk_inner_product_FLP(data1, data2, dataSize, arch) ((void)arch,silk_inner_product_FLP_c(data1, data2, dataSize))
134
#endif
135
136
137
/* sum of squares of a silk_float array, with result as double */
138
double silk_energy_FLP(
139
    const silk_float    *data,
140
    opus_int            dataSize
141
);
142
143
/********************************************************************/
144
/*                                MACROS                            */
145
/********************************************************************/
146
147
2.10M
#define PI              (3.1415926536f)
148
149
819k
#define silk_min_float( a, b )                  (((a) < (b)) ? (a) :  (b))
150
17.5M
#define silk_max_float( a, b )                  (((a) > (b)) ? (a) :  (b))
151
16.6M
#define silk_abs_float( a )                     ((silk_float)fabs(a))
152
153
/* sigmoid function */
154
static OPUS_INLINE silk_float silk_sigmoid( silk_float x )
155
264k
{
156
264k
    return (silk_float)(1.0 / (1.0 + exp(-x)));
157
264k
}
Unexecuted instantiation: enc_API.c:silk_sigmoid
Unexecuted instantiation: HP_variable_cutoff.c:silk_sigmoid
Unexecuted instantiation: init_encoder.c:silk_sigmoid
Unexecuted instantiation: control_codec.c:silk_sigmoid
Unexecuted instantiation: encode_frame_FLP.c:silk_sigmoid
Unexecuted instantiation: find_pitch_lags_FLP.c:silk_sigmoid
Unexecuted instantiation: find_pred_coefs_FLP.c:silk_sigmoid
Unexecuted instantiation: LPC_analysis_filter_FLP.c:silk_sigmoid
Unexecuted instantiation: LTP_analysis_filter_FLP.c:silk_sigmoid
Unexecuted instantiation: LTP_scale_ctrl_FLP.c:silk_sigmoid
noise_shape_analysis_FLP.c:silk_sigmoid
Line
Count
Source
155
232k
{
156
232k
    return (silk_float)(1.0 / (1.0 + exp(-x)));
157
232k
}
process_gains_FLP.c:silk_sigmoid
Line
Count
Source
155
31.2k
{
156
31.2k
    return (silk_float)(1.0 / (1.0 + exp(-x)));
157
31.2k
}
Unexecuted instantiation: residual_energy_FLP.c:silk_sigmoid
Unexecuted instantiation: warped_autocorrelation_FLP.c:silk_sigmoid
Unexecuted instantiation: wrappers_FLP.c:silk_sigmoid
Unexecuted instantiation: autocorrelation_FLP.c:silk_sigmoid
Unexecuted instantiation: bwexpander_FLP.c:silk_sigmoid
Unexecuted instantiation: energy_FLP.c:silk_sigmoid
Unexecuted instantiation: k2a_FLP.c:silk_sigmoid
Unexecuted instantiation: pitch_analysis_core_FLP.c:silk_sigmoid
Unexecuted instantiation: scale_copy_vector_FLP.c:silk_sigmoid
Unexecuted instantiation: schur_FLP.c:silk_sigmoid
Unexecuted instantiation: sort_FLP.c:silk_sigmoid
Unexecuted instantiation: x86_silk_map.c:silk_sigmoid
Unexecuted instantiation: apply_sine_window_FLP.c:silk_sigmoid
Unexecuted instantiation: find_LPC_FLP.c:silk_sigmoid
Unexecuted instantiation: find_LTP_FLP.c:silk_sigmoid
Unexecuted instantiation: burg_modified_FLP.c:silk_sigmoid
Unexecuted instantiation: inner_product_FLP.c:silk_sigmoid
Unexecuted instantiation: scale_vector_FLP.c:silk_sigmoid
Unexecuted instantiation: inner_product_FLP_avx2.c:silk_sigmoid
Unexecuted instantiation: corrMatrix_FLP.c:silk_sigmoid
158
159
/* floating-point to integer conversion (rounding) */
160
static OPUS_INLINE opus_int32 silk_float2int( silk_float x )
161
211M
{
162
211M
    return (opus_int32)float2int( x );
163
211M
}
Unexecuted instantiation: enc_API.c:silk_float2int
Unexecuted instantiation: HP_variable_cutoff.c:silk_float2int
Unexecuted instantiation: init_encoder.c:silk_float2int
Unexecuted instantiation: control_codec.c:silk_float2int
Unexecuted instantiation: encode_frame_FLP.c:silk_float2int
Unexecuted instantiation: find_pitch_lags_FLP.c:silk_float2int
Unexecuted instantiation: find_pred_coefs_FLP.c:silk_float2int
Unexecuted instantiation: LPC_analysis_filter_FLP.c:silk_float2int
Unexecuted instantiation: LTP_analysis_filter_FLP.c:silk_float2int
Unexecuted instantiation: LTP_scale_ctrl_FLP.c:silk_float2int
Unexecuted instantiation: noise_shape_analysis_FLP.c:silk_float2int
Unexecuted instantiation: process_gains_FLP.c:silk_float2int
Unexecuted instantiation: residual_energy_FLP.c:silk_float2int
Unexecuted instantiation: warped_autocorrelation_FLP.c:silk_float2int
wrappers_FLP.c:silk_float2int
Line
Count
Source
161
211M
{
162
211M
    return (opus_int32)float2int( x );
163
211M
}
Unexecuted instantiation: autocorrelation_FLP.c:silk_float2int
Unexecuted instantiation: bwexpander_FLP.c:silk_float2int
Unexecuted instantiation: energy_FLP.c:silk_float2int
Unexecuted instantiation: k2a_FLP.c:silk_float2int
Unexecuted instantiation: pitch_analysis_core_FLP.c:silk_float2int
Unexecuted instantiation: scale_copy_vector_FLP.c:silk_float2int
Unexecuted instantiation: schur_FLP.c:silk_float2int
Unexecuted instantiation: sort_FLP.c:silk_float2int
Unexecuted instantiation: x86_silk_map.c:silk_float2int
Unexecuted instantiation: apply_sine_window_FLP.c:silk_float2int
Unexecuted instantiation: find_LPC_FLP.c:silk_float2int
Unexecuted instantiation: find_LTP_FLP.c:silk_float2int
Unexecuted instantiation: burg_modified_FLP.c:silk_float2int
Unexecuted instantiation: inner_product_FLP.c:silk_float2int
Unexecuted instantiation: scale_vector_FLP.c:silk_float2int
Unexecuted instantiation: inner_product_FLP_avx2.c:silk_float2int
Unexecuted instantiation: corrMatrix_FLP.c:silk_float2int
164
165
/* floating-point to integer conversion (rounding) */
166
static OPUS_INLINE void silk_float2short_array(
167
    opus_int16       *out,
168
    const silk_float *in,
169
    opus_int32       length
170
)
171
86.7k
{
172
86.7k
    opus_int32 k;
173
35.1M
    for( k = length - 1; k >= 0; k-- ) {
174
35.1M
        out[k] = silk_SAT16( (opus_int32)float2int( in[k] ) );
175
35.1M
    }
176
86.7k
}
Unexecuted instantiation: enc_API.c:silk_float2short_array
Unexecuted instantiation: HP_variable_cutoff.c:silk_float2short_array
Unexecuted instantiation: init_encoder.c:silk_float2short_array
Unexecuted instantiation: control_codec.c:silk_float2short_array
Unexecuted instantiation: encode_frame_FLP.c:silk_float2short_array
Unexecuted instantiation: find_pitch_lags_FLP.c:silk_float2short_array
Unexecuted instantiation: find_pred_coefs_FLP.c:silk_float2short_array
Unexecuted instantiation: LPC_analysis_filter_FLP.c:silk_float2short_array
Unexecuted instantiation: LTP_analysis_filter_FLP.c:silk_float2short_array
Unexecuted instantiation: LTP_scale_ctrl_FLP.c:silk_float2short_array
Unexecuted instantiation: noise_shape_analysis_FLP.c:silk_float2short_array
Unexecuted instantiation: process_gains_FLP.c:silk_float2short_array
Unexecuted instantiation: residual_energy_FLP.c:silk_float2short_array
Unexecuted instantiation: warped_autocorrelation_FLP.c:silk_float2short_array
Unexecuted instantiation: wrappers_FLP.c:silk_float2short_array
Unexecuted instantiation: autocorrelation_FLP.c:silk_float2short_array
Unexecuted instantiation: bwexpander_FLP.c:silk_float2short_array
Unexecuted instantiation: energy_FLP.c:silk_float2short_array
Unexecuted instantiation: k2a_FLP.c:silk_float2short_array
pitch_analysis_core_FLP.c:silk_float2short_array
Line
Count
Source
171
86.7k
{
172
86.7k
    opus_int32 k;
173
35.1M
    for( k = length - 1; k >= 0; k-- ) {
174
35.1M
        out[k] = silk_SAT16( (opus_int32)float2int( in[k] ) );
175
35.1M
    }
176
86.7k
}
Unexecuted instantiation: scale_copy_vector_FLP.c:silk_float2short_array
Unexecuted instantiation: schur_FLP.c:silk_float2short_array
Unexecuted instantiation: sort_FLP.c:silk_float2short_array
Unexecuted instantiation: x86_silk_map.c:silk_float2short_array
Unexecuted instantiation: apply_sine_window_FLP.c:silk_float2short_array
Unexecuted instantiation: find_LPC_FLP.c:silk_float2short_array
Unexecuted instantiation: find_LTP_FLP.c:silk_float2short_array
Unexecuted instantiation: burg_modified_FLP.c:silk_float2short_array
Unexecuted instantiation: inner_product_FLP.c:silk_float2short_array
Unexecuted instantiation: scale_vector_FLP.c:silk_float2short_array
Unexecuted instantiation: inner_product_FLP_avx2.c:silk_float2short_array
Unexecuted instantiation: corrMatrix_FLP.c:silk_float2short_array
177
178
/* integer to floating-point conversion */
179
static OPUS_INLINE void silk_short2float_array(
180
    silk_float       *out,
181
    const opus_int16 *in,
182
    opus_int32       length
183
)
184
348k
{
185
348k
    opus_int32 k;
186
64.1M
    for( k = length - 1; k >= 0; k-- ) {
187
63.7M
        out[k] = (silk_float)in[k];
188
63.7M
    }
189
348k
}
Unexecuted instantiation: enc_API.c:silk_short2float_array
Unexecuted instantiation: HP_variable_cutoff.c:silk_short2float_array
Unexecuted instantiation: init_encoder.c:silk_short2float_array
Unexecuted instantiation: control_codec.c:silk_short2float_array
encode_frame_FLP.c:silk_short2float_array
Line
Count
Source
184
232k
{
185
232k
    opus_int32 k;
186
41.0M
    for( k = length - 1; k >= 0; k-- ) {
187
40.7M
        out[k] = (silk_float)in[k];
188
40.7M
    }
189
232k
}
Unexecuted instantiation: find_pitch_lags_FLP.c:silk_short2float_array
Unexecuted instantiation: find_pred_coefs_FLP.c:silk_short2float_array
Unexecuted instantiation: LPC_analysis_filter_FLP.c:silk_short2float_array
Unexecuted instantiation: LTP_analysis_filter_FLP.c:silk_short2float_array
Unexecuted instantiation: LTP_scale_ctrl_FLP.c:silk_short2float_array
Unexecuted instantiation: noise_shape_analysis_FLP.c:silk_short2float_array
Unexecuted instantiation: process_gains_FLP.c:silk_short2float_array
Unexecuted instantiation: residual_energy_FLP.c:silk_short2float_array
Unexecuted instantiation: warped_autocorrelation_FLP.c:silk_short2float_array
Unexecuted instantiation: wrappers_FLP.c:silk_short2float_array
Unexecuted instantiation: autocorrelation_FLP.c:silk_short2float_array
Unexecuted instantiation: bwexpander_FLP.c:silk_short2float_array
Unexecuted instantiation: energy_FLP.c:silk_short2float_array
Unexecuted instantiation: k2a_FLP.c:silk_short2float_array
pitch_analysis_core_FLP.c:silk_short2float_array
Line
Count
Source
184
115k
{
185
115k
    opus_int32 k;
186
23.1M
    for( k = length - 1; k >= 0; k-- ) {
187
23.0M
        out[k] = (silk_float)in[k];
188
23.0M
    }
189
115k
}
Unexecuted instantiation: scale_copy_vector_FLP.c:silk_short2float_array
Unexecuted instantiation: schur_FLP.c:silk_short2float_array
Unexecuted instantiation: sort_FLP.c:silk_short2float_array
Unexecuted instantiation: x86_silk_map.c:silk_short2float_array
Unexecuted instantiation: apply_sine_window_FLP.c:silk_short2float_array
Unexecuted instantiation: find_LPC_FLP.c:silk_short2float_array
Unexecuted instantiation: find_LTP_FLP.c:silk_short2float_array
Unexecuted instantiation: burg_modified_FLP.c:silk_short2float_array
Unexecuted instantiation: inner_product_FLP.c:silk_short2float_array
Unexecuted instantiation: scale_vector_FLP.c:silk_short2float_array
Unexecuted instantiation: inner_product_FLP_avx2.c:silk_short2float_array
Unexecuted instantiation: corrMatrix_FLP.c:silk_short2float_array
190
191
/* using log2() helps the fixed-point conversion */
192
static OPUS_INLINE silk_float silk_log2( double x )
193
2.42M
{
194
2.42M
    return ( silk_float )( 3.32192809488736 * log10( x ) );
195
2.42M
}
Unexecuted instantiation: enc_API.c:silk_log2
Unexecuted instantiation: HP_variable_cutoff.c:silk_log2
Unexecuted instantiation: init_encoder.c:silk_log2
Unexecuted instantiation: control_codec.c:silk_log2
Unexecuted instantiation: encode_frame_FLP.c:silk_log2
Unexecuted instantiation: find_pitch_lags_FLP.c:silk_log2
Unexecuted instantiation: find_pred_coefs_FLP.c:silk_log2
Unexecuted instantiation: LPC_analysis_filter_FLP.c:silk_log2
Unexecuted instantiation: LTP_analysis_filter_FLP.c:silk_log2
Unexecuted instantiation: LTP_scale_ctrl_FLP.c:silk_log2
noise_shape_analysis_FLP.c:silk_log2
Line
Count
Source
193
1.73M
{
194
1.73M
    return ( silk_float )( 3.32192809488736 * log10( x ) );
195
1.73M
}
Unexecuted instantiation: process_gains_FLP.c:silk_log2
Unexecuted instantiation: residual_energy_FLP.c:silk_log2
Unexecuted instantiation: warped_autocorrelation_FLP.c:silk_log2
Unexecuted instantiation: wrappers_FLP.c:silk_log2
Unexecuted instantiation: autocorrelation_FLP.c:silk_log2
Unexecuted instantiation: bwexpander_FLP.c:silk_log2
Unexecuted instantiation: energy_FLP.c:silk_log2
Unexecuted instantiation: k2a_FLP.c:silk_log2
pitch_analysis_core_FLP.c:silk_log2
Line
Count
Source
193
685k
{
194
685k
    return ( silk_float )( 3.32192809488736 * log10( x ) );
195
685k
}
Unexecuted instantiation: scale_copy_vector_FLP.c:silk_log2
Unexecuted instantiation: schur_FLP.c:silk_log2
Unexecuted instantiation: sort_FLP.c:silk_log2
Unexecuted instantiation: x86_silk_map.c:silk_log2
Unexecuted instantiation: apply_sine_window_FLP.c:silk_log2
Unexecuted instantiation: find_LPC_FLP.c:silk_log2
Unexecuted instantiation: find_LTP_FLP.c:silk_log2
Unexecuted instantiation: burg_modified_FLP.c:silk_log2
Unexecuted instantiation: inner_product_FLP.c:silk_log2
Unexecuted instantiation: scale_vector_FLP.c:silk_log2
Unexecuted instantiation: inner_product_FLP_avx2.c:silk_log2
Unexecuted instantiation: corrMatrix_FLP.c:silk_log2
196
197
#endif /* SILK_SIGPROC_FLP_H */