1 /*____________________________________________________________________________ 2 3 FreeAmp - The Free MP3 Player 4 5 MP3 Decoder originally Copyright (C) 1995-1997 Xing Technology 6 Corp. http://www.xingtech.com 7 8 Portions Copyright (C) 1998 EMusic.com 9 10 This program is free software; you can redistribute it and/or modify 11 it under the terms of the GNU General Public License as published by 12 the Free Software Foundation; either version 2 of the License, or 13 (at your option) any later version. 14 15 This program is distributed in the hope that it will be useful, 16 but WITHOUT ANY WARRANTY; without even the implied warranty of 17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 GNU General Public License for more details. 19 20 You should have received a copy of the GNU General Public License 21 along with this program; if not, write to the Free Software 22 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 23 24 $Id: itype.h,v 1.3 2000/10/13 14:29:02 ijr Exp $ 25 ____________________________________________________________________________*/ 26 27 /*--------------------------------------------------------------- 28 29 mpeg Layer II audio decoder, integer version 30 variable type control 31 32 -----------------------------------------------------------------*/ 33 /*----------------------------------------------------------------- 34 Variable types can have a large impact on performance. If the 35 native type int is 32 bit or better, setting all variables to the 36 native int is probably the best bet. Machines with fast floating 37 point handware will probably run faster with the floating point 38 version of this decoder. 39 40 On 16 bit machines, use the native 16 bit int where possible 41 with special consideration given to the multiplies used in 42 the dct and window (see below). 43 44 45 The code uses the type INT32 when 32 or more bits are required. 46 Use the native int if possible. 47 Signed types are required for all but DCTCOEF which may be unsigned. 48 49 THe major parts of the decoder are: bit stream unpack (iup.c), 50 dct (cidct.c), and window (iwinq.c). The compute time relationship 51 is usually unpack < dct < window. 52 53 -------------------------------------------------------------------*/ 54 55 /*-------------- dct cidct.c ------------------------------------------- 56 dct input is type SAMPLEINT, output is WININT 57 58 DCTCOEF: dct coefs, 16 or more bits required 59 DCTBITS: fractional bits in dct coefs. Coefs are unsigned in 60 the range 0.50 to 10.2. DCTBITS=10 is a compromise 61 between precision and the possibility of overflowing 62 intermediate results. 63 64 65 DCTSATURATE: If set, saturates dct output to 16 bit. 66 Dct output may overflow if WININT is 16 bit, overflow 67 is rare, but very noisy. Define to 1 for 16 bit WININT. 68 Define to 0 otherwise. 69 70 The multiply used in the dct (routine forward_bf in cidct.c) requires 71 the multiplication of a 32 bit variable by a 16 bit unsigned coef 72 to produce a signed 32 bit result. On 16 bit machines this could be 73 faster than a full 32x32 multiply. 74 75 ------------------------------------------------------------------*/ 76 /*-------------- WINDOW iwinq.c --------------------------------------- 77 window input is type WININT, output is short (16 bit pcm audio) 78 79 window coefs WINBITS fractional bits, 80 coefs are signed range in -1.15 to 0.96. 81 WINBITS=14 is maximum for 16 bit signed representation. 82 Some CPU's will multiply faster with fewer bits. 83 WINBITS less that 8 may cause noticeable quality loss. 84 85 WINMULT defines the multiply used in the window (iwinq.c) 86 WINMULT must produce a 32 bit (or better) result, although both 87 multipliers may be 16 bit. A 16x16-->32 multiply may offer 88 a performance advantage if the compiler can be coerced into 89 doing the right thing. 90 ------------------------------------------------------------------*/ 91 /*-- settings for MS C++ 4.0 flat 32 bit (long=int=32bit) --*/ 92 /*-- asm replacement modules must use these settings ---*/ 93 #ifndef ITYPES_H 94 #define ITYPES_H 95 96 #ifdef WIN32 97 #include <basetsd.h> 98 #endif 99 100 #ifndef WIN32 101 typedef long INT32; 102 typedef unsigned long UINT32; 103 #endif 104 105 typedef int SAMPLEINT; 106 107 typedef int DCTCOEF; 108 109 #define DCTBITS 10 110 #define DCTSATURATE 0 111 112 typedef int WININT; 113 typedef int WINCOEF; 114 115 #define WINBITS 10 116 #define WINMULT(x,coef) ((x)*(coef)) 117 #endif