home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 13 / AACD13.ISO / AACD / Sound / LAME / src / debugscalefac.c < prev    next >
C/C++ Source or Header  |  2000-06-30  |  4KB  |  140 lines

  1.      {
  2. /*******************************************************************
  3.  
  4. DEBUG INFORMATION 
  5. criticalbands (scalefactor bands)
  6. partition bands
  7. FFT bands
  8. MDCT bands 
  9.  
  10. *******************************************************************/
  11.  
  12. #include "tables.h"
  13.  int *scalefac_band_long; 
  14.  int *scalefac_band_short;
  15.  FLOAT fstart,fstop;
  16.  FLOAT mstart,mstop;
  17.  
  18.  
  19.  scalefac_band_long  = &sfBandIndex[info->sampling_frequency + (info->version * 3)].l[0];
  20.  scalefac_band_short = &sfBandIndex[info->sampling_frequency + (info->version * 3)].s[0];
  21.  
  22.  DEBUGF("\n\n long block partiton  bands \n");
  23.  for (b = 0; b<CBANDS; b++) {
  24.    /* look for FFT partition band bu_l[b]*/
  25.    for (i=0;i<HBLKSIZE;i++, fstart=i) {
  26.      if (partition_l[i]==b) break;
  27.    }
  28.    fstop=0;
  29.    for (i=HBLKSIZE-1;i>=0;i--, fstart=i) {
  30.      if (partition_l[i]==b) break;
  31.    }
  32.  
  33.    if(fstart>0) fstart -= .5;
  34.    fstop += .5;
  35.    DEBUGF("pb=%2i  FFT=(%4.1f,%4.1f)  numlines=%i  norm=%f  \n",
  36.          b,fstart,fstop,numlines_l[b],norm_l[b]);
  37.  
  38.  }
  39.  
  40.  
  41.  
  42.  DEBUGF("\n\n long block critial bands \n");
  43.  DEBUGF("crit band,part_band, part_band range  FFT range MDCT range \n");
  44.  for ( b = 0;b < SBPSY_l; b++ ) {
  45.  
  46.    /* look for FFT partition band bu_l[b]*/
  47.    for (i=0;i<HBLKSIZE;i++, fstart=i) {
  48.      if (partition_l[i]==bu_l[b]) break;
  49.    }
  50.    for (i=HBLKSIZE-1;i>=0;i--, fstop=i) {
  51.      if (partition_l[i]==bo_l[b]) break;
  52.    }
  53.  
  54.  
  55.    /* numlines_l[pb] = number of FFT lines in partition band pb */
  56.    /* w1 = 1, then all FFT lines belong to this partition band */
  57.    fstart += ( (1-w1_l[b])*numlines_l[ bu_l[b] ] ) ;
  58.  
  59.    /* w2 = 1, then all FFT lines belong to this partition band */
  60.    fstop -= ( (1-w2_l[b])*numlines_l[ bo_l[b] ] ) ;
  61.  
  62.  
  63.    if (fstart>0) fstart -= .5;  /* contribution extends to center of freq band */
  64.    fstop += .5;
  65.  
  66.    mstart = scalefac_band_long[b];
  67.    mstop  = scalefac_band_long[b+1]-1;
  68.    if (mstart>0) mstart -= .5;
  69.    mstop += .5;
  70.  
  71.    DEBUGF("cb=%2i(%2i)(%2i,%2i)(%3.2f,%3.2f)  FFT:(%4.1f,%4.1f)(%5.0f,%5.0f)Hz   MDCT:(%5.1f,%5.1f)(%5.0f,%5.0f)Hz \n",
  72.            b,npart_l_orig,bu_l[b],bo_l[b],w1_l[b],w2_l[b],
  73.       fstart,fstop,sfreq*fstart/BLKSIZE,sfreq*fstop/BLKSIZE,
  74.       mstart,mstop,mstart*.5*sfreq/576,mstop*.5*sfreq/576
  75.            );
  76.  }
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  DEBUGF("\n\n short block partition bands \n");
  83.  for (b = 0; b<CBANDS; b++) {
  84.    /* look for FFT partition band bu_s[b]*/
  85.    for (i=0;i<HBLKSIZE_s;i++,fstart=i) {
  86.      if (partition_s[i]==b) break;
  87.    }
  88.    for (i=HBLKSIZE_s-1; i>=0; i--,fstop=i) {
  89.      if (partition_s[i]==b) break;
  90.    }
  91.  
  92.    if(fstart>0) fstart -= .5;
  93.    fstop += .5;
  94.    DEBUGF("pb=%2i  FFT=(%4.1f,%4.1f)  numlines=%i norm=%f \n",
  95.       b,fstart,fstop,numlines_s[b],norm_s[b]);
  96.  
  97.  }
  98.  
  99.  
  100.  
  101.  DEBUGF("\n\n short block critial bands \n");
  102.  DEBUGF("crit band,part_band, part_band range  FFT range MDCT range \n");
  103.  for ( b = 0;b < SBPSY_s; b++ ) {
  104.  
  105.    /* look for FFT partition band bu_s[b]*/
  106.    for (i=0;i<HBLKSIZE_s;i++)  
  107.      if (partition_s[i]==bu_s[b]) {fstart=i;break;}
  108.    for (i=HBLKSIZE_s-1;i>=0;i--) 
  109.      if (partition_s[i]==bo_s[b]) {fstop=i; break;}
  110.  
  111.  
  112.    /* numlines_s[pb] = number of FFT lines in partition band pb */
  113.    /* w1 = 1, then all FFT lines belong to this partition band */
  114.    fstart += ( (1-w1_s[b])*numlines_s[ bu_s[b] ] ) ;
  115.  
  116.    /* w2 = 1, then all FFT lines belong to this partition band */
  117.    fstop -= ( (1-w2_s[b])*numlines_s[ bo_s[b] ] ) ;
  118.  
  119.  
  120.    if (fstart>0) fstart -= .5;  /* contribution extends to center of freq band */
  121.    fstop += .5;
  122.  
  123.    mstart = scalefac_band_short[b];
  124.    mstop  = scalefac_band_short[b+1]-1;
  125.    if (mstart>0) mstart -= .5;
  126.    mstop += .5;
  127.  
  128.    DEBUGF("cb=%2i(%2i)(%2i,%2i)(%3.2f,%3.2f)  FFT:(%4.1f,%4.1f)(%5.0f,%5.0f)Hz   MDCT:(%5.1f,%5.1f)(%5.0f,%5.0f)Hz \n",
  129.            b,npart_s_orig,bu_s[b],bo_s[b],w1_s[b],w2_s[b],
  130.       fstart,fstop,sfreq*fstart/BLKSIZE_s,sfreq*fstop/BLKSIZE_s,
  131.       mstart,mstop,mstart*.5*sfreq/192,mstop*.5*sfreq/192
  132.            );
  133.  }
  134.  
  135.  
  136. /*******************************************************************
  137. END DEBUG INFORMATION 
  138. *******************************************************************/
  139.      }
  140.