diff options
author | Chia-chi Yeh <chiachi@android.com> | 2010-10-21 23:39:35 +0800 |
---|---|---|
committer | Chia-chi Yeh <chiachi@android.com> | 2010-10-22 03:47:02 +0800 |
commit | 8a68b52b9873f1f3d7114576c9f39a2b7b402152 (patch) | |
tree | f199749f93bd9be86e8278856b963b8fcf018ac3 /voip/jni/rtp/EchoSuppressor.h | |
parent | b595e094e3901ff8a224eaf7d4869e7d2e5649dd (diff) | |
download | frameworks_base-8a68b52b9873f1f3d7114576c9f39a2b7b402152.zip frameworks_base-8a68b52b9873f1f3d7114576c9f39a2b7b402152.tar.gz frameworks_base-8a68b52b9873f1f3d7114576c9f39a2b7b402152.tar.bz2 |
RTP: Fix non-zero DC in EchoSuppressor caused while aggregating samples.
Rewrite using integer arithmetic to get full 32-bit precision instead
of 23-bit in single precision floating-points.
Bug: 3029745
Change-Id: If67dcc403923755f403d08bbafb41ebce26e4e8b
Diffstat (limited to 'voip/jni/rtp/EchoSuppressor.h')
-rw-r--r-- | voip/jni/rtp/EchoSuppressor.h | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/voip/jni/rtp/EchoSuppressor.h b/voip/jni/rtp/EchoSuppressor.h index 85decf5..2f3b593 100644 --- a/voip/jni/rtp/EchoSuppressor.h +++ b/voip/jni/rtp/EchoSuppressor.h @@ -23,11 +23,12 @@ class EchoSuppressor { public: // The sampleCount must be power of 2. - EchoSuppressor(int sampleRate, int sampleCount, int tailLength); + EchoSuppressor(int sampleCount, int tailLength); ~EchoSuppressor(); void run(int16_t *playbacked, int16_t *recorded); private: + int mShift; int mScale; int mSampleCount; int mWindowSize; @@ -35,17 +36,23 @@ private: int mRecordLength; int mRecordOffset; - float *mXs; - float *mXYs; - float *mXXs; - float mYY; + uint16_t *mXs; + uint32_t *mXSums; + uint32_t *mX2Sums; + uint16_t *mXRecords; - float *mXYRecords; - float *mXXRecords; - float *mYYRecords; + uint32_t mYSum; + uint32_t mY2Sum; + uint32_t *mYRecords; + uint32_t *mY2Records; - float mLastX; - float mLastY; + uint32_t *mXYSums; + uint32_t *mXYRecords; + + int32_t mLastX; + int32_t mLastY; + + float mWeight; }; #endif |