Dirac - A Video Codec

Created by the British Broadcasting Corporation.


block_match.h

Go to the documentation of this file.
00001 /* ***** BEGIN LICENSE BLOCK ***** 00002 * 00003 * $Id: block_match.h,v 1.5 2004/08/03 09:23: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) 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 _BLOCK_MATCH_H_ 00039 #define _BLOCK_MATCH_H_ 00040 00041 #include <libdirac_motionest/me_utils.h> 00042 #include <vector> 00043 //handles the business of finding the best block match 00044 00045 typedef std::vector< std::vector< MVector > > CandidateList; 00046 00048 /* 00049 Add a new motion vector list to the set of lists consisting of the 00050 square neighbourhood [mv.x-xr,mv.x+xr] by 00051 [mv.y-yr,mv.y+yr]. Vectors that already occur in previous lists are not added. 00052 */ 00053 void AddNewVlist( CandidateList& vect_list , const MVector& mv , const int xr , const int yr ); 00054 00056 /* 00057 Add a new motion vector list to the set of lists consisting of the vectors of the 00058 form (mv.x+m*step,mv.y+n*step) where m lies between -xr and xr and n lies between -yr and yr. 00059 Vectors that already occur in previous lists are not added. 00060 */ 00061 void AddNewVlist( CandidateList& vect_list , const MVector& mv , const int xr , const int yr , const int step ); 00062 00064 /* 00065 Add a new motion vector list to the set of lists consisting of the diagonal neighbourhood of height 2yr+1 pixels and 00066 width 2xr+1 centred on \param mv 00067 Vectors that already occur in previous lists are not added. 00068 */ 00069 void AddNewVlistD( CandidateList& vect_list , const MVector& mv , const int xr, const int yr); 00070 00072 00075 void AddVect( CandidateList& vect_list , const MVector& mv , const int list_num); 00076 00078 00081 ValueType GetVar(const MVector& mv1,const MVector& mv2); 00082 00084 00089 ValueType GetVar(const std::vector<MVector>& pred_list,const MVector& mv); 00090 00091 00093 00094 // Subsumes FindBestMatch and FindBestMatchSubpel 00095 class BlockMatcher 00096 { 00097 public: 00099 00108 BlockMatcher( const PicArray& ref_data , 00109 const PicArray& pic_data , 00110 const OLBParams& bparams , 00111 const MvArray& mv_array , 00112 const TwoDArray< MvCostData >& cost_array); 00113 00115 00123 void FindBestMatch(int xpos , int ypos, 00124 const CandidateList& cand_list, 00125 const MVector& mv_prediction, 00126 float lambda); 00127 00129 00137 void FindBestMatchSubp(int xpos, int ypos, 00138 const CandidateList& cand_list, 00139 const MVector& mv_prediction, 00140 float lambda); 00141 00142 private: 00143 // Local copies of the picture and reference 00144 const PicArray& m_pic_data; 00145 const PicArray& m_ref_data; 00146 00147 // Local copy of the motion vector array being populated 00148 const MvArray& m_mv_array; 00149 00150 // Local copy of the costs being determined through the matching 00151 const TwoDArray< MvCostData >& m_cost_array; 00152 00153 // Block difference elements. Will choose between them depending 00154 // on whether we're at the edge of the picture 00155 SimpleBlockDiff m_simplediff; 00156 BChkBlockDiff m_checkdiff; 00157 SimpleBlockDiffUp m_simplediffup; 00158 BChkBlockDiffUp m_checkdiffup; 00159 00160 // The block parameters we're using 00161 OLBParams m_bparams; 00162 00163 }; 00164 #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.