Dirac - A Video Codec

Created by the British Broadcasting Corporation.


pixel_match.h
Go to the documentation of this file.
1/* ***** BEGIN LICENSE BLOCK *****
2*
3* $Id: pixel_match.h,v 1.11 2008/08/27 00:20:52 asuraparaju Exp $ $Name: Dirac_1_0_2 $
4*
5* Version: MPL 1.1/GPL 2.0/LGPL 2.1
6*
7* The contents of this file are subject to the Mozilla Public License
8* Version 1.1 (the "License"); you may not use this file except in compliance
9* with the License. You may obtain a copy of the License at
10* http://www.mozilla.org/MPL/
11*
12* Software distributed under the License is distributed on an "AS IS" basis,
13* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
14* the specific language governing rights and limitations under the License.
15*
16* The Original Code is BBC Research and Development code.
17*
18* The Initial Developer of the Original Code is the British Broadcasting
19* Corporation.
20* Portions created by the Initial Developer are Copyright (C) 2004.
21* All Rights Reserved.
22*
23* Contributor(s): Thomas Davies (Original Author)
24*
25* Alternatively, the contents of this file may be used under the terms of
26* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
27* Public License Version 2.1 (the "LGPL"), in which case the provisions of
28* the GPL or the LGPL are applicable instead of those above. If you wish to
29* allow use of your version of this file only under the terms of the either
30* the GPL or LGPL and not to allow others to use your version of this file
31* under the MPL, indicate your decision by deleting the provisions above
32* and replace them with the notice and other provisions required by the GPL
33* or LGPL. If you do not delete the provisions above, a recipient may use
34* your version of this file under the terms of any one of the MPL, the GPL
35* or the LGPL.
36* ***** END LICENSE BLOCK ***** */
37
38#ifndef _PIXEL_MATCH_H_
39#define _PIXEL_MATCH_H_
40
41/* *************************************************************************
42*
43* Class for getting motion vectors to pixel-accuracy
44*
45* The class could be implemented in any number of ways. The approach taken
46* has been to do hierarchical matching, which means doing block matching
47* on smaller, downcoverted versions of the pictures in order to get a wider
48* effective search range. At each level of searching the vectors discovered
49* can be used as guides to the next level of searching, and in this way
50* large motions can be detected easily. The danger is that the motions of
51* small objects can be overlooked.
52*
53* *************************************************************************/
54
58namespace dirac
59{
60 class EncQueue;
61 class MvData;
62 class EncoderParams;
63 class PicArray;
64
65
67 {
68 public:
69
72
74 /* Do the searching.
75
76 \param my_buffer the buffer of pictures from which pictures are taken
77 \param pic_num the number of the picture for which motion is to be estimated
78 \param mv_data class in which the measured motion vectors are stored, together with costs
79
80 */
81 void DoSearch( EncQueue& my_buffer, int pic_num );
82
83 private:
84
85 // Member variables
86
89
92
93 // the depth of the hierarchical match
95
96 // the level we're at (from 0 to depth)
98
99 // the search-range sizes for the hierarchical match
100 int m_xr, m_yr;
101
102 // the search-range sizes for when hierarchical match fails
104
105 // the temporal distances to the reference pictures
106 int m_tdiff[2];
107
108 // the picture sort - I, L1 or L2
110
111 // list of candidate vectors for checking
113
114 // Prediction used for each block. This is derived from neighbouring blocks
115 // and is used to control the variation in the motion vector field.
117
118 // The value used in computing block cost means with a simple recursive filter
119 double m_rho;
120
121 // The mean of the block cost
123
124 // The mean of the square of the block cost
126
127 private:
128
129 // Functions
130
132 void MakePicHierarchy(const PicArray& data, OneDArray< PicArray* >& down_data);
133
136 OneDArray< MEData* >& me_data_set );
137
139 void TidyPics( OneDArray< PicArray*>& down_data );
140
142 void TidyMEData( OneDArray< MEData*>& me_data_set );
143
145 void MatchPic(const PicArray& ref_data , const PicArray& pic_data , MEData& me_data ,
146 const MvData& guide_data, const int ref_id);
147
149 void DoBlock(const int xpos, const int ypos ,
150 const MvArray& guide_array,
151 BlockMatcher& block_match);
152
153 };
154
155} // namespace dirac
156
157#endif
Definition of class SequenceHeaderByteIO.
Definition: accessunit_byteio.h:52
std::vector< std::vector< MVector > > CandidateList
Definition: block_match.h:48
A template class for one-dimensional arrays.
Definition: arrays.h:90
A template class for two-dimensional arrays.
Definition: arrays.h:285
Picture type Class.
Definition: common.h:229
A class for picture component data.
Definition: common.h:719
Structure to hold motion parameters when motion comp is used.
Definition: common.h:968
Parameters for the encoding process.
Definition: common.h:1280
Class for all the motion vector data.
Definition: motion.h:220
Class for all the motion estimation data.
Definition: motion.h:314
Holds pictures both for reference and to overcome reordering delay.
Definition: enc_queue.h:59
Class to do block matching.
Definition: block_match.h:105
Definition: pixel_match.h:67
const EncoderParams & m_encparams
Local reference to the encoder params.
Definition: pixel_match.h:88
CandidateList m_cand_list
Definition: pixel_match.h:112
int m_big_yr
Definition: pixel_match.h:103
int m_tdiff[2]
Definition: pixel_match.h:106
void MakePicHierarchy(const PicArray &data, OneDArray< PicArray * > &down_data)
Make down-converted pictures.
int m_yr
Definition: pixel_match.h:100
MVector m_mv_prediction
Definition: pixel_match.h:116
double m_rho
Definition: pixel_match.h:119
void TidyMEData(OneDArray< MEData * > &me_data_set)
Tidy up the allocations made in building the MV data hirearchy.
void DoBlock(const int xpos, const int ypos, const MvArray &guide_array, BlockMatcher &block_match)
Do a given block.
void DoSearch(EncQueue &my_buffer, int pic_num)
Do the actual search.
const PicturePredParams * m_predparams
Local reference to the picture pred params.
Definition: pixel_match.h:91
PictureSort m_psort
Definition: pixel_match.h:109
int m_big_xr
Definition: pixel_match.h:103
void MatchPic(const PicArray &ref_data, const PicArray &pic_data, MEData &me_data, const MvData &guide_data, const int ref_id)
Match the picture data.
int m_level
Definition: pixel_match.h:97
double m_cost_mean_sq
Definition: pixel_match.h:125
int m_xr
Definition: pixel_match.h:100
double m_cost_mean
Definition: pixel_match.h:122
void TidyPics(OneDArray< PicArray * > &down_data)
Tidy up the allocations made in building the picture hirearchy.
void MakeMEDataHierarchy(const OneDArray< PicArray * > &down_data, OneDArray< MEData * > &me_data_set)
Make a hierarchy of MvData structures.
int m_depth
Definition: pixel_match.h:94
PixelMatcher(const EncoderParams &encp)
Constructor.

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