| 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, |
| 110 AudioParameters::kAudioCDSampleRate, 16, | 111 AudioParameters::kAudioCDSampleRate, 16, |
| 111 kFrames, | 112 kFrames, |
| 112 AudioParameters::NO_EFFECTS); | 113 AudioParameters::NO_EFFECTS); |
| 113 | 114 |
| 114 ChannelLayout output_layout = GetParam().output_layout; | 115 ChannelLayout output_layout = GetParam().output_layout; |
| 115 int output_channels = GetParam().output_channels; | 116 int output_channels = GetParam().output_channels; |
| 116 scoped_ptr<AudioBus> output_bus = AudioBus::Create(output_channels, kFrames); | 117 scoped_ptr<AudioBus> output_bus = AudioBus::Create(output_channels, kFrames); |
| 117 AudioParameters output_audio(AudioParameters::AUDIO_PCM_LINEAR, | 118 AudioParameters output_audio(AudioParameters::AUDIO_PCM_LINEAR, |
| 118 output_layout, | 119 output_layout, |
| 119 output_layout == CHANNEL_LAYOUT_DISCRETE ? | 120 output_layout == CHANNEL_LAYOUT_DISCRETE ? |
| 120 output_channels : | 121 output_channels : |
| 121 ChannelLayoutToChannelCount(output_layout), | 122 ChannelLayoutToChannelCount(output_layout), |
| 123 0, |
| 122 AudioParameters::kAudioCDSampleRate, 16, | 124 AudioParameters::kAudioCDSampleRate, 16, |
| 123 kFrames, | 125 kFrames, |
| 124 AudioParameters::NO_EFFECTS); | 126 AudioParameters::NO_EFFECTS); |
| 125 | 127 |
| 126 const float* channel_values = GetParam().channel_values; | 128 const float* channel_values = GetParam().channel_values; |
| 127 ASSERT_EQ(input_bus->channels(), GetParam().num_channel_values); | 129 ASSERT_EQ(input_bus->channels(), GetParam().num_channel_values); |
| 128 | 130 |
| 129 float expected_value = 0; | 131 float expected_value = 0; |
| 130 float scale = GetParam().scale; | 132 float scale = GetParam().scale; |
| 131 for (int ch = 0; ch < input_bus->channels(); ++ch) { | 133 for (int ch = 0; ch < input_bus->channels(); ++ch) { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 kStereoToMonoValues, arraysize(kStereoToMonoValues)), | 181 kStereoToMonoValues, arraysize(kStereoToMonoValues)), |
| 180 ChannelMixerTestData(CHANNEL_LAYOUT_DISCRETE, 2, | 182 ChannelMixerTestData(CHANNEL_LAYOUT_DISCRETE, 2, |
| 181 CHANNEL_LAYOUT_DISCRETE, 5, | 183 CHANNEL_LAYOUT_DISCRETE, 5, |
| 182 kStereoToMonoValues, arraysize(kStereoToMonoValues)), | 184 kStereoToMonoValues, arraysize(kStereoToMonoValues)), |
| 183 ChannelMixerTestData(CHANNEL_LAYOUT_DISCRETE, 5, | 185 ChannelMixerTestData(CHANNEL_LAYOUT_DISCRETE, 5, |
| 184 CHANNEL_LAYOUT_DISCRETE, 2, | 186 CHANNEL_LAYOUT_DISCRETE, 2, |
| 185 kFiveDiscreteValues, arraysize(kFiveDiscreteValues)) | 187 kFiveDiscreteValues, arraysize(kFiveDiscreteValues)) |
| 186 )); | 188 )); |
| 187 | 189 |
| 188 } // namespace media | 190 } // namespace media |
| OLD | NEW |