19a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org/* 29a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 39a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org * 49a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org * Use of this source code is governed by a BSD-style license 59a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org * that can be found in the LICENSE file in the root of the source 69a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org * tree. An additional intellectual property rights grant can be found 79a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org * in the file PATENTS. All contributing project authors may 89a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org * be found in the AUTHORS file in the root of the source tree. 99a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org */ 109a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org 11e5abc854f3dc47de16067c2a41476c39b7626722henrik.lundin@webrtc.org#ifndef WEBRTC_MODULES_AUDIO_CODING_NETEQ_NORMAL_H_ 12e5abc854f3dc47de16067c2a41476c39b7626722henrik.lundin@webrtc.org#define WEBRTC_MODULES_AUDIO_CODING_NETEQ_NORMAL_H_ 139a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org 143f45c2e0ac4cb280f941efa3a3476895795e3dd6pbos@webrtc.org#include <string.h> // Access to size_t. 153f45c2e0ac4cb280f941efa3a3476895795e3dd6pbos@webrtc.org 169a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org#include <vector> 179a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org 18774b3d38a4a0f1a8ec08972a3c543cb5d607ce13henrike@webrtc.org#include "webrtc/base/constructormagic.h" 19e5abc854f3dc47de16067c2a41476c39b7626722henrik.lundin@webrtc.org#include "webrtc/modules/audio_coding/neteq/audio_multi_vector.h" 20e5abc854f3dc47de16067c2a41476c39b7626722henrik.lundin@webrtc.org#include "webrtc/modules/audio_coding/neteq/defines.h" 219a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org#include "webrtc/typedefs.h" 229a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org 239a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.orgnamespace webrtc { 249a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org 259a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// Forward declarations. 269a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.orgclass BackgroundNoise; 279a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.orgclass DecoderDatabase; 289a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.orgclass Expand; 299a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org 309a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// This class provides the "Normal" DSP operation, that is performed when 319a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// there is no data loss, no need to stretch the timing of the signal, and 329a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// no other "special circumstances" are at hand. 339a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.orgclass Normal { 349a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org public: 359a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org Normal(int fs_hz, DecoderDatabase* decoder_database, 369a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org const BackgroundNoise& background_noise, 379a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org Expand* expand) 389a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org : fs_hz_(fs_hz), 399a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org decoder_database_(decoder_database), 409a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org background_noise_(background_noise), 419a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org expand_(expand) { 429a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org } 439a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org 449a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org virtual ~Normal() {} 459a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org 469a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org // Performs the "Normal" operation. The decoder data is supplied in |input|, 479a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org // having |length| samples in total for all channels (interleaved). The 489a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org // result is written to |output|. The number of channels allocated in 499a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org // |output| defines the number of channels that will be used when 509a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org // de-interleaving |input|. |last_mode| contains the mode used in the previous 519a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org // GetAudio call (i.e., not the current one), and |external_mute_factor| is 529a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org // a pointer to the mute factor in the NetEqImpl class. 539a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org int Process(const int16_t* input, size_t length, 549a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org Modes last_mode, 559a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org int16_t* external_mute_factor_array, 560e9c399746f45ceaf46f12b11ba93c09cca0c2bbhenrik.lundin@webrtc.org AudioMultiVector* output); 579a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org 589a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org private: 599a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org int fs_hz_; 609a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org DecoderDatabase* decoder_database_; 619a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org const BackgroundNoise& background_noise_; 629a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org Expand* expand_; 639a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org 649a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org DISALLOW_COPY_AND_ASSIGN(Normal); 659a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org}; 669a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org 679a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org} // namespace webrtc 68e5abc854f3dc47de16067c2a41476c39b7626722henrik.lundin@webrtc.org#endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_NORMAL_H_ 69