15e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh/* 25e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische 35e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh * Universitaet Berlin. See the accompanying file "COPYRIGHT" for 45e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. 55e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh */ 65e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 75e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh/*$Header: /tmp_amd/presto/export/kbs/jutta/src/gsm/RCS/private.h,v 1.6 1996/07/02 10:15:26 jutta Exp $*/ 85e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 95e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh#ifndef PRIVATE_H 105e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh#define PRIVATE_H 115e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 125e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yehtypedef short word; /* 16 bit signed int */ 135e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yehtypedef long longword; /* 32 bit signed int */ 145e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 155e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yehtypedef unsigned short uword; /* unsigned word */ 165e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yehtypedef unsigned long ulongword; /* unsigned longword */ 175e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 185e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yehstruct gsm_state { 195e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 205e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word dp0[ 280 ]; 215e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word e[ 50 ]; /* code.c */ 225e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 235e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word z1; /* preprocessing.c, Offset_com. */ 245e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh longword L_z2; /* Offset_com. */ 255e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh int mp; /* Preemphasis */ 265e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 275e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word u[8]; /* short_term_aly_filter.c */ 285e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word LARpp[2][8]; /* */ 295e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word j; /* */ 305e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 315e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word ltp_cut; /* long_term.c, LTP crosscorr. */ 325e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word nrp; /* 40 */ /* long_term.c, synthesis */ 335e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word v[9]; /* short_term.c, synthesis */ 345e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word msr; /* decoder.c, Postprocessing */ 355e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 365e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh char verbose; /* only used if !NDEBUG */ 375e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh char fast; /* only used if FAST */ 385e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 395e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh char wav_fmt; /* only used if WAV49 defined */ 405e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh unsigned char frame_index; /* odd/even chaining */ 415e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh unsigned char frame_chain; /* half-byte to carry forward */ 425e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh}; 435e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 445e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 455e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh#define MIN_WORD (-32767 - 1) 465e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh#define MAX_WORD 32767 475e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 485e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh#define MIN_LONGWORD (-2147483647 - 1) 495e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh#define MAX_LONGWORD 2147483647 505e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 515e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh#ifdef SASR /* flag: >> is a signed arithmetic shift right */ 525e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh#undef SASR 535e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh#define SASR(x, by) ((x) >> (by)) 545e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh#else 555e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh#define SASR(x, by) ((x) >= 0 ? (x) >> (by) : (~(-((x) + 1) >> (by)))) 565e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh#endif /* SASR */ 575e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 585e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh#include "proto.h" 595e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 605e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh/* 615e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh * Prototypes from add.c 625e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh */ 635e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yehextern word gsm_mult P((word a, word b)); 645e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yehextern longword gsm_L_mult P((word a, word b)); 655e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yehextern word gsm_mult_r P((word a, word b)); 665e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 675e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yehextern word gsm_div P((word num, word denum)); 685e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 695e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yehextern word gsm_add P(( word a, word b )); 705e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yehextern longword gsm_L_add P(( longword a, longword b )); 715e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 725e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yehextern word gsm_sub P((word a, word b)); 735e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yehextern longword gsm_L_sub P((longword a, longword b)); 745e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 755e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yehextern word gsm_abs P((word a)); 765e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 775e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yehextern word gsm_norm P(( longword a )); 785e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 795e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yehextern longword gsm_L_asl P((longword a, int n)); 805e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yehextern word gsm_asl P((word a, int n)); 815e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 825e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yehextern longword gsm_L_asr P((longword a, int n)); 835e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yehextern word gsm_asr P((word a, int n)); 845e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 855e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh/* 865e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh * Inlined functions from add.h 875e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh */ 885e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 895e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh/* 905e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh * #define GSM_MULT_R(a, b) (* word a, word b, !(a == b == MIN_WORD) *) \ 915e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh * (0x0FFFF & SASR(((longword)(a) * (longword)(b) + 16384), 15)) 925e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh */ 935e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh#define GSM_MULT_R(a, b) /* word a, word b, !(a == b == MIN_WORD) */ \ 945e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh (SASR( ((longword)(a) * (longword)(b) + 16384), 15 )) 955e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 965e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh# define GSM_MULT(a,b) /* word a, word b, !(a == b == MIN_WORD) */ \ 975e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh (SASR( ((longword)(a) * (longword)(b)), 15 )) 985e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 995e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh# define GSM_L_MULT(a, b) /* word a, word b */ \ 1005e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh (((longword)(a) * (longword)(b)) << 1) 1015e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 1025e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh# define GSM_L_ADD(a, b) \ 1035e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh ( (a) < 0 ? ( (b) >= 0 ? (a) + (b) \ 1045e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh : (utmp = (ulongword)-((a) + 1) + (ulongword)-((b) + 1)) \ 1055e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh >= MAX_LONGWORD ? MIN_LONGWORD : -(longword)utmp-2 ) \ 1065e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh : ((b) <= 0 ? (a) + (b) \ 1075e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh : (utmp = (ulongword)(a) + (ulongword)(b)) >= MAX_LONGWORD \ 1085e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh ? MAX_LONGWORD : utmp)) 1095e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 1105e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh/* 1115e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh * # define GSM_ADD(a, b) \ 1125e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh * ((ltmp = (longword)(a) + (longword)(b)) >= MAX_WORD \ 1135e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh * ? MAX_WORD : ltmp <= MIN_WORD ? MIN_WORD : ltmp) 1145e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh */ 1155e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh/* Nonportable, but faster: */ 1165e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 1175e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh#define GSM_ADD(a, b) \ 1185e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh ((ulongword)((ltmp = (longword)(a) + (longword)(b)) - MIN_WORD) > \ 1195e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh MAX_WORD - MIN_WORD ? (ltmp > 0 ? MAX_WORD : MIN_WORD) : ltmp) 1205e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 1215e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh# define GSM_SUB(a, b) \ 1225e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh ((ltmp = (longword)(a) - (longword)(b)) >= MAX_WORD \ 1235e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh ? MAX_WORD : ltmp <= MIN_WORD ? MIN_WORD : ltmp) 1245e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 1255e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh# define GSM_ABS(a) ((a) < 0 ? ((a) == MIN_WORD ? MAX_WORD : -(a)) : (a)) 1265e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 1275e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh/* Use these if necessary: 1285e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 1295e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh# define GSM_MULT_R(a, b) gsm_mult_r(a, b) 1305e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh# define GSM_MULT(a, b) gsm_mult(a, b) 1315e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh# define GSM_L_MULT(a, b) gsm_L_mult(a, b) 1325e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 1335e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh# define GSM_L_ADD(a, b) gsm_L_add(a, b) 1345e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh# define GSM_ADD(a, b) gsm_add(a, b) 1355e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh# define GSM_SUB(a, b) gsm_sub(a, b) 1365e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 1375e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh# define GSM_ABS(a) gsm_abs(a) 1385e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 1395e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh*/ 1405e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 1415e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh/* 1425e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh * More prototypes from implementations.. 1435e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh */ 1445e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yehextern void Gsm_Coder P(( 1455e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh struct gsm_state * S, 1465e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word * s, /* [0..159] samples IN */ 1475e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word * LARc, /* [0..7] LAR coefficients OUT */ 1485e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word * Nc, /* [0..3] LTP lag OUT */ 1495e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word * bc, /* [0..3] coded LTP gain OUT */ 1505e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word * Mc, /* [0..3] RPE grid selection OUT */ 1515e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word * xmaxc,/* [0..3] Coded maximum amplitude OUT */ 1525e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word * xMc /* [13*4] normalized RPE samples OUT */)); 1535e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 1545e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yehextern void Gsm_Long_Term_Predictor P(( /* 4x for 160 samples */ 1555e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh struct gsm_state * S, 1565e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word * d, /* [0..39] residual signal IN */ 1575e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word * dp, /* [-120..-1] d' IN */ 1585e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word * e, /* [0..40] OUT */ 1595e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word * dpp, /* [0..40] OUT */ 1605e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word * Nc, /* correlation lag OUT */ 1615e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word * bc /* gain factor OUT */)); 1625e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 1635e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yehextern void Gsm_LPC_Analysis P(( 1645e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh struct gsm_state * S, 1655e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word * s, /* 0..159 signals IN/OUT */ 1665e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word * LARc)); /* 0..7 LARc's OUT */ 1675e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 1685e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yehextern void Gsm_Preprocess P(( 1695e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh struct gsm_state * S, 1705e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word * s, word * so)); 1715e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 1725e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yehextern void Gsm_Encoding P(( 1735e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh struct gsm_state * S, 1745e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word * e, 1755e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word * ep, 1765e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word * xmaxc, 1775e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word * Mc, 1785e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word * xMc)); 1795e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 1805e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yehextern void Gsm_Short_Term_Analysis_Filter P(( 1815e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh struct gsm_state * S, 1825e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word * LARc, /* coded log area ratio [0..7] IN */ 1835e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word * d /* st res. signal [0..159] IN/OUT */)); 1845e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 1855e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yehextern void Gsm_Decoder P(( 1865e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh struct gsm_state * S, 1875e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word * LARcr, /* [0..7] IN */ 1885e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word * Ncr, /* [0..3] IN */ 1895e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word * bcr, /* [0..3] IN */ 1905e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word * Mcr, /* [0..3] IN */ 1915e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word * xmaxcr, /* [0..3] IN */ 1925e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word * xMcr, /* [0..13*4] IN */ 1935e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word * s)); /* [0..159] OUT */ 1945e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 1955e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yehextern void Gsm_Decoding P(( 1965e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh struct gsm_state * S, 1975e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word xmaxcr, 1985e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word Mcr, 1995e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word * xMcr, /* [0..12] IN */ 2005e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word * erp)); /* [0..39] OUT */ 2015e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 2025e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yehextern void Gsm_Long_Term_Synthesis_Filtering P(( 2035e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh struct gsm_state* S, 2045e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word Ncr, 2055e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word bcr, 2065e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word * erp, /* [0..39] IN */ 2075e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word * drp)); /* [-120..-1] IN, [0..40] OUT */ 2085e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 2095e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yehvoid Gsm_RPE_Decoding P(( 2105e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh struct gsm_state *S, 2115e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word xmaxcr, 2125e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word Mcr, 2135e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word * xMcr, /* [0..12], 3 bits IN */ 2145e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word * erp)); /* [0..39] OUT */ 2155e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 2165e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yehvoid Gsm_RPE_Encoding P(( 2175e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh struct gsm_state * S, 2185e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word * e, /* -5..-1][0..39][40..44 IN/OUT */ 2195e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word * xmaxc, /* OUT */ 2205e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word * Mc, /* OUT */ 2215e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word * xMc)); /* [0..12] OUT */ 2225e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 2235e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yehextern void Gsm_Short_Term_Synthesis_Filter P(( 2245e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh struct gsm_state * S, 2255e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word * LARcr, /* log area ratios [0..7] IN */ 2265e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word * drp, /* received d [0...39] IN */ 2275e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word * s)); /* signal s [0..159] OUT */ 2285e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 2295e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yehextern void Gsm_Update_of_reconstructed_short_time_residual_signal P(( 2305e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word * dpp, /* [0...39] IN */ 2315e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word * ep, /* [0...39] IN */ 2325e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh word * dp)); /* [-120...-1] IN/OUT */ 2335e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 2345e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh/* 2355e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh * Tables from table.c 2365e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh */ 2375e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh#ifndef GSM_TABLE_C 2385e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 2395e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yehextern word gsm_A[8], gsm_B[8], gsm_MIC[8], gsm_MAC[8]; 2405e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yehextern word gsm_INVA[8]; 2415e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yehextern word gsm_DLB[4], gsm_QLB[4]; 2425e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yehextern word gsm_H[11]; 2435e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yehextern word gsm_NRFAC[8]; 2445e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yehextern word gsm_FAC[8]; 2455e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 2465e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh#endif /* GSM_TABLE_C */ 2475e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 2485e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh/* 2495e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh * Debugging 2505e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh */ 2515e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh#ifdef NDEBUG 2525e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 2535e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh# define gsm_debug_words(a, b, c, d) /* nil */ 2545e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh# define gsm_debug_longwords(a, b, c, d) /* nil */ 2555e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh# define gsm_debug_word(a, b) /* nil */ 2565e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh# define gsm_debug_longword(a, b) /* nil */ 2575e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 2585e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh#else /* !NDEBUG => DEBUG */ 2595e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 2605e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh extern void gsm_debug_words P((char * name, int, int, word *)); 2615e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh extern void gsm_debug_longwords P((char * name, int, int, longword *)); 2625e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh extern void gsm_debug_longword P((char * name, longword)); 2635e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh extern void gsm_debug_word P((char * name, word)); 2645e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 2655e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh#endif /* !NDEBUG */ 2665e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 2675e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh#include "unproto.h" 2685e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh 2695e4516958690b9a1b2c98f88eeecba3edd2dbda4Chia-chi Yeh#endif /* PRIVATE_H */ 270