This repository has been archived by the owner on Jan 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathde_acelp.c
74 lines (57 loc) · 1.67 KB
/
de_acelp.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*
ITU-T G.729A Speech Coder with Annex B ANSI-C Source Code
*/
/*
----------------------------------------------------------------------
COPYRIGHT NOTICE
----------------------------------------------------------------------
ITU-T G.729 Annex C ANSI C source code
Copyright (C) 1998, AT&T, France Telecom, NTT, University of
Sherbrooke. All rights reserved.
----------------------------------------------------------------------
*/
#include "typedef.h"
#include "ld8a.h"
/*-----------------------------------------------------------*
* Function decod_ACELP() *
* ~~~~~~~~~~~~~~~~~~~~~~~ *
* Algebraic codebook decoder. *
*----------------------------------------------------------*/
void decod_ACELP(
int sign, /* input : signs of 4 pulses */
int index, /* input : positions of 4 pulses */
FLOAT cod[] /* output: innovative codevector */
)
{
int pos[4];
int i, j;
/* decode the positions of 4 pulses */
i = index & 7;
pos[0] = i*5;
index >>= 3;
i = index & 7;
pos[1] = i*5 + 1;
index >>= 3;
i = index & 7;
pos[2] = i*5 + 2;
index >>= 3;
j = index & 1;
index >>= 1;
i = index & 7;
pos[3] = i*5 + 3 + j;
/* find the algebraic codeword */
set_zero(cod, L_SUBFR);
/* decode the signs of 4 pulses */
for (j=0; j<4; j++)
{
i = sign & 1;
sign >>= 1;
if (i != 0) {
cod[pos[j]] = (F)1.0;
}
else {
cod[pos[j]] = (F)-1.0;
}
}
return;
}