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
h
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
h
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
libavutil
riscv
cpu.c
Go to the documentation of this file.
1
/*
2
* Copyright © 2022 Rémi Denis-Courmont.
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
#include "
libavutil/cpu.h
"
22
#include "
libavutil/cpu_internal.h
"
23
#include "
libavutil/log.h
"
24
#include "config.h"
25
26
#if HAVE_GETAUXVAL
27
#include <sys/auxv.h>
28
#define HWCAP_RV(letter) (1ul << ((letter) - 'A'))
29
#endif
30
31
int
ff_get_cpu_flags_riscv
(
void
)
32
{
33
int
ret
= 0;
34
#if HAVE_GETAUXVAL
35
const
unsigned
long
hwcap = getauxval(AT_HWCAP);
36
37
if
(hwcap & HWCAP_RV(
'I'
))
38
ret
|=
AV_CPU_FLAG_RVI
;
39
if
(hwcap & HWCAP_RV(
'F'
))
40
ret
|=
AV_CPU_FLAG_RVF
;
41
if
(hwcap & HWCAP_RV(
'D'
))
42
ret
|=
AV_CPU_FLAG_RVD
;
43
if
(hwcap & HWCAP_RV(
'B'
))
44
ret
|=
AV_CPU_FLAG_RVB_ADDR
|
AV_CPU_FLAG_RVB_BASIC
;
45
46
/* The V extension implies all Zve* functional subsets */
47
if
(hwcap & HWCAP_RV(
'V'
))
48
ret
|=
AV_CPU_FLAG_RVV_I32
|
AV_CPU_FLAG_RVV_I64
49
|
AV_CPU_FLAG_RVV_F32
|
AV_CPU_FLAG_RVV_F64
;
50
#endif
51
52
#ifdef __riscv_i
53
ret
|=
AV_CPU_FLAG_RVI
;
54
#endif
55
#if defined (__riscv_flen) && (__riscv_flen >= 32)
56
ret
|=
AV_CPU_FLAG_RVF
;
57
#if (__riscv_flen >= 64)
58
ret
|=
AV_CPU_FLAG_RVD
;
59
#endif
60
#endif
61
62
#ifdef __riscv_zba
63
ret
|=
AV_CPU_FLAG_RVB_ADDR
;
64
#endif
65
#ifdef __riscv_zbb
66
ret
|=
AV_CPU_FLAG_RVB_BASIC
;
67
#endif
68
69
/* If RV-V is enabled statically at compile-time, check the details. */
70
#ifdef __riscv_vectors
71
ret
|=
AV_CPU_FLAG_RVV_I32
;
72
#if __riscv_v_elen >= 64
73
ret
|=
AV_CPU_FLAG_RVV_I64
;
74
#endif
75
#if __riscv_v_elen_fp >= 32
76
ret
|=
AV_CPU_FLAG_RVV_F32
;
77
#if __riscv_v_elen_fp >= 64
78
ret
|=
AV_CPU_FLAG_RVV_F64
;
79
#endif
80
#endif
81
#endif
82
83
return
ret
;
84
}
AV_CPU_FLAG_RVB_BASIC
#define AV_CPU_FLAG_RVB_BASIC
Basic bit-manipulations.
Definition:
cpu.h:91
AV_CPU_FLAG_RVF
#define AV_CPU_FLAG_RVF
F (single precision FP)
Definition:
cpu.h:85
AV_CPU_FLAG_RVV_F64
#define AV_CPU_FLAG_RVV_F64
Vectors of double's.
Definition:
cpu.h:90
AV_CPU_FLAG_RVV_F32
#define AV_CPU_FLAG_RVV_F32
Vectors of float's */.
Definition:
cpu.h:88
cpu_internal.h
AV_CPU_FLAG_RVB_ADDR
#define AV_CPU_FLAG_RVB_ADDR
Address bit-manipulations.
Definition:
cpu.h:92
AV_CPU_FLAG_RVD
#define AV_CPU_FLAG_RVD
D (double precision FP)
Definition:
cpu.h:86
cpu.h
log.h
AV_CPU_FLAG_RVV_I32
#define AV_CPU_FLAG_RVV_I32
Vectors of 8/16/32-bit int's */.
Definition:
cpu.h:87
ret
ret
Definition:
filter_design.txt:187
AV_CPU_FLAG_RVI
#define AV_CPU_FLAG_RVI
I (full GPR bank)
Definition:
cpu.h:84
AV_CPU_FLAG_RVV_I64
#define AV_CPU_FLAG_RVV_I64
Vectors of 64-bit int's */.
Definition:
cpu.h:89
ff_get_cpu_flags_riscv
int ff_get_cpu_flags_riscv(void)
Definition:
cpu.c:31
Generated on Thu Apr 18 2024 22:42:41 for FFmpeg by
1.8.17