Chromium Code Reviews| Index: webrtc/modules/audio_coding/neteq/dsp_helper.cc |
| diff --git a/webrtc/modules/audio_coding/neteq/dsp_helper.cc b/webrtc/modules/audio_coding/neteq/dsp_helper.cc |
| index 3e5c61d87b559586b889ef0826527c278c677ecd..4a34408821110812886d1418fd2460230c725ae2 100644 |
| --- a/webrtc/modules/audio_coding/neteq/dsp_helper.cc |
| +++ b/webrtc/modules/audio_coding/neteq/dsp_helper.cc |
| @@ -99,13 +99,13 @@ int DspHelper::RampSignal(AudioMultiVector* signal, |
| return end_factor; |
| } |
| -void DspHelper::PeakDetection(int16_t* data, int data_length, |
| - int num_peaks, int fs_mult, |
| - int* peak_index, int16_t* peak_value) { |
| - int16_t min_index = 0; |
| - int16_t max_index = 0; |
| +void DspHelper::PeakDetection(int16_t* data, size_t data_length, |
| + size_t num_peaks, size_t fs_mult, |
|
hlundin-webrtc
2015/08/10 11:30:00
Again, fs_mult.
|
| + size_t* peak_index, int16_t* peak_value) { |
| + size_t min_index = 0; |
| + size_t max_index = 0; |
| - for (int i = 0; i <= num_peaks - 1; i++) { |
| + for (size_t i = 0; i <= num_peaks - 1; i++) { |
| if (num_peaks == 1) { |
| // Single peak. The parabola fit assumes that an extra point is |
| // available; worst case it gets a zero on the high end of the signal. |
| @@ -147,8 +147,8 @@ void DspHelper::PeakDetection(int16_t* data, int data_length, |
| } |
| } |
| -void DspHelper::ParabolicFit(int16_t* signal_points, int fs_mult, |
| - int* peak_index, int16_t* peak_value) { |
| +void DspHelper::ParabolicFit(int16_t* signal_points, size_t fs_mult, |
|
hlundin-webrtc
2015/08/10 11:30:00
fs_mult
|
| + size_t* peak_index, int16_t* peak_value) { |
| uint16_t fit_index[13]; |
| if (fs_mult == 1) { |
| fit_index[0] = 0; |
| @@ -192,7 +192,7 @@ void DspHelper::ParabolicFit(int16_t* signal_points, int fs_mult, |
| - signal_points[2]; |
| int32_t den = signal_points[0] + (signal_points[1] * -2) + signal_points[2]; |
| int32_t temp = num * 120; |
| - int flag = 1; |
| + size_t flag = 1; |
| int16_t stp = kParabolaCoefficients[fit_index[fs_mult]][0] |
| - kParabolaCoefficients[fit_index[fs_mult - 1]][0]; |
| int16_t strt = (kParabolaCoefficients[fit_index[fs_mult]][0] |
| @@ -235,16 +235,16 @@ void DspHelper::ParabolicFit(int16_t* signal_points, int fs_mult, |
| } |
| } |
| -int DspHelper::MinDistortion(const int16_t* signal, int min_lag, |
| - int max_lag, int length, |
| - int32_t* distortion_value) { |
| - int best_index = 0; |
| +size_t DspHelper::MinDistortion(const int16_t* signal, size_t min_lag, |
| + size_t max_lag, size_t length, |
| + int32_t* distortion_value) { |
| + size_t best_index = 0; |
| int32_t min_distortion = WEBRTC_SPL_WORD32_MAX; |
| - for (int i = min_lag; i <= max_lag; i++) { |
| + for (size_t i = min_lag; i <= max_lag; i++) { |
| int32_t sum_diff = 0; |
| const int16_t* data1 = signal; |
| const int16_t* data2 = signal - i; |
| - for (int j = 0; j < length; j++) { |
| + for (size_t j = 0; j < length; j++) { |
| sum_diff += WEBRTC_SPL_ABS_W32(data1[j] - data2[j]); |
| } |
| // Compare with previous minimum. |
| @@ -293,15 +293,15 @@ void DspHelper::MuteSignal(int16_t* signal, int mute_slope, size_t length) { |
| } |
| int DspHelper::DownsampleTo4kHz(const int16_t* input, size_t input_length, |
| - int output_length, int input_rate_hz, |
| + size_t output_length, int input_rate_hz, |
| bool compensate_delay, int16_t* output) { |
| // Set filter parameters depending on input frequency. |
| // NOTE: The phase delay values are wrong compared to the true phase delay |
| // of the filters. However, the error is preserved (through the +1 term) for |
| // consistency. |
| const int16_t* filter_coefficients; // Filter coefficients. |
| - int16_t filter_length; // Number of coefficients. |
| - int16_t filter_delay; // Phase delay in samples. |
| + size_t filter_length; // Number of coefficients. |
| + size_t filter_delay; // Phase delay in samples. |
| int16_t factor; // Conversion rate (inFsHz / 8000). |
| switch (input_rate_hz) { |
| case 8000: { |
| @@ -345,9 +345,8 @@ int DspHelper::DownsampleTo4kHz(const int16_t* input, size_t input_length, |
| // Returns -1 if input signal is too short; 0 otherwise. |
| return WebRtcSpl_DownsampleFast( |
| - &input[filter_length - 1], static_cast<int>(input_length) - |
| - (filter_length - 1), output, output_length, filter_coefficients, |
| - filter_length, factor, filter_delay); |
| + &input[filter_length - 1], input_length - filter_length + 1, output, |
| + output_length, filter_coefficients, filter_length, factor, filter_delay); |
| } |
| } // namespace webrtc |