Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
libremedia
Tethys
FFmpeg
Commits
865b70bc
Commit
865b70bc
authored
11 years ago
by
Kieran Kunhya
Committed by
Michael Niedermayer
11 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add AVX2 capable CPU detection. Patch based on x264's AVX2 detection
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
780669ef
No related branches found
No related tags found
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
configure
+3
-0
3 additions, 0 deletions
configure
libavutil/cpu.c
+3
-0
3 additions, 0 deletions
libavutil/cpu.c
libavutil/cpu.h
+2
-0
2 additions, 0 deletions
libavutil/cpu.h
libavutil/x86/cpu.c
+7
-0
7 additions, 0 deletions
libavutil/x86/cpu.c
libavutil/x86/cpu.h
+3
-0
3 additions, 0 deletions
libavutil/x86/cpu.h
with
18 additions
and
0 deletions
configure
+
3
−
0
View file @
865b70bc
...
...
@@ -315,6 +315,7 @@ Optimization options (experts only):
--disable-sse42 disable SSE4.2 optimizations
--disable-avx disable AVX optimizations
--disable-fma4 disable FMA4 optimizations
--disable-avx2 disable AVX2 optimizations
--disable-armv5te disable armv5te optimizations
--disable-armv6 disable armv6 optimizations
--disable-armv6t2 disable armv6t2 optimizations
...
...
@@ -1344,6 +1345,7 @@ ARCH_EXT_LIST_X86='
amd3dnow
amd3dnowext
avx
avx2
fma4
i686
mmx
...
...
@@ -1705,6 +1707,7 @@ sse4_deps="ssse3"
sse42_deps
=
"sse4"
avx_deps
=
"sse42"
fma4_deps
=
"avx"
avx2_deps
=
"avx"
mmx_external_deps
=
"yasm"
mmx_inline_deps
=
"inline_asm"
...
...
This diff is collapsed.
Click to expand it.
libavutil/cpu.c
+
3
−
0
View file @
865b70bc
...
...
@@ -85,6 +85,7 @@ int av_parse_cpu_flags(const char *s)
#define CPUFLAG_AVX (AV_CPU_FLAG_AVX | CPUFLAG_SSE42)
#define CPUFLAG_XOP (AV_CPU_FLAG_XOP | CPUFLAG_AVX)
#define CPUFLAG_FMA4 (AV_CPU_FLAG_FMA4 | CPUFLAG_AVX)
#define CPUFLAG_AVX2 (AV_CPU_FLAG_AVX2 | CPUFLAG_AVX)
static
const
AVOption
cpuflags_opts
[]
=
{
{
"flags"
,
NULL
,
0
,
AV_OPT_TYPE_FLAGS
,
{
.
i64
=
0
},
INT64_MIN
,
INT64_MAX
,
.
unit
=
"flags"
},
#if ARCH_PPC
...
...
@@ -104,6 +105,7 @@ int av_parse_cpu_flags(const char *s)
{
"avx"
,
NULL
,
0
,
AV_OPT_TYPE_CONST
,
{
.
i64
=
CPUFLAG_AVX
},
.
unit
=
"flags"
},
{
"xop"
,
NULL
,
0
,
AV_OPT_TYPE_CONST
,
{
.
i64
=
CPUFLAG_XOP
},
.
unit
=
"flags"
},
{
"fma4"
,
NULL
,
0
,
AV_OPT_TYPE_CONST
,
{
.
i64
=
CPUFLAG_FMA4
},
.
unit
=
"flags"
},
{
"avx2"
,
NULL
,
0
,
AV_OPT_TYPE_CONST
,
{
.
i64
=
CPUFLAG_AVX2
},
.
unit
=
"flags"
},
{
"3dnow"
,
NULL
,
0
,
AV_OPT_TYPE_CONST
,
{
.
i64
=
CPUFLAG_3DNOW
},
.
unit
=
"flags"
},
{
"3dnowext"
,
NULL
,
0
,
AV_OPT_TYPE_CONST
,
{
.
i64
=
CPUFLAG_3DNOWEXT
},
.
unit
=
"flags"
},
{
"cmov"
,
NULL
,
0
,
AV_OPT_TYPE_CONST
,
{
.
i64
=
AV_CPU_FLAG_CMOV
},
.
unit
=
"flags"
},
...
...
@@ -267,6 +269,7 @@ static const struct {
{
AV_CPU_FLAG_3DNOW
,
"3dnow"
},
{
AV_CPU_FLAG_3DNOWEXT
,
"3dnowext"
},
{
AV_CPU_FLAG_CMOV
,
"cmov"
},
{
AV_CPU_FLAG_AVX2
,
"avx2"
},
#endif
{
0
}
};
...
...
This diff is collapsed.
Click to expand it.
libavutil/cpu.h
+
2
−
0
View file @
865b70bc
...
...
@@ -50,6 +50,8 @@
// #else
// #define AV_CPU_FLAG_CMOV 0x1000 ///< supports cmov instruction
// #endif
#define AV_CPU_FLAG_AVX2 0x8000 ///< AVX2 functions: requires OS support even if YMM registers aren't used
#define AV_CPU_FLAG_ALTIVEC 0x0001 ///< standard
...
...
This diff is collapsed.
Click to expand it.
libavutil/x86/cpu.c
+
7
−
0
View file @
865b70bc
...
...
@@ -134,6 +134,13 @@ int ff_get_cpu_flags_x86(void)
if
((
eax
&
0x6
)
==
0x6
)
rval
|=
AV_CPU_FLAG_AVX
;
}
if
(
HAVE_AVX2
&&
max_std_level
>=
7
)
{
cpuid
(
7
,
eax
,
ebx
,
ecx
,
edx
);
if
(
ebx
&
0x00000020
)
rval
|=
AV_CPU_FLAG_AVX2
;
/* TODO: BMI1/2 */
}
#endif
/* HAVE_AVX */
#endif
/* HAVE_SSE */
}
...
...
This diff is collapsed.
Click to expand it.
libavutil/x86/cpu.h
+
3
−
0
View file @
865b70bc
...
...
@@ -38,6 +38,7 @@
#define X86_SSE42(flags) CPUEXT(flags, SSE42)
#define X86_AVX(flags) CPUEXT(flags, AVX)
#define X86_FMA4(flags) CPUEXT(flags, FMA4)
#define X86_AVX2(flags) CPUEXT(flags, AVX2)
#define EXTERNAL_AMD3DNOW(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, AMD3DNOW)
#define EXTERNAL_AMD3DNOWEXT(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, AMD3DNOWEXT)
...
...
@@ -51,6 +52,7 @@
#define EXTERNAL_SSE42(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, SSE42)
#define EXTERNAL_AVX(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, AVX)
#define EXTERNAL_FMA4(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, FMA4)
#define EXTERNAL_AVX2(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, AVX2)
#define INLINE_AMD3DNOW(flags) CPUEXT_SUFFIX(flags, _INLINE, AMD3DNOW)
#define INLINE_AMD3DNOWEXT(flags) CPUEXT_SUFFIX(flags, _INLINE, AMD3DNOWEXT)
...
...
@@ -64,6 +66,7 @@
#define INLINE_SSE42(flags) CPUEXT_SUFFIX(flags, _INLINE, SSE42)
#define INLINE_AVX(flags) CPUEXT_SUFFIX(flags, _INLINE, AVX)
#define INLINE_FMA4(flags) CPUEXT_SUFFIX(flags, _INLINE, FMA4)
#define INLINE_AVX2(flags) CPUEXT_SUFFIX(flags, _INLINE, AVX2)
void
ff_cpu_cpuid
(
int
index
,
int
*
eax
,
int
*
ebx
,
int
*
ecx
,
int
*
edx
);
void
ff_cpu_xgetbv
(
int
op
,
int
*
eax
,
int
*
edx
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment