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

Side by Side Diff: webrtc/modules/audio_processing/test/vector_based_audio_frame.h

Issue 1510493004: Bitexactness test for the highpass filter (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Refactored the test not to use fixtures in response to reviewer comments Created 5 years 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) 2014 The WebRTC project authors. All Rights Reserved.
hlundin-webrtc 2015/12/10 12:12:17 2015
peah-webrtc 2015/12/22 06:28:11 Done.
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 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_TEST_VECTOR_BASED_AUDIO_FRAME_H_
12 #define WEBRTC_MODULES_AUDIO_PROCESSING_TEST_VECTOR_BASED_AUDIO_FRAME_H_
13
14 #include <math.h>
15 #include <iterator>
16 #include <limits>
17 #include <string>
18 #include <vector>
19
20 #include "webrtc/base/constructormagic.h"
21 #include "webrtc/modules/audio_processing/audio_processing_impl.h"
22 #include "webrtc/test/random.h"
23
24 namespace webrtc {
25
26 // Handles an audio frame represented by a two-dimensional float* array type
27 // using vectors and adds support for common tasks.
28 class VectorBasedAudioFrame {
the sun 2015/12/10 12:03:54 AudioBuffer already maintains buffers for the audi
peah-webrtc 2015/12/22 06:28:10 Of course, you are right. Have now done that, whic
29 public:
30 VectorBasedAudioFrame(size_t frame_length,
hlundin-webrtc 2015/12/10 12:12:17 Comment that the size of initial_values must be (a
peah-webrtc 2015/12/22 06:28:11 This is no longer applicable in the new code. Ack
31 size_t num_channels,
32 const float* initial_values);
33
34 VectorBasedAudioFrame(size_t frame_length, size_t num_channels);
hlundin-webrtc 2015/12/10 12:12:17 What is the initial value in this case?
peah-webrtc 2015/12/22 06:28:11 They are not initialized at all, only allocated. T
35
36 std::vector<float*>* get_frame() { return &frame_; }
37 size_t frame_length() const { return frame_length_; }
38 size_t num_channels() const { return num_channels_; }
39
40 // Fills the frame with random values quantized to 16 bits.
41 void Randomize(test::Random* rand_gen_) const;
42
43 // Copies the frame to an audiobuffer.
44 void CopyToAudioBuffer(StreamConfig stream_config, AudioBuffer* buffer);
45
46 // Fill the frame with the content of an audiobuffer.
47 void CopyFromAudioBuffer(StreamConfig stream_config, AudioBuffer* buffer);
48
49 // Compare the the frame content to the content of another frame using a
hlundin-webrtc 2015/12/10 12:12:17 Compares
peah-webrtc 2015/12/22 06:28:10 Good catch. Fully changed in the new code though.
50 // specified tolerance.
51 bool CompareTo(VectorBasedAudioFrame* other_frame, float tolerance) const;
hlundin-webrtc 2015/12/10 12:12:17 Drop To, simply call it Compare (it's shorter, and
hlundin-webrtc 2015/12/10 12:12:17 other_frame should be const, right?
peah-webrtc 2015/12/22 06:28:10 Great point! This method has been removed in the
peah-webrtc 2015/12/22 06:28:10 True. Acknowledged.
52
53 // Prints all the values of the frame.
hlundin-webrtc 2015/12/10 12:12:17 ... to stdout?
peah-webrtc 2015/12/22 06:28:10 Yes, that was how it was. Good point that that sho
54 void PrintValues();
55
56 // Prints a specified number of values from the frame.
hlundin-webrtc 2015/12/10 12:12:17 ... to stdout?
peah-webrtc 2015/12/22 06:28:10 The function is now removed. Acknowledged.
57 void PrintValues(size_t num_samples_per_channel);
58
59 private:
60 const size_t frame_length_;
hlundin-webrtc 2015/12/10 12:12:17 Do you need frame_length_ and num_channels_ as exp
peah-webrtc 2015/12/22 06:28:10 Fully true! That would be better. The new impleme
61 const size_t num_channels_;
62 std::vector<float*> frame_;
63 std::vector<float> channels_;
64 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(VectorBasedAudioFrame);
65 };
66
67 } // namespace webrtc
68
69 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_TEST_VECTOR_BASED_AUDIO_FRAME_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698