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

Side by Side Diff: webrtc/common_audio/resampler/push_sinc_resampler.cc

Issue 1362503003: Use suffixed {uint,int}{8,16,32,64}_t types. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: google::int32 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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 21 matching lines...) Expand all
32 } 32 }
33 33
34 size_t PushSincResampler::Resample(const int16_t* source, 34 size_t PushSincResampler::Resample(const int16_t* source,
35 size_t source_length, 35 size_t source_length,
36 int16_t* destination, 36 int16_t* destination,
37 size_t destination_capacity) { 37 size_t destination_capacity) {
38 if (!float_buffer_.get()) 38 if (!float_buffer_.get())
39 float_buffer_.reset(new float[destination_frames_]); 39 float_buffer_.reset(new float[destination_frames_]);
40 40
41 source_ptr_int_ = source; 41 source_ptr_int_ = source;
42 // Pass nullptr as the float source to have Run() read from the int16 source. 42 // Pass nullptr as the float source to have Run() read from the int16_t
43 // source.
43 Resample(nullptr, source_length, float_buffer_.get(), destination_frames_); 44 Resample(nullptr, source_length, float_buffer_.get(), destination_frames_);
44 FloatS16ToS16(float_buffer_.get(), destination_frames_, destination); 45 FloatS16ToS16(float_buffer_.get(), destination_frames_, destination);
45 source_ptr_int_ = nullptr; 46 source_ptr_int_ = nullptr;
46 return destination_frames_; 47 return destination_frames_;
47 } 48 }
48 49
49 size_t PushSincResampler::Resample(const float* source, 50 size_t PushSincResampler::Resample(const float* source,
50 size_t source_length, 51 size_t source_length,
51 float* destination, 52 float* destination,
52 size_t destination_capacity) { 53 size_t destination_capacity) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 if (source_ptr_) { 95 if (source_ptr_) {
95 std::memcpy(destination, source_ptr_, frames * sizeof(*destination)); 96 std::memcpy(destination, source_ptr_, frames * sizeof(*destination));
96 } else { 97 } else {
97 for (size_t i = 0; i < frames; ++i) 98 for (size_t i = 0; i < frames; ++i)
98 destination[i] = static_cast<float>(source_ptr_int_[i]); 99 destination[i] = static_cast<float>(source_ptr_int_[i]);
99 } 100 }
100 source_available_ -= frames; 101 source_available_ -= frames;
101 } 102 }
102 103
103 } // namespace webrtc 104 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698