Dirac - A Video Codec

Created by the British Broadcasting Corporation.


mv_codec.h
Go to the documentation of this file.
1/* ***** BEGIN LICENSE BLOCK *****
2*
3* $Id: mv_codec.h,v 1.25 2008/10/01 01:26:47 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* Scott R Ladd,
25* Tim Borer,
26* Andrew Kennedy
27*
28* Alternatively, the contents of this file may be used under the terms of
29* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
30* Public License Version 2.1 (the "LGPL"), in which case the provisions of
31* the GPL or the LGPL are applicable instead of those above. If you wish to
32* allow use of your version of this file only under the terms of the either
33* the GPL or LGPL and not to allow others to use your version of this file
34* under the MPL, indicate your decision by deleting the provisions above
35* and replace them with the notice and other provisions required by the GPL
36* or LGPL. If you do not delete the provisions above, a recipient may use
37* your version of this file under the terms of any one of the MPL, the GPL
38* or the LGPL.
39* ***** END LICENSE BLOCK ***** */
40
41#ifndef _MV_CODEC_H_
42#define _MV_CODEC_H_
43
45//Class to do motion vector coding and decoding//
46//------using adaptive arithmetic coding-------//
48
53#include <vector>
54
55namespace dirac
56{
58
61 class SplitModeCodec: public ArithCodec<MvData>
62 {
63 public:
65
70 SplitModeCodec(ByteIO* p_byteio, size_t number_of_contexts);
71
72
73
76
77 private:
78
79 // Position of current SB
81
82 private:
83
84 // functions
89
90 // coding functions
91 // Code the SB splitting mode
92 void CodeVal(const MvData& in_data);
93
94 // decoding functions
95 // Decode the SB splitting mode
96 void DecodeVal( MvData& out_data);
97
98 void DoWorkCode( MvData& in_data );
99 void DoWorkDecode(MvData& out_data);
100
101 // Context stuff
102 void ResetAll();
103
104 //prediction stuff
105 unsigned int Prediction(const TwoDArray<int>& mbdata) const;
106
107 };
108
109/******************************************************************************/
110
112
115 class PredModeCodec: public ArithCodec<MvData>
116 {
117 public:
119
125 PredModeCodec(ByteIO* p_byteio, size_t number_of_contexts, const int num_refs);
126
129
130 private:
131
132 // Position of current block
134 // Position of current SB
136 // Position of top-left block of current SB
138 // Number of reference pictures
140
141 private:
142
143 // functions
148
149 // coding functions
150 // Code the block prediction mode
151 void CodeVal(const MvData& in_data);
152
153 // decoding functions
154 // Decode the block prediction mode
155 void DecodeVal(MvData& out_data);
156
157 void DoWorkCode( MvData& in_data );
158 void DoWorkDecode(MvData& out_data);
159
160 // Context stuff
161 void ResetAll();
162
163 //prediction stuff
164 unsigned int Prediction(const TwoDArray<PredMode>& preddata) const;
165
166 };
167
168/******************************************************************************/
169
171
175 class VectorElementCodec: public ArithCodec<MvData>
176 {
177 public:
179
186 VectorElementCodec(ByteIO* p_byteio, int ref_id, MvElement horvert,
187 size_t number_of_contexts);
188
189
192
193 private:
194
195 // Position of current block
197
198 // Position of current SB
200
201 // Position of top-left block of current SB
203
204 // The identity of the reference (1 or 2)
205 const int m_ref;
206
207 // Whether it's the vertical or horizontal MV element
209
210 private:
211
212 // functions
217
218 // coding functions
219 // Code the motion vector element
220 void CodeVal(const MvData& in_data);
221
222 // decoding functions
223 // Decode the motion vector element
224 void DecodeVal( MvData& out_data);
225
226 void DoWorkCode( MvData& in_data );
227 void DoWorkDecode(MvData& out_data);
228
229 // Context stuff
230 void ResetAll();
231
232 //prediction stuff
233 int Prediction( const MvArray& mvarray,
234 const TwoDArray<PredMode>& preddata) const;
235
236 };
237
238/******************************************************************************/
240
244 class DCCodec: public ArithCodec<MvData>
245 {
246 public:
248
254 DCCodec(ByteIO* p_byteio, const CompSort csort, size_t number_of_contexts);
255
258
259 private:
260
261 // The component being coded
263 // Position of current block
265 // Position of current SB
267 // Position of top-left block of current SB
269
270 private:
271
272 // functions
274 DCCodec(const DCCodec& cpy);
277
278 // coding functions
279 // Code the dc value of intra blocks
280 void CodeVal(const MvData& in_data);
281
282 // decoding functions
283 // Decode the dc value of intra blocks
284 void DecodeVal( MvData& out_data);
285
286 void DoWorkCode( MvData& in_data );
287 void DoWorkDecode(MvData& out_data);
288
289 // Context stuff
290 void ResetAll();
291
292 //prediction stuff
294 const TwoDArray<PredMode>& preddata) const;
295 };
296
297
298}// end namepace dirac
299
300
301#endif
Definition of class SequenceHeaderByteIO.
Definition: accessunit_byteio.h:52
CompSort
Types of picture component.
Definition: common.h:87
short ValueType
Type of picture data (including motion compensated residuals)
Definition: common.h:70
MvElement
Horizontal or vertical.
Definition: motion.h:54
Class ByteIO - top-level class for reading/writing bytes to a stream.
Definition: byteio.h:73
Abstract binary arithmetic coding class.
Definition: arith_codec.h:376
Class for all the motion vector data.
Definition: motion.h:220
Codes and decodes the split mode.
Definition: mv_codec.h:62
SplitModeCodec(ByteIO *p_byteio, size_t number_of_contexts)
Constructor.
void DoWorkDecode(MvData &out_data)
virtual decode-only functions
SplitModeCodec & operator=(const SplitModeCodec &rhs)
Private, bodyless copy operator=: class should not be assigned.
unsigned int Prediction(const TwoDArray< int > &mbdata) const
void DecodeVal(MvData &out_data)
void CodeVal(const MvData &in_data)
void DoWorkCode(MvData &in_data)
Does the work of actually coding the data.
void InitContexts()
Initialises the contexts
SplitModeCodec(const SplitModeCodec &cpy)
Private, bodyless copy constructor: class should not be copied.
int m_sb_yp
Definition: mv_codec.h:80
int m_sb_xp
Definition: mv_codec.h:80
Codes and decodes the prediction modes.
Definition: mv_codec.h:116
unsigned int Prediction(const TwoDArray< PredMode > &preddata) const
void InitContexts()
Initialises the contexts.
void CodeVal(const MvData &in_data)
void DoWorkCode(MvData &in_data)
Does the work of actually coding the data.
void DecodeVal(MvData &out_data)
PredModeCodec(const PredModeCodec &cpy)
Private, bodyless copy constructor: class should not be copied.
PredModeCodec(ByteIO *p_byteio, size_t number_of_contexts, const int num_refs)
Constructor.
PredModeCodec & operator=(const PredModeCodec &rhs)
Private, bodyless copy operator=: class should not be assigned.
int m_b_yp
Definition: mv_codec.h:133
int m_sb_tlb_y
Definition: mv_codec.h:137
void DoWorkDecode(MvData &out_data)
virtual decode-only functions
int m_num_refs
Definition: mv_codec.h:139
int m_sb_yp
Definition: mv_codec.h:135
int m_sb_tlb_x
Definition: mv_codec.h:137
int m_sb_xp
Definition: mv_codec.h:135
int m_b_xp
Definition: mv_codec.h:133
Codes and decodes an array of motion vectors.
Definition: mv_codec.h:176
void InitContexts()
Initialises the contexts
int m_sb_yp
Definition: mv_codec.h:199
VectorElementCodec & operator=(const VectorElementCodec &rhs)
Private, bodyless copy operator=: class should not be assigned.
const int m_ref
Definition: mv_codec.h:205
VectorElementCodec(ByteIO *p_byteio, int ref_id, MvElement horvert, size_t number_of_contexts)
Constructor.
VectorElementCodec(const VectorElementCodec &cpy)
Private, bodyless copy constructor: class should not be copied.
int m_sb_xp
Definition: mv_codec.h:199
int m_sb_tlb_y
Definition: mv_codec.h:202
int m_b_yp
Definition: mv_codec.h:196
const MvElement m_hv
Definition: mv_codec.h:208
int Prediction(const MvArray &mvarray, const TwoDArray< PredMode > &preddata) const
int m_b_xp
Definition: mv_codec.h:196
void DecodeVal(MvData &out_data)
void CodeVal(const MvData &in_data)
void DoWorkDecode(MvData &out_data)
virtual decode-only functions
void DoWorkCode(MvData &in_data)
Does the work of actually coding the data.
int m_sb_tlb_x
Definition: mv_codec.h:202
Codes and decodes a set of DC values.
Definition: mv_codec.h:245
int m_sb_xp
Definition: mv_codec.h:266
void InitContexts()
Initialises the contexts
DCCodec(const DCCodec &cpy)
Private, bodyless copy constructor: class should not be copied.
DCCodec & operator=(const DCCodec &rhs)
Private, bodyless copy operator=: class should not be assigned.
void DecodeVal(MvData &out_data)
const CompSort m_csort
Definition: mv_codec.h:262
void DoWorkDecode(MvData &out_data)
virtual decode-only functions
int m_sb_tlb_x
Definition: mv_codec.h:268
int m_sb_yp
Definition: mv_codec.h:266
int m_b_yp
Definition: mv_codec.h:264
void DoWorkCode(MvData &in_data)
Does the work of actually coding the data.
DCCodec(ByteIO *p_byteio, const CompSort csort, size_t number_of_contexts)
Constructor.
ValueType Prediction(const TwoDArray< ValueType > &dcdata, const TwoDArray< PredMode > &preddata) const
void CodeVal(const MvData &in_data)
int m_b_xp
Definition: mv_codec.h:264
int m_sb_tlb_y
Definition: mv_codec.h:268

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