1
0

mp3decode.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /***************************************************************************\
  2. *
  3. * MPEG Layer3-Audio Decoder
  4. * © 1997-2006 by Fraunhofer IIS
  5. * All Rights Reserved
  6. *
  7. * filename: mp3decode.h
  8. * project : ISO/MPEG-Decoder
  9. * author : Martin Sieler
  10. * date : 1998-05-26
  11. * contents/description: MPEG Layer-3 decoder
  12. *
  13. *
  14. \***************************************************************************/
  15. /*
  16. * $Date: 2011/01/28 21:45:29 $
  17. * $Id: mp3decode.h,v 1.5 2011/01/28 21:45:29 audiodsp Exp $
  18. */
  19. #ifndef __MP3DECODE_H__
  20. #define __MP3DECODE_H__
  21. /* ------------------------ includes --------------------------------------*/
  22. #include "mpeg.h"
  23. #include "mpegbitstream.h"
  24. #include "huffdec.h"
  25. #include "mdct.h"
  26. #include "polyphase.h"
  27. #include "mp3ancofl.h"
  28. #ifdef ERROR_CONCEALMENT
  29. #include "conceal.h"
  30. #endif
  31. /*-------------------------------------------------------------------------*/
  32. //
  33. // MPEG Layer-3 decoding class.
  34. //
  35. // This is the main MPEG Layer-3 decoder object.
  36. //
  37. class NALIGN(16) CMp3Decode
  38. {
  39. public:
  40. CMp3Decode(CMpegBitStream &_Bs, int _crc_check, DecoderHooks *_hooks=0);
  41. ~CMp3Decode();
  42. void Init(bool fFullReset = true);
  43. // PcmFormat: 0: integer, 1: 32 bit float (IEEE)
  44. SSC Decode(float *pPcm,
  45. size_t cbPcm,
  46. size_t *pcbUsed,
  47. unsigned char *ancData,
  48. size_t *numAncBytes = 0,
  49. int oflOn = 0,
  50. unsigned int *startDelay = 0,
  51. unsigned int *totalLength = 0);
  52. SSC GetLastAncData(unsigned char* ancData, size_t *numAncBytes);
  53. SSC GetOflVersion(int* oflVersion);
  54. protected:
  55. SSC DecodeOnNoMainData(float *pPcm);
  56. SSC DecodeNormal (float *pPcm, bool fCrcOk);
  57. void PolyphaseReorder();
  58. void ZeroISpectrum();
  59. void ZeroSpectrum();
  60. void ZeroPolySpectrum();
  61. void SetInfo();
  62. CMp3Huffman m_Mp3Huffman; // huffman decoder
  63. CMdct m_Mdct; // mdct
  64. CPolyphase m_Polyphase; // polyphase
  65. CMp3AncOfl m_AncOfl; // ancillary data and ofl
  66. #ifdef ERROR_CONCEALMENT
  67. CErrorConcealment m_Conceal; // error concealment
  68. #endif
  69. MPEG_INFO m_Info; // info structure
  70. CMpegBitStream &m_Bs; // bitstream
  71. CBitStream m_Db; // dynamic buffer
  72. MP3SI m_Si; // side info
  73. MP3SCF m_ScaleFac[2]; // scalefactors
  74. int m_ISpectrum[2][SSLIMIT*SBLIMIT]; // spectrum (integer)
  75. NALIGN(16) SPECTRUM m_Spectrum; // spectrum (float)
  76. NALIGN(16) POLYSPECTRUM m_PolySpectrum; // spectrum (post-mdct)
  77. int m_crc_check; // 0: no CRC check, 1: fail on CRC errors
  78. protected:
  79. enum { dynBufSize = 2048 } ;
  80. unsigned char m_dynBufMemory [dynBufSize] ;
  81. private:
  82. DecoderHooks *hooks;
  83. };
  84. /*-------------------------------------------------------------------------*/
  85. #endif