Ignore:
Timestamp:
12/29/06 15:21:35 (17 years ago)
Author:
r2d
Message:
  • moved libmpcdec includes in /mpc
  • removed mppdec.h and mpp.h
  • mpcenc defines cleanup
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libmpc/branches/r2d/mpcenc/mpcenc.h

    r173 r195  
    1818 */
    1919
    20 #ifndef MPPENC_MPPENC_H
    21 #define MPPENC_MPPENC_H
     20#ifndef MPCENC_MPCENC_H
     21#define MPCENC_MPCENC_H
    2222
    2323#include "libmpcenc.h"
     
    2626#include <mpc/minimax.h>
    2727
    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
     191FILE*      pipeopen                   ( const char* command, const char* filename );
     192
     193// stderr.c
     194void       SetStderrSilent            ( mpc_bool_t state );
     195mpc_bool_t GetStderrSilent            ( void );
     196int mpc_cdecl  stderr_printf              ( const char* format, ... );
    34197
    35198// quant.h
     
    37200
    38201// wave_in.h
    39 
    40202typedef struct {
    41203    FILE*         fp;                   // File pointer to read data
    42     Ulong         PCMOffset;            // File offset of PCM data
     204    mpc_size_t    PCMOffset;            // File offset of PCM data
    43205    long double   SampleFreq;           // Sample frequency in Hz
    44     Uint          BitsPerSample;        // used bits per sample, 8*BytesPerSample-7 <= BitsPerSample <= BytesPerSample
    45     Uint          BytesPerSample;       // allocated bytes per sample
    46     Uint          Channels;             // Number of channels, 1...8
    47     UintMax_t     PCMBytes;             // PCM Samples (in 8 bit units)
    48     UintMax_t     PCMSamples;           // PCM Samples per Channel
    49     Bool_t        raw;                  // raw: headerless format
     206    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
    50212} wave_t;
     213
     214typedef float SCFTriple [3];
    51215
    52216// FIXME : put in lib header
     
    121285void writeBitstream_SV8 ( mpc_encoder_t*, int, const SubbandQuantTyp*);
    122286
    123 
    124 
    125 
    126 void    Huffman_SV7_Encoder ( void );
    127 
    128 
    129287// keyboard.c
    130288int    WaitKey      ( void );
     
    153311// winmsg.c
    154312#ifdef _WIN32
     313#define WIN32_MESSAGES      1                   // support Windows-Messaging to Frontend
    155314int    SearchForFrontend   ( void );
    156315void   SendQuitMessage     ( void );
     
    159318void   SendProgressMessage ( const int, const float, const float );
    160319#else
    161 # undef  WIN32_MESSAGES
    162320# define WIN32_MESSAGES                 0
    163321# define SearchForFrontend()            (0)
     
    173331#define MPPENC_DENORMAL_FIX_RIGHT ( MPPENC_DENORMAL_FIX_BASE * 0.5f )
    174332
    175 
    176 #endif /* MPPENC_MPPENC_H */
    177 
    178 #if 0
    179 # define LAST_HUFFMAN   15
    180 # define DUMP_HIGHRES
    181 #endif
    182 
    183 #if 0
    184 # define DUMP_RES15
    185 #endif
    186 
    187333#ifndef LAST_HUFFMAN
    188334# define LAST_HUFFMAN    7
    189335#endif
    190336
     337#endif /* MPCENC_MPCENC_H */
     338
    191339/* end of mpcenc.h */
Note: See TracChangeset for help on using the changeset viewer.