EchoSuppressor.h revision c7092775516e15983053a58b3b43ff3eb58ac46f
1c7092775516e15983053a58b3b43ff3eb58ac46fChia-chi Yeh/*
2c7092775516e15983053a58b3b43ff3eb58ac46fChia-chi Yeh * Copyrightm (C) 2010 The Android Open Source Project
3c7092775516e15983053a58b3b43ff3eb58ac46fChia-chi Yeh *
4c7092775516e15983053a58b3b43ff3eb58ac46fChia-chi Yeh * Licensed under the Apache License, Version 2.0 (the "License");
5c7092775516e15983053a58b3b43ff3eb58ac46fChia-chi Yeh * you may not use this file except in compliance with the License.
6c7092775516e15983053a58b3b43ff3eb58ac46fChia-chi Yeh * You may obtain a copy of the License at
7c7092775516e15983053a58b3b43ff3eb58ac46fChia-chi Yeh *
8c7092775516e15983053a58b3b43ff3eb58ac46fChia-chi Yeh *      http://www.apache.org/licenses/LICENSE-2.0
9c7092775516e15983053a58b3b43ff3eb58ac46fChia-chi Yeh *
10c7092775516e15983053a58b3b43ff3eb58ac46fChia-chi Yeh * Unless required by applicable law or agreed to in writing, software
11c7092775516e15983053a58b3b43ff3eb58ac46fChia-chi Yeh * distributed under the License is distributed on an "AS IS" BASIS,
12c7092775516e15983053a58b3b43ff3eb58ac46fChia-chi Yeh * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13c7092775516e15983053a58b3b43ff3eb58ac46fChia-chi Yeh * See the License for the specific language governing permissions and
14c7092775516e15983053a58b3b43ff3eb58ac46fChia-chi Yeh * limitations under the License.
15c7092775516e15983053a58b3b43ff3eb58ac46fChia-chi Yeh */
16c7092775516e15983053a58b3b43ff3eb58ac46fChia-chi Yeh
17c7092775516e15983053a58b3b43ff3eb58ac46fChia-chi Yeh#ifndef __ECHO_SUPPRESSOR_H__
18c7092775516e15983053a58b3b43ff3eb58ac46fChia-chi Yeh#define __ECHO_SUPPRESSOR_H__
19c7092775516e15983053a58b3b43ff3eb58ac46fChia-chi Yeh
20c7092775516e15983053a58b3b43ff3eb58ac46fChia-chi Yeh#include <stdint.h>
21c7092775516e15983053a58b3b43ff3eb58ac46fChia-chi Yeh
22c7092775516e15983053a58b3b43ff3eb58ac46fChia-chi Yehclass EchoSuppressor
23c7092775516e15983053a58b3b43ff3eb58ac46fChia-chi Yeh{
24c7092775516e15983053a58b3b43ff3eb58ac46fChia-chi Yehpublic:
25c7092775516e15983053a58b3b43ff3eb58ac46fChia-chi Yeh    // The sampleCount must be power of 2.
26c7092775516e15983053a58b3b43ff3eb58ac46fChia-chi Yeh    EchoSuppressor(int sampleRate, int sampleCount, int tailLength);
27c7092775516e15983053a58b3b43ff3eb58ac46fChia-chi Yeh    ~EchoSuppressor();
28c7092775516e15983053a58b3b43ff3eb58ac46fChia-chi Yeh    void run(int16_t *playbacked, int16_t *recorded);
29c7092775516e15983053a58b3b43ff3eb58ac46fChia-chi Yeh
30c7092775516e15983053a58b3b43ff3eb58ac46fChia-chi Yehprivate:
31c7092775516e15983053a58b3b43ff3eb58ac46fChia-chi Yeh    int mScale;
32c7092775516e15983053a58b3b43ff3eb58ac46fChia-chi Yeh    int mSampleCount;
33c7092775516e15983053a58b3b43ff3eb58ac46fChia-chi Yeh    int mWindowSize;
34c7092775516e15983053a58b3b43ff3eb58ac46fChia-chi Yeh    int mTailLength;
35c7092775516e15983053a58b3b43ff3eb58ac46fChia-chi Yeh    int mRecordLength;
36c7092775516e15983053a58b3b43ff3eb58ac46fChia-chi Yeh    int mRecordOffset;
37c7092775516e15983053a58b3b43ff3eb58ac46fChia-chi Yeh
38c7092775516e15983053a58b3b43ff3eb58ac46fChia-chi Yeh    float *mXs;
39c7092775516e15983053a58b3b43ff3eb58ac46fChia-chi Yeh    float *mXYs;
40c7092775516e15983053a58b3b43ff3eb58ac46fChia-chi Yeh    float *mXXs;
41c7092775516e15983053a58b3b43ff3eb58ac46fChia-chi Yeh    float mYY;
42c7092775516e15983053a58b3b43ff3eb58ac46fChia-chi Yeh
43c7092775516e15983053a58b3b43ff3eb58ac46fChia-chi Yeh    float *mXYRecords;
44c7092775516e15983053a58b3b43ff3eb58ac46fChia-chi Yeh    float *mXXRecords;
45c7092775516e15983053a58b3b43ff3eb58ac46fChia-chi Yeh    float *mYYRecords;
46c7092775516e15983053a58b3b43ff3eb58ac46fChia-chi Yeh
47c7092775516e15983053a58b3b43ff3eb58ac46fChia-chi Yeh    float mLastX;
48c7092775516e15983053a58b3b43ff3eb58ac46fChia-chi Yeh    float mLastY;
49c7092775516e15983053a58b3b43ff3eb58ac46fChia-chi Yeh};
50c7092775516e15983053a58b3b43ff3eb58ac46fChia-chi Yeh
51c7092775516e15983053a58b3b43ff3eb58ac46fChia-chi Yeh#endif
52