OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // MSVC++ requires this to be set before any other includes to get M_SQRT1_2. | 5 // MSVC++ requires this to be set before any other includes to get M_SQRT1_2. |
6 #define _USE_MATH_DEFINES | 6 #define _USE_MATH_DEFINES |
7 | 7 |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 // output channels have the same value. | 100 // output channels have the same value. |
101 TEST_P(ChannelMixerTest, Mixing) { | 101 TEST_P(ChannelMixerTest, Mixing) { |
102 ChannelLayout input_layout = GetParam().input_layout; | 102 ChannelLayout input_layout = GetParam().input_layout; |
103 int input_channels = GetParam().input_channels; | 103 int input_channels = GetParam().input_channels; |
104 scoped_ptr<AudioBus> input_bus = AudioBus::Create(input_channels, kFrames); | 104 scoped_ptr<AudioBus> input_bus = AudioBus::Create(input_channels, kFrames); |
105 AudioParameters input_audio(AudioParameters::AUDIO_PCM_LINEAR, | 105 AudioParameters input_audio(AudioParameters::AUDIO_PCM_LINEAR, |
106 input_layout, | 106 input_layout, |
107 input_layout == CHANNEL_LAYOUT_DISCRETE ? | 107 input_layout == CHANNEL_LAYOUT_DISCRETE ? |
108 input_channels : | 108 input_channels : |
109 ChannelLayoutToChannelCount(input_layout), | 109 ChannelLayoutToChannelCount(input_layout), |
110 0, | |
111 AudioParameters::kAudioCDSampleRate, 16, | 110 AudioParameters::kAudioCDSampleRate, 16, |
112 kFrames, | 111 kFrames, |
113 AudioParameters::NO_EFFECTS); | 112 AudioParameters::NO_EFFECTS); |
114 | 113 |
115 ChannelLayout output_layout = GetParam().output_layout; | 114 ChannelLayout output_layout = GetParam().output_layout; |
116 int output_channels = GetParam().output_channels; | 115 int output_channels = GetParam().output_channels; |
117 scoped_ptr<AudioBus> output_bus = AudioBus::Create(output_channels, kFrames); | 116 scoped_ptr<AudioBus> output_bus = AudioBus::Create(output_channels, kFrames); |
118 AudioParameters output_audio(AudioParameters::AUDIO_PCM_LINEAR, | 117 AudioParameters output_audio(AudioParameters::AUDIO_PCM_LINEAR, |
119 output_layout, | 118 output_layout, |
120 output_layout == CHANNEL_LAYOUT_DISCRETE ? | 119 output_layout == CHANNEL_LAYOUT_DISCRETE ? |
121 output_channels : | 120 output_channels : |
122 ChannelLayoutToChannelCount(output_layout), | 121 ChannelLayoutToChannelCount(output_layout), |
123 0, | |
124 AudioParameters::kAudioCDSampleRate, 16, | 122 AudioParameters::kAudioCDSampleRate, 16, |
125 kFrames, | 123 kFrames, |
126 AudioParameters::NO_EFFECTS); | 124 AudioParameters::NO_EFFECTS); |
127 | 125 |
128 const float* channel_values = GetParam().channel_values; | 126 const float* channel_values = GetParam().channel_values; |
129 ASSERT_EQ(input_bus->channels(), GetParam().num_channel_values); | 127 ASSERT_EQ(input_bus->channels(), GetParam().num_channel_values); |
130 | 128 |
131 float expected_value = 0; | 129 float expected_value = 0; |
132 float scale = GetParam().scale; | 130 float scale = GetParam().scale; |
133 for (int ch = 0; ch < input_bus->channels(); ++ch) { | 131 for (int ch = 0; ch < input_bus->channels(); ++ch) { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 kStereoToMonoValues, arraysize(kStereoToMonoValues)), | 179 kStereoToMonoValues, arraysize(kStereoToMonoValues)), |
182 ChannelMixerTestData(CHANNEL_LAYOUT_DISCRETE, 2, | 180 ChannelMixerTestData(CHANNEL_LAYOUT_DISCRETE, 2, |
183 CHANNEL_LAYOUT_DISCRETE, 5, | 181 CHANNEL_LAYOUT_DISCRETE, 5, |
184 kStereoToMonoValues, arraysize(kStereoToMonoValues)), | 182 kStereoToMonoValues, arraysize(kStereoToMonoValues)), |
185 ChannelMixerTestData(CHANNEL_LAYOUT_DISCRETE, 5, | 183 ChannelMixerTestData(CHANNEL_LAYOUT_DISCRETE, 5, |
186 CHANNEL_LAYOUT_DISCRETE, 2, | 184 CHANNEL_LAYOUT_DISCRETE, 2, |
187 kFiveDiscreteValues, arraysize(kFiveDiscreteValues)) | 185 kFiveDiscreteValues, arraysize(kFiveDiscreteValues)) |
188 )); | 186 )); |
189 | 187 |
190 } // namespace media | 188 } // namespace media |
OLD | NEW |