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