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
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
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
Victor Ding
Opus
Commits
0f869cba
Commit
0f869cba
authored
11 years ago
by
Jean-Marc Valin
Browse files
Options
Downloads
Patches
Plain Diff
Changes ABS16() and ABS32() to use fabs() in the float build
gcc is better at optimizing it than the ?: version
parent
c94e4bb1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
celt/arch.h
+7
-3
7 additions, 3 deletions
celt/arch.h
celt/tests/test_unit_cwrs32.c
+1
-1
1 addition, 1 deletion
celt/tests/test_unit_cwrs32.c
with
8 additions
and
4 deletions
celt/arch.h
+
7
−
3
View file @
0f869cba
...
...
@@ -69,11 +69,8 @@ static OPUS_INLINE void _celt_fatal(const char *str, const char *file, int line)
#define IMUL32(a,b) ((a)*(b))
#define ABS(x) ((x) < 0 ? (-(x)) : (x))
/**< Absolute integer value. */
#define ABS16(x) ((x) < 0 ? (-(x)) : (x))
/**< Absolute 16-bit value. */
#define MIN16(a,b) ((a) < (b) ? (a) : (b))
/**< Minimum 16-bit value. */
#define MAX16(a,b) ((a) > (b) ? (a) : (b))
/**< Maximum 16-bit value. */
#define ABS32(x) ((x) < 0 ? (-(x)) : (x))
/**< Absolute 32-bit value. */
#define MIN32(a,b) ((a) < (b) ? (a) : (b))
/**< Minimum 32-bit value. */
#define MAX32(a,b) ((a) > (b) ? (a) : (b))
/**< Maximum 32-bit value. */
#define IMIN(a,b) ((a) < (b) ? (a) : (b))
/**< Minimum int value. */
...
...
@@ -108,6 +105,9 @@ typedef opus_val32 celt_ener;
#define SCALEIN(a) (a)
#define SCALEOUT(a) (a)
#define ABS16(x) ((x) < 0 ? (-(x)) : (x))
#define ABS32(x) ((x) < 0 ? (-(x)) : (x))
#ifdef FIXED_DEBUG
#include
"fixed_debug.h"
#else
...
...
@@ -146,6 +146,10 @@ typedef float celt_ener;
#define VERY_LARGE16 1e15f
#define Q15_ONE ((opus_val16)1.f)
/* This appears to be the same speed as C99's fabsf() but it's more portable. */
#define ABS16(x) ((float)fabs(x))
#define ABS32(x) ((float)fabs(x))
#define QCONST16(x,bits) (x)
#define QCONST32(x,bits) (x)
...
...
This diff is collapsed.
Click to expand it.
celt/tests/test_unit_cwrs32.c
+
1
−
1
View file @
0f869cba
...
...
@@ -127,7 +127,7 @@ int main(void){
cwrsi
(
n
,
k
,
i
,
y
);
#endif
sy
=
0
;
for
(
j
=
0
;
j
<
n
;
j
++
)
sy
+=
ABS
(
y
[
j
]);
for
(
j
=
0
;
j
<
n
;
j
++
)
sy
+=
abs
(
y
[
j
]);
if
(
sy
!=
k
){
fprintf
(
stderr
,
"N=%d Pulse count mismatch in cwrsi (%d!=%d).
\n
"
,
n
,
sy
,
k
);
...
...
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