Changeset 195 for libmpc/branches/r2d/mpcenc/mpcenc.h
- Timestamp:
- 12/29/06 15:21:35 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libmpc/branches/r2d/mpcenc/mpcenc.h
r173 r195 18 18 */ 19 19 20 #ifndef MP PENC_MPPENC_H21 #define MP PENC_MPPENC_H20 #ifndef MPCENC_MPCENC_H 21 #define MPCENC_MPCENC_H 22 22 23 23 #include "libmpcenc.h" … … 26 26 #include <mpc/minimax.h> 27 27 28 #include "mppdec.h" 29 30 #define WIN32_MESSAGES 1 // support Windows-Messaging to Frontend 31 32 // analyse_filter.c 33 #define X_MEM 1152 28 //// optimization/feature defines ////////////////////////////////// 29 #ifndef NOT_INCLUDE_CONFIG_H 30 # include "config.h" 31 #endif 32 33 //// portable system includes ////////////////////////////////////// 34 #include <stddef.h> 35 #include <math.h> 36 37 //// system dependent system includes ////////////////////////////// 38 // low level I/O, where are prototypes and constants? 39 #if defined _WIN32 || defined __TURBOC__ || defined __ZTC__ || defined _MSC_VER 40 # include <io.h> 41 #elif defined __unix__ || defined __linux__ || defined __APPLE__ 42 # include <unistd.h> 43 #else 44 // .... add Includes for new Operating System here (with prefix: #elif defined) 45 # include <unistd.h> 46 #endif 47 48 #if defined __linux__ 49 # include <fpu_control.h> 50 #elif defined __FreeBSD__ 51 # include <machine/floatingpoint.h> 52 #elif defined _MSC_VER 53 # include <float.h> 54 #endif 55 56 57 #if !defined(__APPLE__) 58 // use optimized assembler routines for Pentium III/K6-2/Athlon (only 32 bit OS, Intel x86 and no MAKE_xxBITS) 59 // you need the NASM assembler on your system, the program becomes a little bit larger and decoding 60 // on AMD K6-2 (x3), AMD K6-III (x3), AMD Duron (x1.7), AMD Athlon (x1.7), Pentium III (x2) and Pentium 4 (x1.8) becomes faster 61 #define USE_ASM 62 63 #endif 64 65 // Use termios for reading values from keyboard without echo and ENTER 66 #define USE_TERMIOS 67 68 // make debug output in tags.c stfu 69 #define STFU 70 71 #if INT_MAX < 2147483647L 72 # undef USE_ASM 73 #endif 74 75 #ifndef O_BINARY 76 # ifdef _O_BINARY 77 # define O_BINARY _O_BINARY 78 # else 79 # define O_BINARY 0 80 # endif 81 #endif 82 83 #if defined _WIN32 || defined __TURBOC__ 84 # define strncasecmp(__s1,__s2,__n) strnicmp ((__s1), (__s2), (__n)) 85 # define strcasecmp(__s1,__s2) stricmp ((__s1), (__s2)) 86 #endif 87 88 #if defined _WIN32 89 # include <direct.h> 90 # define snprintf _snprintf 91 # define getcwd(__buff,__len) _getcwd ((__buff), (__len)) 92 #endif 93 94 //// Binary/Low-Level-IO /////////////////////////////////////////// 95 // 96 97 #if defined __BORLANDC__ || defined _WIN32 98 # define FILENO(__fp) _fileno ((__fp)) 99 #elif defined __CYGWIN__ || defined __TURBOC__ || defined __unix__ || defined __EMX__ || defined _MSC_VER 100 # define FILENO(__fp) fileno ((__fp)) 101 #else 102 # define FILENO(__fp) fileno ((__fp)) 103 #endif 104 105 106 // 107 // If we have access to a file via file name, we can open the file with an 108 // additional "b" or a O_BINARY within the (f)open function to get a 109 // transparent untranslated data stream which is necessary for audio bitstream 110 // data and also for PCM data. If we are working with 111 // stdin/stdout/FILENO_STDIN/FILENO_STDOUT we can't open the file with these 112 // attributes, because the files are already open. So we need a non 113 // standardized sequence to switch to this mode (not necessary for Unix). 114 // Mostly the sequence is the same for incoming and outgoing streams, but only 115 // mostly so we need one for IN and one for OUT. 116 // Macros are called with the file pointer and you get back the untransalted file 117 // pointer which can be equal or different from the original. 118 // 119 120 #if defined __EMX__ 121 # define SETBINARY_IN(__fp) (_fsetmode ( (__fp), "b" ), (__fp)) 122 # define SETBINARY_OUT(__fp) (_fsetmode ( (__fp), "b" ), (__fp)) 123 #elif defined __TURBOC__ || defined __BORLANDC__ 124 # define SETBINARY_IN(__fp) (setmode ( FILENO ((__fp)), O_BINARY ), (__fp)) 125 # define SETBINARY_OUT(__fp) (setmode ( FILENO ((__fp)), O_BINARY ), (__fp)) 126 #elif defined __CYGWIN__ 127 # define SETBINARY_IN(__fp) (setmode ( FILENO ((__fp)), _O_BINARY ), (__fp)) 128 # define SETBINARY_OUT(__fp) (setmode ( FILENO ((__fp)), _O_BINARY ), (__fp)) 129 #elif defined _WIN32 130 # define SETBINARY_IN(__fp) (_setmode ( FILENO ((__fp)), _O_BINARY ), (__fp)) 131 # define SETBINARY_OUT(__fp) (_setmode ( FILENO ((__fp)), _O_BINARY ), (__fp)) 132 #elif defined _MSC_VER 133 # define SETBINARY_IN(__fp) (setmode ( FILENO ((__fp)), O_BINARY ), (__fp)) 134 # define SETBINARY_OUT(__fp) (setmode ( FILENO ((__fp)), O_BINARY ), (__fp)) 135 #elif defined __unix__ 136 # define SETBINARY_IN(__fp) (__fp) 137 # define SETBINARY_OUT(__fp) (__fp) 138 #elif 0 139 # define SETBINARY_IN(__fp) (freopen ( NULL, "rb", (__fp) ), (__fp)) 140 # define SETBINARY_OUT(__fp) (freopen ( NULL, "wb", (__fp) ), (__fp)) 141 #else 142 # define SETBINARY_IN(__fp) (__fp) 143 # define SETBINARY_OUT(__fp) (__fp) 144 #endif 145 146 // file I/O using ANSI buffered file I/O via file pointer FILE* (fopen, fread, fwrite, fclose) 147 #define READ(fp,ptr,len) fread (ptr, 1, len, fp) // READ returns -1 or 0 on error/EOF, otherwise > 0 148 #define READ1(fp,ptr) fread (ptr, 1, 1, fp) // READ returns -1 or 0 on error/EOF, otherwise > 0 149 150 #ifdef _WIN32 151 # define POPEN_READ_BINARY_OPEN(cmd) _popen ((cmd), "rb") 152 #else 153 # define POPEN_READ_BINARY_OPEN(cmd) popen ((cmd), "r") 154 #endif 155 156 // Path separator 157 #if defined __unix__ || defined __bsdi__ || defined __FreeBSD__ || defined __OpenBSD__ || defined __NetBSD__ || defined __APPLE__ 158 # define PATH_SEP '/' 159 # define DRIVE_SEP '\0' 160 # define EXE_EXT "" 161 # define DEV_NULL "/dev/null" 162 # define ENVPATH_SEP ':' 163 #elif defined _WIN32 || defined __TURBOC__ || defined __ZTC__ || defined _MSC_VER 164 # define PATH_SEP '\\' 165 # define DRIVE_SEP ':' 166 # define EXE_EXT ".exe" 167 # define DEV_NULL "\\nul" 168 # define ENVPATH_SEP ';' 169 #else 170 # define PATH_SEP '/' // Amiga: C:/ 171 # define DRIVE_SEP ':' 172 # define EXE_EXT "" 173 # define DEV_NULL "nul" 174 # define ENVPATH_SEP ';' 175 #endif 176 177 #ifdef _WIN32 178 # define TitleBar(text) SetConsoleTitle (text) 179 #else 180 # define TitleBar(text) (void) (text) 181 #endif 182 183 184 //// constants ///////////////////////////////////////////////////// 185 #define DECODER_DELAY (512 - 32 + 1) 186 #define BLK_SIZE (36 * 32) 187 188 189 //// procedures/functions ////////////////////////////////////////// 190 // pipeopen.c 191 FILE* pipeopen ( const char* command, const char* filename ); 192 193 // stderr.c 194 void SetStderrSilent ( mpc_bool_t state ); 195 mpc_bool_t GetStderrSilent ( void ); 196 int mpc_cdecl stderr_printf ( const char* format, ... ); 34 197 35 198 // quant.h … … 37 200 38 201 // wave_in.h 39 40 202 typedef struct { 41 203 FILE* fp; // File pointer to read data 42 UlongPCMOffset; // File offset of PCM data204 mpc_size_t PCMOffset; // File offset of PCM data 43 205 long double SampleFreq; // Sample frequency in Hz 44 UintBitsPerSample; // used bits per sample, 8*BytesPerSample-7 <= BitsPerSample <= BytesPerSample45 UintBytesPerSample; // allocated bytes per sample46 UintChannels; // Number of channels, 1...847 UintMax_tPCMBytes; // PCM Samples (in 8 bit units)48 UintMax_tPCMSamples; // PCM Samples per Channel49 Bool_traw; // raw: headerless format206 mpc_uint_t BitsPerSample; // used bits per sample, 8*BytesPerSample-7 <= BitsPerSample <= BytesPerSample 207 mpc_uint_t BytesPerSample; // allocated bytes per sample 208 mpc_uint_t Channels; // Number of channels, 1...8 209 mpc_size_t PCMBytes; // PCM Samples (in 8 bit units) 210 mpc_size_t PCMSamples; // PCM Samples per Channel 211 mpc_bool_t raw; // raw: headerless format 50 212 } wave_t; 213 214 typedef float SCFTriple [3]; 51 215 52 216 // FIXME : put in lib header … … 121 285 void writeBitstream_SV8 ( mpc_encoder_t*, int, const SubbandQuantTyp*); 122 286 123 124 125 126 void Huffman_SV7_Encoder ( void );127 128 129 287 // keyboard.c 130 288 int WaitKey ( void ); … … 153 311 // winmsg.c 154 312 #ifdef _WIN32 313 #define WIN32_MESSAGES 1 // support Windows-Messaging to Frontend 155 314 int SearchForFrontend ( void ); 156 315 void SendQuitMessage ( void ); … … 159 318 void SendProgressMessage ( const int, const float, const float ); 160 319 #else 161 # undef WIN32_MESSAGES162 320 # define WIN32_MESSAGES 0 163 321 # define SearchForFrontend() (0) … … 173 331 #define MPPENC_DENORMAL_FIX_RIGHT ( MPPENC_DENORMAL_FIX_BASE * 0.5f ) 174 332 175 176 #endif /* MPPENC_MPPENC_H */177 178 #if 0179 # define LAST_HUFFMAN 15180 # define DUMP_HIGHRES181 #endif182 183 #if 0184 # define DUMP_RES15185 #endif186 187 333 #ifndef LAST_HUFFMAN 188 334 # define LAST_HUFFMAN 7 189 335 #endif 190 336 337 #endif /* MPCENC_MPCENC_H */ 338 191 339 /* end of mpcenc.h */
Note: See TracChangeset
for help on using the changeset viewer.