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