| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 29 matching lines...) Expand all Loading... |
| 40 } | 40 } |
| 41 | 41 |
| 42 const ChannelBuffer<float>* IFChannelBuffer::fbuf_const() const { | 42 const ChannelBuffer<float>* IFChannelBuffer::fbuf_const() const { |
| 43 RefreshF(); | 43 RefreshF(); |
| 44 return &fbuf_; | 44 return &fbuf_; |
| 45 } | 45 } |
| 46 | 46 |
| 47 void IFChannelBuffer::RefreshF() const { | 47 void IFChannelBuffer::RefreshF() const { |
| 48 if (!fvalid_) { | 48 if (!fvalid_) { |
| 49 RTC_DCHECK(ivalid_); | 49 RTC_DCHECK(ivalid_); |
| 50 fbuf_.set_num_channels(ibuf_.num_channels()); |
| 50 const int16_t* const* int_channels = ibuf_.channels(); | 51 const int16_t* const* int_channels = ibuf_.channels(); |
| 51 float* const* float_channels = fbuf_.channels(); | 52 float* const* float_channels = fbuf_.channels(); |
| 52 for (size_t i = 0; i < ibuf_.num_channels(); ++i) { | 53 for (size_t i = 0; i < ibuf_.num_channels(); ++i) { |
| 53 for (size_t j = 0; j < ibuf_.num_frames(); ++j) { | 54 for (size_t j = 0; j < ibuf_.num_frames(); ++j) { |
| 54 float_channels[i][j] = int_channels[i][j]; | 55 float_channels[i][j] = int_channels[i][j]; |
| 55 } | 56 } |
| 56 } | 57 } |
| 57 fvalid_ = true; | 58 fvalid_ = true; |
| 58 } | 59 } |
| 59 } | 60 } |
| 60 | 61 |
| 61 void IFChannelBuffer::RefreshI() const { | 62 void IFChannelBuffer::RefreshI() const { |
| 62 if (!ivalid_) { | 63 if (!ivalid_) { |
| 63 RTC_DCHECK(fvalid_); | 64 RTC_DCHECK(fvalid_); |
| 64 int16_t* const* int_channels = ibuf_.channels(); | 65 int16_t* const* int_channels = ibuf_.channels(); |
| 66 ibuf_.set_num_channels(fbuf_.num_channels()); |
| 65 const float* const* float_channels = fbuf_.channels(); | 67 const float* const* float_channels = fbuf_.channels(); |
| 66 for (size_t i = 0; i < ibuf_.num_channels(); ++i) { | 68 for (size_t i = 0; i < fbuf_.num_channels(); ++i) { |
| 67 FloatS16ToS16(float_channels[i], | 69 FloatS16ToS16(float_channels[i], |
| 68 ibuf_.num_frames(), | 70 ibuf_.num_frames(), |
| 69 int_channels[i]); | 71 int_channels[i]); |
| 70 } | 72 } |
| 71 ivalid_ = true; | 73 ivalid_ = true; |
| 72 } | 74 } |
| 73 } | 75 } |
| 74 | 76 |
| 75 } // namespace webrtc | 77 } // namespace webrtc |
| OLD | NEW |