blob: fa14685f9bb49bd9e072dfa042a78c8760679fcb [file] [log] [blame]
henrik.lundin@webrtc.org9a400812013-01-29 12:09:21 +00001/*
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
pbos@webrtc.org3f45c2e2013-08-05 16:22:53 +000014#include <string.h> // Access to size_t.
15
henrik.lundin@webrtc.org9a400812013-01-29 12:09:21 +000016#include <vector>
17
18#include "webrtc/modules/audio_coding/neteq4/audio_multi_vector.h"
19#include "webrtc/modules/audio_coding/neteq4/defines.h"
20#include "webrtc/system_wrappers/interface/constructor_magic.h"
21#include "webrtc/typedefs.h"
22
23namespace webrtc {
24
25// Forward declarations.
26class BackgroundNoise;
27class DecoderDatabase;
28class Expand;
29
30// This class provides the "Normal" DSP operation, that is performed when
31// there is no data loss, no need to stretch the timing of the signal, and
32// no other "special circumstances" are at hand.
33class Normal {
34 public:
35 Normal(int fs_hz, DecoderDatabase* decoder_database,
36 const BackgroundNoise& background_noise,
37 Expand* expand)
38 : fs_hz_(fs_hz),
39 decoder_database_(decoder_database),
40 background_noise_(background_noise),
41 expand_(expand) {
42 }
43
44 virtual ~Normal() {}
45
46 // Performs the "Normal" operation. The decoder data is supplied in |input|,
47 // having |length| samples in total for all channels (interleaved). The
48 // result is written to |output|. The number of channels allocated in
49 // |output| defines the number of channels that will be used when
50 // de-interleaving |input|. |last_mode| contains the mode used in the previous
51 // GetAudio call (i.e., not the current one), and |external_mute_factor| is
52 // a pointer to the mute factor in the NetEqImpl class.
53 int Process(const int16_t* input, size_t length,
54 Modes last_mode,
55 int16_t* external_mute_factor_array,
henrik.lundin@webrtc.org0e9c3992013-09-30 20:38:44 +000056 AudioMultiVector* output);
henrik.lundin@webrtc.org9a400812013-01-29 12:09:21 +000057
58 private:
59 int fs_hz_;
60 DecoderDatabase* decoder_database_;
61 const BackgroundNoise& background_noise_;
62 Expand* expand_;
63
64 DISALLOW_COPY_AND_ASSIGN(Normal);
65};
66
67} // namespace webrtc
68#endif // SRC_MODULES_AUDIO_CODING_NETEQ4_NORMAL_H_