Ignore:
Timestamp:
12/29/06 15:21:35 (18 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.c

    r194 r195  
    3636int           APE_Version     = 2000;
    3737int           LowDelay        = 0;
    38 Bool_t        EnableTags      = MPC_FALSE;
    39 Bool_t        IsEndBeep       = MPC_FALSE;
     38mpc_bool_t    EnableTags      = MPC_FALSE;
     39mpc_bool_t    IsEndBeep       = MPC_FALSE;
    4040
    4141#define MODE_OVERWRITE          0
     
    4848unsigned int  verbose         = 0;      // more information during output
    4949unsigned int  NoUnicode       = 1;      // console is unicode or not (tag translation)
    50 UintMax_t     SamplesInWAVE   = 0;      // number of samples per channel in the WAV file
     50mpc_uint64_t    SamplesInWAVE   = 0;      // number of samples per channel in the WAV file
    5151float         MaxOverFlow     = 0.f;    // maximum overflow
    5252float         ScalingFactorl  = 1.f;    // Scaling the input signal
     
    5757float         SkipTime        = 0.f;    // Skip the beginning of the file (sec)
    5858double        Duration        = 1.e+99; // Maximum encoded audio length
    59 Bool_t        FrontendPresent = 0;      // Flag for frontend-detection
    60 Bool_t        XLevel          = 1;      // Encode extreme levels with relative SCFs
     59mpc_bool_t    FrontendPresent = 0;      // Flag for frontend-detection
     60mpc_bool_t    XLevel          = 1;      // Encode extreme levels with relative SCFs
    6161
    6262#if MPPENC_MINOR % 2 == 0
     
    115115
    116116    echo_off ();
    117     ret = READ1 ( STDIN, buff );
     117    ret = READ1 ( stdin, buff );
    118118    echo_on ();
    119119    return ret == 1  ?  buff[0]  :  -1;
     
    430430    for ( n = 0; n < BLOCK; n++, N++ ) {
    431431        idx           = n + CENTER;
    432         fadeout_pos   = UintMAX_FP(SamplesInWAVE - N) * inv_fs;
     432        fadeout_pos   = (long double)(SamplesInWAVE - N) * inv_fs;
    433433        scale         = fadeout_pos / FadeOutTime;
    434434        scale         = bump (scale);
     
    13121312
    13131313static const char*
    1314 PrintTime ( PsyModel* m, UintMax_t samples, int sign )
     1314PrintTime ( PsyModel* m, mpc_uint64_t samples, int sign )
    13151315{
    13161316    static char  ret [32];
    1317         Ulong        tmp  = (Ulong) ( UintMAX_FP(samples) * 100. / m->SampleFreq );
    1318     Uint         hour = (Uint)  ( tmp / 360000     );
    1319     Uint         min  = (Uint)  ( tmp / 6000 %  60 );
    1320     Uint         sec  = (Uint)  ( tmp / 100  %  60 );
    1321     Uint         csec = (Uint)  ( tmp        % 100 );
    1322 
    1323 
    1324         if ( UintMAX_FP(samples) >= m->SampleFreq * 360000. )
     1317        mpc_uint32_t tmp  = (mpc_uint32_t) ( (long double)(samples) * 100. / m->SampleFreq );
     1318    mpc_uint_t   hour = (mpc_uint_t)  ( tmp / 360000     );
     1319    mpc_uint_t   min  = (mpc_uint_t)  ( tmp / 6000 %  60 );
     1320    mpc_uint_t   sec  = (mpc_uint_t)  ( tmp / 100  %  60 );
     1321    mpc_uint_t   csec = (mpc_uint_t)  ( tmp        % 100 );
     1322
     1323
     1324        if ( (long double)(samples) >= m->SampleFreq * 360000. )
    13251325        return "            ";
    13261326    else if ( hour > 9 )
     
    13401340static void
    13411341ShowProgress ( PsyModel* m,
    1342                            UintMax_t  samples,
    1343                UintMax_t  total_samples,
    1344                UintMax_t  databits )
     1342                           mpc_uint64_t  samples,
     1343               mpc_uint64_t  total_samples,
     1344               mpc_uint64_t  databits )
    13451345{
    13461346    static clock_t  start;
     
    13631363        return;
    13641364
    1365     percent     = 100.f    * UintMAX_FP(samples) / UintMAX_FP(total_samples);
    1366         kbps        =   1.e-3f * UintMAX_FP(databits) * m->SampleFreq / UintMAX_FP(samples);
    1367         speed       =   1.f    * UintMAX_FP(samples) * (CLOCKS_PER_SEC / m->SampleFreq) / (unsigned long)(curr - start) ;
    1368     total_estim =   1.f    * UintMAX_FP(total_samples) / UintMAX_FP(samples) * (unsigned long)(curr - start);
     1365    percent     = 100.f    * (long double)(samples) / (long double)(total_samples);
     1366        kbps        =   1.e-3f * (long double)(databits) * m->SampleFreq / (long double)(samples);
     1367        speed       =   1.f    * (long double)(samples) * (CLOCKS_PER_SEC / m->SampleFreq) / (unsigned long)(curr - start) ;
     1368    total_estim =   1.f    * (long double)(total_samples) / (long double)(samples) * (unsigned long)(curr - start);
    13691369
    13701370    // progress percent
    1371     if ( total_samples < IntMax_MAX )
     1371        if ( total_samples < mpc_int64_max )
    13721372        stderr_printf ("\r%5.1f ", percent );
    13731373    else
     
    15211521    SubbandQuantTyp  Q [32];                    // Subband samples after quantization
    15221522    wave_t           Wave;                      // contains WAV-files arguments
    1523     UintMax_t        AllSamplesRead   =    0;   // overall read Samples per channel
     1523    mpc_uint64_t        AllSamplesRead   =    0;   // overall read Samples per channel
    15241524    unsigned int     CurrentRead      =    0;   // current read Samples per channel
    15251525    unsigned int     N;                         // counter for processed frames
     
    15951595        return 1;
    15961596
    1597     if ( UintMAX_FP(SamplesInWAVE) >= Wave.SampleFreq * (SkipTime + Duration) ) {
     1597    if ( (long double)(SamplesInWAVE) >= Wave.SampleFreq * (SkipTime + Duration) ) {
    15981598        SamplesInWAVE = Wave.SampleFreq * (SkipTime + Duration);
    15991599    }
     
    16021602
    16031603    // check fade-length
    1604     if ( FadeInTime + FadeOutTime > UintMAX_FP(SamplesInWAVE) / Wave.SampleFreq ) {
     1604    if ( FadeInTime + FadeOutTime > (long double)(SamplesInWAVE) / Wave.SampleFreq ) {
    16051605        stderr_printf ( "WARNING: Duration of fade in + out exceeds file length!\n");
    1606         FadeInTime = FadeOutTime = 0.5 * UintMAX_FP(SamplesInWAVE) / Wave.SampleFreq;
     1606        FadeInTime = FadeOutTime = 0.5 * (long double)(SamplesInWAVE) / Wave.SampleFreq;
    16071607    }
    16081608
     
    16621662    if ( myfeof (Wave.fp) ) {
    16631663        stderr_printf ( "WAVE file has incorrect header: header: %.3f s, contents: %.3f s    \n",
    1664                                                 UintMAX_FP(AllSamplesRead) / m.SampleFreq, UintMAX_FP(SamplesInWAVE) / m.SampleFreq );
     1664                                                (long double)(AllSamplesRead) / m.SampleFreq, (long double)(SamplesInWAVE) / m.SampleFreq );
    16651665        SamplesInWAVE = AllSamplesRead;
    16661666    }
    16671667
    1668     for ( N = 0; (UintMax_t)N * BLOCK < SamplesInWAVE + DECODER_DELAY; N++ ) {
     1668    for ( N = 0; (mpc_uint64_t)N * BLOCK < SamplesInWAVE + DECODER_DELAY; N++ ) {
    16691669
    16701670        // setting residual data-fields to zero
     
    16801680        /*********************************************************************************/
    16811681        if ( FadeInTime  > 0. )
    1682             if ( FadeInTime  > UintMAX_FP(BLOCK         + (UintMax_t)N*BLOCK) / Wave.SampleFreq )
     1682            if ( FadeInTime  > (long double)(BLOCK         + (mpc_uint64_t)N*BLOCK) / Wave.SampleFreq )
    16831683                Fading_In  ( &Main, N*BLOCK, Wave.SampleFreq );
    16841684        if ( FadeOutTime > 0. )
    1685             if ( FadeOutTime > UintMAX_FP(SamplesInWAVE - (UintMax_t)N*BLOCK) / Wave.SampleFreq )
     1685            if ( FadeOutTime > (long double)(SamplesInWAVE - (mpc_uint64_t)N*BLOCK) / Wave.SampleFreq )
    16861686                Fading_Out ( &Main, N*BLOCK, Wave.SampleFreq );
    16871687
     
    17161716        writeBitstream_SV8 ( &e, m.Max_Band, Q );                                                // write SV7-Bitstream
    17171717
    1718         if ( (Int)(time (NULL) - T) >= 0 ) {                            // output
     1718        if ( (int)(time (NULL) - T) >= 0 ) {                            // output
    17191719            T += labs (DisplayUpdateTime);
    1720                         ShowProgress (&m, (UintMax_t)(N+1) * BLOCK, SamplesInWAVE, e.outputBits );
     1720                        ShowProgress (&m, (mpc_uint64_t)(N+1) * BLOCK, SamplesInWAVE, e.outputBits );
    17211721        }
    17221722
     
    17331733        if ( myfeof (Wave.fp) ) {
    17341734            stderr_printf ( "WAVE file has incorrect header: header: %.3f s, contents: %.3f s    \n",
    1735                                                         UintMAX_FP(AllSamplesRead) / m.SampleFreq, UintMAX_FP(SamplesInWAVE) / m.SampleFreq );
     1735                                                        (long double)(AllSamplesRead) / m.SampleFreq, (long double)(SamplesInWAVE) / m.SampleFreq );
    17361736            SamplesInWAVE = AllSamplesRead;
    17371737        }
     
    17691769
    17701770/************ The main() function *****************************/
    1771 int Cdecl
     1771int mpc_cdecl
    17721772main ( int argc, char** argv )
    17731773{
    17741774    int  ret;
    1775 
    1776 #if (defined USE_OSS_AUDIO  ||  defined USE_ESD_AUDIO  ||  defined USE_SUN_AUDIO)  &&  (defined USE_REALTIME  ||  defined USE_NICE)
    1777     // DisableSUID ();
    1778 #endif
    17791775
    17801776#ifdef _OS2
Note: See TracChangeset for help on using the changeset viewer.