Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
5fb6de10
Commit
5fb6de10
authored
Dec 13, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rewrite atomic float helpers, fix 64-bits big endian support
parent
17d2ca87
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
10 deletions
+11
-10
include/vlc_atomic.h
include/vlc_atomic.h
+8
-7
src/audio_output/volume.c
src/audio_output/volume.c
+3
-3
No files found.
include/vlc_atomic.h
View file @
5fb6de10
...
...
@@ -362,21 +362,22 @@ static inline uintptr_t vlc_atomic_compare_swap(vlc_atomic_t *atom,
return
u
;
}
typedef
atomic_uint_least32_t
vlc_atomic_float
;
/** Helper to retrieve a single precision from an atom. */
static
inline
float
vlc_atomic_
getf
(
vlc_atomic_
t
*
atom
)
static
inline
float
vlc_atomic_
loadf
(
vlc_atomic_floa
t
*
atom
)
{
union
{
float
f
;
uint
ptr
_t
i
;
}
u
;
u
.
i
=
vlc_atomic_get
(
atom
);
union
{
float
f
;
uint
32
_t
i
;
}
u
;
u
.
i
=
atomic_load
(
atom
);
return
u
.
f
;
}
/** Helper to store a single precision into an atom. */
static
inline
float
vlc_atomic_setf
(
vlc_atomic_
t
*
atom
,
float
f
)
static
inline
void
vlc_atomic_storef
(
vlc_atomic_floa
t
*
atom
,
float
f
)
{
union
{
float
f
;
uint
ptr
_t
i
;
}
u
;
union
{
float
f
;
uint
32
_t
i
;
}
u
;
u
.
f
=
f
;
vlc_atomic_set
(
atom
,
u
.
i
);
return
f
;
atomic_store
(
atom
,
u
.
i
);
}
#endif
src/audio_output/volume.c
View file @
5fb6de10
...
...
@@ -37,7 +37,7 @@ struct aout_volume
{
audio_volume_t
object
;
audio_replay_gain_t
replay_gain
;
vlc_atomic_t
gain_factor
;
vlc_atomic_
floa
t
gain_factor
;
float
output_factor
;
module_t
*
module
;
};
...
...
@@ -135,7 +135,7 @@ int aout_volume_Amplify(aout_volume_t *vol, block_t *block)
return
-
1
;
float
amp
=
vol
->
output_factor
*
vlc_atomic_
get
f
(
&
vol
->
gain_factor
);
*
vlc_atomic_
load
f
(
&
vol
->
gain_factor
);
vol
->
object
.
amplify
(
&
vol
->
object
,
block
,
amp
);
return
0
;
...
...
@@ -197,7 +197,7 @@ static int ReplayGainCallback (vlc_object_t *obj, char const *var,
aout_volume_t
*
vol
=
data
;
float
multiplier
=
aout_ReplayGainSelect
(
obj
,
val
.
psz_string
,
&
vol
->
replay_gain
);
vlc_atomic_s
et
f
(
&
vol
->
gain_factor
,
multiplier
);
vlc_atomic_s
tore
f
(
&
vol
->
gain_factor
,
multiplier
);
VLC_UNUSED
(
var
);
VLC_UNUSED
(
oldval
);
return
VLC_SUCCESS
;
}
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