| 1 | /* | 
| 2 | Copyright 2018 Google Inc. All Rights Reserved. | 
| 3 |  | 
| 4 | Licensed under the Apache License, Version 2.0 (the "License"); | 
| 5 | you may not use this file except in compliance with the License. | 
| 6 | You may obtain a copy of the License at | 
| 7 |  | 
| 8 |     http://www.apache.org/licenses/LICENSE-2.0 | 
| 9 |  | 
| 10 | Unless required by applicable law or agreed to in writing, software | 
| 11 | distributed under the License is distributed on an "AS-IS" BASIS, | 
| 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
| 13 | See the License for the specific language governing permissions and | 
| 14 | limitations under the License. | 
| 15 | */ | 
| 16 |  | 
| 17 | #include "base/channel_view.h" | 
| 18 |  | 
| 19 | #include "base/simd_utils.h" | 
| 20 |  | 
| 21 | namespace vraudio { | 
| 22 |  | 
| 23 | ChannelView& ChannelView::operator+=(const ChannelView& other) { | 
| 24 |   DCHECK_EQ(other.size(), size_); | 
| 25 |   DCHECK(enabled_); | 
| 26 |   float* this_sample = begin(); | 
| 27 |   const float* other_sample = other.begin(); | 
| 28 |   AddPointwise(length: size_, input_a: other_sample, input_b: this_sample, output: this_sample); | 
| 29 |   return *this; | 
| 30 | } | 
| 31 |  | 
| 32 | ChannelView& ChannelView::operator-=(const ChannelView& other) { | 
| 33 |   DCHECK_EQ(other.size(), size_); | 
| 34 |   DCHECK(enabled_); | 
| 35 |   float* this_sample = begin(); | 
| 36 |   const float* other_sample = other.begin(); | 
| 37 |   SubtractPointwise(length: size_, input_a: other_sample, input_b: this_sample, output: this_sample); | 
| 38 |   return *this; | 
| 39 | } | 
| 40 |  | 
| 41 | ChannelView& ChannelView::operator*=(const ChannelView& other) { | 
| 42 |   DCHECK_EQ(other.size(), size_); | 
| 43 |   DCHECK(enabled_); | 
| 44 |   float* this_sample = begin(); | 
| 45 |   const float* other_sample = other.begin(); | 
| 46 |   MultiplyPointwise(length: size_, input_a: other_sample, input_b: this_sample, output: this_sample); | 
| 47 |   return *this; | 
| 48 | } | 
| 49 |  | 
| 50 | }  // namespace vraudio | 
| 51 |  |