1
0

mpeg.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. /***************************************************************************\
  2. *
  3. * MPEG Layer3-Audio Decoder
  4. * © 1997-2006 by Fraunhofer IIS
  5. * All Rights Reserved
  6. *
  7. * filename: mpeg.h
  8. * project : ISO/MPEG-Decoder
  9. * author : Markus Werner, addings: Martin Sieler
  10. * date : 1995-07-07
  11. * contents/description: HEADER - iso/mpeg-definitions
  12. *
  13. *
  14. \***************************************************************************/
  15. /*
  16. * $Date: 2011/01/20 22:14:40 $
  17. * $Id: mpeg.h,v 1.3 2011/01/20 22:14:40 audiodsp Exp $
  18. */
  19. /*-------------------------------------------------------------------------*/
  20. #ifndef __MPEG_H__
  21. #define __MPEG_H__
  22. #include "foundation/align.h"
  23. /* ------------------------ includes --------------------------------------*/
  24. /* ------------------------------------------------------------------------*/
  25. //
  26. // MPEG ID (fhgVersion)
  27. //
  28. #define MPG_MPEG1 1
  29. #define MPG_MPEG2 0
  30. #define MPG_MPEG25 2
  31. /* ------------------------------------------------------------------------*/
  32. //
  33. // sample rate
  34. //
  35. #define MPG_SF_LOW 2
  36. /* ------------------------------------------------------------------------*/
  37. //
  38. // header-mode field
  39. //
  40. #define MPG_MD_STEREO 0
  41. #define MPG_MD_JOINT_STEREO 1
  42. #define MPG_MD_DUAL_CHANNEL 2
  43. #define MPG_MD_MONO 3
  44. /*-------------------------------------------------------------------------*/
  45. //
  46. // channels
  47. //
  48. #define MONO 1
  49. #define STEREO 2
  50. /* ------------------------------------------------------------------------*/
  51. //
  52. // subbands, samples/subband
  53. //
  54. #define SBLIMIT 32
  55. #define SSLIMIT 18
  56. /* ------------------------------------------------------------------------*/
  57. //
  58. // info structure
  59. //
  60. typedef struct
  61. {
  62. int stereo;
  63. int sample_rate_ndx;
  64. int frame_bits;
  65. int mode;
  66. int mode_ext;
  67. int header_size;
  68. int fhgVersion;
  69. int protection;
  70. bool IsMpeg1;
  71. } MPEG_INFO;
  72. /* ------------------------------------------------------------------------*/
  73. //
  74. // MPEG Layer-3 sideinfo (per channel/granule)
  75. //
  76. typedef struct
  77. {
  78. int part2_3_length;
  79. int big_values;
  80. int global_gain;
  81. int scalefac_compress;
  82. int window_switching_flag;
  83. int block_type;
  84. int mixed_block_flag;
  85. int table_select[3];
  86. int subblock_gain[3];
  87. int region0_count;
  88. int region1_count;
  89. int preflag;
  90. int scalefac_scale;
  91. int count1table_select;
  92. // additional calced values
  93. int intensity_scale; // MPEG 2, MPEG 2.5 only
  94. int zeroStartNdx;
  95. int zeroSfbStartNdxIsLong;
  96. int zeroSfbStartNdxL;
  97. int zeroSfbStartNdxSMax;
  98. int zeroSfbStartNdxS[3];
  99. int zeroSbStartNdx;
  100. } MP3SI_GRCH;
  101. /* ------------------------------------------------------------------------*/
  102. //
  103. // MPEG Layer-3 sideinfo
  104. //
  105. typedef struct
  106. {
  107. int main_data_begin;
  108. int private_bits;
  109. struct
  110. {
  111. int scfsi[4];
  112. MP3SI_GRCH gr[2];
  113. } ch[2];
  114. } MP3SI;
  115. /* ------------------------------------------------------------------------*/
  116. //
  117. // MPEG Layer-3 scalefactors
  118. //
  119. typedef struct
  120. {
  121. // scalefactors
  122. int l[23];
  123. int s[3][13];
  124. // illegal intensity position
  125. int l_iip[23];
  126. int s_iip[13];
  127. } MP3SCF;
  128. /* ------------------------------------------------------------------------*/
  129. //
  130. // spectrum (as transmitted)
  131. //
  132. typedef NALIGN(16) float SPECTRUM[2][SBLIMIT][SSLIMIT];
  133. //
  134. // spectrum (after mdct)
  135. //
  136. typedef NALIGN(16) float POLYSPECTRUM[2][SSLIMIT][SBLIMIT];
  137. /* Nullsoft added 25 Oct 2007 */
  138. struct DecoderHooks
  139. {
  140. void (*layer3_vis)(SPECTRUM vistable,int gr, int nch);
  141. void (*layer2_eq)(float *xr, int nch, int srate, int nparts);
  142. void (*layer3_eq)(float *xr, int nch, int srate);
  143. };
  144. /* ------------------------------------------------------------------------*/
  145. #endif