Chia-chi Yeh | a8a1009 | 2010-10-05 01:17:13 +0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyrightm (C) 2010 The Android Open Source Project |
| 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 | #ifndef __ECHO_SUPPRESSOR_H__ |
| 18 | #define __ECHO_SUPPRESSOR_H__ |
| 19 | |
| 20 | #include <stdint.h> |
| 21 | |
| 22 | class EchoSuppressor |
| 23 | { |
| 24 | public: |
| 25 | // The sampleCount must be power of 2. |
Chia-chi Yeh | 8a68b52 | 2010-10-21 23:39:35 +0800 | [diff] [blame] | 26 | EchoSuppressor(int sampleCount, int tailLength); |
Chia-chi Yeh | a8a1009 | 2010-10-05 01:17:13 +0800 | [diff] [blame] | 27 | ~EchoSuppressor(); |
| 28 | void run(int16_t *playbacked, int16_t *recorded); |
| 29 | |
| 30 | private: |
Chia-chi Yeh | 8a68b52 | 2010-10-21 23:39:35 +0800 | [diff] [blame] | 31 | int mShift; |
Chia-chi Yeh | a8a1009 | 2010-10-05 01:17:13 +0800 | [diff] [blame] | 32 | int mScale; |
| 33 | int mSampleCount; |
| 34 | int mWindowSize; |
| 35 | int mTailLength; |
| 36 | int mRecordLength; |
| 37 | int mRecordOffset; |
| 38 | |
Chia-chi Yeh | 8a68b52 | 2010-10-21 23:39:35 +0800 | [diff] [blame] | 39 | uint16_t *mXs; |
| 40 | uint32_t *mXSums; |
| 41 | uint32_t *mX2Sums; |
| 42 | uint16_t *mXRecords; |
Chia-chi Yeh | a8a1009 | 2010-10-05 01:17:13 +0800 | [diff] [blame] | 43 | |
Chia-chi Yeh | 8a68b52 | 2010-10-21 23:39:35 +0800 | [diff] [blame] | 44 | uint32_t mYSum; |
| 45 | uint32_t mY2Sum; |
| 46 | uint32_t *mYRecords; |
| 47 | uint32_t *mY2Records; |
Chia-chi Yeh | a8a1009 | 2010-10-05 01:17:13 +0800 | [diff] [blame] | 48 | |
Chia-chi Yeh | 8a68b52 | 2010-10-21 23:39:35 +0800 | [diff] [blame] | 49 | uint32_t *mXYSums; |
| 50 | uint32_t *mXYRecords; |
| 51 | |
| 52 | int32_t mLastX; |
| 53 | int32_t mLastY; |
| 54 | |
| 55 | float mWeight; |
Chia-chi Yeh | a8a1009 | 2010-10-05 01:17:13 +0800 | [diff] [blame] | 56 | }; |
| 57 | |
| 58 | #endif |