home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 6 / AACD06.ISO / AACD / Sound / LAME / Source / gtkanal.h < prev    next >
C/C++ Source or Header  |  1999-05-27  |  3KB  |  121 lines

  1. /* 
  2. layerIII enc->dec delay:  1056    (observed)
  3. layerII  enc->dec dealy:   480    (observed)
  4.  
  5.  
  6.        sync_flush              filter_delay         
  7. layerII:  480 = 256+224.         256(polyphase)
  8. layerIII: 768 = 512+32+224      512+32       polyphase: 256
  9.                                              mdct  9*32= 256+32?
  10.  
  11. This would mean: players have a 512 delay?
  12. output = input delayed by 1056 = 512(output) + 512+32(input)
  13.  
  14.  
  15. New calculation:
  16. polyphase 256-16             (dec or enc)
  17. mdct      256+32  (9*32)     (dec or enc) 
  18. total:    512+16
  19.  
  20.  
  21. SYNC_FLUSH calculation:
  22. layerIII enc delay:                     528
  23. extra bits to display full fft window:  224
  24. total:                                  752
  25.  
  26. layerII sync_flush:  should be 464
  27. layerIII sync_flush: should be 752
  28.  
  29.  
  30. Also we would like to remove mpg123 decoder delay with 
  31. DECDELAY of -528 (not possible)
  32. so delay by a enough to make the total delay 1 whole frame (1152-528)
  33. */
  34.  
  35.  
  36. /* old values (FFT's use this alignment) */
  37. /*
  38. #define ENCDELAY 544  
  39. #define DECDELAY (1152-512)
  40. */
  41.  
  42.  
  43. /* correct values */
  44. #define ENCDELAY 528 
  45. #define DECDELAY (1152-528)
  46.  
  47. /* use this delay if you want to also include the data from the FFT window */
  48. #define WINDELAY (224 + ENCDELAY)
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60. #ifdef HAVEGTK
  61.  
  62. /* mpg123 ouput is delayed by 1 frame
  63.  * HOWEVER, sometimes mpg123 doesn't produce a frame until we send the
  64.  * next frame.  Everytime this happens, bump up MPGLAG.  
  65.  */
  66. #define READ_AHEAD 5              /* number of frames to read ahead */
  67. #define MAXMPGLAG READ_AHEAD      /* if the mpg123 lag becomes bigger than this                      we have to stop */
  68. #define NUMBACK 5                 /* number of frames we can back up */
  69. #define NUMPINFO (NUMBACK+READ_AHEAD+1)
  70.  
  71. #define BLKSIZE         1024
  72. #define HBLKSIZE        513
  73. #define SBMAX_l 21
  74. #define SBMAX_s 12
  75.  
  76.  
  77.  
  78. typedef struct {
  79.   int frameNum;           /* current frame number */
  80.   int num_samples;        /* number of pcm samples read for this frame */
  81.   double frametime;       /* starting time of frame, in seconds */
  82.   double pcmdata[2][1152+WINDELAY];
  83.   double pcmdata2[2][1152+DECDELAY];
  84.   double energy[2][2][BLKSIZE];
  85.   double xr[2][2][576];
  86.   double mpg123xr[2][2][576];
  87.   double pe[2][2];
  88.   double ms_ratio[2];
  89.  
  90.   double thr[2][2][SBMAX_l];
  91.   double en[2][2][SBMAX_l];
  92.   double thr_s[2][2][3*SBMAX_s];
  93.   double en_s[2][2][3*SBMAX_s];
  94.   double ers[2][2];
  95.  
  96.   double xfsf[2][2][SBMAX_l];
  97.   double xfsf_s[2][2][3*SBMAX_s];
  98.  
  99.   int mpglag;
  100.   int qss[2][2];
  101.   int sub_gain[2][2][3];
  102.   int over[2][2];
  103.   double noise[2][2];
  104.   int blocktype[2][2];
  105.   int mpg123blocktype[2][2];
  106.   int mixed[2][2];
  107.   int mainbits[2][2];
  108.   int LAMEmainbits[2][2];
  109.   int stereo,js,ms_stereo,i_stereo,emph,bitrate,sampfreq,maindata;
  110.   int scfsi,mean_bits,resvsize;
  111.   int totbits;
  112. } plotting_data;
  113.  
  114.  
  115. int gtkcontrol(int,int,char *,int);
  116.  
  117. extern int gtkflag;
  118. extern plotting_data *pinfo;
  119.  
  120. #endif
  121.