Coverage Report

Created: 2024-09-06 07:53

/src/opus/silk/float/SigProc_FLP.h
Line
Count
Source (jump to first uncovered line)
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
#ifdef  __cplusplus
37
extern "C"
38
{
39
#endif
40
41
/********************************************************************/
42
/*                    SIGNAL PROCESSING FUNCTIONS                   */
43
/********************************************************************/
44
45
/* Chirp (bw expand) LP AR filter */
46
void silk_bwexpander_FLP(
47
    silk_float          *ar,                /* I/O  AR filter to be expanded (without leading 1)                */
48
    const opus_int      d,                  /* I    length of ar                                                */
49
    const silk_float    chirp               /* I    chirp factor (typically in range (0..1) )                   */
50
);
51
52
/* compute inverse of LPC prediction gain, and                          */
53
/* test if LPC coefficients are stable (all poles within unit circle)   */
54
/* this code is based on silk_FLP_a2k()                                 */
55
silk_float silk_LPC_inverse_pred_gain_FLP(  /* O    return inverse prediction gain, energy domain               */
56
    const silk_float    *A,                 /* I    prediction coefficients [order]                             */
57
    opus_int32          order               /* I    prediction order                                            */
58
);
59
60
silk_float silk_schur_FLP(                  /* O    returns residual energy                                     */
61
    silk_float          refl_coef[],        /* O    reflection coefficients (length order)                      */
62
    const silk_float    auto_corr[],        /* I    autocorrelation sequence (length order+1)                   */
63
    opus_int            order               /* I    order                                                       */
64
);
65
66
void silk_k2a_FLP(
67
    silk_float          *A,                 /* O     prediction coefficients [order]                            */
68
    const silk_float    *rc,                /* I     reflection coefficients [order]                            */
69
    opus_int32          order               /* I     prediction order                                           */
70
);
71
72
/* compute autocorrelation */
73
void silk_autocorrelation_FLP(
74
    silk_float          *results,           /* O    result (length correlationCount)                            */
75
    const silk_float    *inputData,         /* I    input data to correlate                                     */
76
    opus_int            inputDataSize,      /* I    length of input                                             */
77
    opus_int            correlationCount,    /* I    number of correlation taps to compute                       */
78
    int                 arch
79
);
80
81
opus_int silk_pitch_analysis_core_FLP(      /* O    Voicing estimate: 0 voiced, 1 unvoiced                      */
82
    const silk_float    *frame,             /* I    Signal of length PE_FRAME_LENGTH_MS*Fs_kHz                  */
83
    opus_int            *pitch_out,         /* O    Pitch lag values [nb_subfr]                                 */
84
    opus_int16          *lagIndex,          /* O    Lag Index                                                   */
85
    opus_int8           *contourIndex,      /* O    Pitch contour Index                                         */
86
    silk_float          *LTPCorr,           /* I/O  Normalized correlation; input: value from previous frame    */
87
    opus_int            prevLag,            /* I    Last lag of previous frame; set to zero is unvoiced         */
88
    const silk_float    search_thres1,      /* I    First stage threshold for lag candidates 0 - 1              */
89
    const silk_float    search_thres2,      /* I    Final threshold for lag candidates 0 - 1                    */
90
    const opus_int      Fs_kHz,             /* I    sample frequency (kHz)                                      */
91
    const opus_int      complexity,         /* I    Complexity setting, 0-2, where 2 is highest                 */
92
    const opus_int      nb_subfr,           /* I    Number of 5 ms subframes                                    */
93
    int                 arch                /* I    Run-time architecture                                       */
94
);
95
96
void silk_insertion_sort_decreasing_FLP(
97
    silk_float          *a,                 /* I/O  Unsorted / Sorted vector                                    */
98
    opus_int            *idx,               /* O    Index vector for the sorted elements                        */
99
    const opus_int      L,                  /* I    Vector length                                               */
100
    const opus_int      K                   /* I    Number of correctly sorted positions                        */
101
);
102
103
/* Compute reflection coefficients from input signal */
104
silk_float silk_burg_modified_FLP(          /* O    returns residual energy                                     */
105
    silk_float          A[],                /* O    prediction coefficients (length order)                      */
106
    const silk_float    x[],                /* I    input signal, length: nb_subfr*(D+L_sub)                    */
107
    const silk_float    minInvGain,         /* I    minimum inverse prediction gain                             */
108
    const opus_int      subfr_length,       /* I    input signal subframe length (incl. D preceding samples)    */
109
    const opus_int      nb_subfr,           /* I    number of subframes stacked in x                            */
110
    const opus_int      D,                  /* I    order                                                       */
111
    int                 arch
112
);
113
114
/* multiply a vector by a constant */
115
void silk_scale_vector_FLP(
116
    silk_float          *data1,
117
    silk_float          gain,
118
    opus_int            dataSize
119
);
120
121
/* copy and multiply a vector by a constant */
122
void silk_scale_copy_vector_FLP(
123
    silk_float          *data_out,
124
    const silk_float    *data_in,
125
    silk_float          gain,
126
    opus_int            dataSize
127
);
128
129
/* inner product of two silk_float arrays, with result as double */
130
double silk_inner_product_FLP_c(
131
    const silk_float    *data1,
132
    const silk_float    *data2,
133
    opus_int            dataSize
134
);
135
136
#ifndef OVERRIDE_inner_product_FLP
137
#define silk_inner_product_FLP(data1, data2, dataSize, arch) ((void)arch,silk_inner_product_FLP_c(data1, data2, dataSize))
138
#endif
139
140
141
/* sum of squares of a silk_float array, with result as double */
142
double silk_energy_FLP(
143
    const silk_float    *data,
144
    opus_int            dataSize
145
);
146
147
/********************************************************************/
148
/*                                MACROS                            */
149
/********************************************************************/
150
151
0
#define PI              (3.1415926536f)
152
153
0
#define silk_min_float( a, b )                  (((a) < (b)) ? (a) :  (b))
154
0
#define silk_max_float( a, b )                  (((a) > (b)) ? (a) :  (b))
155
0
#define silk_abs_float( a )                     ((silk_float)fabs(a))
156
157
/* sigmoid function */
158
static OPUS_INLINE silk_float silk_sigmoid( silk_float x )
159
0
{
160
0
    return (silk_float)(1.0 / (1.0 + exp(-x)));
161
0
}
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
Unexecuted instantiation: noise_shape_analysis_FLP.c:silk_sigmoid
Unexecuted instantiation: process_gains_FLP.c:silk_sigmoid
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
162
163
/* floating-point to integer conversion (rounding) */
164
static OPUS_INLINE opus_int32 silk_float2int( silk_float x )
165
0
{
166
0
    return (opus_int32)float2int( x );
167
0
}
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
Unexecuted instantiation: wrappers_FLP.c:silk_float2int
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
168
169
/* floating-point to integer conversion (rounding) */
170
static OPUS_INLINE void silk_float2short_array(
171
    opus_int16       *out,
172
    const silk_float *in,
173
    opus_int32       length
174
)
175
0
{
176
0
    opus_int32 k;
177
0
    for( k = length - 1; k >= 0; k-- ) {
178
0
        out[k] = silk_SAT16( (opus_int32)float2int( in[k] ) );
179
0
    }
180
0
}
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
Unexecuted instantiation: pitch_analysis_core_FLP.c:silk_float2short_array
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
181
182
/* integer to floating-point conversion */
183
static OPUS_INLINE void silk_short2float_array(
184
    silk_float       *out,
185
    const opus_int16 *in,
186
    opus_int32       length
187
)
188
0
{
189
0
    opus_int32 k;
190
0
    for( k = length - 1; k >= 0; k-- ) {
191
0
        out[k] = (silk_float)in[k];
192
0
    }
193
0
}
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
Unexecuted instantiation: encode_frame_FLP.c:silk_short2float_array
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
Unexecuted instantiation: pitch_analysis_core_FLP.c:silk_short2float_array
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
194
195
/* using log2() helps the fixed-point conversion */
196
static OPUS_INLINE silk_float silk_log2( double x )
197
0
{
198
0
    return ( silk_float )( 3.32192809488736 * log10( x ) );
199
0
}
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
Unexecuted instantiation: noise_shape_analysis_FLP.c:silk_log2
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
Unexecuted instantiation: pitch_analysis_core_FLP.c:silk_log2
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
200
201
#ifdef  __cplusplus
202
}
203
#endif
204
205
#endif /* SILK_SIGPROC_FLP_H */