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