Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
1c8f5cc6
Commit
1c8f5cc6
authored
Sep 05, 2009
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NEON vectorized fi32->s16l audio filter
This conversion is always needed between mixer and output.
parent
b1aa778c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
75 additions
and
6 deletions
+75
-6
modules/audio_filter/converter/neon.c
modules/audio_filter/converter/neon.c
+75
-6
No files found.
modules/audio_filter/converter/neon.c
View file @
1c8f5cc6
...
...
@@ -37,6 +37,8 @@ vlc_module_end ()
static
void
Do_F32_S32
(
aout_instance_t
*
,
aout_filter_t
*
,
aout_buffer_t
*
,
aout_buffer_t
*
);
static
void
Do_S32_S16
(
aout_instance_t
*
,
aout_filter_t
*
,
aout_buffer_t
*
,
aout_buffer_t
*
);
static
int
Open
(
vlc_object_t
*
obj
)
{
...
...
@@ -47,15 +49,32 @@ static int Open (vlc_object_t *obj)
if
(
!
AOUT_FMTS_SIMILAR
(
&
filter
->
input
,
&
filter
->
output
))
return
VLC_EGENERIC
;
if
(
filter
->
input
.
i_format
==
VLC_CODEC_FL32
)
switch
(
filter
->
input
.
i_format
)
{
if
(
filter
->
output
.
i_format
==
VLC_CODEC_FI32
)
filter
->
pf_do_work
=
Do_F32_S32
;
else
case
VLC_CODEC_FL32
:
switch
(
filter
->
output
.
i_format
)
{
case
VLC_CODEC_FI32
:
filter
->
pf_do_work
=
Do_F32_S32
;
break
;
default:
return
VLC_EGENERIC
;
}
break
;
case
VLC_CODEC_FI32
:
switch
(
filter
->
output
.
i_format
)
{
case
VLC_CODEC_S16N
:
filter
->
pf_do_work
=
Do_S32_S16
;
break
;
default:
return
VLC_EGENERIC
;
}
break
;
default:
return
VLC_EGENERIC
;
}
else
return
VLC_EGENERIC
;
filter
->
b_in_place
=
true
;
return
0
;
...
...
@@ -118,3 +137,53 @@ static void Do_F32_S32 (aout_instance_t *aout, aout_filter_t *filter,
outbuf
->
i_nb_bytes
=
inbuf
->
i_nb_bytes
;
(
void
)
aout
;
}
/**
* Signed 32-bits fixed point to signed 16-bits integer
*/
static
void
Do_S32_S16
(
aout_instance_t
*
aout
,
aout_filter_t
*
filter
,
aout_buffer_t
*
inbuf
,
aout_buffer_t
*
outbuf
)
{
unsigned
nb_samples
=
inbuf
->
i_nb_samples
*
aout_FormatNbChannels
(
&
filter
->
input
);
int32_t
*
inp
=
(
int32_t
*
)
inbuf
->
p_buffer
;
const
int32_t
*
endp
=
inp
+
nb_samples
;
int16_t
*
outp
=
(
int16_t
*
)
outbuf
->
p_buffer
;
while
(
nb_samples
&
3
)
{
const
int16_t
roundup
=
1
<<
12
;
asm
volatile
(
"qadd r0, %[inv], %[roundup]
\n
"
"ssat %[outv], #16, r0, asr #13
\n
"
:
[
outv
]
"=r"
(
*
outp
)
:
[
inv
]
"r"
(
*
inp
),
[
roundup
]
"r"
(
roundup
)
:
"r0"
);
inp
++
;
outp
++
;
nb_samples
--
;
}
if
(
nb_samples
&
4
)
asm
volatile
(
"vld1.s32 {q0}, [%[inp]]!
\n
"
"vrshrn.i32 d0, q0, #13
\n
"
"vst1.s16 {d0}, [%[outp]]!
\n
"
:
[
outp
]
"+r"
(
outp
),
[
inp
]
"+r"
(
inp
)
:
:
"q0"
,
"memory"
);
while
(
inp
!=
endp
)
asm
volatile
(
"vld1.s32 {q0-q1}, [%[inp]]!
\n
"
"vrshrn.s32 d0, q0, #13
\n
"
"vrshrn.s32 d1, q1, #13
\n
"
"vst1.s16 {q0}, [%[outp]]!
\n
"
:
[
outp
]
"+r"
(
outp
),
[
inp
]
"+r"
(
inp
)
:
:
"q0"
,
"q1"
,
"memory"
);
outbuf
->
i_nb_samples
=
inbuf
->
i_nb_samples
;
outbuf
->
i_nb_bytes
=
inbuf
->
i_nb_bytes
/
2
;
(
void
)
aout
;
}
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