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 / polyphase.h < prev   
Encoding:
C/C++ Source or Header  |  2009-09-14  |  2.1 KB  |  74 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_POLYPHASE_H
  19. #define f_VD2_PRISS_POLYPHASE_H
  20.  
  21. #include <vd2/system/vdtypes.h>
  22.  
  23. class VDMPEGAudioPolyphaseFilter {
  24. public:
  25.     void *operator new(size_t);
  26.     void operator delete(void *);
  27.  
  28.     static VDMPEGAudioPolyphaseFilter *Create();
  29.  
  30.     VDMPEGAudioPolyphaseFilter();
  31.  
  32.     virtual bool ShouldRecreate() = 0;
  33.     void Reset();
  34.     void Generate(const float left[32], const float right[32], sint16 *dst);
  35.  
  36. protected:
  37.     enum OptMode {
  38.         kOptModeFPU,
  39.         kOptModeSSE
  40.     };
  41.  
  42.     static OptMode GetOptMode();
  43.     virtual void DCTInputButterflies(float x[32], const float in[32]);
  44.     virtual void DCT4x8(float *);
  45.     virtual void Matrix(const float *, bool stereo, int ch);
  46.     virtual void SynthesizeMono(sint16 *dst);
  47.     virtual void SynthesizeStereo(sint16 *dst);
  48.  
  49.     __declspec(align(16)) union {
  50.         float    mono[32][16];
  51.         float    stereo[32][2][16];
  52.     } mWindow;
  53.  
  54.     unsigned    mWindowPos;
  55.  
  56.     float        mFilter[17][32];
  57. };
  58.  
  59. class VDMPEGAudioPolyphaseFilterFPU : public VDMPEGAudioPolyphaseFilter {
  60. protected:
  61.     bool ShouldRecreate() { return GetOptMode() != kOptModeFPU; }
  62. };
  63.  
  64. class VDMPEGAudioPolyphaseFilterSSE : public VDMPEGAudioPolyphaseFilter {
  65. protected:
  66.     bool ShouldRecreate() { return GetOptMode() != kOptModeSSE; }
  67.  
  68.     void DCTInputButterflies(float x[32], const float in[32]);
  69.     void DCT4x8(float *x);
  70.     void SynthesizeStereo(sint16 *dst);
  71. };
  72.  
  73. #endif
  74.