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 "TRenSingleModel.h" |
---|
37 | |
---|
38 | ////////////// TRENSINGLE MODEL /////////////// |
---|
39 | template <BlenMod iBM, Bool bBitInc> |
---|
40 | TRenSingleModelC<iBM,bBitInc>::TRenSingleModelC() |
---|
41 | : m_iDistShift ( g_uiBitIncrement << 1 ) |
---|
42 | { |
---|
43 | m_iWidth = -1; |
---|
44 | m_iHeight = -1; |
---|
45 | m_iStride = -1; |
---|
46 | m_iUsedHeight = -1; |
---|
47 | m_iHorOffset = -1; |
---|
48 | m_iMode = -1; |
---|
49 | m_iPad = PICYUV_PAD; |
---|
50 | m_iGapTolerance = -1; |
---|
51 | m_bUseOrgRef = false; |
---|
52 | |
---|
53 | m_pcPicYuvRef = NULL; |
---|
54 | |
---|
55 | m_pcOutputSamples = NULL; |
---|
56 | m_pcOutputSamplesRow = NULL; |
---|
57 | m_iOutputSamplesStride = -1; |
---|
58 | |
---|
59 | m_ppiCurLUT = NULL; |
---|
60 | m_piInvZLUTLeft = NULL; |
---|
61 | m_piInvZLUTRight = NULL; |
---|
62 | |
---|
63 | m_aapiRefVideoPel[0] = NULL; |
---|
64 | m_aapiRefVideoPel[1] = NULL; |
---|
65 | m_aapiRefVideoPel[2] = NULL; |
---|
66 | |
---|
67 | m_aiRefVideoStrides[0] = -1; |
---|
68 | m_aiRefVideoStrides[1] = -1; |
---|
69 | m_aiRefVideoStrides[2] = -1; |
---|
70 | |
---|
71 | |
---|
72 | for (UInt uiViewNum = 0 ; uiViewNum < 2; uiViewNum++) |
---|
73 | { |
---|
74 | // LUT |
---|
75 | m_appiShiftLut[uiViewNum] = NULL; |
---|
76 | |
---|
77 | m_pcInputSamples[uiViewNum] = NULL; |
---|
78 | m_iInputSamplesStride = -1; |
---|
79 | |
---|
80 | m_ppiCurLUT = NULL; |
---|
81 | m_piInvZLUTLeft = NULL; |
---|
82 | m_piInvZLUTRight = NULL; |
---|
83 | } |
---|
84 | |
---|
85 | #ifdef LGE_VSO_EARLY_SKIP_A0093 |
---|
86 | m_pbHorSkip = NULL; |
---|
87 | #endif |
---|
88 | } |
---|
89 | |
---|
90 | template <BlenMod iBM, Bool bBitInc> |
---|
91 | TRenSingleModelC<iBM,bBitInc>::~TRenSingleModelC() |
---|
92 | { |
---|
93 | #ifdef LGE_VSO_EARLY_SKIP_A0093 |
---|
94 | if ( m_pbHorSkip ) |
---|
95 | { |
---|
96 | delete[] m_pbHorSkip; |
---|
97 | m_pbHorSkip = NULL; |
---|
98 | } |
---|
99 | #endif |
---|
100 | |
---|
101 | if ( m_pcInputSamples [0] ) delete[] m_pcInputSamples [0]; |
---|
102 | if ( m_pcInputSamples [1] ) delete[] m_pcInputSamples [1]; |
---|
103 | |
---|
104 | if ( m_pcOutputSamples ) delete[] m_pcOutputSamples ; |
---|
105 | |
---|
106 | if ( m_piInvZLUTLeft ) delete[] m_piInvZLUTLeft ; |
---|
107 | if ( m_piInvZLUTRight ) delete[] m_piInvZLUTRight; |
---|
108 | |
---|
109 | if ( m_aapiRefVideoPel[0] ) delete[] ( m_aapiRefVideoPel[0] - ( m_aiRefVideoStrides[0] * m_iPad + m_iPad ) ); |
---|
110 | if ( m_aapiRefVideoPel[1] ) delete[] ( m_aapiRefVideoPel[1] - ( m_aiRefVideoStrides[1] * m_iPad + m_iPad ) ); |
---|
111 | if ( m_aapiRefVideoPel[2] ) delete[] ( m_aapiRefVideoPel[2] - ( m_aiRefVideoStrides[2] * m_iPad + m_iPad ) ); |
---|
112 | } |
---|
113 | |
---|
114 | template <BlenMod iBM, Bool bBitInc> Void |
---|
115 | #if LGE_VSO_EARLY_SKIP_A0093 |
---|
116 | TRenSingleModelC<iBM,bBitInc>::create( Int iMode, Int iWidth, Int iHeight, Int iShiftPrec, Int*** aaaiSubPelShiftTable, Int iHoleMargin, Bool bUseOrgRef, Int iBlendMode, Bool bEarlySkip ) |
---|
117 | #else |
---|
118 | TRenSingleModelC<iBM,bBitInc>::create( Int iMode, Int iWidth, Int iHeight, Int iShiftPrec, Int*** aaaiSubPelShiftTable, Int iHoleMargin, Bool bUseOrgRef, Int iBlendMode ) |
---|
119 | #endif |
---|
120 | |
---|
121 | { |
---|
122 | #if LGE_VSO_EARLY_SKIP_A0093 |
---|
123 | m_pbHorSkip = new Bool [MAX_CU_SIZE]; |
---|
124 | m_bEarlySkip = bEarlySkip; |
---|
125 | #endif |
---|
126 | |
---|
127 | AOF( iBlendMode == iBM ); |
---|
128 | |
---|
129 | m_iMode = iMode; |
---|
130 | |
---|
131 | m_iWidth = iWidth; |
---|
132 | m_iHeight = iHeight; |
---|
133 | m_iStride = iWidth; |
---|
134 | |
---|
135 | m_iSampledWidth = m_iWidth << iShiftPrec; |
---|
136 | m_iSampledStride = m_iStride << iShiftPrec; |
---|
137 | |
---|
138 | m_iShiftPrec = iShiftPrec; |
---|
139 | m_aaiSubPelShiftL = aaaiSubPelShiftTable[0]; |
---|
140 | m_aaiSubPelShiftR = aaaiSubPelShiftTable[1]; |
---|
141 | |
---|
142 | if (m_iMode == 2) |
---|
143 | { |
---|
144 | m_piInvZLUTLeft = new Int[257]; |
---|
145 | m_piInvZLUTRight = new Int[257]; |
---|
146 | } |
---|
147 | |
---|
148 | m_iGapTolerance = ( 2 << iShiftPrec ); |
---|
149 | m_iHoleMargin = iHoleMargin; |
---|
150 | |
---|
151 | m_bUseOrgRef = bUseOrgRef; |
---|
152 | |
---|
153 | m_aiRefVideoStrides[0] = m_iStride + (m_iPad << 1); |
---|
154 | m_aiRefVideoStrides[1] = m_iStride + (m_iPad << 1); |
---|
155 | m_aiRefVideoStrides[2] = m_iStride + (m_iPad << 1); |
---|
156 | |
---|
157 | m_aapiRefVideoPel [0] = new Pel[ m_aiRefVideoStrides[0] * (m_iHeight + (m_iPad << 1))]; |
---|
158 | m_aapiRefVideoPel [1] = new Pel[ m_aiRefVideoStrides[1] * (m_iHeight + (m_iPad << 1))]; |
---|
159 | m_aapiRefVideoPel [2] = new Pel[ m_aiRefVideoStrides[2] * (m_iHeight + (m_iPad << 1))]; |
---|
160 | |
---|
161 | m_aapiRefVideoPel [0] += m_aiRefVideoStrides[0] * m_iPad + m_iPad; |
---|
162 | m_aapiRefVideoPel [1] += m_aiRefVideoStrides[1] * m_iPad + m_iPad; |
---|
163 | m_aapiRefVideoPel [2] += m_aiRefVideoStrides[2] * m_iPad + m_iPad; |
---|
164 | |
---|
165 | m_iInputSamplesStride = m_iWidth+1; |
---|
166 | m_iOutputSamplesStride = m_iWidth; |
---|
167 | |
---|
168 | m_pcInputSamples[0] = new RenModelInPels[m_iInputSamplesStride*m_iHeight]; |
---|
169 | m_pcInputSamples[1] = new RenModelInPels[m_iInputSamplesStride*m_iHeight]; |
---|
170 | |
---|
171 | m_pcOutputSamples = new RenModelOutPels[m_iOutputSamplesStride*m_iHeight]; |
---|
172 | } |
---|
173 | |
---|
174 | template <BlenMod iBM, Bool bBitInc> Void |
---|
175 | TRenSingleModelC<iBM,bBitInc>::setLRView( Int iViewPos, Pel** apiCurVideoPel, Int* aiCurVideoStride, Pel* piCurDepthPel, Int iCurDepthStride ) |
---|
176 | { |
---|
177 | AOF(( iViewPos == 0) || (iViewPos == 1) ); |
---|
178 | |
---|
179 | RenModelInPels* pcCurInputSampleRow = m_pcInputSamples[iViewPos]; |
---|
180 | |
---|
181 | Pel* piDRow = piCurDepthPel; |
---|
182 | Pel* piYRow = apiCurVideoPel[0]; |
---|
183 | #if HHI_VSO_COLOR_PLANES |
---|
184 | Pel* piURow = apiCurVideoPel[1]; |
---|
185 | Pel* piVRow = apiCurVideoPel[2]; |
---|
186 | #endif |
---|
187 | |
---|
188 | |
---|
189 | Int iOffsetX = ( iViewPos == VIEWPOS_RIGHT ) ? 1 : 0; |
---|
190 | |
---|
191 | for ( Int iPosY = 0; iPosY < m_iUsedHeight; iPosY++ ) |
---|
192 | { |
---|
193 | if ( iViewPos == VIEWPOS_RIGHT ) |
---|
194 | { |
---|
195 | Int iSubPosX = (1 << m_iShiftPrec); |
---|
196 | pcCurInputSampleRow[0].aiY[iSubPosX] = piYRow[0]; |
---|
197 | #if HHI_VSO_COLOR_PLANES |
---|
198 | pcCurInputSampleRow[0].aiU[iSubPosX] = piURow[0]; |
---|
199 | pcCurInputSampleRow[0].aiV[iSubPosX] = piVRow[0]; |
---|
200 | #endif |
---|
201 | } |
---|
202 | |
---|
203 | for ( Int iPosX = 0; iPosX < m_iWidth; iPosX++ ) |
---|
204 | { |
---|
205 | pcCurInputSampleRow[iPosX].iD = piDRow[iPosX]; |
---|
206 | |
---|
207 | for (Int iSubPosX = 0; iSubPosX < (1 << m_iShiftPrec)+1; iSubPosX++ ) |
---|
208 | { |
---|
209 | Int iShift = (iPosX << m_iShiftPrec) + iSubPosX; |
---|
210 | pcCurInputSampleRow[iPosX+iOffsetX].aiY[iSubPosX] = piYRow[iShift]; |
---|
211 | #if HHI_VSO_COLOR_PLANES |
---|
212 | pcCurInputSampleRow[iPosX+iOffsetX].aiU[iSubPosX] = piURow[iShift]; |
---|
213 | pcCurInputSampleRow[iPosX+iOffsetX].aiV[iSubPosX] = piVRow[iShift]; |
---|
214 | #endif |
---|
215 | } |
---|
216 | } |
---|
217 | |
---|
218 | pcCurInputSampleRow += m_iInputSamplesStride; |
---|
219 | |
---|
220 | piDRow += iCurDepthStride; |
---|
221 | piYRow += aiCurVideoStride[0]; |
---|
222 | #if HHI_VSO_COLOR_PLANES |
---|
223 | piURow += aiCurVideoStride[1]; |
---|
224 | piVRow += aiCurVideoStride[2]; |
---|
225 | #endif |
---|
226 | } |
---|
227 | |
---|
228 | |
---|
229 | m_aapiBaseVideoPel [iViewPos] = apiCurVideoPel; |
---|
230 | m_aaiBaseVideoStrides [iViewPos] = aiCurVideoStride; |
---|
231 | m_apiBaseDepthPel [iViewPos] = piCurDepthPel; |
---|
232 | m_aiBaseDepthStrides [iViewPos] = iCurDepthStride; |
---|
233 | |
---|
234 | } |
---|
235 | template <BlenMod iBM, Bool bBitInc> Void |
---|
236 | TRenSingleModelC<iBM,bBitInc>::setupPart ( UInt uiHorOffset, Int iUsedHeight ) |
---|
237 | { |
---|
238 | AOT( iUsedHeight > m_iHeight ); |
---|
239 | |
---|
240 | m_iUsedHeight = iUsedHeight; |
---|
241 | m_iHorOffset = (Int) uiHorOffset; |
---|
242 | } |
---|
243 | |
---|
244 | template <BlenMod iBM, Bool bBitInc> Void |
---|
245 | TRenSingleModelC<iBM,bBitInc>::setup( TComPicYuv* pcOrgVideo, Int** ppiShiftLutLeft, Int** ppiBaseShiftLutLeft, Int** ppiShiftLutRight, Int** ppiBaseShiftLutRight, Int iDistToLeft, Bool bKeepReference ) |
---|
246 | { |
---|
247 | AOT( !m_bUseOrgRef && pcOrgVideo ); |
---|
248 | AOT( (ppiShiftLutLeft == NULL) && (m_iMode == 0 || m_iMode == 2) ); |
---|
249 | AOT( (ppiShiftLutRight == NULL) && (m_iMode == 1 || m_iMode == 2) ); |
---|
250 | |
---|
251 | m_appiShiftLut[0] = ppiShiftLutLeft; |
---|
252 | m_appiShiftLut[1] = ppiShiftLutRight; |
---|
253 | |
---|
254 | // Copy Reference |
---|
255 | m_pcPicYuvRef = pcOrgVideo; |
---|
256 | |
---|
257 | if ( pcOrgVideo && !bKeepReference ) |
---|
258 | { |
---|
259 | TRenFilter::copy( pcOrgVideo->getLumaAddr() + m_iHorOffset * pcOrgVideo->getStride() , pcOrgVideo->getStride() , m_iWidth, m_iUsedHeight, m_aapiRefVideoPel[0], m_aiRefVideoStrides[0]); |
---|
260 | TRenFilter::sampleCUpHorUp(0, pcOrgVideo->getCbAddr() + (m_iHorOffset >> 1) * pcOrgVideo->getCStride(), pcOrgVideo->getCStride(), m_iWidth >> 1, m_iUsedHeight >> 1, m_aapiRefVideoPel[1], m_aiRefVideoStrides[1]); |
---|
261 | TRenFilter::sampleCUpHorUp(0, pcOrgVideo->getCrAddr() + (m_iHorOffset >> 1) * pcOrgVideo->getCStride(), pcOrgVideo->getCStride(), m_iWidth >> 1, m_iUsedHeight >> 1, m_aapiRefVideoPel[2], m_aiRefVideoStrides[2]); |
---|
262 | xSetStructRefView(); |
---|
263 | } |
---|
264 | |
---|
265 | // Initial Rendering |
---|
266 | xResetStructError(); |
---|
267 | xInitSampleStructs(); |
---|
268 | switch ( m_iMode ) |
---|
269 | { |
---|
270 | case 0: |
---|
271 | #if LGE_VSO_EARLY_SKIP_A0093 |
---|
272 | xRenderL<true>( 0, 0, m_iWidth, m_iUsedHeight, m_aiBaseDepthStrides[0], m_apiBaseDepthPel[0],false ); |
---|
273 | #else |
---|
274 | xRenderL<true>( 0, 0, m_iWidth, m_iUsedHeight, m_aiBaseDepthStrides[0], m_apiBaseDepthPel[0] ); |
---|
275 | #endif |
---|
276 | break; |
---|
277 | case 1: |
---|
278 | #ifdef LGE_VSO_EARLY_SKIP_A0093 |
---|
279 | xRenderR<true>( 0, 0, m_iWidth, m_iUsedHeight, m_aiBaseDepthStrides[1], m_apiBaseDepthPel[1],false); |
---|
280 | #else |
---|
281 | xRenderR<true>( 0, 0, m_iWidth, m_iUsedHeight, m_aiBaseDepthStrides[1], m_apiBaseDepthPel[1] ); |
---|
282 | #endif |
---|
283 | break; |
---|
284 | case 2: |
---|
285 | TRenFilter::setupZLUT( true, 30, iDistToLeft, ppiBaseShiftLutLeft, ppiBaseShiftLutRight, m_iBlendZThres, m_iBlendDistWeight, m_piInvZLUTLeft, m_piInvZLUTRight ); |
---|
286 | #ifdef LGE_VSO_EARLY_SKIP_A0093 |
---|
287 | xRenderL<true>( 0, 0, m_iWidth, m_iUsedHeight, m_aiBaseDepthStrides[0], m_apiBaseDepthPel[0],false); |
---|
288 | xRenderR<true>( 0, 0, m_iWidth, m_iUsedHeight, m_aiBaseDepthStrides[1], m_apiBaseDepthPel[1],false); |
---|
289 | #else |
---|
290 | xRenderL<true>( 0, 0, m_iWidth, m_iUsedHeight, m_aiBaseDepthStrides[0], m_apiBaseDepthPel[0] ); |
---|
291 | xRenderR<true>( 0, 0, m_iWidth, m_iUsedHeight, m_aiBaseDepthStrides[1], m_apiBaseDepthPel[1] ); |
---|
292 | #endif |
---|
293 | break; |
---|
294 | default: |
---|
295 | AOT(true); |
---|
296 | } |
---|
297 | |
---|
298 | // Get Rendered View as Reference |
---|
299 | if ( !pcOrgVideo && !bKeepReference ) |
---|
300 | { |
---|
301 | xResetStructError(); |
---|
302 | xSetStructSynthViewAsRefView(); |
---|
303 | } |
---|
304 | } |
---|
305 | |
---|
306 | template <BlenMod iBM, Bool bBitInc> Void |
---|
307 | #if HHI_VSO_COLOR_PLANES |
---|
308 | TRenSingleModelC<iBM,bBitInc>::xGetSampleStrTextPtrs( Int iViewNum, Pel RenModelOutPels::*& rpiSrcY, Pel RenModelOutPels::*& rpiSrcU, Pel RenModelOutPels::*& rpiSrcV ) |
---|
309 | #else |
---|
310 | TRenSingleModelC<iBM,bBitInc>::xGetSampleStrTextPtrs( Int iViewNum, Pel RenModelOutPels::*& rpiSrcY ) |
---|
311 | #endif |
---|
312 | { |
---|
313 | switch ( iViewNum ) |
---|
314 | { |
---|
315 | case 0: |
---|
316 | rpiSrcY = &RenModelOutPels::iYLeft; |
---|
317 | #if HHI_VSO_COLOR_PLANES |
---|
318 | rpiSrcU = &RenModelOutPels::iULeft; |
---|
319 | rpiSrcV = &RenModelOutPels::iVLeft; |
---|
320 | #endif |
---|
321 | break; |
---|
322 | case 1: |
---|
323 | rpiSrcY = &RenModelOutPels::iYRight; |
---|
324 | #if HHI_VSO_COLOR_PLANES |
---|
325 | rpiSrcU = &RenModelOutPels::iURight; |
---|
326 | rpiSrcV = &RenModelOutPels::iVRight; |
---|
327 | #endif |
---|
328 | break; |
---|
329 | case 2: |
---|
330 | rpiSrcY = &RenModelOutPels::iYBlended; |
---|
331 | #if HHI_VSO_COLOR_PLANES |
---|
332 | rpiSrcU = &RenModelOutPels::iUBlended; |
---|
333 | rpiSrcV = &RenModelOutPels::iVBlended; |
---|
334 | #endif |
---|
335 | break; |
---|
336 | } |
---|
337 | } |
---|
338 | |
---|
339 | |
---|
340 | template <BlenMod iBM, Bool bBitInc> Void |
---|
341 | TRenSingleModelC<iBM,bBitInc>::xGetSampleStrDepthPtrs( Int iViewNum, Pel RenModelOutPels::*& rpiSrcD ) |
---|
342 | { |
---|
343 | AOT(iViewNum != 0 && iViewNum != 1); |
---|
344 | rpiSrcD = (iViewNum == 1) ? &RenModelOutPels::iDRight : &RenModelOutPels::iDLeft; |
---|
345 | } |
---|
346 | |
---|
347 | |
---|
348 | template <BlenMod iBM, Bool bBitInc> Void |
---|
349 | TRenSingleModelC<iBM,bBitInc>::xSetStructRefView( ) |
---|
350 | { |
---|
351 | RenModelOutPels* pcCurOutSampleRow = m_pcOutputSamples; |
---|
352 | |
---|
353 | Pel* piYRow = m_aapiRefVideoPel[0]; |
---|
354 | #if HHI_VSO_COLOR_PLANES |
---|
355 | Pel* piURow = m_aapiRefVideoPel[1]; |
---|
356 | Pel* piVRow = m_aapiRefVideoPel[2]; |
---|
357 | #endif |
---|
358 | |
---|
359 | for ( Int iPosY = 0; iPosY < m_iUsedHeight; iPosY++ ) |
---|
360 | { |
---|
361 | for ( Int iPosX = 0; iPosX < m_iWidth; iPosX++ ) |
---|
362 | { |
---|
363 | pcCurOutSampleRow[iPosX].iYRef = piYRow[iPosX]; |
---|
364 | #if HHI_VSO_COLOR_PLANES |
---|
365 | pcCurOutSampleRow[iPosX].iURef = piURow[iPosX]; |
---|
366 | pcCurOutSampleRow[iPosX].iVRef = piVRow[iPosX]; |
---|
367 | #endif |
---|
368 | } |
---|
369 | |
---|
370 | pcCurOutSampleRow += m_iOutputSamplesStride; |
---|
371 | |
---|
372 | piYRow += m_aiRefVideoStrides[0]; |
---|
373 | #if HHI_VSO_COLOR_PLANES |
---|
374 | piURow += m_aiRefVideoStrides[1]; |
---|
375 | piVRow += m_aiRefVideoStrides[2]; |
---|
376 | #endif |
---|
377 | } |
---|
378 | } |
---|
379 | |
---|
380 | template <BlenMod iBM, Bool bBitInc> Void |
---|
381 | TRenSingleModelC<iBM,bBitInc>::xResetStructError( ) |
---|
382 | { |
---|
383 | RenModelOutPels* pcCurOutSampleRow = m_pcOutputSamples; |
---|
384 | |
---|
385 | for ( Int iPosY = 0; iPosY < m_iHeight; iPosY++ ) |
---|
386 | { |
---|
387 | for ( Int iPosX = 0; iPosX < m_iWidth; iPosX++ ) |
---|
388 | { |
---|
389 | pcCurOutSampleRow[iPosX].iError = 0; |
---|
390 | } |
---|
391 | pcCurOutSampleRow += m_iOutputSamplesStride; |
---|
392 | } |
---|
393 | } |
---|
394 | |
---|
395 | template <BlenMod iBM, Bool bBitInc> Void |
---|
396 | TRenSingleModelC<iBM,bBitInc>::xSetStructSynthViewAsRefView( ) |
---|
397 | { |
---|
398 | AOT( m_iMode < 0 || m_iMode > 2); |
---|
399 | |
---|
400 | RenModelOutPels* pcCurOutSampleRow = m_pcOutputSamples; |
---|
401 | |
---|
402 | Pel RenModelOutPels::* piSrcY = NULL; |
---|
403 | |
---|
404 | #if HHI_VSO_COLOR_PLANES |
---|
405 | Pel RenModelOutPels::* piSrcU = NULL; |
---|
406 | Pel RenModelOutPels::* piSrcV = NULL; |
---|
407 | xGetSampleStrTextPtrs( m_iMode, piSrcY, piSrcU, piSrcV ); |
---|
408 | #else |
---|
409 | xGetSampleStrTextPtrs( m_iMode, piSrcY ); |
---|
410 | #endif |
---|
411 | |
---|
412 | for ( Int iPosY = 0; iPosY < m_iUsedHeight; iPosY++ ) |
---|
413 | { |
---|
414 | for ( Int iPosX = 0; iPosX < m_iWidth; iPosX++ ) |
---|
415 | { |
---|
416 | pcCurOutSampleRow[iPosX].iYRef = pcCurOutSampleRow[iPosX].*piSrcY; |
---|
417 | #if HHI_VSO_COLOR_PLANES |
---|
418 | pcCurOutSampleRow[iPosX].iURef = pcCurOutSampleRow[iPosX].*piSrcU; |
---|
419 | pcCurOutSampleRow[iPosX].iVRef = pcCurOutSampleRow[iPosX].*piSrcV; |
---|
420 | #endif |
---|
421 | } |
---|
422 | pcCurOutSampleRow += m_iOutputSamplesStride; |
---|
423 | } |
---|
424 | } |
---|
425 | |
---|
426 | template <BlenMod iBM, Bool bBitInc> Void |
---|
427 | TRenSingleModelC<iBM,bBitInc>::xInitSampleStructs() |
---|
428 | { |
---|
429 | RenModelOutPels* pcOutSampleRow = m_pcOutputSamples; |
---|
430 | RenModelInPels * pcLeftInSampleRow = m_pcInputSamples[0]; |
---|
431 | RenModelInPels * pcRightInSampleRow = m_pcInputSamples[1]; |
---|
432 | |
---|
433 | |
---|
434 | for (Int iPosY = 0; iPosY < m_iHeight; iPosY++) |
---|
435 | { |
---|
436 | for (Int iPosX = 0; iPosX < m_iWidth; iPosX++) |
---|
437 | { |
---|
438 | //// Output Samples |
---|
439 | pcOutSampleRow[iPosX].iFilledLeft = REN_IS_HOLE; |
---|
440 | pcOutSampleRow[iPosX].iFilledRight = REN_IS_HOLE; |
---|
441 | |
---|
442 | pcOutSampleRow[iPosX].iDLeft = 0; |
---|
443 | pcOutSampleRow[iPosX].iDRight = 0; |
---|
444 | pcOutSampleRow[iPosX].iDBlended = 0; |
---|
445 | |
---|
446 | // Y Planes |
---|
447 | pcOutSampleRow[iPosX].iYLeft = 0; |
---|
448 | pcOutSampleRow[iPosX].iYRight = 0; |
---|
449 | pcOutSampleRow[iPosX].iYBlended = 0; |
---|
450 | #if HHI_VSO_COLOR_PLANES |
---|
451 | // U Planes |
---|
452 | pcOutSampleRow[iPosX].iULeft = 128 << g_uiBitIncrement; |
---|
453 | pcOutSampleRow[iPosX].iURight = 128 << g_uiBitIncrement; |
---|
454 | pcOutSampleRow[iPosX].iUBlended = 128 << g_uiBitIncrement; |
---|
455 | |
---|
456 | // V Planes |
---|
457 | pcOutSampleRow[iPosX].iVLeft = 128 << g_uiBitIncrement; |
---|
458 | pcOutSampleRow[iPosX].iVRight = 128 << g_uiBitIncrement; |
---|
459 | pcOutSampleRow[iPosX].iVBlended = 128 << g_uiBitIncrement; |
---|
460 | #endif |
---|
461 | //// Input Samples |
---|
462 | pcLeftInSampleRow [iPosX].bOccluded = false; |
---|
463 | pcRightInSampleRow[iPosX].bOccluded = false; |
---|
464 | } |
---|
465 | |
---|
466 | pcOutSampleRow += m_iOutputSamplesStride; |
---|
467 | pcLeftInSampleRow += m_iInputSamplesStride; |
---|
468 | pcRightInSampleRow += m_iInputSamplesStride; |
---|
469 | } |
---|
470 | } |
---|
471 | |
---|
472 | |
---|
473 | #ifdef LGE_VSO_EARLY_SKIP_A0093 |
---|
474 | template <BlenMod iBM, Bool bBitInc> RMDist |
---|
475 | TRenSingleModelC<iBM,bBitInc>::getDistDepth( Int iViewPos, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData , Pel * piOrgData, Int iOrgStride ) |
---|
476 | #else |
---|
477 | template <BlenMod iBM, Bool bBitInc> RMDist |
---|
478 | TRenSingleModelC<iBM,bBitInc>::getDistDepth( Int iViewPos, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData ) |
---|
479 | #endif |
---|
480 | { |
---|
481 | RMDist iSSE = 0; |
---|
482 | #ifdef LGE_VSO_EARLY_SKIP_A0093 |
---|
483 | Bool bEarlySkip; |
---|
484 | #endif |
---|
485 | switch ( iViewPos ) |
---|
486 | { |
---|
487 | case 0: |
---|
488 | #ifdef LGE_VSO_EARLY_SKIP_A0093 |
---|
489 | bEarlySkip = m_bEarlySkip ? xDetectEarlySkipL(iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData, piOrgData, iOrgStride) : false; |
---|
490 | if( !bEarlySkip ) |
---|
491 | { |
---|
492 | iSSE = xRenderL<false>( iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData,true ); |
---|
493 | } |
---|
494 | #else |
---|
495 | iSSE = xRenderL<false>( iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData ); |
---|
496 | #endif |
---|
497 | break; |
---|
498 | case 1: |
---|
499 | #ifdef LGE_VSO_EARLY_SKIP_A0093 |
---|
500 | bEarlySkip = m_bEarlySkip ? xDetectEarlySkipR(iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData, piOrgData, iOrgStride) : false; |
---|
501 | if( !bEarlySkip ) |
---|
502 | { |
---|
503 | iSSE = xRenderR<false>( iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData,true ); |
---|
504 | } |
---|
505 | #else |
---|
506 | iSSE = xRenderR<false>( iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData ); |
---|
507 | #endif |
---|
508 | break; |
---|
509 | default: |
---|
510 | assert(0); |
---|
511 | } |
---|
512 | |
---|
513 | return iSSE; |
---|
514 | } |
---|
515 | #ifdef LGE_VSO_EARLY_SKIP_A0093 |
---|
516 | template <BlenMod iBM, Bool bBitInc> Void |
---|
517 | TRenSingleModelC<iBM,bBitInc>::setDepth( Int iViewPos, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Pel* piOrgData, Int iOrgStride ) |
---|
518 | #else |
---|
519 | template <BlenMod iBM, Bool bBitInc> Void |
---|
520 | TRenSingleModelC<iBM,bBitInc>::setDepth( Int iViewPos, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData ) |
---|
521 | #endif |
---|
522 | { |
---|
523 | #ifdef LGE_VSO_EARLY_SKIP_A0093 |
---|
524 | Bool bEarlySkip; |
---|
525 | #endif |
---|
526 | switch ( iViewPos ) |
---|
527 | { |
---|
528 | case 0: |
---|
529 | #ifdef LGE_VSO_EARLY_SKIP_A0093 |
---|
530 | bEarlySkip = m_bEarlySkip ? xDetectEarlySkipL(iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData, piOrgData,iOrgStride) : false; |
---|
531 | if( !bEarlySkip ) |
---|
532 | { |
---|
533 | xRenderL<true>( iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData,true ); |
---|
534 | } |
---|
535 | #else |
---|
536 | xRenderL<true>( iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData ); |
---|
537 | #endif |
---|
538 | break; |
---|
539 | case 1: |
---|
540 | #ifdef LGE_VSO_EARLY_SKIP_A0093 |
---|
541 | bEarlySkip = m_bEarlySkip ? xDetectEarlySkipR(iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData, piOrgData,iOrgStride) : false; |
---|
542 | if( !bEarlySkip ) |
---|
543 | { |
---|
544 | xRenderR<true>( iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData,true ); |
---|
545 | } |
---|
546 | #else |
---|
547 | xRenderR<true>( iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData ); |
---|
548 | #endif |
---|
549 | break; |
---|
550 | default: |
---|
551 | assert(0); |
---|
552 | } |
---|
553 | } |
---|
554 | |
---|
555 | template <BlenMod iBM, Bool bBitInc> Void |
---|
556 | TRenSingleModelC<iBM,bBitInc>::getSynthVideo( Int iViewPos, TComPicYuv* pcPicYuv ) |
---|
557 | { |
---|
558 | AOT( pcPicYuv->getWidth() != m_iWidth ); |
---|
559 | AOT( pcPicYuv->getHeight() < m_iUsedHeight + m_iHorOffset ); |
---|
560 | |
---|
561 | #if HHI_VSO_COLOR_PLANES |
---|
562 | Pel RenModelOutPels::* piText[3] = { NULL, NULL, NULL }; |
---|
563 | xGetSampleStrTextPtrs(iViewPos, piText[0], piText[1], piText[2]); |
---|
564 | |
---|
565 | // Temp image for chroma down sampling |
---|
566 | PelImage cTempImage( m_iWidth, m_iUsedHeight, 3, 0); |
---|
567 | |
---|
568 | Int aiStrides[3]; |
---|
569 | Pel* apiData [3]; |
---|
570 | |
---|
571 | cTempImage.getDataAndStrides( apiData, aiStrides ); |
---|
572 | |
---|
573 | for (UInt uiCurPlane = 0; uiCurPlane < 3; uiCurPlane++ ) |
---|
574 | { |
---|
575 | xCopyFromSampleStruct( m_pcOutputSamples, m_iOutputSamplesStride, piText[uiCurPlane], apiData[uiCurPlane], aiStrides[uiCurPlane] , m_iWidth, m_iUsedHeight); |
---|
576 | } |
---|
577 | xCopy2PicYuv( apiData, aiStrides, pcPicYuv ); |
---|
578 | #else |
---|
579 | Pel RenModelOutPels::* piY; |
---|
580 | xGetSampleStrTextPtrs(iViewPos, piY); |
---|
581 | xCopyFromSampleStruct( m_pcOutputSamples, m_iOutputSamplesStride, piY, pcPicYuv->getLumaAddr() + m_iHorOffset * pcPicYuv->getStride(), pcPicYuv->getStride(), m_iWidth, m_iUsedHeight ); |
---|
582 | pcPicYuv->setChromaTo( 128 << g_uiBitIncrement ); |
---|
583 | #endif |
---|
584 | } |
---|
585 | |
---|
586 | template <BlenMod iBM, Bool bBitInc> Void |
---|
587 | TRenSingleModelC<iBM,bBitInc>::getSynthDepth( Int iViewPos, TComPicYuv* pcPicYuv ) |
---|
588 | { |
---|
589 | AOT( iViewPos != 0 && iViewPos != 1); |
---|
590 | AOT( pcPicYuv->getWidth() != m_iWidth ); |
---|
591 | AOT( pcPicYuv->getHeight() < m_iUsedHeight + m_iHorOffset ); |
---|
592 | |
---|
593 | Pel RenModelOutPels::* piD = 0; |
---|
594 | xGetSampleStrDepthPtrs(iViewPos, piD); |
---|
595 | xCopyFromSampleStruct( m_pcOutputSamples, m_iOutputSamplesStride, piD, pcPicYuv->getLumaAddr() + pcPicYuv->getStride() * m_iHorOffset, pcPicYuv->getStride(), m_iWidth, m_iUsedHeight ); |
---|
596 | pcPicYuv->setChromaTo( 128 << g_uiBitIncrement ); |
---|
597 | } |
---|
598 | |
---|
599 | |
---|
600 | template <BlenMod iBM, Bool bBitInc> Void |
---|
601 | TRenSingleModelC<iBM,bBitInc>::getRefVideo ( Int iViewPos, TComPicYuv* pcPicYuv ) |
---|
602 | { |
---|
603 | AOT( pcPicYuv->getWidth() != m_iWidth ); |
---|
604 | AOT( pcPicYuv->getHeight() < m_iUsedHeight + m_iHorOffset); |
---|
605 | |
---|
606 | #if HHI_VSO_COLOR_PLANES |
---|
607 | Pel RenModelOutPels::* piText[3]; |
---|
608 | piText[0] = &RenModelOutPels::iYRef; |
---|
609 | piText[1] = &RenModelOutPels::iURef; |
---|
610 | piText[2] = &RenModelOutPels::iVRef; |
---|
611 | |
---|
612 | // Temp image for chroma down sampling |
---|
613 | |
---|
614 | PelImage cTempImage( m_iWidth, m_iUsedHeight, 3, 0); |
---|
615 | Int aiStrides[3]; |
---|
616 | Pel* apiData [3]; |
---|
617 | |
---|
618 | cTempImage.getDataAndStrides( apiData, aiStrides ); |
---|
619 | |
---|
620 | for (UInt uiCurPlane = 0; uiCurPlane < 3; uiCurPlane++ ) |
---|
621 | { |
---|
622 | xCopyFromSampleStruct( m_pcOutputSamples, m_iOutputSamplesStride, piText[uiCurPlane], apiData[uiCurPlane], aiStrides[uiCurPlane] , m_iWidth, m_iUsedHeight); |
---|
623 | } |
---|
624 | |
---|
625 | xCopy2PicYuv( apiData, aiStrides, pcPicYuv ); |
---|
626 | #else |
---|
627 | xCopyFromSampleStruct( m_pcOutputSamples, m_iOutputSamplesStride, &RenModelOutPels::iYRef, pcPicYuv->getLumaAddr() * pcPicYuv->getStride() + m_iHorOffset, pcPicYuv->getStride(), m_iWidth, m_iUsedHeight ); |
---|
628 | pcPicYuv->setChromaTo( 128 << g_uiBitIncrement ); |
---|
629 | #endif |
---|
630 | } |
---|
631 | |
---|
632 | template <BlenMod iBM, Bool bBitInc> RMDist |
---|
633 | TRenSingleModelC<iBM,bBitInc>::getDistVideo( Int iViewPos, Int iPlane, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData ) |
---|
634 | { |
---|
635 | AOF(false); |
---|
636 | return 0; |
---|
637 | } |
---|
638 | |
---|
639 | template <BlenMod iBM, Bool bBitInc> Void |
---|
640 | TRenSingleModelC<iBM,bBitInc>::setVideo( Int iViewPos, Int iPlane, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData ) |
---|
641 | { |
---|
642 | AOF(false); |
---|
643 | } |
---|
644 | |
---|
645 | |
---|
646 | |
---|
647 | template <BlenMod iBM, Bool bBitInc> __inline Void |
---|
648 | TRenSingleModelC<iBM,bBitInc>::xSetViewRow( Int iPosY ) |
---|
649 | { |
---|
650 | m_pcInputSamplesRow[0] = m_pcInputSamples[0] + m_iInputSamplesStride * iPosY; |
---|
651 | m_pcInputSamplesRow[1] = m_pcInputSamples[1] + m_iInputSamplesStride * iPosY; |
---|
652 | m_pcOutputSamplesRow = m_pcOutputSamples + m_iOutputSamplesStride * iPosY; |
---|
653 | |
---|
654 | } |
---|
655 | |
---|
656 | template <BlenMod iBM, Bool bBitInc> __inline Void |
---|
657 | TRenSingleModelC<iBM,bBitInc>::xIncViewRow( ) |
---|
658 | { |
---|
659 | m_pcInputSamplesRow[0] += m_iInputSamplesStride ; |
---|
660 | m_pcInputSamplesRow[1] += m_iInputSamplesStride ; |
---|
661 | m_pcOutputSamplesRow += m_iOutputSamplesStride; |
---|
662 | } |
---|
663 | #if LGE_VSO_EARLY_SKIP_A0093 |
---|
664 | template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline RMDist |
---|
665 | TRenSingleModelC<iBM,bBitInc>::xRenderL( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Bool bFast) |
---|
666 | #else |
---|
667 | template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline RMDist |
---|
668 | TRenSingleModelC<iBM,bBitInc>::xRenderL( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData) |
---|
669 | #endif |
---|
670 | { |
---|
671 | const Int iCurViewPos = 0; |
---|
672 | const Int iOtherViewPos = 1; |
---|
673 | |
---|
674 | m_iCurViewPos = iCurViewPos ; |
---|
675 | m_iOtherViewPos = iOtherViewPos; |
---|
676 | |
---|
677 | m_piNewDepthData = piNewData; |
---|
678 | m_iNewDataWidth = iWidth; |
---|
679 | m_iStartChangePosX = iStartPosX; |
---|
680 | |
---|
681 | if ((iWidth == 0) || (iHeight == 0)) |
---|
682 | return 0; |
---|
683 | |
---|
684 | // Get Data |
---|
685 | m_ppiCurLUT = m_appiShiftLut [iCurViewPos]; |
---|
686 | xSetViewRow ( iStartPosY); |
---|
687 | |
---|
688 | // Init Start |
---|
689 | RMDist iError = 0; |
---|
690 | Int iStartChangePos; |
---|
691 | |
---|
692 | iStartChangePos = m_iStartChangePosX; |
---|
693 | |
---|
694 | for (Int iPosY = iStartPosY; iPosY < iStartPosY + iHeight; iPosY++ ) |
---|
695 | { |
---|
696 | #ifdef LGE_VSO_EARLY_SKIP_A0093 |
---|
697 | if( m_bEarlySkip && bFast ) |
---|
698 | { |
---|
699 | if ( m_pbHorSkip[iPosY-iStartPosY] ) |
---|
700 | { |
---|
701 | xIncViewRow(); |
---|
702 | m_piNewDepthData += iStride; |
---|
703 | continue; |
---|
704 | } |
---|
705 | } |
---|
706 | #endif |
---|
707 | m_bInOcclusion = false; |
---|
708 | |
---|
709 | Int iLastSPos; |
---|
710 | Int iEndChangePos = m_iStartChangePosX + iWidth - 1; |
---|
711 | Int iPosXinNewData = iWidth - 1; |
---|
712 | Int iMinChangedSPos = m_iSampledWidth; |
---|
713 | |
---|
714 | if ( iEndChangePos == ( m_iWidth -1 )) // Special processing for rightmost depth sample |
---|
715 | { |
---|
716 | m_iCurDepth = m_piNewDepthData[iPosXinNewData]; |
---|
717 | Int iCurSPos = xShiftNewData(iEndChangePos, iPosXinNewData); |
---|
718 | m_iLastOccludedSPos = iCurSPos + 1; |
---|
719 | m_iLastOccludedSPosFP = xRangeLeftL( m_iLastOccludedSPos ); |
---|
720 | xExtrapolateMarginL<bSet> ( iCurSPos, iEndChangePos, iError ); |
---|
721 | |
---|
722 | iMinChangedSPos = Min( iMinChangedSPos, (iEndChangePos << m_iShiftPrec) - m_ppiCurLUT[0][ RenModRemoveBitInc( Max(m_pcInputSamplesRow[iCurViewPos][iEndChangePos].iD, m_piNewDepthData[iPosXinNewData] )) ]); |
---|
723 | iLastSPos = iCurSPos; |
---|
724 | m_iLastDepth = m_iCurDepth; |
---|
725 | |
---|
726 | if ( bSet ) |
---|
727 | { |
---|
728 | m_pcInputSamplesRow[iCurViewPos][iEndChangePos].iD = m_piNewDepthData[iPosXinNewData]; |
---|
729 | } |
---|
730 | |
---|
731 | iPosXinNewData--; |
---|
732 | iEndChangePos--; |
---|
733 | } |
---|
734 | else |
---|
735 | { |
---|
736 | iLastSPos = xShift(iEndChangePos+1); |
---|
737 | m_iLastDepth = m_pcInputSamplesRow [iCurViewPos][iEndChangePos+1].iD; |
---|
738 | xInitRenderPartL( iEndChangePos, iLastSPos ); |
---|
739 | } |
---|
740 | |
---|
741 | //// RENDER NEW DATA |
---|
742 | Int iCurPosX; |
---|
743 | for ( iCurPosX = iEndChangePos; iCurPosX >= iStartChangePos; iCurPosX-- ) |
---|
744 | { |
---|
745 | // Get minimal changed sample position |
---|
746 | |
---|
747 | iMinChangedSPos = Min( iMinChangedSPos, (iCurPosX << m_iShiftPrec) - m_ppiCurLUT[0][ RenModRemoveBitInc( Max(m_pcInputSamplesRow[iCurViewPos][iCurPosX].iD, m_piNewDepthData[iPosXinNewData] )) ]); |
---|
748 | Int iCurSPos = xShiftNewData(iCurPosX,iPosXinNewData); |
---|
749 | m_iCurDepth = m_piNewDepthData[iPosXinNewData]; |
---|
750 | xRenderRangeL<bSet>(iCurSPos, iLastSPos, iCurPosX, iError ); |
---|
751 | iLastSPos = iCurSPos; |
---|
752 | m_iLastDepth = m_iCurDepth; |
---|
753 | |
---|
754 | if ( bSet ) |
---|
755 | { |
---|
756 | m_pcInputSamplesRow[iCurViewPos][iCurPosX].iD = m_piNewDepthData[iPosXinNewData]; |
---|
757 | } |
---|
758 | |
---|
759 | iPosXinNewData--; |
---|
760 | } |
---|
761 | |
---|
762 | //// RE-RENDER DATA LEFT TO NEW DATA |
---|
763 | while ( iCurPosX >= 0 ) |
---|
764 | { |
---|
765 | Int iCurSPos = xShift(iCurPosX); |
---|
766 | |
---|
767 | m_iCurDepth = m_pcInputSamplesRow[iCurViewPos][iCurPosX].iD; |
---|
768 | xRenderRangeL<bSet>( iCurSPos, iLastSPos, iCurPosX, iError ); |
---|
769 | |
---|
770 | if ( iCurSPos < iMinChangedSPos ) |
---|
771 | { |
---|
772 | break; |
---|
773 | } |
---|
774 | |
---|
775 | iCurPosX--; |
---|
776 | iLastSPos = iCurSPos; |
---|
777 | m_iLastDepth = m_iCurDepth; |
---|
778 | } |
---|
779 | |
---|
780 | |
---|
781 | xIncViewRow(); |
---|
782 | m_piNewDepthData += iStride; |
---|
783 | } |
---|
784 | return iError; |
---|
785 | } |
---|
786 | |
---|
787 | #ifdef LGE_VSO_EARLY_SKIP_A0093 |
---|
788 | template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline RMDist |
---|
789 | TRenSingleModelC<iBM,bBitInc>::xRenderR( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData , Bool bFast) |
---|
790 | #else |
---|
791 | template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline RMDist |
---|
792 | TRenSingleModelC<iBM,bBitInc>::xRenderR( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData ) |
---|
793 | #endif |
---|
794 | { |
---|
795 | |
---|
796 | const Int iCurViewPos = 1; |
---|
797 | const Int iOtherViewPos = 0; |
---|
798 | |
---|
799 | m_iCurViewPos = iCurViewPos; |
---|
800 | m_iOtherViewPos = iOtherViewPos; |
---|
801 | |
---|
802 | m_piNewDepthData = piNewData; |
---|
803 | m_iNewDataWidth = iWidth; |
---|
804 | m_iStartChangePosX = iStartPosX; |
---|
805 | |
---|
806 | if ((iWidth == 0) || (iHeight == 0)) |
---|
807 | return 0; |
---|
808 | |
---|
809 | // Get Data |
---|
810 | m_ppiCurLUT = m_appiShiftLut [iCurViewPos]; |
---|
811 | xSetViewRow ( iStartPosY); |
---|
812 | |
---|
813 | // Init Start |
---|
814 | RMDist iError = 0; |
---|
815 | Int iEndChangePos; |
---|
816 | |
---|
817 | iEndChangePos = m_iStartChangePosX + iWidth - 1; |
---|
818 | |
---|
819 | for (Int iPosY = iStartPosY; iPosY < iStartPosY + iHeight; iPosY++ ) |
---|
820 | { |
---|
821 | #ifdef LGE_VSO_EARLY_SKIP_A0093 |
---|
822 | if( m_bEarlySkip && bFast ) |
---|
823 | { |
---|
824 | if ( m_pbHorSkip[iPosY-iStartPosY] ) |
---|
825 | { |
---|
826 | xIncViewRow(); |
---|
827 | m_piNewDepthData += iStride; |
---|
828 | continue; |
---|
829 | } |
---|
830 | } |
---|
831 | #endif |
---|
832 | m_bInOcclusion = false; |
---|
833 | |
---|
834 | Int iLastSPos; |
---|
835 | Int iStartChangePos = m_iStartChangePosX; |
---|
836 | Int iPosXinNewData = 0; |
---|
837 | Int iMaxChangedSPos = -1; |
---|
838 | |
---|
839 | if ( iStartChangePos == 0 ) // Special processing for leftmost depth sample |
---|
840 | { |
---|
841 | m_iCurDepth = m_piNewDepthData[iPosXinNewData]; |
---|
842 | Int iCurSPos = xShiftNewData(iStartChangePos, iPosXinNewData); |
---|
843 | m_iLastOccludedSPos = iCurSPos - 1; |
---|
844 | m_iLastOccludedSPosFP = xRangeRightR( m_iLastOccludedSPos ); |
---|
845 | xExtrapolateMarginR<bSet> ( iCurSPos, iStartChangePos, iError ); |
---|
846 | |
---|
847 | iMaxChangedSPos = Max( iMaxChangedSPos, (iStartChangePos << m_iShiftPrec) - m_ppiCurLUT[0][ RenModRemoveBitInc( Max(m_pcInputSamplesRow[iCurViewPos][iStartChangePos].iD, m_piNewDepthData[iPosXinNewData] )) ]); |
---|
848 | iLastSPos = iCurSPos; |
---|
849 | m_iLastDepth = m_iCurDepth; |
---|
850 | if ( bSet ) |
---|
851 | { |
---|
852 | m_pcInputSamplesRow[iCurViewPos][iStartChangePos].iD = m_piNewDepthData[iPosXinNewData]; |
---|
853 | } |
---|
854 | |
---|
855 | |
---|
856 | iPosXinNewData++; |
---|
857 | iStartChangePos++; |
---|
858 | } |
---|
859 | else |
---|
860 | { |
---|
861 | iLastSPos = xShift(iStartChangePos-1); |
---|
862 | |
---|
863 | m_iLastDepth = m_pcInputSamplesRow[iCurViewPos][iStartChangePos-1].iD; |
---|
864 | xInitRenderPartR( iStartChangePos, iLastSPos ); |
---|
865 | } |
---|
866 | |
---|
867 | //// RENDER NEW DATA |
---|
868 | Int iCurPosX; |
---|
869 | for ( iCurPosX = iStartChangePos; iCurPosX <= iEndChangePos; iCurPosX++ ) |
---|
870 | { |
---|
871 | // Get minimal changed sample position |
---|
872 | |
---|
873 | iMaxChangedSPos = Max( iMaxChangedSPos, (iCurPosX << m_iShiftPrec) - m_ppiCurLUT[0][ RenModRemoveBitInc( Max(m_pcInputSamplesRow[iCurViewPos][iCurPosX].iD, m_piNewDepthData[iPosXinNewData] )) ]); |
---|
874 | Int iCurSPos = xShiftNewData(iCurPosX,iPosXinNewData); |
---|
875 | m_iCurDepth = m_piNewDepthData[iPosXinNewData]; |
---|
876 | xRenderRangeR<bSet>(iCurSPos, iLastSPos, iCurPosX, iError ); |
---|
877 | iLastSPos = iCurSPos; |
---|
878 | m_iLastDepth = m_iCurDepth; |
---|
879 | |
---|
880 | if ( bSet ) |
---|
881 | { |
---|
882 | m_pcInputSamplesRow[iCurViewPos][iCurPosX].iD = m_piNewDepthData[iPosXinNewData]; |
---|
883 | } |
---|
884 | |
---|
885 | iPosXinNewData++; |
---|
886 | } |
---|
887 | |
---|
888 | //// RE-RENDER DATA LEFT TO NEW DATA |
---|
889 | while ( iCurPosX < m_iWidth ) |
---|
890 | { |
---|
891 | Int iCurSPos = xShift(iCurPosX); |
---|
892 | |
---|
893 | m_iCurDepth = m_pcInputSamplesRow[iCurViewPos][iCurPosX].iD; |
---|
894 | xRenderRangeR<bSet>( iCurSPos, iLastSPos, iCurPosX, iError ); |
---|
895 | |
---|
896 | if ( iCurSPos > iMaxChangedSPos ) |
---|
897 | { |
---|
898 | break; |
---|
899 | } |
---|
900 | iCurPosX++; |
---|
901 | iLastSPos = iCurSPos; |
---|
902 | m_iLastDepth = m_iCurDepth; |
---|
903 | } |
---|
904 | |
---|
905 | xIncViewRow(); |
---|
906 | m_piNewDepthData += iStride; |
---|
907 | } |
---|
908 | return iError; |
---|
909 | } |
---|
910 | |
---|
911 | |
---|
912 | template <BlenMod iBM, Bool bBitInc> __inline Void |
---|
913 | TRenSingleModelC<iBM,bBitInc>::xInitRenderPartL( Int iEndChangePos, Int iLastSPos ) |
---|
914 | { |
---|
915 | const Int iCurViewPos = 0; |
---|
916 | // GET MINIMAL OCCLUDED SAMPLE POSITION |
---|
917 | Int iCurPosX = iEndChangePos; |
---|
918 | |
---|
919 | |
---|
920 | if ( ( iCurPosX + 1 < m_iWidth ) && (m_pcInputSamplesRow[iCurViewPos][ iCurPosX + 1].bOccluded ) ) |
---|
921 | { |
---|
922 | iCurPosX++; |
---|
923 | |
---|
924 | while ( (iCurPosX + 1 < m_iWidth) && (m_pcInputSamplesRow[iCurViewPos][ iCurPosX + 1].bOccluded ) ) |
---|
925 | |
---|
926 | iCurPosX++; |
---|
927 | |
---|
928 | if ( iCurPosX + 1 < m_iWidth ) |
---|
929 | { |
---|
930 | iCurPosX++; |
---|
931 | m_iLastOccludedSPos = xShift(iCurPosX); |
---|
932 | } |
---|
933 | else |
---|
934 | { |
---|
935 | m_iLastOccludedSPos = xShift(iCurPosX) + 1; |
---|
936 | } |
---|
937 | |
---|
938 | m_iLastOccludedSPosFP = xRoundL( m_iLastOccludedSPos ); |
---|
939 | } |
---|
940 | else |
---|
941 | { |
---|
942 | m_iLastOccludedSPos = iLastSPos+1; |
---|
943 | m_iLastOccludedSPosFP = xRangeLeftL( m_iLastOccludedSPos ); |
---|
944 | } |
---|
945 | |
---|
946 | m_bInOcclusion = iLastSPos >= m_iLastOccludedSPos; |
---|
947 | }; |
---|
948 | |
---|
949 | template <BlenMod iBM, Bool bBitInc> __inline Void |
---|
950 | TRenSingleModelC<iBM,bBitInc>::xInitRenderPartR( Int iStartChangePos, Int iLastSPos ) |
---|
951 | { |
---|
952 | const Int iCurViewPos = 1; |
---|
953 | // GET MINIMAL OCCLUDED SAMPLE POSITION |
---|
954 | Int iCurPosX = iStartChangePos; |
---|
955 | |
---|
956 | if ( ( iCurPosX - 1 > -1 ) && (m_pcInputSamplesRow[iCurViewPos][ iCurPosX - 1].bOccluded ) ) |
---|
957 | { |
---|
958 | iCurPosX--; |
---|
959 | |
---|
960 | while ( (iCurPosX - 1 > -1 ) && (m_pcInputSamplesRow[iCurViewPos][ iCurPosX - 1].bOccluded ) ) |
---|
961 | iCurPosX--; |
---|
962 | |
---|
963 | if ( iCurPosX - 1 > -1 ) |
---|
964 | { |
---|
965 | iCurPosX--; |
---|
966 | m_iLastOccludedSPos = xShift(iCurPosX); |
---|
967 | } |
---|
968 | else |
---|
969 | { |
---|
970 | m_iLastOccludedSPos = xShift(iCurPosX) - 1; |
---|
971 | } |
---|
972 | m_iLastOccludedSPosFP = xRoundR( m_iLastOccludedSPos ); |
---|
973 | } |
---|
974 | else |
---|
975 | { |
---|
976 | m_iLastOccludedSPos = iLastSPos-1; |
---|
977 | m_iLastOccludedSPosFP = xRangeRightR( m_iLastOccludedSPos ); |
---|
978 | } |
---|
979 | |
---|
980 | m_bInOcclusion = iLastSPos <= m_iLastOccludedSPos; |
---|
981 | }; |
---|
982 | |
---|
983 | |
---|
984 | template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void |
---|
985 | TRenSingleModelC<iBM,bBitInc>::xRenderShiftedRangeL(Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError ) |
---|
986 | { |
---|
987 | assert( iCurSPos <= iLastSPos ); |
---|
988 | //assert( iRightSPos < m_iWidth ); |
---|
989 | |
---|
990 | Int iDeltaSPos = iLastSPos - iCurSPos; |
---|
991 | if ( iDeltaSPos > m_iGapTolerance ) |
---|
992 | { |
---|
993 | xFillHoleL<bSet>( iCurSPos, iLastSPos, iCurPos, riError ); |
---|
994 | } |
---|
995 | else |
---|
996 | { |
---|
997 | if (iLastSPos < 0 ) |
---|
998 | return; |
---|
999 | |
---|
1000 | RM_AOT( iDeltaSPos > m_iGapTolerance ); |
---|
1001 | |
---|
1002 | m_iThisDepth = m_iCurDepth; |
---|
1003 | for (Int iFillSPos = Max(0, xRangeLeftL(iCurSPos) ); iFillSPos <= min(xRangeRightL( iLastSPos ) ,m_iLastOccludedSPosFP-1); iFillSPos++ ) |
---|
1004 | { |
---|
1005 | Int iDeltaCurSPos = (iFillSPos << m_iShiftPrec) - iCurSPos; |
---|
1006 | |
---|
1007 | RM_AOT( iDeltaCurSPos > iDeltaSPos ); |
---|
1008 | RM_AOT( iDeltaCurSPos < 0 ); |
---|
1009 | RM_AOT( m_aaiSubPelShiftL[iDeltaSPos][iDeltaCurSPos] == 0xdeaddead); |
---|
1010 | |
---|
1011 | xSetShiftedPelL<bSet>( iCurPos, m_aaiSubPelShiftL[iDeltaSPos][iDeltaCurSPos], iFillSPos, REN_IS_FILLED, riError ); |
---|
1012 | } |
---|
1013 | }; |
---|
1014 | } |
---|
1015 | |
---|
1016 | template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void |
---|
1017 | TRenSingleModelC<iBM,bBitInc>::xRenderShiftedRangeR(Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError ) |
---|
1018 | { |
---|
1019 | assert( iCurSPos >= iLastSPos ); |
---|
1020 | |
---|
1021 | Int iDeltaSPos = iCurSPos - iLastSPos; |
---|
1022 | if ( iDeltaSPos > m_iGapTolerance ) |
---|
1023 | { |
---|
1024 | xFillHoleR<bSet>( iCurSPos, iLastSPos, iCurPos, riError ); |
---|
1025 | } |
---|
1026 | else |
---|
1027 | { |
---|
1028 | if (iLastSPos > m_iSampledWidth - 1 ) |
---|
1029 | return; |
---|
1030 | |
---|
1031 | m_iThisDepth = m_iCurDepth; |
---|
1032 | RM_AOT( iDeltaSPos > m_iGapTolerance ); |
---|
1033 | for (Int iFillSPos = max(m_iLastOccludedSPosFP+1, xRangeLeftR(iLastSPos) ); iFillSPos <= min(xRangeRightR( iCurSPos ) ,m_iWidth -1); iFillSPos++ ) |
---|
1034 | { |
---|
1035 | Int iDeltaCurSPos = (iFillSPos << m_iShiftPrec) - iLastSPos; |
---|
1036 | |
---|
1037 | RM_AOT( iDeltaCurSPos > iDeltaSPos ); |
---|
1038 | RM_AOT( iDeltaCurSPos < 0 ); |
---|
1039 | RM_AOT( m_aaiSubPelShiftR[iDeltaSPos][iDeltaCurSPos] == 0xdeaddead); |
---|
1040 | |
---|
1041 | xSetShiftedPelR<bSet>( iCurPos, m_aaiSubPelShiftR[iDeltaSPos][iDeltaCurSPos], iFillSPos, REN_IS_FILLED, riError ); |
---|
1042 | } |
---|
1043 | }; |
---|
1044 | } |
---|
1045 | |
---|
1046 | |
---|
1047 | |
---|
1048 | template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void |
---|
1049 | TRenSingleModelC<iBM,bBitInc>::xRenderRangeL(Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError ) |
---|
1050 | { |
---|
1051 | const Int iCurViewPos = 0; |
---|
1052 | if ( !m_bInOcclusion ) |
---|
1053 | { |
---|
1054 | if ( iCurSPos >= iLastSPos ) |
---|
1055 | { |
---|
1056 | m_iLastOccludedSPos = iLastSPos; |
---|
1057 | |
---|
1058 | Int iRightSPosFP = xRoundL( iLastSPos ); |
---|
1059 | if ( ( iRightSPosFP == xRangeRightL(iLastSPos)) && (iRightSPosFP >= 0) ) |
---|
1060 | { |
---|
1061 | m_iThisDepth = m_iLastDepth; |
---|
1062 | |
---|
1063 | xSetShiftedPelL<bSet>( iCurPos+1, 0, iRightSPosFP, REN_IS_FILLED, riError ); |
---|
1064 | } |
---|
1065 | m_iLastOccludedSPosFP = iRightSPosFP; |
---|
1066 | |
---|
1067 | m_bInOcclusion = true; |
---|
1068 | |
---|
1069 | if ( bSet ) |
---|
1070 | { |
---|
1071 | m_pcInputSamplesRow[iCurViewPos][ iCurPos ].bOccluded = true; |
---|
1072 | } |
---|
1073 | } |
---|
1074 | else |
---|
1075 | { |
---|
1076 | if ( bSet ) |
---|
1077 | { |
---|
1078 | m_pcInputSamplesRow[iCurViewPos][ iCurPos ].bOccluded = false; |
---|
1079 | } |
---|
1080 | |
---|
1081 | xRenderShiftedRangeL<bSet>(iCurSPos, iLastSPos, iCurPos, riError ); |
---|
1082 | } |
---|
1083 | } |
---|
1084 | else |
---|
1085 | { |
---|
1086 | if ( iCurSPos < m_iLastOccludedSPos ) |
---|
1087 | { |
---|
1088 | m_bInOcclusion = false; |
---|
1089 | if ( bSet ) |
---|
1090 | { |
---|
1091 | m_pcInputSamplesRow[iCurViewPos][ iCurPos ].bOccluded = false; |
---|
1092 | } |
---|
1093 | |
---|
1094 | xRenderShiftedRangeL<bSet>(iCurSPos, iLastSPos, iCurPos, riError ); |
---|
1095 | } |
---|
1096 | else |
---|
1097 | { |
---|
1098 | if ( bSet ) |
---|
1099 | { |
---|
1100 | m_pcInputSamplesRow[iCurViewPos][ iCurPos ].bOccluded = true; |
---|
1101 | } |
---|
1102 | } |
---|
1103 | } |
---|
1104 | } |
---|
1105 | |
---|
1106 | template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void |
---|
1107 | TRenSingleModelC<iBM,bBitInc>::xRenderRangeR(Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError ) |
---|
1108 | { |
---|
1109 | const Int iCurViewPos = 1; |
---|
1110 | // Find out if current sample is occluded |
---|
1111 | if ( !m_bInOcclusion ) |
---|
1112 | { |
---|
1113 | if ( iCurSPos <= iLastSPos ) |
---|
1114 | { |
---|
1115 | m_iLastOccludedSPos = iLastSPos; |
---|
1116 | |
---|
1117 | Int iLeftSPosFP = xRoundR( iLastSPos ); |
---|
1118 | if ( ( iLeftSPosFP == xRangeLeftR(iLastSPos)) && (iLeftSPosFP <= m_iWidth - 1) ) |
---|
1119 | { |
---|
1120 | m_iThisDepth = m_iLastDepth; |
---|
1121 | xSetShiftedPelR<bSet>( iCurPos-1,1 << m_iShiftPrec , iLeftSPosFP, REN_IS_FILLED, riError ); |
---|
1122 | } |
---|
1123 | m_iLastOccludedSPosFP = iLeftSPosFP; |
---|
1124 | |
---|
1125 | m_bInOcclusion = true; |
---|
1126 | |
---|
1127 | if ( bSet ) |
---|
1128 | { |
---|
1129 | m_pcInputSamplesRow[iCurViewPos][ iCurPos ].bOccluded = true; |
---|
1130 | } |
---|
1131 | } |
---|
1132 | else |
---|
1133 | { |
---|
1134 | if ( bSet ) |
---|
1135 | { |
---|
1136 | m_pcInputSamplesRow[iCurViewPos][ iCurPos ].bOccluded = false; |
---|
1137 | } |
---|
1138 | |
---|
1139 | xRenderShiftedRangeR<bSet>(iCurSPos, iLastSPos, iCurPos, riError ); |
---|
1140 | } |
---|
1141 | } |
---|
1142 | else |
---|
1143 | { |
---|
1144 | if ( iCurSPos > m_iLastOccludedSPos ) |
---|
1145 | { |
---|
1146 | m_bInOcclusion = false; |
---|
1147 | if ( bSet ) |
---|
1148 | { |
---|
1149 | m_pcInputSamplesRow[iCurViewPos][ iCurPos ].bOccluded = false; |
---|
1150 | } |
---|
1151 | |
---|
1152 | xRenderShiftedRangeR<bSet>(iCurSPos, iLastSPos, iCurPos, riError ); |
---|
1153 | } |
---|
1154 | else |
---|
1155 | { |
---|
1156 | if ( bSet ) |
---|
1157 | { |
---|
1158 | m_pcInputSamplesRow[iCurViewPos][ iCurPos ].bOccluded = true; |
---|
1159 | } |
---|
1160 | } |
---|
1161 | } |
---|
1162 | } |
---|
1163 | |
---|
1164 | template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void |
---|
1165 | TRenSingleModelC<iBM,bBitInc>::xFillHoleL( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError ) |
---|
1166 | { |
---|
1167 | if (iLastSPos < 0) |
---|
1168 | return; |
---|
1169 | |
---|
1170 | Int iStartFillSPos = iCurSPos; |
---|
1171 | Int iStartFillPos = iCurPos; |
---|
1172 | Int iLastPos = iCurPos + 1; |
---|
1173 | |
---|
1174 | Int iStartFillSPosFP = xRangeLeftL(iStartFillSPos); |
---|
1175 | |
---|
1176 | if (iStartFillSPosFP == xRoundL(iStartFillSPos)) |
---|
1177 | { |
---|
1178 | if ((iStartFillSPosFP >= 0) && (iStartFillSPosFP < m_iLastOccludedSPosFP) ) |
---|
1179 | { |
---|
1180 | m_iThisDepth = m_iCurDepth; |
---|
1181 | xSetShiftedPelL<bSet> ( iStartFillPos, 0, iStartFillSPosFP, REN_IS_FILLED, riError ); |
---|
1182 | } |
---|
1183 | } |
---|
1184 | else |
---|
1185 | { |
---|
1186 | iStartFillSPosFP--; |
---|
1187 | } |
---|
1188 | |
---|
1189 | m_iThisDepth = m_iLastDepth; |
---|
1190 | for (Int iFillSPos = Max(iStartFillSPosFP+1,0); iFillSPos <= min(xRangeRightL( iLastSPos ), m_iLastOccludedSPosFP-1 ); iFillSPos++ ) |
---|
1191 | { |
---|
1192 | xSetShiftedPelL<bSet>( iLastPos, 0, iFillSPos, REN_IS_HOLE, riError ); |
---|
1193 | } |
---|
1194 | } |
---|
1195 | |
---|
1196 | template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void |
---|
1197 | TRenSingleModelC<iBM,bBitInc>::xFillHoleR( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError ) |
---|
1198 | { |
---|
1199 | if (iLastSPos < 0) |
---|
1200 | return; |
---|
1201 | |
---|
1202 | Int iStartFillSPos = iCurSPos; |
---|
1203 | Int iEndFillPos = iCurPos; |
---|
1204 | Int iLastPos = iCurPos - 1; |
---|
1205 | |
---|
1206 | Int iStartFillSPosFP = xRangeRightR(iStartFillSPos); |
---|
1207 | |
---|
1208 | if (iStartFillSPosFP == xRoundR(iStartFillSPos)) |
---|
1209 | { |
---|
1210 | if ((iStartFillSPosFP < m_iWidth) && (iStartFillSPosFP > m_iLastOccludedSPosFP) ) |
---|
1211 | { |
---|
1212 | m_iThisDepth = m_iCurDepth; |
---|
1213 | xSetShiftedPelR<bSet>( iEndFillPos, 1 << m_iShiftPrec , iStartFillSPosFP, REN_IS_FILLED, riError ); |
---|
1214 | } |
---|
1215 | } |
---|
1216 | else |
---|
1217 | { |
---|
1218 | iStartFillSPosFP++; |
---|
1219 | } |
---|
1220 | |
---|
1221 | m_iThisDepth = m_iLastDepth; |
---|
1222 | for (Int iFillSPos = max(xRangeLeftR( iLastSPos ), m_iLastOccludedSPosFP+1); iFillSPos <= min(iStartFillSPosFP,m_iWidth)-1 ; iFillSPos++ ) |
---|
1223 | { |
---|
1224 | xSetShiftedPelR<bSet>( iLastPos, 1 << m_iShiftPrec, iFillSPos, REN_IS_HOLE, riError ); |
---|
1225 | } |
---|
1226 | } |
---|
1227 | |
---|
1228 | template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void |
---|
1229 | TRenSingleModelC<iBM,bBitInc>::xExtrapolateMarginL(Int iCurSPos, Int iCurPos, RMDist& riError ) |
---|
1230 | { |
---|
1231 | // if (iLeftSPos < 0 ) |
---|
1232 | // return; |
---|
1233 | |
---|
1234 | Int iSPosFullPel = Max(0,xRangeLeftL(iCurSPos)); |
---|
1235 | |
---|
1236 | m_iThisDepth = m_iCurDepth; |
---|
1237 | if (iSPosFullPel < m_iWidth) |
---|
1238 | { |
---|
1239 | xSetShiftedPelL<bSet>( iCurPos, 0, iSPosFullPel, REN_IS_FILLED, riError ); |
---|
1240 | } |
---|
1241 | |
---|
1242 | for (Int iFillSPos = iSPosFullPel +1; iFillSPos < m_iWidth; iFillSPos++ ) |
---|
1243 | { |
---|
1244 | xSetShiftedPelL<bSet>( iCurPos, 0, iFillSPos, REN_IS_HOLE, riError ); |
---|
1245 | } |
---|
1246 | } |
---|
1247 | |
---|
1248 | template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void |
---|
1249 | TRenSingleModelC<iBM,bBitInc>::xExtrapolateMarginR(Int iCurSPos, Int iCurPos, RMDist& riError ) |
---|
1250 | { |
---|
1251 | // if (iLeftSPos < 0 ) |
---|
1252 | // return; |
---|
1253 | |
---|
1254 | Int iSPosFullPel = Min(m_iWidth-1,xRangeRightR(iCurSPos)); |
---|
1255 | |
---|
1256 | m_iThisDepth = m_iCurDepth; |
---|
1257 | if (iSPosFullPel > -1) |
---|
1258 | { |
---|
1259 | xSetShiftedPelR<bSet>( iCurPos, 1 << m_iShiftPrec, iSPosFullPel, REN_IS_FILLED, riError ); |
---|
1260 | } |
---|
1261 | |
---|
1262 | for (Int iFillSPos = iSPosFullPel -1; iFillSPos > -1; iFillSPos-- ) |
---|
1263 | { |
---|
1264 | xSetShiftedPelR<bSet>( iCurPos , 1 << m_iShiftPrec, iFillSPos, REN_IS_HOLE, riError ); |
---|
1265 | } |
---|
1266 | } |
---|
1267 | |
---|
1268 | template <BlenMod iBM, Bool bBitInc> __inline Int |
---|
1269 | TRenSingleModelC<iBM,bBitInc>::xShiftNewData( Int iPosX, Int iPosInNewData ) |
---|
1270 | { |
---|
1271 | RM_AOT( iPosInNewData < 0 ); |
---|
1272 | RM_AOF( iPosInNewData < m_iNewDataWidth ); |
---|
1273 | |
---|
1274 | return (iPosX << m_iShiftPrec) - m_ppiCurLUT[0][ RenModRemoveBitInc( m_piNewDepthData[iPosInNewData] )]; |
---|
1275 | } |
---|
1276 | |
---|
1277 | template <BlenMod iBM, Bool bBitInc> __inline Int |
---|
1278 | TRenSingleModelC<iBM,bBitInc>::xShift( Int iPosX ) |
---|
1279 | { |
---|
1280 | RM_AOT( iPosX < 0); |
---|
1281 | RM_AOF( iPosX < m_iWidth); |
---|
1282 | |
---|
1283 | return (iPosX << m_iShiftPrec) - m_ppiCurLUT[0][ RenModRemoveBitInc( m_pcInputSamplesRow[m_iCurViewPos][iPosX].iD )]; |
---|
1284 | } |
---|
1285 | |
---|
1286 | |
---|
1287 | template <BlenMod iBM, Bool bBitInc> __inline Int |
---|
1288 | TRenSingleModelC<iBM,bBitInc>::xShift( Int iPos, Int iPosInNewData ) |
---|
1289 | { |
---|
1290 | if ( (iPosInNewData >= 0) && (iPosInNewData < m_iNewDataWidth) ) |
---|
1291 | { |
---|
1292 | return xShiftNewData(iPos ,iPosInNewData ); |
---|
1293 | } |
---|
1294 | else |
---|
1295 | { |
---|
1296 | return xShift(iPos); |
---|
1297 | } |
---|
1298 | } |
---|
1299 | |
---|
1300 | template <BlenMod iBM, Bool bBitInc> __inline Int |
---|
1301 | TRenSingleModelC<iBM,bBitInc>::xRangeLeftL( Int iPos ) |
---|
1302 | { |
---|
1303 | return ( iPos + (1 << m_iShiftPrec) - 1) >> m_iShiftPrec; |
---|
1304 | } |
---|
1305 | |
---|
1306 | |
---|
1307 | template <BlenMod iBM, Bool bBitInc> __inline Int |
---|
1308 | TRenSingleModelC<iBM,bBitInc>::xRangeLeftR( Int iPos ) |
---|
1309 | { |
---|
1310 | |
---|
1311 | return xRangeRightR( iPos ) + 1; |
---|
1312 | } |
---|
1313 | |
---|
1314 | |
---|
1315 | template <BlenMod iBM, Bool bBitInc> __inline Int |
---|
1316 | TRenSingleModelC<iBM,bBitInc>::xRangeRightL( Int iPos ) |
---|
1317 | { |
---|
1318 | return xRangeLeftL(iPos) - 1; |
---|
1319 | } |
---|
1320 | |
---|
1321 | template <BlenMod iBM, Bool bBitInc> __inline Int |
---|
1322 | TRenSingleModelC<iBM,bBitInc>::xRangeRightR( Int iPos ) |
---|
1323 | { |
---|
1324 | return iPos >> m_iShiftPrec; |
---|
1325 | } |
---|
1326 | |
---|
1327 | |
---|
1328 | template <BlenMod iBM, Bool bBitInc> __inline Int |
---|
1329 | TRenSingleModelC<iBM,bBitInc>::xRoundL( Int iPos ) |
---|
1330 | { |
---|
1331 | return (iPos + (( 1 << m_iShiftPrec ) >> 1 )) >> m_iShiftPrec; |
---|
1332 | } |
---|
1333 | |
---|
1334 | template <BlenMod iBM, Bool bBitInc> __inline Int |
---|
1335 | TRenSingleModelC<iBM,bBitInc>::xRoundR( Int iPos ) |
---|
1336 | { |
---|
1337 | return (m_iShiftPrec == 0) ? iPos : xRoundL(iPos - 1); |
---|
1338 | } |
---|
1339 | |
---|
1340 | |
---|
1341 | template <BlenMod iBM, Bool bBitInc> Void |
---|
1342 | TRenSingleModelC<iBM,bBitInc>::xSetPels( Pel* piPelSource , Int iSourceStride, Int iWidth, Int iHeight, Pel iVal ) |
---|
1343 | { |
---|
1344 | for (Int iYPos = 0; iYPos < iHeight; iYPos++) |
---|
1345 | { |
---|
1346 | for (Int iXPos = 0; iXPos < iWidth; iXPos++) |
---|
1347 | { |
---|
1348 | piPelSource[iXPos] = iVal; |
---|
1349 | } |
---|
1350 | piPelSource += iSourceStride; |
---|
1351 | } |
---|
1352 | } |
---|
1353 | |
---|
1354 | template <BlenMod iBM, Bool bBitInc> Void |
---|
1355 | TRenSingleModelC<iBM,bBitInc>::xSetInts( Int* piPelSource , Int iSourceStride, Int iWidth, Int iHeight, Int iVal ) |
---|
1356 | { |
---|
1357 | for (Int iYPos = 0; iYPos < iHeight; iYPos++) |
---|
1358 | { |
---|
1359 | for (Int iXPos = 0; iXPos < iWidth; iXPos++) |
---|
1360 | { |
---|
1361 | piPelSource[iXPos] = iVal; |
---|
1362 | } |
---|
1363 | piPelSource += iSourceStride; |
---|
1364 | } |
---|
1365 | } |
---|
1366 | |
---|
1367 | |
---|
1368 | template <BlenMod iBM, Bool bBitInc> Void |
---|
1369 | TRenSingleModelC<iBM,bBitInc>::xSetBools( Bool* pbPelSource , Int iSourceStride, Int iWidth, Int iHeight, Bool bVal ) |
---|
1370 | { |
---|
1371 | for (Int iYPos = 0; iYPos < iHeight; iYPos++) |
---|
1372 | { |
---|
1373 | for (Int iXPos = 0; iXPos < iWidth; iXPos++) |
---|
1374 | { |
---|
1375 | pbPelSource[iXPos] = bVal; |
---|
1376 | } |
---|
1377 | pbPelSource += iSourceStride; |
---|
1378 | } |
---|
1379 | } |
---|
1380 | |
---|
1381 | template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void |
---|
1382 | TRenSingleModelC<iBM,bBitInc>::xSetShiftedPelL(Int iSourcePos, Int iSubSourcePos, Int iTargetSPos, Pel iFilled, RMDist& riError ) |
---|
1383 | { |
---|
1384 | RM_AOT( iSourcePos < 0 ); |
---|
1385 | RM_AOT( iSourcePos >= m_iWidth ); |
---|
1386 | RM_AOT( iSubSourcePos < 0 ); |
---|
1387 | RM_AOT( iSubSourcePos > (1 << m_iShiftPrec) ); |
---|
1388 | RM_AOT( iTargetSPos < 0 ); |
---|
1389 | RM_AOT( iTargetSPos >= m_iWidth ); |
---|
1390 | |
---|
1391 | RenModelOutPels* pcOutSample = m_pcOutputSamplesRow + iTargetSPos; |
---|
1392 | RenModelInPels * pcInSample = m_pcInputSamplesRow[VIEWPOS_LEFT] + iSourcePos ; |
---|
1393 | |
---|
1394 | if ( iBM != BLEND_NONE ) |
---|
1395 | { |
---|
1396 | xSetShiftedPelBlendL<bSet> (pcInSample, iSubSourcePos, pcOutSample, iFilled, riError); |
---|
1397 | } |
---|
1398 | else |
---|
1399 | { |
---|
1400 | xSetShiftedPelNoBlendL<bSet>(pcInSample, iSubSourcePos, pcOutSample, iFilled, riError); |
---|
1401 | } |
---|
1402 | } |
---|
1403 | |
---|
1404 | template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void |
---|
1405 | TRenSingleModelC<iBM,bBitInc>::xSetShiftedPelNoBlendL(RenModelInPels* pcInSample, Int iSubSourcePos, RenModelOutPels* pcOutSample, Pel iFilled, RMDist& riError ) |
---|
1406 | { |
---|
1407 | if ( bSet ) |
---|
1408 | { |
---|
1409 | // Filled |
---|
1410 | pcOutSample->iFilledLeft = iFilled; |
---|
1411 | |
---|
1412 | // Yuv |
---|
1413 | pcOutSample->iYLeft = pcInSample->aiY[iSubSourcePos]; |
---|
1414 | #if HHI_VSO_COLOR_PLANES |
---|
1415 | pcOutSample->iULeft = pcInSample->aiU[iSubSourcePos]; |
---|
1416 | pcOutSample->iVLeft = pcInSample->aiV[iSubSourcePos]; |
---|
1417 | |
---|
1418 | pcOutSample->iError = xGetDist( pcOutSample->iYLeft - pcOutSample->iYRef, |
---|
1419 | pcOutSample->iULeft - pcOutSample->iURef, |
---|
1420 | pcOutSample->iVLeft - pcOutSample->iVRef |
---|
1421 | ); |
---|
1422 | #else |
---|
1423 | pcOutSample->iError = xGetDist( pcOutSample->iYLeft - pcOutSample->iYRef ); |
---|
1424 | #endif |
---|
1425 | |
---|
1426 | } |
---|
1427 | else |
---|
1428 | { |
---|
1429 | #if HHI_VSO_COLOR_PLANES |
---|
1430 | riError += xGetDist( pcInSample->aiY[iSubSourcePos] - pcOutSample->iYRef, |
---|
1431 | pcInSample->aiU[iSubSourcePos] - pcOutSample->iURef, |
---|
1432 | pcInSample->aiV[iSubSourcePos] - pcOutSample->iVRef |
---|
1433 | ); |
---|
1434 | #else |
---|
1435 | riError += xGetDist( pcInSample->aiY[iSubSourcePos] - pcOutSample->iYRef ); |
---|
1436 | #endif |
---|
1437 | |
---|
1438 | riError -= pcOutSample->iError; |
---|
1439 | } |
---|
1440 | } |
---|
1441 | |
---|
1442 | template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void |
---|
1443 | TRenSingleModelC<iBM,bBitInc>::xSetShiftedPelBlendL(RenModelInPels* pcInSample, Int iSubSourcePos, RenModelOutPels* pcOutSample, Pel iFilled, RMDist& riError ) |
---|
1444 | { |
---|
1445 | Pel piBlendedValueY; |
---|
1446 | #if HHI_VSO_COLOR_PLANES |
---|
1447 | Pel piBlendedValueU; |
---|
1448 | Pel piBlendedValueV; |
---|
1449 | #endif |
---|
1450 | |
---|
1451 | xGetBlendedValue ( |
---|
1452 | pcInSample ->aiY[iSubSourcePos], |
---|
1453 | pcOutSample->iYRight, |
---|
1454 | #if HHI_VSO_COLOR_PLANES |
---|
1455 | pcInSample ->aiU[iSubSourcePos], |
---|
1456 | pcOutSample->iURight, |
---|
1457 | pcInSample ->aiV[iSubSourcePos], |
---|
1458 | pcOutSample->iVRight, |
---|
1459 | #endif |
---|
1460 | m_piInvZLUTLeft [RenModRemoveBitInc(m_iThisDepth) ], |
---|
1461 | m_piInvZLUTRight[RenModRemoveBitInc(pcOutSample->iDRight)], |
---|
1462 | iFilled, |
---|
1463 | pcOutSample->iFilledRight , |
---|
1464 | piBlendedValueY |
---|
1465 | #if HHI_VSO_COLOR_PLANES |
---|
1466 | , piBlendedValueU, |
---|
1467 | piBlendedValueV |
---|
1468 | #endif |
---|
1469 | ); |
---|
1470 | |
---|
1471 | if ( bSet ) |
---|
1472 | { |
---|
1473 | // Set values |
---|
1474 | pcOutSample->iDLeft = m_iThisDepth; |
---|
1475 | pcOutSample->iYLeft = pcInSample ->aiY[iSubSourcePos]; |
---|
1476 | pcOutSample->iYBlended = piBlendedValueY; |
---|
1477 | #if HHI_VSO_COLOR_PLANES |
---|
1478 | pcOutSample->iULeft = pcInSample ->aiU[iSubSourcePos]; |
---|
1479 | pcOutSample->iUBlended = piBlendedValueU; |
---|
1480 | pcOutSample->iVLeft = pcInSample ->aiV[iSubSourcePos]; |
---|
1481 | pcOutSample->iVBlended = piBlendedValueV; |
---|
1482 | #endif |
---|
1483 | pcOutSample->iFilledLeft = iFilled; |
---|
1484 | |
---|
1485 | // Get Error |
---|
1486 | Int iDiffY = pcOutSample->iYRef - piBlendedValueY; |
---|
1487 | #if HHI_VSO_COLOR_PLANES |
---|
1488 | Int iDiffU = pcOutSample->iURef - piBlendedValueU; |
---|
1489 | Int iDiffV = pcOutSample->iVRef - piBlendedValueV; |
---|
1490 | pcOutSample->iError = xGetDist(iDiffY, iDiffU, iDiffV ); |
---|
1491 | #else |
---|
1492 | pcOutSample->iError = xGetDist(iDiffY ); |
---|
1493 | #endif |
---|
1494 | } |
---|
1495 | else |
---|
1496 | { |
---|
1497 | Int iDiffY = pcOutSample->iYRef - piBlendedValueY; |
---|
1498 | #if HHI_VSO_COLOR_PLANES |
---|
1499 | Int iDiffU = pcOutSample->iURef - piBlendedValueU; |
---|
1500 | Int iDiffV = pcOutSample->iVRef - piBlendedValueV; |
---|
1501 | riError += ( xGetDist( iDiffY, iDiffU, iDiffV ) - pcOutSample->iError ); |
---|
1502 | |
---|
1503 | #else |
---|
1504 | riError += ( xGetDist( iDiffY ) - pcOutSample->iError ); |
---|
1505 | #endif |
---|
1506 | |
---|
1507 | } |
---|
1508 | } |
---|
1509 | |
---|
1510 | |
---|
1511 | template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void |
---|
1512 | TRenSingleModelC<iBM,bBitInc>::xSetShiftedPelR(Int iSourcePos, Int iSubSourcePos, Int iTargetSPos, Pel iFilled, RMDist& riError ) |
---|
1513 | { |
---|
1514 | RM_AOT( iSourcePos < 0 ); |
---|
1515 | RM_AOT( iSourcePos >= m_iWidth ); |
---|
1516 | RM_AOT( iSubSourcePos < 0 ); |
---|
1517 | RM_AOT( iSubSourcePos >= (1 << m_iShiftPrec)+1 ); |
---|
1518 | RM_AOT( iTargetSPos < 0 ); |
---|
1519 | RM_AOT( iTargetSPos >= m_iWidth ); |
---|
1520 | |
---|
1521 | RenModelOutPels* pcOutSample = m_pcOutputSamplesRow + iTargetSPos; |
---|
1522 | RenModelInPels * pcInSample = m_pcInputSamplesRow[VIEWPOS_RIGHT] + iSourcePos ; |
---|
1523 | |
---|
1524 | if ( iBM != BLEND_NONE ) |
---|
1525 | { |
---|
1526 | xSetShiftedPelBlendR<bSet> (pcInSample, iSubSourcePos, pcOutSample, iFilled, riError); |
---|
1527 | } |
---|
1528 | else |
---|
1529 | { |
---|
1530 | xSetShiftedPelNoBlendR<bSet> (pcInSample, iSubSourcePos, pcOutSample, iFilled, riError); |
---|
1531 | } |
---|
1532 | } |
---|
1533 | |
---|
1534 | template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void |
---|
1535 | TRenSingleModelC<iBM,bBitInc>::xSetShiftedPelNoBlendR(RenModelInPels* pcInSample, Int iSubSourcePos, RenModelOutPels* pcOutSample, Pel iFilled, RMDist& riError ) |
---|
1536 | { |
---|
1537 | if ( bSet ) |
---|
1538 | { |
---|
1539 | // Filled |
---|
1540 | pcOutSample->iFilledRight = iFilled; |
---|
1541 | |
---|
1542 | // Yuv |
---|
1543 | pcOutSample->iYRight = pcInSample->aiY[iSubSourcePos]; |
---|
1544 | #if HHI_VSO_COLOR_PLANES |
---|
1545 | pcOutSample->iURight = pcInSample->aiU[iSubSourcePos]; |
---|
1546 | pcOutSample->iVRight = pcInSample->aiV[iSubSourcePos]; |
---|
1547 | |
---|
1548 | pcOutSample->iError = xGetDist( |
---|
1549 | pcOutSample->iYRight - pcOutSample->iYRef, |
---|
1550 | pcOutSample->iURight - pcOutSample->iURef, |
---|
1551 | pcOutSample->iVRight - pcOutSample->iVRef |
---|
1552 | ); |
---|
1553 | #else |
---|
1554 | pcOutSample->iError = xGetDist( pcOutSample->iYRight - pcOutSample->iYRef ); |
---|
1555 | #endif |
---|
1556 | |
---|
1557 | } |
---|
1558 | else |
---|
1559 | { |
---|
1560 | #if HHI_VSO_COLOR_PLANES |
---|
1561 | riError += xGetDist( pcInSample->aiY[iSubSourcePos] - pcOutSample->iYRef, |
---|
1562 | pcInSample->aiU[iSubSourcePos] - pcOutSample->iURef, |
---|
1563 | pcInSample->aiV[iSubSourcePos] - pcOutSample->iVRef |
---|
1564 | ); |
---|
1565 | #else |
---|
1566 | riError += xGetDist( pcInSample->aiY[iSubSourcePos] - pcOutSample->iYRef ); |
---|
1567 | #endif |
---|
1568 | |
---|
1569 | riError -= pcOutSample->iError; |
---|
1570 | } |
---|
1571 | } |
---|
1572 | |
---|
1573 | template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void |
---|
1574 | TRenSingleModelC<iBM,bBitInc>::xSetShiftedPelBlendR(RenModelInPels* pcInSample, Int iSubSourcePos, RenModelOutPels* pcOutSample, Pel iFilled, RMDist& riError ) |
---|
1575 | { |
---|
1576 | Pel piBlendedValueY; |
---|
1577 | #if HHI_VSO_COLOR_PLANES |
---|
1578 | Pel piBlendedValueU; |
---|
1579 | Pel piBlendedValueV; |
---|
1580 | #endif |
---|
1581 | |
---|
1582 | xGetBlendedValue ( |
---|
1583 | pcOutSample->iYLeft, |
---|
1584 | pcInSample ->aiY[iSubSourcePos], |
---|
1585 | #if HHI_VSO_COLOR_PLANES |
---|
1586 | pcOutSample->iULeft, |
---|
1587 | pcInSample ->aiU[iSubSourcePos], |
---|
1588 | pcOutSample->iVLeft, |
---|
1589 | pcInSample ->aiV[iSubSourcePos], |
---|
1590 | #endif |
---|
1591 | m_piInvZLUTLeft [RenModRemoveBitInc(pcOutSample->iDLeft)], |
---|
1592 | m_piInvZLUTRight [RenModRemoveBitInc(m_iThisDepth) ], |
---|
1593 | pcOutSample->iFilledLeft, |
---|
1594 | iFilled, |
---|
1595 | piBlendedValueY |
---|
1596 | #if HHI_VSO_COLOR_PLANES |
---|
1597 | , piBlendedValueU, |
---|
1598 | piBlendedValueV |
---|
1599 | #endif |
---|
1600 | ); |
---|
1601 | |
---|
1602 | if ( bSet ) |
---|
1603 | { |
---|
1604 | // Set values |
---|
1605 | pcOutSample->iDRight = m_iThisDepth; |
---|
1606 | pcOutSample->iYRight = pcInSample ->aiY[iSubSourcePos]; |
---|
1607 | pcOutSample->iYBlended = piBlendedValueY; |
---|
1608 | #if HHI_VSO_COLOR_PLANES |
---|
1609 | pcOutSample->iURight = pcInSample ->aiU[iSubSourcePos]; |
---|
1610 | pcOutSample->iUBlended = piBlendedValueU; |
---|
1611 | pcOutSample->iVRight = pcInSample ->aiV[iSubSourcePos]; |
---|
1612 | pcOutSample->iVBlended = piBlendedValueV; |
---|
1613 | #endif |
---|
1614 | pcOutSample->iFilledRight = iFilled; |
---|
1615 | |
---|
1616 | // Get Error |
---|
1617 | Int iDiffY = pcOutSample->iYRef - piBlendedValueY; |
---|
1618 | #if HHI_VSO_COLOR_PLANES |
---|
1619 | Int iDiffU = pcOutSample->iURef - piBlendedValueU; |
---|
1620 | Int iDiffV = pcOutSample->iVRef - piBlendedValueV; |
---|
1621 | pcOutSample->iError = xGetDist(iDiffY, iDiffU, iDiffV ); |
---|
1622 | #else |
---|
1623 | pcOutSample->iError = xGetDist(iDiffY ); |
---|
1624 | #endif |
---|
1625 | } |
---|
1626 | else |
---|
1627 | { |
---|
1628 | Int iDiffY = pcOutSample->iYRef - piBlendedValueY; |
---|
1629 | #if HHI_VSO_COLOR_PLANES |
---|
1630 | Int iDiffU = pcOutSample->iURef - piBlendedValueU; |
---|
1631 | Int iDiffV = pcOutSample->iVRef - piBlendedValueV; |
---|
1632 | riError += ( xGetDist( iDiffY, iDiffU, iDiffV ) - pcOutSample->iError ); |
---|
1633 | #else |
---|
1634 | riError += ( xGetDist( iDiffY ) - pcOutSample->iError ); |
---|
1635 | #endif |
---|
1636 | } |
---|
1637 | } |
---|
1638 | |
---|
1639 | template <BlenMod iBM, Bool bBitInc> __inline Int |
---|
1640 | TRenSingleModelC<iBM,bBitInc>::xGetDist( Int iDiffY, Int iDiffU, Int iDiffV ) |
---|
1641 | { |
---|
1642 | |
---|
1643 | if ( !bBitInc ) |
---|
1644 | { |
---|
1645 | return ( (iDiffY * iDiffY ) |
---|
1646 | + ((( (iDiffU * iDiffU ) |
---|
1647 | +(iDiffV * iDiffV ) |
---|
1648 | ) |
---|
1649 | ) >> 2 |
---|
1650 | ) |
---|
1651 | ); |
---|
1652 | } |
---|
1653 | else |
---|
1654 | { |
---|
1655 | return ( ((iDiffY * iDiffY) >> m_iDistShift) |
---|
1656 | + ((( ((iDiffU * iDiffU) >> m_iDistShift) |
---|
1657 | +((iDiffV * iDiffV) >> m_iDistShift) |
---|
1658 | ) |
---|
1659 | ) >> 2 |
---|
1660 | ) |
---|
1661 | ); |
---|
1662 | |
---|
1663 | } |
---|
1664 | } |
---|
1665 | |
---|
1666 | template <BlenMod iBM, Bool bBitInc> __inline Int |
---|
1667 | TRenSingleModelC<iBM,bBitInc>::xGetDist( Int iDiffY ) |
---|
1668 | { |
---|
1669 | if ( !bBitInc ) |
---|
1670 | { |
---|
1671 | return (iDiffY * iDiffY); |
---|
1672 | } |
---|
1673 | else |
---|
1674 | { |
---|
1675 | return ((iDiffY * iDiffY) >> m_iDistShift); |
---|
1676 | } |
---|
1677 | |
---|
1678 | } |
---|
1679 | |
---|
1680 | |
---|
1681 | #if HHI_VSO_COLOR_PLANES |
---|
1682 | template <BlenMod iBM, Bool bBitInc> __inline Void |
---|
1683 | TRenSingleModelC<iBM,bBitInc>::xGetBlendedValue( Pel iYL, Pel iYR, Pel iUL, Pel iUR, Pel iVL, Pel iVR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY, Pel& riU, Pel&riV ) |
---|
1684 | #else |
---|
1685 | template <BlenMod iBM, Bool bBitInc> __inline Void |
---|
1686 | TRenSingleModelC<iBM,bBitInc>::xGetBlendedValue( Pel iYL, Pel iYR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY ) |
---|
1687 | #endif |
---|
1688 | { |
---|
1689 | |
---|
1690 | RM_AOT( iBM != BLEND_AVRG && iBM != BLEND_LEFT && iBM != BLEND_RIGHT ); |
---|
1691 | |
---|
1692 | if (iBM != BLEND_AVRG ) |
---|
1693 | { |
---|
1694 | if (iBM == BLEND_LEFT ) |
---|
1695 | { |
---|
1696 | #if HHI_VSO_COLOR_PLANES |
---|
1697 | xGetBlendedValueBM1( iYL, iYR, iUL, iUR, iVL, iVR, iDepthL, iDepthR, iFilledL, iFilledR, riY, riU, riV ); |
---|
1698 | #else |
---|
1699 | xGetBlendedValueBM1( iYL, iYR, iDepthL, iDepthR, iFilledL, iFilledR, riY ); |
---|
1700 | #endif |
---|
1701 | } |
---|
1702 | else |
---|
1703 | { |
---|
1704 | #if HHI_VSO_COLOR_PLANES |
---|
1705 | xGetBlendedValueBM2( iYL, iYR, iUL, iUR, iVL, iVR, iDepthL, iDepthR, iFilledL, iFilledR, riY, riU, riV ); |
---|
1706 | #else |
---|
1707 | xGetBlendedValueBM2( iYL, iYR, iDepthL, iDepthR, iFilledL, iFilledR, riY ); |
---|
1708 | #endif |
---|
1709 | } |
---|
1710 | return; |
---|
1711 | } |
---|
1712 | |
---|
1713 | if ( (iFilledL != REN_IS_HOLE ) && ( iFilledR != REN_IS_HOLE) ) |
---|
1714 | { |
---|
1715 | Int iDepthDifference = iDepthR - iDepthL; |
---|
1716 | |
---|
1717 | if ( abs ( iDepthDifference ) <= m_iBlendZThres ) |
---|
1718 | { |
---|
1719 | if ((iFilledL == REN_IS_FILLED) && ( iFilledR != REN_IS_FILLED)) |
---|
1720 | { |
---|
1721 | riY = xBlend( iYL, iYR, iFilledR >> 1 ); |
---|
1722 | #if HHI_VSO_COLOR_PLANES |
---|
1723 | riU = xBlend( iUL, iUR, iFilledR >> 1 ); |
---|
1724 | riV = xBlend( iVL, iVR, iFilledR >> 1 ); |
---|
1725 | #endif |
---|
1726 | |
---|
1727 | } |
---|
1728 | else if ((iFilledL != REN_IS_FILLED) && ( iFilledR == REN_IS_FILLED)) |
---|
1729 | { |
---|
1730 | riY = xBlend( iYR, iYL, (iFilledL >> 1) ); |
---|
1731 | #if HHI_VSO_COLOR_PLANES |
---|
1732 | riU = xBlend( iUR, iUL, (iFilledL >> 1) ); |
---|
1733 | riV = xBlend( iVR, iVL, (iFilledL >> 1) ); |
---|
1734 | #endif |
---|
1735 | } |
---|
1736 | else |
---|
1737 | { |
---|
1738 | riY = xBlend( iYL, iYR, m_iBlendDistWeight ); |
---|
1739 | #if HHI_VSO_COLOR_PLANES |
---|
1740 | riU = xBlend( iUL, iUR, m_iBlendDistWeight ); |
---|
1741 | riV = xBlend( iVL, iVR, m_iBlendDistWeight ); |
---|
1742 | #endif |
---|
1743 | } |
---|
1744 | } |
---|
1745 | else if ( iDepthDifference < 0 ) |
---|
1746 | { |
---|
1747 | riY = iYL; |
---|
1748 | #if HHI_VSO_COLOR_PLANES |
---|
1749 | riU = iUL; |
---|
1750 | riV = iVL; |
---|
1751 | #endif |
---|
1752 | } |
---|
1753 | else |
---|
1754 | { |
---|
1755 | riY = iYR; |
---|
1756 | #if HHI_VSO_COLOR_PLANES |
---|
1757 | riU = iUR; |
---|
1758 | riV = iVR; |
---|
1759 | #endif |
---|
1760 | } |
---|
1761 | } |
---|
1762 | else if ( (iFilledL == REN_IS_HOLE) && (iFilledR == REN_IS_HOLE)) |
---|
1763 | { |
---|
1764 | if ( iDepthR < iDepthL ) |
---|
1765 | { |
---|
1766 | riY = iYR; |
---|
1767 | #if HHI_VSO_COLOR_PLANES |
---|
1768 | riU = iUR; |
---|
1769 | riV = iVR; |
---|
1770 | #endif |
---|
1771 | } |
---|
1772 | else |
---|
1773 | { |
---|
1774 | riY = iYL; |
---|
1775 | #if HHI_VSO_COLOR_PLANES |
---|
1776 | riU = iUL; |
---|
1777 | riV = iVL; |
---|
1778 | #endif |
---|
1779 | } |
---|
1780 | } |
---|
1781 | else |
---|
1782 | { |
---|
1783 | if (iFilledR == REN_IS_HOLE) |
---|
1784 | { |
---|
1785 | riY = iYL; |
---|
1786 | #if HHI_VSO_COLOR_PLANES |
---|
1787 | riU = iUL; |
---|
1788 | riV = iVL; |
---|
1789 | #endif |
---|
1790 | } |
---|
1791 | else |
---|
1792 | { |
---|
1793 | riY = iYR; |
---|
1794 | #if HHI_VSO_COLOR_PLANES |
---|
1795 | riU = iUR; |
---|
1796 | riV = iVR; |
---|
1797 | #endif |
---|
1798 | } |
---|
1799 | } |
---|
1800 | } |
---|
1801 | |
---|
1802 | template <BlenMod iBM, Bool bBitInc> __inline Void |
---|
1803 | #if HHI_VSO_COLOR_PLANES |
---|
1804 | TRenSingleModelC<iBM,bBitInc>::xGetBlendedValueBM1( Pel iYL, Pel iYR, Pel iUL, Pel iUR, Pel iVL, Pel iVR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY, Pel& riU, Pel&riV ) |
---|
1805 | #else |
---|
1806 | TRenSingleModelC<iBM,bBitInc>::xGetBlendedValueBM1( Pel iYL, Pel iYR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY ) |
---|
1807 | #endif |
---|
1808 | { |
---|
1809 | if ( iFilledL == REN_IS_FILLED || iFilledR == REN_IS_HOLE ) |
---|
1810 | { |
---|
1811 | riY = iYL; |
---|
1812 | #if HHI_VSO_COLOR_PLANES |
---|
1813 | riU = iUL; |
---|
1814 | riV = iVL; |
---|
1815 | #endif |
---|
1816 | } |
---|
1817 | else if ( iFilledL == REN_IS_HOLE ) |
---|
1818 | { |
---|
1819 | riY = iYR; |
---|
1820 | #if HHI_VSO_COLOR_PLANES |
---|
1821 | riU = iUR; |
---|
1822 | riV = iVR; |
---|
1823 | #endif |
---|
1824 | } |
---|
1825 | else |
---|
1826 | { |
---|
1827 | riY = xBlend( iYR, iYL, iFilledL ); |
---|
1828 | #if HHI_VSO_COLOR_PLANES |
---|
1829 | riU = xBlend( iUR, iUL, iFilledL ); |
---|
1830 | riV = xBlend( iVR, iUL, iFilledL ); |
---|
1831 | #endif |
---|
1832 | } |
---|
1833 | } |
---|
1834 | |
---|
1835 | template <BlenMod iBM, Bool bBitInc> __inline Void |
---|
1836 | #if HHI_VSO_COLOR_PLANES |
---|
1837 | TRenSingleModelC<iBM,bBitInc>::xGetBlendedValueBM2( Pel iYL, Pel iYR, Pel iUL, Pel iUR, Pel iVL, Pel iVR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY, Pel& riU, Pel&riV ) |
---|
1838 | #else |
---|
1839 | TRenSingleModelC<iBM,bBitInc>::xGetBlendedValueBM2( Pel iYL, Pel iYR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY ) |
---|
1840 | #endif |
---|
1841 | { |
---|
1842 | if ( iFilledR == REN_IS_FILLED || iFilledL == REN_IS_HOLE ) |
---|
1843 | { |
---|
1844 | riY = iYR; |
---|
1845 | #if HHI_VSO_COLOR_PLANES |
---|
1846 | riU = iUR; |
---|
1847 | riV = iVR; |
---|
1848 | #endif |
---|
1849 | } |
---|
1850 | else if ( iFilledR == REN_IS_HOLE ) |
---|
1851 | { |
---|
1852 | riY = iYL; |
---|
1853 | #if HHI_VSO_COLOR_PLANES |
---|
1854 | riU = iUL; |
---|
1855 | riV = iVL; |
---|
1856 | #endif |
---|
1857 | } |
---|
1858 | else |
---|
1859 | { |
---|
1860 | riY = xBlend( iYL, iYR, iFilledR ); |
---|
1861 | #if HHI_VSO_COLOR_PLANES |
---|
1862 | riU = xBlend( iUL, iUR, iFilledR ); |
---|
1863 | riV = xBlend( iVL, iUR, iFilledR ); |
---|
1864 | #endif |
---|
1865 | } |
---|
1866 | } |
---|
1867 | |
---|
1868 | template <BlenMod iBM, Bool bBitInc> __inline Pel |
---|
1869 | TRenSingleModelC<iBM,bBitInc>::xBlend( Pel pVal1, Pel pVal2, Int iWeightVal2 ) |
---|
1870 | { |
---|
1871 | return pVal1 + (Pel) ( ( (Int) ( pVal2 - pVal1) * iWeightVal2 + (1 << (REN_VDWEIGHT_PREC - 1)) ) >> REN_VDWEIGHT_PREC ); |
---|
1872 | } |
---|
1873 | |
---|
1874 | template <BlenMod iBM, Bool bBitInc> Void |
---|
1875 | TRenSingleModelC<iBM,bBitInc>::xCopy2PicYuv( Pel** ppiSrcVideoPel, Int* piStrides, TComPicYuv* rpcPicYuvTarget ) |
---|
1876 | { |
---|
1877 | TRenFilter::copy ( ppiSrcVideoPel[0], piStrides[0], m_iWidth, m_iUsedHeight, rpcPicYuvTarget->getLumaAddr() + m_iHorOffset * rpcPicYuvTarget->getStride() , rpcPicYuvTarget->getStride () ); |
---|
1878 | TRenFilter::sampleDown2Tap13( ppiSrcVideoPel[1], piStrides[1], m_iWidth, m_iUsedHeight, rpcPicYuvTarget->getCbAddr () + (m_iHorOffset >> 1) * rpcPicYuvTarget->getCStride(), rpcPicYuvTarget->getCStride() ); |
---|
1879 | TRenFilter::sampleDown2Tap13( ppiSrcVideoPel[2], piStrides[2], m_iWidth, m_iUsedHeight, rpcPicYuvTarget->getCrAddr () + (m_iHorOffset >> 1) * rpcPicYuvTarget->getCStride(), rpcPicYuvTarget->getCStride() ); |
---|
1880 | } |
---|
1881 | |
---|
1882 | template class TRenSingleModelC<BLEND_NONE ,true>; |
---|
1883 | template class TRenSingleModelC<BLEND_AVRG ,true>; |
---|
1884 | template class TRenSingleModelC<BLEND_LEFT ,true>; |
---|
1885 | template class TRenSingleModelC<BLEND_RIGHT,true>; |
---|
1886 | |
---|
1887 | template class TRenSingleModelC<BLEND_NONE ,false>; |
---|
1888 | template class TRenSingleModelC<BLEND_AVRG ,false>; |
---|
1889 | template class TRenSingleModelC<BLEND_LEFT ,false>; |
---|
1890 | template class TRenSingleModelC<BLEND_RIGHT,false>; |
---|
1891 | |
---|
1892 | #ifdef LGE_VSO_EARLY_SKIP_A0093 |
---|
1893 | template <BlenMod iBM, Bool bBitInc> |
---|
1894 | __inline Bool |
---|
1895 | TRenSingleModelC<iBM,bBitInc>::xDetectEarlySkipL( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData,Pel* piOrgData, Int iOrgStride) |
---|
1896 | { |
---|
1897 | RM_AOF( m_bEarlySkip ); |
---|
1898 | const Int iCurViewPos = 0; |
---|
1899 | Int** ppiCurLUT = m_appiShiftLut [ iCurViewPos ]; |
---|
1900 | |
---|
1901 | Bool bNoDiff = true; |
---|
1902 | |
---|
1903 | for (Int iPosY=0; iPosY < iHeight; iPosY++) |
---|
1904 | { |
---|
1905 | m_pbHorSkip[iPosY] = true; |
---|
1906 | |
---|
1907 | for (Int iPosX = 0; iPosX < iWidth; iPosX++) |
---|
1908 | { |
---|
1909 | Int iDisparityRec = abs(ppiCurLUT[0][ RenModRemoveBitInc(piNewData[iPosX])]); |
---|
1910 | Int iDispartyOrg = abs(ppiCurLUT[0][ RenModRemoveBitInc(piOrgData[iPosX])]); |
---|
1911 | |
---|
1912 | if( iDispartyOrg != iDisparityRec) |
---|
1913 | { |
---|
1914 | m_pbHorSkip[iPosY] = false; |
---|
1915 | bNoDiff = false; |
---|
1916 | break; |
---|
1917 | } |
---|
1918 | } |
---|
1919 | piNewData += iStride; |
---|
1920 | piOrgData += iOrgStride; |
---|
1921 | } |
---|
1922 | return bNoDiff; |
---|
1923 | } |
---|
1924 | |
---|
1925 | template <BlenMod iBM, Bool bBitInc> |
---|
1926 | __inline Bool |
---|
1927 | TRenSingleModelC<iBM,bBitInc>::xDetectEarlySkipR( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData,Pel* piOrgData, Int iOrgStride) |
---|
1928 | { |
---|
1929 | RM_AOF( m_bEarlySkip ); |
---|
1930 | Bool bNoDiff = true; |
---|
1931 | |
---|
1932 | const Int iCurViewPos = 1; |
---|
1933 | Int** ppiCurLUT = m_appiShiftLut [ iCurViewPos ]; |
---|
1934 | |
---|
1935 | for ( Int iPosY = 0; iPosY < iHeight; iPosY++ ) |
---|
1936 | { |
---|
1937 | m_pbHorSkip[iPosY] = true; |
---|
1938 | |
---|
1939 | for (Int iPosX = 0; iPosX < iWidth; iPosX++) |
---|
1940 | { |
---|
1941 | Int iDisparityRec = abs( ppiCurLUT[0][ RenModRemoveBitInc(piNewData[iPosX])] ); |
---|
1942 | Int iDisparityOrg = abs( ppiCurLUT[0][ RenModRemoveBitInc(piOrgData[iPosX])] ); |
---|
1943 | |
---|
1944 | if( iDisparityRec != iDisparityOrg ) |
---|
1945 | { |
---|
1946 | m_pbHorSkip[iPosY] = false; |
---|
1947 | bNoDiff = false; |
---|
1948 | break; |
---|
1949 | } |
---|
1950 | } |
---|
1951 | |
---|
1952 | piNewData += iStride; |
---|
1953 | piOrgData += iOrgStride; |
---|
1954 | } |
---|
1955 | return bNoDiff; |
---|
1956 | } |
---|
1957 | #endif |
---|