home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2004 March / PCWELT_3_2004.ISO / pcwsoft / flaskmpeg_078_39_src.z.exe / flaskmpeg / Audio / MPEG / Layer2.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2002-10-28  |  14.4 KB  |  573 lines

  1. #include <crtdbg.h>
  2. #include <string.h>
  3.  
  4. #include <stdio.h>
  5.  
  6. #include "AMPDecoder.h"
  7.  
  8. ////////////////////////////////////////////////////////////////////////////
  9.  
  10. //#define RDTSC_PROFILE
  11.  
  12. #ifdef RDTSC_PROFILE
  13.  
  14.     #include <windows.h>
  15.  
  16.     static long p_lasttime;
  17.     static long p_frames=0;
  18.     static __int64 p_total=0;
  19.     static __int64 p_read=0;
  20.     static __int64 p_bitalloc=0;
  21.     static __int64 p_scfsi=0;
  22.     static __int64 p_scalefac=0;
  23.     static __int64 p_decode=0;
  24.     static __int64 p_polyphase=0;
  25.  
  26.     static void __inline profile_set(int) {
  27.         __asm {
  28.             rdtsc
  29.             mov        p_lasttime,eax
  30.         };
  31.     }
  32.  
  33.     static void __inline profile_add(__int64& counter) {
  34.         long diff;
  35.  
  36.         __asm {
  37.             rdtsc
  38.             sub        eax,p_lasttime
  39.             mov        diff,eax
  40.         }
  41.  
  42.         counter += diff;
  43.         p_total += diff;
  44.  
  45.         __asm {
  46.             rdtsc
  47.             mov        p_lasttime,eax
  48.  
  49.         }
  50.     }
  51. #else
  52.  
  53.     #define profile_set(x)
  54.     #define profile_add(x)
  55.  
  56. #endif
  57.  
  58. ////////////////////////////////////////////////////////////////////////////
  59.  
  60. // 'c' table
  61.  
  62. static const double c_f_tab[17] = {
  63. #if 0
  64. #define F(c,steps) ( 32768.0 * (c) * 2.0 / ((steps)+1) )
  65.  
  66.     F(1.33333333333,3),
  67.     F(1.60000000000,7),
  68.     F(1.14285714286,7),
  69.     F(1.77777777777,15),
  70.     F(1.06666666666,15),
  71.     F(1.03225806452,31),
  72.     F(1.01587301587,63),
  73.     F(1.00787401575,127),
  74.     F(1.00392156863,255),
  75.     F(1.00195694716,511),
  76.     F(1.00097751711,1023),
  77.     F(1.00048851979,2047),
  78.     F(1.00024420024,4095),
  79.     F(1.00012208522,8191),
  80.     F(1.00006103888,16383),
  81.     F(1.00003051851,32767),
  82.     F(1.00001525902,65535),
  83. #else
  84. #define F(steps1, steps0) (32767.0 * 2.0 / (double)steps0)
  85.  
  86.     F(    4, 3),
  87.     F(    8, 5),
  88.     F(    8, 7),
  89.     F(   16, 9),
  90.     F(   16, 15),
  91.     F(   32, 31),
  92.     F(   64, 63),
  93.     F(  128, 127),
  94.     F(  256, 255),
  95.     F(  512, 511),
  96.     F( 1024, 1023),
  97.     F( 2048, 2047),
  98.     F( 4096, 4095),
  99.     F( 8192, 8191),
  100.     F(16384, 16383),
  101.     F(32768, 32767),
  102.     F(65536, 65535),
  103. #endif
  104.  
  105. #undef F
  106.  
  107. };
  108.  
  109. static const double scalefactors[64] = {
  110. 2.00000000000000, 1.58740105196820, 1.25992104989487,
  111. 1.00000000000000, 0.79370052598410, 0.62996052494744, 0.50000000000000,
  112. 0.39685026299205, 0.31498026247372, 0.25000000000000, 0.19842513149602,
  113. 0.15749013123686, 0.12500000000000, 0.09921256574801, 0.07874506561843,
  114. 0.06250000000000, 0.04960628287401, 0.03937253280921, 0.03125000000000,
  115. 0.02480314143700, 0.01968626640461, 0.01562500000000, 0.01240157071850,
  116. 0.00984313320230, 0.00781250000000, 0.00620078535925, 0.00492156660115,
  117. 0.00390625000000, 0.00310039267963, 0.00246078330058, 0.00195312500000,
  118. 0.00155019633981, 0.00123039165029, 0.00097656250000, 0.00077509816991,
  119. 0.00061519582514, 0.00048828125000, 0.00038754908495, 0.00030759791257,
  120. 0.00024414062500, 0.00019377454248, 0.00015379895629, 0.00012207031250,
  121. 0.00009688727124, 0.00007689947814, 0.00006103515625, 0.00004844363562,
  122. 0.00003844973907, 0.00003051757813, 0.00002422181781, 0.00001922486954,
  123. 0.00001525878906, 0.00001211090890, 0.00000961243477, 0.00000762939453,
  124. 0.00000605545445, 0.00000480621738, 0.00000381469727, 0.00000302772723,
  125. 0.00000240310869, 0.00000190734863, 0.00000151386361, 0.00000120155435,
  126. 1E-20
  127. };
  128.  
  129.  
  130. /* ABCD_INDEX = lookqt[mode][sr_index][br_index]  */
  131. /* -1 = invalid  */
  132. static signed char lookqt[4][3][16] =
  133. {
  134.    1, -1, -1, -1, 2, -1, 2, 0, 0, 0, 1, 1, 1, 1, 1, -1,        /*  44ks stereo */
  135.    0, -1, -1, -1, 2, -1, 2, 0, 0, 0, 0, 0, 0, 0, 0, -1,        /*  48ks */
  136.    1, -1, -1, -1, 3, -1, 3, 0, 0, 0, 1, 1, 1, 1, 1, -1,        /*  32ks */
  137.    1, -1, -1, -1, 2, -1, 2, 0, 0, 0, 1, 1, 1, 1, 1, -1,        /*  44ks joint stereo */
  138.    0, -1, -1, -1, 2, -1, 2, 0, 0, 0, 0, 0, 0, 0, 0, -1,        /*  48ks */
  139.    1, -1, -1, -1, 3, -1, 3, 0, 0, 0, 1, 1, 1, 1, 1, -1,        /*  32ks */
  140.    1, -1, -1, -1, 2, -1, 2, 0, 0, 0, 1, 1, 1, 1, 1, -1,        /*  44ks dual chan */
  141.    0, -1, -1, -1, 2, -1, 2, 0, 0, 0, 0, 0, 0, 0, 0, -1,        /*  48ks */
  142.    1, -1, -1, -1, 3, -1, 3, 0, 0, 0, 1, 1, 1, 1, 1, -1,        /*  32ks */
  143. // mono extended beyond legal br index
  144. //  1,2,2,0,0,0,1,1,1,1,1,1,1,1,1,-1,          /*  44ks single chan */
  145. //  0,2,2,0,0,0,0,0,0,0,0,0,0,0,0,-1,          /*  48ks */
  146. //  1,3,3,0,0,0,1,1,1,1,1,1,1,1,1,-1,          /*  32ks */
  147. // legal mono
  148.    1, 2, 2, 0, 0, 0, 1, 1, 1, 1, 1, -1, -1, -1, -1, -1,        /*  44ks single chan */
  149.    0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1,        /*  48ks */
  150.    1, 3, 3, 0, 0, 0, 1, 1, 1, 1, 1, -1, -1, -1, -1, -1,        /*  32ks */
  151. };
  152.  
  153. /* bit allocation table look up */
  154. /* table per mpeg spec tables 3b2a/b/c/d  /e is mpeg2 */
  155. /* look_bat[abcd_index][4][16]  */
  156. static const unsigned char look_bat[5][4][16] =
  157. {
  158. /* LOOK_BATA */
  159.    0, 1, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
  160.    0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 17,
  161.    0, 1, 2, 3, 4, 5, 6, 17, 0, 0, 0, 0, 0, 0, 0, 0,
  162.    0, 1, 2, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  163. /* LOOK_BATB */
  164.    0, 1, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
  165.    0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 17,
  166.    0, 1, 2, 3, 4, 5, 6, 17, 0, 0, 0, 0, 0, 0, 0, 0,
  167.    0, 1, 2, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  168. /* LOOK_BATC */
  169.    0, 1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
  170.    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  171.    0, 1, 2, 4, 5, 6, 7, 8, 0, 0, 0, 0, 0, 0, 0, 0,
  172.    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  173. /* LOOK_BATD */
  174.    0, 1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
  175.    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  176.    0, 1, 2, 4, 5, 6, 7, 8, 0, 0, 0, 0, 0, 0, 0, 0,
  177.    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  178. /* LOOK_BATE */
  179.    0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
  180.    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  181.    0, 1, 2, 4, 5, 6, 7, 8, 0, 0, 0, 0, 0, 0, 0, 0,
  182.    0, 1, 2, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  183. };
  184.  
  185. static const unsigned char look_nbat[5][4] =
  186. {
  187.    3, 8, 12, 4,
  188.    3, 8, 12, 7,
  189.    2, 0, 6, 0,
  190.    2, 0, 10, 0,
  191.    4, 0, 7, 19,
  192. };
  193.  
  194. static const unsigned char nbit[4]={4,4,3,2};
  195.  
  196. ///////////////////////////////////////////////////////////////////////////
  197.  
  198. void AMPDecoder::L1_PrereadFrame() {
  199.     resetbitsL2(frame_size);
  200. }
  201.  
  202. bool AMPDecoder::L1_DecodeFrame() {
  203.     int i, j;
  204.     int sb, ch;
  205.     int subbands, sidebands;
  206.     int bitalloc[32][2];
  207.     float scalefac[32][2];
  208.     float sample[2][32];
  209.  
  210.     // header's already been read... so fill the bit reservoir.
  211.  
  212.     profile_set(0);
  213.  
  214.     resetbitsL2(frame_size);
  215.  
  216.     profile_add(p_read);
  217.  
  218.     // decode bit allocations for each subband.
  219.  
  220. //_RPT0(0,"Decoding bit allocations\n");
  221.  
  222.     if (mode == MODE_JOINTSTEREO)
  223.         sidebands = 4*(mode_ext+1);
  224.     else
  225.         sidebands = 32;
  226.  
  227.     for(sb=0; sb<32; sb++) {
  228.         if (sb < sidebands)
  229.             for(ch=0; ch<channels; ch++)
  230.                 bitalloc[sb][ch] = getbitsL2(4);
  231.         else
  232.             bitalloc[sb][0] = bitalloc[sb][1] = getbitsL2(4);
  233.     }
  234.  
  235.     subbands = sb;
  236.     if (sidebands > subbands)
  237.         sidebands = subbands;
  238.  
  239.     profile_add(p_bitalloc);
  240.  
  241.     // decode scale factors
  242.     //
  243.     // 6 bits per subband per channel, left-then-right if stereo
  244.  
  245.     static const unsigned char bitlookup[]={
  246.         0, 64, 65, 3, 66, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16
  247.     };
  248.  
  249.     for(sb=0; sb<32; sb++) {
  250.         for(ch=0; ch<channels; ch++) {
  251.             if (bitalloc[sb][ch]) {
  252.                 double c = c_f_tab[bitalloc[sb][ch]-1];
  253.  
  254.                 ++bitalloc[sb][ch];
  255.  
  256.                 scalefac[sb][ch] = c*scalefactors[getbitsL2(6)];
  257.             }
  258.         }
  259.     }
  260.  
  261.     // decode samples (12 sets)
  262.  
  263.     for(sb=0; sb<32; sb++)
  264.         for(ch=0; ch<channels; ch++)
  265.             sample[ch][sb] = 0;
  266.  
  267.     profile_add(p_scalefac);
  268.  
  269.     for(i=0; i<12; i++) {
  270.         for(sb=0; sb<sidebands; sb++) {
  271.             for(ch=0; ch<channels; ch++) {
  272.                 if (bitalloc[sb][ch]) {
  273.                     const unsigned char bits = bitalloc[sb][ch];
  274.                     const float sf = scalefac[sb][ch];
  275.  
  276.                     int bias = (1<<(bits-1))-1;
  277.                     sample[ch][sb] = scalefac[sb][ch]*(getbitsL2(bits) - bias);
  278.                 }
  279.             }
  280.         }
  281.  
  282.         for(; sb<subbands; sb++) {
  283.             if (bitalloc[sb][0]) {
  284.                 const unsigned char bits = bitalloc[sb][0];
  285.                 const double sf = scalefac[sb][0];
  286.  
  287.                 int bias = (1<<(bits-1))-1;
  288.                 sample[0][sb] = sf*(getbitsL2(bits) - bias);
  289.             }
  290.  
  291.             if (channels>1)
  292.                 sample[1][sb] = sample[0][sb];
  293.         }
  294.  
  295.         profile_add(p_decode);
  296.  
  297.         // subband synthesis
  298.  
  299.         if (mode == MODE_MONO)
  300.             polyphase(&sample[0][0], NULL, psDest + 32*i, false);
  301.         else
  302.             polyphase(&sample[0][0], &sample[1][0], psDest + 64*i, false);
  303.  
  304.         profile_add(p_polyphase);
  305.     }
  306.  
  307. #ifdef RDTSC_PROFILE
  308.  
  309.     if (!(++p_frames & 127)) {
  310.         static char buf[256];
  311.  
  312.         sprintf(buf, "%d frames: total %I64d, read %d%%, bitalloc %d%%, scalefac %d%%, decode %d%%, poly %d%%\n"
  313.                 ,p_frames
  314.                 ,p_total
  315.                 ,(long)((p_read*100)/p_total)
  316.                 ,(long)((p_bitalloc*100)/p_total)
  317.                 ,(long)((p_scalefac*100)/p_total)
  318.                 ,(long)((p_decode*100)/p_total)
  319.                 ,(long)((p_polyphase*100)/p_total)
  320.                 );
  321.         OutputDebugString(buf);
  322.     }
  323. #endif
  324.  
  325.     // report proper sample count
  326.  
  327.     if (mode == MODE_MONO)
  328.         lSampleCount = 384;
  329.     else
  330.         lSampleCount = 384*2;
  331.  
  332.     return true;
  333. }
  334.  
  335. void AMPDecoder::L2_PrereadFrame() {
  336.     resetbitsL2(frame_size);
  337. }
  338.  
  339. bool AMPDecoder::L2_DecodeFrame() {
  340.     int i, j;
  341.     int sb, ch;
  342.     int subbands, sidebands;
  343.     int alloctbl_idx;
  344.     int bitalloc[32][2];
  345.     int scfsi[32][2];
  346.     float scalefac[3][32][2];
  347.     float sample[3][2][32];
  348.  
  349.     // header's already been read... so fill the bit reservoir.
  350.  
  351.     profile_set(0);
  352.  
  353.     resetbitsL2(frame_size);
  354.  
  355.     profile_add(p_read);
  356.  
  357.     // decode bit allocations for each subband.
  358.     //
  359.     // 1) Figure out which A-D table we want, based on mode, bitrate and sampling rate.
  360.  
  361.     if (is_mpeg2)
  362.         alloctbl_idx = 4;
  363.     else
  364.         alloctbl_idx = lookqt[mode][sr_index][br_index];
  365.  
  366.     // 2) Decode actual bit allocations.
  367.  
  368. //_RPT0(0,"Decoding bit allocations\n");
  369.  
  370.     if (mode == MODE_JOINTSTEREO)
  371.         sidebands = 4*(mode_ext+1);
  372.     else
  373.         sidebands = 32;
  374.  
  375.     sb=0;
  376.     for(i=0; i<4; i++)
  377.         for(j=0; j<look_nbat[alloctbl_idx][i]; j++) {
  378.  
  379.             if (sb < sidebands)
  380.                 for(ch=0; ch<channels; ch++)
  381.                     bitalloc[sb][ch] = look_bat[alloctbl_idx][i][getbitsL2(nbit[i])];
  382.             else
  383.                 bitalloc[sb][0] = bitalloc[sb][1] = look_bat[alloctbl_idx][i][getbitsL2(nbit[i])];
  384.  
  385.             ++sb;
  386.         }
  387.  
  388.     subbands = sb;
  389.     if (sidebands > subbands)
  390.         sidebands = subbands;
  391.  
  392.     profile_add(p_bitalloc);
  393.  
  394.     // decode scale factor selector indices (scfsi)
  395.     //
  396.     // 2 bits per subband per channel, left-then-right if stereo
  397.  
  398.     for(sb=0; sb<subbands; sb++)
  399.         for(ch=0; ch<channels; ch++)
  400.             if (bitalloc[sb][ch])
  401.                 scfsi[sb][ch] = getbitsL2(2);
  402.  
  403.     profile_add(p_scfsi);
  404.  
  405.     // decode scale factors
  406.     //
  407.     // 6, 12, or 18 bits per subband per channel, left-then-right if stereo
  408.  
  409.     static const unsigned char bitlookup[]={
  410.         0, 64, 65, 3, 66, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16
  411.     };
  412.  
  413.     for(sb=0; sb<subbands; sb++) {
  414.         for(ch=0; ch<channels; ch++) {
  415.             if (bitalloc[sb][ch]) {
  416.                 double c = c_f_tab[bitalloc[sb][ch]-1];
  417.  
  418.                 bitalloc[sb][ch] = bitlookup[bitalloc[sb][ch]];
  419.  
  420.                 scalefac[0][sb][ch] = c*scalefactors[getbitsL2(6)];
  421.  
  422.                 switch(scfsi[sb][ch]) {
  423.  
  424.                     case 0:        // three distinct scale factors
  425.                         scalefac[1][sb][ch] = c*scalefactors[getbitsL2(6)];
  426.                         scalefac[2][sb][ch] = c*scalefactors[getbitsL2(6)];
  427.                         break;
  428.  
  429.                     case 1:        // first two scale factors identical
  430.                         scalefac[1][sb][ch] = scalefac[0][sb][ch];
  431.                         scalefac[2][sb][ch] = c*scalefactors[getbitsL2(6)];
  432.                         break;
  433.  
  434.                     case 3:        // last two scale factors identical
  435.                         scalefac[1][sb][ch] =
  436.                         scalefac[2][sb][ch] = c*scalefactors[getbitsL2(6)];
  437.                         break;
  438.  
  439.                     case 2:        // all three scale factors identical
  440.                         scalefac[1][sb][ch] =
  441.                         scalefac[2][sb][ch] = scalefac[0][sb][ch];
  442.                         break;
  443.  
  444.                     default:
  445.                         __assume(false);
  446.  
  447.                 }
  448.             }
  449.         }
  450.     }
  451.  
  452.     // decode samples (12 sets)
  453.  
  454.     static const unsigned char group_bits[]={
  455.         5, 7, 10,
  456.     };
  457.  
  458. /*    for(sb=subbands; sb<32; sb++)
  459.         for(ch=0; ch<channels; ch++)
  460.             sample[0][ch][sb] = sample[1][ch][sb] = sample[2][ch][sb] = 0;*/
  461.  
  462.     for(sb=0; sb<32; sb++)
  463.         for(ch=0; ch<channels; ch++)
  464.             sample[0][ch][sb] = sample[1][ch][sb] = sample[2][ch][sb] = 0;
  465.  
  466.     profile_add(p_scalefac);
  467.  
  468.     for(i=0; i<12; i++) {
  469.         const float (*const sf_ptr)[2] = scalefac[i>>2];
  470.  
  471.  
  472.         for(sb=0; sb<sidebands; sb++) {
  473.             for(ch=0; ch<channels; ch++) {
  474.                 if (bitalloc[sb][ch]) {
  475.                     const unsigned char bits = bitalloc[sb][ch];
  476.                     const double sf = sf_ptr[sb][ch];
  477.  
  478.                     if (bits<64) {
  479.                         int bias = (1<<(bits-1))-1;
  480.                         sample[0][ch][sb] = sf*(getbitsL2(bits) - bias);
  481.                         sample[1][ch][sb] = sf*(getbitsL2(bits) - bias);
  482.                         sample[2][ch][sb] = sf*(getbitsL2(bits) - bias);
  483.                     } else {
  484.  
  485.                         // select between 3 grouping of 3, 5, or 9 levels each
  486.  
  487.                         const int v = getbitsL2(group_bits[bits-64]);
  488.                         const signed char (*const grp_tbl)[3] = group_tbls[bits-64];
  489.  
  490.                         sample[0][ch][sb] = sf*grp_tbl[v][0];
  491.                         sample[1][ch][sb] = sf*grp_tbl[v][1];
  492.                         sample[2][ch][sb] = sf*grp_tbl[v][2];
  493.                     }
  494.                 }
  495.             }
  496.         }
  497.  
  498.         for(; sb<subbands; sb++) {
  499.             if (bitalloc[sb][0]) {
  500.                 const unsigned char bits = bitalloc[sb][0];
  501.                 const double sf = sf_ptr[sb][0];
  502.  
  503.                 if (bits<64) {
  504.                     int bias = (1<<(bits-1))-1;
  505.                     sample[0][0][sb] = sf*(getbitsL2(bits) - bias);
  506.                     sample[1][0][sb] = sf*(getbitsL2(bits) - bias);
  507.                     sample[2][0][sb] = sf*(getbitsL2(bits) - bias);
  508.                 } else {
  509.  
  510.                     // select between 3 grouping of 3, 5, or 9 levels each
  511.  
  512.                     const int v  = getbitsL2(group_bits[bits-64]);
  513.                     const signed char (*grp_tbl)[3] = group_tbls[bits-64];
  514.  
  515.                     sample[0][0][sb] = sf*grp_tbl[v][0];
  516.                     sample[1][0][sb] = sf*grp_tbl[v][1];
  517.                     sample[2][0][sb] = sf*grp_tbl[v][2];
  518.                 }
  519.             }
  520.  
  521.             if (channels>1) {
  522.                 sample[0][1][sb] = sample[0][0][sb];
  523.                 sample[1][1][sb] = sample[1][0][sb];
  524.                 sample[2][1][sb] = sample[2][0][sb];
  525.             }
  526.         }
  527.  
  528.         profile_add(p_decode);
  529.  
  530.         // subband synthesis
  531.  
  532.         if (mode == MODE_MONO)
  533.             for(j=0; j<3; j++) {
  534.                 polyphase(&sample[j][0][0], NULL, psDest + 32*(i*3+j), false);
  535.             }
  536.         else
  537.             for(j=0; j<3; j++) {
  538.                 polyphase(&sample[j][0][0], &sample[j][1][0], psDest + 64*(i*3+j), false);
  539.             }
  540.  
  541.         profile_add(p_polyphase);
  542.     }
  543.  
  544. #ifdef RDTSC_PROFILE
  545.  
  546.     if (!(++p_frames & 127)) {
  547.         static char buf[256];
  548.  
  549.         sprintf(buf, "%d frames: total %I64d, read %d%%, bitalloc %d%%, scfsi %d%%, scalefac %d%%, decode %d%%, poly %d%%\n"
  550.                 ,p_frames
  551.                 ,p_total
  552.                 ,(long)((p_read*100)/p_total)
  553.                 ,(long)((p_bitalloc*100)/p_total)
  554.                 ,(long)((p_scfsi*100)/p_total)
  555.                 ,(long)((p_scalefac*100)/p_total)
  556.                 ,(long)((p_decode*100)/p_total)
  557.                 ,(long)((p_polyphase*100)/p_total)
  558.                 );
  559.         OutputDebugString(buf);
  560.     }
  561. #endif
  562.  
  563.  
  564.     // report proper sample count
  565.  
  566.     if (mode == MODE_MONO)
  567.         lSampleCount = 1152;
  568.     else
  569.         lSampleCount = 1152*2;
  570.  
  571.     return true;
  572. }
  573.