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-2016, ITU/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 | #ifndef __TRENSINGLEMODEL__ |
---|
36 | #define __TRENSINGLEMODEL__ |
---|
37 | |
---|
38 | #include "TRenImage.h" |
---|
39 | #include "../TLibCommon/CommonDef.h" |
---|
40 | #include "../TLibCommon/TComPicYuv.h" |
---|
41 | #include "../TLibCommon/TypeDef.h" |
---|
42 | #include "../TAppCommon/TAppComCamPara.h" |
---|
43 | |
---|
44 | |
---|
45 | #include <math.h> |
---|
46 | #include <errno.h> |
---|
47 | #include <iostream> |
---|
48 | |
---|
49 | #include <string> |
---|
50 | #include <cstdio> |
---|
51 | #include <cstring> |
---|
52 | |
---|
53 | #if NH_3D_VSO |
---|
54 | using namespace std; |
---|
55 | |
---|
56 | #if H_3D_VSO_RM_ASSERTIONS |
---|
57 | #define RM_AOT( exp ) AOT ( exp ) |
---|
58 | #define RM_AOF( exp ) AOF ( exp ) |
---|
59 | #else |
---|
60 | #define RM_AOT( exp ) ((void)0) |
---|
61 | #define RM_AOF( exp ) ((void)0) |
---|
62 | #endif |
---|
63 | |
---|
64 | #define RenModRemoveBitInc( exp ) bBitInc ? ( RemoveBitIncrement( exp ) ) : ( exp ) |
---|
65 | |
---|
66 | class TRenSingleModel |
---|
67 | { |
---|
68 | public: |
---|
69 | |
---|
70 | virtual ~TRenSingleModel() { } |
---|
71 | #if H_3D_VSO_EARLY_SKIP |
---|
72 | virtual Void create ( Int iMode, Int iWidth, Int iHeight, Int iShiftPrec, Int*** aaaiSubPelShiftTable, Int iHoleMargin, Bool bUseOrgRef, Int iBlendMode, Bool bLimOutput, Bool bEarlySkip ) = 0; |
---|
73 | #else |
---|
74 | virtual Void create ( Int iMode, Int iWidth, Int iHeight, Int iShiftPrec, Int*** aaaiSubPelShiftTable, Int iHoleMargin, Bool bUseOrgRef, Int iBlendMode, Bool bLimOutput ) = 0; |
---|
75 | #endif |
---|
76 | |
---|
77 | // Setup |
---|
78 | virtual Void setLRView ( Int iViewPos, Pel** apiCurVideoPel, Int* aiCurVideoStride, Pel* piCurDepthPel, Int iCurDepthStride ) = 0; |
---|
79 | virtual Void setupPart ( UInt uiHorOffset, Int iUsedHeight ) = 0; |
---|
80 | #if RM_FIX_SETUP |
---|
81 | virtual Void setupLut ( Int** ppiShiftLutLeft, Int** ppiBaseShiftLutLeft, Int** ppiShiftLutRight, Int** ppiBaseShiftLutRight, Int iDistToLeft ) = 0; |
---|
82 | virtual Void setupRefView ( TComPicYuv* pcOrgVideo ) = 0; |
---|
83 | |
---|
84 | virtual Void renderAll () = 0; |
---|
85 | virtual Void setStructSynthViewAsRefView () = 0; |
---|
86 | virtual Void resetStructError () = 0; |
---|
87 | virtual Void setLimOutStruct ( Int iSourceViewPos ) = 0; |
---|
88 | #else |
---|
89 | virtual Void setupLutAndRef ( TComPicYuv* pcOrgVideo, Int** ppiShiftLutLeft, Int** ppiBaseShiftLutLeft, Int** ppiShiftLutRight, Int** ppiBaseShiftLutRight, Int iDistToLeft, Bool bRenderRef ) = 0; |
---|
90 | virtual Void setupInitialState ( Int curViewPosInModel ) = 0; |
---|
91 | #endif |
---|
92 | |
---|
93 | // Set Data |
---|
94 | #if H_3D_VSO_EARLY_SKIP |
---|
95 | virtual Void setDepth ( Int iViewPos, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData, const Pel* piOrgData, Int iOrgStride ) = 0; |
---|
96 | #else |
---|
97 | virtual Void setDepth ( Int iViewPos, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData ) = 0; |
---|
98 | #endif |
---|
99 | virtual Void setVideo ( Int iViewPos, Int iPlane, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData ) = 0; |
---|
100 | |
---|
101 | // Get Distortion |
---|
102 | #if H_3D_VSO_EARLY_SKIP |
---|
103 | virtual RMDist getDistDepth ( Int iViewPos, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData, const Pel * piOrgData , Int iOrgStride)=0; |
---|
104 | #else |
---|
105 | virtual RMDist getDistDepth ( Int iViewPos, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData ) = 0; |
---|
106 | #endif |
---|
107 | virtual RMDist getDistVideo ( Int iViewPos, Int iPlane, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData ) = 0; |
---|
108 | |
---|
109 | virtual Void getSynthVideo ( Int iViewPos, TComPicYuv* pcPicYuv ) = 0; |
---|
110 | virtual Void getSynthDepth ( Int iViewPos, TComPicYuv* pcPicYuv ) = 0; |
---|
111 | virtual Void getRefVideo ( Int iViewPos, TComPicYuv* pcPicYuv ) = 0; |
---|
112 | }; |
---|
113 | |
---|
114 | template < BlenMod iBM, Bool bBitInc > |
---|
115 | class TRenSingleModelC : public TRenSingleModel |
---|
116 | { |
---|
117 | struct RenModelInPels |
---|
118 | { |
---|
119 | // video |
---|
120 | Pel aiY[5] ; // y-value |
---|
121 | #if H_3D_VSO_COLOR_PLANES |
---|
122 | Pel aiU[5] ; // u-value |
---|
123 | Pel aiV[5] ; // v-value |
---|
124 | #endif |
---|
125 | // depth |
---|
126 | Pel iD ; // depth |
---|
127 | Int aiOccludedPos; // Occluded |
---|
128 | |
---|
129 | }; |
---|
130 | |
---|
131 | struct RenModelLimOutPels |
---|
132 | { |
---|
133 | Pel iDOther; |
---|
134 | Int iFilledOther; |
---|
135 | // video |
---|
136 | Pel iYOther; |
---|
137 | Pel iYRef ; |
---|
138 | #if H_3D_VSO_COLOR_PLANES |
---|
139 | Pel iUOther; |
---|
140 | Pel iURef ; |
---|
141 | Pel iVOther; |
---|
142 | Pel iVRef ; |
---|
143 | #endif |
---|
144 | Int iError ; |
---|
145 | }; |
---|
146 | |
---|
147 | struct RenModelOutPels |
---|
148 | { |
---|
149 | // video |
---|
150 | Pel iYLeft ; |
---|
151 | Pel iYRight ; |
---|
152 | Pel iYBlended ; |
---|
153 | #if H_3D_VSO_COLOR_PLANES |
---|
154 | Pel iULeft ; |
---|
155 | Pel iURight ; |
---|
156 | Pel iUBlended ; |
---|
157 | Pel iVLeft ; |
---|
158 | Pel iVRight ; |
---|
159 | Pel iVBlended ; |
---|
160 | #endif |
---|
161 | // depth |
---|
162 | Pel iDLeft ; |
---|
163 | Pel iDRight ; |
---|
164 | Pel iDBlended ; |
---|
165 | |
---|
166 | // state |
---|
167 | Int iFilledLeft ; |
---|
168 | Int iFilledRight; |
---|
169 | |
---|
170 | // error |
---|
171 | Int iError ; |
---|
172 | |
---|
173 | // reference |
---|
174 | Pel iYRef ; |
---|
175 | #if H_3D_VSO_COLOR_PLANES |
---|
176 | Pel iURef ; |
---|
177 | Pel iVRef ; |
---|
178 | #endif |
---|
179 | }; |
---|
180 | |
---|
181 | |
---|
182 | |
---|
183 | public: |
---|
184 | TRenSingleModelC(); |
---|
185 | ~TRenSingleModelC(); |
---|
186 | |
---|
187 | // Create Model |
---|
188 | #if H_3D_VSO_EARLY_SKIP |
---|
189 | Void create ( Int iMode, Int iWidth, Int iHeight, Int iShiftPrec, Int*** aaaiSubPelShiftTable, Int iHoleMargin, Bool bUseOrgRef, Int iBlendMode, Bool bLimOutput, Bool bEarlySkip ); |
---|
190 | #else |
---|
191 | Void create ( Int iMode, Int iWidth, Int iHeight, Int iShiftPrec, Int*** aaaiSubPelShiftTable, Int iHoleMargin, Bool bUseOrgRef, Int iBlendMode, Bool bLimOutput ); |
---|
192 | #endif |
---|
193 | |
---|
194 | // Setup |
---|
195 | Void setLRView ( Int iViewPos, Pel** apiCurVideoPel, Int* aiCurVideoStride, Pel* piCurDepthPel, Int iCurDepthStride ); |
---|
196 | Void setupPart ( UInt uiHorOffset, Int uiUsedHeight ); |
---|
197 | #if RM_FIX_SETUP |
---|
198 | Void setupLut ( Int** ppiShiftLutLeft, Int** ppiBaseShiftLutLeft, Int** ppiShiftLutRight, Int** ppiBaseShiftLutRight, Int iDistToLeft); |
---|
199 | Void setupRefView ( TComPicYuv* pcOrgVideo ); |
---|
200 | |
---|
201 | __inline Void renderAll( ); |
---|
202 | Void setStructSynthViewAsRefView (); |
---|
203 | Void resetStructError (); |
---|
204 | Void setLimOutStruct ( Int iSourceViewPos ); |
---|
205 | #else |
---|
206 | Void setupLutAndRef ( TComPicYuv* pcOrgVideo, Int** ppiShiftLutLeft, Int** ppiBaseShiftLutLeft, Int** ppiShiftLutRight, Int** ppiBaseShiftLutRight, Int iDistToLeft, Bool bRenderRef ); |
---|
207 | Void setupInitialState ( Int curViewPosInModel ); |
---|
208 | #endif |
---|
209 | |
---|
210 | |
---|
211 | #if H_3D_VSO_EARLY_SKIP |
---|
212 | Void setDepth ( Int iViewPos, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData, const Pel* piOrgData, Int iOrgStride ); |
---|
213 | #else |
---|
214 | Void setDepth ( Int iViewPos, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData ); |
---|
215 | #endif |
---|
216 | Void setVideo ( Int iViewPos, Int iPlane, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData ); |
---|
217 | |
---|
218 | // Get Distortion |
---|
219 | #if H_3D_VSO_EARLY_SKIP |
---|
220 | RMDist getDistDepth ( Int iViewPos, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData, const Pel * piOrgData , Int iOrgStride); |
---|
221 | #else |
---|
222 | RMDist getDistDepth ( Int iViewPos, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData ); |
---|
223 | #endif |
---|
224 | RMDist getDistVideo ( Int iViewPos, Int iPlane, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData ); |
---|
225 | |
---|
226 | Void getSynthVideo ( Int iViewPos, TComPicYuv* pcPicYuv ); |
---|
227 | Void getSynthDepth ( Int iViewPos, TComPicYuv* pcPicYuv ); |
---|
228 | Void getRefVideo ( Int iViewPos, TComPicYuv* pcPicYuv ); |
---|
229 | |
---|
230 | private: |
---|
231 | |
---|
232 | #if !RM_FIX_SETUP |
---|
233 | __inline Void xRenderAll( ); |
---|
234 | #endif |
---|
235 | |
---|
236 | |
---|
237 | #if H_3D_VSO_EARLY_SKIP |
---|
238 | template < Bool bL, SetMod iSM > RMDist xSetOrGet( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData, Pel* piOrgData, Int iOrgStride ); |
---|
239 | #else |
---|
240 | template < Bool bL, SetMod iSM > RMDist xSetOrGet( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData ); |
---|
241 | #endif |
---|
242 | |
---|
243 | // Set and inc Current Row |
---|
244 | template< SetMod bSM > __inline Void xSetViewRow( Int iPosY ); |
---|
245 | template< SetMod bSM > __inline Void xIncViewRow(); |
---|
246 | |
---|
247 | ///// Rendering ///// |
---|
248 | template< typename T, Bool bL > __inline T xPlus ( T arg1, T arg2 ) { return bL ? (arg1 + arg2) : (arg1 - arg2); }; |
---|
249 | template< typename T, Bool bL > __inline T xMin ( T arg1, T arg2 ) { return bL ? std::min(arg1, arg2) : std::max(arg1, arg2) ;}; |
---|
250 | template< typename T, Bool bL > __inline T xMax ( T arg1, T arg2 ) { return bL ? std::max(arg1, arg2) : std::min(arg1, arg2) ;}; |
---|
251 | template< typename T, Bool bL > __inline Void xInc ( T& arg1 ) { bL ? arg1++ : arg1-- ;}; |
---|
252 | template< typename T, Bool bL > __inline Void xDec ( T& arg1 ) { bL ? arg1-- : arg1++ ;}; |
---|
253 | template< typename T, Bool bL > __inline Bool xLess ( T arg1, T arg2 ) { return bL ? arg1 < arg2 : arg1 > arg2; }; |
---|
254 | template< typename T, Bool bL > __inline Bool xGeQ ( T arg1, T arg2 ) { return bL ? arg1 >= arg2 : arg1 <= arg2; }; |
---|
255 | template< Bool bL > __inline Int xZero ( ) { return bL ? 0 : m_iWidth - 1; }; |
---|
256 | template< Bool bL > __inline Int xWidthMinus1( ) { return bL ? m_iWidth - 1 : 0; }; |
---|
257 | #if H_3D_VSO_EARLY_SKIP |
---|
258 | template< Bool bL > __inline Bool xDetectEarlySkip ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData,const Pel* piOrgData, Int iOrgStride ); |
---|
259 | template< Bool bL, SetMod bSM > __inline RMDist xRender ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData, Bool bFast ); |
---|
260 | template< SetMod bSM > __inline RMDist xGetSSE ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData, Bool bFast ); |
---|
261 | #else |
---|
262 | template< Bool bL, SetMod bSM > __inline RMDist xRender ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData ); |
---|
263 | template< SetMod bSM > __inline RMDist xGetSSE ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData ); |
---|
264 | #endif |
---|
265 | template< Bool bL > __inline Void xInitRenderPart ( Int iEndChangePos, Int iLastSPos ); |
---|
266 | template< Bool bL, SetMod bSM > __inline Void xRenderRange ( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError ); |
---|
267 | template< Bool bL, SetMod bSM > __inline Void xRenderShiftedRange( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError ); |
---|
268 | template< Bool bL, SetMod bSM > __inline Void xFillHole ( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError ); |
---|
269 | template< Bool bL, SetMod bSM > __inline Void xExtrapolateMargin ( Int iCurSPos, Int iCurPos, RMDist& riError ); |
---|
270 | template< Bool bL > __inline Int xRangeLeft ( Int iPos ); |
---|
271 | template< Bool bL > __inline Int xRangeRight ( Int iPos ); |
---|
272 | template< Bool bL > __inline Int xRound ( Int iPos ); |
---|
273 | |
---|
274 | #if H_3D_VSO_COLOR_PLANES |
---|
275 | template< Bool bL, SetMod bSM > __inline Void xGetBlendedValue ( Pel& riY, Pel iYL, Pel iYR, Pel& riU, Pel iUL, Pel iUR, Pel& riV, Pel iVL, Pel iVR, Int iFilledL, Int iFilledR, Pel iDepthL, Pel iDepthR ); |
---|
276 | template< Bool bL, SetMod bSM > __inline Void xGetBlendedValueBM1 ( Pel& riY, Pel iYL, Pel iYR, Pel& riU, Pel iUL, Pel iUR, Pel& riV, Pel iVL, Pel iVR, Int iFilledL, Int iFilledR, Pel iDepthL, Pel iDepthR ); |
---|
277 | template< Bool bL, SetMod bSM > __inline Void xGetBlendedValueBM2 ( Pel& riY, Pel iYL, Pel iYR, Pel& riU, Pel iUL, Pel iUR, Pel& riV, Pel iVL, Pel iVR, Int iFilledL, Int iFilledR, Pel iDepthL, Pel iDepthR ); |
---|
278 | #else |
---|
279 | template< Bool bL, SetMod bSM > __inline Void xGetBlendedValue ( Pel& riY, Pel iYL, Pel iYR, Int iFilledL, Int iFilledR, Pel iDepthL, Pel iDepthR ); |
---|
280 | template< Bool bL, SetMod bSM > __inline Void xGetBlendedValueBM1 ( Pel& riY, Pel iYL, Pel iYR, Int iFilledL, Int iFilledR, Pel iDepthL, Pel iDepthR ); |
---|
281 | template< Bool bL, SetMod bSM > __inline Void xGetBlendedValueBM2 ( Pel& riY, Pel iYL, Pel iYR, Int iFilledL, Int iFilledR, Pel iDepthL, Pel iDepthR ); |
---|
282 | #endif |
---|
283 | __inline Pel xBlend ( Pel pVal1, Pel pVal2, Int iWeightVal2 ); |
---|
284 | |
---|
285 | // General |
---|
286 | template<Bool bL, SetMod bSM> __inline Void xSetShiftedPel (Int iSourcePos, Int iSubSourcePos, Int iTargetSPos, Pel iFilled, RMDist& riError ); |
---|
287 | |
---|
288 | template <Bool bL> __inline Int xShiftNewData ( Int iPos, Int iPosInNewData ); |
---|
289 | template <Bool bL> __inline Int xShift ( Int iPos ); |
---|
290 | template <Bool bL> __inline Int xShift ( Int iPos, Int iPosInNewData ); |
---|
291 | |
---|
292 | __inline Int xShiftDept ( Int iPosXinSubPel, Int iDepth ); |
---|
293 | |
---|
294 | __inline Int xGetDist ( Int iDiffY, Int iDiffU, Int iDiffV ); |
---|
295 | __inline Int xGetDist ( Int iDiffY ); |
---|
296 | |
---|
297 | // Utilities |
---|
298 | __inline Void xSetPels ( Pel* piPelSource , Int iSourceStride, Int iWidth, Int iHeight, Pel iVal ); |
---|
299 | __inline Void xSetBools ( Bool* pbSource , Int iSourceStride, Int iWidth, Int iHeight, Bool bVal ); |
---|
300 | __inline Void xSetInts ( Int* piPelSource , Int iSourceStride, Int iWidth, Int iHeight, Int iVal ); |
---|
301 | |
---|
302 | #if H_3D_VSO_COLOR_PLANES |
---|
303 | Void xGetSampleStrTextPtrs ( Int iViewNum, Pel RenModelOutPels::*& rpiSrcY, Pel RenModelOutPels::*& rpiSrcU, Pel RenModelOutPels::*& rpiSrcV ); |
---|
304 | #else |
---|
305 | Void xGetSampleStrTextPtrs ( Int iViewNum, Pel RenModelOutPels::*& rpiSrcY ); |
---|
306 | #endif |
---|
307 | Void xGetSampleStrDepthPtrs ( Int iViewNum, Pel RenModelOutPels::*& rpiSrcD ); |
---|
308 | Void xGetSampleStrFilledPtrs( Int iViewNum, Int RenModelOutPels::*& rpiSrcFilled ); |
---|
309 | |
---|
310 | |
---|
311 | Void xSetStructRefView (); |
---|
312 | #if !RM_FIX_SETUP |
---|
313 | Void xResetStructError (); |
---|
314 | Void xSetLimOutStruct (Int iSourceViewPos ); |
---|
315 | #endif |
---|
316 | |
---|
317 | Void xInitSampleStructs (); |
---|
318 | #if !RM_FIX_SETUP |
---|
319 | Void xSetStructSynthViewAsRefView (); |
---|
320 | #endif |
---|
321 | Void xCopy2PicYuv ( Pel** ppiSrcVideoPel, Int* piStrides, TComPicYuv* rpcPicYuvTarget ); |
---|
322 | |
---|
323 | template< typename S, typename T> |
---|
324 | Void xCopyFromSampleStruct ( S* ptSource , Int iSourceStride, T S::* ptSourceElement, T* ptTarget, Int iTargetStride, Int iWidth, Int iHeight ) |
---|
325 | { |
---|
326 | AOT( iWidth != m_iWidth ); |
---|
327 | for (Int iPosY = 0; iPosY < iHeight; iPosY++) |
---|
328 | { |
---|
329 | for (Int iPosX = 0; iPosX < m_iWidth; iPosX++) |
---|
330 | { |
---|
331 | ptTarget[iPosX] = ptSource[iPosX].*ptSourceElement; |
---|
332 | } |
---|
333 | ptSource += iSourceStride; |
---|
334 | ptTarget += iTargetStride; |
---|
335 | } |
---|
336 | } |
---|
337 | |
---|
338 | template< typename S, typename T> |
---|
339 | Void xCopyToSampleStruct ( T* ptSource , Int iSourceStride, S* ptTarget, Int iTargetStride, T S::* ptSourceElement, Int iWidth, Int iHeight ) |
---|
340 | { |
---|
341 | AOT( iWidth != m_iWidth ); |
---|
342 | for (Int iPosY = 0; iPosY < iHeight; iPosY++) |
---|
343 | { |
---|
344 | for (Int iPosX = 0; iPosX < m_iWidth; iPosX++) |
---|
345 | { |
---|
346 | ptTarget[iPosX] = ptSource[iPosX].*ptSourceElement; |
---|
347 | } |
---|
348 | ptSource += iSourceStride; |
---|
349 | ptTarget += iTargetStride; |
---|
350 | } |
---|
351 | } |
---|
352 | |
---|
353 | private: |
---|
354 | |
---|
355 | // Image sizes |
---|
356 | Int m_iWidth; |
---|
357 | Int m_iHeight; |
---|
358 | Int m_iStride; |
---|
359 | Int m_iPad; |
---|
360 | Int m_iUsedHeight; |
---|
361 | Int m_iHorOffset; |
---|
362 | |
---|
363 | Int m_iSampledWidth; |
---|
364 | Int m_iSampledStride; |
---|
365 | |
---|
366 | RenModelInPels* m_pcInputSamples[2]; |
---|
367 | Int m_iInputSamplesStride; |
---|
368 | |
---|
369 | // Base |
---|
370 | Pel** m_aapiBaseVideoPel [2]; // Dim1: ViewPosition 0->Left, 1->Right; Dim2: Plane 0-> Y, 1->U, 2->V |
---|
371 | Int* m_aaiBaseVideoStrides [2]; // Dim1: ViewPosition 0->Left, 1->Right; Dim2: Plane 0-> Y, 1->U, 2->V |
---|
372 | |
---|
373 | Pel* m_apiBaseDepthPel [2]; // Dim1: ViewPosition |
---|
374 | Int m_aiBaseDepthStrides [2]; // Dim1: ViewPosition |
---|
375 | |
---|
376 | |
---|
377 | // LUT |
---|
378 | Int** m_appiShiftLut [2]; |
---|
379 | Int** m_ppiCurLUT; |
---|
380 | Int** m_aaiSubPelShiftL; |
---|
381 | Int** m_aaiSubPelShiftR; |
---|
382 | |
---|
383 | Int* m_piInvZLUTLeft; |
---|
384 | Int* m_piInvZLUTRight; |
---|
385 | |
---|
386 | |
---|
387 | //// Reference Data //// |
---|
388 | TComPicYuv* m_pcPicYuvRef ; // Reference PIcYuv |
---|
389 | |
---|
390 | //// Output Samples |
---|
391 | RenModelOutPels* m_pcOutputSamples; |
---|
392 | RenModelLimOutPels* m_pcLimOutputSamples; |
---|
393 | |
---|
394 | Int m_iOutputSamplesStride; |
---|
395 | |
---|
396 | Pel* m_aapiRefVideoPel [3]; // Dim1: Plane 0-> Y, 1->U, 2->V |
---|
397 | Int m_aiRefVideoStrides [3]; // Dim1: Plane 0-> Y, 1->U, 2->V |
---|
398 | |
---|
399 | // Rendering State |
---|
400 | Bool m_bInOcclusion; // Currently rendering in occluded area |
---|
401 | Int m_iLastOccludedSPos; // Position of last topmost shifted position |
---|
402 | |
---|
403 | Int m_curRangeStart; |
---|
404 | Int m_lastRangeStart; |
---|
405 | |
---|
406 | const Pel* m_piNewDepthData; // Pointer to new depth data |
---|
407 | Int m_iStartChangePosX; // Start Position of new data |
---|
408 | Int m_iNewDataWidth; // Width of new data |
---|
409 | Pel m_iCurDepth; // Current Depth Value |
---|
410 | Pel m_iLastDepth; // Last Depth Value |
---|
411 | Pel m_iThisDepth; // Depth value to use for setting |
---|
412 | |
---|
413 | //// Settings //// |
---|
414 | // Input |
---|
415 | Int m_iMode; // 0: Left to Right, 1: Right to Left, 2: Merge |
---|
416 | Bool m_bUseOrgRef; |
---|
417 | Int m_iShiftPrec; |
---|
418 | Int m_iHoleMargin; |
---|
419 | #if H_3D_VSO_EARLY_SKIP |
---|
420 | Bool m_bEarlySkip; |
---|
421 | #endif |
---|
422 | |
---|
423 | // Derived settings |
---|
424 | Int m_iGapTolerance; |
---|
425 | Int m_iBlendZThres; |
---|
426 | Int m_iBlendDistWeight; |
---|
427 | |
---|
428 | //// Current Pointers //// |
---|
429 | |
---|
430 | RenModelInPels* m_pcInputSamplesRow [2]; |
---|
431 | RenModelOutPels* m_pcOutputSamplesRow; |
---|
432 | RenModelLimOutPels* m_pcLimOutputSamplesRow; |
---|
433 | |
---|
434 | //// MISC //// |
---|
435 | const Int m_iDistShift; // Shift in Distortion computation |
---|
436 | Bool m_bLimOutput; // Save distortion only |
---|
437 | |
---|
438 | //// Early Skip |
---|
439 | #if H_3D_VSO_EARLY_SKIP |
---|
440 | Bool* m_pbHorSkip; |
---|
441 | #endif |
---|
442 | }; |
---|
443 | |
---|
444 | #endif // H_3D |
---|
445 | #endif //__TRENSINGLEMODEL__ |
---|
446 | |
---|
447 | |
---|