henrik.lundin@webrtc.org | 9a40081 | 2013-01-29 12:09:21 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 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 |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
| 11 | #ifndef WEBRTC_MODULES_AUDIO_CODING_NETEQ4_NORMAL_H_ |
| 12 | #define WEBRTC_MODULES_AUDIO_CODING_NETEQ4_NORMAL_H_ |
| 13 | |
| 14 | #include <cstring> // Access to size_t. |
| 15 | #include <vector> |
| 16 | |
| 17 | #include "webrtc/modules/audio_coding/neteq4/audio_multi_vector.h" |
| 18 | #include "webrtc/modules/audio_coding/neteq4/defines.h" |
| 19 | #include "webrtc/system_wrappers/interface/constructor_magic.h" |
| 20 | #include "webrtc/typedefs.h" |
| 21 | |
| 22 | namespace webrtc { |
| 23 | |
| 24 | // Forward declarations. |
| 25 | class BackgroundNoise; |
| 26 | class DecoderDatabase; |
| 27 | class Expand; |
| 28 | |
| 29 | // This class provides the "Normal" DSP operation, that is performed when |
| 30 | // there is no data loss, no need to stretch the timing of the signal, and |
| 31 | // no other "special circumstances" are at hand. |
| 32 | class Normal { |
| 33 | public: |
| 34 | Normal(int fs_hz, DecoderDatabase* decoder_database, |
| 35 | const BackgroundNoise& background_noise, |
| 36 | Expand* expand) |
| 37 | : fs_hz_(fs_hz), |
| 38 | decoder_database_(decoder_database), |
| 39 | background_noise_(background_noise), |
| 40 | expand_(expand) { |
| 41 | } |
| 42 | |
| 43 | virtual ~Normal() {} |
| 44 | |
| 45 | // Performs the "Normal" operation. The decoder data is supplied in |input|, |
| 46 | // having |length| samples in total for all channels (interleaved). The |
| 47 | // result is written to |output|. The number of channels allocated in |
| 48 | // |output| defines the number of channels that will be used when |
| 49 | // de-interleaving |input|. |last_mode| contains the mode used in the previous |
| 50 | // GetAudio call (i.e., not the current one), and |external_mute_factor| is |
| 51 | // a pointer to the mute factor in the NetEqImpl class. |
| 52 | int Process(const int16_t* input, size_t length, |
| 53 | Modes last_mode, |
| 54 | int16_t* external_mute_factor_array, |
| 55 | AudioMultiVector<int16_t>* output); |
| 56 | |
| 57 | private: |
| 58 | int fs_hz_; |
| 59 | DecoderDatabase* decoder_database_; |
| 60 | const BackgroundNoise& background_noise_; |
| 61 | Expand* expand_; |
| 62 | |
| 63 | DISALLOW_COPY_AND_ASSIGN(Normal); |
| 64 | }; |
| 65 | |
| 66 | } // namespace webrtc |
| 67 | #endif // SRC_MODULES_AUDIO_CODING_NETEQ4_NORMAL_H_ |