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
eee1dd00
Commit
eee1dd00
authored
May 16, 2014
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
integer: simplify
parent
13c14eea
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
27 deletions
+21
-27
modules/audio_mixer/integer.c
modules/audio_mixer/integer.c
+21
-27
No files found.
modules/audio_mixer/integer.c
View file @
eee1dd00
...
...
@@ -44,21 +44,19 @@ static void FilterS32N (audio_volume_t *vol, block_t *block, float volume)
{
int32_t
*
p
=
(
int32_t
*
)
block
->
p_buffer
;
int32_t
mult
=
lroundf
(
volume
*
0x1
.
p24f
);
int
_fast
32_t
mult
=
lroundf
(
volume
*
0x1
.
p24f
);
if
(
mult
==
(
1
<<
24
))
return
;
for
(
size_t
n
=
block
->
i_buffer
/
sizeof
(
*
p
);
n
>
0
;
n
--
)
{
int
64_t
s
=
*
p
*
(
int64_t
)
mult
;
if
(
s
>
=
((
int64_t
)
INT32_MAX
<<
INT64_C
(
24
))
)
*
p
=
INT32_MAX
;
int
_fast64_t
s
=
(
*
p
*
(
int_fast64_t
)
mult
)
>>
INT64_C
(
24
)
;
if
(
s
>
INT32_MAX
)
s
=
INT32_MAX
;
else
if
(
s
<
((
int64_t
)
INT32_MIN
<<
INT64_C
(
24
)))
*
p
=
INT32_MIN
;
else
*
p
=
s
>>
INT64_C
(
24
);
p
++
;
if
(
s
<
INT32_MIN
)
s
=
INT32_MIN
;
*
(
p
++
)
=
s
;
}
(
void
)
vol
;
}
...
...
@@ -67,21 +65,19 @@ static void FilterS16N (audio_volume_t *vol, block_t *block, float volume)
{
int16_t
*
p
=
(
int16_t
*
)
block
->
p_buffer
;
int16_t
mult
=
lroundf
(
volume
*
0x1
.
p8f
);
int
_fast
16_t
mult
=
lroundf
(
volume
*
0x1
.
p8f
);
if
(
mult
==
(
1
<<
8
))
return
;
for
(
size_t
n
=
block
->
i_buffer
/
sizeof
(
*
p
);
n
>
0
;
n
--
)
{
int32_t
s
=
*
p
*
(
int32_t
)
mult
;
if
(
s
>=
(
INT16_MAX
<<
8
))
*
p
=
INT16_MAX
;
else
if
(
s
<
(
INT16_MIN
<<
8
))
*
p
=
INT16_MIN
;
int_fast32_t
s
=
(
*
p
*
(
int_fast32_t
)
mult
)
>>
8
;
if
(
s
>
INT16_MAX
)
s
=
INT16_MAX
;
else
*
p
=
s
>>
8
;
p
++
;
if
(
s
<
INT16_MIN
)
s
=
INT16_MIN
;
*
(
p
++
)
=
s
;
}
(
void
)
vol
;
}
...
...
@@ -90,21 +86,19 @@ static void FilterU8 (audio_volume_t *vol, block_t *block, float volume)
{
uint8_t
*
p
=
(
uint8_t
*
)
block
->
p_buffer
;
int16_t
mult
=
lroundf
(
volume
*
0x1
.
p8f
);
int
_fast
16_t
mult
=
lroundf
(
volume
*
0x1
.
p8f
);
if
(
mult
==
(
1
<<
8
))
return
;
for
(
size_t
n
=
block
->
i_buffer
/
sizeof
(
*
p
);
n
>
0
;
n
--
)
{
int32_t
s
=
(
*
p
-
128
)
*
mult
;
if
(
s
>=
(
INT8_MAX
<<
8
))
*
p
=
255
;
else
if
(
s
<
(
INT8_MIN
<<
8
))
*
p
=
0
;
int_fast32_t
s
=
(((
int_fast8_t
)(
*
p
-
128
))
*
(
int_fast32_t
)
mult
)
>>
8
;
if
(
s
>
INT8_MAX
)
s
=
INT8_MAX
;
else
*
p
=
(
s
>>
8
)
+
128
;
p
++
;
if
(
s
<
INT8_MIN
)
s
=
INT8_MIN
;
*
(
p
++
)
=
s
+
128
;
}
(
void
)
vol
;
}
...
...
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