Dirac - A Video Codec

Created by the British Broadcasting Corporation.


band_vlc.h
Go to the documentation of this file.
1 /* ***** BEGIN LICENSE BLOCK *****
2 *
3 * $Id: band_vlc.h,v 1.8 2009/02/09 09:44:56 asuraparaju Exp $ $Name: Dirac_1_0_2 $
4 *
5 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 *
7 * The contents of this file are subject to the Mozilla Public License
8 * Version 1.1 (the "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 * http://www.mozilla.org/MPL/
11 *
12 * Software distributed under the License is distributed on an "AS IS" basis,
13 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
14 * the specific language governing rights and limitations under the License.
15 *
16 * The Original Code is BBC Research and Development code.
17 *
18 * The Initial Developer of the Original Code is the British Broadcasting
19 * Corporation.
20 * Portions created by the Initial Developer are Copyright (C) 2004.
21 * All Rights Reserved.
22 *
23 * Contributor(s): Thomas Davies (Original Author),
24 * Scott R Ladd,
25 * Steve Bearcroft
26 * Andrew Kennedy
27 *
28 * Alternatively, the contents of this file may be used under the terms of
29 * the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
30 * Public License Version 2.1 (the "LGPL"), in which case the provisions of
31 * the GPL or the LGPL are applicable instead of those above. If you wish to
32 * allow use of your version of this file only under the terms of the either
33 * the GPL or LGPL and not to allow others to use your version of this file
34 * under the MPL, indicate your decision by deleting the provisions above
35 * and replace them with the notice and other provisions required by the GPL
36 * or LGPL. If you do not delete the provisions above, a recipient may use
37 * your version of this file under the terms of any one of the MPL, the GPL
38 * or the LGPL.
39 * ***** END LICENSE BLOCK ***** */
40 
41 #ifndef _BAND_VLC_H
42 #define _BAND_VLC_H
43 
46 
47 
48 namespace dirac
49 {
50 
51  class SubbandByteIO;
52  class ByteIO;
53 
56  {
57  public:
59  ArithCodecToVLCAdapter(SubbandByteIO* subband_byteio, size_t number_of_contexts);
60 
63 
64  /* Compresses the input and returns the number of bits written */
65  int Compress (CoeffArray &in_data);
66 
67  /* Decompresses the bitstream */
68  void Decompress (CoeffArray& out_data, int num_bytes);
69 
70  /* Encodes a symbol and writes to the output */
71  void EncodeSymbol(bool val, int /*context_num*/)
72  {
73  m_byteio->WriteBit(val);
74  }
75 
76  /* Decodes a symbol */
77  bool DecodeSymbol(int /*context_num*/)
78  {
79  return m_byteio->ReadBoolB();
80  }
81 
83  virtual void DoWorkCode(CoeffArray &in_data) = 0;
84 
86  virtual void DoWorkDecode(CoeffArray &out_data) = 0;
87 
88  protected:
91 
92  private:
97  };
98 
99 
101 
105 
107  //Finally,special class incorporating prediction for the DC band of intra frames//
109 
111 
115  class IntraDCBandVLC: public GenericIntraDCBandCodec<ArithCodecToVLCAdapter>
116  {
117  public:
119 
124  IntraDCBandVLC(SubbandByteIO* subband_byteio,
125  const SubbandList& band_list);
126  private:
128  void CodeCoeff(CoeffArray& in_data, const int xpos, const int ypos);
129 
130  private:
132  IntraDCBandVLC (const IntraDCBandVLC& cpy);
133 
136  };
137 
138 
139 }// end namespace dirac
140 #endif
Definition of class SequenceHeaderByteIO.
Definition: accessunit_byteio.h:51
void EncodeSymbol(bool val, int)
Definition: band_vlc.h:71
A class for wavelet coefficient data.
Definition: wavelet_utils.h:622
void CodeCoeff(CoeffArray &in_data, const int xpos, const int ypos)
Encode a single coefficient using error-feedback DC quantization.
A class specially for coding the DC subband of Intra frames.
Definition: band_vlc.h:115
A class encapulating all the subbands produced by a transform.
Definition: wavelet_utils.h:279
IntraDCBandVLC & operator=(const IntraDCBandVLC &rhs)
Private, bodyless copy operator=: class should not be assigned.
bool ReadBoolB()
Reads boolean value - bounded i/o.
GenericBandCodec< ArithCodecToVLCAdapter > BandVLC
A general class for coding and decoding wavelet subband data using variable length coding...
Definition: band_vlc.h:104
Subband Dirac-bytestream input/output.
Definition: subband_byteio.h:56
A template class specially for coding the DC subband of Intra frames.
Definition: band_codec.h:171
virtual ~ArithCodecToVLCAdapter()
Definition: band_vlc.h:62
bool DecodeSymbol(int)
Definition: band_vlc.h:77
ByteIO * m_byteio
Definition: band_vlc.h:90
Definition: band_vlc.h:55
Class ByteIO - top-level class for reading/writing bytes to a stream
Definition: byteio.h:72
virtual void DoWorkCode(CoeffArray &in_data)=0
int Compress(CoeffArray &in_data)
ArithCodecToVLCAdapter(SubbandByteIO *subband_byteio, size_t number_of_contexts)
virtual void DoWorkDecode(CoeffArray &out_data)=0
IntraDCBandVLC(SubbandByteIO *subband_byteio, const SubbandList &band_list)
Constructor.
void WriteBit(const bool &bit)
Outputs a bit
ArithCodecToVLCAdapter & operator=(const ArithCodecToVLCAdapter &rhs)
Private, bodyless copy operator=: class should not be assigned.
void Decompress(CoeffArray &out_data, int num_bytes)

© 2004 British Broadcasting Corporation. Dirac code licensed under the Mozilla Public License (MPL) Version 1.1.
HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.