OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
49 std::vector<float> noise(noise_samples * noise_file.num_channels()); | 49 std::vector<float> noise(noise_samples * noise_file.num_channels()); |
50 ChannelBuffer<float> in_buf(in_samples, in_file.num_channels()); | 50 ChannelBuffer<float> in_buf(in_samples, in_file.num_channels()); |
51 ChannelBuffer<float> noise_buf(noise_samples, noise_file.num_channels()); | 51 ChannelBuffer<float> noise_buf(noise_samples, noise_file.num_channels()); |
52 AudioBuffer capture_audio(noise_samples, noise_file.num_channels(), | 52 AudioBuffer capture_audio(noise_samples, noise_file.num_channels(), |
53 noise_samples, noise_file.num_channels(), | 53 noise_samples, noise_file.num_channels(), |
54 noise_samples); | 54 noise_samples); |
55 StreamConfig stream_config(noise_file.sample_rate(), | 55 StreamConfig stream_config(noise_file.sample_rate(), |
56 noise_file.num_channels()); | 56 noise_file.num_channels()); |
57 while (in_file.ReadSamples(in.size(), in.data()) == in.size() && | 57 while (in_file.ReadSamples(in.size(), in.data()) == in.size() && |
58 noise_file.ReadSamples(noise.size(), noise.data()) == noise.size()) { | 58 noise_file.ReadSamples(noise.size(), noise.data()) == noise.size()) { |
59 FloatS16ToFloat(in.data(), in.size(), in.data()); | |
peah-webrtc
2016/03/21 12:25:48
Is this change due to that the conversion was redu
aluebs-webrtc
2016/03/29 23:15:15
This conversion is not present in the APM, so that
| |
60 FloatS16ToFloat(noise.data(), noise.size(), noise.data()); | 59 FloatS16ToFloat(noise.data(), noise.size(), noise.data()); |
61 Deinterleave(in.data(), in_buf.num_frames(), in_buf.num_channels(), | 60 Deinterleave(in.data(), in_buf.num_frames(), in_buf.num_channels(), |
62 in_buf.channels()); | 61 in_buf.channels()); |
63 Deinterleave(noise.data(), noise_buf.num_frames(), noise_buf.num_channels(), | 62 Deinterleave(noise.data(), noise_buf.num_frames(), noise_buf.num_channels(), |
64 noise_buf.channels()); | 63 noise_buf.channels()); |
65 capture_audio.CopyFrom(noise_buf.channels(), stream_config); | 64 capture_audio.CopyFrom(noise_buf.channels(), stream_config); |
66 ns.AnalyzeCaptureAudio(&capture_audio); | 65 ns.AnalyzeCaptureAudio(&capture_audio); |
67 ns.ProcessCaptureAudio(&capture_audio); | 66 ns.ProcessCaptureAudio(&capture_audio); |
68 enh.SetCaptureNoiseEstimate(ns.NoiseEstimate()); | 67 enh.SetCaptureNoiseEstimate(ns.NoiseEstimate()); |
69 enh.ProcessRenderAudio(in_buf.channels(), in_file.sample_rate(), | 68 enh.ProcessRenderAudio(in_buf.channels(), in_file.sample_rate(), |
70 in_file.num_channels()); | 69 in_file.num_channels()); |
71 Interleave(in_buf.channels(), in_buf.num_frames(), in_buf.num_channels(), | 70 Interleave(in_buf.channels(), in_buf.num_frames(), in_buf.num_channels(), |
72 in.data()); | 71 in.data()); |
73 FloatToFloatS16(in.data(), in.size(), in.data()); | |
74 out_file.WriteSamples(in.data(), in.size()); | 72 out_file.WriteSamples(in.data(), in.size()); |
75 } | 73 } |
76 } | 74 } |
77 | 75 |
78 } // namespace | 76 } // namespace |
79 } // namespace webrtc | 77 } // namespace webrtc |
80 | 78 |
81 int main(int argc, char* argv[]) { | 79 int main(int argc, char* argv[]) { |
82 webrtc::void_main(argc, argv); | 80 webrtc::void_main(argc, argv); |
83 return 0; | 81 return 0; |
84 } | 82 } |
OLD | NEW |