Changeset 795 in 3DVCSoftware for branches/HTM-9.3-dev1-MediaTek/source/Lib/TLibCommon/TComSlice.cpp
- Timestamp:
- 24 Jan 2014, 02:36:31 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-9.3-dev1-MediaTek/source/Lib/TLibCommon/TComSlice.cpp
r773 r795 3272 3272 #endif 3273 3273 3274 #if MTK_DDD_G0063 3275 if( getIsDepth() && getViewIndex() > 0 ) 3276 { 3277 TComSlice *pcTextSlice = getTexturePic()->getSlice( 0 ); 3278 memcpy( m_aiDDDInvScale, pcTextSlice->m_aiDDDInvScale, sizeof( Int ) * getViewIndex() ); 3279 memcpy( m_aiDDDInvOffset, pcTextSlice->m_aiDDDInvOffset, sizeof( Int ) * getViewIndex() ); 3280 memcpy( m_aiDDDShift, pcTextSlice->m_aiDDDShift, sizeof( Int ) * getViewIndex() ); 3281 } 3282 #endif 3283 3274 3284 if( !setupLUT ) 3275 3285 return; … … 3319 3329 m_depthToDisparityF[ i ][ d ] = ( invCodScale[ i ] * d + invOffset ) >> log2Div; 3320 3330 } 3321 } 3322 } 3323 #endif 3324 #endif 3331 3332 #if MTK_DDD_G0063 3333 InitializeDDDPara( vps->getCamParPrecision(), codScale[ i ], codOffset[ i ], i ); 3334 #endif 3335 } 3336 } 3337 #endif 3338 #endif 3339 3340 #if MTK_DDD_G0063 3341 Void TComSlice::InitializeDDDPara( UInt uiCamParsCodedPrecision, Int iCodedScale,Int iCodedOffset, Int iBaseViewIdx ) 3342 { 3343 UInt uiViewId = getViewIndex(); 3344 3345 if( uiViewId == 0 ) 3346 { 3347 m_aiDDDInvScale[ iBaseViewIdx ] = m_aiDDDInvOffset[ iBaseViewIdx ] = m_aiDDDShift[ iBaseViewIdx ] = 0; 3348 return; 3349 } 3350 3351 3352 Int iSign = iCodedScale >= 0 ? 1 : -1; 3353 iCodedScale = abs( iCodedScale ); 3354 3355 Int iBitWidth = 0; 3356 3357 const Int iInvPres = 9; 3358 3359 while( ((( 1 << iBitWidth ) << 1 ) <= iCodedScale ) ) 3360 { 3361 iBitWidth ++; 3362 } 3363 iBitWidth += iInvPres; 3364 Int iTargetValue = 1 << iBitWidth; 3365 3366 Int iMinError = MAX_INT; 3367 Int iBestD = 1 << ( iInvPres - 1 ); 3368 for( Int d = 1 << ( iInvPres - 1 ); d < ( 1 << iInvPres ); d++ ) 3369 { 3370 Int iError = abs( iCodedScale * d - iTargetValue ); 3371 if( iError < iMinError ) 3372 { 3373 iMinError = iError; 3374 iBestD = d; 3375 } 3376 if( iMinError == 0 ) 3377 { 3378 break; 3379 } 3380 } 3381 Int iRoundingDir = 0; 3382 if( iCodedScale * iBestD > iTargetValue ) 3383 { 3384 iRoundingDir = -1; 3385 } 3386 else if( iCodedScale * iBestD < iTargetValue ) 3387 { 3388 iRoundingDir = 1; 3389 } 3390 Int iCamPres = uiCamParsCodedPrecision - 1; 3391 m_aiDDDInvScale [ iBaseViewIdx ] = ( iBestD << ( iCamPres + g_bitDepthY )) * iSign; 3392 m_aiDDDInvOffset[ iBaseViewIdx ] = -iSign * iBestD * ( iCodedOffset << g_bitDepthY ); 3393 m_aiDDDShift [ iBaseViewIdx ] = iBitWidth; 3394 m_aiDDDInvOffset[ iBaseViewIdx ] += 1 << ( m_aiDDDShift[ iBaseViewIdx ] - 1 ); 3395 m_aiDDDInvOffset[ iBaseViewIdx ] += ( 1 << ( m_aiDDDShift[ iBaseViewIdx ] - 4 ) ) * iRoundingDir; 3396 3397 return; 3398 } 3399 #endif 3400 3325 3401 /** get scaling matrix from RefMatrixID 3326 3402 * \param sizeId size index
Note: See TracChangeset for help on using the changeset viewer.