[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 | * |
---|
| 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 | */ |
---|
[2] | 33 | |
---|
| 34 | #include "TRenImage.h" |
---|
| 35 | #include "TRenFilter.h" |
---|
| 36 | #include "TRenSingleModel.h" |
---|
| 37 | |
---|
[608] | 38 | #if H_3D_VSO |
---|
| 39 | |
---|
[2] | 40 | ////////////// TRENSINGLE MODEL /////////////// |
---|
[100] | 41 | template <BlenMod iBM, Bool bBitInc> |
---|
| 42 | TRenSingleModelC<iBM,bBitInc>::TRenSingleModelC() |
---|
[608] | 43 | : m_iDistShift ( ( g_bitDepthY - 8) << 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 | { |
---|
[124] | 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]); |
---|
[100] | 264 | xSetStructRefView(); |
---|
[2] | 265 | } |
---|
| 266 | |
---|
| 267 | // Initial Rendering |
---|
[100] | 268 | xResetStructError(); |
---|
| 269 | xInitSampleStructs(); |
---|
[2] | 270 | switch ( m_iMode ) |
---|
[100] | 271 | { |
---|
| 272 | case 0: |
---|
[608] | 273 | #if H_3D_VSO_EARLY_SKIP |
---|
[124] | 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: |
---|
[608] | 280 | #if H_3D_VSO_EARLY_SKIP |
---|
[124] | 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 ); |
---|
[608] | 288 | #if H_3D_VSO_EARLY_SKIP |
---|
[124] | 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 | } |
---|
[2] | 299 | |
---|
| 300 | // Get Rendered View as Reference |
---|
| 301 | if ( !pcOrgVideo && !bKeepReference ) |
---|
| 302 | { |
---|
[100] | 303 | xResetStructError(); |
---|
| 304 | xSetStructSynthViewAsRefView(); |
---|
[2] | 305 | } |
---|
| 306 | } |
---|
| 307 | |
---|
[100] | 308 | template <BlenMod iBM, Bool bBitInc> Void |
---|
[608] | 309 | #if H_3D_VSO_COLOR_PLANES |
---|
[100] | 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 |
---|
[2] | 314 | { |
---|
[100] | 315 | switch ( iViewNum ) |
---|
[2] | 316 | { |
---|
| 317 | case 0: |
---|
[100] | 318 | rpiSrcY = &RenModelOutPels::iYLeft; |
---|
[608] | 319 | #if H_3D_VSO_COLOR_PLANES |
---|
[100] | 320 | rpiSrcU = &RenModelOutPels::iULeft; |
---|
| 321 | rpiSrcV = &RenModelOutPels::iVLeft; |
---|
| 322 | #endif |
---|
[2] | 323 | break; |
---|
| 324 | case 1: |
---|
[100] | 325 | rpiSrcY = &RenModelOutPels::iYRight; |
---|
[608] | 326 | #if H_3D_VSO_COLOR_PLANES |
---|
[100] | 327 | rpiSrcU = &RenModelOutPels::iURight; |
---|
| 328 | rpiSrcV = &RenModelOutPels::iVRight; |
---|
| 329 | #endif |
---|
[2] | 330 | break; |
---|
[100] | 331 | case 2: |
---|
| 332 | rpiSrcY = &RenModelOutPels::iYBlended; |
---|
[608] | 333 | #if H_3D_VSO_COLOR_PLANES |
---|
[100] | 334 | rpiSrcU = &RenModelOutPels::iUBlended; |
---|
| 335 | rpiSrcV = &RenModelOutPels::iVBlended; |
---|
| 336 | #endif |
---|
| 337 | break; |
---|
[2] | 338 | } |
---|
| 339 | } |
---|
| 340 | |
---|
[100] | 341 | |
---|
| 342 | template <BlenMod iBM, Bool bBitInc> Void |
---|
| 343 | TRenSingleModelC<iBM,bBitInc>::xGetSampleStrDepthPtrs( Int iViewNum, Pel RenModelOutPels::*& rpiSrcD ) |
---|
[2] | 344 | { |
---|
[100] | 345 | AOT(iViewNum != 0 && iViewNum != 1); |
---|
| 346 | rpiSrcD = (iViewNum == 1) ? &RenModelOutPels::iDRight : &RenModelOutPels::iDLeft; |
---|
[2] | 347 | } |
---|
| 348 | |
---|
| 349 | |
---|
[100] | 350 | template <BlenMod iBM, Bool bBitInc> Void |
---|
| 351 | TRenSingleModelC<iBM,bBitInc>::xSetStructRefView( ) |
---|
[2] | 352 | { |
---|
[100] | 353 | RenModelOutPels* pcCurOutSampleRow = m_pcOutputSamples; |
---|
| 354 | |
---|
| 355 | Pel* piYRow = m_aapiRefVideoPel[0]; |
---|
[608] | 356 | #if H_3D_VSO_COLOR_PLANES |
---|
[100] | 357 | Pel* piURow = m_aapiRefVideoPel[1]; |
---|
| 358 | Pel* piVRow = m_aapiRefVideoPel[2]; |
---|
| 359 | #endif |
---|
| 360 | |
---|
[124] | 361 | for ( Int iPosY = 0; iPosY < m_iUsedHeight; iPosY++ ) |
---|
[100] | 362 | { |
---|
| 363 | for ( Int iPosX = 0; iPosX < m_iWidth; iPosX++ ) |
---|
| 364 | { |
---|
| 365 | pcCurOutSampleRow[iPosX].iYRef = piYRow[iPosX]; |
---|
[608] | 366 | #if H_3D_VSO_COLOR_PLANES |
---|
[100] | 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]; |
---|
[608] | 375 | #if H_3D_VSO_COLOR_PLANES |
---|
[100] | 376 | piURow += m_aiRefVideoStrides[1]; |
---|
| 377 | piVRow += m_aiRefVideoStrides[2]; |
---|
| 378 | #endif |
---|
| 379 | } |
---|
[2] | 380 | } |
---|
| 381 | |
---|
[100] | 382 | template <BlenMod iBM, Bool bBitInc> Void |
---|
| 383 | TRenSingleModelC<iBM,bBitInc>::xResetStructError( ) |
---|
| 384 | { |
---|
| 385 | RenModelOutPels* pcCurOutSampleRow = m_pcOutputSamples; |
---|
[2] | 386 | |
---|
[100] | 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 | } |
---|
[2] | 395 | } |
---|
| 396 | |
---|
[100] | 397 | template <BlenMod iBM, Bool bBitInc> Void |
---|
| 398 | TRenSingleModelC<iBM,bBitInc>::xSetStructSynthViewAsRefView( ) |
---|
| 399 | { |
---|
| 400 | AOT( m_iMode < 0 || m_iMode > 2); |
---|
[2] | 401 | |
---|
[100] | 402 | RenModelOutPels* pcCurOutSampleRow = m_pcOutputSamples; |
---|
| 403 | |
---|
| 404 | Pel RenModelOutPels::* piSrcY = NULL; |
---|
| 405 | |
---|
[608] | 406 | #if H_3D_VSO_COLOR_PLANES |
---|
[100] | 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 | |
---|
[124] | 414 | for ( Int iPosY = 0; iPosY < m_iUsedHeight; iPosY++ ) |
---|
[100] | 415 | { |
---|
| 416 | for ( Int iPosX = 0; iPosX < m_iWidth; iPosX++ ) |
---|
| 417 | { |
---|
| 418 | pcCurOutSampleRow[iPosX].iYRef = pcCurOutSampleRow[iPosX].*piSrcY; |
---|
[608] | 419 | #if H_3D_VSO_COLOR_PLANES |
---|
[100] | 420 | pcCurOutSampleRow[iPosX].iURef = pcCurOutSampleRow[iPosX].*piSrcU; |
---|
| 421 | pcCurOutSampleRow[iPosX].iVRef = pcCurOutSampleRow[iPosX].*piSrcV; |
---|
| 422 | #endif |
---|
| 423 | } |
---|
| 424 | pcCurOutSampleRow += m_iOutputSamplesStride; |
---|
| 425 | } |
---|
[2] | 426 | } |
---|
| 427 | |
---|
[100] | 428 | template <BlenMod iBM, Bool bBitInc> Void |
---|
| 429 | TRenSingleModelC<iBM,bBitInc>::xInitSampleStructs() |
---|
[2] | 430 | { |
---|
[100] | 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; |
---|
[608] | 452 | #if H_3D_VSO_COLOR_PLANES |
---|
[100] | 453 | // U Planes |
---|
[608] | 454 | pcOutSampleRow[iPosX].iULeft = 1 << (g_bitDepthC - 1); |
---|
| 455 | pcOutSampleRow[iPosX].iURight = 1 << (g_bitDepthC - 1); |
---|
| 456 | pcOutSampleRow[iPosX].iUBlended = 1 << (g_bitDepthC - 1); |
---|
[100] | 457 | |
---|
| 458 | // V Planes |
---|
[608] | 459 | pcOutSampleRow[iPosX].iVLeft = 1 << (g_bitDepthC - 1); |
---|
| 460 | pcOutSampleRow[iPosX].iVRight = 1 << (g_bitDepthC - 1); |
---|
| 461 | pcOutSampleRow[iPosX].iVBlended = 1 << (g_bitDepthC - 1); |
---|
[100] | 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 | } |
---|
[2] | 472 | } |
---|
| 473 | |
---|
| 474 | |
---|
[608] | 475 | #if H_3D_VSO_EARLY_SKIP |
---|
[100] | 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; |
---|
[608] | 484 | #if H_3D_VSO_EARLY_SKIP |
---|
[100] | 485 | Bool bEarlySkip; |
---|
| 486 | #endif |
---|
| 487 | switch ( iViewPos ) |
---|
| 488 | { |
---|
| 489 | case 0: |
---|
[608] | 490 | #if H_3D_VSO_EARLY_SKIP |
---|
[100] | 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: |
---|
[608] | 501 | #if H_3D_VSO_EARLY_SKIP |
---|
[100] | 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 | } |
---|
[2] | 514 | |
---|
[100] | 515 | return iSSE; |
---|
| 516 | } |
---|
[608] | 517 | #if H_3D_VSO_EARLY_SKIP |
---|
[100] | 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 |
---|
[2] | 524 | { |
---|
[608] | 525 | #ifdef H_3D_VSO_EARLY_SKIP |
---|
[100] | 526 | Bool bEarlySkip; |
---|
| 527 | #endif |
---|
| 528 | switch ( iViewPos ) |
---|
| 529 | { |
---|
| 530 | case 0: |
---|
[608] | 531 | #if H_3D_VSO_EARLY_SKIP |
---|
[100] | 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: |
---|
[608] | 542 | #if H_3D_VSO_EARLY_SKIP |
---|
[100] | 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 | } |
---|
[2] | 556 | |
---|
[100] | 557 | template <BlenMod iBM, Bool bBitInc> Void |
---|
[124] | 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 | |
---|
[608] | 563 | #if H_3D_VSO_COLOR_PLANES |
---|
[124] | 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 ); |
---|
[608] | 584 | pcPicYuv->setChromaTo( 1 << (g_bitDepthC - 1) ); |
---|
[124] | 585 | #endif |
---|
| 586 | } |
---|
[2] | 587 | |
---|
[124] | 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 ); |
---|
[100] | 594 | |
---|
[124] | 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 ); |
---|
[608] | 598 | pcPicYuv->setChromaTo( 1 << (g_bitDepthC - 1) ); |
---|
[124] | 599 | } |
---|
| 600 | |
---|
[100] | 601 | |
---|
| 602 | template <BlenMod iBM, Bool bBitInc> Void |
---|
[124] | 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 | |
---|
[608] | 608 | #if H_3D_VSO_COLOR_PLANES |
---|
[124] | 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 ); |
---|
[608] | 630 | pcPicYuv->setChromaTo( 1 << ( g_bitDepthC - 1 ) ); |
---|
[124] | 631 | #endif |
---|
| 632 | } |
---|
[2] | 633 | |
---|
[100] | 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; |
---|
[2] | 639 | } |
---|
| 640 | |
---|
[100] | 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 ) |
---|
[2] | 643 | { |
---|
[100] | 644 | AOF(false); |
---|
| 645 | } |
---|
[2] | 646 | |
---|
[100] | 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 | } |
---|
[608] | 665 | #if H_3D_VSO_EARLY_SKIP |
---|
[100] | 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 | |
---|
[2] | 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 |
---|
[100] | 687 | m_ppiCurLUT = m_appiShiftLut [iCurViewPos]; |
---|
[2] | 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 | { |
---|
[608] | 698 | #if H_3D_VSO_EARLY_SKIP |
---|
[100] | 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 |
---|
[2] | 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 ); |
---|
[100] | 722 | xExtrapolateMarginL<bSet> ( iCurSPos, iEndChangePos, iError ); |
---|
| 723 | |
---|
[608] | 724 | iMinChangedSPos = std::min( iMinChangedSPos, (iEndChangePos << m_iShiftPrec) - m_ppiCurLUT[0][ RenModRemoveBitInc( std::max(m_pcInputSamplesRow[iCurViewPos][iEndChangePos].iD, m_piNewDepthData[iPosXinNewData] )) ]); |
---|
[2] | 725 | iLastSPos = iCurSPos; |
---|
| 726 | m_iLastDepth = m_iCurDepth; |
---|
[100] | 727 | |
---|
| 728 | if ( bSet ) |
---|
| 729 | { |
---|
| 730 | m_pcInputSamplesRow[iCurViewPos][iEndChangePos].iD = m_piNewDepthData[iPosXinNewData]; |
---|
| 731 | } |
---|
| 732 | |
---|
[2] | 733 | iPosXinNewData--; |
---|
| 734 | iEndChangePos--; |
---|
| 735 | } |
---|
| 736 | else |
---|
| 737 | { |
---|
| 738 | iLastSPos = xShift(iEndChangePos+1); |
---|
[100] | 739 | m_iLastDepth = m_pcInputSamplesRow [iCurViewPos][iEndChangePos+1].iD; |
---|
[2] | 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 |
---|
[100] | 748 | |
---|
[608] | 749 | iMinChangedSPos = std::min( iMinChangedSPos, (iCurPosX << m_iShiftPrec) - m_ppiCurLUT[0][ RenModRemoveBitInc( std::max(m_pcInputSamplesRow[iCurViewPos][iCurPosX].iD, m_piNewDepthData[iPosXinNewData] )) ]); |
---|
[2] | 750 | Int iCurSPos = xShiftNewData(iCurPosX,iPosXinNewData); |
---|
| 751 | m_iCurDepth = m_piNewDepthData[iPosXinNewData]; |
---|
[100] | 752 | xRenderRangeL<bSet>(iCurSPos, iLastSPos, iCurPosX, iError ); |
---|
[2] | 753 | iLastSPos = iCurSPos; |
---|
| 754 | m_iLastDepth = m_iCurDepth; |
---|
[100] | 755 | |
---|
| 756 | if ( bSet ) |
---|
| 757 | { |
---|
| 758 | m_pcInputSamplesRow[iCurViewPos][iCurPosX].iD = m_piNewDepthData[iPosXinNewData]; |
---|
| 759 | } |
---|
| 760 | |
---|
[2] | 761 | iPosXinNewData--; |
---|
| 762 | } |
---|
| 763 | |
---|
| 764 | //// RE-RENDER DATA LEFT TO NEW DATA |
---|
| 765 | while ( iCurPosX >= 0 ) |
---|
| 766 | { |
---|
| 767 | Int iCurSPos = xShift(iCurPosX); |
---|
| 768 | |
---|
[100] | 769 | m_iCurDepth = m_pcInputSamplesRow[iCurViewPos][iCurPosX].iD; |
---|
| 770 | xRenderRangeL<bSet>( iCurSPos, iLastSPos, iCurPosX, iError ); |
---|
| 771 | |
---|
[2] | 772 | if ( iCurSPos < iMinChangedSPos ) |
---|
| 773 | { |
---|
| 774 | break; |
---|
[124] | 775 | } |
---|
[5] | 776 | |
---|
[2] | 777 | iCurPosX--; |
---|
| 778 | iLastSPos = iCurSPos; |
---|
| 779 | m_iLastDepth = m_iCurDepth; |
---|
| 780 | } |
---|
| 781 | |
---|
[100] | 782 | |
---|
[2] | 783 | xIncViewRow(); |
---|
| 784 | m_piNewDepthData += iStride; |
---|
| 785 | } |
---|
| 786 | return iError; |
---|
| 787 | } |
---|
| 788 | |
---|
[608] | 789 | #ifdef H_3D_VSO_EARLY_SKIP |
---|
[100] | 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 |
---|
[2] | 796 | { |
---|
| 797 | |
---|
[100] | 798 | const Int iCurViewPos = 1; |
---|
| 799 | const Int iOtherViewPos = 0; |
---|
| 800 | |
---|
| 801 | m_iCurViewPos = iCurViewPos; |
---|
| 802 | m_iOtherViewPos = iOtherViewPos; |
---|
| 803 | |
---|
[2] | 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 |
---|
[100] | 812 | m_ppiCurLUT = m_appiShiftLut [iCurViewPos]; |
---|
[2] | 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 | { |
---|
[608] | 823 | #if H_3D_VSO_EARLY_SKIP |
---|
[100] | 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 |
---|
[2] | 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 ); |
---|
[100] | 847 | xExtrapolateMarginR<bSet> ( iCurSPos, iStartChangePos, iError ); |
---|
| 848 | |
---|
[608] | 849 | iMaxChangedSPos = std::max( iMaxChangedSPos, (iStartChangePos << m_iShiftPrec) - m_ppiCurLUT[0][ RenModRemoveBitInc( std::max(m_pcInputSamplesRow[iCurViewPos][iStartChangePos].iD, m_piNewDepthData[iPosXinNewData] )) ]); |
---|
[2] | 850 | iLastSPos = iCurSPos; |
---|
| 851 | m_iLastDepth = m_iCurDepth; |
---|
[100] | 852 | if ( bSet ) |
---|
| 853 | { |
---|
| 854 | m_pcInputSamplesRow[iCurViewPos][iStartChangePos].iD = m_piNewDepthData[iPosXinNewData]; |
---|
| 855 | } |
---|
| 856 | |
---|
| 857 | |
---|
[2] | 858 | iPosXinNewData++; |
---|
| 859 | iStartChangePos++; |
---|
| 860 | } |
---|
| 861 | else |
---|
| 862 | { |
---|
| 863 | iLastSPos = xShift(iStartChangePos-1); |
---|
[100] | 864 | |
---|
| 865 | m_iLastDepth = m_pcInputSamplesRow[iCurViewPos][iStartChangePos-1].iD; |
---|
[2] | 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 |
---|
[100] | 874 | |
---|
[608] | 875 | iMaxChangedSPos = std::max( iMaxChangedSPos, (iCurPosX << m_iShiftPrec) - m_ppiCurLUT[0][ RenModRemoveBitInc( std::max(m_pcInputSamplesRow[iCurViewPos][iCurPosX].iD, m_piNewDepthData[iPosXinNewData] )) ]); |
---|
[2] | 876 | Int iCurSPos = xShiftNewData(iCurPosX,iPosXinNewData); |
---|
| 877 | m_iCurDepth = m_piNewDepthData[iPosXinNewData]; |
---|
[100] | 878 | xRenderRangeR<bSet>(iCurSPos, iLastSPos, iCurPosX, iError ); |
---|
[2] | 879 | iLastSPos = iCurSPos; |
---|
| 880 | m_iLastDepth = m_iCurDepth; |
---|
[100] | 881 | |
---|
| 882 | if ( bSet ) |
---|
| 883 | { |
---|
| 884 | m_pcInputSamplesRow[iCurViewPos][iCurPosX].iD = m_piNewDepthData[iPosXinNewData]; |
---|
| 885 | } |
---|
| 886 | |
---|
[2] | 887 | iPosXinNewData++; |
---|
| 888 | } |
---|
| 889 | |
---|
| 890 | //// RE-RENDER DATA LEFT TO NEW DATA |
---|
| 891 | while ( iCurPosX < m_iWidth ) |
---|
| 892 | { |
---|
| 893 | Int iCurSPos = xShift(iCurPosX); |
---|
| 894 | |
---|
[100] | 895 | m_iCurDepth = m_pcInputSamplesRow[iCurViewPos][iCurPosX].iD; |
---|
| 896 | xRenderRangeR<bSet>( iCurSPos, iLastSPos, iCurPosX, iError ); |
---|
| 897 | |
---|
[2] | 898 | if ( iCurSPos > iMaxChangedSPos ) |
---|
| 899 | { |
---|
| 900 | break; |
---|
| 901 | } |
---|
| 902 | iCurPosX++; |
---|
| 903 | iLastSPos = iCurSPos; |
---|
| 904 | m_iLastDepth = m_iCurDepth; |
---|
| 905 | } |
---|
[100] | 906 | |
---|
[2] | 907 | xIncViewRow(); |
---|
| 908 | m_piNewDepthData += iStride; |
---|
| 909 | } |
---|
| 910 | return iError; |
---|
| 911 | } |
---|
| 912 | |
---|
| 913 | |
---|
[100] | 914 | template <BlenMod iBM, Bool bBitInc> __inline Void |
---|
| 915 | TRenSingleModelC<iBM,bBitInc>::xInitRenderPartL( Int iEndChangePos, Int iLastSPos ) |
---|
[2] | 916 | { |
---|
[100] | 917 | const Int iCurViewPos = 0; |
---|
[2] | 918 | // GET MINIMAL OCCLUDED SAMPLE POSITION |
---|
| 919 | Int iCurPosX = iEndChangePos; |
---|
| 920 | |
---|
[100] | 921 | |
---|
| 922 | if ( ( iCurPosX + 1 < m_iWidth ) && (m_pcInputSamplesRow[iCurViewPos][ iCurPosX + 1].bOccluded ) ) |
---|
[2] | 923 | { |
---|
| 924 | iCurPosX++; |
---|
[100] | 925 | |
---|
| 926 | while ( (iCurPosX + 1 < m_iWidth) && (m_pcInputSamplesRow[iCurViewPos][ iCurPosX + 1].bOccluded ) ) |
---|
| 927 | |
---|
[2] | 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 | |
---|
[100] | 951 | template <BlenMod iBM, Bool bBitInc> __inline Void |
---|
| 952 | TRenSingleModelC<iBM,bBitInc>::xInitRenderPartR( Int iStartChangePos, Int iLastSPos ) |
---|
[2] | 953 | { |
---|
[100] | 954 | const Int iCurViewPos = 1; |
---|
[2] | 955 | // GET MINIMAL OCCLUDED SAMPLE POSITION |
---|
| 956 | Int iCurPosX = iStartChangePos; |
---|
| 957 | |
---|
[100] | 958 | if ( ( iCurPosX - 1 > -1 ) && (m_pcInputSamplesRow[iCurViewPos][ iCurPosX - 1].bOccluded ) ) |
---|
[2] | 959 | { |
---|
| 960 | iCurPosX--; |
---|
[100] | 961 | |
---|
| 962 | while ( (iCurPosX - 1 > -1 ) && (m_pcInputSamplesRow[iCurViewPos][ iCurPosX - 1].bOccluded ) ) |
---|
[2] | 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 | |
---|
[100] | 986 | template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void |
---|
| 987 | TRenSingleModelC<iBM,bBitInc>::xRenderShiftedRangeL(Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError ) |
---|
[2] | 988 | { |
---|
| 989 | assert( iCurSPos <= iLastSPos ); |
---|
| 990 | //assert( iRightSPos < m_iWidth ); |
---|
| 991 | |
---|
| 992 | Int iDeltaSPos = iLastSPos - iCurSPos; |
---|
| 993 | if ( iDeltaSPos > m_iGapTolerance ) |
---|
| 994 | { |
---|
[100] | 995 | xFillHoleL<bSet>( iCurSPos, iLastSPos, iCurPos, riError ); |
---|
[2] | 996 | } |
---|
| 997 | else |
---|
| 998 | { |
---|
| 999 | if (iLastSPos < 0 ) |
---|
| 1000 | return; |
---|
| 1001 | |
---|
[100] | 1002 | RM_AOT( iDeltaSPos > m_iGapTolerance ); |
---|
[2] | 1003 | |
---|
| 1004 | m_iThisDepth = m_iCurDepth; |
---|
[608] | 1005 | for (Int iFillSPos = std::max(0, xRangeLeftL(iCurSPos) ); iFillSPos <= min(xRangeRightL( iLastSPos ) ,m_iLastOccludedSPosFP-1); iFillSPos++ ) |
---|
[2] | 1006 | { |
---|
| 1007 | Int iDeltaCurSPos = (iFillSPos << m_iShiftPrec) - iCurSPos; |
---|
| 1008 | |
---|
[100] | 1009 | RM_AOT( iDeltaCurSPos > iDeltaSPos ); |
---|
| 1010 | RM_AOT( iDeltaCurSPos < 0 ); |
---|
| 1011 | RM_AOT( m_aaiSubPelShiftL[iDeltaSPos][iDeltaCurSPos] == 0xdeaddead); |
---|
[2] | 1012 | |
---|
[100] | 1013 | xSetShiftedPelL<bSet>( iCurPos, m_aaiSubPelShiftL[iDeltaSPos][iDeltaCurSPos], iFillSPos, REN_IS_FILLED, riError ); |
---|
[2] | 1014 | } |
---|
| 1015 | }; |
---|
| 1016 | } |
---|
| 1017 | |
---|
[100] | 1018 | template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void |
---|
| 1019 | TRenSingleModelC<iBM,bBitInc>::xRenderShiftedRangeR(Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError ) |
---|
[2] | 1020 | { |
---|
| 1021 | assert( iCurSPos >= iLastSPos ); |
---|
| 1022 | |
---|
| 1023 | Int iDeltaSPos = iCurSPos - iLastSPos; |
---|
| 1024 | if ( iDeltaSPos > m_iGapTolerance ) |
---|
| 1025 | { |
---|
[100] | 1026 | xFillHoleR<bSet>( iCurSPos, iLastSPos, iCurPos, riError ); |
---|
[2] | 1027 | } |
---|
| 1028 | else |
---|
| 1029 | { |
---|
| 1030 | if (iLastSPos > m_iSampledWidth - 1 ) |
---|
| 1031 | return; |
---|
| 1032 | |
---|
| 1033 | m_iThisDepth = m_iCurDepth; |
---|
[100] | 1034 | RM_AOT( iDeltaSPos > m_iGapTolerance ); |
---|
[2] | 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 | |
---|
[100] | 1039 | RM_AOT( iDeltaCurSPos > iDeltaSPos ); |
---|
| 1040 | RM_AOT( iDeltaCurSPos < 0 ); |
---|
| 1041 | RM_AOT( m_aaiSubPelShiftR[iDeltaSPos][iDeltaCurSPos] == 0xdeaddead); |
---|
[2] | 1042 | |
---|
[100] | 1043 | xSetShiftedPelR<bSet>( iCurPos, m_aaiSubPelShiftR[iDeltaSPos][iDeltaCurSPos], iFillSPos, REN_IS_FILLED, riError ); |
---|
[2] | 1044 | } |
---|
| 1045 | }; |
---|
| 1046 | } |
---|
| 1047 | |
---|
| 1048 | |
---|
| 1049 | |
---|
[100] | 1050 | template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void |
---|
| 1051 | TRenSingleModelC<iBM,bBitInc>::xRenderRangeL(Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError ) |
---|
[2] | 1052 | { |
---|
[100] | 1053 | const Int iCurViewPos = 0; |
---|
[2] | 1054 | if ( !m_bInOcclusion ) |
---|
| 1055 | { |
---|
| 1056 | if ( iCurSPos >= iLastSPos ) |
---|
| 1057 | { |
---|
| 1058 | m_iLastOccludedSPos = iLastSPos; |
---|
[5] | 1059 | |
---|
[2] | 1060 | Int iRightSPosFP = xRoundL( iLastSPos ); |
---|
| 1061 | if ( ( iRightSPosFP == xRangeRightL(iLastSPos)) && (iRightSPosFP >= 0) ) |
---|
| 1062 | { |
---|
| 1063 | m_iThisDepth = m_iLastDepth; |
---|
[100] | 1064 | |
---|
| 1065 | xSetShiftedPelL<bSet>( iCurPos+1, 0, iRightSPosFP, REN_IS_FILLED, riError ); |
---|
[2] | 1066 | } |
---|
| 1067 | m_iLastOccludedSPosFP = iRightSPosFP; |
---|
| 1068 | |
---|
| 1069 | m_bInOcclusion = true; |
---|
| 1070 | |
---|
[100] | 1071 | if ( bSet ) |
---|
[2] | 1072 | { |
---|
[100] | 1073 | m_pcInputSamplesRow[iCurViewPos][ iCurPos ].bOccluded = true; |
---|
[2] | 1074 | } |
---|
| 1075 | } |
---|
| 1076 | else |
---|
| 1077 | { |
---|
[100] | 1078 | if ( bSet ) |
---|
[2] | 1079 | { |
---|
[100] | 1080 | m_pcInputSamplesRow[iCurViewPos][ iCurPos ].bOccluded = false; |
---|
[2] | 1081 | } |
---|
| 1082 | |
---|
[100] | 1083 | xRenderShiftedRangeL<bSet>(iCurSPos, iLastSPos, iCurPos, riError ); |
---|
[2] | 1084 | } |
---|
| 1085 | } |
---|
| 1086 | else |
---|
| 1087 | { |
---|
| 1088 | if ( iCurSPos < m_iLastOccludedSPos ) |
---|
| 1089 | { |
---|
| 1090 | m_bInOcclusion = false; |
---|
[100] | 1091 | if ( bSet ) |
---|
[2] | 1092 | { |
---|
[100] | 1093 | m_pcInputSamplesRow[iCurViewPos][ iCurPos ].bOccluded = false; |
---|
[2] | 1094 | } |
---|
| 1095 | |
---|
[100] | 1096 | xRenderShiftedRangeL<bSet>(iCurSPos, iLastSPos, iCurPos, riError ); |
---|
[2] | 1097 | } |
---|
| 1098 | else |
---|
| 1099 | { |
---|
[100] | 1100 | if ( bSet ) |
---|
[2] | 1101 | { |
---|
[100] | 1102 | m_pcInputSamplesRow[iCurViewPos][ iCurPos ].bOccluded = true; |
---|
[2] | 1103 | } |
---|
| 1104 | } |
---|
| 1105 | } |
---|
| 1106 | } |
---|
| 1107 | |
---|
[100] | 1108 | template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void |
---|
| 1109 | TRenSingleModelC<iBM,bBitInc>::xRenderRangeR(Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError ) |
---|
[2] | 1110 | { |
---|
[100] | 1111 | const Int iCurViewPos = 1; |
---|
[2] | 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; |
---|
[100] | 1123 | xSetShiftedPelR<bSet>( iCurPos-1,1 << m_iShiftPrec , iLeftSPosFP, REN_IS_FILLED, riError ); |
---|
[2] | 1124 | } |
---|
| 1125 | m_iLastOccludedSPosFP = iLeftSPosFP; |
---|
| 1126 | |
---|
| 1127 | m_bInOcclusion = true; |
---|
| 1128 | |
---|
[100] | 1129 | if ( bSet ) |
---|
[2] | 1130 | { |
---|
[100] | 1131 | m_pcInputSamplesRow[iCurViewPos][ iCurPos ].bOccluded = true; |
---|
[2] | 1132 | } |
---|
| 1133 | } |
---|
| 1134 | else |
---|
| 1135 | { |
---|
[100] | 1136 | if ( bSet ) |
---|
[2] | 1137 | { |
---|
[100] | 1138 | m_pcInputSamplesRow[iCurViewPos][ iCurPos ].bOccluded = false; |
---|
[2] | 1139 | } |
---|
| 1140 | |
---|
[100] | 1141 | xRenderShiftedRangeR<bSet>(iCurSPos, iLastSPos, iCurPos, riError ); |
---|
[2] | 1142 | } |
---|
| 1143 | } |
---|
| 1144 | else |
---|
| 1145 | { |
---|
| 1146 | if ( iCurSPos > m_iLastOccludedSPos ) |
---|
| 1147 | { |
---|
| 1148 | m_bInOcclusion = false; |
---|
[100] | 1149 | if ( bSet ) |
---|
[2] | 1150 | { |
---|
[100] | 1151 | m_pcInputSamplesRow[iCurViewPos][ iCurPos ].bOccluded = false; |
---|
[2] | 1152 | } |
---|
| 1153 | |
---|
[100] | 1154 | xRenderShiftedRangeR<bSet>(iCurSPos, iLastSPos, iCurPos, riError ); |
---|
[2] | 1155 | } |
---|
| 1156 | else |
---|
| 1157 | { |
---|
[100] | 1158 | if ( bSet ) |
---|
[2] | 1159 | { |
---|
[100] | 1160 | m_pcInputSamplesRow[iCurViewPos][ iCurPos ].bOccluded = true; |
---|
[2] | 1161 | } |
---|
| 1162 | } |
---|
| 1163 | } |
---|
| 1164 | } |
---|
| 1165 | |
---|
[100] | 1166 | template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void |
---|
| 1167 | TRenSingleModelC<iBM,bBitInc>::xFillHoleL( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError ) |
---|
[2] | 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; |
---|
[100] | 1183 | xSetShiftedPelL<bSet> ( iStartFillPos, 0, iStartFillSPosFP, REN_IS_FILLED, riError ); |
---|
[2] | 1184 | } |
---|
| 1185 | } |
---|
| 1186 | else |
---|
| 1187 | { |
---|
| 1188 | iStartFillSPosFP--; |
---|
| 1189 | } |
---|
| 1190 | |
---|
| 1191 | m_iThisDepth = m_iLastDepth; |
---|
[608] | 1192 | for (Int iFillSPos = std::max(iStartFillSPosFP+1,0); iFillSPos <= min(xRangeRightL( iLastSPos ), m_iLastOccludedSPosFP-1 ); iFillSPos++ ) |
---|
[2] | 1193 | { |
---|
[100] | 1194 | xSetShiftedPelL<bSet>( iLastPos, 0, iFillSPos, REN_IS_HOLE, riError ); |
---|
[2] | 1195 | } |
---|
| 1196 | } |
---|
| 1197 | |
---|
[100] | 1198 | template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void |
---|
| 1199 | TRenSingleModelC<iBM,bBitInc>::xFillHoleR( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError ) |
---|
[2] | 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; |
---|
[100] | 1215 | xSetShiftedPelR<bSet>( iEndFillPos, 1 << m_iShiftPrec , iStartFillSPosFP, REN_IS_FILLED, riError ); |
---|
[2] | 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 | { |
---|
[100] | 1226 | xSetShiftedPelR<bSet>( iLastPos, 1 << m_iShiftPrec, iFillSPos, REN_IS_HOLE, riError ); |
---|
[2] | 1227 | } |
---|
| 1228 | } |
---|
| 1229 | |
---|
[100] | 1230 | template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void |
---|
| 1231 | TRenSingleModelC<iBM,bBitInc>::xExtrapolateMarginL(Int iCurSPos, Int iCurPos, RMDist& riError ) |
---|
[2] | 1232 | { |
---|
| 1233 | // if (iLeftSPos < 0 ) |
---|
| 1234 | // return; |
---|
| 1235 | |
---|
[608] | 1236 | Int iSPosFullPel = std::max(0,xRangeLeftL(iCurSPos)); |
---|
[2] | 1237 | |
---|
| 1238 | m_iThisDepth = m_iCurDepth; |
---|
| 1239 | if (iSPosFullPel < m_iWidth) |
---|
| 1240 | { |
---|
[100] | 1241 | xSetShiftedPelL<bSet>( iCurPos, 0, iSPosFullPel, REN_IS_FILLED, riError ); |
---|
[2] | 1242 | } |
---|
| 1243 | |
---|
| 1244 | for (Int iFillSPos = iSPosFullPel +1; iFillSPos < m_iWidth; iFillSPos++ ) |
---|
| 1245 | { |
---|
[100] | 1246 | xSetShiftedPelL<bSet>( iCurPos, 0, iFillSPos, REN_IS_HOLE, riError ); |
---|
[2] | 1247 | } |
---|
| 1248 | } |
---|
| 1249 | |
---|
[100] | 1250 | template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void |
---|
| 1251 | TRenSingleModelC<iBM,bBitInc>::xExtrapolateMarginR(Int iCurSPos, Int iCurPos, RMDist& riError ) |
---|
[2] | 1252 | { |
---|
| 1253 | // if (iLeftSPos < 0 ) |
---|
| 1254 | // return; |
---|
| 1255 | |
---|
[608] | 1256 | Int iSPosFullPel = std::min(m_iWidth-1,xRangeRightR(iCurSPos)); |
---|
[2] | 1257 | |
---|
| 1258 | m_iThisDepth = m_iCurDepth; |
---|
| 1259 | if (iSPosFullPel > -1) |
---|
| 1260 | { |
---|
[100] | 1261 | xSetShiftedPelR<bSet>( iCurPos, 1 << m_iShiftPrec, iSPosFullPel, REN_IS_FILLED, riError ); |
---|
[2] | 1262 | } |
---|
| 1263 | |
---|
| 1264 | for (Int iFillSPos = iSPosFullPel -1; iFillSPos > -1; iFillSPos-- ) |
---|
| 1265 | { |
---|
[100] | 1266 | xSetShiftedPelR<bSet>( iCurPos , 1 << m_iShiftPrec, iFillSPos, REN_IS_HOLE, riError ); |
---|
[2] | 1267 | } |
---|
| 1268 | } |
---|
| 1269 | |
---|
[100] | 1270 | template <BlenMod iBM, Bool bBitInc> __inline Int |
---|
| 1271 | TRenSingleModelC<iBM,bBitInc>::xShiftNewData( Int iPosX, Int iPosInNewData ) |
---|
[2] | 1272 | { |
---|
[100] | 1273 | RM_AOT( iPosInNewData < 0 ); |
---|
| 1274 | RM_AOF( iPosInNewData < m_iNewDataWidth ); |
---|
[2] | 1275 | |
---|
[100] | 1276 | return (iPosX << m_iShiftPrec) - m_ppiCurLUT[0][ RenModRemoveBitInc( m_piNewDepthData[iPosInNewData] )]; |
---|
[2] | 1277 | } |
---|
| 1278 | |
---|
[100] | 1279 | template <BlenMod iBM, Bool bBitInc> __inline Int |
---|
| 1280 | TRenSingleModelC<iBM,bBitInc>::xShift( Int iPosX ) |
---|
[2] | 1281 | { |
---|
[100] | 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 )]; |
---|
[2] | 1286 | } |
---|
| 1287 | |
---|
| 1288 | |
---|
[100] | 1289 | template <BlenMod iBM, Bool bBitInc> __inline Int |
---|
| 1290 | TRenSingleModelC<iBM,bBitInc>::xShift( Int iPos, Int iPosInNewData ) |
---|
[2] | 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 | |
---|
[100] | 1302 | template <BlenMod iBM, Bool bBitInc> __inline Int |
---|
| 1303 | TRenSingleModelC<iBM,bBitInc>::xRangeLeftL( Int iPos ) |
---|
[2] | 1304 | { |
---|
| 1305 | return ( iPos + (1 << m_iShiftPrec) - 1) >> m_iShiftPrec; |
---|
| 1306 | } |
---|
| 1307 | |
---|
| 1308 | |
---|
[100] | 1309 | template <BlenMod iBM, Bool bBitInc> __inline Int |
---|
| 1310 | TRenSingleModelC<iBM,bBitInc>::xRangeLeftR( Int iPos ) |
---|
[2] | 1311 | { |
---|
| 1312 | |
---|
| 1313 | return xRangeRightR( iPos ) + 1; |
---|
| 1314 | } |
---|
| 1315 | |
---|
| 1316 | |
---|
[100] | 1317 | template <BlenMod iBM, Bool bBitInc> __inline Int |
---|
| 1318 | TRenSingleModelC<iBM,bBitInc>::xRangeRightL( Int iPos ) |
---|
[2] | 1319 | { |
---|
| 1320 | return xRangeLeftL(iPos) - 1; |
---|
| 1321 | } |
---|
| 1322 | |
---|
[100] | 1323 | template <BlenMod iBM, Bool bBitInc> __inline Int |
---|
| 1324 | TRenSingleModelC<iBM,bBitInc>::xRangeRightR( Int iPos ) |
---|
[2] | 1325 | { |
---|
| 1326 | return iPos >> m_iShiftPrec; |
---|
| 1327 | } |
---|
| 1328 | |
---|
| 1329 | |
---|
[100] | 1330 | template <BlenMod iBM, Bool bBitInc> __inline Int |
---|
| 1331 | TRenSingleModelC<iBM,bBitInc>::xRoundL( Int iPos ) |
---|
[2] | 1332 | { |
---|
| 1333 | return (iPos + (( 1 << m_iShiftPrec ) >> 1 )) >> m_iShiftPrec; |
---|
| 1334 | } |
---|
| 1335 | |
---|
[100] | 1336 | template <BlenMod iBM, Bool bBitInc> __inline Int |
---|
| 1337 | TRenSingleModelC<iBM,bBitInc>::xRoundR( Int iPos ) |
---|
[2] | 1338 | { |
---|
| 1339 | return (m_iShiftPrec == 0) ? iPos : xRoundL(iPos - 1); |
---|
| 1340 | } |
---|
| 1341 | |
---|
| 1342 | |
---|
[100] | 1343 | template <BlenMod iBM, Bool bBitInc> Void |
---|
| 1344 | TRenSingleModelC<iBM,bBitInc>::xSetPels( Pel* piPelSource , Int iSourceStride, Int iWidth, Int iHeight, Pel iVal ) |
---|
[2] | 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 | |
---|
[100] | 1356 | template <BlenMod iBM, Bool bBitInc> Void |
---|
| 1357 | TRenSingleModelC<iBM,bBitInc>::xSetInts( Int* piPelSource , Int iSourceStride, Int iWidth, Int iHeight, Int iVal ) |
---|
[2] | 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 | |
---|
[100] | 1370 | template <BlenMod iBM, Bool bBitInc> Void |
---|
| 1371 | TRenSingleModelC<iBM,bBitInc>::xSetBools( Bool* pbPelSource , Int iSourceStride, Int iWidth, Int iHeight, Bool bVal ) |
---|
[2] | 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 | |
---|
[100] | 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 ) |
---|
[2] | 1385 | { |
---|
[100] | 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 ); |
---|
[2] | 1392 | |
---|
[100] | 1393 | RenModelOutPels* pcOutSample = m_pcOutputSamplesRow + iTargetSPos; |
---|
| 1394 | RenModelInPels * pcInSample = m_pcInputSamplesRow[VIEWPOS_LEFT] + iSourcePos ; |
---|
[2] | 1395 | |
---|
[100] | 1396 | if ( iBM != BLEND_NONE ) |
---|
[2] | 1397 | { |
---|
[100] | 1398 | xSetShiftedPelBlendL<bSet> (pcInSample, iSubSourcePos, pcOutSample, iFilled, riError); |
---|
[2] | 1399 | } |
---|
[100] | 1400 | else |
---|
| 1401 | { |
---|
| 1402 | xSetShiftedPelNoBlendL<bSet>(pcInSample, iSubSourcePos, pcOutSample, iFilled, riError); |
---|
| 1403 | } |
---|
[2] | 1404 | } |
---|
| 1405 | |
---|
[100] | 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 ) |
---|
[2] | 1408 | { |
---|
[100] | 1409 | if ( bSet ) |
---|
| 1410 | { |
---|
| 1411 | // Filled |
---|
| 1412 | pcOutSample->iFilledLeft = iFilled; |
---|
[2] | 1413 | |
---|
[100] | 1414 | // Yuv |
---|
| 1415 | pcOutSample->iYLeft = pcInSample->aiY[iSubSourcePos]; |
---|
[608] | 1416 | #if H_3D_VSO_COLOR_PLANES |
---|
[100] | 1417 | pcOutSample->iULeft = pcInSample->aiU[iSubSourcePos]; |
---|
| 1418 | pcOutSample->iVLeft = pcInSample->aiV[iSubSourcePos]; |
---|
[2] | 1419 | |
---|
[100] | 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 | |
---|
[2] | 1428 | } |
---|
[100] | 1429 | else |
---|
| 1430 | { |
---|
[608] | 1431 | #if H_3D_VSO_COLOR_PLANES |
---|
[100] | 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 |
---|
[2] | 1439 | |
---|
[100] | 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; |
---|
[608] | 1448 | #if H_3D_VSO_COLOR_PLANES |
---|
[100] | 1449 | Pel piBlendedValueU; |
---|
| 1450 | Pel piBlendedValueV; |
---|
[2] | 1451 | #endif |
---|
[100] | 1452 | |
---|
| 1453 | xGetBlendedValue ( |
---|
| 1454 | pcInSample ->aiY[iSubSourcePos], |
---|
| 1455 | pcOutSample->iYRight, |
---|
[608] | 1456 | #if H_3D_VSO_COLOR_PLANES |
---|
[100] | 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 |
---|
[608] | 1467 | #if H_3D_VSO_COLOR_PLANES |
---|
[100] | 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; |
---|
[608] | 1479 | #if H_3D_VSO_COLOR_PLANES |
---|
[100] | 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; |
---|
[608] | 1489 | #if H_3D_VSO_COLOR_PLANES |
---|
[100] | 1490 | Int iDiffU = pcOutSample->iURef - piBlendedValueU; |
---|
| 1491 | Int iDiffV = pcOutSample->iVRef - piBlendedValueV; |
---|
| 1492 | pcOutSample->iError = xGetDist(iDiffY, iDiffU, iDiffV ); |
---|
[2] | 1493 | #else |
---|
[100] | 1494 | pcOutSample->iError = xGetDist(iDiffY ); |
---|
[2] | 1495 | #endif |
---|
| 1496 | } |
---|
| 1497 | else |
---|
| 1498 | { |
---|
[100] | 1499 | Int iDiffY = pcOutSample->iYRef - piBlendedValueY; |
---|
[608] | 1500 | #if H_3D_VSO_COLOR_PLANES |
---|
[100] | 1501 | Int iDiffU = pcOutSample->iURef - piBlendedValueU; |
---|
| 1502 | Int iDiffV = pcOutSample->iVRef - piBlendedValueV; |
---|
| 1503 | riError += ( xGetDist( iDiffY, iDiffU, iDiffV ) - pcOutSample->iError ); |
---|
| 1504 | |
---|
[2] | 1505 | #else |
---|
[100] | 1506 | riError += ( xGetDist( iDiffY ) - pcOutSample->iError ); |
---|
[2] | 1507 | #endif |
---|
[100] | 1508 | |
---|
[2] | 1509 | } |
---|
| 1510 | } |
---|
| 1511 | |
---|
[100] | 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 ) |
---|
[2] | 1515 | { |
---|
[100] | 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 ); |
---|
[2] | 1522 | |
---|
[100] | 1523 | RenModelOutPels* pcOutSample = m_pcOutputSamplesRow + iTargetSPos; |
---|
| 1524 | RenModelInPels * pcInSample = m_pcInputSamplesRow[VIEWPOS_RIGHT] + iSourcePos ; |
---|
[2] | 1525 | |
---|
[100] | 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]; |
---|
[608] | 1546 | #if H_3D_VSO_COLOR_PLANES |
---|
[100] | 1547 | pcOutSample->iURight = pcInSample->aiU[iSubSourcePos]; |
---|
| 1548 | pcOutSample->iVRight = pcInSample->aiV[iSubSourcePos]; |
---|
[2] | 1549 | |
---|
[100] | 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 |
---|
[2] | 1558 | |
---|
[100] | 1559 | } |
---|
| 1560 | else |
---|
| 1561 | { |
---|
[608] | 1562 | #if H_3D_VSO_COLOR_PLANES |
---|
[100] | 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 ); |
---|
[2] | 1569 | #endif |
---|
[100] | 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; |
---|
[608] | 1579 | #if H_3D_VSO_COLOR_PLANES |
---|
[100] | 1580 | Pel piBlendedValueU; |
---|
| 1581 | Pel piBlendedValueV; |
---|
[2] | 1582 | #endif |
---|
[100] | 1583 | |
---|
| 1584 | xGetBlendedValue ( |
---|
| 1585 | pcOutSample->iYLeft, |
---|
| 1586 | pcInSample ->aiY[iSubSourcePos], |
---|
[608] | 1587 | #if H_3D_VSO_COLOR_PLANES |
---|
[100] | 1588 | pcOutSample->iULeft, |
---|
| 1589 | pcInSample ->aiU[iSubSourcePos], |
---|
| 1590 | pcOutSample->iVLeft, |
---|
| 1591 | pcInSample ->aiV[iSubSourcePos], |
---|
[2] | 1592 | #endif |
---|
[100] | 1593 | m_piInvZLUTLeft [RenModRemoveBitInc(pcOutSample->iDLeft)], |
---|
| 1594 | m_piInvZLUTRight [RenModRemoveBitInc(m_iThisDepth) ], |
---|
| 1595 | pcOutSample->iFilledLeft, |
---|
| 1596 | iFilled, |
---|
| 1597 | piBlendedValueY |
---|
[608] | 1598 | #if H_3D_VSO_COLOR_PLANES |
---|
[2] | 1599 | , piBlendedValueU, |
---|
[100] | 1600 | piBlendedValueV |
---|
[2] | 1601 | #endif |
---|
| 1602 | ); |
---|
| 1603 | |
---|
[100] | 1604 | if ( bSet ) |
---|
| 1605 | { |
---|
| 1606 | // Set values |
---|
| 1607 | pcOutSample->iDRight = m_iThisDepth; |
---|
| 1608 | pcOutSample->iYRight = pcInSample ->aiY[iSubSourcePos]; |
---|
| 1609 | pcOutSample->iYBlended = piBlendedValueY; |
---|
[608] | 1610 | #if H_3D_VSO_COLOR_PLANES |
---|
[100] | 1611 | pcOutSample->iURight = pcInSample ->aiU[iSubSourcePos]; |
---|
| 1612 | pcOutSample->iUBlended = piBlendedValueU; |
---|
| 1613 | pcOutSample->iVRight = pcInSample ->aiV[iSubSourcePos]; |
---|
| 1614 | pcOutSample->iVBlended = piBlendedValueV; |
---|
[2] | 1615 | #endif |
---|
[100] | 1616 | pcOutSample->iFilledRight = iFilled; |
---|
[2] | 1617 | |
---|
[100] | 1618 | // Get Error |
---|
| 1619 | Int iDiffY = pcOutSample->iYRef - piBlendedValueY; |
---|
[608] | 1620 | #if H_3D_VSO_COLOR_PLANES |
---|
[100] | 1621 | Int iDiffU = pcOutSample->iURef - piBlendedValueU; |
---|
| 1622 | Int iDiffV = pcOutSample->iVRef - piBlendedValueV; |
---|
| 1623 | pcOutSample->iError = xGetDist(iDiffY, iDiffU, iDiffV ); |
---|
[2] | 1624 | #else |
---|
[100] | 1625 | pcOutSample->iError = xGetDist(iDiffY ); |
---|
[2] | 1626 | #endif |
---|
| 1627 | } |
---|
| 1628 | else |
---|
| 1629 | { |
---|
[100] | 1630 | Int iDiffY = pcOutSample->iYRef - piBlendedValueY; |
---|
[608] | 1631 | #if H_3D_VSO_COLOR_PLANES |
---|
[100] | 1632 | Int iDiffU = pcOutSample->iURef - piBlendedValueU; |
---|
| 1633 | Int iDiffV = pcOutSample->iVRef - piBlendedValueV; |
---|
| 1634 | riError += ( xGetDist( iDiffY, iDiffU, iDiffV ) - pcOutSample->iError ); |
---|
[2] | 1635 | #else |
---|
[100] | 1636 | riError += ( xGetDist( iDiffY ) - pcOutSample->iError ); |
---|
[2] | 1637 | #endif |
---|
| 1638 | } |
---|
| 1639 | } |
---|
| 1640 | |
---|
[100] | 1641 | template <BlenMod iBM, Bool bBitInc> __inline Int |
---|
| 1642 | TRenSingleModelC<iBM,bBitInc>::xGetDist( Int iDiffY, Int iDiffU, Int iDiffV ) |
---|
| 1643 | { |
---|
[2] | 1644 | |
---|
[100] | 1645 | if ( !bBitInc ) |
---|
| 1646 | { |
---|
| 1647 | return ( (iDiffY * iDiffY ) |
---|
| 1648 | + ((( (iDiffU * iDiffU ) |
---|
| 1649 | +(iDiffV * iDiffV ) |
---|
| 1650 | ) |
---|
| 1651 | ) >> 2 |
---|
[2] | 1652 | ) |
---|
[100] | 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 | } |
---|
[2] | 1666 | } |
---|
| 1667 | |
---|
[100] | 1668 | template <BlenMod iBM, Bool bBitInc> __inline Int |
---|
| 1669 | TRenSingleModelC<iBM,bBitInc>::xGetDist( Int iDiffY ) |
---|
[2] | 1670 | { |
---|
[100] | 1671 | if ( !bBitInc ) |
---|
| 1672 | { |
---|
| 1673 | return (iDiffY * iDiffY); |
---|
| 1674 | } |
---|
| 1675 | else |
---|
| 1676 | { |
---|
| 1677 | return ((iDiffY * iDiffY) >> m_iDistShift); |
---|
| 1678 | } |
---|
| 1679 | |
---|
[2] | 1680 | } |
---|
| 1681 | |
---|
[100] | 1682 | |
---|
[608] | 1683 | #if H_3D_VSO_COLOR_PLANES |
---|
[100] | 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 ) |
---|
[2] | 1686 | #else |
---|
[100] | 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 ) |
---|
[2] | 1689 | #endif |
---|
| 1690 | { |
---|
[100] | 1691 | |
---|
| 1692 | RM_AOT( iBM != BLEND_AVRG && iBM != BLEND_LEFT && iBM != BLEND_RIGHT ); |
---|
| 1693 | |
---|
| 1694 | if (iBM != BLEND_AVRG ) |
---|
[2] | 1695 | { |
---|
[100] | 1696 | if (iBM == BLEND_LEFT ) |
---|
[2] | 1697 | { |
---|
[608] | 1698 | #if H_3D_VSO_COLOR_PLANES |
---|
[2] | 1699 | xGetBlendedValueBM1( iYL, iYR, iUL, iUR, iVL, iVR, iDepthL, iDepthR, iFilledL, iFilledR, riY, riU, riV ); |
---|
[5] | 1700 | #else |
---|
| 1701 | xGetBlendedValueBM1( iYL, iYR, iDepthL, iDepthR, iFilledL, iFilledR, riY ); |
---|
| 1702 | #endif |
---|
[2] | 1703 | } |
---|
| 1704 | else |
---|
| 1705 | { |
---|
[608] | 1706 | #if H_3D_VSO_COLOR_PLANES |
---|
[2] | 1707 | xGetBlendedValueBM2( iYL, iYR, iUL, iUR, iVL, iVR, iDepthL, iDepthR, iFilledL, iFilledR, riY, riU, riV ); |
---|
[5] | 1708 | #else |
---|
| 1709 | xGetBlendedValueBM2( iYL, iYR, iDepthL, iDepthR, iFilledL, iFilledR, riY ); |
---|
| 1710 | #endif |
---|
[2] | 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 ); |
---|
[608] | 1724 | #if H_3D_VSO_COLOR_PLANES |
---|
[2] | 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) ); |
---|
[608] | 1733 | #if H_3D_VSO_COLOR_PLANES |
---|
[2] | 1734 | riU = xBlend( iUR, iUL, (iFilledL >> 1) ); |
---|
| 1735 | riV = xBlend( iVR, iVL, (iFilledL >> 1) ); |
---|
| 1736 | #endif |
---|
| 1737 | } |
---|
| 1738 | else |
---|
| 1739 | { |
---|
[81] | 1740 | riY = xBlend( iYL, iYR, m_iBlendDistWeight ); |
---|
[608] | 1741 | #if H_3D_VSO_COLOR_PLANES |
---|
[81] | 1742 | riU = xBlend( iUL, iUR, m_iBlendDistWeight ); |
---|
| 1743 | riV = xBlend( iVL, iVR, m_iBlendDistWeight ); |
---|
| 1744 | #endif |
---|
[2] | 1745 | } |
---|
| 1746 | } |
---|
| 1747 | else if ( iDepthDifference < 0 ) |
---|
| 1748 | { |
---|
| 1749 | riY = iYL; |
---|
[608] | 1750 | #if H_3D_VSO_COLOR_PLANES |
---|
[2] | 1751 | riU = iUL; |
---|
| 1752 | riV = iVL; |
---|
| 1753 | #endif |
---|
| 1754 | } |
---|
| 1755 | else |
---|
| 1756 | { |
---|
| 1757 | riY = iYR; |
---|
[608] | 1758 | #if H_3D_VSO_COLOR_PLANES |
---|
[2] | 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; |
---|
[608] | 1769 | #if H_3D_VSO_COLOR_PLANES |
---|
[2] | 1770 | riU = iUR; |
---|
| 1771 | riV = iVR; |
---|
| 1772 | #endif |
---|
| 1773 | } |
---|
| 1774 | else |
---|
| 1775 | { |
---|
| 1776 | riY = iYL; |
---|
[608] | 1777 | #if H_3D_VSO_COLOR_PLANES |
---|
[2] | 1778 | riU = iUL; |
---|
| 1779 | riV = iVL; |
---|
| 1780 | #endif |
---|
| 1781 | } |
---|
| 1782 | } |
---|
| 1783 | else |
---|
| 1784 | { |
---|
| 1785 | if (iFilledR == REN_IS_HOLE) |
---|
| 1786 | { |
---|
| 1787 | riY = iYL; |
---|
[608] | 1788 | #if H_3D_VSO_COLOR_PLANES |
---|
[2] | 1789 | riU = iUL; |
---|
| 1790 | riV = iVL; |
---|
| 1791 | #endif |
---|
| 1792 | } |
---|
| 1793 | else |
---|
| 1794 | { |
---|
| 1795 | riY = iYR; |
---|
[608] | 1796 | #if H_3D_VSO_COLOR_PLANES |
---|
[2] | 1797 | riU = iUR; |
---|
| 1798 | riV = iVR; |
---|
| 1799 | #endif |
---|
| 1800 | } |
---|
| 1801 | } |
---|
| 1802 | } |
---|
| 1803 | |
---|
[100] | 1804 | template <BlenMod iBM, Bool bBitInc> __inline Void |
---|
[608] | 1805 | #if H_3D_VSO_COLOR_PLANES |
---|
[100] | 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 ) |
---|
[5] | 1807 | #else |
---|
[100] | 1808 | TRenSingleModelC<iBM,bBitInc>::xGetBlendedValueBM1( Pel iYL, Pel iYR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY ) |
---|
[5] | 1809 | #endif |
---|
[2] | 1810 | { |
---|
[100] | 1811 | if ( iFilledL == REN_IS_FILLED || iFilledR == REN_IS_HOLE ) |
---|
[2] | 1812 | { |
---|
| 1813 | riY = iYL; |
---|
[608] | 1814 | #if H_3D_VSO_COLOR_PLANES |
---|
[2] | 1815 | riU = iUL; |
---|
| 1816 | riV = iVL; |
---|
| 1817 | #endif |
---|
| 1818 | } |
---|
| 1819 | else if ( iFilledL == REN_IS_HOLE ) |
---|
| 1820 | { |
---|
| 1821 | riY = iYR; |
---|
[608] | 1822 | #if H_3D_VSO_COLOR_PLANES |
---|
[2] | 1823 | riU = iUR; |
---|
| 1824 | riV = iVR; |
---|
| 1825 | #endif |
---|
| 1826 | } |
---|
| 1827 | else |
---|
| 1828 | { |
---|
| 1829 | riY = xBlend( iYR, iYL, iFilledL ); |
---|
[608] | 1830 | #if H_3D_VSO_COLOR_PLANES |
---|
[2] | 1831 | riU = xBlend( iUR, iUL, iFilledL ); |
---|
| 1832 | riV = xBlend( iVR, iUL, iFilledL ); |
---|
| 1833 | #endif |
---|
| 1834 | } |
---|
| 1835 | } |
---|
| 1836 | |
---|
[100] | 1837 | template <BlenMod iBM, Bool bBitInc> __inline Void |
---|
[608] | 1838 | #if H_3D_VSO_COLOR_PLANES |
---|
[100] | 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 ) |
---|
[5] | 1840 | #else |
---|
[100] | 1841 | TRenSingleModelC<iBM,bBitInc>::xGetBlendedValueBM2( Pel iYL, Pel iYR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY ) |
---|
[5] | 1842 | #endif |
---|
[2] | 1843 | { |
---|
| 1844 | if ( iFilledR == REN_IS_FILLED || iFilledL == REN_IS_HOLE ) |
---|
| 1845 | { |
---|
| 1846 | riY = iYR; |
---|
[608] | 1847 | #if H_3D_VSO_COLOR_PLANES |
---|
[2] | 1848 | riU = iUR; |
---|
| 1849 | riV = iVR; |
---|
| 1850 | #endif |
---|
| 1851 | } |
---|
| 1852 | else if ( iFilledR == REN_IS_HOLE ) |
---|
| 1853 | { |
---|
| 1854 | riY = iYL; |
---|
[608] | 1855 | #if H_3D_VSO_COLOR_PLANES |
---|
[2] | 1856 | riU = iUL; |
---|
| 1857 | riV = iVL; |
---|
| 1858 | #endif |
---|
| 1859 | } |
---|
| 1860 | else |
---|
| 1861 | { |
---|
| 1862 | riY = xBlend( iYL, iYR, iFilledR ); |
---|
[608] | 1863 | #if H_3D_VSO_COLOR_PLANES |
---|
[2] | 1864 | riU = xBlend( iUL, iUR, iFilledR ); |
---|
| 1865 | riV = xBlend( iVL, iUR, iFilledR ); |
---|
| 1866 | #endif |
---|
| 1867 | } |
---|
| 1868 | } |
---|
| 1869 | |
---|
[100] | 1870 | template <BlenMod iBM, Bool bBitInc> __inline Pel |
---|
| 1871 | TRenSingleModelC<iBM,bBitInc>::xBlend( Pel pVal1, Pel pVal2, Int iWeightVal2 ) |
---|
[2] | 1872 | { |
---|
| 1873 | return pVal1 + (Pel) ( ( (Int) ( pVal2 - pVal1) * iWeightVal2 + (1 << (REN_VDWEIGHT_PREC - 1)) ) >> REN_VDWEIGHT_PREC ); |
---|
| 1874 | } |
---|
[100] | 1875 | |
---|
| 1876 | template <BlenMod iBM, Bool bBitInc> Void |
---|
[124] | 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 | } |
---|
[100] | 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 | |
---|
[608] | 1894 | #if H_3D_VSO_EARLY_SKIP |
---|
[100] | 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 | } |
---|
[189] | 1959 | #endif |
---|
[608] | 1960 | #endif // H_3D |
---|
[210] | 1961 | |
---|