2 ** Copyright 2003-2010, VisualOn, Inc.
\r
4 ** Licensed under the Apache License, Version 2.0 (the "License");
\r
5 ** you may not use this file except in compliance with the License.
\r
6 ** You may obtain a copy of the License at
\r
8 ** http://www.apache.org/licenses/LICENSE-2.0
\r
10 ** Unless required by applicable law or agreed to in writing, software
\r
11 ** distributed under the License is distributed on an "AS IS" BASIS,
\r
12 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
13 ** See the License for the specific language governing permissions and
\r
14 ** limitations under the License.
\r
17 /***********************************************************************
\r
20 * Description:filtering through 1/(1-mu z^ -1) *
\r
21 * Deemph2 --> signal is divided by 2 *
\r
22 * Deemph_32 --> for 32 bits signal. *
\r
24 ************************************************************************/
\r
26 #include "typedef.h"
\r
27 #include "basic_op.h"
\r
28 #include "math_op.h"
\r
31 Word16 x[], /* (i/o) : input signal overwritten by the output */
\r
32 Word16 mu, /* (i) Q15 : deemphasis factor */
\r
33 Word16 L, /* (i) : vector size */
\r
34 Word16 * mem /* (i/o) : memory (y[-1]) */
\r
40 L_tmp = L_deposit_h(x[0]);
\r
41 L_tmp = L_mac(L_tmp, *mem, mu);
\r
42 x[0] = vo_round(L_tmp);
\r
44 for (i = 1; i < L; i++)
\r
46 L_tmp = L_deposit_h(x[i]);
\r
47 L_tmp = L_mac(L_tmp, x[i - 1], mu);
\r
48 x[i] = voround(L_tmp);
\r
58 Word16 x[], /* (i/o) : input signal overwritten by the output */
\r
59 Word16 mu, /* (i) Q15 : deemphasis factor */
\r
60 Word16 L, /* (i) : vector size */
\r
61 Word16 * mem /* (i/o) : memory (y[-1]) */
\r
67 L_tmp += ((*mem) * mu)<<1;
\r
68 x[0] = (L_tmp + 0x8000)>>16;
\r
69 for (i = 1; i < L; i++)
\r
72 L_tmp += (x[i - 1] * mu)<<1;
\r
73 x[i] = (L_tmp + 0x8000)>>16;
\r
81 Word16 x_hi[], /* (i) : input signal (bit31..16) */
\r
82 Word16 x_lo[], /* (i) : input signal (bit15..4) */
\r
83 Word16 y[], /* (o) : output signal (x16) */
\r
84 Word16 mu, /* (i) Q15 : deemphasis factor */
\r
85 Word16 L, /* (i) : vector size */
\r
86 Word16 * mem /* (i/o) : memory (y[-1]) */
\r
92 fac = mu >> 1; /* Q15 --> Q14 */
\r
94 L_tmp = L_deposit_h(x_hi[0]);
\r
95 L_tmp += (x_lo[0] * 8)<<1;
\r
96 L_tmp = (L_tmp << 3);
\r
97 L_tmp += ((*mem) * fac)<<1;
\r
98 L_tmp = (L_tmp << 1);
\r
99 y[0] = (L_tmp + 0x8000)>>16;
\r
101 for (i = 1; i < L; i++)
\r
103 L_tmp = L_deposit_h(x_hi[i]);
\r
104 L_tmp += (x_lo[i] * 8)<<1;
\r
105 L_tmp = (L_tmp << 3);
\r
106 L_tmp += (y[i - 1] * fac)<<1;
\r
107 L_tmp = (L_tmp << 1);
\r
108 y[i] = (L_tmp + 0x8000)>>16;
\r