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.2 2007/12/13 14:49:47 tjdwave Exp $ $Name: Dirac_0_9_0 $
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 
00046 
00047 namespace dirac
00048 {
00049 
00050    class SubbandByteIO;
00051    class ByteIO;
00052 
00053 
00055 
00058     class BandVLC
00059     {
00060     public:
00061 
00063 
00070         BandVLC(SubbandByteIO* subband_byteio,
00071                   const SubbandList& band_list,
00072                   int band_num,
00073                   const bool is_intra);
00074 
00075 
00076         void Decompress (CoeffArray& out_data, int num_bytes);
00077 
00078         int Compress (CoeffArray &in_data);
00079 
00080         virtual ~BandVLC(){}
00081 
00082     protected:
00084         inline void CodeVal( CoeffArray& in_data , const int xpos , const int ypos , const CoeffType val);
00085 
00087         inline void DecodeVal(CoeffArray& out_data , const int xpos , const int ypos );
00088 
00090         void CodeQIndexOffset( const int offset );
00091 
00093         int DecodeQIndexOffset();
00094 
00096         inline void SetToVal( const CodeBlock& code_block , CoeffArray& coeff_data , const CoeffType val);
00097 
00099         inline void ClearBlock( const CodeBlock& code_block , CoeffArray& coeff_data);
00100     private:
00101         //functions
00102         // Overridden from the base class
00103         virtual void DoWorkCode(CoeffArray& in_data);
00104         // Ditto
00105         virtual void DoWorkDecode(CoeffArray& out_data);
00106 
00107         virtual void CodeCoeffBlock(const CodeBlock& code_block , CoeffArray& in_data);
00108         virtual void DecodeCoeffBlock(const CodeBlock& code_block , CoeffArray& out_data);
00109 
00111         BandVLC(const BandVLC& cpy);
00113         BandVLC& operator=(const BandVLC& rhs);
00114 
00115     protected:
00116               
00118         bool m_is_intra;
00119     
00121         int m_bnum;
00122 
00124         const Subband m_node;
00125     
00127         int m_last_qf_idx;
00128             
00130         int m_qf;
00131     
00133         CoeffType m_offset;
00134 
00136         ByteIO *m_byteio;
00137     
00138     };
00139 
00141     //Finally,special class incorporating prediction for the DC band of intra frames//
00143 
00145 
00149     class IntraDCBandVLC: public BandVLC
00150     {
00151     public:
00153 
00158         IntraDCBandVLC(SubbandByteIO* subband_byteio,
00159                          const SubbandList& band_list)
00160           : BandVLC(subband_byteio,band_list,
00161                       band_list.Length(), true){}
00162 
00163     
00164     private:
00165         void DoWorkCode(CoeffArray& in_data);                    //overridden from the base class
00166         void DoWorkDecode(CoeffArray& out_data); //ditto
00167 
00168         void CodeCoeffBlock(const CodeBlock& code_block , CoeffArray& in_data);
00169         void DecodeCoeffBlock(const CodeBlock& code_block , CoeffArray& out_data);
00170 
00172         IntraDCBandVLC (const IntraDCBandVLC& cpy); 
00173 
00175         IntraDCBandVLC& operator=(const IntraDCBandVLC& rhs);
00176 
00178         CoeffType GetPrediction(const CoeffArray& data , const int xpos , const int ypos ) const;
00179     };
00180 
00181 
00182 }// end namespace dirac
00183 #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.