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

Side by Side Diff: voice_engine/utility.cc

Issue 3013033002: Remove VoEFile (Closed)
Patch Set: rebase Created 3 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 | « voice_engine/utility.h ('k') | voice_engine/voe_base_impl.cc » ('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) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 81
82 // Upmix after resampling. 82 // Upmix after resampling.
83 if (num_channels == 1 && dst_frame->num_channels_ == 2) { 83 if (num_channels == 1 && dst_frame->num_channels_ == 2) {
84 // The audio in dst_frame really is mono at this point; MonoToStereo will 84 // The audio in dst_frame really is mono at this point; MonoToStereo will
85 // set this back to stereo. 85 // set this back to stereo.
86 dst_frame->num_channels_ = 1; 86 dst_frame->num_channels_ = 1;
87 AudioFrameOperations::MonoToStereo(dst_frame); 87 AudioFrameOperations::MonoToStereo(dst_frame);
88 } 88 }
89 } 89 }
90 90
91 void MixWithSat(int16_t target[],
92 size_t target_channel,
93 const int16_t source[],
94 size_t source_channel,
95 size_t source_len) {
96 RTC_DCHECK_GE(target_channel, 1);
97 RTC_DCHECK_LE(target_channel, 2);
98 RTC_DCHECK_GE(source_channel, 1);
99 RTC_DCHECK_LE(source_channel, 2);
100
101 if (target_channel == 2 && source_channel == 1) {
102 // Convert source from mono to stereo.
103 int32_t left = 0;
104 int32_t right = 0;
105 for (size_t i = 0; i < source_len; ++i) {
106 left = source[i] + target[i * 2];
107 right = source[i] + target[i * 2 + 1];
108 target[i * 2] = WebRtcSpl_SatW32ToW16(left);
109 target[i * 2 + 1] = WebRtcSpl_SatW32ToW16(right);
110 }
111 } else if (target_channel == 1 && source_channel == 2) {
112 // Convert source from stereo to mono.
113 int32_t temp = 0;
114 for (size_t i = 0; i < source_len / 2; ++i) {
115 temp = ((source[i * 2] + source[i * 2 + 1]) >> 1) + target[i];
116 target[i] = WebRtcSpl_SatW32ToW16(temp);
117 }
118 } else {
119 int32_t temp = 0;
120 for (size_t i = 0; i < source_len; ++i) {
121 temp = source[i] + target[i];
122 target[i] = WebRtcSpl_SatW32ToW16(temp);
123 }
124 }
125 }
126
127 } // namespace voe 91 } // namespace voe
128 } // namespace webrtc 92 } // namespace webrtc
OLDNEW
« no previous file with comments | « voice_engine/utility.h ('k') | voice_engine/voe_base_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698