1
0

huffmandecoder.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /***************************************************************************\
  2. *
  3. * MPEG Layer3-Audio Decoder
  4. * © 1997-2006 by Fraunhofer IIS
  5. * All Rights Reserved
  6. *
  7. * filename: huffmandecoder.h
  8. * project : MPEG Decoder
  9. * author : Martin Sieler
  10. * date : 1998-02-08
  11. * contents/description: HEADER - huffman decoder
  12. *
  13. *
  14. \***************************************************************************/
  15. /*
  16. * $Date: 2011/01/21 22:25:58 $
  17. * $Id: huffmandecoder.h,v 1.4 2011/01/21 22:25:58 audiodsp Exp $
  18. */
  19. #ifndef __HUFFMANDECODER_H__
  20. #define __HUFFMANDECODER_H__
  21. /* ------------------------ includes --------------------------------------*/
  22. #include "bitsequence.h"
  23. #include "huffmanbitobj.h"
  24. #include "huffmantable.h"
  25. /*-------------------------- defines --------------------------------------*/
  26. class CBitStream;
  27. /*-------------------------------------------------------------------------*/
  28. //
  29. // Huffman decoder (helper) class.
  30. //
  31. // This object reads and decodes MPEG Layer-3 huffman data.
  32. //
  33. class CHuffmanDecoder
  34. {
  35. public:
  36. CHuffmanDecoder();
  37. virtual ~CHuffmanDecoder();
  38. int ReadHuffmanCode(CBitStream &Bs,
  39. int *pIsp,
  40. const int *pTableSelect,
  41. const int *pRegionEnd,
  42. int Count1TableSelect,
  43. int Part2_3Length);
  44. protected:
  45. private:
  46. int ReadBigValues(CBitStream &Bs,
  47. int *pIsp,
  48. const int *pTableSelect,
  49. const int *pRegionEnd);
  50. int ReadCount1Area(CBitStream &Bs,
  51. int *pIsp,
  52. int Count1TableSelect,
  53. int Count1Start,
  54. int Part2_3Length);
  55. #ifdef _MSC_VER
  56. // these only have one caller and inlining shows notable improvements in the profiler
  57. __forceinline void ReadHuffmanDual (CBitStream &Bs, int *pIsp);
  58. __forceinline void ReadHuffmanDualLin(CBitStream &Bs, int *pIsp);
  59. __forceinline bool ReadHuffmanQuad (CBitStream &Bs, int *pIsp);
  60. #else
  61. void ReadHuffmanDual (CBitStream &Bs, int *pIsp);
  62. void ReadHuffmanDualLin(CBitStream &Bs, int *pIsp);
  63. bool ReadHuffmanQuad (CBitStream &Bs, int *pIsp);
  64. #endif
  65. CHuffmanTable m_HuffmanTable;
  66. CHuffmanBitObj m_HuffmanBitObj;
  67. CBitSequence m_LinBits;
  68. };
  69. /*-------------------------------------------------------------------------*/
  70. #endif