home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 275 / DPCS0111DVD.ISO / Toolkit / Audio-Visual / VirtualDub / Source / VirtualDub-1.9.10-src.7z / src / Priss / h / engine.h < prev    next >
Encoding:
C/C++ Source or Header  |  2009-09-14  |  2.7 KB  |  98 lines

  1. //    Priss (NekoAmp 2.0) - MPEG-1/2 audio decoding library
  2. //    Copyright (C) 2003 Avery Lee
  3. //
  4. //    This program is free software; you can redistribute it and/or modify
  5. //    it under the terms of the GNU General Public License as published by
  6. //    the Free Software Foundation; either version 2 of the License, or
  7. //    (at your option) any later version.
  8. //
  9. //    This program is distributed in the hope that it will be useful,
  10. //    but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12. //    GNU General Public License for more details.
  13. //
  14. //    You should have received a copy of the GNU General Public License
  15. //    along with this program; if not, write to the Free Software
  16. //    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17.  
  18. #ifndef f_VD2_PRISS_ENGINE_H
  19. #define f_VD2_PRISS_ENGINE_H
  20.  
  21. #include <vd2/system/vdtypes.h>
  22. #include <vd2/Priss/decoder.h>
  23.  
  24. #include "polyphase.h"
  25.  
  26. class VDMPEGAudioHuffBitReader;
  27.  
  28. class VDMPEGAudioDecoder : public IVDMPEGAudioDecoder {
  29. public:
  30.     VDMPEGAudioDecoder();
  31.     ~VDMPEGAudioDecoder();
  32.  
  33.     void    Init();
  34.     void    SetSource(IVDMPEGAudioBitsource *pSource);
  35.     void    SetDestination(sint16 *psDest);
  36.     uint32    GetSampleCount();
  37.     uint32    GetFrameDataSize();
  38.     void    GetStreamInfo(VDMPEGAudioStreamInfo *pasi);
  39.     const char *GetErrorString(int err);
  40.     void    Reset();
  41.     void    ReadHeader();
  42.     void    PrereadFrame();
  43.     bool    DecodeFrame();
  44.     void    ConcealFrame();
  45.  
  46. protected:
  47.     bool    DecodeLayerI();
  48.     bool    DecodeLayerII();
  49.     void    PrereadLayerIII();
  50.     bool    DecodeLayerIII();
  51.  
  52.     static void DecodeHuffmanValues(VDMPEGAudioHuffBitReader& bitreader, sint32 *dst, unsigned table, unsigned pairs);
  53.  
  54.     IVDMPEGAudioBitsource *mpSource;
  55.     VDMPEGAudioStreamInfo mHeader;
  56.     uint32            mFrameDataSize;
  57.     short            *mpSampleDst;
  58.     uint32            mSamplesDecoded;
  59.  
  60.     uint8            mBitrateIndex;
  61.     uint8            mSamplingRateIndex;
  62.     uint8            mMode;
  63.     uint8            mModeExtension;
  64.  
  65.     float            mL2Scalefactors[64];
  66.     sint8            mL2Ungroup3[32][3];
  67.  
  68.     uint8            mFrameBuffer[1728+4];
  69.  
  70.     enum { kL3BufferSize = 2048 };
  71.     uint8            mL3Buffer[2048];            // Only needs to be 960, but we make it 1024 for address masking
  72.     uint32            mL3BufferPos;                // Tail for layer III circular buffer operation
  73.     uint32            mL3BufferLevel;                // Number of bits in layer III bit reservoir
  74.  
  75.     float            mL3OverlapBuffer[2][32][18];    // used for overlapping tails of IMDCT output
  76.  
  77.     float            mL3Windows[4][36];            // IMDCT windows
  78.  
  79.     union {
  80.         struct {
  81.             float recon[2][576];
  82.         } mL3Data;
  83.     };
  84.  
  85.     float            mL3Pow43Tab[256];            // [-128,127] ^ (4/3)
  86.  
  87.     VDMPEGAudioPolyphaseFilter    *mpPolyphaseFilter;
  88.  
  89.     static const struct L3HuffmanTableDescriptor {
  90.         const uint8 (*table)[2];
  91.         unsigned treelen;
  92.         unsigned bits;
  93.         unsigned linbits;
  94.     } sL3HuffmanTables[];
  95. };
  96.  
  97. #endif
  98.