source: 3DVCSoftware/trunk/source/Lib/TLibCommon/TComWedgelet.h @ 49

Last change on this file since 49 was 5, checked in by hhi, 13 years ago

Clean version with cfg-files

  • Property svn:eol-style set to native
File size: 6.4 KB
Line 
1/* The copyright in this software is being made available under the BSD
2 * License, included below. This software may be subject to other third party
3 * and contributor rights, including patent rights, and no such rights are
4 * granted under this license.
5 *
6 * Copyright (c) 2010-2011, ISO/IEC
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions are met:
11 *
12 *  * Redistributions of source code must retain the above copyright notice,
13 *    this list of conditions and the following disclaimer.
14 *  * Redistributions in binary form must reproduce the above copyright notice,
15 *    this list of conditions and the following disclaimer in the documentation
16 *    and/or other materials provided with the distribution.
17 *  * Neither the name of the ISO/IEC nor the names of its contributors may
18 *    be used to endorse or promote products derived from this software without
19 *    specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
31 * THE POSSIBILITY OF SUCH DAMAGE.
32 */
33
34
35
36#ifndef __TCOMWEDGELET__
37#define __TCOMWEDGELET__
38
39// Include files
40#include <assert.h>
41#include "CommonDef.h"
42
43#include <vector>
44
45
46enum WedgeResolution
47{
48  DOUBLE_PEL,
49  FULL_PEL,
50  HALF_PEL
51};
52
53enum WedgeDist
54{
55  WedgeDist_SAD  = 0,
56  WedgeDist_SSE  = 4,
57};
58
59// ====================================================================================================================
60// Class definition TComWedgelet
61// ====================================================================================================================
62class TComWedgelet
63{
64private:
65  UChar           m_uhXs;                       // line start X pos
66  UChar           m_uhYs;                       // line start Y pos
67  UChar           m_uhXe;                       // line end   X pos
68  UChar           m_uhYe;                       // line end   Y pos
69  UChar           m_uhOri;                      // orientation index
70  WedgeResolution m_eWedgeRes;                  // start/end pos resolution
71
72  UInt  m_uiWidth;
73  UInt  m_uiHeight;
74
75  Bool* m_pbPattern;
76
77  Void  xGenerateWedgePattern();
78  Void  xDrawEdgeLine( UChar uhXs, UChar uhYs, UChar uhXe, UChar uhYe, Bool* pbPattern, Int iPatternStride );
79
80public:
81  TComWedgelet( UInt uiWidth, UInt uiHeight );
82  TComWedgelet( const TComWedgelet &rcWedge );
83  virtual ~TComWedgelet();
84
85  Void  create ( UInt iWidth, UInt iHeight );   ///< create  wedgelet pattern
86  Void  destroy();                              ///< destroy wedgelet pattern
87  Void  clear  ();                              ///< clear   wedgelet pattern
88
89  UInt            getWidth   () { return m_uiWidth; }
90  UInt            getStride  () { return m_uiWidth; }
91  UInt            getHeight  () { return m_uiHeight; }
92  WedgeResolution getWedgeRes() { return m_eWedgeRes; }
93  Bool*           getPattern () { return m_pbPattern; }
94  UChar           getStartX  () { return m_uhXs; }
95  UChar           getStartY  () { return m_uhYs; }
96  UChar           getEndX    () { return m_uhXe; }
97  UChar           getEndY    () { return m_uhYe; }
98  UChar           getOri     () { return m_uhOri; }
99
100  Void  setWedgelet( UChar uhXs, UChar uhYs, UChar uhXe, UChar uhYe, UChar uhOri, WedgeResolution eWedgeRes );
101
102  Bool  checkNotPlain();
103  Bool  checkNotIdentical( Bool* pbRefPattern );
104  Bool  checkNotInvIdentical( Bool* pbRefPattern );
105
106  Bool  checkPredDirAbovePossible( UInt uiPredDirBlockSize, UInt uiPredDirBlockOffsett );
107  Bool  checkPredDirLeftPossible ( UInt uiPredDirBlockSize, UInt uiPredDirBlockOffsett );
108
109  Void  getPredDirStartEndAbove( UChar& ruhXs, UChar& ruhYs, UChar& ruhXe, UChar& ruhYe, UInt uiPredDirBlockSize, UInt uiPredDirBlockOffset, Int iDeltaEnd );
110  Void  getPredDirStartEndLeft ( UChar& ruhXs, UChar& ruhYs, UChar& ruhXe, UChar& ruhYe, UInt uiPredDirBlockSize, UInt uiPredDirBlockOffset, Int iDeltaEnd );
111};  // END CLASS DEFINITION TComWedgelet
112
113// type definition wedgelet pattern list
114typedef std::vector<TComWedgelet> WedgeList;
115
116// ====================================================================================================================
117// Class definition TComWedgeRef
118// ====================================================================================================================
119class TComWedgeRef
120{
121private:
122  UChar           m_uhXs;                       // line start X pos
123  UChar           m_uhYs;                       // line start Y pos
124  UChar           m_uhXe;                       // line end   X pos
125  UChar           m_uhYe;                       // line end   Y pos
126  UInt            m_uiRefIdx;                   // index of corresponding pattern of TComWedgelet object in wedge list
127
128public:
129  TComWedgeRef() {}
130  virtual ~TComWedgeRef() {}
131
132  UChar           getStartX  () { return m_uhXs; }
133  UChar           getStartY  () { return m_uhYs; }
134  UChar           getEndX    () { return m_uhXe; }
135  UChar           getEndY    () { return m_uhYe; }
136  UInt            getRefIdx  () { return m_uiRefIdx; }
137
138  Void  setWedgeRef( UChar uhXs, UChar uhYs, UChar uhXe, UChar uhYe, UInt uiRefIdx ) { m_uhXs = uhXs; m_uhYs = uhYs; m_uhXe = uhXe; m_uhYe = uhYe; m_uiRefIdx = uiRefIdx; }
139};  // END CLASS DEFINITION TComWedgeRef
140
141// type definition wedgelet reference list
142typedef std::vector<TComWedgeRef> WedgeRefList;
143
144// ====================================================================================================================
145// Function definition roftoi (mathematically correct rounding of float to int)
146// ====================================================================================================================
147__inline Int roftoi( Double value )
148{
149  (value < -0.5) ? (value -= 0.5) : (value += 0.5);
150  return ( (Int)value );
151}
152#endif // __TCOMWEDGELET__
Note: See TracBrowser for help on using the repository browser.