Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
savoirfairelinux
jami-daemon
Commits
6a652e93
Commit
6a652e93
authored
Jun 03, 2010
by
Alexandre Savard
Browse files
[#3487] Improve notch filter for DC component removal
parent
99743b43
Changes
3
Hide whitespace changes
Inline
Side-by-side
sflphone-common/src/audio/alsa/alsalayer.cpp
View file @
6a652e93
...
...
@@ -1125,9 +1125,15 @@ void AlsaLayer::audioCallback(void)
}
else
{
int
sampleready
=
AudioLayer
::
_echoCanceller
->
processAudio
(
in
,
echoCancelledMic
,
toPut
);
SFLDataFormat
*
filter_out
=
(
SFLDataFormat
*
)
malloc
(
framesPerBufferAlsa
*
sizeof
(
SFLDataFormat
));
_audiofilter
->
processAudio
(
in
,
filter_out
,
toPut
);
int
sampleready
=
AudioLayer
::
_echoCanceller
->
processAudio
(
filter_out
,
echoCancelledMic
,
toPut
);
getMainBuffer
()
->
putData
(
echoCancelledMic
,
sampleready
*
sizeof
(
SFLDataFormat
),
100
);
free
(
rsmpl_out
);
}
}
...
...
sflphone-common/src/audio/dcblocker.cpp
View file @
6a652e93
...
...
@@ -77,7 +77,7 @@ void DcBlocker::process (SFLDataFormat *data, int nbBytes)
int
nbSamples
=
nbBytes
/
sizeof
(
SFLDataFormat
);
for
(
int
i
=
0
;
i
<
nbSamples
;
i
++
)
{
_debug
(
"i: %d"
,
i
);
_x
=
data
[
i
];
_y
=
(
SFLDataFormat
)
(
(
float
)
_x
-
(
float
)
_xm1
+
0.9999
*
(
float
)
_ym1
);
...
...
@@ -89,6 +89,22 @@ void DcBlocker::process (SFLDataFormat *data, int nbBytes)
}
}
int
DcBlocker
::
process
(
SFLDataFormat
*
inputData
,
SFLDataFormat
*
outputData
,
int
nbBytes
)
{
return
0
;}
int
DcBlocker
::
process
(
SFLDataFormat
*
inputData
,
SFLDataFormat
*
outputData
,
int
nbBytes
)
{
int
nbSamples
=
nbBytes
/
sizeof
(
SFLDataFormat
);
for
(
int
i
=
0
;
i
<
nbSamples
;
i
++
)
{
_x
=
inputData
[
i
];
_y
=
(
SFLDataFormat
)
(
(
float
)
_x
-
(
float
)
_xm1
+
0.9999
*
(
float
)
_ym1
);
_xm1
=
_x
;
_ym1
=
_y
;
outputData
[
i
]
=
_y
;
}
return
0
;
}
void
DcBlocker
::
process
(
SFLDataFormat
*
micData
,
SFLDataFormat
*
spkrData
,
SFLDataFormat
*
outputData
,
int
nbBytes
)
{}
sflphone-common/src/audio/pulseaudio/pulselayer.cpp
View file @
6a652e93
...
...
@@ -981,11 +981,18 @@ void PulseLayer::readFromMic (void)
}
else
{
SFLDataFormat
*
filter_out
=
(
SFLDataFormat
*
)
pa_xmalloc
(
r
);
// remove dc offset
_audiofilter
->
processAudio
((
SFLDataFormat
*
)
data
,
filter_out
,
r
);
// echo cancellation processing
int
sampleready
=
_echoCanceller
->
processAudio
((
SFLDataFormat
*
)
data
,
echoCancelledMic
,
r
);
int
sampleready
=
_echoCanceller
->
processAudio
((
SFLDataFormat
*
)
data
,
echoCancelledMic
,
r
);
// no resampling required
getMainBuffer
()
->
putData
(
echoCancelledMic
,
sampleready
*
sizeof
(
SFLDataFormat
),
100
);
pa_xfree
(
filter_out
);
}
...
...
Write
Preview
Supports
Markdown
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