Add decibel conversion functions to //common_audio:common_audio
The functions replace some existing code and will be used in the the new AutomaticGainController. Bug: webrtc:7949 Change-Id: I9a32132d4a4699a507b8548a2eac10972a2f3fd6 Reviewed-on: https://webrtc-review.googlesource.com/53141 Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Commit-Queue: Alex Loiko <aleloi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#22045}
This commit is contained in:
@ -14,6 +14,7 @@
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "common_audio/include/audio_util.h"
|
||||
#include "modules/audio_coding/neteq/audio_multi_vector.h"
|
||||
#include "test/gtest.h"
|
||||
|
||||
@ -79,7 +80,7 @@ class DtmfToneGeneratorTest : public ::testing::Test {
|
||||
EXPECT_EQ(kNumSamples, tone_gen_.Generate(kNumSamples, &signal));
|
||||
for (int n = 0; n < kNumSamples; ++n) {
|
||||
double attenuation_factor =
|
||||
pow(10, -static_cast<double>(attenuation) / 20);
|
||||
DbToRatio(-static_cast<float>(attenuation));
|
||||
// Verify that the attenuation is correct.
|
||||
for (int channel = 0; channel < channels; ++channel) {
|
||||
EXPECT_NEAR(attenuation_factor * ref_signal[channel][n],
|
||||
|
||||
Reference in New Issue
Block a user