Coverage Report

Created: 2024-09-06 07:53

/src/ffmpeg/libavutil/ffmath.h
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * copyright (c) 2016 Ganesh Ajjanagadde <gajjanag@gmail.com>
3
 *
4
 * This file is part of FFmpeg.
5
 *
6
 * FFmpeg is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU Lesser General Public
8
 * License as published by the Free Software Foundation; either
9
 * version 2.1 of the License, or (at your option) any later version.
10
 *
11
 * FFmpeg is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
 * Lesser General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU Lesser General Public
17
 * License along with FFmpeg; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
 */
20
21
/**
22
 * @file
23
 * internal math functions header
24
 */
25
26
#ifndef AVUTIL_FFMATH_H
27
#define AVUTIL_FFMATH_H
28
29
#include "attributes.h"
30
#include "libm.h"
31
32
/**
33
 * Compute 10^x for floating point values. Note: this function is by no means
34
 * "correctly rounded", and is meant as a fast, reasonably accurate approximation.
35
 * For instance, maximum relative error for the double precision variant is
36
 * ~ 1e-13 for very small and very large values.
37
 * This is ~2x faster than GNU libm's approach, which is still off by 2ulp on
38
 * some inputs.
39
 * @param x exponent
40
 * @return 10^x
41
 */
42
static av_always_inline double ff_exp10(double x)
43
12.6M
{
44
12.6M
    return exp2(M_LOG2_10 * x);
45
12.6M
}
eval.c:ff_exp10
Line
Count
Source
43
194
{
44
194
    return exp2(M_LOG2_10 * x);
45
194
}
wmaprodec.c:ff_exp10
Line
Count
Source
43
4.52M
{
44
4.52M
    return exp2(M_LOG2_10 * x);
45
4.52M
}
imc.c:ff_exp10
Line
Count
Source
43
36.5k
{
44
36.5k
    return exp2(M_LOG2_10 * x);
45
36.5k
}
acelp_pitch_delay.c:ff_exp10
Line
Count
Source
43
8.00M
{
44
8.00M
    return exp2(M_LOG2_10 * x);
45
8.00M
}
Unexecuted instantiation: wmaenc.c:ff_exp10
Unexecuted instantiation: aacenc.c:ff_exp10
Unexecuted instantiation: aaccoder.c:ff_exp10
Unexecuted instantiation: aacenc_is.c:ff_exp10
Unexecuted instantiation: aacenc_ltp.c:ff_exp10
Unexecuted instantiation: aacenc_pred.c:ff_exp10
Unexecuted instantiation: aacenc_tns.c:ff_exp10
Unexecuted instantiation: aacpsy.c:ff_exp10
Unexecuted instantiation: dcaenc.c:ff_exp10
on2avc.c:ff_exp10
Line
Count
Source
43
100k
{
44
100k
    return exp2(M_LOG2_10 * x);
45
100k
}
46
47
static av_always_inline float ff_exp10f(float x)
48
0
{
49
0
    return exp2f(M_LOG2_10 * x);
50
0
}
Unexecuted instantiation: eval.c:ff_exp10f
Unexecuted instantiation: wmaprodec.c:ff_exp10f
Unexecuted instantiation: imc.c:ff_exp10f
Unexecuted instantiation: acelp_pitch_delay.c:ff_exp10f
Unexecuted instantiation: wmaenc.c:ff_exp10f
Unexecuted instantiation: aacenc.c:ff_exp10f
Unexecuted instantiation: aaccoder.c:ff_exp10f
Unexecuted instantiation: aacenc_is.c:ff_exp10f
Unexecuted instantiation: aacenc_ltp.c:ff_exp10f
Unexecuted instantiation: aacenc_pred.c:ff_exp10f
Unexecuted instantiation: aacenc_tns.c:ff_exp10f
Unexecuted instantiation: aacpsy.c:ff_exp10f
Unexecuted instantiation: dcaenc.c:ff_exp10f
Unexecuted instantiation: on2avc.c:ff_exp10f
51
52
/**
53
 * Compute x^y for floating point x, y. Note: this function is faster than the
54
 * libm variant due to mainly 2 reasons:
55
 * 1. It does not handle any edge cases. In particular, this is only guaranteed
56
 * to work correctly for x > 0.
57
 * 2. It is not as accurate as a standard nearly "correctly rounded" libm variant.
58
 * @param x base
59
 * @param y exponent
60
 * @return x^y
61
 */
62
static av_always_inline float ff_fast_powf(float x, float y)
63
0
{
64
0
    return expf(logf(x) * y);
65
0
}
Unexecuted instantiation: eval.c:ff_fast_powf
Unexecuted instantiation: wmaprodec.c:ff_fast_powf
Unexecuted instantiation: imc.c:ff_fast_powf
Unexecuted instantiation: acelp_pitch_delay.c:ff_fast_powf
Unexecuted instantiation: wmaenc.c:ff_fast_powf
Unexecuted instantiation: aacenc.c:ff_fast_powf
Unexecuted instantiation: aaccoder.c:ff_fast_powf
Unexecuted instantiation: aacenc_is.c:ff_fast_powf
Unexecuted instantiation: aacenc_ltp.c:ff_fast_powf
Unexecuted instantiation: aacenc_pred.c:ff_fast_powf
Unexecuted instantiation: aacenc_tns.c:ff_fast_powf
Unexecuted instantiation: aacpsy.c:ff_fast_powf
Unexecuted instantiation: dcaenc.c:ff_fast_powf
Unexecuted instantiation: on2avc.c:ff_fast_powf
66
67
#endif /* AVUTIL_FFMATH_H */