Created by the British Broadcasting Corporation.
00001 /* ***** BEGIN LICENSE BLOCK ***** 00002 * 00003 * $Id: mv_codec.h,v 1.19 2006/06/13 09:07:25 timborer Exp $ $Name: Dirac_0_6_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 * Tim Borer, 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 _MV_CODEC_H_ 00042 #define _MV_CODEC_H_ 00043 00045 //Class to do motion vector coding and decoding// 00046 //------using adaptive arithmetic coding-------// 00048 00049 #include <libdirac_common/arith_codec.h> 00050 #include <libdirac_common/common.h> 00051 #include <libdirac_common/motion.h> 00052 #include <libdirac_common/wavelet_utils.h> 00053 #include <vector> 00054 00055 namespace dirac 00056 { 00057 00059 00062 class MvDataCodec: public ArithCodec<MvData> 00063 { 00064 public: 00066 00072 MvDataCodec(ByteIO* p_byteio, 00073 size_t number_of_contexts, 00074 const ChromaFormat & cf); 00075 00076 00077 00079 void InitContexts(); 00080 00081 private: 00082 00083 int m_MB_count; 00084 const int m_reset_num; 00085 00086 const ChromaFormat & m_cformat; 00087 00088 // Position of current block 00089 int m_b_xp, m_b_yp; 00090 // Position of current MB 00091 int m_mb_xp, m_mb_yp; 00092 // Position of top-left block of current MB 00093 int m_mb_tlb_x, m_mb_tlb_y; 00094 00095 private: 00096 00097 // functions 00099 MvDataCodec(const MvDataCodec& cpy); 00101 MvDataCodec& operator=(const MvDataCodec& rhs); 00102 00103 // coding functions 00104 // Code the MB splitting mode 00105 void CodeMBSplit(const MvData& in_data); 00106 // Code the MB common ref mode 00107 void CodeMBCom(const MvData& in_data); 00108 // Code the block prediction mode 00109 void CodePredmode(const MvData& in_data); 00110 // Code the first motion vector 00111 void CodeMv1(const MvData& in_data); 00112 // Code the second motion vector 00113 void CodeMv2(const MvData& in_data); 00114 // Code the dc value of intra blocks 00115 void CodeDC(const MvData& in_data); 00116 00117 // decoding functions 00118 // Decode the MB splitting mode 00119 void DecodeMBSplit( MvData& out_data); 00120 // Decode the MB common ref mode 00121 void DecodeMBCom( MvData& out_data); 00122 // Decode the block prediction mode 00123 void DecodePredmode(MvData& out_data); 00124 // Decode the first motion vector 00125 void DecodeMv1( MvData& out_data); 00126 // Decode the second motion vector 00127 void DecodeMv2( MvData& out_data); 00128 // Decode the dc value of intra blocks 00129 void DecodeDC( MvData& out_data); 00130 00131 void DoWorkCode( MvData& in_data ); 00132 void DoWorkDecode(MvData& out_data); 00133 00134 // Context stuff 00135 void ResetAll(); 00136 00137 //prediction stuff 00138 unsigned int MBSplitPrediction(const TwoDArray<int>& mbdata) const; 00139 00140 bool MBCBModePrediction(const TwoDArray<bool>& mbdata) const; 00141 00142 unsigned int BlockModePrediction(const TwoDArray<PredMode>& preddata, 00143 const unsigned int num_refs) const; 00144 00145 MVector Mv1Prediction( const MvArray& mvarray, 00146 const TwoDArray<PredMode>& preddata) const; 00147 00148 MVector Mv2Prediction( const MvArray& mvarray, 00149 const TwoDArray<PredMode>& preddata) const; 00150 00151 ValueType DCPrediction( const TwoDArray<ValueType>& dcdata, 00152 const TwoDArray<PredMode>& preddata) const; 00153 }; 00154 00155 }// end namepace dirac 00156 00157 #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.