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
0896977b
Commit
0896977b
authored
Aug 13, 2014
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chorus_fangler: avoid double upconversion
parent
96054d7e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
14 deletions
+15
-14
modules/audio_filter/chorus_flanger.c
modules/audio_filter/chorus_flanger.c
+15
-14
No files found.
modules/audio_filter/chorus_flanger.c
View file @
0896977b
...
...
@@ -102,7 +102,7 @@ vlc_module_end ()
static
inline
float
small_value
(
void
)
{
/* allows for 2^-24, should be enough for 24-bit DACs at least */
return
(
1
.
0
/
16777216
.
0
)
;
return
1
.
f
/
16777216
.
f
;
}
/**
...
...
@@ -130,21 +130,21 @@ static int Open( vlc_object_t *p_this )
var_AddCallback
(
p_this
,
"dry-mix"
,
paramCallback
,
p_sys
);
var_AddCallback
(
p_this
,
"wet-mix"
,
paramCallback
,
p_sys
);
if
(
p_sys
->
f_delayTime
<
0
.
0
)
if
(
p_sys
->
f_delayTime
<
0
.
f
)
{
msg_Err
(
p_filter
,
"Delay Time is invalid"
);
free
(
p_sys
);
return
VLC_EGENERIC
;
}
if
(
p_sys
->
f_sweepDepth
>
p_sys
->
f_delayTime
||
p_sys
->
f_sweepDepth
<
0
.
0
)
if
(
p_sys
->
f_sweepDepth
>
p_sys
->
f_delayTime
||
p_sys
->
f_sweepDepth
<
0
.
f
)
{
msg_Err
(
p_filter
,
"Sweep Depth is invalid"
);
free
(
p_sys
);
return
VLC_EGENERIC
;
}
if
(
p_sys
->
f_sweepRate
<
0
.
0
)
if
(
p_sys
->
f_sweepRate
<
0
.
f
)
{
msg_Err
(
p_filter
,
"Sweep Rate is invalid"
);
free
(
p_sys
);
...
...
@@ -156,9 +156,10 @@ static int Open( vlc_object_t *p_this )
+
p_sys
->
f_sweepDepth
)
*
p_filter
->
fmt_in
.
audio
.
i_rate
/
1000
)
+
1
);
msg_Dbg
(
p_filter
,
"Buffer length:%d, Channels:%d, Sweep Depth:%f, Delay "
"time:%f, Sweep Rate:%f, Sample Rate: %d"
,
p_sys
->
i_bufferLength
,
p_sys
->
i_channels
,
p_sys
->
f_sweepDepth
,
p_sys
->
f_delayTime
,
p_sys
->
f_sweepRate
,
p_filter
->
fmt_in
.
audio
.
i_rate
);
"time:%f, Sweep Rate:%f, Sample Rate: %d"
,
p_sys
->
i_bufferLength
,
p_sys
->
i_channels
,
(
double
)
p_sys
->
f_sweepDepth
,
(
double
)
p_sys
->
f_delayTime
,
(
double
)
p_sys
->
f_sweepRate
,
p_filter
->
fmt_in
.
audio
.
i_rate
);
if
(
p_sys
->
i_bufferLength
<=
0
)
{
msg_Err
(
p_filter
,
"Delay-time, Sample rate or Channels was incorrect"
);
...
...
@@ -183,7 +184,7 @@ static int Open( vlc_object_t *p_this )
if
(
p_sys
->
f_sweepDepth
<
small_value
()
||
p_filter
->
fmt_in
.
audio
.
i_rate
<
small_value
()
)
{
p_sys
->
f_sinMultiplier
=
0
.
0
;
p_sys
->
f_sinMultiplier
=
0
.
f
;
}
else
{
p_sys
->
f_sinMultiplier
=
11
*
p_sys
->
f_sweepRate
/
...
...
@@ -204,8 +205,8 @@ static int Open( vlc_object_t *p_this )
*/
static
inline
void
sanitize
(
float
*
f_value
)
{
if
(
fabs
(
*
f_value
)
<
small_value
()
)
*
f_value
=
0
.
0
f
;
if
(
fabs
f
(
*
f_value
)
<
small_value
()
)
*
f_value
=
0
.
f
;
}
...
...
@@ -221,7 +222,7 @@ static block_t *DoWork( filter_t *p_filter, block_t *p_in_buf )
int
i_chan
;
unsigned
i_samples
=
p_in_buf
->
i_nb_samples
;
/* number of samples */
/* maximum number of samples to offset in buffer */
int
i_maxOffset
=
floor
(
p_sys
->
f_sweepDepth
*
p_sys
->
i_sampleRate
/
1000
);
int
i_maxOffset
=
floor
f
(
p_sys
->
f_sweepDepth
*
p_sys
->
i_sampleRate
/
1000
);
float
*
p_out
=
(
float
*
)
p_in_buf
->
p_buffer
;
float
*
p_in
=
(
float
*
)
p_in_buf
->
p_buffer
;
...
...
@@ -236,13 +237,13 @@ static block_t *DoWork( filter_t *p_filter, block_t *p_in_buf )
*
floorf
(
p_sys
->
f_sweepDepth
*
p_sys
->
i_sampleRate
/
1000
);
if
(
abs
(
p_sys
->
i_step
)
>
0
)
{
if
(
p_sys
->
i_cumulative
>=
floor
(
p_sys
->
f_sweepDepth
*
if
(
p_sys
->
i_cumulative
>=
floor
f
(
p_sys
->
f_sweepDepth
*
p_sys
->
i_sampleRate
/
p_sys
->
f_sweepRate
))
{
p_sys
->
f_offset
=
i_maxOffset
;
p_sys
->
i_step
=
-
1
*
(
p_sys
->
i_step
);
}
if
(
p_sys
->
i_cumulative
<=
floor
(
-
1
*
p_sys
->
f_sweepDepth
*
if
(
p_sys
->
i_cumulative
<=
floor
f
(
-
1
*
p_sys
->
f_sweepDepth
*
p_sys
->
i_sampleRate
/
p_sys
->
f_sweepRate
)
)
{
p_sys
->
f_offset
=
-
i_maxOffset
;
...
...
@@ -250,7 +251,7 @@ static block_t *DoWork( filter_t *p_filter, block_t *p_in_buf )
}
}
/* Calculate position in delay */
int
offset
=
floor
(
p_sys
->
f_offset
);
int
offset
=
floor
f
(
p_sys
->
f_offset
);
p_ptr
=
p_sys
->
p_write
+
(
i_maxOffset
-
offset
)
*
p_sys
->
i_channels
;
/* Handle Overflow */
...
...
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