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 | #include "TRenImage.h" |
---|
35 | #include "TRenFilter.h" |
---|
36 | #include "TRenModel.h" |
---|
37 | |
---|
38 | /////////// TRENMODEL ////////////////////// |
---|
39 | TRenModel::TRenModel() |
---|
40 | { |
---|
41 | m_iPad = PICYUV_PAD; |
---|
42 | m_iWidth = -1; |
---|
43 | m_iHeight = -1; |
---|
44 | #if FIX_VSO_SETUP |
---|
45 | m_iUsedHeight = -1; |
---|
46 | #endif |
---|
47 | m_iNumOfBaseViews = -1; |
---|
48 | m_iSampledWidth = -1; |
---|
49 | m_iShiftPrec = 0; |
---|
50 | m_iHoleMargin = 1; |
---|
51 | m_uiHorOff = -1; |
---|
52 | #if LGE_VSO_EARLY_SKIP_A0093 |
---|
53 | m_bEarlySkip = false; |
---|
54 | #endif |
---|
55 | |
---|
56 | // Current Error Type /// |
---|
57 | m_iCurrentView = -1; |
---|
58 | m_iCurrentContent = -1; |
---|
59 | m_iCurrentPlane = -1; |
---|
60 | |
---|
61 | // Array of Models used to determine the Current Error /// |
---|
62 | m_iNumOfCurRenModels = -1; |
---|
63 | m_apcCurRenModels = NULL; |
---|
64 | m_aiCurPosInModels = NULL; |
---|
65 | |
---|
66 | // Array of Models /// |
---|
67 | m_iNumOfRenModels = -1; |
---|
68 | m_apcRenModels = NULL; |
---|
69 | |
---|
70 | // Mapping from View number to models /// |
---|
71 | m_aiNumOfModelsForDepthView = NULL; |
---|
72 | m_aapcRenModelForDepthView = NULL; |
---|
73 | m_aaePosInModelForDepthView = NULL; |
---|
74 | |
---|
75 | m_aiNumOfModelsForVideoView = NULL; |
---|
76 | m_aapcRenModelForVideoView = NULL; |
---|
77 | m_aaePosInModelForVideoView = NULL; |
---|
78 | m_aaeBaseViewPosInModel = NULL; |
---|
79 | |
---|
80 | // Data |
---|
81 | m_aapiCurVideoPel = NULL; |
---|
82 | m_aaiCurVideoStrides = NULL; |
---|
83 | m_apiCurDepthPel = NULL; |
---|
84 | m_aiCurDepthStrides = NULL; |
---|
85 | |
---|
86 | m_aapiOrgVideoPel = NULL; |
---|
87 | m_aaiOrgVideoStrides = NULL; |
---|
88 | m_apiOrgDepthPel = NULL; |
---|
89 | m_aiOrgDepthStrides = NULL; |
---|
90 | |
---|
91 | m_aaaiSubPelShiftLut[0]= NULL; |
---|
92 | m_aaaiSubPelShiftLut[1]= NULL; |
---|
93 | |
---|
94 | /// Current Setup data /// |
---|
95 | m_abSetupVideoFromOrgForView = NULL; |
---|
96 | m_abSetupDepthFromOrgForView = NULL; |
---|
97 | } |
---|
98 | |
---|
99 | TRenModel::~TRenModel() |
---|
100 | { |
---|
101 | if ( m_apcRenModels ) |
---|
102 | { |
---|
103 | for (Int iNumModel = 0; iNumModel < m_iNumOfRenModels; iNumModel++) |
---|
104 | { |
---|
105 | if ( m_apcRenModels[iNumModel] ) delete m_apcRenModels[iNumModel]; |
---|
106 | } |
---|
107 | |
---|
108 | delete[] m_apcRenModels; |
---|
109 | } |
---|
110 | |
---|
111 | for (Int iViewNum = 0; iViewNum < m_iNumOfBaseViews; iViewNum++) |
---|
112 | { |
---|
113 | if ( m_aapcRenModelForDepthView && m_aapcRenModelForDepthView [iViewNum] ) |
---|
114 | { |
---|
115 | delete[] m_aapcRenModelForDepthView [iViewNum]; |
---|
116 | } |
---|
117 | |
---|
118 | if ( m_aaePosInModelForDepthView && m_aaePosInModelForDepthView[iViewNum] ) |
---|
119 | { |
---|
120 | delete[] m_aaePosInModelForDepthView[iViewNum]; |
---|
121 | } |
---|
122 | |
---|
123 | if ( m_aapcRenModelForVideoView && m_aapcRenModelForVideoView[iViewNum] ) |
---|
124 | { |
---|
125 | delete[] m_aapcRenModelForVideoView[iViewNum]; |
---|
126 | } |
---|
127 | |
---|
128 | if ( m_aaePosInModelForVideoView && m_aaePosInModelForVideoView[iViewNum] ) |
---|
129 | { |
---|
130 | delete[] m_aaePosInModelForVideoView[iViewNum]; |
---|
131 | } |
---|
132 | |
---|
133 | if ( m_aaeBaseViewPosInModel && m_aaeBaseViewPosInModel[iViewNum] ) |
---|
134 | { |
---|
135 | delete[] m_aaeBaseViewPosInModel[iViewNum]; |
---|
136 | } |
---|
137 | |
---|
138 | if ( m_aapiCurVideoPel && m_aapiCurVideoPel [iViewNum] ) |
---|
139 | { |
---|
140 | delete[] ( m_aapiCurVideoPel [iViewNum][0] - m_iPad * m_aaiCurVideoStrides[iViewNum][0] - m_iPad ); |
---|
141 | delete[] ( m_aapiCurVideoPel [iViewNum][1] - m_iPad * m_aaiCurVideoStrides[iViewNum][1] - m_iPad ); |
---|
142 | delete[] ( m_aapiCurVideoPel [iViewNum][2] - m_iPad * m_aaiCurVideoStrides[iViewNum][2] - m_iPad ); |
---|
143 | delete[] m_aapiCurVideoPel [iViewNum]; |
---|
144 | } |
---|
145 | |
---|
146 | if ( m_aaiCurVideoStrides && m_aaiCurVideoStrides [iViewNum] ) |
---|
147 | { |
---|
148 | delete[] m_aaiCurVideoStrides [iViewNum]; |
---|
149 | } |
---|
150 | |
---|
151 | if ( m_apiCurDepthPel ) |
---|
152 | { |
---|
153 | delete[] ( m_apiCurDepthPel [iViewNum] - m_iPad * m_aiCurDepthStrides [iViewNum] - m_iPad ); |
---|
154 | } |
---|
155 | |
---|
156 | if ( m_aapiOrgVideoPel && m_aapiOrgVideoPel [iViewNum] ) |
---|
157 | { |
---|
158 | delete[] ( m_aapiOrgVideoPel [iViewNum][0] - m_iPad * m_aaiOrgVideoStrides[iViewNum][0] - m_iPad ); |
---|
159 | delete[] ( m_aapiOrgVideoPel [iViewNum][1] - m_iPad * m_aaiOrgVideoStrides[iViewNum][1] - m_iPad ); |
---|
160 | delete[] ( m_aapiOrgVideoPel [iViewNum][2] - m_iPad * m_aaiOrgVideoStrides[iViewNum][2] - m_iPad ); |
---|
161 | delete[] m_aapiOrgVideoPel [iViewNum]; |
---|
162 | } |
---|
163 | |
---|
164 | if ( m_aaiOrgVideoStrides && m_aaiOrgVideoStrides [iViewNum] ) |
---|
165 | { |
---|
166 | delete[] m_aaiOrgVideoStrides [iViewNum]; |
---|
167 | } |
---|
168 | |
---|
169 | if ( m_apiOrgDepthPel && m_apiOrgDepthPel [iViewNum ] ) |
---|
170 | { |
---|
171 | delete[] ( m_apiOrgDepthPel [iViewNum] - m_iPad * m_aiOrgDepthStrides [iViewNum] - m_iPad ); |
---|
172 | } |
---|
173 | } |
---|
174 | |
---|
175 | if(m_aiNumOfModelsForDepthView) delete[] m_aiNumOfModelsForDepthView; |
---|
176 | if(m_aapcRenModelForDepthView ) delete[] m_aapcRenModelForDepthView ; |
---|
177 | if(m_aaePosInModelForDepthView) delete[] m_aaePosInModelForDepthView; |
---|
178 | |
---|
179 | if(m_aiNumOfModelsForVideoView) delete[] m_aiNumOfModelsForVideoView; |
---|
180 | if(m_aapcRenModelForVideoView ) delete[] m_aapcRenModelForVideoView ; |
---|
181 | if(m_aaePosInModelForVideoView) delete[] m_aaePosInModelForVideoView; |
---|
182 | |
---|
183 | |
---|
184 | if(m_aaeBaseViewPosInModel ) delete[] m_aaeBaseViewPosInModel ; |
---|
185 | if(m_aapiCurVideoPel ) delete[] m_aapiCurVideoPel ; |
---|
186 | if(m_aaiCurVideoStrides ) delete[] m_aaiCurVideoStrides ; |
---|
187 | |
---|
188 | if(m_abSetupVideoFromOrgForView) delete[] m_abSetupVideoFromOrgForView; |
---|
189 | if(m_abSetupDepthFromOrgForView) delete[] m_abSetupDepthFromOrgForView; |
---|
190 | |
---|
191 | if(m_aapiOrgVideoPel ) delete[] m_aapiOrgVideoPel ; |
---|
192 | if(m_aaiOrgVideoStrides ) delete[] m_aaiOrgVideoStrides ; |
---|
193 | |
---|
194 | if(m_apiOrgDepthPel ) delete[] m_apiOrgDepthPel ; |
---|
195 | if(m_aiOrgDepthStrides ) delete[] m_aiOrgDepthStrides ; |
---|
196 | |
---|
197 | if(m_apiCurDepthPel ) delete[] m_apiCurDepthPel ; |
---|
198 | if(m_aiCurDepthStrides ) delete[] m_aiCurDepthStrides ; |
---|
199 | |
---|
200 | Int iNumEntries = (1 << ( m_iShiftPrec + 1) ) + 1 ; |
---|
201 | |
---|
202 | for (UInt uiEntry = 0; uiEntry < iNumEntries; uiEntry++) |
---|
203 | { |
---|
204 | if ( m_aaaiSubPelShiftLut[0] && m_aaaiSubPelShiftLut[0][uiEntry] ) |
---|
205 | delete[] m_aaaiSubPelShiftLut[0][uiEntry]; |
---|
206 | |
---|
207 | if ( m_aaaiSubPelShiftLut[1] && m_aaaiSubPelShiftLut[1][uiEntry] ) |
---|
208 | delete[] m_aaaiSubPelShiftLut[1][uiEntry]; |
---|
209 | } |
---|
210 | |
---|
211 | if( m_aaaiSubPelShiftLut[0] ) delete[] m_aaaiSubPelShiftLut[0]; |
---|
212 | if( m_aaaiSubPelShiftLut[1] ) delete[] m_aaaiSubPelShiftLut[1]; |
---|
213 | } |
---|
214 | |
---|
215 | |
---|
216 | |
---|
217 | Void |
---|
218 | #if LGE_VSO_EARLY_SKIP_A0093 |
---|
219 | TRenModel::create( Int iNumOfBaseViews, Int iNumOfModels, Int iWidth, Int iHeight, Int iShiftPrec, Int iHoleMargin, Bool bEarlySkip ) |
---|
220 | #else |
---|
221 | TRenModel::create( Int iNumOfBaseViews, Int iNumOfModels, Int iWidth, Int iHeight, Int iShiftPrec, Int iHoleMargin ) |
---|
222 | #endif |
---|
223 | { |
---|
224 | m_iNumOfBaseViews = iNumOfBaseViews; |
---|
225 | m_iNumOfRenModels = iNumOfModels; |
---|
226 | m_iWidth = iWidth; |
---|
227 | m_iHeight = iHeight; |
---|
228 | m_iShiftPrec = iShiftPrec; |
---|
229 | m_iHoleMargin = iHoleMargin; |
---|
230 | #if LGE_VSO_EARLY_SKIP_A0093 |
---|
231 | m_bEarlySkip = bEarlySkip; |
---|
232 | #endif |
---|
233 | |
---|
234 | |
---|
235 | // LUTs for sub pel shifting |
---|
236 | Int iNumEntries = (1 << ( m_iShiftPrec + 1) ) + 1 ; |
---|
237 | m_aaaiSubPelShiftLut[0] = new Int*[ iNumEntries ]; |
---|
238 | m_aaaiSubPelShiftLut[1] = new Int*[ iNumEntries ]; |
---|
239 | for (UInt uiEntry = 0; uiEntry < iNumEntries; uiEntry++) |
---|
240 | { |
---|
241 | m_aaaiSubPelShiftLut[0][uiEntry] = new Int[ iNumEntries ]; |
---|
242 | m_aaaiSubPelShiftLut[1][uiEntry] = new Int[ iNumEntries ]; |
---|
243 | } |
---|
244 | |
---|
245 | TRenFilter::setSubPelShiftLUT( m_iShiftPrec, m_aaaiSubPelShiftLut[0], 0 ); |
---|
246 | TRenFilter::setSubPelShiftLUT( m_iShiftPrec, m_aaaiSubPelShiftLut[1], 0 ); |
---|
247 | |
---|
248 | m_iSampledWidth = iWidth << m_iShiftPrec; |
---|
249 | |
---|
250 | |
---|
251 | m_aapiCurVideoPel = new Pel** [m_iNumOfBaseViews]; |
---|
252 | m_aaiCurVideoStrides = new Int* [m_iNumOfBaseViews]; |
---|
253 | m_apiCurDepthPel = new Pel* [m_iNumOfBaseViews]; |
---|
254 | m_aiCurDepthStrides = new Int [m_iNumOfBaseViews]; |
---|
255 | |
---|
256 | m_aapiOrgVideoPel = new Pel** [m_iNumOfBaseViews]; |
---|
257 | m_aaiOrgVideoStrides = new Int* [m_iNumOfBaseViews]; |
---|
258 | |
---|
259 | m_apiOrgDepthPel = new Pel* [m_iNumOfBaseViews]; |
---|
260 | m_aiOrgDepthStrides = new Int [m_iNumOfBaseViews]; |
---|
261 | |
---|
262 | m_abSetupVideoFromOrgForView = new Bool[m_iNumOfBaseViews]; |
---|
263 | m_abSetupDepthFromOrgForView = new Bool[m_iNumOfBaseViews]; |
---|
264 | |
---|
265 | m_iNumOfCurRenModels = 0; |
---|
266 | m_apcCurRenModels = NULL; |
---|
267 | m_aiCurPosInModels = NULL; |
---|
268 | |
---|
269 | m_apcRenModels = new TRenSingleModel* [m_iNumOfRenModels]; |
---|
270 | |
---|
271 | m_aiNumOfModelsForDepthView = new Int [m_iNumOfBaseViews]; |
---|
272 | m_aapcRenModelForDepthView = new TRenSingleModel** [m_iNumOfBaseViews]; |
---|
273 | m_aaePosInModelForDepthView = new Int* [m_iNumOfBaseViews]; |
---|
274 | |
---|
275 | m_aiNumOfModelsForVideoView = new Int [m_iNumOfBaseViews]; |
---|
276 | m_aapcRenModelForVideoView = new TRenSingleModel** [m_iNumOfBaseViews]; |
---|
277 | m_aaePosInModelForVideoView = new Int* [m_iNumOfBaseViews]; |
---|
278 | m_aaeBaseViewPosInModel = new Int* [m_iNumOfBaseViews]; |
---|
279 | |
---|
280 | |
---|
281 | for (Int iModelNum = 0; iModelNum < m_iNumOfRenModels; iModelNum++) |
---|
282 | { |
---|
283 | m_apcRenModels [iModelNum] = NULL; |
---|
284 | } |
---|
285 | |
---|
286 | for (Int iViewNum = 0; iViewNum < m_iNumOfBaseViews; iViewNum++ ) |
---|
287 | { |
---|
288 | m_aiNumOfModelsForDepthView[ iViewNum ] = 0; |
---|
289 | m_aiNumOfModelsForVideoView[ iViewNum ] = 0; |
---|
290 | |
---|
291 | m_aapcRenModelForDepthView [iViewNum] = new TRenSingleModel*[m_iNumOfRenModels]; |
---|
292 | m_aapcRenModelForVideoView [iViewNum] = new TRenSingleModel*[m_iNumOfRenModels]; |
---|
293 | |
---|
294 | m_aaePosInModelForDepthView[iViewNum] = new Int [m_iNumOfRenModels]; |
---|
295 | m_aaePosInModelForVideoView[iViewNum] = new Int [m_iNumOfRenModels]; |
---|
296 | m_aaeBaseViewPosInModel [iViewNum] = new Int [m_iNumOfRenModels]; |
---|
297 | |
---|
298 | for (Int iModelNum = 0; iModelNum< m_iNumOfRenModels; iModelNum++) |
---|
299 | { |
---|
300 | m_aapcRenModelForDepthView [iViewNum] [iModelNum] = NULL; |
---|
301 | m_aapcRenModelForVideoView [iViewNum] [iModelNum] = NULL; |
---|
302 | m_aaePosInModelForDepthView[iViewNum] [iModelNum] = VIEWPOS_INVALID; |
---|
303 | m_aaePosInModelForVideoView[iViewNum] [iModelNum] = VIEWPOS_INVALID; |
---|
304 | m_aaeBaseViewPosInModel [iViewNum] [iModelNum] = VIEWPOS_INVALID; |
---|
305 | }; |
---|
306 | |
---|
307 | m_aaiCurVideoStrides [iViewNum] = new Int[3]; |
---|
308 | m_aaiCurVideoStrides [iViewNum][0] = m_iSampledWidth + (m_iPad << 1); |
---|
309 | m_aaiCurVideoStrides [iViewNum][1] = m_iSampledWidth + (m_iPad << 1); |
---|
310 | m_aaiCurVideoStrides [iViewNum][2] = m_iSampledWidth + (m_iPad << 1); |
---|
311 | |
---|
312 | m_aapiCurVideoPel [iViewNum] = new Pel*[3]; |
---|
313 | m_aapiCurVideoPel [iViewNum][0] = new Pel [ m_aaiCurVideoStrides[iViewNum][0] * ( m_iHeight + (m_iPad << 1) )]; |
---|
314 | m_aapiCurVideoPel [iViewNum][1] = new Pel [ m_aaiCurVideoStrides[iViewNum][1] * ( m_iHeight + (m_iPad << 1) )]; |
---|
315 | m_aapiCurVideoPel [iViewNum][2] = new Pel [ m_aaiCurVideoStrides[iViewNum][2] * ( m_iHeight + (m_iPad << 1) )]; |
---|
316 | |
---|
317 | m_aapiCurVideoPel [iViewNum][0] += m_aaiCurVideoStrides[iViewNum][0] * m_iPad + m_iPad; |
---|
318 | m_aapiCurVideoPel [iViewNum][1] += m_aaiCurVideoStrides[iViewNum][1] * m_iPad + m_iPad; |
---|
319 | m_aapiCurVideoPel [iViewNum][2] += m_aaiCurVideoStrides[iViewNum][2] * m_iPad + m_iPad; |
---|
320 | |
---|
321 | m_aiCurDepthStrides [iViewNum] = m_iWidth + (m_iPad << 1); |
---|
322 | m_apiCurDepthPel [iViewNum] = new Pel[ m_aiCurDepthStrides[iViewNum] * ( m_iHeight + (m_iPad << 1) ) ]; |
---|
323 | m_apiCurDepthPel [iViewNum] += m_aiCurDepthStrides[iViewNum] * m_iPad + m_iPad; |
---|
324 | |
---|
325 | m_aaiOrgVideoStrides [iViewNum] = new Int[3]; |
---|
326 | m_aaiOrgVideoStrides [iViewNum][0] = m_iSampledWidth + (m_iPad << 1); |
---|
327 | m_aaiOrgVideoStrides [iViewNum][1] = m_iSampledWidth + (m_iPad << 1); |
---|
328 | m_aaiOrgVideoStrides [iViewNum][2] = m_iSampledWidth + (m_iPad << 1); |
---|
329 | |
---|
330 | m_aapiOrgVideoPel [iViewNum] = new Pel*[3]; |
---|
331 | m_aapiOrgVideoPel [iViewNum][0] = new Pel [ m_aaiOrgVideoStrides[iViewNum][0] * ( m_iHeight + (m_iPad << 1) )]; |
---|
332 | m_aapiOrgVideoPel [iViewNum][1] = new Pel [ m_aaiOrgVideoStrides[iViewNum][1] * ( m_iHeight + (m_iPad << 1) )]; |
---|
333 | m_aapiOrgVideoPel [iViewNum][2] = new Pel [ m_aaiOrgVideoStrides[iViewNum][2] * ( m_iHeight + (m_iPad << 1) )]; |
---|
334 | |
---|
335 | m_aapiOrgVideoPel [iViewNum][0] += m_aaiOrgVideoStrides[iViewNum][0] * m_iPad + m_iPad; |
---|
336 | m_aapiOrgVideoPel [iViewNum][1] += m_aaiOrgVideoStrides[iViewNum][1] * m_iPad + m_iPad; |
---|
337 | m_aapiOrgVideoPel [iViewNum][2] += m_aaiOrgVideoStrides[iViewNum][2] * m_iPad + m_iPad; |
---|
338 | |
---|
339 | m_aiOrgDepthStrides [iViewNum] = m_iWidth + (m_iPad << 1); |
---|
340 | m_apiOrgDepthPel [iViewNum] = new Pel[ m_aiOrgDepthStrides[iViewNum] * ( m_iHeight + (m_iPad << 1) ) ]; |
---|
341 | m_apiOrgDepthPel [iViewNum] += m_aiOrgDepthStrides[iViewNum] * m_iPad + m_iPad; |
---|
342 | |
---|
343 | m_abSetupVideoFromOrgForView[iViewNum] = false; |
---|
344 | m_abSetupDepthFromOrgForView[iViewNum] = false; |
---|
345 | } |
---|
346 | } |
---|
347 | |
---|
348 | Void |
---|
349 | TRenModel::createSingleModel( Int iBaseViewNum, Int iContent, Int iModelNum, Int iLeftViewNum, Int iRightViewNum, Bool bUseOrgRef, Int iBlendMode ) |
---|
350 | { |
---|
351 | Int iMode = ( (iLeftViewNum != -1) && ( iRightViewNum != -1 ) ) ? 2 : ( iLeftViewNum != -1 ? 0 : ( iRightViewNum != -1 ? 1 : -1 ) ); |
---|
352 | |
---|
353 | AOT( iMode == -1); |
---|
354 | AOT( iModelNum < 0 || iModelNum > m_iNumOfRenModels ); |
---|
355 | AOT( iLeftViewNum < -1 || iLeftViewNum > m_iNumOfBaseViews ); |
---|
356 | AOT( iRightViewNum < -1 || iRightViewNum > m_iNumOfBaseViews ); |
---|
357 | AOT( iBaseViewNum < -1 || iBaseViewNum > m_iNumOfBaseViews ); |
---|
358 | AOT( iBaseViewNum != -1 && iBaseViewNum != iLeftViewNum && iBaseViewNum != iRightViewNum ); |
---|
359 | AOT( iContent < -1 || iContent > 1 ); |
---|
360 | AOT( iBlendMode < -1 || iBlendMode > 2 ); |
---|
361 | |
---|
362 | Bool bBitInc = (g_uiBitIncrement != 0); |
---|
363 | |
---|
364 | AOT( m_apcRenModels[iModelNum] ); |
---|
365 | |
---|
366 | if ( bBitInc ) |
---|
367 | { |
---|
368 | if ( iMode != 2 ) |
---|
369 | { // No Blending |
---|
370 | m_apcRenModels[iModelNum] = new TRenSingleModelC<BLEND_NONE, true>; |
---|
371 | } |
---|
372 | else |
---|
373 | { |
---|
374 | switch ( iBlendMode ) |
---|
375 | { |
---|
376 | case BLEND_AVRG: // average |
---|
377 | m_apcRenModels[iModelNum] = new TRenSingleModelC<BLEND_AVRG, true>; |
---|
378 | break; |
---|
379 | case BLEND_LEFT: // left view is main view |
---|
380 | m_apcRenModels[iModelNum] = new TRenSingleModelC<BLEND_LEFT, true>; |
---|
381 | break; |
---|
382 | case BLEND_RIGHT: // right view is main view |
---|
383 | m_apcRenModels[iModelNum] = new TRenSingleModelC<BLEND_RIGHT, true>; |
---|
384 | break; |
---|
385 | default: |
---|
386 | AOT(true); |
---|
387 | break; |
---|
388 | } |
---|
389 | } |
---|
390 | } |
---|
391 | else |
---|
392 | { |
---|
393 | if ( iMode != 2 ) |
---|
394 | { // No Blending |
---|
395 | m_apcRenModels[iModelNum] = new TRenSingleModelC<BLEND_NONE, false>; |
---|
396 | } |
---|
397 | else |
---|
398 | { |
---|
399 | switch ( iBlendMode ) |
---|
400 | { |
---|
401 | case BLEND_AVRG: // average |
---|
402 | m_apcRenModels[iModelNum] = new TRenSingleModelC<BLEND_AVRG, false>; |
---|
403 | break; |
---|
404 | case BLEND_LEFT: // left view is main view |
---|
405 | m_apcRenModels[iModelNum] = new TRenSingleModelC<BLEND_LEFT, false>; |
---|
406 | break; |
---|
407 | case BLEND_RIGHT: // right view is main view |
---|
408 | m_apcRenModels[iModelNum] = new TRenSingleModelC<BLEND_RIGHT, false>; |
---|
409 | break; |
---|
410 | default: |
---|
411 | AOT(true); |
---|
412 | break; |
---|
413 | } |
---|
414 | } |
---|
415 | } |
---|
416 | |
---|
417 | |
---|
418 | #if LGE_VSO_EARLY_SKIP_A0093 |
---|
419 | m_apcRenModels[iModelNum]->create( iMode ,m_iWidth, m_iHeight, m_iShiftPrec, m_aaaiSubPelShiftLut, m_iHoleMargin, bUseOrgRef, iBlendMode, m_bEarlySkip ); |
---|
420 | #else |
---|
421 | m_apcRenModels[iModelNum]->create( iMode ,m_iWidth, m_iHeight, m_iShiftPrec, m_aaaiSubPelShiftLut, m_iHoleMargin, bUseOrgRef, iBlendMode ); |
---|
422 | #endif |
---|
423 | |
---|
424 | if ( iLeftViewNum != -1 ) |
---|
425 | { |
---|
426 | xSetLRViewAndAddModel( iModelNum, iLeftViewNum, iContent, VIEWPOS_LEFT, (iBaseViewNum == -1 || iBaseViewNum == iLeftViewNum ) ); |
---|
427 | } |
---|
428 | |
---|
429 | if ( iRightViewNum != -1) |
---|
430 | { |
---|
431 | xSetLRViewAndAddModel( iModelNum, iRightViewNum, iContent, VIEWPOS_RIGHT, (iBaseViewNum == -1 || iBaseViewNum == iRightViewNum ) ); |
---|
432 | } |
---|
433 | } |
---|
434 | |
---|
435 | Void |
---|
436 | TRenModel::setBaseView( Int iViewNum, TComPicYuv* pcPicYuvVideoData, TComPicYuv* pcPicYuvDepthData, TComPicYuv* pcPicYuvOrgVideoData, TComPicYuv* pcPicYuvOrgDepthData ) |
---|
437 | { |
---|
438 | AOT( iViewNum < 0 || iViewNum > m_iNumOfBaseViews ); |
---|
439 | #if FIX_VSO_SETUP |
---|
440 | AOF( pcPicYuvVideoData->getHeight() >= m_iUsedHeight + m_uiHorOff && pcPicYuvVideoData->getWidth() == m_iWidth ); |
---|
441 | AOF( pcPicYuvDepthData->getHeight() >= m_iUsedHeight + m_uiHorOff && pcPicYuvDepthData->getWidth() == m_iWidth ); |
---|
442 | #else |
---|
443 | AOF( pcPicYuvVideoData->getHeight() <= m_iHeight + m_uiHorOff || pcPicYuvVideoData->getWidth() == m_iWidth ); |
---|
444 | AOF( pcPicYuvDepthData->getHeight() <= m_iHeight + m_uiHorOff || pcPicYuvDepthData->getWidth() == m_iWidth ); |
---|
445 | #endif |
---|
446 | |
---|
447 | pcPicYuvVideoData->extendPicBorder(); |
---|
448 | |
---|
449 | #if FIX_VSO_SETUP |
---|
450 | TRenFilter::sampleHorUp ( m_iShiftPrec, pcPicYuvVideoData->getLumaAddr() + m_uiHorOff * pcPicYuvVideoData->getStride () , pcPicYuvVideoData->getStride() , m_iWidth, m_iUsedHeight, m_aapiCurVideoPel[ iViewNum ][0], m_aaiCurVideoStrides[iViewNum][0] ); |
---|
451 | TRenFilter::sampleCUpHorUp( m_iShiftPrec, pcPicYuvVideoData->getCbAddr() + (m_uiHorOff >> 1 ) * pcPicYuvVideoData->getCStride() , pcPicYuvVideoData->getCStride(), m_iWidth >> 1, m_iUsedHeight >> 1, m_aapiCurVideoPel[ iViewNum ][1], m_aaiCurVideoStrides[iViewNum][1] ); |
---|
452 | TRenFilter::sampleCUpHorUp( m_iShiftPrec, pcPicYuvVideoData->getCrAddr() + (m_uiHorOff >> 1 ) * pcPicYuvVideoData->getCStride() , pcPicYuvVideoData->getCStride(), m_iWidth >> 1, m_iUsedHeight >> 1, m_aapiCurVideoPel[ iViewNum ][2], m_aaiCurVideoStrides[iViewNum][2] ); |
---|
453 | TRenFilter::copy ( pcPicYuvDepthData->getLumaAddr() + m_uiHorOff * pcPicYuvDepthData->getStride () , pcPicYuvDepthData->getStride(), m_iWidth, m_iUsedHeight, m_apiCurDepthPel [ iViewNum], m_aiCurDepthStrides [iViewNum] ); |
---|
454 | #else |
---|
455 | TRenFilter::sampleHorUp ( m_iShiftPrec, pcPicYuvVideoData->getLumaAddr() + m_uiHorOff * pcPicYuvVideoData->getStride () , pcPicYuvVideoData->getStride() , m_iWidth, m_iHeight, m_aapiCurVideoPel[ iViewNum ][0], m_aaiCurVideoStrides[iViewNum][0] ); |
---|
456 | TRenFilter::sampleCUpHorUp( m_iShiftPrec, pcPicYuvVideoData->getCbAddr() + (m_uiHorOff >> 1 ) * pcPicYuvVideoData->getCStride() , pcPicYuvVideoData->getCStride(), m_iWidth >> 1, m_iHeight >> 1, m_aapiCurVideoPel[ iViewNum ][1], m_aaiCurVideoStrides[iViewNum][1] ); |
---|
457 | TRenFilter::sampleCUpHorUp( m_iShiftPrec, pcPicYuvVideoData->getCrAddr() + (m_uiHorOff >> 1 ) * pcPicYuvVideoData->getCStride() , pcPicYuvVideoData->getCStride(), m_iWidth >> 1, m_iHeight >> 1, m_aapiCurVideoPel[ iViewNum ][2], m_aaiCurVideoStrides[iViewNum][2] ); |
---|
458 | TRenFilter::copy ( pcPicYuvDepthData->getLumaAddr() + m_uiHorOff * pcPicYuvDepthData->getStride () , pcPicYuvDepthData->getStride(), m_iWidth, m_iHeight, m_apiCurDepthPel [ iViewNum], m_aiCurDepthStrides [iViewNum] ); |
---|
459 | #endif |
---|
460 | |
---|
461 | // Used for rendering reference pic from original video data |
---|
462 | m_abSetupVideoFromOrgForView[iViewNum] = (pcPicYuvOrgVideoData != NULL); |
---|
463 | m_abSetupDepthFromOrgForView[iViewNum] = (pcPicYuvOrgDepthData != NULL); |
---|
464 | |
---|
465 | if ( m_abSetupVideoFromOrgForView[iViewNum] ) |
---|
466 | { |
---|
467 | #if FIX_VSO_SETUP |
---|
468 | AOF( pcPicYuvOrgVideoData->getHeight() >= m_iUsedHeight + m_uiHorOff && pcPicYuvOrgVideoData->getWidth() == m_iWidth ); |
---|
469 | pcPicYuvOrgVideoData->extendPicBorder(); |
---|
470 | TRenFilter::sampleHorUp ( m_iShiftPrec, pcPicYuvOrgVideoData->getLumaAddr() + m_uiHorOff * pcPicYuvOrgVideoData->getStride() , pcPicYuvOrgVideoData->getStride() , m_iWidth, m_iUsedHeight, m_aapiOrgVideoPel[ iViewNum ][0], m_aaiOrgVideoStrides[iViewNum][0] ); |
---|
471 | TRenFilter::sampleCUpHorUp( m_iShiftPrec, pcPicYuvOrgVideoData->getCbAddr() + (m_uiHorOff >> 1 ) * pcPicYuvOrgVideoData->getCStride(), pcPicYuvOrgVideoData->getCStride(), m_iWidth >> 1, m_iUsedHeight >> 1, m_aapiOrgVideoPel[ iViewNum ][1], m_aaiOrgVideoStrides[iViewNum][1] ); |
---|
472 | TRenFilter::sampleCUpHorUp( m_iShiftPrec, pcPicYuvOrgVideoData->getCrAddr() + (m_uiHorOff >> 1 ) * pcPicYuvOrgVideoData->getCStride(), pcPicYuvOrgVideoData->getCStride(), m_iWidth >> 1, m_iUsedHeight >> 1, m_aapiOrgVideoPel[ iViewNum ][2], m_aaiOrgVideoStrides[iViewNum][2] ); |
---|
473 | #else |
---|
474 | AOF( pcPicYuvOrgVideoData->getHeight() <= m_iHeight + m_uiHorOff || pcPicYuvOrgVideoData->getWidth() == m_iWidth ); |
---|
475 | pcPicYuvOrgVideoData->extendPicBorder(); |
---|
476 | TRenFilter::sampleHorUp ( m_iShiftPrec, pcPicYuvOrgVideoData->getLumaAddr() + m_uiHorOff * pcPicYuvOrgVideoData->getStride() , pcPicYuvOrgVideoData->getStride() , m_iWidth, m_iHeight, m_aapiOrgVideoPel[ iViewNum ][0], m_aaiOrgVideoStrides[iViewNum][0] ); |
---|
477 | TRenFilter::sampleCUpHorUp( m_iShiftPrec, pcPicYuvOrgVideoData->getCbAddr() + (m_uiHorOff >> 1 ) * pcPicYuvOrgVideoData->getCStride(), pcPicYuvOrgVideoData->getCStride(), m_iWidth >> 1, m_iHeight >> 1, m_aapiOrgVideoPel[ iViewNum ][1], m_aaiOrgVideoStrides[iViewNum][1] ); |
---|
478 | TRenFilter::sampleCUpHorUp( m_iShiftPrec, pcPicYuvOrgVideoData->getCrAddr() + (m_uiHorOff >> 1 ) * pcPicYuvOrgVideoData->getCStride(), pcPicYuvOrgVideoData->getCStride(), m_iWidth >> 1, m_iHeight >> 1, m_aapiOrgVideoPel[ iViewNum ][2], m_aaiOrgVideoStrides[iViewNum][2] ); |
---|
479 | #endif |
---|
480 | } |
---|
481 | |
---|
482 | if ( m_abSetupDepthFromOrgForView[iViewNum] ) |
---|
483 | { |
---|
484 | #if FIX_VSO_SETUP |
---|
485 | AOF( pcPicYuvOrgDepthData->getHeight() >= m_iUsedHeight + m_uiHorOff && pcPicYuvOrgDepthData->getWidth() == m_iWidth ); |
---|
486 | TRenFilter::copy ( pcPicYuvOrgDepthData->getLumaAddr() + m_uiHorOff * pcPicYuvOrgDepthData->getStride() , pcPicYuvOrgDepthData->getStride(), m_iWidth, m_iUsedHeight, m_apiOrgDepthPel [ iViewNum], m_aiOrgDepthStrides [iViewNum] ); |
---|
487 | #else |
---|
488 | AOF( pcPicYuvOrgDepthData->getHeight() <= m_iHeight + m_uiHorOff || pcPicYuvOrgDepthData->getWidth() == m_iWidth ); |
---|
489 | TRenFilter::copy ( pcPicYuvOrgDepthData->getLumaAddr() + m_uiHorOff * pcPicYuvOrgDepthData->getStride() , pcPicYuvOrgDepthData->getStride(), m_iWidth, m_iHeight, m_apiOrgDepthPel [ iViewNum], m_aiOrgDepthStrides [iViewNum] ); |
---|
490 | #endif |
---|
491 | } |
---|
492 | } |
---|
493 | |
---|
494 | Void |
---|
495 | TRenModel::setSingleModel( Int iModelNum, Int** ppiShiftLutLeft, Int** ppiBaseShiftLutLeft, Int** ppiShiftLutRight, Int** ppiBaseShiftLutRight, Int iDistToLeft, TComPicYuv* pcPicYuvRefView ) |
---|
496 | { |
---|
497 | AOT( iModelNum < 0 || iModelNum > m_iNumOfRenModels ); |
---|
498 | |
---|
499 | #if FIX_VSO_SETUP |
---|
500 | m_apcRenModels[iModelNum]->setupPart( m_uiHorOff, m_iUsedHeight ); |
---|
501 | #endif |
---|
502 | |
---|
503 | // Switch model to original data for setup if given to render reference |
---|
504 | Bool bAnyRefFromOrg = false; |
---|
505 | for (Int iBaseViewIdx = 0; iBaseViewIdx < m_iNumOfBaseViews; iBaseViewIdx++ ) |
---|
506 | { |
---|
507 | Bool bSetupFromOrgVideo = m_abSetupVideoFromOrgForView[iBaseViewIdx]; |
---|
508 | Bool bSetupFromOrgDepth = m_abSetupDepthFromOrgForView[iBaseViewIdx]; |
---|
509 | bAnyRefFromOrg = bAnyRefFromOrg || bSetupFromOrgVideo || bSetupFromOrgDepth; |
---|
510 | |
---|
511 | if ( m_aaeBaseViewPosInModel[iBaseViewIdx][iModelNum] != VIEWPOS_INVALID ) |
---|
512 | { |
---|
513 | bAnyRefFromOrg = true; |
---|
514 | m_apcRenModels[iModelNum]->setLRView( m_aaeBaseViewPosInModel[iBaseViewIdx][iModelNum], |
---|
515 | ( bSetupFromOrgVideo ? m_aapiOrgVideoPel : m_aapiCurVideoPel ) [iBaseViewIdx], |
---|
516 | ( bSetupFromOrgVideo ? m_aaiOrgVideoStrides: m_aaiCurVideoStrides) [iBaseViewIdx], |
---|
517 | ( bSetupFromOrgDepth ? m_apiOrgDepthPel : m_apiCurDepthPel ) [iBaseViewIdx], |
---|
518 | ( bSetupFromOrgDepth ? m_aiOrgDepthStrides : m_aiCurDepthStrides ) [iBaseViewIdx] ); |
---|
519 | } |
---|
520 | } |
---|
521 | |
---|
522 | #if FIX_VSO_SETUP |
---|
523 | m_apcRenModels[iModelNum]->setup ( pcPicYuvRefView, ppiShiftLutLeft, ppiBaseShiftLutLeft, ppiShiftLutRight, ppiBaseShiftLutRight, iDistToLeft, false ); |
---|
524 | #else |
---|
525 | m_apcRenModels[iModelNum]->setup ( pcPicYuvRefView, ppiShiftLutLeft, ppiBaseShiftLutLeft, ppiShiftLutRight, ppiBaseShiftLutRight, iDistToLeft, false, m_uiHorOff ); |
---|
526 | #endif |
---|
527 | |
---|
528 | // Setup to Org |
---|
529 | if ( bAnyRefFromOrg ) |
---|
530 | { |
---|
531 | // Restore old values |
---|
532 | for (Int iBaseViewIdx = 0; iBaseViewIdx < m_iNumOfBaseViews; iBaseViewIdx++ ) |
---|
533 | { |
---|
534 | if ( m_aaeBaseViewPosInModel[iBaseViewIdx][iModelNum] != VIEWPOS_INVALID ) |
---|
535 | { |
---|
536 | m_apcRenModels[iModelNum]->setLRView( |
---|
537 | m_aaeBaseViewPosInModel[iBaseViewIdx][iModelNum], |
---|
538 | m_aapiCurVideoPel [iBaseViewIdx], |
---|
539 | m_aaiCurVideoStrides [iBaseViewIdx], |
---|
540 | m_apiCurDepthPel [iBaseViewIdx], |
---|
541 | m_aiCurDepthStrides [iBaseViewIdx] |
---|
542 | ); |
---|
543 | } |
---|
544 | } |
---|
545 | |
---|
546 | // setup keeping reference rendered from original data |
---|
547 | #if FIX_VSO_SETUP |
---|
548 | m_apcRenModels[iModelNum]->setup ( pcPicYuvRefView, ppiShiftLutLeft, ppiBaseShiftLutLeft, ppiShiftLutRight, ppiBaseShiftLutRight, iDistToLeft, true ); |
---|
549 | #else |
---|
550 | m_apcRenModels[iModelNum]->setup ( pcPicYuvRefView, ppiShiftLutLeft, ppiBaseShiftLutLeft, ppiShiftLutRight, ppiBaseShiftLutRight, iDistToLeft, true, m_uiHorOff); |
---|
551 | #endif |
---|
552 | } |
---|
553 | } |
---|
554 | |
---|
555 | Void |
---|
556 | TRenModel::setErrorMode( Int iView, Int iContent, int iPlane ) |
---|
557 | { |
---|
558 | AOT(iView > m_iNumOfBaseViews || iView < 0); |
---|
559 | AOT(iContent != 0 && iContent != 1); |
---|
560 | AOT(iPlane < 0 || iPlane > 3); |
---|
561 | |
---|
562 | m_iCurrentView = iView; |
---|
563 | m_iCurrentContent = iContent; |
---|
564 | m_iCurrentPlane = iPlane; |
---|
565 | |
---|
566 | if ( iContent == 1 ) |
---|
567 | { |
---|
568 | m_iNumOfCurRenModels = m_aiNumOfModelsForDepthView[iView]; |
---|
569 | m_apcCurRenModels = m_aapcRenModelForDepthView [iView]; |
---|
570 | m_aiCurPosInModels = m_aaePosInModelForDepthView[iView]; |
---|
571 | } |
---|
572 | else |
---|
573 | { |
---|
574 | m_iNumOfCurRenModels = m_aiNumOfModelsForVideoView[iView]; |
---|
575 | m_apcCurRenModels = m_aapcRenModelForVideoView [iView]; |
---|
576 | m_aiCurPosInModels = m_aaePosInModelForVideoView[iView]; |
---|
577 | } |
---|
578 | } |
---|
579 | |
---|
580 | |
---|
581 | #if FIX_VSO_SETUP |
---|
582 | Void |
---|
583 | TRenModel::setupPart ( UInt uiHorOff, Int iUsedHeight ) |
---|
584 | { |
---|
585 | AOT( iUsedHeight > m_iHeight ); |
---|
586 | m_uiHorOff = uiHorOff; |
---|
587 | m_iUsedHeight = iUsedHeight; |
---|
588 | } |
---|
589 | #else |
---|
590 | Void |
---|
591 | TRenModel::setHorOffset ( UInt uiHorOff ) |
---|
592 | { |
---|
593 | m_uiHorOff = uiHorOff; |
---|
594 | } |
---|
595 | #endif |
---|
596 | |
---|
597 | #if LGE_VSO_EARLY_SKIP_A0093 |
---|
598 | RMDist |
---|
599 | TRenModel::getDist( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Pel * piOrgData, Int iOrgStride) |
---|
600 | #else |
---|
601 | RMDist |
---|
602 | TRenModel::getDist( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData ) |
---|
603 | #endif |
---|
604 | { |
---|
605 | iStartPosY -= m_uiHorOff; |
---|
606 | |
---|
607 | AOT( iWidth + iStartPosX > m_iWidth ); |
---|
608 | #if FIX_VSO_SETUP |
---|
609 | AOT( iHeight + iStartPosY > m_iUsedHeight ); |
---|
610 | #else |
---|
611 | AOT( iHeight + iStartPosY > m_iHeight ); |
---|
612 | #endif |
---|
613 | |
---|
614 | AOT( iStartPosX < 0); |
---|
615 | AOT( iStartPosY < 0); |
---|
616 | AOT( iWidth < 0); |
---|
617 | AOT( iHeight < 0); |
---|
618 | |
---|
619 | RMDist iDist = 0; |
---|
620 | |
---|
621 | for (Int iModelNum = 0; iModelNum < m_iNumOfCurRenModels; iModelNum++ ) |
---|
622 | { |
---|
623 | if (m_iCurrentContent == 1) |
---|
624 | { |
---|
625 | #if LGE_VSO_EARLY_SKIP_A0093 |
---|
626 | iDist += m_apcCurRenModels[iModelNum]->getDistDepth ( m_aiCurPosInModels[iModelNum], iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData , piOrgData, iOrgStride); |
---|
627 | #else |
---|
628 | iDist += m_apcCurRenModels[iModelNum]->getDistDepth ( m_aiCurPosInModels[iModelNum], iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData ); |
---|
629 | #endif |
---|
630 | } |
---|
631 | else |
---|
632 | { |
---|
633 | iDist += m_apcCurRenModels[iModelNum]->getDistVideo ( m_aiCurPosInModels[iModelNum], m_iCurrentPlane ,iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData ); |
---|
634 | } |
---|
635 | } |
---|
636 | |
---|
637 | return ( iDist + (m_iNumOfCurRenModels >> 1) ) / m_iNumOfCurRenModels; |
---|
638 | } |
---|
639 | |
---|
640 | Void |
---|
641 | TRenModel::setData( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData ) |
---|
642 | { |
---|
643 | iStartPosY -= m_uiHorOff; |
---|
644 | |
---|
645 | iWidth = min(iWidth , m_iWidth - iStartPosX ); |
---|
646 | #if FIX_VSO_SETUP |
---|
647 | iHeight = min(iHeight, m_iUsedHeight - iStartPosY ); |
---|
648 | #else |
---|
649 | iHeight = min(iHeight, m_iHeight - iStartPosY ); |
---|
650 | #endif |
---|
651 | |
---|
652 | AOT( iStartPosX < 0); |
---|
653 | AOT( iStartPosY < 0); |
---|
654 | AOT( iWidth < 0); |
---|
655 | AOT( iHeight < 0); |
---|
656 | |
---|
657 | for (Int iModelNum = 0; iModelNum < m_iNumOfCurRenModels; iModelNum++ ) |
---|
658 | { |
---|
659 | if (m_iCurrentContent == 1) |
---|
660 | { |
---|
661 | #ifdef LGE_VSO_EARLY_SKIP_A0093 |
---|
662 | Int iTargetStride = m_aiCurDepthStrides[ m_iCurrentView ]; |
---|
663 | m_apcCurRenModels[iModelNum]->setDepth ( m_aiCurPosInModels[iModelNum], iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData,m_apiCurDepthPel[ m_iCurrentView ] + iStartPosY * iTargetStride + iStartPosX ,iTargetStride ); |
---|
664 | #else |
---|
665 | m_apcCurRenModels[iModelNum]->setDepth ( m_aiCurPosInModels[iModelNum], iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData ); |
---|
666 | #endif |
---|
667 | } |
---|
668 | else |
---|
669 | { |
---|
670 | m_apcCurRenModels[iModelNum]->setVideo ( m_aiCurPosInModels[iModelNum], m_iCurrentPlane ,iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData ); |
---|
671 | } |
---|
672 | } |
---|
673 | |
---|
674 | #ifdef LGE_VSO_EARLY_SKIP_A0093 |
---|
675 | if (m_iCurrentContent == 1) |
---|
676 | { |
---|
677 | Int iTargetStride = m_aiCurDepthStrides[ m_iCurrentView ]; |
---|
678 | TRenFilter::copy( piNewData, iStride, iWidth, iHeight, m_apiCurDepthPel[ m_iCurrentView ] + iStartPosY * iTargetStride + iStartPosX, iTargetStride ); |
---|
679 | } |
---|
680 | #endif |
---|
681 | } |
---|
682 | |
---|
683 | Void |
---|
684 | TRenModel::getSynthVideo( Int iModelNum, Int iViewNum, TComPicYuv* pcPicYuv ) |
---|
685 | { |
---|
686 | #if FIX_VSO_SETUP |
---|
687 | m_apcRenModels[iModelNum]->getSynthVideo(iViewNum, pcPicYuv ); |
---|
688 | #else |
---|
689 | m_apcRenModels[iModelNum]->getSynthVideo(iViewNum, pcPicYuv, m_uiHorOff ); |
---|
690 | #endif |
---|
691 | } |
---|
692 | |
---|
693 | Void |
---|
694 | TRenModel::getSynthDepth( Int iModelNum, Int iViewNum, TComPicYuv* pcPicYuv ) |
---|
695 | { |
---|
696 | #if HHI_VSO_SPEEDUP_A0033 && !FIX_VSO_SETUP |
---|
697 | m_apcRenModels[iModelNum]->getSynthDepth(iViewNum, pcPicYuv, m_uiHorOff ); |
---|
698 | #else |
---|
699 | m_apcRenModels[iModelNum]->getSynthDepth(iViewNum, pcPicYuv ); |
---|
700 | #endif |
---|
701 | } |
---|
702 | |
---|
703 | Void |
---|
704 | TRenModel::getTotalSSE( Int64& riSSEY, Int64& riSSEU, Int64& riSSEV ) |
---|
705 | { |
---|
706 | TComPicYuv cPicYuvSynth; |
---|
707 | #if FIX_VSO_SETUP |
---|
708 | cPicYuvSynth.create( m_iWidth, m_iUsedHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth ); |
---|
709 | #else |
---|
710 | cPicYuvSynth.create( m_iWidth, m_iHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth ); |
---|
711 | #endif |
---|
712 | |
---|
713 | TComPicYuv cPicYuvTempRef; |
---|
714 | #if FIX_VSO_SETUP |
---|
715 | cPicYuvTempRef.create( m_iWidth, m_iUsedHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth); |
---|
716 | #else |
---|
717 | cPicYuvTempRef.create( m_iWidth, m_iHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth); |
---|
718 | #endif |
---|
719 | |
---|
720 | Int64 iSSEY = 0; |
---|
721 | Int64 iSSEU = 0; |
---|
722 | Int64 iSSEV = 0; |
---|
723 | |
---|
724 | for (Int iCurModel = 0; iCurModel < m_iNumOfCurRenModels; iCurModel++) |
---|
725 | { |
---|
726 | #if FIX_VSO_SETUP |
---|
727 | m_apcCurRenModels[iCurModel]->getSynthVideo( m_aiCurPosInModels[iCurModel], &cPicYuvSynth ); |
---|
728 | m_apcCurRenModels[iCurModel]->getRefVideo ( m_aiCurPosInModels[iCurModel], &cPicYuvTempRef ); |
---|
729 | |
---|
730 | iSSEY += TRenFilter::SSE( cPicYuvSynth.getLumaAddr(), cPicYuvSynth.getStride(), m_iWidth, m_iUsedHeight , cPicYuvTempRef.getLumaAddr(), cPicYuvTempRef.getStride() ); |
---|
731 | iSSEU += TRenFilter::SSE( cPicYuvSynth.getCbAddr() , cPicYuvSynth.getCStride(), m_iWidth >> 1, m_iUsedHeight >> 1, cPicYuvTempRef.getCbAddr() , cPicYuvTempRef.getCStride()); |
---|
732 | iSSEV += TRenFilter::SSE( cPicYuvSynth.getCrAddr() , cPicYuvSynth.getCStride(), m_iWidth >> 1, m_iUsedHeight >> 1, cPicYuvTempRef.getCrAddr() , cPicYuvTempRef.getCStride()); |
---|
733 | #else |
---|
734 | m_apcCurRenModels[iCurModel]->getSynthVideo( m_aiCurPosInModels[iCurModel], &cPicYuvSynth, 0 ); |
---|
735 | TComPicYuv* pcPicYuvRef = &cPicYuvTempRef; |
---|
736 | m_apcCurRenModels[iCurModel]->getRefVideo ( m_aiCurPosInModels[iCurModel], pcPicYuvRef , 0 ); |
---|
737 | |
---|
738 | iSSEY += TRenFilter::SSE( cPicYuvSynth.getLumaAddr(), cPicYuvSynth.getStride(), m_iWidth, m_iHeight , pcPicYuvRef->getLumaAddr(), pcPicYuvRef->getStride() ); |
---|
739 | iSSEU += TRenFilter::SSE( cPicYuvSynth.getCbAddr() , cPicYuvSynth.getCStride(), m_iWidth >> 1, m_iHeight >> 1, pcPicYuvRef->getCbAddr() , pcPicYuvRef->getCStride()); |
---|
740 | iSSEV += TRenFilter::SSE( cPicYuvSynth.getCrAddr() , cPicYuvSynth.getCStride(), m_iWidth >> 1, m_iHeight >> 1, pcPicYuvRef->getCrAddr() , pcPicYuvRef->getCStride()); |
---|
741 | #endif |
---|
742 | } |
---|
743 | |
---|
744 | riSSEY = ( iSSEY + (m_iNumOfCurRenModels >> 1) ) / m_iNumOfCurRenModels; |
---|
745 | riSSEU = ( iSSEU + (m_iNumOfCurRenModels >> 1) ) / m_iNumOfCurRenModels; |
---|
746 | riSSEV = ( iSSEV + (m_iNumOfCurRenModels >> 1) ) / m_iNumOfCurRenModels; |
---|
747 | |
---|
748 | cPicYuvTempRef.destroy(); |
---|
749 | cPicYuvSynth .destroy(); |
---|
750 | } |
---|
751 | |
---|
752 | Void |
---|
753 | TRenModel::xSetLRViewAndAddModel( Int iModelNum, Int iBaseViewNum, Int iContent, Int iViewPos, Bool bAdd ) |
---|
754 | { |
---|
755 | AOF(iViewPos == VIEWPOS_LEFT || iViewPos == VIEWPOS_RIGHT); |
---|
756 | AOF(iContent == -1 || iContent == 0 || iContent == 1); |
---|
757 | AOT( iBaseViewNum < 0 || iBaseViewNum > m_iNumOfBaseViews ); |
---|
758 | AOT( m_aaeBaseViewPosInModel[iBaseViewNum][iModelNum] != VIEWPOS_INVALID ); |
---|
759 | m_aaeBaseViewPosInModel[iBaseViewNum][iModelNum] = iViewPos; |
---|
760 | |
---|
761 | if (bAdd) |
---|
762 | { |
---|
763 | if (iContent == 0 || iContent == -1 ) |
---|
764 | { |
---|
765 | Int iNewModelIdxForView = m_aiNumOfModelsForVideoView[iBaseViewNum]++; |
---|
766 | m_aapcRenModelForVideoView [ iBaseViewNum ][ iNewModelIdxForView ] = m_apcRenModels[iModelNum]; |
---|
767 | m_aaePosInModelForVideoView[ iBaseViewNum ][ iNewModelIdxForView ] = iViewPos; |
---|
768 | } |
---|
769 | |
---|
770 | if (iContent == 1 || iContent == -1 ) |
---|
771 | { |
---|
772 | Int iNewModelIdxForView = m_aiNumOfModelsForDepthView[iBaseViewNum]++; |
---|
773 | m_aapcRenModelForDepthView [ iBaseViewNum ][ iNewModelIdxForView ] = m_apcRenModels[iModelNum]; |
---|
774 | m_aaePosInModelForDepthView[ iBaseViewNum ][ iNewModelIdxForView ] = iViewPos; |
---|
775 | } |
---|
776 | } |
---|
777 | } |
---|