| 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 |
#if !defined(_G722_H_) |
| 28 |
#define _G722_H_ |
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
enum |
| 44 |
{ |
| 45 |
G722_SAMPLE_RATE_8000 = 0x0001, |
| 46 |
G722_PACKED = 0x0002 |
| 47 |
}; |
| 48 |
|
| 49 |
#ifndef INT16_MAX |
| 50 |
#define INT16_MAX 32767 |
| 51 |
#endif |
| 52 |
#ifndef INT16_MIN |
| 53 |
#define INT16_MIN (-32768) |
| 54 |
#endif |
| 55 |
|
| 56 |
typedef struct |
| 57 |
{ |
| 58 |
|
| 59 |
|
| 60 |
int itu_test_mode; |
| 61 |
|
| 62 |
int packed; |
| 63 |
|
| 64 |
int eight_k; |
| 65 |
|
| 66 |
int bits_per_sample; |
| 67 |
|
| 68 |
|
| 69 |
int x[24]; |
| 70 |
|
| 71 |
struct |
| 72 |
{ |
| 73 |
int s; |
| 74 |
int sp; |
| 75 |
int sz; |
| 76 |
int r[3]; |
| 77 |
int a[3]; |
| 78 |
int ap[3]; |
| 79 |
int p[3]; |
| 80 |
int d[7]; |
| 81 |
int b[7]; |
| 82 |
int bp[7]; |
| 83 |
int sg[7]; |
| 84 |
int nb; |
| 85 |
int det; |
| 86 |
} band[2]; |
| 87 |
|
| 88 |
unsigned int in_buffer; |
| 89 |
int in_bits; |
| 90 |
unsigned int out_buffer; |
| 91 |
int out_bits; |
| 92 |
} g722_encode_state_t; |
| 93 |
|
| 94 |
typedef struct |
| 95 |
{ |
| 96 |
|
| 97 |
|
| 98 |
int itu_test_mode; |
| 99 |
|
| 100 |
int packed; |
| 101 |
|
| 102 |
int eight_k; |
| 103 |
|
| 104 |
int bits_per_sample; |
| 105 |
|
| 106 |
|
| 107 |
int x[24]; |
| 108 |
|
| 109 |
struct |
| 110 |
{ |
| 111 |
int s; |
| 112 |
int sp; |
| 113 |
int sz; |
| 114 |
int r[3]; |
| 115 |
int a[3]; |
| 116 |
int ap[3]; |
| 117 |
int p[3]; |
| 118 |
int d[7]; |
| 119 |
int b[7]; |
| 120 |
int bp[7]; |
| 121 |
int sg[7]; |
| 122 |
int nb; |
| 123 |
int det; |
| 124 |
} band[2]; |
| 125 |
|
| 126 |
unsigned int in_buffer; |
| 127 |
int in_bits; |
| 128 |
unsigned int out_buffer; |
| 129 |
int out_bits; |
| 130 |
} g722_decode_state_t; |
| 131 |
|
| 132 |
#ifdef __cplusplus |
| 133 |
extern "C" { |
| 134 |
#endif |
| 135 |
|
| 136 |
g722_encode_state_t *g722_encode_init(g722_encode_state_t *s, int rate, int options); |
| 137 |
int g722_encode_release(g722_encode_state_t *s); |
| 138 |
int g722_encode(g722_encode_state_t *s, uint8_t g722_data[], const int16_t amp[], int len); |
| 139 |
|
| 140 |
g722_decode_state_t *g722_decode_init(g722_decode_state_t *s, int rate, int options); |
| 141 |
int g722_decode_release(g722_decode_state_t *s); |
| 142 |
int g722_decode(g722_decode_state_t *s, int16_t amp[], const uint8_t g722_data[], int len); |
| 143 |
|
| 144 |
#ifdef __cplusplus |
| 145 |
} |
| 146 |
#endif |
| 147 |
|
| 148 |
#endif |