home *** CD-ROM | disk | FTP | other *** search
/ PC Shareware 1997 June / PC_Shareware-1997-06.iso / manga / mp2win95 / _setup.1 / Sublay2.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-06-23  |  3.4 KB  |  109 lines

  1. /*
  2.  *  @(#) subband_layer_2.h 1.8, last edit: 6/15/94 16:51:59
  3.  *  @(#) Copyright (C) 1993, 1994 Tobias Bading (bading@cs.tu-berlin.de)
  4.  *  @(#) Berlin University of Technology
  5.  *
  6.  *  This program is free software; you can redistribute it and/or modify
  7.  *  it under the terms of the GNU General Public License as published by
  8.  *  the Free Software Foundation; either version 2 of the License, or
  9.  *  (at your option) any later version.
  10.  *
  11.  *  This program is distributed in the hope that it will be useful,
  12.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.  *  GNU General Public License for more details.
  15.  *
  16.  *  You should have received a copy of the GNU General Public License
  17.  *  along with this program; if not, write to the Free Software
  18.  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  */
  20.  
  21. #ifndef SUBBAND_LAYER_2_H
  22. #define SUBBAND_LAYER_2_H
  23.  
  24. #include "all.h"
  25. #include "subband.h"
  26. #include "header.h"
  27. #include "crc.h"
  28.  
  29.  
  30. // class for layer II subbands in single channel mode:
  31. class SubbandLayer2 : public Subband
  32. {
  33. protected:
  34.   uint32 subbandnumber;
  35.  
  36.   uint32 allocation;
  37.   uint32 scfsi;
  38.   real     scalefactor1, scalefactor2, scalefactor3;
  39.   uint32 codelength;
  40.   const real *groupingtable;
  41.   real     factor;
  42.  
  43.   uint32 groupnumber;
  44.   uint32 samplenumber;
  45.   real     samples[3];
  46.   real     c, d;
  47.  
  48.   uint32 get_allocationlength (Header *);
  49.   void     prepare_sample_reading (Header *, uint32, const real **, real *,
  50.                  uint32 *, real *, real *);
  51.  
  52. public:
  53.         SubbandLayer2 (uint32 subbandnumber);
  54.   void        read_allocation (Ibitstream *, Header *, Crc16 *);
  55.   virtual void    read_scalefactor_selection (Ibitstream *, Crc16 *);
  56.   void        read_scalefactor (Ibitstream *, Header *);
  57.   BOOL        read_sampledata (Ibitstream *);
  58.   BOOL        put_next_sample (e_channels, SynthesisFilter *, SynthesisFilter * = NULL);
  59. };
  60.  
  61.  
  62. // class for layer II subbands in joint stereo mode:
  63. class SubbandLayer2IntensityStereo : public SubbandLayer2
  64. {
  65. protected:
  66.   uint32 channel2_scfsi;
  67.   real     channel2_scalefactor1, channel2_scalefactor2, channel2_scalefactor3;
  68.  
  69. public:
  70.        SubbandLayer2IntensityStereo (uint32 subbandnumber);
  71.   void read_allocation (Ibitstream *stream, Header *header, Crc16 *crc)
  72.   {
  73.     SubbandLayer2::read_allocation (stream, header, crc);
  74.   }
  75.   void read_scalefactor_selection (Ibitstream *, Crc16 *);
  76.   void read_scalefactor (Ibitstream *, Header *);
  77.   BOOL read_sampledata (Ibitstream *stream)
  78.   {
  79.      return SubbandLayer2::read_sampledata (stream);
  80.   }
  81.   BOOL put_next_sample (e_channels, SynthesisFilter *, SynthesisFilter *);
  82. };
  83.  
  84.  
  85. // class for layer II subbands in stereo mode:
  86. class SubbandLayer2Stereo : public SubbandLayer2
  87. {
  88. protected:
  89.   uint32 channel2_allocation;
  90.   uint32 channel2_scfsi;
  91.   real     channel2_scalefactor1, channel2_scalefactor2, channel2_scalefactor3;
  92.   BOOL     channel2_grouping;
  93.   uint32 channel2_codelength;
  94.   const real *channel2_groupingtable;
  95.   real     channel2_factor;
  96.   real     channel2_samples[3];
  97.   real     channel2_c, channel2_d;
  98.  
  99. public:
  100.        SubbandLayer2Stereo (uint32 subbandnumber);
  101.   void read_allocation (Ibitstream *, Header *, Crc16 *);
  102.   void read_scalefactor_selection (Ibitstream *, Crc16 *);
  103.   void read_scalefactor (Ibitstream *, Header *);
  104.   BOOL read_sampledata (Ibitstream *);
  105.   BOOL put_next_sample (e_channels, SynthesisFilter *, SynthesisFilter *);
  106. };
  107.  
  108. #endif
  109.