1
/*****************************************************************************
3
** ITU-T G.722.1 (2005-05) - Fixed point implementation for main body and Annex C
4
** > Software Release 2.1 (2008-06)
5
** (Simple repackaging; no change from 2005-05 Release 2.0 code)
7
** � 2004 Polycom, Inc.
9
** All rights reserved.
11
*****************************************************************************/
13
/*****************************************************************************
14
* Filename: rmlt_coefs_to_samples.c
16
* Purpose: Convert Reversed MLT (Modulated Lapped Transform)
17
* Coefficients to Samples
19
* The "Reversed MLT" is an overlapped block transform which uses
20
* even symmetry * on the left, odd symmetry on the right and a
21
* Type IV DCT as the block transform. * It is thus similar to a
22
* MLT which uses odd symmetry on the left, even symmetry * on the
23
* right and a Type IV DST as the block transform. In fact, it is
24
* equivalent * to reversing the order of the samples, performing
25
* an MLT and then negating all * the even-numbered coefficients.
27
*****************************************************************************/
29
/***************************************************************************
31
***************************************************************************/
36
/***************************************************************************
37
Function: rmlt_coefs_to_samples
39
Syntax: void rmlt_coefs_to_samples(Word16 *coefs,
51
outputs: Word16 *out_samples
53
Description: Converts the mlt_coefs to samples
57
WMOPS: 7kHz | 24kbit | 32kbit
58
-------|--------------|----------------
60
-------|--------------|----------------
62
-------|--------------|----------------
64
14kHz | 24kbit | 32kbit | 48kbit
65
-------|--------------|----------------|----------------
66
AVG | 3.97 | 3.97 | 3.97
67
-------|--------------|----------------|----------------
68
MAX | 3.97 | 3.97 | 3.97
69
-------|--------------|----------------|----------------
71
***************************************************************************/
73
void rmlt_coefs_to_samples(Word16 *coefs,
81
Word16 index, vals_left;
82
Word16 new_samples[MAX_DCT_LENGTH];
83
Word16 *new_ptr, *old_ptr;
84
Word16 *win_new, *win_old;
91
half_dct_size = shr_nocheck(dct_length,1);
93
/* Perform a Type IV (inverse) DCT on the coefficients */
94
dct_type_iv_s(coefs, new_samples, dct_length);
99
for(index=0;index<dct_length;index++)
101
new_samples[index] = shr_nocheck(new_samples[index],mag_shift);
110
mag_shift = negate(mag_shift);
111
for(index=0;index<dct_length;index++)
113
new_samples[index] = shl_nocheck(new_samples[index],mag_shift);
120
/* Get the first half of the windowed samples */
122
out_ptr = out_samples;
125
if (dct_length==DCT_LENGTH)
127
win_new = rmlt_to_samples_window;
129
win_old = rmlt_to_samples_window + dct_length;
134
win_new = max_rmlt_to_samples_window;
136
win_old = max_rmlt_to_samples_window + dct_length;
139
old_ptr = old_samples;
141
new_ptr = new_samples + half_dct_size;
144
for (vals_left = half_dct_size; vals_left > 0; vals_left--)
148
sum = L_mac(sum,*win_new++, *--new_ptr);
149
sum = L_mac(sum,*--win_old, *old_ptr++);
150
*out_ptr++ = itu_round(L_shl_nocheck(sum,2));
155
/* Get the second half of the windowed samples */
157
for (vals_left = half_dct_size; vals_left > 0; vals_left--)
161
sum = L_mac(sum,*win_new++, *new_ptr++);
162
sum = L_mac(sum,negate(*--win_old), *--old_ptr);
163
*out_ptr++ = itu_round(L_shl_nocheck(sum,2));
167
/* Save the second half of the new samples for */
168
/* next time, when they will be the old samples. */
170
/* pointer arithmetic */
171
new_ptr = new_samples + half_dct_size;
173
old_ptr = old_samples;
175
for (vals_left = half_dct_size; vals_left > 0; vals_left--)
177
*old_ptr++ = *new_ptr++;