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