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
b344246d
Commit
b344246d
authored
Aug 13, 2014
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
audio_format: stick to single precision arithmethic (except for FL64)
parent
f5e117e3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
modules/audio_filter/converter/format.c
modules/audio_filter/converter/format.c
+7
-7
No files found.
modules/audio_filter/converter/format.c
View file @
b344246d
...
@@ -185,7 +185,7 @@ static block_t *S16toFl32(filter_t *filter, block_t *bsrc)
...
@@ -185,7 +185,7 @@ static block_t *S16toFl32(filter_t *filter, block_t *bsrc)
* of 19 seconds for the above division. */
* of 19 seconds for the above division. */
union
{
float
f
;
int32_t
i
;
}
u
;
union
{
float
f
;
int32_t
i
;
}
u
;
u
.
i
=
*
src
++
+
0x43c00000
;
u
.
i
=
*
src
++
+
0x43c00000
;
*
dst
++
=
u
.
f
-
384
.
0
;
*
dst
++
=
u
.
f
-
384
.
f
;
}
}
#endif
#endif
out:
out:
...
@@ -265,7 +265,7 @@ static block_t *Fl32toS16(filter_t *filter, block_t *b)
...
@@ -265,7 +265,7 @@ static block_t *Fl32toS16(filter_t *filter, block_t *b)
#else
#else
/* This is Walken's trick based on IEEE float format. */
/* This is Walken's trick based on IEEE float format. */
union
{
float
f
;
int32_t
i
;
}
u
;
union
{
float
f
;
int32_t
i
;
}
u
;
u
.
f
=
*
src
++
+
384
.
0
;
u
.
f
=
*
src
++
+
384
.
f
;
if
(
u
.
i
>
0x43c07fff
)
if
(
u
.
i
>
0x43c07fff
)
*
dst
++
=
32767
;
*
dst
++
=
32767
;
else
if
(
u
.
i
<
0x43bf8000
)
else
if
(
u
.
i
<
0x43bf8000
)
...
@@ -375,11 +375,11 @@ static block_t *Fl64toU8(filter_t *filter, block_t *b)
...
@@ -375,11 +375,11 @@ static block_t *Fl64toU8(filter_t *filter, block_t *b)
uint8_t
*
dst
=
(
uint8_t
*
)
src
;
uint8_t
*
dst
=
(
uint8_t
*
)
src
;
for
(
size_t
i
=
b
->
i_buffer
/
8
;
i
--
;)
for
(
size_t
i
=
b
->
i_buffer
/
8
;
i
--
;)
{
{
float
s
=
*
(
src
++
)
*
128
.
f
;
float
s
=
*
(
src
++
)
*
128
.;
if
(
s
>=
127
.)
if
(
s
>=
127
.
f
)
*
(
dst
++
)
=
255
;
*
(
dst
++
)
=
255
;
else
else
if
(
s
<=
-
128
.)
if
(
s
<=
-
128
.
f
)
*
(
dst
++
)
=
0
;
*
(
dst
++
)
=
0
;
else
else
*
(
dst
++
)
=
lround
(
s
)
+
128
;
*
(
dst
++
)
=
lround
(
s
)
+
128
;
...
@@ -426,10 +426,10 @@ static block_t *Fl64toS32(filter_t *filter, block_t *b)
...
@@ -426,10 +426,10 @@ static block_t *Fl64toS32(filter_t *filter, block_t *b)
for
(
size_t
i
=
b
->
i_buffer
/
8
;
i
--
;)
for
(
size_t
i
=
b
->
i_buffer
/
8
;
i
--
;)
{
{
float
s
=
*
(
src
++
)
*
2147483648
.;
float
s
=
*
(
src
++
)
*
2147483648
.;
if
(
s
>=
2147483647
.)
if
(
s
>=
2147483647
.
f
)
*
(
dst
++
)
=
2147483647
;
*
(
dst
++
)
=
2147483647
;
else
else
if
(
s
<=
-
2147483648
.)
if
(
s
<=
-
2147483648
.
f
)
*
(
dst
++
)
=
-
2147483648
;
*
(
dst
++
)
=
-
2147483648
;
else
else
*
(
dst
++
)
=
lround
(
s
);
*
(
dst
++
)
=
lround
(
s
);
...
...
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