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

Side by Side Diff: webrtc/modules/audio_processing/audio_buffer.h

Issue 1316523002: Convert channel counts to size_t. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Fix compile Created 4 years, 11 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
1 /* 1 /*
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2011 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 16 matching lines...) Expand all
27 enum Band { 27 enum Band {
28 kBand0To8kHz = 0, 28 kBand0To8kHz = 0,
29 kBand8To16kHz = 1, 29 kBand8To16kHz = 1,
30 kBand16To24kHz = 2 30 kBand16To24kHz = 2
31 }; 31 };
32 32
33 class AudioBuffer { 33 class AudioBuffer {
34 public: 34 public:
35 // TODO(ajm): Switch to take ChannelLayouts. 35 // TODO(ajm): Switch to take ChannelLayouts.
36 AudioBuffer(size_t input_num_frames, 36 AudioBuffer(size_t input_num_frames,
37 int num_input_channels, 37 size_t num_input_channels,
38 size_t process_num_frames, 38 size_t process_num_frames,
39 int num_process_channels, 39 size_t num_process_channels,
40 size_t output_num_frames); 40 size_t output_num_frames);
41 virtual ~AudioBuffer(); 41 virtual ~AudioBuffer();
42 42
43 int num_channels() const; 43 size_t num_channels() const;
44 void set_num_channels(int num_channels); 44 void set_num_channels(size_t num_channels);
45 size_t num_frames() const; 45 size_t num_frames() const;
46 size_t num_frames_per_band() const; 46 size_t num_frames_per_band() const;
47 size_t num_keyboard_frames() const; 47 size_t num_keyboard_frames() const;
48 size_t num_bands() const; 48 size_t num_bands() const;
49 49
50 // Returns a pointer array to the full-band channels. 50 // Returns a pointer array to the full-band channels.
51 // Usage: 51 // Usage:
52 // channels()[channel][sample]. 52 // channels()[channel][sample].
53 // Where: 53 // Where:
54 // 0 <= channel < |num_proc_channels_| 54 // 0 <= channel < |num_proc_channels_|
55 // 0 <= sample < |proc_num_frames_| 55 // 0 <= sample < |proc_num_frames_|
56 int16_t* const* channels(); 56 int16_t* const* channels();
57 const int16_t* const* channels_const() const; 57 const int16_t* const* channels_const() const;
58 float* const* channels_f(); 58 float* const* channels_f();
59 const float* const* channels_const_f() const; 59 const float* const* channels_const_f() const;
60 60
61 // Returns a pointer array to the bands for a specific channel. 61 // Returns a pointer array to the bands for a specific channel.
62 // Usage: 62 // Usage:
63 // split_bands(channel)[band][sample]. 63 // split_bands(channel)[band][sample].
64 // Where: 64 // Where:
65 // 0 <= channel < |num_proc_channels_| 65 // 0 <= channel < |num_proc_channels_|
66 // 0 <= band < |num_bands_| 66 // 0 <= band < |num_bands_|
67 // 0 <= sample < |num_split_frames_| 67 // 0 <= sample < |num_split_frames_|
68 int16_t* const* split_bands(int channel); 68 int16_t* const* split_bands(size_t channel);
69 const int16_t* const* split_bands_const(int channel) const; 69 const int16_t* const* split_bands_const(size_t channel) const;
70 float* const* split_bands_f(int channel); 70 float* const* split_bands_f(size_t channel);
71 const float* const* split_bands_const_f(int channel) const; 71 const float* const* split_bands_const_f(size_t channel) const;
72 72
73 // Returns a pointer array to the channels for a specific band. 73 // Returns a pointer array to the channels for a specific band.
74 // Usage: 74 // Usage:
75 // split_channels(band)[channel][sample]. 75 // split_channels(band)[channel][sample].
76 // Where: 76 // Where:
77 // 0 <= band < |num_bands_| 77 // 0 <= band < |num_bands_|
78 // 0 <= channel < |num_proc_channels_| 78 // 0 <= channel < |num_proc_channels_|
79 // 0 <= sample < |num_split_frames_| 79 // 0 <= sample < |num_split_frames_|
80 int16_t* const* split_channels(Band band); 80 int16_t* const* split_channels(Band band);
81 const int16_t* const* split_channels_const(Band band) const; 81 const int16_t* const* split_channels_const(Band band) const;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 // Recombine the different bands into one signal. 121 // Recombine the different bands into one signal.
122 void MergeFrequencyBands(); 122 void MergeFrequencyBands();
123 123
124 private: 124 private:
125 // Called from DeinterleaveFrom() and CopyFrom(). 125 // Called from DeinterleaveFrom() and CopyFrom().
126 void InitForNewData(); 126 void InitForNewData();
127 127
128 // The audio is passed into DeinterleaveFrom() or CopyFrom() with input 128 // The audio is passed into DeinterleaveFrom() or CopyFrom() with input
129 // format (samples per channel and number of channels). 129 // format (samples per channel and number of channels).
130 const size_t input_num_frames_; 130 const size_t input_num_frames_;
131 const int num_input_channels_; 131 const size_t num_input_channels_;
132 // The audio is stored by DeinterleaveFrom() or CopyFrom() with processing 132 // The audio is stored by DeinterleaveFrom() or CopyFrom() with processing
133 // format. 133 // format.
134 const size_t proc_num_frames_; 134 const size_t proc_num_frames_;
135 const int num_proc_channels_; 135 const size_t num_proc_channels_;
136 // The audio is returned by InterleaveTo() and CopyTo() with output samples 136 // The audio is returned by InterleaveTo() and CopyTo() with output samples
137 // per channels and the current number of channels. This last one can be 137 // per channels and the current number of channels. This last one can be
138 // changed at any time using set_num_channels(). 138 // changed at any time using set_num_channels().
139 const size_t output_num_frames_; 139 const size_t output_num_frames_;
140 int num_channels_; 140 size_t num_channels_;
141 141
142 size_t num_bands_; 142 size_t num_bands_;
143 size_t num_split_frames_; 143 size_t num_split_frames_;
144 bool mixed_low_pass_valid_; 144 bool mixed_low_pass_valid_;
145 bool reference_copied_; 145 bool reference_copied_;
146 AudioFrame::VADActivity activity_; 146 AudioFrame::VADActivity activity_;
147 147
148 const float* keyboard_data_; 148 const float* keyboard_data_;
149 rtc::scoped_ptr<IFChannelBuffer> data_; 149 rtc::scoped_ptr<IFChannelBuffer> data_;
150 rtc::scoped_ptr<IFChannelBuffer> split_data_; 150 rtc::scoped_ptr<IFChannelBuffer> split_data_;
151 rtc::scoped_ptr<SplittingFilter> splitting_filter_; 151 rtc::scoped_ptr<SplittingFilter> splitting_filter_;
152 rtc::scoped_ptr<ChannelBuffer<int16_t> > mixed_low_pass_channels_; 152 rtc::scoped_ptr<ChannelBuffer<int16_t> > mixed_low_pass_channels_;
153 rtc::scoped_ptr<ChannelBuffer<int16_t> > low_pass_reference_channels_; 153 rtc::scoped_ptr<ChannelBuffer<int16_t> > low_pass_reference_channels_;
154 rtc::scoped_ptr<IFChannelBuffer> input_buffer_; 154 rtc::scoped_ptr<IFChannelBuffer> input_buffer_;
155 rtc::scoped_ptr<IFChannelBuffer> output_buffer_; 155 rtc::scoped_ptr<IFChannelBuffer> output_buffer_;
156 rtc::scoped_ptr<ChannelBuffer<float> > process_buffer_; 156 rtc::scoped_ptr<ChannelBuffer<float> > process_buffer_;
157 ScopedVector<PushSincResampler> input_resamplers_; 157 ScopedVector<PushSincResampler> input_resamplers_;
158 ScopedVector<PushSincResampler> output_resamplers_; 158 ScopedVector<PushSincResampler> output_resamplers_;
159 }; 159 };
160 160
161 } // namespace webrtc 161 } // namespace webrtc
162 162
163 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AUDIO_BUFFER_H_ 163 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AUDIO_BUFFER_H_
OLDNEW
« no previous file with comments | « webrtc/modules/audio_device/test/func_test_manager.cc ('k') | webrtc/modules/audio_processing/audio_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698