diff options
author | pbos@webrtc.org <pbos@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> | 2013-04-09 10:09:10 +0000 |
---|---|---|
committer | pbos@webrtc.org <pbos@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> | 2013-04-09 10:09:10 +0000 |
commit | 54f03bc96c30337a3a97af7262cfb5148063b162 (patch) | |
tree | 7ea8ea88941b30b55449b7e64f06383cb9f67611 /voice_engine/dtmf_inband.cc | |
parent | c0231afbbf1d7bac40b77da5933715dc63c88144 (diff) | |
download | webrtc-54f03bc96c30337a3a97af7262cfb5148063b162.tar.gz |
WebRtc_Word32 -> int32_t in voice_engine/
BUG=314
Review URL: https://webrtc-codereview.appspot.com/1305004
git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@3792 4adac7df-926f-26a2-2b94-8c16560cd09d
Diffstat (limited to 'voice_engine/dtmf_inband.cc')
-rw-r--r-- | voice_engine/dtmf_inband.cc | 98 |
1 files changed, 49 insertions, 49 deletions
diff --git a/voice_engine/dtmf_inband.cc b/voice_engine/dtmf_inband.cc index 689bc543..c6897095 100644 --- a/voice_engine/dtmf_inband.cc +++ b/voice_engine/dtmf_inband.cc @@ -16,43 +16,43 @@ namespace webrtc { -const WebRtc_Word16 Dtmf_a_times2Tab8Khz[8]= +const int16_t Dtmf_a_times2Tab8Khz[8]= { 27978, 26956, 25701, 24219, 19073, 16325, 13085, 9314 }; -const WebRtc_Word16 Dtmf_a_times2Tab16Khz[8]= +const int16_t Dtmf_a_times2Tab16Khz[8]= { 31548, 31281, 30951, 30556, 29144, 28361, 27409, 26258 }; -const WebRtc_Word16 Dtmf_a_times2Tab32Khz[8]= +const int16_t Dtmf_a_times2Tab32Khz[8]= { 32462,32394, 32311, 32210, 31849, 31647, 31400, 31098 }; // Second table is sin(2*pi*f/fs) in Q14 -const WebRtc_Word16 Dtmf_ym2Tab8Khz[8]= +const int16_t Dtmf_ym2Tab8Khz[8]= { 8527, 9315, 10163, 11036, 13322, 14206, 15021, 15708 }; -const WebRtc_Word16 Dtmf_ym2Tab16Khz[8]= +const int16_t Dtmf_ym2Tab16Khz[8]= { 4429, 4879, 5380, 5918, 7490, 8207, 8979, 9801 }; -const WebRtc_Word16 Dtmf_ym2Tab32Khz[8]= +const int16_t Dtmf_ym2Tab32Khz[8]= { 2235, 2468, 2728, 3010, 3853, 4249, 4685, 5164 }; -const WebRtc_Word16 Dtmf_dBm0kHz[37]= +const int16_t Dtmf_dBm0kHz[37]= { 16141, 14386, 12821, 11427, 10184, 9077, 8090, 7210, 6426, 5727, 5104, 4549, @@ -64,7 +64,7 @@ const WebRtc_Word16 Dtmf_dBm0kHz[37]= }; -DtmfInband::DtmfInband(const WebRtc_Word32 id) : +DtmfInband::DtmfInband(const int32_t id) : _critSect(*CriticalSectionWrapper::CreateCriticalSection()), _id(id), _outputFrequencyHz(8000), @@ -87,7 +87,7 @@ DtmfInband::~DtmfInband() } int -DtmfInband::SetSampleRate(const WebRtc_UWord16 frequency) +DtmfInband::SetSampleRate(const uint16_t frequency) { if (frequency != 8000 && frequency != 16000 && @@ -102,7 +102,7 @@ DtmfInband::SetSampleRate(const WebRtc_UWord16 frequency) } int -DtmfInband::GetSampleRate(WebRtc_UWord16& frequency) +DtmfInband::GetSampleRate(uint16_t& frequency) { frequency = _outputFrequencyHz; return 0; @@ -125,9 +125,9 @@ DtmfInband::Init() } int -DtmfInband::AddTone(const WebRtc_UWord8 eventCode, - WebRtc_Word32 lengthMs, - WebRtc_Word32 attenuationDb) +DtmfInband::AddTone(const uint8_t eventCode, + int32_t lengthMs, + int32_t attenuationDb) { CriticalSectionScoped lock(&_critSect); @@ -145,10 +145,10 @@ DtmfInband::AddTone(const WebRtc_UWord8 eventCode, ReInit(); - _frameLengthSamples = static_cast<WebRtc_Word16> (_outputFrequencyHz / 100); - _eventCode = static_cast<WebRtc_Word16> (eventCode); - _attenuationDb = static_cast<WebRtc_Word16> (attenuationDb); - _remainingSamples = static_cast<WebRtc_Word32> + _frameLengthSamples = static_cast<int16_t> (_outputFrequencyHz / 100); + _eventCode = static_cast<int16_t> (eventCode); + _attenuationDb = static_cast<int16_t> (attenuationDb); + _remainingSamples = static_cast<int32_t> (lengthMs * (_outputFrequencyHz / 1000)); _lengthMs = lengthMs; @@ -162,16 +162,16 @@ DtmfInband::ResetTone() ReInit(); - _frameLengthSamples = static_cast<WebRtc_Word16> (_outputFrequencyHz / 100); - _remainingSamples = static_cast<WebRtc_Word32> + _frameLengthSamples = static_cast<int16_t> (_outputFrequencyHz / 100); + _remainingSamples = static_cast<int32_t> (_lengthMs * (_outputFrequencyHz / 1000)); return 0; } int -DtmfInband::StartTone(const WebRtc_UWord8 eventCode, - WebRtc_Word32 attenuationDb) +DtmfInband::StartTone(const uint8_t eventCode, + int32_t attenuationDb) { CriticalSectionScoped lock(&_critSect); @@ -188,9 +188,9 @@ DtmfInband::StartTone(const WebRtc_UWord8 eventCode, ReInit(); - _frameLengthSamples = static_cast<WebRtc_Word16> (_outputFrequencyHz / 100); - _eventCode = static_cast<WebRtc_Word16> (eventCode); - _attenuationDb = static_cast<WebRtc_Word16> (attenuationDb); + _frameLengthSamples = static_cast<int16_t> (_outputFrequencyHz / 100); + _eventCode = static_cast<int16_t> (eventCode); + _attenuationDb = static_cast<int16_t> (attenuationDb); _playing = true; return 0; @@ -226,8 +226,8 @@ DtmfInband::IsAddingTone() } int -DtmfInband::Get10msTone(WebRtc_Word16 output[320], - WebRtc_UWord16& outputSizeInSamples) +DtmfInband::Get10msTone(int16_t output[320], + uint16_t& outputSizeInSamples) { CriticalSectionScoped lock(&_critSect); if (DtmfFix_generate(output, @@ -255,22 +255,22 @@ DtmfInband::UpdateDelaySinceLastTone() } } -WebRtc_UWord32 +uint32_t DtmfInband::DelaySinceLastTone() const { return _delaySinceLastToneMS; } -WebRtc_Word16 -DtmfInband::DtmfFix_generate(WebRtc_Word16 *decoded, - const WebRtc_Word16 value, - const WebRtc_Word16 volume, - const WebRtc_Word16 frameLen, - const WebRtc_Word16 fs) +int16_t +DtmfInband::DtmfFix_generate(int16_t *decoded, + const int16_t value, + const int16_t volume, + const int16_t frameLen, + const int16_t fs) { - const WebRtc_Word16 *a_times2Tbl; - const WebRtc_Word16 *y2_Table; - WebRtc_Word16 a1_times2 = 0, a2_times2 = 0; + const int16_t *a_times2Tbl; + const int16_t *y2_Table; + int16_t a1_times2 = 0, a2_times2 = 0; if (fs==8000) { a_times2Tbl=Dtmf_a_times2Tab8Khz; @@ -347,24 +347,24 @@ DtmfInband::DtmfFix_generate(WebRtc_Word16 *decoded, frameLen)); } -WebRtc_Word16 -DtmfInband::DtmfFix_generateSignal(const WebRtc_Word16 a1_times2, - const WebRtc_Word16 a2_times2, - const WebRtc_Word16 volume, - WebRtc_Word16 *signal, - const WebRtc_Word16 length) +int16_t +DtmfInband::DtmfFix_generateSignal(const int16_t a1_times2, + const int16_t a2_times2, + const int16_t volume, + int16_t *signal, + const int16_t length) { int i; /* Generate Signal */ for (i=0;i<length;i++) { - WebRtc_Word32 tempVal; - WebRtc_Word16 tempValLow, tempValHigh; + int32_t tempVal; + int16_t tempValLow, tempValHigh; /* Use recursion formula y[n] = a*2*y[n-1] - y[n-2] */ - tempValLow = (WebRtc_Word16)(((( (WebRtc_Word32)(a1_times2 * + tempValLow = (int16_t)(((( (int32_t)(a1_times2 * _oldOutputLow[1])) + 8192) >> 14) - _oldOutputLow[0]); - tempValHigh = (WebRtc_Word16)(((( (WebRtc_Word32)(a2_times2 * + tempValHigh = (int16_t)(((( (int32_t)(a2_times2 * _oldOutputHigh[1])) + 8192) >> 14) - _oldOutputHigh[0]); /* Update memory */ @@ -373,14 +373,14 @@ DtmfInband::DtmfFix_generateSignal(const WebRtc_Word16 a1_times2, _oldOutputHigh[0]=_oldOutputHigh[1]; _oldOutputHigh[1]=tempValHigh; - tempVal = (WebRtc_Word32)(kDtmfAmpLow * tempValLow) + - (WebRtc_Word32)(kDtmfAmpHigh * tempValHigh); + tempVal = (int32_t)(kDtmfAmpLow * tempValLow) + + (int32_t)(kDtmfAmpHigh * tempValHigh); /* Norm the signal to Q14 */ tempVal=(tempVal+16384)>>15; /* Scale the signal to correct dbM0 value */ - signal[i]=(WebRtc_Word16)((tempVal*Dtmf_dBm0kHz[volume]+8192)>>14); + signal[i]=(int16_t)((tempVal*Dtmf_dBm0kHz[volume]+8192)>>14); } return(0); |