Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
d1136fc4
Commit
d1136fc4
authored
Jul 26, 2011
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
aout: premultiply gain before mixing
parent
ce42f29a
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
14 additions
and
13 deletions
+14
-13
include/vlc_aout_mixer.h
include/vlc_aout_mixer.h
+0
-4
modules/audio_mixer/fixed32.c
modules/audio_mixer/fixed32.c
+6
-2
modules/audio_mixer/float32.c
modules/audio_mixer/float32.c
+2
-2
src/audio_output/aout_internal.h
src/audio_output/aout_internal.h
+1
-0
src/audio_output/dec.c
src/audio_output/dec.c
+1
-1
src/audio_output/input.c
src/audio_output/input.c
+4
-4
No files found.
include/vlc_aout_mixer.h
View file @
d1136fc4
...
@@ -41,11 +41,7 @@ typedef struct aout_mixer_sys_t aout_mixer_sys_t;
...
@@ -41,11 +41,7 @@ typedef struct aout_mixer_sys_t aout_mixer_sys_t;
typedef
struct
aout_mixer_t
aout_mixer_t
;
typedef
struct
aout_mixer_t
aout_mixer_t
;
typedef
struct
{
typedef
struct
{
/* */
aout_fifo_t
fifo
;
aout_fifo_t
fifo
;
/* Software multiplier */
float
multiplier
;
}
aout_mixer_input_t
;
}
aout_mixer_input_t
;
/**
/**
...
...
modules/audio_mixer/fixed32.c
View file @
d1136fc4
...
@@ -60,7 +60,7 @@ static int Activate (vlc_object_t *obj)
...
@@ -60,7 +60,7 @@ static int Activate (vlc_object_t *obj)
static
void
FilterFI32
(
aout_mixer_t
*
mixer
,
block_t
*
block
,
float
volume
)
static
void
FilterFI32
(
aout_mixer_t
*
mixer
,
block_t
*
block
,
float
volume
)
{
{
const
int64_t
mult
=
volume
*
mixer
->
input
->
multiplier
*
FIXED32_ONE
;
const
int64_t
mult
=
volume
*
FIXED32_ONE
;
if
(
mult
==
FIXED32_ONE
)
if
(
mult
==
FIXED32_ONE
)
return
;
return
;
...
@@ -72,11 +72,13 @@ static void FilterFI32 (aout_mixer_t *mixer, block_t *block, float volume)
...
@@ -72,11 +72,13 @@ static void FilterFI32 (aout_mixer_t *mixer, block_t *block, float volume)
*
p
=
(
*
p
*
mult
)
>>
FIXED32_FRACBITS
;
*
p
=
(
*
p
*
mult
)
>>
FIXED32_FRACBITS
;
p
++
;
p
++
;
}
}
(
void
)
mixer
;
}
}
static
void
FilterS16N
(
aout_mixer_t
*
mixer
,
block_t
*
block
,
float
volume
)
static
void
FilterS16N
(
aout_mixer_t
*
mixer
,
block_t
*
block
,
float
volume
)
{
{
const
int32_t
mult
=
volume
*
mixer
->
input
->
multiplier
*
0x10000
;
const
int32_t
mult
=
volume
*
0x10000
;
if
(
mult
==
0x10000
)
if
(
mult
==
0x10000
)
return
;
return
;
...
@@ -88,4 +90,6 @@ static void FilterS16N (aout_mixer_t *mixer, block_t *block, float volume)
...
@@ -88,4 +90,6 @@ static void FilterS16N (aout_mixer_t *mixer, block_t *block, float volume)
*
p
=
(
*
p
*
mult
)
>>
16
;
*
p
=
(
*
p
*
mult
)
>>
16
;
p
++
;
p
++
;
}
}
(
void
)
mixer
;
}
}
modules/audio_mixer/float32.c
View file @
d1136fc4
...
@@ -72,12 +72,12 @@ static int Create( vlc_object_t *p_this )
...
@@ -72,12 +72,12 @@ static int Create( vlc_object_t *p_this )
static
void
DoWork
(
aout_mixer_t
*
p_mixer
,
aout_buffer_t
*
p_buffer
,
static
void
DoWork
(
aout_mixer_t
*
p_mixer
,
aout_buffer_t
*
p_buffer
,
float
f_multiplier
)
float
f_multiplier
)
{
{
f_multiplier
*=
p_mixer
->
input
->
multiplier
;
if
(
f_multiplier
==
1
.
0
)
if
(
f_multiplier
==
1
.
0
)
return
;
/* nothing to do */
return
;
/* nothing to do */
float
*
p
=
(
float
*
)
p_buffer
->
p_buffer
;
float
*
p
=
(
float
*
)
p_buffer
->
p_buffer
;
for
(
size_t
i
=
p_buffer
->
i_buffer
/
sizeof
(
float
);
i
>
0
;
i
--
)
for
(
size_t
i
=
p_buffer
->
i_buffer
/
sizeof
(
float
);
i
>
0
;
i
--
)
*
(
p
++
)
*=
f_multiplier
;
*
(
p
++
)
*=
f_multiplier
;
(
void
)
p_mixer
;
}
}
src/audio_output/aout_internal.h
View file @
d1136fc4
...
@@ -54,6 +54,7 @@ block_t *aout_FilterBufferNew( filter_t *, int );
...
@@ -54,6 +54,7 @@ block_t *aout_FilterBufferNew( filter_t *, int );
struct
aout_input_t
struct
aout_input_t
{
{
audio_sample_format_t
input
;
audio_sample_format_t
input
;
float
multiplier
;
/**< Replay gain multiplier */
/* pre-filters */
/* pre-filters */
filter_t
*
pp_filters
[
AOUT_MAX_FILTERS
];
filter_t
*
pp_filters
[
AOUT_MAX_FILTERS
];
...
...
src/audio_output/dec.c
View file @
d1136fc4
...
@@ -198,7 +198,7 @@ int aout_DecPlay( audio_output_t * p_aout, aout_input_t * p_input,
...
@@ -198,7 +198,7 @@ int aout_DecPlay( audio_output_t * p_aout, aout_input_t * p_input,
aout_InputCheckAndRestart
(
p_aout
,
p_input
);
aout_InputCheckAndRestart
(
p_aout
,
p_input
);
aout_InputPlay
(
p_aout
,
p_input
,
p_buffer
,
i_input_rate
);
aout_InputPlay
(
p_aout
,
p_input
,
p_buffer
,
i_input_rate
);
/* Run the mixer if it is able to run. */
/* Run the mixer if it is able to run. */
aout_MixerRun
(
p_aout
,
p_aout
->
mixer_multiplier
);
aout_MixerRun
(
p_aout
,
p_aout
->
mixer_multiplier
*
p_input
->
multiplier
);
aout_unlock
(
p_aout
);
aout_unlock
(
p_aout
);
return
0
;
return
0
;
}
}
...
...
src/audio_output/input.c
View file @
d1136fc4
...
@@ -874,7 +874,7 @@ static void ReplayGainSelect( audio_output_t *p_aout, aout_input_t *p_input )
...
@@ -874,7 +874,7 @@ static void ReplayGainSelect( audio_output_t *p_aout, aout_input_t *p_input )
int
i_use
;
int
i_use
;
float
f_gain
;
float
f_gain
;
p_input
->
m
ixer
.
m
ultiplier
=
1
.
0
;
p_input
->
multiplier
=
1
.
0
;
if
(
!
psz_replay_gain
)
if
(
!
psz_replay_gain
)
return
;
return
;
...
@@ -905,14 +905,14 @@ static void ReplayGainSelect( audio_output_t *p_aout, aout_input_t *p_input )
...
@@ -905,14 +905,14 @@ static void ReplayGainSelect( audio_output_t *p_aout, aout_input_t *p_input )
f_gain
=
var_GetFloat
(
p_aout
,
"audio-replay-gain-default"
);
f_gain
=
var_GetFloat
(
p_aout
,
"audio-replay-gain-default"
);
else
else
f_gain
=
0
.
0
;
f_gain
=
0
.
0
;
p_input
->
m
ixer
.
m
ultiplier
=
pow
(
10
.
0
,
f_gain
/
20
.
0
);
p_input
->
multiplier
=
pow
(
10
.
0
,
f_gain
/
20
.
0
);
/* */
/* */
if
(
p_input
->
replay_gain
.
pb_peak
[
i_use
]
&&
if
(
p_input
->
replay_gain
.
pb_peak
[
i_use
]
&&
var_GetBool
(
p_aout
,
"audio-replay-gain-peak-protection"
)
&&
var_GetBool
(
p_aout
,
"audio-replay-gain-peak-protection"
)
&&
p_input
->
replay_gain
.
pf_peak
[
i_use
]
*
p_input
->
m
ixer
.
m
ultiplier
>
1
.
0
)
p_input
->
replay_gain
.
pf_peak
[
i_use
]
*
p_input
->
multiplier
>
1
.
0
)
{
{
p_input
->
m
ixer
.
m
ultiplier
=
1
.
0
f
/
p_input
->
replay_gain
.
pf_peak
[
i_use
];
p_input
->
multiplier
=
1
.
0
f
/
p_input
->
replay_gain
.
pf_peak
[
i_use
];
}
}
free
(
psz_replay_gain
);
free
(
psz_replay_gain
);
...
...
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