FFmpeg
Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
Functions
Variables
Data Structures
Data Structures
Data Structure Index
Class Hierarchy
Data Fields
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
c
d
g
i
o
q
r
s
v
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerations
Enumerator
a
d
e
f
i
j
l
m
n
p
r
s
v
Files
File List
Globals
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
l
m
o
p
q
r
s
t
u
v
w
x
y
Enumerations
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Macros
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Examples
•
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Modules
Pages
libavcodec
tests
celp_math.c
Go to the documentation of this file.
1
/*
2
* This file is part of FFmpeg.
3
*
4
* FFmpeg is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU Lesser General Public
6
* License as published by the Free Software Foundation; either
7
* version 2.1 of the License, or (at your option) any later version.
8
*
9
* FFmpeg is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
* Lesser General Public License for more details.
13
*
14
* You should have received a copy of the GNU Lesser General Public
15
* License along with FFmpeg; if not, write to the Free Software
16
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
*/
18
19
#include "
libavutil/libm.h
"
20
#include "
libavcodec/celp_math.c
"
21
22
static
inline
void
IsAlmostEqual
(
float
A
,
float
B
,
float
epsilon)
23
{
24
float
diff
= fabsf(
A
-
B
);
25
float
absa = fabsf(
A
);
26
float
absb = fabsf(
B
);
27
float
largest = (absb > absa) ? absb : absa;
28
av_assert0
(
diff
<= largest * epsilon);
29
}
30
31
int
main
(
void
)
32
{
33
int
i
;
34
const
float
f1[3] = {0.0, 1.1, 2.2};
35
const
float
f2[3] = {3.3, 4.4, 5.5};
36
const
int16_t i1[3] = {6, 7, 8};
37
const
int16_t i2[3] = {9, 10, 11};
38
39
float
r
=
ff_dot_productf
(f1, f2,
FF_ARRAY_ELEMS
(f1));
40
int64_t d =
ff_dot_product
(i1, i2,
FF_ARRAY_ELEMS
(i1));
41
42
IsAlmostEqual
(16.94
f
,
r
, 0.000001
f
);
43
av_assert0
(212 == d);
44
45
for
(
i
= 1024;
i
>= 1;
i
/=2)
46
av_assert0
(
ff_log2_q15
(
i
) == (1<<15)*((
int
)
log2
(
i
))+(1<<2));
47
48
return
0;
49
}
main
int main(void)
Definition:
celp_math.c:31
r
const char * r
Definition:
vf_curves.c:114
libm.h
A
#define A(x)
Definition:
vp56_arith.h:28
av_assert0
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition:
avassert.h:37
f
#define f(width, name)
Definition:
cbs_vp9.c:255
ff_log2_q15
int ff_log2_q15(uint32_t value)
Calculate log2(x).
Definition:
celp_math.c:78
IsAlmostEqual
static void IsAlmostEqual(float A, float B, float epsilon)
Definition:
celp_math.c:22
celp_math.c
i
#define i(width, name, range_min, range_max)
Definition:
cbs_h2645.c:269
ff_dot_product
int64_t ff_dot_product(const int16_t *a, const int16_t *b, int length)
Calculate the dot product of 2 int16_t vectors.
Definition:
celp_math.c:98
log2
#define log2(x)
Definition:
libm.h:404
FF_ARRAY_ELEMS
#define FF_ARRAY_ELEMS(a)
Definition:
sinewin_tablegen_template.c:38
B
#define B
Definition:
huffyuvdsp.h:32
diff
static av_always_inline int diff(const uint32_t a, const uint32_t b)
Definition:
vf_palettegen.c:136
ff_dot_productf
float ff_dot_productf(const float *a, const float *b, int length)
Return the dot product.
Definition:
celp_math.c:109
Generated on Wed Aug 24 2022 21:31:11 for FFmpeg by
1.8.17