| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 // is decreased by |factor_decrement| (Q14) for each sample. The gain for | 103 // is decreased by |factor_decrement| (Q14) for each sample. The gain for |
| 104 // |input2| is the complement 16384 - mix_factor. | 104 // |input2| is the complement 16384 - mix_factor. |
| 105 static void CrossFade(const int16_t* input1, const int16_t* input2, | 105 static void CrossFade(const int16_t* input1, const int16_t* input2, |
| 106 size_t length, int16_t* mix_factor, | 106 size_t length, int16_t* mix_factor, |
| 107 int16_t factor_decrement, int16_t* output); | 107 int16_t factor_decrement, int16_t* output); |
| 108 | 108 |
| 109 // Scales |input| with an increasing gain. Applies |factor| (Q14) to the first | 109 // Scales |input| with an increasing gain. Applies |factor| (Q14) to the first |
| 110 // sample and increases the gain by |increment| (Q20) for each sample. The | 110 // sample and increases the gain by |increment| (Q20) for each sample. The |
| 111 // result is written to |output|. |length| samples are processed. | 111 // result is written to |output|. |length| samples are processed. |
| 112 static void UnmuteSignal(const int16_t* input, size_t length, int16_t* factor, | 112 static void UnmuteSignal(const int16_t* input, size_t length, int16_t* factor, |
| 113 int increment, int16_t* output); | 113 int16_t increment, int16_t* output); |
| 114 | 114 |
| 115 // Starts at unity gain and gradually fades out |signal|. For each sample, | 115 // Starts at unity gain and gradually fades out |signal|. For each sample, |
| 116 // the gain is reduced by |mute_slope| (Q14). |length| samples are processed. | 116 // the gain is reduced by |mute_slope| (Q14). |length| samples are processed. |
| 117 static void MuteSignal(int16_t* signal, int mute_slope, size_t length); | 117 static void MuteSignal(int16_t* signal, int16_t mute_slope, size_t length); |
| 118 | 118 |
| 119 // Downsamples |input| from |sample_rate_hz| to 4 kHz sample rate. The input | 119 // Downsamples |input| from |sample_rate_hz| to 4 kHz sample rate. The input |
| 120 // has |input_length| samples, and the method will write |output_length| | 120 // has |input_length| samples, and the method will write |output_length| |
| 121 // samples to |output|. Compensates for the phase delay of the downsampling | 121 // samples to |output|. Compensates for the phase delay of the downsampling |
| 122 // filters if |compensate_delay| is true. Returns -1 if the input is too short | 122 // filters if |compensate_delay| is true. Returns -1 if the input is too short |
| 123 // to produce |output_length| samples, otherwise 0. | 123 // to produce |output_length| samples, otherwise 0. |
| 124 static int DownsampleTo4kHz(const int16_t* input, size_t input_length, | 124 static int DownsampleTo4kHz(const int16_t* input, size_t input_length, |
| 125 int output_length, int input_rate_hz, | 125 int output_length, int input_rate_hz, |
| 126 bool compensate_delay, int16_t* output); | 126 bool compensate_delay, int16_t* output); |
| 127 | 127 |
| 128 private: | 128 private: |
| 129 // Table of constants used in method DspHelper::ParabolicFit(). | 129 // Table of constants used in method DspHelper::ParabolicFit(). |
| 130 static const int16_t kParabolaCoefficients[17][3]; | 130 static const int16_t kParabolaCoefficients[17][3]; |
| 131 | 131 |
| 132 DISALLOW_COPY_AND_ASSIGN(DspHelper); | 132 DISALLOW_COPY_AND_ASSIGN(DspHelper); |
| 133 }; | 133 }; |
| 134 | 134 |
| 135 } // namespace webrtc | 135 } // namespace webrtc |
| 136 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_DSP_HELPER_H_ | 136 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_DSP_HELPER_H_ |
| OLD | NEW |