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