Mercurial > mplayer.hg
comparison libmpcodecs/native/xa_gsm_int.h @ 5603:5f4485862a72
native codecs files moved to libmpcodecs/native/
author | arpi |
---|---|
date | Sat, 13 Apr 2002 18:04:24 +0000 |
parents | xa/xa_gsm_int.h@3b5f5d1c5041 |
children | 3826d2cfa4b0 |
comparison
equal
deleted
inserted
replaced
5602:628c85c15c7b | 5603:5f4485862a72 |
---|---|
1 /******************************************************************** | |
2 * | |
3 * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische | |
4 * Universitaet Berlin. See the accompanying file "COPYRIGHT" for | |
5 * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. | |
6 * | |
7 ********************************************************************/ | |
8 | |
9 #include "xa_gsm.h" | |
10 | |
11 | |
12 typedef short word; /* 16 bit signed int */ | |
13 typedef int longword; /* 32 bit signed int */ | |
14 | |
15 typedef unsigned short uword; /* unsigned word */ | |
16 typedef unsigned int ulongword; /* unsigned longword */ | |
17 | |
18 typedef struct { | |
19 | |
20 word dp0[ 280 ]; | |
21 | |
22 word z1; /* preprocessing.c, Offset_com. */ | |
23 longword L_z2; /* Offset_com. */ | |
24 int mp; /* Preemphasis */ | |
25 | |
26 word u[8]; /* short_term_aly_filter.c */ | |
27 word LARpp[2][8]; /* */ | |
28 word j; /* */ | |
29 | |
30 word ltp_cut; /* long_term.c, LTP crosscorr. */ | |
31 word nrp; /* 40 */ /* long_term.c, synthesis */ | |
32 word v[9]; /* short_term.c, synthesis */ | |
33 word msr; /* decoder.c, Postprocessing */ | |
34 | |
35 char verbose; /* only used if !NDEBUG */ | |
36 char fast; /* only used if FAST */ | |
37 | |
38 char wav_fmt; /* only used if WAV49 defined */ | |
39 unsigned char frame_index; /* odd/even chaining */ | |
40 unsigned char frame_chain; /* half-byte to carry forward */ | |
41 } XA_GSM_STATE; | |
42 | |
43 | |
44 #define MIN_WORD (-32767 - 1) | |
45 #define MAX_WORD 32767 | |
46 | |
47 #define MIN_LONGWORD (-2147483647 - 1) | |
48 #define MAX_LONGWORD 2147483647 | |
49 | |
50 #ifdef SASR /* flag: >> is a signed arithmetic shift right */ | |
51 #undef SASR | |
52 #define SASR(x, by) ((x) >> (by)) | |
53 #else | |
54 #define SASR(x, by) ((x) >= 0 ? (x) >> (by) : (~(-((x) + 1) >> (by)))) | |
55 #endif /* SASR */ | |
56 | |
57 | |
58 | |
59 /* | |
60 * Inlined functions from add.h | |
61 */ | |
62 | |
63 /* | |
64 * #define GSM_MULT_R(a, b) (* word a, word b, !(a == b == MIN_WORD) *) \ | |
65 * (0x0FFFF & SASR(((longword)(a) * (longword)(b) + 16384), 15)) | |
66 */ | |
67 #define GSM_MULT_R(a, b) /* word a, word b, !(a == b == MIN_WORD) */ \ | |
68 (SASR( ((longword)(a) * (longword)(b) + 16384), 15 )) | |
69 | |
70 # define GSM_MULT(a,b) /* word a, word b, !(a == b == MIN_WORD) */ \ | |
71 (SASR( ((longword)(a) * (longword)(b)), 15 )) | |
72 | |
73 # define GSM_L_MULT(a, b) /* word a, word b */ \ | |
74 (((longword)(a) * (longword)(b)) << 1) | |
75 | |
76 # define GSM_L_ADD(a, b) \ | |
77 ( (a) < 0 ? ( (b) >= 0 ? (a) + (b) \ | |
78 : (utmp = (ulongword)-((a) + 1) + (ulongword)-((b) + 1)) \ | |
79 >= MAX_LONGWORD ? MIN_LONGWORD : -(longword)utmp-2 ) \ | |
80 : ((b) <= 0 ? (a) + (b) \ | |
81 : (utmp = (ulongword)(a) + (ulongword)(b)) >= MAX_LONGWORD \ | |
82 ? MAX_LONGWORD : utmp)) | |
83 | |
84 /* | |
85 * # define GSM_ADD(a, b) \ | |
86 * ((ltmp = (longword)(a) + (longword)(b)) >= MAX_WORD \ | |
87 * ? MAX_WORD : ltmp <= MIN_WORD ? MIN_WORD : ltmp) | |
88 */ | |
89 /* Nonportable, but faster: */ | |
90 | |
91 #define GSM_ADD(a, b) \ | |
92 ((ulongword)((ltmp = (longword)(a) + (longword)(b)) - MIN_WORD) > \ | |
93 MAX_WORD - MIN_WORD ? (ltmp > 0 ? MAX_WORD : MIN_WORD) : ltmp) | |
94 | |
95 # define GSM_SUB(a, b) \ | |
96 ((ltmp = (longword)(a) - (longword)(b)) >= MAX_WORD \ | |
97 ? MAX_WORD : ltmp <= MIN_WORD ? MIN_WORD : ltmp) | |
98 | |
99 # define GSM_ABS(a) ((a) < 0 ? ((a) == MIN_WORD ? MAX_WORD : -(a)) : (a)) | |
100 | |
101 /* Use these if necessary: | |
102 | |
103 # define GSM_MULT_R(a, b) gsm_mult_r(a, b) | |
104 # define GSM_MULT(a, b) gsm_mult(a, b) | |
105 # define GSM_L_MULT(a, b) gsm_L_mult(a, b) | |
106 | |
107 # define GSM_L_ADD(a, b) gsm_L_add(a, b) | |
108 # define GSM_ADD(a, b) gsm_add(a, b) | |
109 # define GSM_SUB(a, b) gsm_sub(a, b) | |
110 | |
111 # define GSM_ABS(a) gsm_abs(a) | |
112 | |
113 */ | |
114 |