Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
6f4775a8
Commit
6f4775a8
authored
Mar 16, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pcm/Neon: apply bit shift during float->int conversion
Avoid multiplication. This is a speedup of 20%.
parent
c7e2f558
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
7 deletions
+2
-7
Neon.hxx
src/pcm/Neon.hxx
+2
-7
No files found.
src/pcm/Neon.hxx
View file @
6f4775a8
...
...
@@ -68,21 +68,16 @@ struct NeonFloatTo16 {
static
constexpr
size_t
BLOCK_SIZE
=
16
;
void
Convert
(
int16_t
*
dst
,
const
float
*
src
,
const
size_t
n
)
const
{
const
float32x4_t
factor
=
vdupq_n_f32
(
1
<<
(
DstTraits
::
BITS
-
1
));
for
(
unsigned
i
=
0
;
i
<
n
/
BLOCK_SIZE
;
++
i
,
src
+=
BLOCK_SIZE
,
dst
+=
BLOCK_SIZE
)
{
/* load 16 float samples into 4 quad
registers */
float32x4x4_t
value
=
vld4q_f32
(
src
);
/* apply factor */
neon_x4_b
(
vmulq_f32
,
value
,
value
,
factor
);
/* convert to 32 bit integer */
int32x4x4_t
ivalue
;
neon_x4_u
(
vcvtq_s32_f32
,
ivalue
,
value
);
neon_x4_b
(
vcvtq_n_s32_f32
,
ivalue
,
value
,
DstTraits
::
BITS
-
1
);
/* convert to 16 bit integer with saturation */
int16x4x4_t
nvalue
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment