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

Side by Side Diff: webrtc/common_audio/channel_buffer.h

Issue 1335923002: Add RTC_ prefix to (D)CHECKs and related macros. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase. Created 5 years, 3 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
« no previous file with comments | « webrtc/common_audio/blocker.cc ('k') | webrtc/common_audio/include/audio_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 const T* const* channels() const { return channels(0); } 68 const T* const* channels() const { return channels(0); }
69 69
70 // Returns a pointer array to the channels for a specific band. 70 // Returns a pointer array to the channels for a specific band.
71 // Usage: 71 // Usage:
72 // channels(band)[channel][sample]. 72 // channels(band)[channel][sample].
73 // Where: 73 // Where:
74 // 0 <= band < |num_bands_| 74 // 0 <= band < |num_bands_|
75 // 0 <= channel < |num_channels_| 75 // 0 <= channel < |num_channels_|
76 // 0 <= sample < |num_frames_per_band_| 76 // 0 <= sample < |num_frames_per_band_|
77 const T* const* channels(size_t band) const { 77 const T* const* channels(size_t band) const {
78 DCHECK_LT(band, num_bands_); 78 RTC_DCHECK_LT(band, num_bands_);
79 return &channels_[band * num_channels_]; 79 return &channels_[band * num_channels_];
80 } 80 }
81 T* const* channels(size_t band) { 81 T* const* channels(size_t band) {
82 const ChannelBuffer<T>* t = this; 82 const ChannelBuffer<T>* t = this;
83 return const_cast<T* const*>(t->channels(band)); 83 return const_cast<T* const*>(t->channels(band));
84 } 84 }
85 85
86 // Returns a pointer array to the bands for a specific channel. 86 // Returns a pointer array to the bands for a specific channel.
87 // Usage: 87 // Usage:
88 // bands(channel)[band][sample]. 88 // bands(channel)[band][sample].
89 // Where: 89 // Where:
90 // 0 <= channel < |num_channels_| 90 // 0 <= channel < |num_channels_|
91 // 0 <= band < |num_bands_| 91 // 0 <= band < |num_bands_|
92 // 0 <= sample < |num_frames_per_band_| 92 // 0 <= sample < |num_frames_per_band_|
93 const T* const* bands(int channel) const { 93 const T* const* bands(int channel) const {
94 DCHECK_LT(channel, num_channels_); 94 RTC_DCHECK_LT(channel, num_channels_);
95 DCHECK_GE(channel, 0); 95 RTC_DCHECK_GE(channel, 0);
96 return &bands_[channel * num_bands_]; 96 return &bands_[channel * num_bands_];
97 } 97 }
98 T* const* bands(int channel) { 98 T* const* bands(int channel) {
99 const ChannelBuffer<T>* t = this; 99 const ChannelBuffer<T>* t = this;
100 return const_cast<T* const*>(t->bands(channel)); 100 return const_cast<T* const*>(t->bands(channel));
101 } 101 }
102 102
103 // Sets the |slice| pointers to the |start_frame| position for each channel. 103 // Sets the |slice| pointers to the |start_frame| position for each channel.
104 // Returns |slice| for convenience. 104 // Returns |slice| for convenience.
105 const T* const* Slice(T** slice, size_t start_frame) const { 105 const T* const* Slice(T** slice, size_t start_frame) const {
106 DCHECK_LT(start_frame, num_frames_); 106 RTC_DCHECK_LT(start_frame, num_frames_);
107 for (int i = 0; i < num_channels_; ++i) 107 for (int i = 0; i < num_channels_; ++i)
108 slice[i] = &channels_[i][start_frame]; 108 slice[i] = &channels_[i][start_frame];
109 return slice; 109 return slice;
110 } 110 }
111 T** Slice(T** slice, size_t start_frame) { 111 T** Slice(T** slice, size_t start_frame) {
112 const ChannelBuffer<T>* t = this; 112 const ChannelBuffer<T>* t = this;
113 return const_cast<T**>(t->Slice(slice, start_frame)); 113 return const_cast<T**>(t->Slice(slice, start_frame));
114 } 114 }
115 115
116 size_t num_frames() const { return num_frames_; } 116 size_t num_frames() const { return num_frames_; }
117 size_t num_frames_per_band() const { return num_frames_per_band_; } 117 size_t num_frames_per_band() const { return num_frames_per_band_; }
118 int num_channels() const { return num_channels_; } 118 int num_channels() const { return num_channels_; }
119 size_t num_bands() const { return num_bands_; } 119 size_t num_bands() const { return num_bands_; }
120 size_t size() const {return num_frames_ * num_channels_; } 120 size_t size() const {return num_frames_ * num_channels_; }
121 121
122 void SetDataForTesting(const T* data, size_t size) { 122 void SetDataForTesting(const T* data, size_t size) {
123 CHECK_EQ(size, this->size()); 123 RTC_CHECK_EQ(size, this->size());
124 memcpy(data_.get(), data, size * sizeof(*data)); 124 memcpy(data_.get(), data, size * sizeof(*data));
125 } 125 }
126 126
127 private: 127 private:
128 rtc::scoped_ptr<T[]> data_; 128 rtc::scoped_ptr<T[]> data_;
129 rtc::scoped_ptr<T* []> channels_; 129 rtc::scoped_ptr<T* []> channels_;
130 rtc::scoped_ptr<T* []> bands_; 130 rtc::scoped_ptr<T* []> bands_;
131 const size_t num_frames_; 131 const size_t num_frames_;
132 const size_t num_frames_per_band_; 132 const size_t num_frames_per_band_;
133 const int num_channels_; 133 const int num_channels_;
(...skipping 26 matching lines...) Expand all
160 160
161 mutable bool ivalid_; 161 mutable bool ivalid_;
162 mutable ChannelBuffer<int16_t> ibuf_; 162 mutable ChannelBuffer<int16_t> ibuf_;
163 mutable bool fvalid_; 163 mutable bool fvalid_;
164 mutable ChannelBuffer<float> fbuf_; 164 mutable ChannelBuffer<float> fbuf_;
165 }; 165 };
166 166
167 } // namespace webrtc 167 } // namespace webrtc
168 168
169 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_CHANNEL_BUFFER_H_ 169 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_CHANNEL_BUFFER_H_
OLDNEW
« no previous file with comments | « webrtc/common_audio/blocker.cc ('k') | webrtc/common_audio/include/audio_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698