# Dirac - A Video Codec

Created by the British Broadcasting Corporation.

overlay.h
Go to the documentation of this file.
1 /* ***** BEGIN LICENSE BLOCK *****
2 *
3 * $Id: overlay.h,v 1.7 2008/03/14 08:17:37 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): Chris Bowley (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 __OVERLAY_H__
39 #define __OVERLAY_H__
40
41
42 #include <libdirac_common/common.h>
43 #include <libdirac_common/motion.h>
44 #include <libdirac_common/picture.h>
45 #include <util/instrumentation/libdirac_instrument/motion_colour.h>
46 #include <util/instrumentation/libdirac_instrument/motion_colour_arrows.h>
47 #include <util/instrumentation/libdirac_instrument/sad.h>
48 #include <util/instrumentation/libdirac_instrument/split_mode.h>
49 #include <util/instrumentation/libdirac_instrument/pred_mode.h>
50 #include <util/instrumentation/libdirac_instrument/overlay_symbols.h>
51 #include <util/instrumentation/libdirac_instrument/gm_inliers.h>
52
53 using dirac::MEData;
54 using dirac::OLBParams;
55
56 namespace dirac_instr
57 {
58 #define NO_REF -1
59
61 enum OverlayOption
62 {
63 motion_arrows, motion_colour, motion_colour_arrows,
64 gm_arrows, gm_colour, gm_colour_arrows,
65 gm_diff_arrows, gm_diff_colour, gm_diff_colour_arrows,
66 gm_inliers, split_mode, SAD, pred_mode
67 };
68
70 class OverlayParams
71 {
72 public:
73
75 // //
76 // Assumes default constructor, copy constructor //
77 // and assignment = //
78 // //
80
83 OverlayOption Option() const {return m_option;}
84
86 int Reference() const {return m_ref;}
87
89 int Background() const {return m_bg;}
90
92 int Legend() const {return m_legend;}
93
95 int MvClip() const {return m_mv_clip;}
96
98 int SADClip() const {return m_sad_clip;}
99
102 void SetOption(OverlayOption o) {m_option=o;}
103
105 void SetReference(int r) {m_ref=r;}
106
108 void SetBackground(bool b) {m_bg=b;}
109
111 void SetLegend(bool l) {m_legend=l;}
112
114 void SetMvClip(int c) {m_mv_clip=c;}
115
117 void SetSADClip(int c) {m_sad_clip=c;}
118
119 private:
121 OverlayOption m_option;
122
124 int m_ref;
125
127 bool m_bg;
128
130 bool m_legend;
131
133 int m_mv_clip;
134
136 int m_sad_clip;
137 };
138
140 class Overlay
141 {
142 public:
144 Overlay(const OverlayParams &, Picture &);
145
147 ~Overlay();
148
150 // //
151 // Assumes default copy constructor and assignment = //
152 // //
154
155 void ProcessPicture(const MEData &, const OLBParams &);
156
157 void ProcessPicture();
158
159 private:
160
162 /*
163 Main overlay is carried out on a motion vector block by block basis
164 */
165 void DoOverlay(const MEData &);
166
168 /*
169 Difference picture formats use different chroma resolutions with
170 respect to luma
171 */
172 void CalculateFactors(const ChromaFormat &);
173
175 /*
176 Pictures must have an integer number of macroblocks, more
177 macroblocks may have been used during encoding and hence the picture
178 must be padded now in order for the correct macroblock (and motion
179 vector block) size to be calculated
180 */
181 void PadPicture(const MEData &);
182
184 void GlobalMotionDifference(const MEData &, MvArray &);
185
187 int m_mv_scale;
188
190 int m_ref;
191
193 const OverlayParams m_oparams;
194
196 Picture & m_picture;
197
199 DrawPictureMotionParams m_draw_params;
200 };
201
202 } // namespace dirac_instr
203
204 #endif
205
dirac_instr::gm_arrows
Definition: overlay.h:64
dirac_instr::gm_inliers
Definition: overlay.h:66
dirac_instr::OverlayParams::m_ref
int m_ref
Reference picture.
Definition: overlay.h:124
dirac_instr::OverlayParams::m_sad_clip
int m_sad_clip
SAD clip value.
Definition: overlay.h:136
dirac_instr::OverlayParams::SetLegend
void SetLegend(bool l)
Set display of colour legend.
Definition: overlay.h:111
split_mode.h
dirac_instr::split_mode
Definition: overlay.h:66
dirac_instr::Overlay::ProcessPicture
void ProcessPicture()
dirac_instr::OverlayParams::SetReference
void SetReference(int r)
Set which reference picture is to be used.
Definition: overlay.h:105
motion_colour.h
dirac_instr::DrawPictureMotionParams
Class encapsulating parameters for drawing the picture.
Definition: draw_overlay.h:55
dirac_instr::gm_colour
Definition: overlay.h:64
dirac_instr::OverlayParams::Option
OverlayOption Option() const
Get functions...
Definition: overlay.h:83
dirac_instr::OverlayParams::m_option
OverlayOption m_option
Instrumentation command line option.
Definition: overlay.h:121
dirac::MvArray
TwoDArray< MVector > MvArray
MvArray is a two-D array of MVectors.
Definition: motion.h:186
dirac_instr::OverlayParams::Background
int Background() const
Returns true if input picture background is used, false if grey.
Definition: overlay.h:89
dirac_instr::OverlayParams::Reference
int Reference() const
Returns which reference is to be used.
Definition: overlay.h:86
sad.h
dirac_instr::Overlay::~Overlay
~Overlay()
Destructor.
dirac_instr::Overlay::GlobalMotionDifference
void GlobalMotionDifference(const MEData &, MvArray &)
Remove global motion from block motion.
dirac_instr::OverlayParams::Legend
int Legend() const
Returns true if colour legend is displayed.
Definition: overlay.h:92
common.h
dirac_instr::Overlay
Class managing instrumentation overlay.
Definition: overlay.h:140
dirac_instr::Overlay::PadPicture
void PadPicture(const MEData &)
Calculates if picture requires padding.
motion.h
dirac_instr::pred_mode
Definition: overlay.h:66
dirac_instr::SAD
Definition: overlay.h:66
dirac_instr::motion_arrows
Definition: overlay.h:63
dirac_instr::Overlay::m_ref
int m_ref
Local copy of reference offset.
Definition: overlay.h:190
ChromaFormat
ChromaFormat
Definition: common_types.h:58
dirac_instr::Overlay::m_mv_scale
int m_mv_scale
Temporal scaling factor for motion vectors.
Definition: overlay.h:187
dirac::OLBParams
Parameters for overlapped block motion compensation.
Definition: common.h:817
dirac_instr::OverlayParams
Class holding instrumentation overlay information.
Definition: overlay.h:70
dirac::MEData
Class for all the motion estimation data.
Definition: motion.h:313
dirac_instr::gm_diff_arrows
Definition: overlay.h:65
dirac_instr::OverlayParams::SetSADClip
void SetSADClip(int c)
Set clip for sad.
Definition: overlay.h:117
pred_mode.h
dirac_instr::Overlay::DoOverlay
void DoOverlay(const MEData &)
Manages overlay based on command-line option.
dirac_instr::OverlayParams::SetMvClip
void SetMvClip(int c)
Set clip for motion vectors.
Definition: overlay.h:114
dirac_instr
Definition: draw_overlay.h:50
dirac_instr::gm_diff_colour
Definition: overlay.h:65
dirac_instr::motion_colour_arrows
Definition: overlay.h:63
dirac_instr::Overlay::m_draw_params
DrawPictureMotionParams m_draw_params
Parameters for drawing picture overlays.
Definition: overlay.h:199
dirac_instr::OverlayParams::SetOption
void SetOption(OverlayOption o)
Set functions...
Definition: overlay.h:102
dirac_instr::OverlayParams::m_bg
bool m_bg
Background - original luma or mid-grey.
Definition: overlay.h:127
dirac_instr::OverlayParams::m_legend
bool m_legend
Instrumentation legend off.
Definition: overlay.h:130
picture.h
dirac_instr::Overlay::Overlay
Overlay(const OverlayParams &, Picture &)
constructor
dirac_instr::OverlayParams::MvClip
int MvClip() const
Returns clip value for motion vectors.
Definition: overlay.h:95
dirac_instr::Overlay::m_oparams
const OverlayParams m_oparams
Overlay parameters.
Definition: overlay.h:193
dirac_instr::OverlayOption
OverlayOption
Enumeration of options for instrumentation overlay.
Definition: overlay.h:61
dirac_instr::OverlayParams::m_mv_clip
int m_mv_clip
Motion vector clip value.
Definition: overlay.h:133
dirac_instr::OverlayParams::SetBackground
void SetBackground(bool b)
Set whether input picture or grey is used as background.
Definition: overlay.h:108
dirac_instr::Overlay::m_picture
Picture & m_picture
Local reference to picture.
Definition: overlay.h:196
gm_inliers.h
dirac_instr::gm_diff_colour_arrows
Definition: overlay.h:65
dirac_instr::Overlay::CalculateFactors
void CalculateFactors(const ChromaFormat &)
Calculates chroma sample factors.
dirac_instr::OverlayParams::SADClip
int SADClip() const
Returns clip value for sad.
Definition: overlay.h:98
motion_colour_arrows.h
dirac_instr::gm_colour_arrows
Definition: overlay.h:64
dirac_instr::motion_colour
Definition: overlay.h:63
overlay_symbols.h
dirac::Picture
A class for encapsulating all the data relating to a picture.
Definition: picture.h:51

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