Changeset 195 for libmpc/branches/r2d/mpcenc/mpcenc.c
- Timestamp:
- 12/29/06 15:21:35 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libmpc/branches/r2d/mpcenc/mpcenc.c
r194 r195 36 36 int APE_Version = 2000; 37 37 int LowDelay = 0; 38 Bool_tEnableTags = MPC_FALSE;39 Bool_tIsEndBeep = MPC_FALSE;38 mpc_bool_t EnableTags = MPC_FALSE; 39 mpc_bool_t IsEndBeep = MPC_FALSE; 40 40 41 41 #define MODE_OVERWRITE 0 … … 48 48 unsigned int verbose = 0; // more information during output 49 49 unsigned int NoUnicode = 1; // console is unicode or not (tag translation) 50 UintMax_tSamplesInWAVE = 0; // number of samples per channel in the WAV file50 mpc_uint64_t SamplesInWAVE = 0; // number of samples per channel in the WAV file 51 51 float MaxOverFlow = 0.f; // maximum overflow 52 52 float ScalingFactorl = 1.f; // Scaling the input signal … … 57 57 float SkipTime = 0.f; // Skip the beginning of the file (sec) 58 58 double Duration = 1.e+99; // Maximum encoded audio length 59 Bool_tFrontendPresent = 0; // Flag for frontend-detection60 Bool_tXLevel = 1; // Encode extreme levels with relative SCFs59 mpc_bool_t FrontendPresent = 0; // Flag for frontend-detection 60 mpc_bool_t XLevel = 1; // Encode extreme levels with relative SCFs 61 61 62 62 #if MPPENC_MINOR % 2 == 0 … … 115 115 116 116 echo_off (); 117 ret = READ1 ( STDIN, buff );117 ret = READ1 ( stdin, buff ); 118 118 echo_on (); 119 119 return ret == 1 ? buff[0] : -1; … … 430 430 for ( n = 0; n < BLOCK; n++, N++ ) { 431 431 idx = n + CENTER; 432 fadeout_pos = UintMAX_FP(SamplesInWAVE - N) * inv_fs;432 fadeout_pos = (long double)(SamplesInWAVE - N) * inv_fs; 433 433 scale = fadeout_pos / FadeOutTime; 434 434 scale = bump (scale); … … 1312 1312 1313 1313 static const char* 1314 PrintTime ( PsyModel* m, UintMax_t samples, int sign )1314 PrintTime ( PsyModel* m, mpc_uint64_t samples, int sign ) 1315 1315 { 1316 1316 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. ) 1325 1325 return " "; 1326 1326 else if ( hour > 9 ) … … 1340 1340 static void 1341 1341 ShowProgress ( 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 ) 1345 1345 { 1346 1346 static clock_t start; … … 1363 1363 return; 1364 1364 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); 1369 1369 1370 1370 // progress percent 1371 if ( total_samples < IntMax_MAX)1371 if ( total_samples < mpc_int64_max ) 1372 1372 stderr_printf ("\r%5.1f ", percent ); 1373 1373 else … … 1521 1521 SubbandQuantTyp Q [32]; // Subband samples after quantization 1522 1522 wave_t Wave; // contains WAV-files arguments 1523 UintMax_t AllSamplesRead = 0; // overall read Samples per channel1523 mpc_uint64_t AllSamplesRead = 0; // overall read Samples per channel 1524 1524 unsigned int CurrentRead = 0; // current read Samples per channel 1525 1525 unsigned int N; // counter for processed frames … … 1595 1595 return 1; 1596 1596 1597 if ( UintMAX_FP(SamplesInWAVE) >= Wave.SampleFreq * (SkipTime + Duration) ) {1597 if ( (long double)(SamplesInWAVE) >= Wave.SampleFreq * (SkipTime + Duration) ) { 1598 1598 SamplesInWAVE = Wave.SampleFreq * (SkipTime + Duration); 1599 1599 } … … 1602 1602 1603 1603 // check fade-length 1604 if ( FadeInTime + FadeOutTime > UintMAX_FP(SamplesInWAVE) / Wave.SampleFreq ) {1604 if ( FadeInTime + FadeOutTime > (long double)(SamplesInWAVE) / Wave.SampleFreq ) { 1605 1605 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; 1607 1607 } 1608 1608 … … 1662 1662 if ( myfeof (Wave.fp) ) { 1663 1663 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 ); 1665 1665 SamplesInWAVE = AllSamplesRead; 1666 1666 } 1667 1667 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++ ) { 1669 1669 1670 1670 // setting residual data-fields to zero … … 1680 1680 /*********************************************************************************/ 1681 1681 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 ) 1683 1683 Fading_In ( &Main, N*BLOCK, Wave.SampleFreq ); 1684 1684 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 ) 1686 1686 Fading_Out ( &Main, N*BLOCK, Wave.SampleFreq ); 1687 1687 … … 1716 1716 writeBitstream_SV8 ( &e, m.Max_Band, Q ); // write SV7-Bitstream 1717 1717 1718 if ( ( Int)(time (NULL) - T) >= 0 ) { // output1718 if ( (int)(time (NULL) - T) >= 0 ) { // output 1719 1719 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 ); 1721 1721 } 1722 1722 … … 1733 1733 if ( myfeof (Wave.fp) ) { 1734 1734 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 ); 1736 1736 SamplesInWAVE = AllSamplesRead; 1737 1737 } … … 1769 1769 1770 1770 /************ The main() function *****************************/ 1771 int Cdecl1771 int mpc_cdecl 1772 1772 main ( int argc, char** argv ) 1773 1773 { 1774 1774 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 #endif1779 1775 1780 1776 #ifdef _OS2
Note: See TracChangeset
for help on using the changeset viewer.