home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / sound / players / maplay_t.z / maplay_t / subband_layer_2.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-02-21  |  3.3 KB  |  111 lines

  1. /*
  2.  *  @(#) subband_layer_2.h 1.5, last edit: 2/21/94 18:10:12
  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 <stdio.h>
  25. #include "all.h"
  26. #include "subband.h"
  27. #include "header.h"
  28. #include "crc.h"
  29.  
  30.  
  31. // class for layer II subbands in single channel mode:
  32. class SubbandLayer2 : public Subband
  33. {
  34. protected:
  35.   uint32 subbandnumber;
  36.  
  37.   uint32 allocation;
  38.   uint32 scfsi;
  39.   uint32 scalefactor1, scalefactor2, scalefactor3;
  40.   bool     grouping;
  41.   uint32 codelength;
  42.   uint32 quantizationsteps;
  43.   real     factor;
  44.  
  45.   uint32 groupnumber;
  46.   uint32 samplenumber;
  47.   real     samples[3];
  48.   real     c, d;
  49.  
  50.   uint32 get_allocationlength (Header *);
  51.   uint32 prepare_sample_reading (Header *, uint32, bool *, uint32 *, real *,
  52.                  uint32 *, real *, real *);
  53.  
  54. public:
  55.         SubbandLayer2 (uint32 subbandnumber);
  56.   void        read_allocation (Ibitstream *, Header *, Crc16 *);
  57.   virtual void    read_scalefactor_selection (Ibitstream *, Crc16 *);
  58.   void        read_scalefactor (Ibitstream *, Header *);
  59.   bool        read_sampledata (Ibitstream *);
  60.   bool        put_next_sample (e_channels, SynthesisFilter *, SynthesisFilter * = NULL);
  61. };
  62.  
  63.  
  64. // class for layer II subbands in joint stereo mode:
  65. class SubbandLayer2IntensityStereo : public SubbandLayer2
  66. {
  67. protected:
  68.   uint32 channel2_scfsi;
  69.   uint32 channel2_scalefactor1, channel2_scalefactor2, channel2_scalefactor3;
  70.  
  71. public:
  72.        SubbandLayer2IntensityStereo (uint32 subbandnumber);
  73.   void read_allocation (Ibitstream *stream, Header *header, Crc16 *crc)
  74.   {
  75.     SubbandLayer2::read_allocation (stream, header, crc);
  76.   }
  77.   void read_scalefactor_selection (Ibitstream *, Crc16 *);
  78.   void read_scalefactor (Ibitstream *, Header *);
  79.   bool read_sampledata (Ibitstream *stream)
  80.   {
  81.     return SubbandLayer2::read_sampledata (stream);
  82.   }
  83.   bool put_next_sample (e_channels, SynthesisFilter *, SynthesisFilter *);
  84. };
  85.  
  86.  
  87. // class for layer II subbands in stereo mode:
  88. class SubbandLayer2Stereo : public SubbandLayer2
  89. {
  90. protected:
  91.   uint32 channel2_allocation;
  92.   uint32 channel2_scfsi;
  93.   uint32 channel2_scalefactor1, channel2_scalefactor2, channel2_scalefactor3;
  94.   bool     channel2_grouping;
  95.   uint32 channel2_codelength;
  96.   uint32 channel2_quantizationsteps;
  97.   real     channel2_factor;
  98.   real     channel2_samples[3];
  99.   real     channel2_c, channel2_d;
  100.  
  101. public:
  102.        SubbandLayer2Stereo (uint32 subbandnumber);
  103.   void read_allocation (Ibitstream *, Header *, Crc16 *);
  104.   void read_scalefactor_selection (Ibitstream *, Crc16 *);
  105.   void read_scalefactor (Ibitstream *, Header *);
  106.   bool read_sampledata (Ibitstream *);
  107.   bool put_next_sample (e_channels, SynthesisFilter *, SynthesisFilter *);
  108. };
  109.  
  110. #endif
  111.