Dirac - A Video Codec

Created by the British Broadcasting Corporation.


band_codec.h

Go to the documentation of this file.
00001 /* ***** BEGIN LICENSE BLOCK ***** 00002 * 00003 * $Id: band_codec.h,v 1.7 2004/08/11 14:40:01 asuraparaju Exp $ $Name: Dirac_0_4_3 $ 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), Scott R Ladd 00024 * 00025 * Alternatively, the contents of this file may be used under the terms of 00026 * the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser 00027 * Public License Version 2.1 (the "LGPL"), in which case the provisions of 00028 * the GPL or the LGPL are applicable instead of those above. If you wish to 00029 * allow use of your version of this file only under the terms of the either 00030 * the GPL or LGPL and not to allow others to use your version of this file 00031 * under the MPL, indicate your decision by deleting the provisions above 00032 * and replace them with the notice and other provisions required by the GPL 00033 * or LGPL. If you do not delete the provisions above, a recipient may use 00034 * your version of this file under the terms of any one of the MPL, the GPL 00035 * or the LGPL. 00036 * ***** END LICENSE BLOCK ***** */ 00037 00038 #ifndef _BAND_CODEC_H_ 00039 #define _BAND_CODEC_H_ 00040 00041 #include <libdirac_common/arith_codec.h> 00042 #include <libdirac_common/wavelet_utils.h> 00043 00044 //Subclasses the arithmetic codec to produce a coding/decoding tool for subbands 00045 00046 00048 00051 class BandCodec: public ArithCodec<PicArray > 00052 { 00053 public: 00054 00056 00063 BandCodec(BasicOutputManager* bits_out, 00064 size_t number_of_contexts, 00065 const SubbandList& band_list, 00066 int band_num); 00067 00069 00076 BandCodec(BitInputManager* bits_in, 00077 size_t number_of_contexts, 00078 const SubbandList& band_list, 00079 int band_num); 00080 00082 void InitContexts(); 00083 00084 protected: 00085 void CodeVal(PicArray& in_data, const ValueType val);//code an individual value 00086 void DecodeVal(PicArray& out_data);//decode an individual value 00087 00088 private: 00089 //functions 00090 virtual void DoWorkCode(PicArray& in_data); //overridden from the base class 00091 virtual void DoWorkDecode(PicArray& in_data, int num_bits); //ditto 00092 00093 void Update( const bool symbol , const int context_num ); 00094 void Resize(const int context_num); 00095 void ResetAll(); 00096 00097 int ChooseContext(const PicArray& data, const int bin_number) const; 00098 int ChooseContext(const PicArray& data) const; 00099 int ChooseSignContext(const PicArray& data) const; 00100 00101 BandCodec(const BandCodec& cpy); //private, bodyless copy constructor: class should not be copied 00102 BandCodec& operator=(const BandCodec& rhs); //private, bodyless copy operator=: class should not be assigned 00103 00104 protected: 00106 int m_bnum; 00107 00109 const Subband m_node; 00110 00112 int m_xp, m_yp, m_xl, m_yl; 00113 00115 int m_xpos, m_ypos; 00116 00118 int m_vol; 00119 00121 int m_reset_coeff_num; 00122 00124 int m_coeff_count; 00125 00127 int m_qf, m_qfinv; 00128 00130 ValueType m_offset; 00131 00133 ValueType m_nhood_sum; 00134 00136 Subband m_pnode; 00137 00139 int m_pxp, m_pyp, m_pxl, m_pyl; 00140 00142 int m_pxpos, m_pypos; 00143 00145 bool m_parent_notzero; 00146 00148 ValueType m_cut_off_point; 00149 }; 00150 00152 00156 class LFBandCodec: public BandCodec 00157 { 00158 public: 00160 00167 LFBandCodec(BasicOutputManager* bits_out, 00168 size_t number_of_contexts, 00169 const SubbandList& band_list, 00170 int band_num) 00171 : BandCodec(bits_out,number_of_contexts,band_list,band_num){} 00172 00174 00181 LFBandCodec(BitInputManager* bits_in, 00182 size_t number_of_contexts, 00183 const SubbandList& band_list, 00184 int band_num) 00185 : BandCodec(bits_in,number_of_contexts,band_list,band_num){} 00186 00187 private: 00188 virtual void DoWorkCode(PicArray& InData); //overridden from the base class 00189 virtual void DoWorkDecode(PicArray& OutData, int num_bits); //ditto 00190 00191 LFBandCodec(const LFBandCodec& cpy); //private, bodyless copy constructor: class should not be copied 00192 LFBandCodec& operator=(const LFBandCodec& rhs); //private, bodyless copy operator=: class should not be assigned 00193 00194 }; 00195 00196 00198 //Finally,special class incorporating prediction for the DC band of intra frames// 00200 00202 00206 class IntraDCBandCodec: public BandCodec 00207 { 00208 public: 00210 00217 IntraDCBandCodec(BasicOutputManager* bits_out, 00218 size_t number_of_contexts, 00219 const SubbandList& band_list) 00220 : BandCodec(bits_out,number_of_contexts,band_list,band_list.Length()){} 00221 00223 00230 IntraDCBandCodec(BitInputManager* bits_in, 00231 size_t number_of_contexts, 00232 const SubbandList& band_list) 00233 : BandCodec(bits_in,number_of_contexts,band_list,band_list.Length()){} 00234 00235 private: 00236 virtual void DoWorkCode(PicArray& InData); //overridden from the base class 00237 virtual void DoWorkDecode(PicArray& OutData, int num_bits); //ditto 00238 00239 IntraDCBandCodec(const IntraDCBandCodec& cpy); //private, bodyless copy constructor: class should not be copied 00240 IntraDCBandCodec& operator=(const IntraDCBandCodec& rhs); //private, bodyless copy operator=: class should not be assigned 00241 00242 ValueType GetPrediction(const PicArray& Data) const;//prediction of a DC value from its previously coded neighbours 00243 }; 00244 00245 #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.