Only compile fastmemcpybench on x86.
[mplayer/glamo.git] / libmpcodecs / native / xa_gsm_int.h
blob40a31a8cb34a97a5c58fffbc0eacfe6b04257edf
1 /********************************************************************
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.
7 * The contents of the file COPYRIGHT:
9 * Any use of this software is permitted provided that this notice is not
10 * removed and that neither the authors nor the Technische Universitaet Berlin
11 * are deemed to have made any representations as to the suitability of this
12 * software for any purpose nor are held responsible for any defects of
13 * this software. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
15 * As a matter of courtesy, the authors request to be informed about uses
16 * this software has found, about bugs in this software, and about any
17 * improvements that may be of general interest.
19 * Berlin, 15.09.1992
20 * Jutta Degener
21 * Carsten Bormann
23 ********************************************************************/
25 #ifndef MPLAYER_XA_GSM_INT_H
26 #define MPLAYER_XA_GSM_INT_H
28 #include "xa_gsm.h"
31 typedef short word; /* 16 bit signed int */
32 typedef int longword; /* 32 bit signed int */
34 typedef unsigned short uword; /* unsigned word */
35 typedef unsigned int ulongword; /* unsigned longword */
37 typedef struct {
39 word dp0[ 280 ];
41 word z1; /* preprocessing.c, Offset_com. */
42 longword L_z2; /* Offset_com. */
43 int mp; /* Preemphasis */
45 word u[8]; /* short_term_aly_filter.c */
46 word LARpp[2][8]; /* */
47 word j; /* */
49 word ltp_cut; /* long_term.c, LTP crosscorr. */
50 word nrp; /* 40 */ /* long_term.c, synthesis */
51 word v[9]; /* short_term.c, synthesis */
52 word msr; /* decoder.c, Postprocessing */
54 char verbose; /* only used if !NDEBUG */
55 char fast; /* only used if FAST */
57 char wav_fmt; /* only used if WAV49 defined */
58 unsigned char frame_index; /* odd/even chaining */
59 unsigned char frame_chain; /* half-byte to carry forward */
60 } XA_GSM_STATE;
63 #define MIN_WORD (-32767 - 1)
64 #define MAX_WORD 32767
66 #define MIN_LONGWORD (-2147483647 - 1)
67 #define MAX_LONGWORD 2147483647
69 #ifdef SASR /* flag: >> is a signed arithmetic shift right */
70 #undef SASR
71 #define SASR(x, by) ((x) >> (by))
72 #else
73 #define SASR(x, by) ((x) >= 0 ? (x) >> (by) : (~(-((x) + 1) >> (by))))
74 #endif /* SASR */
79 * Inlined functions from add.h
82 /*
83 * #define GSM_MULT_R(a, b) (* word a, word b, !(a == b == MIN_WORD) *) \
84 * (0x0FFFF & SASR(((longword)(a) * (longword)(b) + 16384), 15))
86 #define GSM_MULT_R(a, b) /* word a, word b, !(a == b == MIN_WORD) */ \
87 (SASR( ((longword)(a) * (longword)(b) + 16384), 15 ))
89 # define GSM_MULT(a,b) /* word a, word b, !(a == b == MIN_WORD) */ \
90 (SASR( ((longword)(a) * (longword)(b)), 15 ))
92 # define GSM_L_MULT(a, b) /* word a, word b */ \
93 (((longword)(a) * (longword)(b)) << 1)
95 # define GSM_L_ADD(a, b) \
96 ( (a) < 0 ? ( (b) >= 0 ? (a) + (b) \
97 : (utmp = (ulongword)-((a) + 1) + (ulongword)-((b) + 1)) \
98 >= MAX_LONGWORD ? MIN_LONGWORD : -(longword)utmp-2 ) \
99 : ((b) <= 0 ? (a) + (b) \
100 : (utmp = (ulongword)(a) + (ulongword)(b)) >= MAX_LONGWORD \
101 ? MAX_LONGWORD : utmp))
104 * # define GSM_ADD(a, b) \
105 * ((ltmp = (longword)(a) + (longword)(b)) >= MAX_WORD \
106 * ? MAX_WORD : ltmp <= MIN_WORD ? MIN_WORD : ltmp)
108 /* Nonportable, but faster: */
110 #define GSM_ADD(a, b) \
111 ((ulongword)((ltmp = (longword)(a) + (longword)(b)) - MIN_WORD) > \
112 MAX_WORD - MIN_WORD ? (ltmp > 0 ? MAX_WORD : MIN_WORD) : ltmp)
114 # define GSM_SUB(a, b) \
115 ((ltmp = (longword)(a) - (longword)(b)) >= MAX_WORD \
116 ? MAX_WORD : ltmp <= MIN_WORD ? MIN_WORD : ltmp)
118 # define GSM_ABS(a) ((a) < 0 ? ((a) == MIN_WORD ? MAX_WORD : -(a)) : (a))
120 /* Use these if necessary:
122 # define GSM_MULT_R(a, b) gsm_mult_r(a, b)
123 # define GSM_MULT(a, b) gsm_mult(a, b)
124 # define GSM_L_MULT(a, b) gsm_L_mult(a, b)
126 # define GSM_L_ADD(a, b) gsm_L_add(a, b)
127 # define GSM_ADD(a, b) gsm_add(a, b)
128 # define GSM_SUB(a, b) gsm_sub(a, b)
130 # define GSM_ABS(a) gsm_abs(a)
134 #endif /* MPLAYER_XA_GSM_INT_H */