Refactor audio_coding/neteq: Removed usage of macro WEBRTC_SPL_16_16_RSFT

The macro is defined as
#define WEBRTC_SPL_MUL_16_16_RSFT(a, b, c) \
(WEBRTC_SPL_MUL_16_16(a, b) >> (c))

where the latter macro is in C defined as
#define WEBRTC_SPL_MUL_16_16(a, b) \
    ((int32_t) (((int16_t)(a)) * ((int16_t)(b))))
(For definitions on ARMv7 and MIPS, see common_audio/signal_processing/include/spl_inl_{armv7,mips}.h)

The replacement consists of
- avoiding casts to int16_t if inputs already are int16_t
- adding explicit cast to <type> if result is assigned to <type> (other than int or int32_t)
- minor cleanups like remove of unnecessary parentheses and style changes

In addition an implicit cast from int32_t to int16_t was removed, which was a bug.

BUG=3348, 3353
TESTED=Locally on Mac and trybots
R=henrik.lundin@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/41179004

Cr-Commit-Position: refs/heads/master@{#8653}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8653 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
bjornv@webrtc.org 2015-03-09 13:30:28 +00:00
parent c7faace956
commit 600587d5ac
2 changed files with 3 additions and 4 deletions

View File

@ -191,8 +191,7 @@ void BackgroundNoise::IncrementEnergyThreshold(size_t channel,
assert(channel < num_channels_);
ChannelParameters& parameters = channel_parameters_[channel];
int32_t temp_energy =
WEBRTC_SPL_MUL_16_16_RSFT(kThresholdIncrement,
parameters.low_energy_update_threshold, 16);
(kThresholdIncrement * parameters.low_energy_update_threshold) >> 16;
temp_energy += kThresholdIncrement *
(parameters.energy_update_threshold & 0xFF);
temp_energy += (kThresholdIncrement *

View File

@ -67,8 +67,8 @@ int Normal::Process(const int16_t* input,
for (size_t channel_ix = 0; channel_ix < output->Channels(); ++channel_ix) {
// Adjust muting factor (main muting factor times expand muting factor).
external_mute_factor_array[channel_ix] = static_cast<int16_t>(
WEBRTC_SPL_MUL_16_16_RSFT(external_mute_factor_array[channel_ix],
expand_->MuteFactor(channel_ix), 14));
(external_mute_factor_array[channel_ix] *
expand_->MuteFactor(channel_ix)) >> 14);
int16_t* signal = &(*output)[channel_ix][0];
size_t length_per_channel = length / output->Channels();