Dirac - A Video Codec

Created by the British Broadcasting Corporation.


band_vlc.h

Go to the documentation of this file.
00001 /* ***** BEGIN LICENSE BLOCK *****
00002 *
00003 * $Id: band_vlc.h,v 1.8 2009/02/09 09:44:56 asuraparaju Exp $ $Name: Dirac_1_0_2 $
00004 *
00005 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00006 *
00007 * The contents of this file are subject to the Mozilla Public License
00008 * Version 1.1 (the "License"); you may not use this file except in compliance
00009 * with the License. You may obtain a copy of the License at
00010 * http://www.mozilla.org/MPL/
00011 *
00012 * Software distributed under the License is distributed on an "AS IS" basis,
00013 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
00014 * the specific language governing rights and limitations under the License.
00015 *
00016 * The Original Code is BBC Research and Development code.
00017 *
00018 * The Initial Developer of the Original Code is the British Broadcasting
00019 * Corporation.
00020 * Portions created by the Initial Developer are Copyright (C) 2004.
00021 * All Rights Reserved.
00022 *
00023 * Contributor(s): Thomas Davies (Original Author),
00024 *                 Scott R Ladd,
00025 *                 Steve Bearcroft
00026 *                 Andrew Kennedy
00027 *
00028 * Alternatively, the contents of this file may be used under the terms of
00029 * the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
00030 * Public License Version 2.1 (the "LGPL"), in which case the provisions of
00031 * the GPL or the LGPL are applicable instead of those above. If you wish to
00032 * allow use of your version of this file only under the terms of the either
00033 * the GPL or LGPL and not to allow others to use your version of this file
00034 * under the MPL, indicate your decision by deleting the provisions above
00035 * and replace them with the notice and other provisions required by the GPL
00036 * or LGPL. If you do not delete the provisions above, a recipient may use
00037 * your version of this file under the terms of any one of the MPL, the GPL
00038 * or the LGPL.
00039 * ***** END LICENSE BLOCK ***** */
00040 
00041 #ifndef _BAND_VLC_H
00042 #define _BAND_VLC_H
00043 
00044 #include <libdirac_common/wavelet_utils.h>
00045 #include <libdirac_common/band_codec.h>
00046 
00047 
00048 namespace dirac
00049 {
00050 
00051    class SubbandByteIO;
00052    class ByteIO;
00053 
00055     class ArithCodecToVLCAdapter
00056     {
00057     public:
00059         ArithCodecToVLCAdapter(SubbandByteIO* subband_byteio, size_t number_of_contexts);
00060 
00062         virtual ~ArithCodecToVLCAdapter(){}
00063 
00064         /* Compresses the input and returns the number of bits written */
00065         int Compress (CoeffArray &in_data);
00066 
00067         /* Decompresses the bitstream */
00068         void Decompress (CoeffArray& out_data, int num_bytes);
00069 
00070         /* Encodes a symbol and writes to the output */
00071         void EncodeSymbol(bool val, int /*context_num*/)
00072         {
00073             m_byteio->WriteBit(val);
00074         }
00075 
00076         /* Decodes a symbol */
00077         bool DecodeSymbol(int /*context_num*/)
00078         {
00079             return m_byteio->ReadBoolB();
00080         }
00081 
00083         virtual void DoWorkCode(CoeffArray &in_data) = 0;
00084 
00086         virtual void DoWorkDecode(CoeffArray &out_data) = 0;
00087 
00088     protected:
00090         ByteIO *m_byteio;
00091 
00092     private:
00094         ArithCodecToVLCAdapter(const ArithCodecToVLCAdapter& cpy);
00096         ArithCodecToVLCAdapter& operator=(const ArithCodecToVLCAdapter& rhs);
00097     };
00098 
00099 
00101 
00104     typedef GenericBandCodec<ArithCodecToVLCAdapter> BandVLC;
00105 
00107     //Finally,special class incorporating prediction for the DC band of intra frames//
00109 
00111 
00115     class IntraDCBandVLC: public GenericIntraDCBandCodec<ArithCodecToVLCAdapter>
00116     {
00117     public:
00119 
00124         IntraDCBandVLC(SubbandByteIO* subband_byteio,
00125                          const SubbandList& band_list);
00126     private:
00128         void CodeCoeff(CoeffArray& in_data, const int xpos, const int ypos);
00129 
00130     private:
00132         IntraDCBandVLC (const IntraDCBandVLC& cpy);
00133 
00135         IntraDCBandVLC& operator=(const IntraDCBandVLC& rhs);
00136     };
00137 
00138 
00139 }// end namespace dirac
00140 #endif

© 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.