blob: ee9daa823c65df94e0d1303560af7e4e39199754 [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
2 * Copyright (c) 2011 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/*
12 * This function "unmutes" a vector on a sample by sample basis.
13 */
14
15#include "dsp_helpfunctions.h"
16
17#include "signal_processing_library.h"
18
19
20void WebRtcNetEQ_UnmuteSignal(WebRtc_Word16 *pw16_inVec, WebRtc_Word16 *startMuteFact,
21 WebRtc_Word16 *pw16_outVec, WebRtc_Word16 unmuteFact,
22 WebRtc_Word16 N)
23{
24 int i;
25 WebRtc_UWord16 w16_tmp;
26 WebRtc_Word32 w32_tmp;
27
28 w16_tmp = (WebRtc_UWord16) *startMuteFact;
29 w32_tmp = WEBRTC_SPL_LSHIFT_W32((WebRtc_Word32)w16_tmp,6) + 32;
30 for (i = 0; i < N; i++)
31 {
32 pw16_outVec[i]
33 = (WebRtc_Word16) ((WEBRTC_SPL_MUL_16_16(w16_tmp, pw16_inVec[i]) + 8192) >> 14);
34 w32_tmp += unmuteFact;
35 w32_tmp = WEBRTC_SPL_MAX(0, w32_tmp);
36 w16_tmp = (WebRtc_UWord16) WEBRTC_SPL_RSHIFT_W32(w32_tmp, 6); /* 20 - 14 = 6 */
37 w16_tmp = WEBRTC_SPL_MIN(16384, w16_tmp);
38 }
39 *startMuteFact = (WebRtc_Word16) w16_tmp;
40}
41