Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Side by Side Diff: webrtc/modules/audio_processing/test/audio_buffer_tools.cc

Issue 1510493004: Bitexactness test for the highpass filter (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Changes in response to reviewer comments Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #include "webrtc/modules/audio_processing/test/audio_buffer_tools.h"
12
13 namespace webrtc {
14
15 void SetupFrame(StreamConfig stream_config,
16 std::vector<float*>* frame,
17 std::vector<float>* frame_samples) {
18 frame_samples->resize(stream_config.num_channels() *
19 stream_config.num_frames());
20 frame->resize(stream_config.num_frames());
the sun 2016/02/22 19:50:58 should be sized to stream_config.num_channels()
peah-webrtc 2016/02/22 23:11:36 Great find! Done.
21 for (int ch = 0; ch < stream_config.num_channels(); ++ch) {
22 (*frame)[ch] = &(*frame_samples)[ch * stream_config.num_frames()];
23 }
24 }
25
26 void CopyVectorToAudioBuffer(StreamConfig stream_config,
27 const std::vector<float>& source,
28 AudioBuffer* destination) {
29 std::vector<float*> input;
30 std::vector<float> input_samples;
31
32 SetupFrame(stream_config, &input, &input_samples);
33
34 RTC_DCHECK_EQ(input_samples.size(), source.size());
35 input_samples = source;
36
37 destination->CopyFrom(&input[0], stream_config);
38 }
39
40 std::vector<float> ExtractVectorFromAudioBuffer(StreamConfig stream_config,
41 AudioBuffer* source) {
42 std::vector<float*> output;
43 std::vector<float> output_samples;
44
45 SetupFrame(stream_config, &output, &output_samples);
46
47 source->CopyTo(stream_config, &output[0]);
48
49 return output_samples;
50 }
51
52 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698