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

Unified Diff: webrtc/common_audio/include/audio_util.h

Issue 1227203003: Update audio code to use size_t more correctly, webrtc/common_audio/ portion. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Resync Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/common_audio/fft4g.c ('k') | webrtc/common_audio/lapped_transform.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/common_audio/include/audio_util.h
diff --git a/webrtc/common_audio/include/audio_util.h b/webrtc/common_audio/include/audio_util.h
index b217c683fd05815a7f10f95b000371f03e2db393..64789f257f10cc288431a438584a98342c863fff 100644
--- a/webrtc/common_audio/include/audio_util.h
+++ b/webrtc/common_audio/include/audio_util.h
@@ -71,13 +71,13 @@ void FloatS16ToFloat(const float* src, size_t size, float* dest);
// per buffer).
template <typename T>
void Deinterleave(const T* interleaved,
- int samples_per_channel,
+ size_t samples_per_channel,
int num_channels,
T* const* deinterleaved) {
for (int i = 0; i < num_channels; ++i) {
T* channel = deinterleaved[i];
int interleaved_idx = i;
- for (int j = 0; j < samples_per_channel; ++j) {
+ for (size_t j = 0; j < samples_per_channel; ++j) {
channel[j] = interleaved[interleaved_idx];
interleaved_idx += num_channels;
}
@@ -89,13 +89,13 @@ void Deinterleave(const T* interleaved,
// (|samples_per_channel| * |num_channels|).
template <typename T>
void Interleave(const T* const* deinterleaved,
- int samples_per_channel,
+ size_t samples_per_channel,
int num_channels,
T* interleaved) {
for (int i = 0; i < num_channels; ++i) {
const T* channel = deinterleaved[i];
int interleaved_idx = i;
- for (int j = 0; j < samples_per_channel; ++j) {
+ for (size_t j = 0; j < samples_per_channel; ++j) {
interleaved[interleaved_idx] = channel[j];
interleaved_idx += num_channels;
}
@@ -104,10 +104,10 @@ void Interleave(const T* const* deinterleaved,
template <typename T, typename Intermediate>
void DownmixToMono(const T* const* input_channels,
- int num_frames,
+ size_t num_frames,
int num_channels,
T* out) {
- for (int i = 0; i < num_frames; ++i) {
+ for (size_t i = 0; i < num_frames; ++i) {
Intermediate value = input_channels[0][i];
for (int j = 1; j < num_channels; ++j) {
value += input_channels[j][i];
@@ -120,11 +120,11 @@ void DownmixToMono(const T* const* input_channels,
// all channels.
template <typename T, typename Intermediate>
void DownmixInterleavedToMonoImpl(const T* interleaved,
- int num_frames,
+ size_t num_frames,
int num_channels,
T* deinterleaved) {
DCHECK_GT(num_channels, 0);
- DCHECK_GT(num_frames, 0);
+ DCHECK_GT(num_frames, 0u);
const T* const end = interleaved + num_frames * num_channels;
@@ -142,13 +142,13 @@ void DownmixInterleavedToMonoImpl(const T* interleaved,
template <typename T>
void DownmixInterleavedToMono(const T* interleaved,
- int num_frames,
+ size_t num_frames,
int num_channels,
T* deinterleaved);
template <>
void DownmixInterleavedToMono<int16_t>(const int16_t* interleaved,
- int num_frames,
+ size_t num_frames,
int num_channels,
int16_t* deinterleaved);
« no previous file with comments | « webrtc/common_audio/fft4g.c ('k') | webrtc/common_audio/lapped_transform.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698