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