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
98ce3c33
Commit
98ce3c33
authored
Jun 07, 2011
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add mixer for FI32 and S16N
Audio volume should now work on !HAVE_FPU. This is untested though.
parent
3be96c60
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
94 additions
and
0 deletions
+94
-0
modules/LIST
modules/LIST
+1
-0
modules/audio_mixer/Modules.am
modules/audio_mixer/Modules.am
+2
-0
modules/audio_mixer/fixed32.c
modules/audio_mixer/fixed32.c
+91
-0
No files found.
modules/LIST
View file @
98ce3c33
...
@@ -118,6 +118,7 @@ $Id$
...
@@ -118,6 +118,7 @@ $Id$
* fb: video output module for the Linux framebuffer
* fb: video output module for the Linux framebuffer
* fbosd: framebuffer osd plugin
* fbosd: framebuffer osd plugin
* filesystem: Filesystem access module
* filesystem: Filesystem access module
* fixed32_mixer: Fixed-point audio mixer
* flac: Flac decoder using libflac
* flac: Flac decoder using libflac
* flacsys: FLAC demuxer
* flacsys: FLAC demuxer
* float32_mixer: Precise float32 audio mixer
* float32_mixer: Precise float32 audio mixer
...
...
modules/audio_mixer/Modules.am
View file @
98ce3c33
SOURCES_trivial_mixer = trivial.c
SOURCES_trivial_mixer = trivial.c
SOURCES_float32_mixer = float32.c
SOURCES_float32_mixer = float32.c
SOURCES_fixed32_mixer = fixed32.c
libvlc_LTLIBRARIES += \
libvlc_LTLIBRARIES += \
libfloat32_mixer_plugin.la \
libfloat32_mixer_plugin.la \
libfixed32_mixer_plugin.la \
libtrivial_mixer_plugin.la
libtrivial_mixer_plugin.la
modules/audio_mixer/fixed32.c
0 → 100644
View file @
98ce3c33
/*****************************************************************************
* fixed32.c : fixed-point software volume
*****************************************************************************
* Copyright (C) 2011 Rémi Denis-Courmnot
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_aout.h>
#include <vlc_aout_mixer.h>
static
int
Activate
(
vlc_object_t
*
);
vlc_module_begin
()
set_category
(
CAT_AUDIO
)
set_subcategory
(
SUBCAT_AUDIO_MISC
)
set_description
(
N_
(
"Fixed-point audio mixer"
))
set_capability
(
"audio mixer"
,
9
)
set_callbacks
(
Activate
,
NULL
)
vlc_module_end
()
static
void
FilterFI32
(
aout_mixer_t
*
,
block_t
*
,
float
);
static
void
FilterS16N
(
aout_mixer_t
*
,
block_t
*
,
float
);
static
int
Activate
(
vlc_object_t
*
obj
)
{
aout_mixer_t
*
mixer
=
(
aout_mixer_t
*
)
obj
;
switch
(
mixer
->
fmt
.
i_format
)
{
case
VLC_CODEC_FI32
:
mixer
->
mix
=
FilterFI32
;
break
;
case
VLC_CODEC_S16N
:
mixer
->
mix
=
FilterS16N
;
break
;
default:
return
-
1
;
}
return
0
;
}
static
void
FilterFI32
(
aout_mixer_t
*
mixer
,
block_t
*
block
,
float
volume
)
{
const
int64_t
mult
=
volume
*
mixer
->
input
->
multiplier
*
FIXED32_ONE
;
if
(
mult
==
FIXED32_ONE
)
return
;
int32_t
*
p
=
(
int32_t
*
)
block
->
p_buffer
;
for
(
size_t
n
=
block
->
i_buffer
/
sizeof
(
*
p
);
n
>
0
;
n
--
)
{
*
p
=
(
*
p
*
mult
)
>>
33
;
// FIXED32_FRACBITS;
p
++
;
}
}
static
void
FilterS16N
(
aout_mixer_t
*
mixer
,
block_t
*
block
,
float
volume
)
{
const
int32_t
mult
=
volume
*
mixer
->
input
->
multiplier
*
0x10000
;
if
(
mult
==
0x10000
)
return
;
int16_t
*
p
=
(
int16_t
*
)
block
->
p_buffer
;
for
(
size_t
n
=
block
->
i_buffer
/
sizeof
(
*
p
);
n
>
0
;
n
--
)
{
*
p
=
(
*
p
*
mult
)
>>
16
;
p
++
;
}
}
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