Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Opus
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Xiph.Org
Opus
Commits
fdb3b3ac
Commit
fdb3b3ac
authored
9 years ago
by
Jonathan Lennox
Committed by
Timothy B. Terriberry
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add named constants for ARM architecture variants.
Signed-off-by:
Timothy B. Terriberry
<
tterribe@xiph.org
>
parent
920ff718
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
celt/arm/armcpu.c
+22
-13
22 additions, 13 deletions
celt/arm/armcpu.c
celt/arm/armcpu.h
+6
-0
6 additions, 0 deletions
celt/arm/armcpu.h
with
28 additions
and
13 deletions
celt/arm/armcpu.c
+
22
−
13
View file @
fdb3b3ac
...
...
@@ -37,11 +37,12 @@
#include
"cpu_support.h"
#include
"os_support.h"
#include
"opus_types.h"
#include
"arch.h"
#define OPUS_CPU_ARM_V4 (1)
#define OPUS_CPU_ARM_EDSP (1<<
1
)
#define OPUS_CPU_ARM_MEDIA
(1<<2
)
#define OPUS_CPU_ARM_NEON (1<<
3
)
#define OPUS_CPU_ARM_V4
_FLAG
(1
<<OPUS_ARCH_ARM_V4
)
#define OPUS_CPU_ARM_EDSP
_FLAG
(1<<
OPUS_ARCH_ARM_EDSP
)
#define OPUS_CPU_ARM_MEDIA
_FLAG (1<<OPUS_ARCH_ARM_MEDIA
)
#define OPUS_CPU_ARM_NEON
_FLAG
(1<<
OPUS_ARCH_ARM_NEON
)
#if defined(_MSC_VER)
/*For GetExceptionCode() and EXCEPTION_ILLEGAL_INSTRUCTION.*/
...
...
@@ -59,7 +60,7 @@ static OPUS_INLINE opus_uint32 opus_cpu_capabilities(void){
__try
{
/*PLD [r13]*/
__emit
(
0xF5DDF000
);
flags
|=
OPUS_CPU_ARM_EDSP
;
flags
|=
OPUS_CPU_ARM_EDSP
_FLAG
;
}
__except
(
GetExceptionCode
()
==
EXCEPTION_ILLEGAL_INSTRUCTION
){
/*Ignore exception.*/
...
...
@@ -68,7 +69,7 @@ static OPUS_INLINE opus_uint32 opus_cpu_capabilities(void){
__try
{
/*SHADD8 r3,r3,r3*/
__emit
(
0xE6333F93
);
flags
|=
OPUS_CPU_ARM_MEDIA
;
flags
|=
OPUS_CPU_ARM_MEDIA
_FLAG
;
}
__except
(
GetExceptionCode
()
==
EXCEPTION_ILLEGAL_INSTRUCTION
){
/*Ignore exception.*/
...
...
@@ -77,7 +78,7 @@ static OPUS_INLINE opus_uint32 opus_cpu_capabilities(void){
__try
{
/*VORR q0,q0,q0*/
__emit
(
0xF2200150
);
flags
|=
OPUS_CPU_ARM_NEON
;
flags
|=
OPUS_CPU_ARM_NEON
_FLAG
;
}
__except
(
GetExceptionCode
()
==
EXCEPTION_ILLEGAL_INSTRUCTION
){
/*Ignore exception.*/
...
...
@@ -115,13 +116,13 @@ opus_uint32 opus_cpu_capabilities(void)
# if defined(OPUS_ARM_MAY_HAVE_EDSP)
p
=
strstr
(
buf
,
" edsp"
);
if
(
p
!=
NULL
&&
(
p
[
5
]
==
' '
||
p
[
5
]
==
'\n'
))
flags
|=
OPUS_CPU_ARM_EDSP
;
flags
|=
OPUS_CPU_ARM_EDSP
_FLAG
;
# endif
# if defined(OPUS_ARM_MAY_HAVE_NEON) || defined(OPUS_ARM_MAY_HAVE_NEON_INTR)
p
=
strstr
(
buf
,
" neon"
);
if
(
p
!=
NULL
&&
(
p
[
5
]
==
' '
||
p
[
5
]
==
'\n'
))
flags
|=
OPUS_CPU_ARM_NEON
;
flags
|=
OPUS_CPU_ARM_NEON
_FLAG
;
# endif
}
# endif
...
...
@@ -134,7 +135,7 @@ opus_uint32 opus_cpu_capabilities(void)
version
=
atoi
(
buf
+
17
);
if
(
version
>=
6
)
flags
|=
OPUS_CPU_ARM_MEDIA
;
flags
|=
OPUS_CPU_ARM_MEDIA
_FLAG
;
}
# endif
}
...
...
@@ -156,18 +157,26 @@ int opus_select_arch(void)
opus_uint32
flags
=
opus_cpu_capabilities
();
int
arch
=
0
;
if
(
!
(
flags
&
OPUS_CPU_ARM_EDSP
))
if
(
!
(
flags
&
OPUS_CPU_ARM_EDSP_FLAG
))
{
/* Asserts ensure arch values are sequential */
celt_assert
(
arch
==
OPUS_ARCH_ARM_V4
);
return
arch
;
}
arch
++
;
if
(
!
(
flags
&
OPUS_CPU_ARM_MEDIA
))
if
(
!
(
flags
&
OPUS_CPU_ARM_MEDIA_FLAG
))
{
celt_assert
(
arch
==
OPUS_ARCH_ARM_EDSP
);
return
arch
;
}
arch
++
;
if
(
!
(
flags
&
OPUS_CPU_ARM_NEON
))
if
(
!
(
flags
&
OPUS_CPU_ARM_NEON_FLAG
))
{
celt_assert
(
arch
==
OPUS_ARCH_ARM_MEDIA
);
return
arch
;
}
arch
++
;
celt_assert
(
arch
==
OPUS_ARCH_ARM_NEON
);
return
arch
;
}
...
...
This diff is collapsed.
Click to expand it.
celt/arm/armcpu.h
+
6
−
0
View file @
fdb3b3ac
...
...
@@ -66,6 +66,12 @@
# if defined(OPUS_HAVE_RTCD)
int
opus_select_arch
(
void
);
#define OPUS_ARCH_ARM_V4 (0)
#define OPUS_ARCH_ARM_EDSP (1)
#define OPUS_ARCH_ARM_MEDIA (2)
#define OPUS_ARCH_ARM_NEON (3)
# endif
#endif
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