| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
#ifndef PRIVATE_H |
| 10 |
#define PRIVATE_H |
| 11 |
|
| 12 |
typedef short word; |
| 13 |
typedef long longword; |
| 14 |
|
| 15 |
typedef unsigned short uword; |
| 16 |
typedef unsigned long ulongword; |
| 17 |
|
| 18 |
struct gsm_state { |
| 19 |
|
| 20 |
word dp0[ 280 ]; |
| 21 |
|
| 22 |
word z1; |
| 23 |
longword L_z2; |
| 24 |
int mp; |
| 25 |
|
| 26 |
word u[8]; |
| 27 |
word LARpp[2][8]; |
| 28 |
word j; |
| 29 |
|
| 30 |
word ltp_cut; |
| 31 |
word nrp; |
| 32 |
word v[9]; |
| 33 |
word msr; |
| 34 |
|
| 35 |
char verbose; |
| 36 |
char fast; |
| 37 |
|
| 38 |
}; |
| 39 |
|
| 40 |
|
| 41 |
#define MIN_WORD ((-32767)-1) |
| 42 |
#define MAX_WORD ( 32767) |
| 43 |
|
| 44 |
#define MIN_LONGWORD ((-2147483647)-1) |
| 45 |
#define MAX_LONGWORD ( 2147483647) |
| 46 |
|
| 47 |
#ifdef SASR |
| 48 |
#undef SASR |
| 49 |
#define SASR(x, by) ((x) >> (by)) |
| 50 |
#endif |
| 51 |
|
| 52 |
|
| 53 |
#include "proto.h" |
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
extern word gsm_mult P((word a, word b)); |
| 59 |
extern longword gsm_L_mult P((word a, word b)); |
| 60 |
extern word gsm_mult_r P((word a, word b)); |
| 61 |
|
| 62 |
extern word gsm_div P((word num, word denum)); |
| 63 |
|
| 64 |
extern word gsm_add P(( word a, word b )); |
| 65 |
extern longword gsm_L_add P(( longword a, longword b )); |
| 66 |
|
| 67 |
extern word gsm_sub P((word a, word b)); |
| 68 |
extern longword gsm_L_sub P((longword a, longword b)); |
| 69 |
|
| 70 |
extern word gsm_abs P((word a)); |
| 71 |
|
| 72 |
extern word gsm_norm P(( longword a )); |
| 73 |
|
| 74 |
extern longword gsm_L_asl P((longword a, int n)); |
| 75 |
extern word gsm_asl P((word a, int n)); |
| 76 |
|
| 77 |
extern longword gsm_L_asr P((longword a, int n)); |
| 78 |
extern word gsm_asr P((word a, int n)); |
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
#define GSM_MULT_R(a, b) \ |
| 89 |
(SASR( ((longword)(a) * (longword)(b) + 16384), 15 )) |
| 90 |
|
| 91 |
# define GSM_MULT(a,b) \ |
| 92 |
(SASR( ((longword)(a) * (longword)(b)), 15 )) |
| 93 |
|
| 94 |
# define GSM_L_MULT(a, b) \ |
| 95 |
(((longword)(a) * (longword)(b)) << 1) |
| 96 |
|
| 97 |
# define GSM_L_ADD(a, b) \ |
| 98 |
( (a) < 0 ? ( (b) >= 0 ? (a) + (b) \ |
| 99 |
: (utmp = (ulongword)-((a) + 1) + (ulongword)-((b) + 1)) \ |
| 100 |
>= MAX_LONGWORD ? MIN_LONGWORD : -(longword)utmp-2 ) \ |
| 101 |
: ((b) <= 0 ? (a) + (b) \ |
| 102 |
: (utmp = (ulongword)(a) + (ulongword)(b)) >= MAX_LONGWORD \ |
| 103 |
? MAX_LONGWORD : utmp)) |
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
#define GSM_ADD(a, b) \ |
| 113 |
((ulongword)((ltmp = (longword)(a) + (longword)(b)) - MIN_WORD) > \ |
| 114 |
MAX_WORD - MIN_WORD ? (ltmp > 0 ? MAX_WORD : MIN_WORD) : ltmp) |
| 115 |
|
| 116 |
# define GSM_SUB(a, b) \ |
| 117 |
((ltmp = (longword)(a) - (longword)(b)) >= MAX_WORD \ |
| 118 |
? MAX_WORD : ltmp <= MIN_WORD ? MIN_WORD : ltmp) |
| 119 |
|
| 120 |
# define GSM_ABS(a) ((a) < 0 ? ((a) == MIN_WORD ? MAX_WORD : -(a)) : (a)) |
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
|
| 139 |
extern void Gsm_Coder P(( |
| 140 |
struct gsm_state * S, |
| 141 |
word * s, |
| 142 |
word * LARc, |
| 143 |
word * Nc, |
| 144 |
word * bc, |
| 145 |
word * Mc, |
| 146 |
word * xmaxc, |
| 147 |
word * xMc )); |
| 148 |
|
| 149 |
extern void Gsm_Long_Term_Predictor P(( |
| 150 |
struct gsm_state * S, |
| 151 |
word * d, |
| 152 |
word * dp, |
| 153 |
word * e, |
| 154 |
word * dpp, |
| 155 |
word * Nc, |
| 156 |
word * bc )); |
| 157 |
|
| 158 |
extern void Gsm_LPC_Analysis P(( |
| 159 |
struct gsm_state * S, |
| 160 |
word * s, |
| 161 |
word * LARc)); |
| 162 |
|
| 163 |
extern void Gsm_Preprocess P(( |
| 164 |
struct gsm_state * S, |
| 165 |
word * s, word * so)); |
| 166 |
|
| 167 |
extern void Gsm_Encoding P(( |
| 168 |
struct gsm_state * S, |
| 169 |
word * e, |
| 170 |
word * ep, |
| 171 |
word * xmaxc, |
| 172 |
word * Mc, |
| 173 |
word * xMc)); |
| 174 |
|
| 175 |
extern void Gsm_Short_Term_Analysis_Filter P(( |
| 176 |
struct gsm_state * S, |
| 177 |
word * LARc, |
| 178 |
word * d )); |
| 179 |
|
| 180 |
extern void Gsm_Decoder P(( |
| 181 |
struct gsm_state * S, |
| 182 |
word * LARcr, |
| 183 |
word * Ncr, |
| 184 |
word * bcr, |
| 185 |
word * Mcr, |
| 186 |
word * xmaxcr, |
| 187 |
word * xMcr, |
| 188 |
word * s)); |
| 189 |
|
| 190 |
extern void Gsm_Decoding P(( |
| 191 |
struct gsm_state * S, |
| 192 |
word xmaxcr, |
| 193 |
word Mcr, |
| 194 |
word * xMcr, |
| 195 |
word * erp)); |
| 196 |
|
| 197 |
extern void Gsm_Long_Term_Synthesis_Filtering P(( |
| 198 |
struct gsm_state* S, |
| 199 |
word Ncr, |
| 200 |
word bcr, |
| 201 |
word * erp, |
| 202 |
word * drp)); |
| 203 |
|
| 204 |
void Gsm_RPE_Decoding P(( |
| 205 |
struct gsm_state *S, |
| 206 |
word xmaxcr, |
| 207 |
word Mcr, |
| 208 |
word * xMcr, |
| 209 |
word * erp)); |
| 210 |
|
| 211 |
void Gsm_RPE_Encoding P(( |
| 212 |
struct gsm_state * S, |
| 213 |
word * e, |
| 214 |
word * xmaxc, |
| 215 |
word * Mc, |
| 216 |
word * xMc)); |
| 217 |
|
| 218 |
extern void Gsm_Short_Term_Synthesis_Filter P(( |
| 219 |
struct gsm_state * S, |
| 220 |
word * LARcr, |
| 221 |
word * drp, |
| 222 |
word * s)); |
| 223 |
|
| 224 |
extern void Gsm_Update_of_reconstructed_short_time_residual_signal P(( |
| 225 |
word * dpp, |
| 226 |
word * ep, |
| 227 |
word * dp)); |
| 228 |
|
| 229 |
|
| 230 |
|
| 231 |
|
| 232 |
#ifndef GSM_TABLE_C |
| 233 |
|
| 234 |
extern word gsm_A[8], gsm_B[8], gsm_MIC[8], gsm_MAC[8]; |
| 235 |
extern word gsm_INVA[8]; |
| 236 |
extern word gsm_DLB[4], gsm_QLB[4]; |
| 237 |
extern word gsm_H[11]; |
| 238 |
extern word gsm_NRFAC[8]; |
| 239 |
extern word gsm_FAC[8]; |
| 240 |
|
| 241 |
#endif |
| 242 |
|
| 243 |
|
| 244 |
|
| 245 |
|
| 246 |
#ifdef NDEBUG |
| 247 |
|
| 248 |
# define gsm_debug_words(a, b, c, d) |
| 249 |
# define gsm_debug_longwords(a, b, c, d) |
| 250 |
# define gsm_debug_word(a, b) |
| 251 |
# define gsm_debug_longword(a, b) |
| 252 |
|
| 253 |
#else |
| 254 |
|
| 255 |
extern void gsm_debug_words P((char * name, int, int, word *)); |
| 256 |
extern void gsm_debug_longwords P((char * name, int, int, longword *)); |
| 257 |
extern void gsm_debug_longword P((char * name, longword)); |
| 258 |
extern void gsm_debug_word P((char * name, word)); |
| 259 |
|
| 260 |
#endif |
| 261 |
|
| 262 |
#include "unproto.h" |
| 263 |
|
| 264 |
#endif |