1 | /* The copyright in this software is being made available under the BSD |
---|
2 | * License, included below. This software may be subject to other third party |
---|
3 | * and contributor rights, including patent rights, and no such rights are |
---|
4 | * granted under this license. |
---|
5 | * |
---|
6 | * Copyright (c) 2010-2016, ITU/ISO/IEC |
---|
7 | * All rights reserved. |
---|
8 | * |
---|
9 | * Redistribution and use in source and binary forms, with or without |
---|
10 | * modification, are permitted provided that the following conditions are met: |
---|
11 | * |
---|
12 | * * Redistributions of source code must retain the above copyright notice, |
---|
13 | * this list of conditions and the following disclaimer. |
---|
14 | * * Redistributions in binary form must reproduce the above copyright notice, |
---|
15 | * this list of conditions and the following disclaimer in the documentation |
---|
16 | * and/or other materials provided with the distribution. |
---|
17 | * * Neither the name of the ISO/IEC nor the names of its contributors may |
---|
18 | * be used to endorse or promote products derived from this software without |
---|
19 | * specific prior written permission. |
---|
20 | * |
---|
21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS |
---|
25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
---|
31 | * THE POSSIBILITY OF SUCH DAMAGE. |
---|
32 | */ |
---|
33 | |
---|
34 | #include "TRenImage.h" |
---|
35 | #include "TRenFilter.h" |
---|
36 | #include "TRenSingleModel.h" |
---|
37 | |
---|
38 | #if NH_3D_VSO |
---|
39 | |
---|
40 | ////////////// TRENSINGLE MODEL /////////////// |
---|
41 | template <BlenMod iBM, Bool bBitInc> |
---|
42 | TRenSingleModelC<iBM,bBitInc>::TRenSingleModelC() |
---|
43 | : m_iDistShift ( ( ENC_INTERNAL_BIT_DEPTH - REN_BIT_DEPTH) << 1 ) |
---|
44 | { |
---|
45 | m_iWidth = -1; |
---|
46 | m_iHeight = -1; |
---|
47 | m_iStride = -1; |
---|
48 | m_iUsedHeight = -1; |
---|
49 | m_iHorOffset = -1; |
---|
50 | m_iMode = -1; |
---|
51 | m_iPad = PICYUV_PAD; |
---|
52 | m_iGapTolerance = -1; |
---|
53 | m_bUseOrgRef = false; |
---|
54 | |
---|
55 | m_pcPicYuvRef = NULL; |
---|
56 | |
---|
57 | m_pcOutputSamples = NULL; |
---|
58 | m_pcOutputSamplesRow = NULL; |
---|
59 | m_iOutputSamplesStride = -1; |
---|
60 | |
---|
61 | m_ppiCurLUT = NULL; |
---|
62 | m_piInvZLUTLeft = NULL; |
---|
63 | m_piInvZLUTRight = NULL; |
---|
64 | |
---|
65 | m_aapiRefVideoPel[0] = NULL; |
---|
66 | m_aapiRefVideoPel[1] = NULL; |
---|
67 | m_aapiRefVideoPel[2] = NULL; |
---|
68 | |
---|
69 | m_aiRefVideoStrides[0] = -1; |
---|
70 | m_aiRefVideoStrides[1] = -1; |
---|
71 | m_aiRefVideoStrides[2] = -1; |
---|
72 | |
---|
73 | |
---|
74 | for (UInt uiViewNum = 0 ; uiViewNum < 2; uiViewNum++) |
---|
75 | { |
---|
76 | // LUT |
---|
77 | m_appiShiftLut[uiViewNum] = NULL; |
---|
78 | |
---|
79 | m_pcInputSamples[uiViewNum] = NULL; |
---|
80 | m_iInputSamplesStride = -1; |
---|
81 | |
---|
82 | m_ppiCurLUT = NULL; |
---|
83 | m_piInvZLUTLeft = NULL; |
---|
84 | m_piInvZLUTRight = NULL; |
---|
85 | } |
---|
86 | |
---|
87 | #if H_3D_VSO_EARLY_SKIP |
---|
88 | m_pbHorSkip = NULL; |
---|
89 | #endif |
---|
90 | } |
---|
91 | |
---|
92 | template <BlenMod iBM, Bool bBitInc> |
---|
93 | TRenSingleModelC<iBM,bBitInc>::~TRenSingleModelC() |
---|
94 | { |
---|
95 | #if H_3D_VSO_EARLY_SKIP |
---|
96 | if ( m_pbHorSkip ) |
---|
97 | { |
---|
98 | delete[] m_pbHorSkip; |
---|
99 | m_pbHorSkip = NULL; |
---|
100 | } |
---|
101 | #endif |
---|
102 | |
---|
103 | if ( m_pcInputSamples [0] ) delete[] m_pcInputSamples [0]; |
---|
104 | if ( m_pcInputSamples [1] ) delete[] m_pcInputSamples [1]; |
---|
105 | |
---|
106 | if ( m_pcOutputSamples ) delete[] m_pcOutputSamples ; |
---|
107 | |
---|
108 | if ( m_piInvZLUTLeft ) delete[] m_piInvZLUTLeft ; |
---|
109 | if ( m_piInvZLUTRight ) delete[] m_piInvZLUTRight; |
---|
110 | |
---|
111 | if ( m_aapiRefVideoPel[0] ) delete[] ( m_aapiRefVideoPel[0] - ( m_aiRefVideoStrides[0] * m_iPad + m_iPad ) ); |
---|
112 | if ( m_aapiRefVideoPel[1] ) delete[] ( m_aapiRefVideoPel[1] - ( m_aiRefVideoStrides[1] * m_iPad + m_iPad ) ); |
---|
113 | if ( m_aapiRefVideoPel[2] ) delete[] ( m_aapiRefVideoPel[2] - ( m_aiRefVideoStrides[2] * m_iPad + m_iPad ) ); |
---|
114 | } |
---|
115 | |
---|
116 | template <BlenMod iBM, Bool bBitInc> Void |
---|
117 | #if H_3D_VSO_EARLY_SKIP |
---|
118 | TRenSingleModelC<iBM,bBitInc>::create( Int iMode, Int iWidth, Int iHeight, Int iShiftPrec, Int*** aaaiSubPelShiftTable, Int iHoleMargin, Bool bUseOrgRef, Int iBlendMode, Bool bLimOutput, Bool bEarlySkip ) |
---|
119 | #else |
---|
120 | TRenSingleModelC<iBM,bBitInc>::create( Int iMode, Int iWidth, Int iHeight, Int iShiftPrec, Int*** aaaiSubPelShiftTable, Int iHoleMargin, Bool bUseOrgRef, Int iBlendMode, Bool bLimOutput ) |
---|
121 | #endif |
---|
122 | |
---|
123 | { |
---|
124 | m_bLimOutput = bLimOutput; |
---|
125 | #if H_3D_VSO_EARLY_SKIP |
---|
126 | m_pbHorSkip = new Bool [MAX_CU_SIZE]; |
---|
127 | m_bEarlySkip = bEarlySkip; |
---|
128 | #endif |
---|
129 | |
---|
130 | AOF( ( iBlendMode == iBM ) || ( iBM == BLEND_NONE ) ); |
---|
131 | m_iMode = iMode; |
---|
132 | |
---|
133 | m_iWidth = iWidth; |
---|
134 | m_iHeight = iHeight; |
---|
135 | m_iStride = iWidth; |
---|
136 | |
---|
137 | m_iSampledWidth = m_iWidth << iShiftPrec; |
---|
138 | m_iSampledStride = m_iStride << iShiftPrec; |
---|
139 | |
---|
140 | m_iShiftPrec = iShiftPrec; |
---|
141 | m_aaiSubPelShiftL = aaaiSubPelShiftTable[0]; |
---|
142 | m_aaiSubPelShiftR = aaaiSubPelShiftTable[1]; |
---|
143 | |
---|
144 | if (m_iMode == 2) |
---|
145 | { |
---|
146 | m_piInvZLUTLeft = new Int[257]; |
---|
147 | m_piInvZLUTRight = new Int[257]; |
---|
148 | } |
---|
149 | |
---|
150 | m_iGapTolerance = ( 2 << iShiftPrec ); |
---|
151 | m_iHoleMargin = iHoleMargin; |
---|
152 | |
---|
153 | m_bUseOrgRef = bUseOrgRef; |
---|
154 | |
---|
155 | m_aiRefVideoStrides[0] = m_iStride + (m_iPad << 1); |
---|
156 | m_aiRefVideoStrides[1] = m_iStride + (m_iPad << 1); |
---|
157 | m_aiRefVideoStrides[2] = m_iStride + (m_iPad << 1); |
---|
158 | |
---|
159 | m_aapiRefVideoPel [0] = new Pel[ m_aiRefVideoStrides[0] * (m_iHeight + (m_iPad << 1))]; |
---|
160 | m_aapiRefVideoPel [1] = new Pel[ m_aiRefVideoStrides[1] * (m_iHeight + (m_iPad << 1))]; |
---|
161 | m_aapiRefVideoPel [2] = new Pel[ m_aiRefVideoStrides[2] * (m_iHeight + (m_iPad << 1))]; |
---|
162 | |
---|
163 | m_aapiRefVideoPel [0] += m_aiRefVideoStrides[0] * m_iPad + m_iPad; |
---|
164 | m_aapiRefVideoPel [1] += m_aiRefVideoStrides[1] * m_iPad + m_iPad; |
---|
165 | m_aapiRefVideoPel [2] += m_aiRefVideoStrides[2] * m_iPad + m_iPad; |
---|
166 | |
---|
167 | m_iInputSamplesStride = m_iWidth+1; |
---|
168 | m_iOutputSamplesStride = m_iWidth; |
---|
169 | |
---|
170 | m_pcInputSamples[0] = new RenModelInPels[m_iInputSamplesStride*m_iHeight]; |
---|
171 | m_pcInputSamples[1] = new RenModelInPels[m_iInputSamplesStride*m_iHeight]; |
---|
172 | |
---|
173 | m_pcOutputSamples = new RenModelOutPels [m_iOutputSamplesStride*m_iHeight]; |
---|
174 | m_pcLimOutputSamples = m_bLimOutput ? new RenModelLimOutPels[m_iOutputSamplesStride*m_iHeight] : NULL; |
---|
175 | } |
---|
176 | |
---|
177 | template <BlenMod iBM, Bool bBitInc> Void |
---|
178 | TRenSingleModelC<iBM,bBitInc>::setLRView( Int iViewPos, Pel** apiCurVideoPel, Int* aiCurVideoStride, Pel* piCurDepthPel, Int iCurDepthStride ) |
---|
179 | { |
---|
180 | AOF(( iViewPos == 0) || (iViewPos == 1) ); |
---|
181 | |
---|
182 | RenModelInPels* pcCurInputSampleRow = m_pcInputSamples[iViewPos]; |
---|
183 | |
---|
184 | Pel* piDRow = piCurDepthPel; |
---|
185 | Pel* piYRow = apiCurVideoPel[0]; |
---|
186 | #if H_3D_VSO_COLOR_PLANES |
---|
187 | Pel* piURow = apiCurVideoPel[1]; |
---|
188 | Pel* piVRow = apiCurVideoPel[2]; |
---|
189 | #endif |
---|
190 | |
---|
191 | |
---|
192 | Int iOffsetX = ( iViewPos == VIEWPOS_RIGHT ) ? 1 : 0; |
---|
193 | |
---|
194 | for ( Int iPosY = 0; iPosY < m_iUsedHeight; iPosY++ ) |
---|
195 | { |
---|
196 | if ( iViewPos == VIEWPOS_RIGHT ) |
---|
197 | { |
---|
198 | Int iSubPosX = (1 << m_iShiftPrec); |
---|
199 | pcCurInputSampleRow[0].aiY[iSubPosX] = piYRow[0]; |
---|
200 | #if H_3D_VSO_COLOR_PLANES |
---|
201 | pcCurInputSampleRow[0].aiU[iSubPosX] = piURow[0]; |
---|
202 | pcCurInputSampleRow[0].aiV[iSubPosX] = piVRow[0]; |
---|
203 | #endif |
---|
204 | } |
---|
205 | |
---|
206 | for ( Int iPosX = 0; iPosX < m_iWidth; iPosX++ ) |
---|
207 | { |
---|
208 | pcCurInputSampleRow[iPosX].iD = piDRow[iPosX]; |
---|
209 | |
---|
210 | for (Int iSubPosX = 0; iSubPosX < (1 << m_iShiftPrec)+1; iSubPosX++ ) |
---|
211 | { |
---|
212 | Int iShift = (iPosX << m_iShiftPrec) + iSubPosX; |
---|
213 | pcCurInputSampleRow[iPosX+iOffsetX].aiY[iSubPosX] = piYRow[iShift]; |
---|
214 | #if H_3D_VSO_COLOR_PLANES |
---|
215 | pcCurInputSampleRow[iPosX+iOffsetX].aiU[iSubPosX] = piURow[iShift]; |
---|
216 | pcCurInputSampleRow[iPosX+iOffsetX].aiV[iSubPosX] = piVRow[iShift]; |
---|
217 | #endif |
---|
218 | } |
---|
219 | } |
---|
220 | |
---|
221 | pcCurInputSampleRow += m_iInputSamplesStride; |
---|
222 | |
---|
223 | piDRow += iCurDepthStride; |
---|
224 | piYRow += aiCurVideoStride[0]; |
---|
225 | #if H_3D_VSO_COLOR_PLANES |
---|
226 | piURow += aiCurVideoStride[1]; |
---|
227 | piVRow += aiCurVideoStride[2]; |
---|
228 | #endif |
---|
229 | } |
---|
230 | |
---|
231 | |
---|
232 | m_aapiBaseVideoPel [iViewPos] = apiCurVideoPel; |
---|
233 | m_aaiBaseVideoStrides [iViewPos] = aiCurVideoStride; |
---|
234 | m_apiBaseDepthPel [iViewPos] = piCurDepthPel; |
---|
235 | m_aiBaseDepthStrides [iViewPos] = iCurDepthStride; |
---|
236 | |
---|
237 | } |
---|
238 | template <BlenMod iBM, Bool bBitInc> Void |
---|
239 | TRenSingleModelC<iBM,bBitInc>::setupPart ( UInt uiHorOffset, Int iUsedHeight ) |
---|
240 | { |
---|
241 | AOT( iUsedHeight > m_iHeight ); |
---|
242 | |
---|
243 | m_iUsedHeight = iUsedHeight; |
---|
244 | m_iHorOffset = (Int) uiHorOffset; |
---|
245 | } |
---|
246 | |
---|
247 | |
---|
248 | #if !RM_FIX_SETUP |
---|
249 | template <BlenMod iBM, Bool bBitInc> Void |
---|
250 | TRenSingleModelC<iBM,bBitInc>::setupInitialState( Int curViewPosInModel ) |
---|
251 | { |
---|
252 | xRenderAll( ); |
---|
253 | |
---|
254 | if ( m_bLimOutput ) |
---|
255 | { |
---|
256 | AOT( curViewPosInModel == VIEWPOS_INVALID ) |
---|
257 | xSetLimOutStruct( (curViewPosInModel == VIEWPOS_RIGHT) ? VIEWPOS_LEFT : VIEWPOS_RIGHT ); |
---|
258 | } |
---|
259 | } |
---|
260 | #endif |
---|
261 | |
---|
262 | #if RM_FIX_SETUP |
---|
263 | template <BlenMod iBM, Bool bBitInc> Void |
---|
264 | TRenSingleModelC<iBM,bBitInc>::setupRefView ( TComPicYuv* pcOrgVideo ) |
---|
265 | { |
---|
266 | m_pcPicYuvRef = pcOrgVideo; |
---|
267 | // Use provided ref view reference |
---|
268 | |
---|
269 | TRenFilter<REN_BIT_DEPTH>::copy( pcOrgVideo->getAddr( COMPONENT_Y ) + m_iHorOffset * pcOrgVideo->getStride( COMPONENT_Y ), pcOrgVideo->getStride( COMPONENT_Y ), m_iWidth, m_iUsedHeight, m_aapiRefVideoPel[0], m_aiRefVideoStrides[0]); |
---|
270 | switch ( pcOrgVideo->getChromaFormat() ) |
---|
271 | { |
---|
272 | case CHROMA_420: |
---|
273 | TRenFilter<REN_BIT_DEPTH>::sampleCUpHorUp(0, pcOrgVideo->getAddr( COMPONENT_Cb ) + (m_iHorOffset >> 1) * pcOrgVideo->getStride( COMPONENT_Cb ), pcOrgVideo->getStride( COMPONENT_Cb ), m_iWidth >> 1, m_iUsedHeight >> 1, m_aapiRefVideoPel[1], m_aiRefVideoStrides[1]); |
---|
274 | TRenFilter<REN_BIT_DEPTH>::sampleCUpHorUp(0, pcOrgVideo->getAddr( COMPONENT_Cr ) + (m_iHorOffset >> 1) * pcOrgVideo->getStride( COMPONENT_Cr ), pcOrgVideo->getStride( COMPONENT_Cr ), m_iWidth >> 1, m_iUsedHeight >> 1, m_aapiRefVideoPel[2], m_aiRefVideoStrides[2]); |
---|
275 | break; |
---|
276 | case CHROMA_444: |
---|
277 | TRenFilter<REN_BIT_DEPTH>::copy( pcOrgVideo->getAddr( COMPONENT_Cb ) + m_iHorOffset * pcOrgVideo->getStride( COMPONENT_Cb ), pcOrgVideo->getStride( COMPONENT_Cb ), m_iWidth, m_iUsedHeight, m_aapiRefVideoPel[1], m_aiRefVideoStrides[1]); |
---|
278 | TRenFilter<REN_BIT_DEPTH>::copy( pcOrgVideo->getAddr( COMPONENT_Cr ) + m_iHorOffset * pcOrgVideo->getStride( COMPONENT_Cr ), pcOrgVideo->getStride( COMPONENT_Cr ), m_iWidth, m_iUsedHeight, m_aapiRefVideoPel[2], m_aiRefVideoStrides[2]); |
---|
279 | break; |
---|
280 | default: |
---|
281 | break; |
---|
282 | } |
---|
283 | xSetStructRefView(); |
---|
284 | } |
---|
285 | |
---|
286 | |
---|
287 | template <BlenMod iBM, Bool bBitInc> Void |
---|
288 | TRenSingleModelC<iBM,bBitInc>::setupLut( Int** ppiShiftLutLeft, Int** ppiBaseShiftLutLeft, Int** ppiShiftLutRight, Int** ppiBaseShiftLutRight, Int iDistToLeft ) |
---|
289 | #else |
---|
290 | template <BlenMod iBM, Bool bBitInc> Void |
---|
291 | TRenSingleModelC<iBM,bBitInc>::setupLutAndRef( TComPicYuv* pcOrgVideo, Int** ppiShiftLutLeft, Int** ppiBaseShiftLutLeft, Int** ppiShiftLutRight, Int** ppiBaseShiftLutRight, Int iDistToLeft, Bool bRenderRef ) |
---|
292 | #endif |
---|
293 | { |
---|
294 | #if !RM_FIX_SETUP |
---|
295 | AOT( !m_bUseOrgRef && pcOrgVideo ); |
---|
296 | #endif |
---|
297 | AOT( (ppiShiftLutLeft == NULL) && (m_iMode == 0 || m_iMode == 2) ); |
---|
298 | AOT( (ppiShiftLutRight == NULL) && (m_iMode == 1 || m_iMode == 2) ); |
---|
299 | |
---|
300 | m_appiShiftLut[0] = ppiShiftLutLeft; |
---|
301 | m_appiShiftLut[1] = ppiShiftLutRight; |
---|
302 | |
---|
303 | |
---|
304 | if ( m_iMode == 2 ) |
---|
305 | { |
---|
306 | TRenFilter<REN_BIT_DEPTH>::setupZLUT( true, 30, iDistToLeft, ppiBaseShiftLutLeft, ppiBaseShiftLutRight, m_iBlendZThres, m_iBlendDistWeight, m_piInvZLUTLeft, m_piInvZLUTRight ); |
---|
307 | } |
---|
308 | |
---|
309 | #if !RM_FIX_SETUP |
---|
310 | // Copy Reference |
---|
311 | m_pcPicYuvRef = pcOrgVideo; |
---|
312 | |
---|
313 | if ( pcOrgVideo ) |
---|
314 | { |
---|
315 | assert( pcOrgVideo->getChromaFormat() == CHROMA_420 ); |
---|
316 | |
---|
317 | TRenFilter<REN_BIT_DEPTH>::copy( pcOrgVideo->getAddr( COMPONENT_Y ) + m_iHorOffset * pcOrgVideo->getStride( COMPONENT_Y ), pcOrgVideo->getStride( COMPONENT_Y ), m_iWidth, m_iUsedHeight, m_aapiRefVideoPel[0], m_aiRefVideoStrides[0]); |
---|
318 | TRenFilter<REN_BIT_DEPTH>::sampleCUpHorUp(0, pcOrgVideo->getAddr( COMPONENT_Cb ) + (m_iHorOffset >> 1) * pcOrgVideo->getStride( COMPONENT_Cb ), pcOrgVideo->getStride( COMPONENT_Cb ), m_iWidth >> 1, m_iUsedHeight >> 1, m_aapiRefVideoPel[1], m_aiRefVideoStrides[1]); |
---|
319 | TRenFilter<REN_BIT_DEPTH>::sampleCUpHorUp(0, pcOrgVideo->getAddr( COMPONENT_Cr ) + (m_iHorOffset >> 1) * pcOrgVideo->getStride( COMPONENT_Cr ), pcOrgVideo->getStride( COMPONENT_Cr ), m_iWidth >> 1, m_iUsedHeight >> 1, m_aapiRefVideoPel[2], m_aiRefVideoStrides[2]); |
---|
320 | xSetStructRefView(); |
---|
321 | } |
---|
322 | else |
---|
323 | { |
---|
324 | if ( bRenderRef ) |
---|
325 | { |
---|
326 | xRenderAll( ); |
---|
327 | xSetStructSynthViewAsRefView(); |
---|
328 | } |
---|
329 | } |
---|
330 | #endif |
---|
331 | } |
---|
332 | |
---|
333 | template <BlenMod iBM, Bool bBitInc> Void |
---|
334 | #if RM_FIX_SETUP |
---|
335 | TRenSingleModelC<iBM,bBitInc>::renderAll( ) |
---|
336 | #else |
---|
337 | TRenSingleModelC<iBM,bBitInc>::xRenderAll( ) |
---|
338 | #endif |
---|
339 | { |
---|
340 | // Initial Rendering |
---|
341 | #if RM_FIX_SETUP |
---|
342 | resetStructError(); |
---|
343 | #else |
---|
344 | xResetStructError(); |
---|
345 | #endif |
---|
346 | xInitSampleStructs(); |
---|
347 | switch ( m_iMode ) |
---|
348 | { |
---|
349 | case 0: |
---|
350 | #if H_3D_VSO_EARLY_SKIP |
---|
351 | xRender<true, SET_FULL>( 0, 0, m_iWidth, m_iUsedHeight, m_aiBaseDepthStrides[0], m_apiBaseDepthPel[0],false ); |
---|
352 | #else |
---|
353 | xRender<true, SET_FULL>( 0, 0, m_iWidth, m_iUsedHeight, m_aiBaseDepthStrides[0], m_apiBaseDepthPel[0] ); |
---|
354 | #endif |
---|
355 | break; |
---|
356 | case 1: |
---|
357 | #if H_3D_VSO_EARLY_SKIP |
---|
358 | xRender<false, SET_FULL>( 0, 0, m_iWidth, m_iUsedHeight, m_aiBaseDepthStrides[1], m_apiBaseDepthPel[1],false); |
---|
359 | #else |
---|
360 | xRender<false, SET_FULL>( 0, 0, m_iWidth, m_iUsedHeight, m_aiBaseDepthStrides[1], m_apiBaseDepthPel[1] ); |
---|
361 | #endif |
---|
362 | break; |
---|
363 | case 2: |
---|
364 | #if H_3D_VSO_EARLY_SKIP |
---|
365 | xRender<true , SET_FULL>( 0, 0, m_iWidth, m_iUsedHeight, m_aiBaseDepthStrides[0], m_apiBaseDepthPel[0],false); |
---|
366 | xRender<false, SET_FULL>( 0, 0, m_iWidth, m_iUsedHeight, m_aiBaseDepthStrides[1], m_apiBaseDepthPel[1],false); |
---|
367 | #else |
---|
368 | xRender<true, SET_FULL>( 0, 0, m_iWidth, m_iUsedHeight, m_aiBaseDepthStrides[0], m_apiBaseDepthPel[0] ); |
---|
369 | xRender<false, SET_FULL>( 0, 0, m_iWidth, m_iUsedHeight, m_aiBaseDepthStrides[1], m_apiBaseDepthPel[1] ); |
---|
370 | #endif |
---|
371 | break; |
---|
372 | default: |
---|
373 | AOT(true); |
---|
374 | } |
---|
375 | } |
---|
376 | |
---|
377 | template <BlenMod iBM, Bool bBitInc> Void |
---|
378 | #if H_3D_VSO_COLOR_PLANES |
---|
379 | TRenSingleModelC<iBM,bBitInc>::xGetSampleStrTextPtrs( Int iViewNum, Pel RenModelOutPels::*& rpiSrcY, Pel RenModelOutPels::*& rpiSrcU, Pel RenModelOutPels::*& rpiSrcV ) |
---|
380 | #else |
---|
381 | TRenSingleModelC<iBM,bBitInc>::xGetSampleStrTextPtrs( Int iViewNum, Pel RenModelOutPels::*& rpiSrcY ) |
---|
382 | #endif |
---|
383 | { |
---|
384 | switch ( iViewNum ) |
---|
385 | { |
---|
386 | |
---|
387 | case -1: |
---|
388 | rpiSrcY = &RenModelOutPels::iYRef; |
---|
389 | #if H_3D_VSO_COLOR_PLANES |
---|
390 | rpiSrcU = &RenModelOutPels::iURef; |
---|
391 | rpiSrcV = &RenModelOutPels::iVRef; |
---|
392 | #endif |
---|
393 | break; |
---|
394 | case 0: |
---|
395 | rpiSrcY = &RenModelOutPels::iYLeft; |
---|
396 | #if H_3D_VSO_COLOR_PLANES |
---|
397 | rpiSrcU = &RenModelOutPels::iULeft; |
---|
398 | rpiSrcV = &RenModelOutPels::iVLeft; |
---|
399 | #endif |
---|
400 | break; |
---|
401 | case 1: |
---|
402 | rpiSrcY = &RenModelOutPels::iYRight; |
---|
403 | #if H_3D_VSO_COLOR_PLANES |
---|
404 | rpiSrcU = &RenModelOutPels::iURight; |
---|
405 | rpiSrcV = &RenModelOutPels::iVRight; |
---|
406 | #endif |
---|
407 | break; |
---|
408 | case 2: |
---|
409 | rpiSrcY = &RenModelOutPels::iYBlended; |
---|
410 | #if H_3D_VSO_COLOR_PLANES |
---|
411 | rpiSrcU = &RenModelOutPels::iUBlended; |
---|
412 | rpiSrcV = &RenModelOutPels::iVBlended; |
---|
413 | #endif |
---|
414 | break; |
---|
415 | } |
---|
416 | } |
---|
417 | |
---|
418 | |
---|
419 | template <BlenMod iBM, Bool bBitInc> Void |
---|
420 | TRenSingleModelC<iBM,bBitInc>::xGetSampleStrDepthPtrs( Int iViewNum, Pel RenModelOutPels::*& rpiSrcD ) |
---|
421 | { |
---|
422 | AOT(iViewNum != 0 && iViewNum != 1); |
---|
423 | rpiSrcD = (iViewNum == 1) ? &RenModelOutPels::iDRight : &RenModelOutPels::iDLeft; |
---|
424 | } |
---|
425 | |
---|
426 | template <BlenMod iBM, Bool bBitInc> Void |
---|
427 | TRenSingleModelC<iBM,bBitInc>::xGetSampleStrFilledPtrs( Int iViewNum, Int RenModelOutPels::*& rpiSrcFilled ) |
---|
428 | { |
---|
429 | AOT(iViewNum != 0 && iViewNum != 1); |
---|
430 | rpiSrcFilled = (iViewNum == 1) ? &RenModelOutPels::iFilledRight : &RenModelOutPels::iFilledLeft; |
---|
431 | } |
---|
432 | |
---|
433 | |
---|
434 | template <BlenMod iBM, Bool bBitInc> Void |
---|
435 | TRenSingleModelC<iBM,bBitInc>::xSetStructRefView( ) |
---|
436 | { |
---|
437 | RenModelOutPels* pcCurOutSampleRow = m_pcOutputSamples; |
---|
438 | |
---|
439 | Pel* piYRow = m_aapiRefVideoPel[0]; |
---|
440 | #if H_3D_VSO_COLOR_PLANES |
---|
441 | Pel* piURow = m_aapiRefVideoPel[1]; |
---|
442 | Pel* piVRow = m_aapiRefVideoPel[2]; |
---|
443 | #endif |
---|
444 | |
---|
445 | for ( Int iPosY = 0; iPosY < m_iUsedHeight; iPosY++ ) |
---|
446 | { |
---|
447 | for ( Int iPosX = 0; iPosX < m_iWidth; iPosX++ ) |
---|
448 | { |
---|
449 | pcCurOutSampleRow[iPosX].iYRef = piYRow[iPosX]; |
---|
450 | #if H_3D_VSO_COLOR_PLANES |
---|
451 | pcCurOutSampleRow[iPosX].iURef = piURow[iPosX]; |
---|
452 | pcCurOutSampleRow[iPosX].iVRef = piVRow[iPosX]; |
---|
453 | #endif |
---|
454 | } |
---|
455 | |
---|
456 | pcCurOutSampleRow += m_iOutputSamplesStride; |
---|
457 | |
---|
458 | piYRow += m_aiRefVideoStrides[0]; |
---|
459 | #if H_3D_VSO_COLOR_PLANES |
---|
460 | piURow += m_aiRefVideoStrides[1]; |
---|
461 | piVRow += m_aiRefVideoStrides[2]; |
---|
462 | #endif |
---|
463 | } |
---|
464 | } |
---|
465 | |
---|
466 | template <BlenMod iBM, Bool bBitInc> Void |
---|
467 | #if RM_FIX_SETUP |
---|
468 | TRenSingleModelC<iBM,bBitInc>::resetStructError( ) |
---|
469 | #else |
---|
470 | TRenSingleModelC<iBM,bBitInc>::xResetStructError( ) |
---|
471 | #endif |
---|
472 | { |
---|
473 | RenModelOutPels* pcCurOutSampleRow = m_pcOutputSamples; |
---|
474 | |
---|
475 | for ( Int iPosY = 0; iPosY < m_iHeight; iPosY++ ) |
---|
476 | { |
---|
477 | for ( Int iPosX = 0; iPosX < m_iWidth; iPosX++ ) |
---|
478 | { |
---|
479 | pcCurOutSampleRow[iPosX].iError = 0; |
---|
480 | } |
---|
481 | pcCurOutSampleRow += m_iOutputSamplesStride; |
---|
482 | } |
---|
483 | } |
---|
484 | |
---|
485 | template <BlenMod iBM, Bool bBitInc> Void |
---|
486 | #if RM_FIX_SETUP |
---|
487 | TRenSingleModelC<iBM,bBitInc>::setLimOutStruct(Int iSourceViewPos ) |
---|
488 | #else |
---|
489 | TRenSingleModelC<iBM,bBitInc>::xSetLimOutStruct(Int iSourceViewPos ) |
---|
490 | #endif |
---|
491 | { |
---|
492 | RM_AOF( m_bLimOutput ); |
---|
493 | RM_AOT( iSourceViewPos < 0 || iSourceViewPos > 1); |
---|
494 | |
---|
495 | RenModelOutPels* pcCurOutSampleRow = m_pcOutputSamples; |
---|
496 | RenModelLimOutPels* pcCurLimOutSampleRow = m_pcLimOutputSamples; |
---|
497 | |
---|
498 | Int RenModelOutPels::* piFilled = NULL; |
---|
499 | xGetSampleStrFilledPtrs( iSourceViewPos, piFilled ); |
---|
500 | |
---|
501 | Pel RenModelOutPels::* piDepth = NULL; |
---|
502 | xGetSampleStrDepthPtrs ( iSourceViewPos, piDepth ); |
---|
503 | |
---|
504 | Pel RenModelOutPels::* piSrcY = NULL; |
---|
505 | |
---|
506 | #if H_3D_VSO_COLOR_PLANES |
---|
507 | Pel RenModelOutPels::* piSrcU = NULL; |
---|
508 | Pel RenModelOutPels::* piSrcV = NULL; |
---|
509 | xGetSampleStrTextPtrs ( iSourceViewPos, piSrcY, piSrcU, piSrcV ); |
---|
510 | #else |
---|
511 | xGetSampleStrTextPtrs ( iSourceViewPos, piSrcY ); |
---|
512 | #endif |
---|
513 | |
---|
514 | for ( Int iPosY = 0; iPosY < m_iUsedHeight; iPosY++ ) |
---|
515 | { |
---|
516 | for ( Int iPosX = 0; iPosX < m_iWidth; iPosX++ ) |
---|
517 | { |
---|
518 | pcCurLimOutSampleRow[iPosX].iYOther = pcCurOutSampleRow[iPosX].*piSrcY; |
---|
519 | pcCurLimOutSampleRow[iPosX].iYRef = pcCurOutSampleRow[iPosX].iYRef; |
---|
520 | |
---|
521 | #if H_3D_VSO_COLOR_PLANES |
---|
522 | pcCurLimOutSampleRow[iPosX].iUOther = pcCurOutSampleRow[iPosX].*piSrcU; |
---|
523 | pcCurLimOutSampleRow[iPosX].iURef = pcCurOutSampleRow[iPosX].iURef; |
---|
524 | |
---|
525 | pcCurLimOutSampleRow[iPosX].iVOther = pcCurOutSampleRow[iPosX].*piSrcV; |
---|
526 | pcCurLimOutSampleRow[iPosX].iVRef = pcCurOutSampleRow[iPosX].iVRef; |
---|
527 | #endif |
---|
528 | pcCurLimOutSampleRow[iPosX].iDOther = pcCurOutSampleRow[iPosX].*piDepth; |
---|
529 | pcCurLimOutSampleRow[iPosX].iFilledOther = pcCurOutSampleRow[iPosX].*piFilled; |
---|
530 | pcCurLimOutSampleRow[iPosX].iError = pcCurOutSampleRow[iPosX].iError; |
---|
531 | |
---|
532 | } |
---|
533 | pcCurOutSampleRow += m_iOutputSamplesStride; |
---|
534 | pcCurLimOutSampleRow += m_iOutputSamplesStride; |
---|
535 | } |
---|
536 | } |
---|
537 | |
---|
538 | template <BlenMod iBM, Bool bBitInc> Void |
---|
539 | #if RM_FIX_SETUP |
---|
540 | TRenSingleModelC<iBM,bBitInc>::setStructSynthViewAsRefView( ) |
---|
541 | #else |
---|
542 | TRenSingleModelC<iBM,bBitInc>::xSetStructSynthViewAsRefView( ) |
---|
543 | #endif |
---|
544 | { |
---|
545 | AOT( m_iMode < 0 || m_iMode > 2); |
---|
546 | |
---|
547 | RenModelOutPels* pcCurOutSampleRow = m_pcOutputSamples; |
---|
548 | |
---|
549 | Pel RenModelOutPels::* piSrcY = NULL; |
---|
550 | |
---|
551 | #if H_3D_VSO_COLOR_PLANES |
---|
552 | Pel RenModelOutPels::* piSrcU = NULL; |
---|
553 | Pel RenModelOutPels::* piSrcV = NULL; |
---|
554 | xGetSampleStrTextPtrs( m_iMode, piSrcY, piSrcU, piSrcV ); |
---|
555 | #else |
---|
556 | xGetSampleStrTextPtrs( m_iMode, piSrcY ); |
---|
557 | #endif |
---|
558 | |
---|
559 | for ( Int iPosY = 0; iPosY < m_iUsedHeight; iPosY++ ) |
---|
560 | { |
---|
561 | for ( Int iPosX = 0; iPosX < m_iWidth; iPosX++ ) |
---|
562 | { |
---|
563 | pcCurOutSampleRow[iPosX].iYRef = pcCurOutSampleRow[iPosX].*piSrcY; |
---|
564 | #if H_3D_VSO_COLOR_PLANES |
---|
565 | pcCurOutSampleRow[iPosX].iURef = pcCurOutSampleRow[iPosX].*piSrcU; |
---|
566 | pcCurOutSampleRow[iPosX].iVRef = pcCurOutSampleRow[iPosX].*piSrcV; |
---|
567 | #endif |
---|
568 | } |
---|
569 | pcCurOutSampleRow += m_iOutputSamplesStride; |
---|
570 | } |
---|
571 | } |
---|
572 | |
---|
573 | template <BlenMod iBM, Bool bBitInc> Void |
---|
574 | TRenSingleModelC<iBM,bBitInc>::xInitSampleStructs() |
---|
575 | { |
---|
576 | RenModelOutPels* pcOutSampleRow = m_pcOutputSamples; |
---|
577 | RenModelInPels * pcLeftInSampleRow = m_pcInputSamples[0]; |
---|
578 | RenModelInPels * pcRightInSampleRow = m_pcInputSamples[1]; |
---|
579 | |
---|
580 | |
---|
581 | for (Int iPosY = 0; iPosY < m_iHeight; iPosY++) |
---|
582 | { |
---|
583 | for (Int iPosX = 0; iPosX < m_iWidth; iPosX++) |
---|
584 | { |
---|
585 | //// Output Samples |
---|
586 | pcOutSampleRow[iPosX].iFilledLeft = REN_IS_HOLE; |
---|
587 | pcOutSampleRow[iPosX].iFilledRight = REN_IS_HOLE; |
---|
588 | |
---|
589 | pcOutSampleRow[iPosX].iDLeft = 0; |
---|
590 | pcOutSampleRow[iPosX].iDRight = 0; |
---|
591 | pcOutSampleRow[iPosX].iDBlended = 0; |
---|
592 | pcOutSampleRow[iPosX].iError = 0; |
---|
593 | |
---|
594 | // Y Planes |
---|
595 | pcOutSampleRow[iPosX].iYLeft = 0; |
---|
596 | pcOutSampleRow[iPosX].iYRight = 0; |
---|
597 | pcOutSampleRow[iPosX].iYBlended = 0; |
---|
598 | #if H_3D_VSO_COLOR_PLANES |
---|
599 | // U Planes |
---|
600 | pcOutSampleRow[iPosX].iULeft = 1 << (REN_BIT_DEPTH - 1); |
---|
601 | pcOutSampleRow[iPosX].iURight = 1 << (REN_BIT_DEPTH - 1); |
---|
602 | pcOutSampleRow[iPosX].iUBlended = 1 << (REN_BIT_DEPTH - 1); |
---|
603 | |
---|
604 | // V Planes |
---|
605 | pcOutSampleRow[iPosX].iVLeft = 1 << (REN_BIT_DEPTH - 1); |
---|
606 | pcOutSampleRow[iPosX].iVRight = 1 << (REN_BIT_DEPTH - 1); |
---|
607 | pcOutSampleRow[iPosX].iVBlended = 1 << (REN_BIT_DEPTH - 1); |
---|
608 | #endif |
---|
609 | //// Input Samples |
---|
610 | pcLeftInSampleRow [iPosX].aiOccludedPos = MAX_INT; |
---|
611 | pcRightInSampleRow[iPosX].aiOccludedPos = MIN_INT; |
---|
612 | } |
---|
613 | |
---|
614 | pcOutSampleRow += m_iOutputSamplesStride; |
---|
615 | pcLeftInSampleRow += m_iInputSamplesStride; |
---|
616 | pcRightInSampleRow += m_iInputSamplesStride; |
---|
617 | } |
---|
618 | } |
---|
619 | |
---|
620 | |
---|
621 | #if H_3D_VSO_EARLY_SKIP |
---|
622 | template <BlenMod iBM, Bool bBitInc> RMDist |
---|
623 | TRenSingleModelC<iBM,bBitInc>::getDistDepth( Int iViewPos, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData , const Pel * piOrgData, Int iOrgStride ) |
---|
624 | #else |
---|
625 | template <BlenMod iBM, Bool bBitInc> RMDist |
---|
626 | TRenSingleModelC<iBM,bBitInc>::getDistDepth( Int iViewPos, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData ) |
---|
627 | #endif |
---|
628 | { |
---|
629 | RMDist iSSE = 0; |
---|
630 | #if H_3D_VSO_EARLY_SKIP |
---|
631 | Bool bEarlySkip; |
---|
632 | #endif |
---|
633 | switch ( iViewPos ) |
---|
634 | { |
---|
635 | case 0: |
---|
636 | #if H_3D_VSO_EARLY_SKIP |
---|
637 | bEarlySkip = m_bEarlySkip ? xDetectEarlySkip<true>(iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData, piOrgData, iOrgStride) : false; |
---|
638 | if( !bEarlySkip ) |
---|
639 | { |
---|
640 | iSSE = xRender<true, GET_SIMP>( iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData,true ); |
---|
641 | } |
---|
642 | #else |
---|
643 | iSSE = xRender<true, GET_SIMP>( iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData ); |
---|
644 | #endif |
---|
645 | break; |
---|
646 | case 1: |
---|
647 | #if H_3D_VSO_EARLY_SKIP |
---|
648 | bEarlySkip = m_bEarlySkip ? xDetectEarlySkip<false>(iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData, piOrgData, iOrgStride) : false; |
---|
649 | if( !bEarlySkip ) |
---|
650 | { |
---|
651 | iSSE = xRender<false, GET_SIMP>( iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData,true ); |
---|
652 | } |
---|
653 | #else |
---|
654 | iSSE = xRender<false, GET_SIMP>( iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData ); |
---|
655 | #endif |
---|
656 | break; |
---|
657 | default: |
---|
658 | assert(0); |
---|
659 | } |
---|
660 | |
---|
661 | return iSSE; |
---|
662 | } |
---|
663 | #if H_3D_VSO_EARLY_SKIP |
---|
664 | template <BlenMod iBM, Bool bBitInc> Void |
---|
665 | TRenSingleModelC<iBM,bBitInc>::setDepth( Int iViewPos, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData, const Pel* piOrgData, Int iOrgStride ) |
---|
666 | #else |
---|
667 | template <BlenMod iBM, Bool bBitInc> Void |
---|
668 | TRenSingleModelC<iBM,bBitInc>::setDepth( Int iViewPos, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData ) |
---|
669 | #endif |
---|
670 | { |
---|
671 | #if H_3D_VSO_EARLY_SKIP |
---|
672 | Bool bEarlySkip; |
---|
673 | #endif |
---|
674 | switch ( iViewPos ) |
---|
675 | { |
---|
676 | case 0: |
---|
677 | #if H_3D_VSO_EARLY_SKIP |
---|
678 | bEarlySkip = m_bEarlySkip ? xDetectEarlySkip<true>(iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData, piOrgData,iOrgStride) : false; |
---|
679 | if( !bEarlySkip ) |
---|
680 | { |
---|
681 | xRender<true, SET_SIMP>( iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData,true ); |
---|
682 | } |
---|
683 | #else |
---|
684 | xRender<true, SET_SIMP>( iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData ); |
---|
685 | #endif |
---|
686 | break; |
---|
687 | case 1: |
---|
688 | #if H_3D_VSO_EARLY_SKIP |
---|
689 | bEarlySkip = m_bEarlySkip ? xDetectEarlySkip<false>(iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData, piOrgData,iOrgStride) : false; |
---|
690 | if( !bEarlySkip ) |
---|
691 | { |
---|
692 | xRender<false, SET_SIMP>( iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData,true ); |
---|
693 | } |
---|
694 | #else |
---|
695 | xRender<false, SET_SIMP>( iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData ); |
---|
696 | #endif |
---|
697 | break; |
---|
698 | default: |
---|
699 | assert(0); |
---|
700 | } |
---|
701 | } |
---|
702 | |
---|
703 | template <BlenMod iBM, Bool bBitInc> Void |
---|
704 | TRenSingleModelC<iBM,bBitInc>::getSynthVideo( Int iViewPos, TComPicYuv* pcPicYuv ) |
---|
705 | { |
---|
706 | AOT( pcPicYuv->getWidth( COMPONENT_Y ) != m_iWidth ); |
---|
707 | AOT( pcPicYuv->getChromaFormat() != CHROMA_420 ); |
---|
708 | |
---|
709 | AOT( pcPicYuv->getHeight( COMPONENT_Y ) < m_iUsedHeight + m_iHorOffset ); |
---|
710 | |
---|
711 | #if H_3D_VSO_COLOR_PLANES |
---|
712 | Pel RenModelOutPels::* piText[3] = { NULL, NULL, NULL }; |
---|
713 | xGetSampleStrTextPtrs(iViewPos, piText[0], piText[1], piText[2]); |
---|
714 | |
---|
715 | // Temp image for chroma down sampling |
---|
716 | PelImage cTempImage( m_iWidth, m_iUsedHeight, 3, 0); |
---|
717 | |
---|
718 | Int aiStrides[3]; |
---|
719 | Pel* apiData [3]; |
---|
720 | |
---|
721 | cTempImage.getDataAndStrides( apiData, aiStrides ); |
---|
722 | |
---|
723 | for (UInt uiCurPlane = 0; uiCurPlane < 3; uiCurPlane++ ) |
---|
724 | { |
---|
725 | xCopyFromSampleStruct( m_pcOutputSamples, m_iOutputSamplesStride, piText[uiCurPlane], apiData[uiCurPlane], aiStrides[uiCurPlane] , m_iWidth, m_iUsedHeight); |
---|
726 | } |
---|
727 | xCopy2PicYuv( apiData, aiStrides, pcPicYuv ); |
---|
728 | #else |
---|
729 | Pel RenModelOutPels::* piY; |
---|
730 | xGetSampleStrTextPtrs(iViewPos, piY); |
---|
731 | xCopyFromSampleStruct( m_pcOutputSamples, m_iOutputSamplesStride, piY, pcPicYuv->getAddr(COMPONENT_Y) + m_iHorOffset * pcPicYuv->getStride(COMPONENT_Y), pcPicYuv->getStride(COMPONENT_Y), m_iWidth, m_iUsedHeight ); |
---|
732 | pcPicYuv->setChromaTo( 1 << (REN_BIT_DEPTH - 1) ); |
---|
733 | #endif |
---|
734 | } |
---|
735 | |
---|
736 | template <BlenMod iBM, Bool bBitInc> Void |
---|
737 | TRenSingleModelC<iBM,bBitInc>::getSynthDepth( Int iViewPos, TComPicYuv* pcPicYuv ) |
---|
738 | { |
---|
739 | AOT( iViewPos != 0 && iViewPos != 1); |
---|
740 | AOT( pcPicYuv->getWidth( COMPONENT_Y) != m_iWidth ); |
---|
741 | AOT( pcPicYuv->getChromaFormat( ) != CHROMA_420 ); |
---|
742 | AOT( pcPicYuv->getHeight( COMPONENT_Y ) < m_iUsedHeight + m_iHorOffset ); |
---|
743 | |
---|
744 | Pel RenModelOutPels::* piD = 0; |
---|
745 | xGetSampleStrDepthPtrs(iViewPos, piD); |
---|
746 | xCopyFromSampleStruct( m_pcOutputSamples, m_iOutputSamplesStride, piD, pcPicYuv->getAddr( COMPONENT_Y ) + pcPicYuv->getStride( COMPONENT_Y ) * m_iHorOffset, pcPicYuv->getStride( COMPONENT_Y ), m_iWidth, m_iUsedHeight ); |
---|
747 | pcPicYuv->setChromaTo( 1 << (REN_BIT_DEPTH - 1) ); |
---|
748 | } |
---|
749 | |
---|
750 | |
---|
751 | template <BlenMod iBM, Bool bBitInc> Void |
---|
752 | TRenSingleModelC<iBM,bBitInc>::getRefVideo ( Int iViewPos, TComPicYuv* pcPicYuv ) |
---|
753 | { |
---|
754 | AOT( pcPicYuv->getChromaFormat( ) != CHROMA_420 ); |
---|
755 | AOT( pcPicYuv->getWidth( COMPONENT_Y ) != m_iWidth ); |
---|
756 | AOT( pcPicYuv->getHeight( COMPONENT_Y ) < m_iUsedHeight + m_iHorOffset); |
---|
757 | |
---|
758 | #if H_3D_VSO_COLOR_PLANES |
---|
759 | Pel RenModelOutPels::* piText[3]; |
---|
760 | piText[0] = &RenModelOutPels::iYRef; |
---|
761 | piText[1] = &RenModelOutPels::iURef; |
---|
762 | piText[2] = &RenModelOutPels::iVRef; |
---|
763 | |
---|
764 | // Temp image for chroma down sampling |
---|
765 | |
---|
766 | PelImage cTempImage( m_iWidth, m_iUsedHeight, 3, 0); |
---|
767 | Int aiStrides[3]; |
---|
768 | Pel* apiData [3]; |
---|
769 | |
---|
770 | cTempImage.getDataAndStrides( apiData, aiStrides ); |
---|
771 | |
---|
772 | for (UInt uiCurPlane = 0; uiCurPlane < 3; uiCurPlane++ ) |
---|
773 | { |
---|
774 | xCopyFromSampleStruct( m_pcOutputSamples, m_iOutputSamplesStride, piText[uiCurPlane], apiData[uiCurPlane], aiStrides[uiCurPlane] , m_iWidth, m_iUsedHeight); |
---|
775 | } |
---|
776 | |
---|
777 | xCopy2PicYuv( apiData, aiStrides, pcPicYuv ); |
---|
778 | #else |
---|
779 | xCopyFromSampleStruct( m_pcOutputSamples, m_iOutputSamplesStride, &RenModelOutPels::iYRef, pcPicYuv->getAddr(COMPONENT_Y), pcPicYuv->getStride(COMPONENT_Y), m_iWidth, m_iUsedHeight ); |
---|
780 | pcPicYuv->setChromaTo( 1 << ( REN_BIT_DEPTH - 1 ) ); |
---|
781 | #endif |
---|
782 | } |
---|
783 | |
---|
784 | template <BlenMod iBM, Bool bBitInc> RMDist |
---|
785 | TRenSingleModelC<iBM,bBitInc>::getDistVideo( Int iViewPos, Int iPlane, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData ) |
---|
786 | { |
---|
787 | AOF(false); |
---|
788 | return 0; |
---|
789 | } |
---|
790 | |
---|
791 | template <BlenMod iBM, Bool bBitInc> Void |
---|
792 | TRenSingleModelC<iBM,bBitInc>::setVideo( Int iViewPos, Int iPlane, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData ) |
---|
793 | { |
---|
794 | AOF(false); |
---|
795 | } |
---|
796 | |
---|
797 | |
---|
798 | |
---|
799 | template <BlenMod iBM, Bool bBitInc> template<SetMod bSM> __inline Void |
---|
800 | TRenSingleModelC<iBM,bBitInc>::xSetViewRow( Int iPosY ) |
---|
801 | { |
---|
802 | m_pcInputSamplesRow[0] = m_pcInputSamples[0] + m_iInputSamplesStride * iPosY; |
---|
803 | m_pcInputSamplesRow[1] = m_pcInputSamples[1] + m_iInputSamplesStride * iPosY; |
---|
804 | if (bSM == SET_FULL || bSM == GET_FULL ) |
---|
805 | { |
---|
806 | m_pcOutputSamplesRow = m_pcOutputSamples + m_iOutputSamplesStride * iPosY; |
---|
807 | } |
---|
808 | else |
---|
809 | { |
---|
810 | m_pcLimOutputSamplesRow = m_pcLimOutputSamples + m_iOutputSamplesStride * iPosY; |
---|
811 | } |
---|
812 | } |
---|
813 | |
---|
814 | template <BlenMod iBM, Bool bBitInc> template<SetMod bSM> __inline Void |
---|
815 | TRenSingleModelC<iBM,bBitInc>::xIncViewRow( ) |
---|
816 | { |
---|
817 | m_pcInputSamplesRow[0] += m_iInputSamplesStride ; |
---|
818 | m_pcInputSamplesRow[1] += m_iInputSamplesStride ; |
---|
819 | |
---|
820 | if (bSM == SET_FULL || bSM == GET_FULL ) |
---|
821 | { |
---|
822 | m_pcOutputSamplesRow += m_iOutputSamplesStride; |
---|
823 | } |
---|
824 | else |
---|
825 | { |
---|
826 | m_pcLimOutputSamplesRow += m_iOutputSamplesStride; |
---|
827 | } |
---|
828 | } |
---|
829 | #if H_3D_VSO_EARLY_SKIP |
---|
830 | template <BlenMod iBM, Bool bBitInc> template<SetMod bSM> __inline RMDist |
---|
831 | TRenSingleModelC<iBM,bBitInc>::xGetSSE( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData, Bool bFast) |
---|
832 | #else |
---|
833 | template <BlenMod iBM, Bool bBitInc> template<SetMod bSM> __inline RMDist |
---|
834 | TRenSingleModelC<iBM,bBitInc>::xGetSSE( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData) |
---|
835 | #endif |
---|
836 | { |
---|
837 | const Int iCurViewPos = 0; |
---|
838 | const Int iOtherViewPos = 1; |
---|
839 | |
---|
840 | m_piNewDepthData = piNewData; |
---|
841 | m_iNewDataWidth = iWidth; |
---|
842 | m_iStartChangePosX = iStartPosX; |
---|
843 | |
---|
844 | if ((iWidth == 0) || (iHeight == 0)) |
---|
845 | return 0; |
---|
846 | |
---|
847 | xSetViewRow<bSM> ( iStartPosY); |
---|
848 | |
---|
849 | // Init Start |
---|
850 | RMDist iError = 0; |
---|
851 | Int iStartChangePos = m_iStartChangePosX; |
---|
852 | Int iEndChangePos = m_iStartChangePosX + iWidth - 1; |
---|
853 | |
---|
854 | for (Int iPosY = iStartPosY; iPosY < iStartPosY + iHeight; iPosY++ ) |
---|
855 | { |
---|
856 | Int iPosXinNewData = iWidth - 1; |
---|
857 | for ( Int iCurPosX = iEndChangePos; iCurPosX >= iStartChangePos; iCurPosX-- ) |
---|
858 | { |
---|
859 | Int iCurDepth = m_piNewDepthData[iPosXinNewData]; |
---|
860 | Int iOldDepth = m_pcInputSamplesRow[iCurViewPos][iCurPosX].iD; |
---|
861 | Int iDiff = (iCurDepth - iOldDepth); |
---|
862 | iError += iDiff * iDiff; |
---|
863 | iPosXinNewData--; |
---|
864 | } |
---|
865 | xIncViewRow<bSM>(); |
---|
866 | m_piNewDepthData += iStride; |
---|
867 | } |
---|
868 | return iError; |
---|
869 | } |
---|
870 | |
---|
871 | #if H_3D_VSO_EARLY_SKIP |
---|
872 | template <BlenMod iBM, Bool bBitInc> template<Bool bL, SetMod bSM> __inline RMDist |
---|
873 | TRenSingleModelC<iBM,bBitInc>::xRender( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData, Bool bFast) |
---|
874 | #else |
---|
875 | template <BlenMod iBM, Bool bBitInc> template<Bool bL, SetMod bSM> __inline RMDist |
---|
876 | TRenSingleModelC<iBM,bBitInc>::xRender( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData) |
---|
877 | #endif |
---|
878 | { |
---|
879 | const Int iCurViewPos = bL ? 0 : 1; |
---|
880 | |
---|
881 | m_piNewDepthData = piNewData; |
---|
882 | m_iNewDataWidth = iWidth; |
---|
883 | m_iStartChangePosX = iStartPosX; |
---|
884 | |
---|
885 | if ((iWidth == 0) || (iHeight == 0)) |
---|
886 | { |
---|
887 | return 0; |
---|
888 | } |
---|
889 | |
---|
890 | // Get Data |
---|
891 | m_ppiCurLUT = m_appiShiftLut [iCurViewPos]; |
---|
892 | xSetViewRow<bSM>( iStartPosY); |
---|
893 | |
---|
894 | // Init Start |
---|
895 | RMDist iError = 0; |
---|
896 | Int iStartChangePos; |
---|
897 | |
---|
898 | iStartChangePos = m_iStartChangePosX + ( bL ? 0 : (iWidth - 1)); |
---|
899 | |
---|
900 | for (Int iPosY = iStartPosY; iPosY < iStartPosY + iHeight; iPosY++ ) |
---|
901 | { |
---|
902 | #if H_3D_VSO_EARLY_SKIP |
---|
903 | if( m_bEarlySkip && bFast ) |
---|
904 | { |
---|
905 | if ( m_pbHorSkip[iPosY-iStartPosY] ) |
---|
906 | { |
---|
907 | xIncViewRow<bSM>(); |
---|
908 | m_piNewDepthData += iStride; |
---|
909 | continue; |
---|
910 | } |
---|
911 | } |
---|
912 | #endif |
---|
913 | m_bInOcclusion = false; |
---|
914 | |
---|
915 | Int iLastSPos; |
---|
916 | Int iEndChangePos = m_iStartChangePosX + ( bL ? (iWidth - 1) : 0 ) ; |
---|
917 | |
---|
918 | Int iEndChangePosInSubPel = iEndChangePos << m_iShiftPrec; |
---|
919 | Int iPosXinNewData = bL ? iWidth - 1 : 0; |
---|
920 | Int iMinChangedSPos = bL ? m_iSampledWidth : -1; |
---|
921 | if ( iEndChangePos == xWidthMinus1<bL>() ) |
---|
922 | { |
---|
923 | m_iCurDepth = m_piNewDepthData[iPosXinNewData]; |
---|
924 | Int iCurSPos = xShiftDept(iEndChangePosInSubPel, m_iCurDepth ); |
---|
925 | |
---|
926 | m_curRangeStart = xRangeLeft<bL>( iCurSPos ); |
---|
927 | xExtrapolateMargin<bL, bSM> ( iCurSPos, iEndChangePos, iError ); |
---|
928 | |
---|
929 | Int iOldDepth = m_pcInputSamplesRow[iCurViewPos][iEndChangePos].iD; |
---|
930 | iMinChangedSPos = xMin<Int, bL>( ( iOldDepth <= m_iCurDepth ) ? iCurSPos : xShiftDept(iEndChangePosInSubPel, iOldDepth ), iMinChangedSPos); |
---|
931 | iLastSPos = iCurSPos; |
---|
932 | m_lastRangeStart = m_curRangeStart; |
---|
933 | m_iLastDepth = m_iCurDepth; |
---|
934 | m_iLastOccludedSPos = iLastSPos; |
---|
935 | |
---|
936 | if ( bSM == SET_FULL || bSM == SET_SIMP ) |
---|
937 | { |
---|
938 | m_pcInputSamplesRow[iCurViewPos][iEndChangePos].iD = m_piNewDepthData[iPosXinNewData]; |
---|
939 | } |
---|
940 | |
---|
941 | xDec<Int, bL>(iPosXinNewData); |
---|
942 | xDec<Int, bL>(iEndChangePos); |
---|
943 | } |
---|
944 | else |
---|
945 | { |
---|
946 | m_iLastDepth = m_pcInputSamplesRow [iCurViewPos][xPlus<Int,bL>(iEndChangePos,1)].iD; |
---|
947 | iLastSPos = xShiftDept(xPlus<Int,bL>(iEndChangePosInSubPel, ( 1 << m_iShiftPrec ) ), m_iLastDepth ); |
---|
948 | xInitRenderPart<bL>( iEndChangePos, iLastSPos ); |
---|
949 | } |
---|
950 | |
---|
951 | //// RENDER NEW DATA |
---|
952 | Int iCurPosX; |
---|
953 | for ( iCurPosX = iEndChangePos; xGeQ<Int,bL>(iCurPosX,iStartChangePos); xDec<Int,bL>(iCurPosX)) |
---|
954 | { |
---|
955 | Int iCurPosXInSubPel = iCurPosX << m_iShiftPrec; |
---|
956 | m_iCurDepth = m_piNewDepthData[iPosXinNewData] ; |
---|
957 | Int iCurSPos = xShiftDept(iCurPosXInSubPel,m_iCurDepth); |
---|
958 | |
---|
959 | Int iOldDepth = m_pcInputSamplesRow[iCurViewPos][iCurPosX].iD; |
---|
960 | iMinChangedSPos = xMin<Int,bL>( ( iOldDepth <= m_iCurDepth ) ? iCurSPos : xShiftDept(iCurPosXInSubPel, iOldDepth ), iMinChangedSPos); |
---|
961 | |
---|
962 | xRenderRange<bL,bSM>(iCurSPos, iLastSPos, iCurPosX, iError ); |
---|
963 | iLastSPos = iCurSPos; |
---|
964 | m_iLastDepth = m_iCurDepth; |
---|
965 | |
---|
966 | if ( bSM == SET_FULL || bSM == SET_SIMP ) |
---|
967 | { |
---|
968 | m_pcInputSamplesRow[iCurViewPos][iCurPosX].iD = m_piNewDepthData[iPosXinNewData]; |
---|
969 | } |
---|
970 | xDec<Int,bL>(iPosXinNewData); |
---|
971 | } |
---|
972 | |
---|
973 | //// RE-RENDER DATA LEFT TO NEW DATA |
---|
974 | |
---|
975 | while ( xGeQ<Int,bL>(iCurPosX, xZero<bL>() ) ) |
---|
976 | { |
---|
977 | Int iCurPosXInSubPel = iCurPosX << m_iShiftPrec; |
---|
978 | m_iCurDepth = m_pcInputSamplesRow[iCurViewPos][iCurPosX].iD; |
---|
979 | Int iCurSPos = xShiftDept(iCurPosXInSubPel,m_iCurDepth); |
---|
980 | xRenderRange<bL,bSM>( iCurSPos, iLastSPos, iCurPosX, iError ); |
---|
981 | if ( xLess<Int,bL>(iCurSPos,iMinChangedSPos) ) |
---|
982 | { |
---|
983 | break; |
---|
984 | } |
---|
985 | |
---|
986 | xDec<Int,bL>(iCurPosX); |
---|
987 | iLastSPos = iCurSPos; |
---|
988 | m_iLastDepth = m_iCurDepth; |
---|
989 | } |
---|
990 | |
---|
991 | |
---|
992 | |
---|
993 | |
---|
994 | xIncViewRow<bSM>(); |
---|
995 | m_piNewDepthData += iStride; |
---|
996 | } |
---|
997 | return iError; |
---|
998 | } |
---|
999 | |
---|
1000 | template <BlenMod iBM, Bool bBitInc> template<Bool bL> __inline Void |
---|
1001 | TRenSingleModelC<iBM,bBitInc>::xInitRenderPart( Int iEndChangePos, Int iLastSPos ) |
---|
1002 | { |
---|
1003 | const Int iCurViewPos = bL ? 0 : 1; |
---|
1004 | m_iLastOccludedSPos = m_pcInputSamplesRow[iCurViewPos][ xPlus<Int,bL>(iEndChangePos,1) ].aiOccludedPos; |
---|
1005 | m_bInOcclusion = xGeQ<Int,bL>( iLastSPos, m_iLastOccludedSPos ); |
---|
1006 | |
---|
1007 | if( m_bInOcclusion ) |
---|
1008 | { |
---|
1009 | m_lastRangeStart = xRound<bL>( m_iLastOccludedSPos ); |
---|
1010 | } |
---|
1011 | else |
---|
1012 | { |
---|
1013 | m_iLastOccludedSPos = iLastSPos; |
---|
1014 | m_lastRangeStart = xRangeLeft<bL>( iLastSPos ); |
---|
1015 | } |
---|
1016 | }; |
---|
1017 | |
---|
1018 | template <BlenMod iBM, Bool bBitInc> template<Bool bL, SetMod bSM> __inline Void |
---|
1019 | TRenSingleModelC<iBM,bBitInc>::xRenderShiftedRange(Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError ) |
---|
1020 | { |
---|
1021 | RM_AOF( (xGeQ<Int,bL>(iLastSPos,iCurSPos)) ); |
---|
1022 | Int iDeltaSPos = bL ? iLastSPos - iCurSPos : iCurSPos - iLastSPos; |
---|
1023 | |
---|
1024 | m_curRangeStart = xRangeLeft<bL>( iCurSPos ); |
---|
1025 | if ( iDeltaSPos > m_iGapTolerance ) |
---|
1026 | { |
---|
1027 | xFillHole<bL,bSM>( iCurSPos, iLastSPos, iCurPos, riError ); |
---|
1028 | } |
---|
1029 | else |
---|
1030 | { |
---|
1031 | if (!xGeQ<Int,bL>(iLastSPos, bL ? 0 : ( m_iSampledWidth - 1) )) |
---|
1032 | { |
---|
1033 | return; |
---|
1034 | } |
---|
1035 | |
---|
1036 | RM_AOT( iDeltaSPos > m_iGapTolerance ); |
---|
1037 | |
---|
1038 | m_iThisDepth = m_iCurDepth; |
---|
1039 | |
---|
1040 | for (Int iFillSPos = xMax<Int,bL>(xZero<bL>(), m_curRangeStart ); xLess<Int,bL>(iFillSPos,m_lastRangeStart); xInc<Int,bL>(iFillSPos)) |
---|
1041 | { |
---|
1042 | Int iDeltaCurSPos = (iFillSPos << m_iShiftPrec) - (bL ? iCurSPos : iLastSPos); |
---|
1043 | |
---|
1044 | RM_AOT( iDeltaCurSPos > iDeltaSPos ); |
---|
1045 | RM_AOT( iDeltaCurSPos < 0 ); |
---|
1046 | RM_AOT( m_aaiSubPelShiftL[iDeltaSPos][iDeltaCurSPos] == 0xdeaddead); |
---|
1047 | |
---|
1048 | xSetShiftedPel<bL, bSM>( iCurPos, m_aaiSubPelShiftL[iDeltaSPos][iDeltaCurSPos], iFillSPos, REN_IS_FILLED, riError ); |
---|
1049 | } |
---|
1050 | }; |
---|
1051 | m_lastRangeStart = m_curRangeStart; |
---|
1052 | } |
---|
1053 | |
---|
1054 | template <BlenMod iBM, Bool bBitInc> template<Bool bL, SetMod bSM> __inline Void |
---|
1055 | TRenSingleModelC<iBM,bBitInc>::xRenderRange(Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError ) |
---|
1056 | { |
---|
1057 | const Int iCurViewPos = bL ? 0 : 1; |
---|
1058 | |
---|
1059 | if ( bSM == SET_FULL || bSM == SET_SIMP ) |
---|
1060 | { |
---|
1061 | m_pcInputSamplesRow[iCurViewPos][ iCurPos ].aiOccludedPos = m_iLastOccludedSPos; |
---|
1062 | } |
---|
1063 | |
---|
1064 | if ( xLess<Int,bL>(iCurSPos,m_iLastOccludedSPos )) |
---|
1065 | { |
---|
1066 | m_bInOcclusion = false; |
---|
1067 | m_iLastOccludedSPos = iCurSPos; |
---|
1068 | xRenderShiftedRange<bL,bSM>(iCurSPos, iLastSPos, iCurPos, riError ); |
---|
1069 | } |
---|
1070 | else |
---|
1071 | { |
---|
1072 | if ( !m_bInOcclusion ) |
---|
1073 | { |
---|
1074 | RM_AOF( (xGeQ<Int,bL>(iLastSPos, m_iLastOccludedSPos)) ); |
---|
1075 | Int iRightSPosFP = xRound<bL>( iLastSPos ); |
---|
1076 | if ( ( iRightSPosFP == xPlus<Int,bL>(m_lastRangeStart, -1) ) && xGeQ<Int,bL>(iRightSPosFP, xZero<bL>()) ) |
---|
1077 | { |
---|
1078 | m_iThisDepth = m_iLastDepth; |
---|
1079 | xSetShiftedPel<bL, bSM>( xPlus<Int,bL>(iCurPos,1), bL ? 0 : (1 << m_iShiftPrec), iRightSPosFP, REN_IS_FILLED, riError ); |
---|
1080 | } |
---|
1081 | m_lastRangeStart = iRightSPosFP; |
---|
1082 | m_bInOcclusion = true; |
---|
1083 | } |
---|
1084 | } |
---|
1085 | } |
---|
1086 | |
---|
1087 | template <BlenMod iBM, Bool bBitInc> template<Bool bL, SetMod bSM> __inline Void |
---|
1088 | TRenSingleModelC<iBM,bBitInc>::xFillHole( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError ) |
---|
1089 | { |
---|
1090 | if (iLastSPos < 0) |
---|
1091 | { |
---|
1092 | return; |
---|
1093 | } |
---|
1094 | |
---|
1095 | Int iStartFillSPos = iCurSPos; |
---|
1096 | Int iStartFillPos = iCurPos; |
---|
1097 | Int iLastPos = xPlus<Int,bL>( iCurPos,1); |
---|
1098 | |
---|
1099 | Int iStartFillSPosFP = m_curRangeStart; |
---|
1100 | if (iStartFillSPosFP == xRound<bL>(iStartFillSPos)) |
---|
1101 | { |
---|
1102 | if ( xGeQ<Int,bL>(iStartFillSPosFP, xZero<bL>()) && xLess<Int,bL>(iStartFillSPosFP, m_lastRangeStart) ) |
---|
1103 | { |
---|
1104 | m_iThisDepth = m_iCurDepth; |
---|
1105 | xSetShiftedPel<bL, bSM> ( iStartFillPos, bL ? 0 : ( 1 << m_iShiftPrec), iStartFillSPosFP, REN_IS_FILLED, riError ); |
---|
1106 | } |
---|
1107 | } |
---|
1108 | else |
---|
1109 | { |
---|
1110 | xDec<Int,bL>( iStartFillSPosFP ); |
---|
1111 | } |
---|
1112 | |
---|
1113 | m_iThisDepth = m_iLastDepth; |
---|
1114 | for (Int iFillSPos = xMax<Int,bL>(xPlus<Int,bL>(iStartFillSPosFP,1),xZero<bL>()); xLess<Int,bL>(iFillSPos, m_lastRangeStart); xInc<Int,bL>(iFillSPos)) |
---|
1115 | { |
---|
1116 | xSetShiftedPel<bL, bSM>( iLastPos, bL ? 0 : (1 << m_iShiftPrec), iFillSPos, REN_IS_HOLE, riError ); |
---|
1117 | } |
---|
1118 | } |
---|
1119 | |
---|
1120 | template <BlenMod iBM, Bool bBitInc> template<Bool bL, SetMod bSM> __inline Void |
---|
1121 | TRenSingleModelC<iBM,bBitInc>::xExtrapolateMargin(Int iCurSPos, Int iCurPos, RMDist& riError ) |
---|
1122 | { |
---|
1123 | Int iSPosFullPel = xMax<Int,bL>(xZero<bL>(),m_curRangeStart); |
---|
1124 | |
---|
1125 | m_iThisDepth = m_iCurDepth; |
---|
1126 | if ( xGeQ<Int,bL>(xWidthMinus1<bL>(), iSPosFullPel) ) |
---|
1127 | { |
---|
1128 | xSetShiftedPel<bL, bSM>( iCurPos, bL ? 0 : (1 << m_iShiftPrec) , iSPosFullPel, REN_IS_FILLED, riError ); |
---|
1129 | } |
---|
1130 | for (Int iFillSPos = xPlus<Int,bL>(iSPosFullPel ,1); xGeQ<Int,bL>( xWidthMinus1<bL>(), iFillSPos ); xInc<Int,bL>(iFillSPos)) |
---|
1131 | { |
---|
1132 | xSetShiftedPel<bL, bSM>( iCurPos, bL ? 0 : ( 1 << m_iShiftPrec ), iFillSPos, REN_IS_HOLE, riError ); |
---|
1133 | } |
---|
1134 | } |
---|
1135 | |
---|
1136 | template <BlenMod iBM, Bool bBitInc> template <Bool bL> __inline Int |
---|
1137 | TRenSingleModelC<iBM,bBitInc>::xShiftNewData( Int iPosX, Int iPosInNewData ) |
---|
1138 | { |
---|
1139 | RM_AOT( iPosInNewData < 0 ); |
---|
1140 | RM_AOF( iPosInNewData < m_iNewDataWidth ); |
---|
1141 | return (iPosX << m_iShiftPrec) - m_ppiCurLUT[0][ RenModRemoveBitInc( m_piNewDepthData[iPosInNewData] )]; |
---|
1142 | } |
---|
1143 | |
---|
1144 | |
---|
1145 | template <BlenMod iBM, Bool bBitInc> __inline Int |
---|
1146 | TRenSingleModelC<iBM,bBitInc>::xShiftDept( Int iPosXinSubPel, Int iDepth ) |
---|
1147 | { |
---|
1148 | return (iPosXinSubPel) - m_ppiCurLUT[0][ RenModRemoveBitInc( iDepth )]; |
---|
1149 | } |
---|
1150 | |
---|
1151 | |
---|
1152 | template <BlenMod iBM, Bool bBitInc> template <Bool bL> __inline Int |
---|
1153 | TRenSingleModelC<iBM,bBitInc>::xShift( Int iPosX ) |
---|
1154 | { |
---|
1155 | RM_AOT( iPosX < 0); |
---|
1156 | RM_AOF( iPosX < m_iWidth); |
---|
1157 | return (iPosX << m_iShiftPrec) - m_ppiCurLUT[0][ RenModRemoveBitInc( m_pcInputSamplesRow[(bL ? 0 : 1)][iPosX].iD )]; |
---|
1158 | } |
---|
1159 | |
---|
1160 | |
---|
1161 | template <BlenMod iBM, Bool bBitInc> template <Bool bL> __inline Int |
---|
1162 | TRenSingleModelC<iBM,bBitInc>::xShift( Int iPos, Int iPosInNewData ) |
---|
1163 | { |
---|
1164 | if ( (iPosInNewData >= 0) && (iPosInNewData < m_iNewDataWidth) ) |
---|
1165 | { |
---|
1166 | return xShiftNewData(iPos ,iPosInNewData ); |
---|
1167 | } |
---|
1168 | else |
---|
1169 | { |
---|
1170 | return xShift<bL>(iPos); |
---|
1171 | } |
---|
1172 | } |
---|
1173 | |
---|
1174 | template <BlenMod iBM, Bool bBitInc> template<Bool bL> __inline Int |
---|
1175 | TRenSingleModelC<iBM,bBitInc>::xRangeLeft( Int iPos ) |
---|
1176 | { |
---|
1177 | if ( bL ) |
---|
1178 | { |
---|
1179 | return ( iPos + (1 << m_iShiftPrec) - 1) >> m_iShiftPrec; |
---|
1180 | } |
---|
1181 | else |
---|
1182 | { |
---|
1183 | return iPos >> m_iShiftPrec; |
---|
1184 | } |
---|
1185 | } |
---|
1186 | |
---|
1187 | |
---|
1188 | |
---|
1189 | template <BlenMod iBM, Bool bBitInc> template<Bool bL> __inline Int |
---|
1190 | TRenSingleModelC<iBM,bBitInc>::xRangeRight( Int iPos ) |
---|
1191 | { |
---|
1192 | if ( bL ) |
---|
1193 | { |
---|
1194 | return xRangeLeft<true>(iPos) - 1; |
---|
1195 | } |
---|
1196 | else |
---|
1197 | { |
---|
1198 | return xRangeLeft<false>( iPos ) + 1; |
---|
1199 | } |
---|
1200 | } |
---|
1201 | |
---|
1202 | template <BlenMod iBM, Bool bBitInc> template<Bool bL> __inline Int |
---|
1203 | TRenSingleModelC<iBM,bBitInc>::xRound( Int iPos ) |
---|
1204 | { |
---|
1205 | if( bL ) |
---|
1206 | { |
---|
1207 | return (iPos + (( 1 << m_iShiftPrec ) >> 1 )) >> m_iShiftPrec; |
---|
1208 | } |
---|
1209 | else |
---|
1210 | { |
---|
1211 | return (m_iShiftPrec == 0) ? iPos : xRound<true>(iPos - 1); |
---|
1212 | } |
---|
1213 | } |
---|
1214 | |
---|
1215 | |
---|
1216 | template <BlenMod iBM, Bool bBitInc> Void |
---|
1217 | TRenSingleModelC<iBM,bBitInc>::xSetPels( Pel* piPelSource , Int iSourceStride, Int iWidth, Int iHeight, Pel iVal ) |
---|
1218 | { |
---|
1219 | for (Int iYPos = 0; iYPos < iHeight; iYPos++) |
---|
1220 | { |
---|
1221 | for (Int iXPos = 0; iXPos < iWidth; iXPos++) |
---|
1222 | { |
---|
1223 | piPelSource[iXPos] = iVal; |
---|
1224 | } |
---|
1225 | piPelSource += iSourceStride; |
---|
1226 | } |
---|
1227 | } |
---|
1228 | |
---|
1229 | template <BlenMod iBM, Bool bBitInc> Void |
---|
1230 | TRenSingleModelC<iBM,bBitInc>::xSetInts( Int* piPelSource , Int iSourceStride, Int iWidth, Int iHeight, Int iVal ) |
---|
1231 | { |
---|
1232 | for (Int iYPos = 0; iYPos < iHeight; iYPos++) |
---|
1233 | { |
---|
1234 | for (Int iXPos = 0; iXPos < iWidth; iXPos++) |
---|
1235 | { |
---|
1236 | piPelSource[iXPos] = iVal; |
---|
1237 | } |
---|
1238 | piPelSource += iSourceStride; |
---|
1239 | } |
---|
1240 | } |
---|
1241 | |
---|
1242 | |
---|
1243 | template <BlenMod iBM, Bool bBitInc> Void |
---|
1244 | TRenSingleModelC<iBM,bBitInc>::xSetBools( Bool* pbPelSource , Int iSourceStride, Int iWidth, Int iHeight, Bool bVal ) |
---|
1245 | { |
---|
1246 | for (Int iYPos = 0; iYPos < iHeight; iYPos++) |
---|
1247 | { |
---|
1248 | for (Int iXPos = 0; iXPos < iWidth; iXPos++) |
---|
1249 | { |
---|
1250 | pbPelSource[iXPos] = bVal; |
---|
1251 | } |
---|
1252 | pbPelSource += iSourceStride; |
---|
1253 | } |
---|
1254 | } |
---|
1255 | |
---|
1256 | template <BlenMod iBM, Bool bBitInc> template<Bool bL, SetMod bSM> __inline Void |
---|
1257 | TRenSingleModelC<iBM,bBitInc>::xSetShiftedPel(Int iSourcePos, Int iSubSourcePos, Int iTargetSPos, Pel iFilled, RMDist& riError ) |
---|
1258 | { |
---|
1259 | RM_AOT( iSourcePos < 0 ); |
---|
1260 | RM_AOT( iSourcePos >= m_iWidth ); |
---|
1261 | RM_AOT( iSubSourcePos < 0 ); |
---|
1262 | RM_AOT( iSubSourcePos > (1 << m_iShiftPrec) ); |
---|
1263 | RM_AOT( iTargetSPos < 0 ); |
---|
1264 | RM_AOT( iTargetSPos >= m_iWidth ); |
---|
1265 | |
---|
1266 | RenModelInPels * pcInSample = m_pcInputSamplesRow[ bL ? VIEWPOS_LEFT : VIEWPOS_RIGHT ] + iSourcePos ; |
---|
1267 | |
---|
1268 | Pel iY; |
---|
1269 | Pel iYCurNew = pcInSample->aiY[iSubSourcePos]; |
---|
1270 | #if H_3D_VSO_COLOR_PLANES |
---|
1271 | Pel iU; |
---|
1272 | Pel iUCurNew = pcInSample->aiU[iSubSourcePos]; |
---|
1273 | Pel iV; |
---|
1274 | Pel iVCurNew = pcInSample->aiV[iSubSourcePos];; |
---|
1275 | #endif |
---|
1276 | |
---|
1277 | const Bool bFullMode = ( bSM == GET_FULL || bSM == SET_FULL ); |
---|
1278 | |
---|
1279 | RenModelOutPels* pcOutSample = bFullMode ? ( m_pcOutputSamplesRow + iTargetSPos ) : NULL; |
---|
1280 | RenModelLimOutPels* pcLimOutSample = bFullMode ? NULL : ( m_pcLimOutputSamplesRow + iTargetSPos ); |
---|
1281 | |
---|
1282 | if ( iBM == BLEND_NONE ) |
---|
1283 | { |
---|
1284 | iY = iYCurNew; |
---|
1285 | #if H_3D_VSO_COLOR_PLANES |
---|
1286 | iU = iUCurNew; |
---|
1287 | iV = iVCurNew; |
---|
1288 | #endif |
---|
1289 | } |
---|
1290 | else |
---|
1291 | { |
---|
1292 | Pel iYOther = bFullMode ? ( bL ? pcOutSample->iYRight : pcOutSample->iYLeft) : pcLimOutSample->iYOther; |
---|
1293 | #if H_3D_VSO_COLOR_PLANES |
---|
1294 | Pel iUOther = bFullMode ? ( bL ? pcOutSample->iURight : pcOutSample->iULeft ) : pcLimOutSample->iUOther; |
---|
1295 | Pel iVOther = bFullMode ? ( bL ? pcOutSample->iVRight : pcOutSample->iVLeft ) : pcLimOutSample->iVOther; |
---|
1296 | #endif |
---|
1297 | Int iFilledOther = bFullMode ? ( bL ? pcOutSample->iFilledRight : pcOutSample->iFilledLeft ) : pcLimOutSample->iFilledOther; |
---|
1298 | Pel iDOther = bFullMode ? ( bL ? pcOutSample->iDRight : pcOutSample->iDLeft ) : pcLimOutSample->iDOther; |
---|
1299 | |
---|
1300 | xGetBlendedValue<bL, bSM>( |
---|
1301 | iY, |
---|
1302 | bL ? iYCurNew : iYOther, |
---|
1303 | bL ? iYOther : iYCurNew, |
---|
1304 | #if H_3D_VSO_COLOR_PLANES |
---|
1305 | iU, |
---|
1306 | bL ? iUCurNew : iUOther, |
---|
1307 | bL ? iUOther : iUCurNew, |
---|
1308 | iV, |
---|
1309 | bL ? iVCurNew : iVOther, |
---|
1310 | bL ? iVOther : iVCurNew, |
---|
1311 | #endif |
---|
1312 | bL ? iFilled : iFilledOther, |
---|
1313 | bL ? iFilledOther : iFilled, |
---|
1314 | m_piInvZLUTLeft [RenModRemoveBitInc( bL ? m_iThisDepth : iDOther)], |
---|
1315 | m_piInvZLUTRight[RenModRemoveBitInc( bL ? iDOther : m_iThisDepth)] |
---|
1316 | ); |
---|
1317 | } |
---|
1318 | |
---|
1319 | |
---|
1320 | Int iDist = xGetDist( |
---|
1321 | iY - ( bFullMode ? pcOutSample->iYRef : pcLimOutSample->iYRef ) |
---|
1322 | #if H_3D_VSO_COLOR_PLANES |
---|
1323 | , iU - ( bFullMode ? pcOutSample->iURef : pcLimOutSample->iURef ) |
---|
1324 | , iV - ( bFullMode ? pcOutSample->iVRef : pcLimOutSample->iVRef ) |
---|
1325 | #endif |
---|
1326 | ); |
---|
1327 | |
---|
1328 | if ( bSM == GET_FULL || bSM == GET_SIMP ) |
---|
1329 | { |
---|
1330 | riError += ( iDist - ( bFullMode ? pcOutSample->iError : pcLimOutSample->iError ) ); |
---|
1331 | } |
---|
1332 | else // bSM == SET_FULL |
---|
1333 | { |
---|
1334 | Int& riErrorStr = bFullMode ? pcOutSample->iError : pcLimOutSample->iError; |
---|
1335 | riErrorStr = iDist; |
---|
1336 | |
---|
1337 | if ( bFullMode ) |
---|
1338 | { |
---|
1339 | if ( iBM != BLEND_NONE ) |
---|
1340 | { |
---|
1341 | pcOutSample->iYBlended = iY; |
---|
1342 | #if H_3D_VSO_COLOR_PLANES |
---|
1343 | pcOutSample->iUBlended = iU; |
---|
1344 | pcOutSample->iVBlended = iV; |
---|
1345 | #endif |
---|
1346 | } |
---|
1347 | |
---|
1348 | if ( bL ) |
---|
1349 | { |
---|
1350 | pcOutSample->iDLeft = m_iThisDepth; |
---|
1351 | pcOutSample->iFilledLeft = iFilled; |
---|
1352 | pcOutSample->iYLeft = iYCurNew; |
---|
1353 | #if H_3D_VSO_COLOR_PLANES |
---|
1354 | pcOutSample->iULeft = iUCurNew; |
---|
1355 | pcOutSample->iVLeft = iVCurNew; |
---|
1356 | #endif |
---|
1357 | } |
---|
1358 | else |
---|
1359 | { |
---|
1360 | pcOutSample->iDRight = m_iThisDepth; |
---|
1361 | pcOutSample->iFilledRight = iFilled; |
---|
1362 | pcOutSample->iYRight = iYCurNew; |
---|
1363 | #if H_3D_VSO_COLOR_PLANES |
---|
1364 | pcOutSample->iURight = iUCurNew; |
---|
1365 | pcOutSample->iVRight = iVCurNew; |
---|
1366 | #endif |
---|
1367 | } |
---|
1368 | } |
---|
1369 | } |
---|
1370 | } |
---|
1371 | |
---|
1372 | template <BlenMod iBM, Bool bBitInc> __inline Int |
---|
1373 | TRenSingleModelC<iBM,bBitInc>::xGetDist( Int iDiffY, Int iDiffU, Int iDiffV ) |
---|
1374 | { |
---|
1375 | |
---|
1376 | if ( !bBitInc ) |
---|
1377 | { |
---|
1378 | return ( (iDiffY * iDiffY ) |
---|
1379 | + ((( (iDiffU * iDiffU ) |
---|
1380 | +(iDiffV * iDiffV ) |
---|
1381 | ) |
---|
1382 | ) >> 2 |
---|
1383 | ) |
---|
1384 | ); |
---|
1385 | } |
---|
1386 | else |
---|
1387 | { |
---|
1388 | return ( ((iDiffY * iDiffY) >> m_iDistShift) |
---|
1389 | + ((( ((iDiffU * iDiffU) >> m_iDistShift) |
---|
1390 | +((iDiffV * iDiffV) >> m_iDistShift) |
---|
1391 | ) |
---|
1392 | ) >> 2 |
---|
1393 | ) |
---|
1394 | ); |
---|
1395 | |
---|
1396 | } |
---|
1397 | } |
---|
1398 | |
---|
1399 | template <BlenMod iBM, Bool bBitInc> __inline Int |
---|
1400 | TRenSingleModelC<iBM,bBitInc>::xGetDist( Int iDiffY ) |
---|
1401 | { |
---|
1402 | if ( !bBitInc ) |
---|
1403 | { |
---|
1404 | return (iDiffY * iDiffY); |
---|
1405 | } |
---|
1406 | else |
---|
1407 | { |
---|
1408 | return ((iDiffY * iDiffY) >> m_iDistShift); |
---|
1409 | } |
---|
1410 | |
---|
1411 | } |
---|
1412 | |
---|
1413 | |
---|
1414 | |
---|
1415 | template <BlenMod iBM, Bool bBitInc> template< Bool bL, SetMod bSM > __inline Void |
---|
1416 | TRenSingleModelC<iBM,bBitInc>::xGetBlendedValue( Pel& riY, Pel iYL, Pel iYR, |
---|
1417 | #if H_3D_VSO_COLOR_PLANES |
---|
1418 | Pel& riU, Pel iUL, Pel iUR, Pel& riV, Pel iVL, Pel iVR, |
---|
1419 | #endif |
---|
1420 | Int iFilledL, Int iFilledR, Pel iDepthL, Pel iDepthR ) |
---|
1421 | { |
---|
1422 | RM_AOT( iBM != BLEND_AVRG && iBM != BLEND_LEFT && iBM != BLEND_RIGHT ); |
---|
1423 | |
---|
1424 | if (iBM != BLEND_AVRG ) |
---|
1425 | { |
---|
1426 | if (iBM == BLEND_LEFT ) |
---|
1427 | { |
---|
1428 | xGetBlendedValueBM1<bL, bSM>( riY, iYL, iYR, |
---|
1429 | #if H_3D_VSO_COLOR_PLANES |
---|
1430 | riU, iUL, iUR, riV, iVL, iVR, |
---|
1431 | #endif |
---|
1432 | iFilledL, iFilledR, iDepthL, iDepthR ); |
---|
1433 | } |
---|
1434 | else |
---|
1435 | { |
---|
1436 | xGetBlendedValueBM2<bL, bSM>( riY, iYL, iYR, |
---|
1437 | #if H_3D_VSO_COLOR_PLANES |
---|
1438 | riU, iUL, iUR, riV, iVL, iVR, |
---|
1439 | #endif |
---|
1440 | iFilledL, iFilledR, iDepthL, iDepthR ); |
---|
1441 | } |
---|
1442 | return; |
---|
1443 | } |
---|
1444 | |
---|
1445 | if ( (iFilledL != REN_IS_HOLE ) && ( iFilledR != REN_IS_HOLE) ) |
---|
1446 | { |
---|
1447 | Int iDepthDifference = iDepthR - iDepthL; |
---|
1448 | |
---|
1449 | if ( abs ( iDepthDifference ) <= m_iBlendZThres ) |
---|
1450 | { |
---|
1451 | { |
---|
1452 | riY = xBlend( iYL, iYR, m_iBlendDistWeight ); |
---|
1453 | #if H_3D_VSO_COLOR_PLANES |
---|
1454 | riU = xBlend( iUL, iUR, m_iBlendDistWeight ); |
---|
1455 | riV = xBlend( iVL, iVR, m_iBlendDistWeight ); |
---|
1456 | #endif |
---|
1457 | } |
---|
1458 | } |
---|
1459 | else if ( iDepthDifference < 0 ) |
---|
1460 | { |
---|
1461 | riY = iYL; |
---|
1462 | #if H_3D_VSO_COLOR_PLANES |
---|
1463 | riU = iUL; |
---|
1464 | riV = iVL; |
---|
1465 | #endif |
---|
1466 | } |
---|
1467 | else |
---|
1468 | { |
---|
1469 | riY = iYR; |
---|
1470 | #if H_3D_VSO_COLOR_PLANES |
---|
1471 | riU = iUR; |
---|
1472 | riV = iVR; |
---|
1473 | #endif |
---|
1474 | } |
---|
1475 | } |
---|
1476 | else if ( (iFilledL == REN_IS_HOLE) && (iFilledR == REN_IS_HOLE)) |
---|
1477 | { |
---|
1478 | if ( iDepthR < iDepthL ) |
---|
1479 | { |
---|
1480 | riY = iYR; |
---|
1481 | #if H_3D_VSO_COLOR_PLANES |
---|
1482 | riU = iUR; |
---|
1483 | riV = iVR; |
---|
1484 | #endif |
---|
1485 | } |
---|
1486 | else |
---|
1487 | { |
---|
1488 | riY = iYL; |
---|
1489 | #if H_3D_VSO_COLOR_PLANES |
---|
1490 | riU = iUL; |
---|
1491 | riV = iVL; |
---|
1492 | #endif |
---|
1493 | } |
---|
1494 | } |
---|
1495 | else |
---|
1496 | { |
---|
1497 | if (iFilledR == REN_IS_HOLE) |
---|
1498 | { |
---|
1499 | riY = iYL; |
---|
1500 | #if H_3D_VSO_COLOR_PLANES |
---|
1501 | riU = iUL; |
---|
1502 | riV = iVL; |
---|
1503 | #endif |
---|
1504 | } |
---|
1505 | else |
---|
1506 | { |
---|
1507 | riY = iYR; |
---|
1508 | #if H_3D_VSO_COLOR_PLANES |
---|
1509 | riU = iUR; |
---|
1510 | riV = iVR; |
---|
1511 | #endif |
---|
1512 | } |
---|
1513 | } |
---|
1514 | } |
---|
1515 | |
---|
1516 | template <BlenMod iBM, Bool bBitInc> template< Bool bL, SetMod SM > __inline Void |
---|
1517 | TRenSingleModelC<iBM,bBitInc>::xGetBlendedValueBM1( Pel& riY, Pel iYL, Pel iYR, |
---|
1518 | #if H_3D_VSO_COLOR_PLANES |
---|
1519 | Pel& riU, Pel iUL, Pel iUR, Pel& riV, Pel iVL, Pel iVR, |
---|
1520 | #endif |
---|
1521 | Int iFilledL, Int iFilledR, Pel iDepthL, Pel iDepthR ) |
---|
1522 | { |
---|
1523 | if ( iFilledL == REN_IS_FILLED || iFilledR == REN_IS_HOLE ) |
---|
1524 | { |
---|
1525 | riY = iYL; |
---|
1526 | #if H_3D_VSO_COLOR_PLANES |
---|
1527 | riU = iUL; |
---|
1528 | riV = iVL; |
---|
1529 | #endif |
---|
1530 | } |
---|
1531 | else if ( iFilledL == REN_IS_HOLE ) |
---|
1532 | { |
---|
1533 | riY = iYR; |
---|
1534 | #if H_3D_VSO_COLOR_PLANES |
---|
1535 | riU = iUR; |
---|
1536 | riV = iVR; |
---|
1537 | #endif |
---|
1538 | } |
---|
1539 | else |
---|
1540 | { |
---|
1541 | riY = xBlend( iYR, iYL, iFilledL ); |
---|
1542 | #if H_3D_VSO_COLOR_PLANES |
---|
1543 | riU = xBlend( iUR, iUL, iFilledL ); |
---|
1544 | riV = xBlend( iVR, iUL, iFilledL ); |
---|
1545 | #endif |
---|
1546 | } |
---|
1547 | } |
---|
1548 | |
---|
1549 | template <BlenMod iBM, Bool bBitInc> template< Bool bL, SetMod SM > __inline Void |
---|
1550 | TRenSingleModelC<iBM,bBitInc>::xGetBlendedValueBM2( Pel& riY, Pel iYL, Pel iYR, |
---|
1551 | #if H_3D_VSO_COLOR_PLANES |
---|
1552 | Pel& riU, Pel iUL, Pel iUR, Pel& riV, Pel iVL, Pel iVR, |
---|
1553 | #endif |
---|
1554 | Int iFilledL, Int iFilledR, Pel iDepthL, Pel iDepthR ) |
---|
1555 | { |
---|
1556 | if ( iFilledR == REN_IS_FILLED || iFilledL == REN_IS_HOLE ) |
---|
1557 | { |
---|
1558 | riY = iYR; |
---|
1559 | #if H_3D_VSO_COLOR_PLANES |
---|
1560 | riU = iUR; |
---|
1561 | riV = iVR; |
---|
1562 | #endif |
---|
1563 | } |
---|
1564 | else if ( iFilledR == REN_IS_HOLE ) |
---|
1565 | { |
---|
1566 | riY = iYL; |
---|
1567 | #if H_3D_VSO_COLOR_PLANES |
---|
1568 | riU = iUL; |
---|
1569 | riV = iVL; |
---|
1570 | #endif |
---|
1571 | } |
---|
1572 | else |
---|
1573 | { |
---|
1574 | riY = xBlend( iYL, iYR, iFilledR ); |
---|
1575 | #if H_3D_VSO_COLOR_PLANES |
---|
1576 | riU = xBlend( iUL, iUR, iFilledR ); |
---|
1577 | riV = xBlend( iVL, iUR, iFilledR ); |
---|
1578 | #endif |
---|
1579 | } |
---|
1580 | } |
---|
1581 | |
---|
1582 | template <BlenMod iBM, Bool bBitInc> __inline Pel |
---|
1583 | TRenSingleModelC<iBM,bBitInc>::xBlend( Pel pVal1, Pel pVal2, Int iWeightVal2 ) |
---|
1584 | { |
---|
1585 | return pVal1 + (Pel) ( ( (Int) ( pVal2 - pVal1) * iWeightVal2 + (1 << (REN_VDWEIGHT_PREC - 1)) ) >> REN_VDWEIGHT_PREC ); |
---|
1586 | } |
---|
1587 | |
---|
1588 | template <BlenMod iBM, Bool bBitInc> Void |
---|
1589 | TRenSingleModelC<iBM,bBitInc>::xCopy2PicYuv( Pel** ppiSrcVideoPel, Int* piStrides, TComPicYuv* rpcPicYuvTarget ) |
---|
1590 | { |
---|
1591 | TRenFilter<REN_BIT_DEPTH>::copy ( ppiSrcVideoPel[0], piStrides[0], m_iWidth, m_iUsedHeight, rpcPicYuvTarget->getAddr( COMPONENT_Y ) + m_iHorOffset * rpcPicYuvTarget->getStride( COMPONENT_Y ), rpcPicYuvTarget->getStride( COMPONENT_Y ) ); |
---|
1592 | TRenFilter<REN_BIT_DEPTH>::sampleDown2Tap13( ppiSrcVideoPel[1], piStrides[1], m_iWidth, m_iUsedHeight, rpcPicYuvTarget->getAddr( COMPONENT_Cb ) + (m_iHorOffset >> 1) * rpcPicYuvTarget->getStride( COMPONENT_Cb ), rpcPicYuvTarget->getStride( COMPONENT_Cb) ); |
---|
1593 | TRenFilter<REN_BIT_DEPTH>::sampleDown2Tap13( ppiSrcVideoPel[2], piStrides[2], m_iWidth, m_iUsedHeight, rpcPicYuvTarget->getAddr( COMPONENT_Cr ) + (m_iHorOffset >> 1) * rpcPicYuvTarget->getStride( COMPONENT_Cr ), rpcPicYuvTarget->getStride( COMPONENT_Cr) ); |
---|
1594 | } |
---|
1595 | |
---|
1596 | template class TRenSingleModelC<BLEND_NONE ,true>; |
---|
1597 | template class TRenSingleModelC<BLEND_AVRG ,true>; |
---|
1598 | template class TRenSingleModelC<BLEND_LEFT ,true>; |
---|
1599 | template class TRenSingleModelC<BLEND_RIGHT,true>; |
---|
1600 | |
---|
1601 | template class TRenSingleModelC<BLEND_NONE ,false>; |
---|
1602 | template class TRenSingleModelC<BLEND_AVRG ,false>; |
---|
1603 | template class TRenSingleModelC<BLEND_LEFT ,false>; |
---|
1604 | template class TRenSingleModelC<BLEND_RIGHT,false>; |
---|
1605 | |
---|
1606 | #if H_3D_VSO_EARLY_SKIP |
---|
1607 | template <BlenMod iBM, Bool bBitInc> template <Bool bL > __inline Bool |
---|
1608 | TRenSingleModelC<iBM,bBitInc>::xDetectEarlySkip( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData, const Pel* piOrgData, Int iOrgStride) |
---|
1609 | { |
---|
1610 | RM_AOF( m_bEarlySkip ); |
---|
1611 | const Int iCurViewPos = bL ? 0 : 1; |
---|
1612 | Int** ppiCurLUT = m_appiShiftLut [ iCurViewPos ]; |
---|
1613 | |
---|
1614 | Bool bNoDiff = true; |
---|
1615 | |
---|
1616 | for (Int iPosY=0; iPosY < iHeight; iPosY++) |
---|
1617 | { |
---|
1618 | m_pbHorSkip[iPosY] = true; |
---|
1619 | |
---|
1620 | for (Int iPosX = 0; iPosX < iWidth; iPosX++) |
---|
1621 | { |
---|
1622 | Int iDisparityRec = abs(ppiCurLUT[0][ RenModRemoveBitInc(piNewData[iPosX])]); |
---|
1623 | Int iDispartyOrg = abs(ppiCurLUT[0][ RenModRemoveBitInc(piOrgData[iPosX])]); |
---|
1624 | |
---|
1625 | if( iDispartyOrg != iDisparityRec) |
---|
1626 | { |
---|
1627 | m_pbHorSkip[iPosY] = false; |
---|
1628 | bNoDiff = false; |
---|
1629 | break; |
---|
1630 | } |
---|
1631 | } |
---|
1632 | piNewData += iStride; |
---|
1633 | piOrgData += iOrgStride; |
---|
1634 | } |
---|
1635 | return bNoDiff; |
---|
1636 | } |
---|
1637 | #endif |
---|
1638 | #endif // NH_3D |
---|
1639 | |
---|