OLD | NEW |
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 1726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1737 } | 1737 } |
1738 | 1738 |
1739 void FormNearendBlock( | 1739 void FormNearendBlock( |
1740 size_t nearend_start_index, | 1740 size_t nearend_start_index, |
1741 size_t num_bands, | 1741 size_t num_bands, |
1742 const float* const* nearend_frame, | 1742 const float* const* nearend_frame, |
1743 size_t num_samples_from_nearend_frame, | 1743 size_t num_samples_from_nearend_frame, |
1744 const float nearend_buffer[NUM_HIGH_BANDS_MAX + 1] | 1744 const float nearend_buffer[NUM_HIGH_BANDS_MAX + 1] |
1745 [PART_LEN - (FRAME_LEN - PART_LEN)], | 1745 [PART_LEN - (FRAME_LEN - PART_LEN)], |
1746 float nearend_block[NUM_HIGH_BANDS_MAX + 1][PART_LEN]) { | 1746 float nearend_block[NUM_HIGH_BANDS_MAX + 1][PART_LEN]) { |
1747 RTC_DCHECK_LE(num_samples_from_nearend_frame, static_cast<size_t>(PART_LEN)); | 1747 RTC_DCHECK_LE(num_samples_from_nearend_frame, PART_LEN); |
1748 const int num_samples_from_buffer = PART_LEN - num_samples_from_nearend_frame; | 1748 const int num_samples_from_buffer = PART_LEN - num_samples_from_nearend_frame; |
1749 | 1749 |
1750 if (num_samples_from_buffer > 0) { | 1750 if (num_samples_from_buffer > 0) { |
1751 for (size_t i = 0; i < num_bands; ++i) { | 1751 for (size_t i = 0; i < num_bands; ++i) { |
1752 memcpy(&nearend_block[i][0], &nearend_buffer[i][0], | 1752 memcpy(&nearend_block[i][0], &nearend_buffer[i][0], |
1753 num_samples_from_buffer * sizeof(float)); | 1753 num_samples_from_buffer * sizeof(float)); |
1754 } | 1754 } |
1755 } | 1755 } |
1756 | 1756 |
1757 for (size_t i = 0; i < num_bands; ++i) { | 1757 for (size_t i = 0; i < num_bands; ++i) { |
(...skipping 30 matching lines...) Expand all Loading... |
1788 PART_LEN * sizeof(float)); | 1788 PART_LEN * sizeof(float)); |
1789 } | 1789 } |
1790 (*output_buffer_size) += PART_LEN; | 1790 (*output_buffer_size) += PART_LEN; |
1791 } | 1791 } |
1792 | 1792 |
1793 void FormOutputFrame(size_t output_start_index, | 1793 void FormOutputFrame(size_t output_start_index, |
1794 size_t num_bands, | 1794 size_t num_bands, |
1795 size_t* output_buffer_size, | 1795 size_t* output_buffer_size, |
1796 float output_buffer[NUM_HIGH_BANDS_MAX + 1][2 * PART_LEN], | 1796 float output_buffer[NUM_HIGH_BANDS_MAX + 1][2 * PART_LEN], |
1797 float* const* output_frame) { | 1797 float* const* output_frame) { |
1798 RTC_DCHECK_LE(static_cast<size_t>(FRAME_LEN), *output_buffer_size); | 1798 RTC_DCHECK_LE(FRAME_LEN, *output_buffer_size); |
1799 for (size_t i = 0; i < num_bands; ++i) { | 1799 for (size_t i = 0; i < num_bands; ++i) { |
1800 memcpy(&output_frame[i][output_start_index], &output_buffer[i][0], | 1800 memcpy(&output_frame[i][output_start_index], &output_buffer[i][0], |
1801 FRAME_LEN * sizeof(float)); | 1801 FRAME_LEN * sizeof(float)); |
1802 } | 1802 } |
1803 (*output_buffer_size) -= FRAME_LEN; | 1803 (*output_buffer_size) -= FRAME_LEN; |
1804 if (*output_buffer_size > 0) { | 1804 if (*output_buffer_size > 0) { |
1805 RTC_DCHECK_GE(static_cast<size_t>(2 * PART_LEN - FRAME_LEN), | 1805 RTC_DCHECK_GE(2 * PART_LEN - FRAME_LEN, (*output_buffer_size)); |
1806 (*output_buffer_size)); | |
1807 for (size_t i = 0; i < num_bands; ++i) { | 1806 for (size_t i = 0; i < num_bands; ++i) { |
1808 memcpy(&output_buffer[i][0], &output_buffer[i][FRAME_LEN], | 1807 memcpy(&output_buffer[i][0], &output_buffer[i][FRAME_LEN], |
1809 (*output_buffer_size) * sizeof(float)); | 1808 (*output_buffer_size) * sizeof(float)); |
1810 } | 1809 } |
1811 } | 1810 } |
1812 } | 1811 } |
1813 | 1812 |
1814 void WebRtcAec_ProcessFrames(AecCore* aec, | 1813 void WebRtcAec_ProcessFrames(AecCore* aec, |
1815 const float* const* nearend, | 1814 const float* const* nearend, |
1816 size_t num_bands, | 1815 size_t num_bands, |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2049 | 2048 |
2050 int WebRtcAec_system_delay(AecCore* self) { | 2049 int WebRtcAec_system_delay(AecCore* self) { |
2051 return self->system_delay; | 2050 return self->system_delay; |
2052 } | 2051 } |
2053 | 2052 |
2054 void WebRtcAec_SetSystemDelay(AecCore* self, int delay) { | 2053 void WebRtcAec_SetSystemDelay(AecCore* self, int delay) { |
2055 RTC_DCHECK_GE(delay, 0); | 2054 RTC_DCHECK_GE(delay, 0); |
2056 self->system_delay = delay; | 2055 self->system_delay = delay; |
2057 } | 2056 } |
2058 } // namespace webrtc | 2057 } // namespace webrtc |
OLD | NEW |