Changeset 600 in 3DVCSoftware for branches/HTM-DEV-2.0-dev0/source
- Timestamp:
- 29 Aug 2013, 14:44:27 (11 years ago)
- Location:
- branches/HTM-DEV-2.0-dev0/source/Lib/TLibCommon
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-DEV-2.0-dev0/source/Lib/TLibCommon/TComDataCU.cpp
r598 r600 6320 6320 #endif 6321 6321 6322 #if H_3D_FIX6323 6322 #if H_3D_IC 6324 6323 Void TComDataCU::setICFlagSubParts( Bool bICFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) … … 7013 7012 } 7014 7013 #endif 7015 #else 7016 #if H_3D_IC 7017 Void TComDataCU::setICFlagSubParts( Bool bICFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) 7018 { 7019 memset( m_pbICFlag + uiAbsPartIdx, bICFlag, (m_pcPic->getNumPartInCU() >> ( 2 * uiDepth ))*sizeof(Bool) ); 7020 } 7021 7022 Bool TComDataCU::isICFlagRequired( UInt uiAbsPartIdx ) 7023 { 7024 UInt uiPartAddr; 7025 UInt iNumbPart; 7026 7027 if( !( getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N ) ) 7028 { 7029 return false; 7030 } 7031 7032 if( getSlice()->getIcSkipParseFlag() ) 7033 { 7034 if( getMergeFlag( uiAbsPartIdx ) && getMergeIndex( uiAbsPartIdx ) == 0 ) 7035 { 7036 return false; 7037 } 7038 } 7039 7040 if( getMergeFlag( uiAbsPartIdx ) ) 7041 { 7042 return true; 7043 } 7044 7045 7046 Int iWidth, iHeight; 7047 7048 iNumbPart = ( getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N ? 1 : ( getPartitionSize( uiAbsPartIdx ) == SIZE_NxN ? 4 : 2 ) ); 7049 7050 for(UInt i = 0; i < iNumbPart; i++) 7051 { 7052 getPartIndexAndSize( i, uiPartAddr, iWidth, iHeight, uiAbsPartIdx, true ); 7053 uiPartAddr += uiAbsPartIdx; 7054 7055 for(UInt uiRefIdx = 0; uiRefIdx < 2; uiRefIdx++) 7056 { 7057 RefPicList eRefList = uiRefIdx ? REF_PIC_LIST_1 : REF_PIC_LIST_0; 7058 Int iBestRefIdx = getCUMvField(eRefList)->getRefIdx(uiPartAddr); 7059 7060 if( ( getInterDir( uiPartAddr ) & ( uiRefIdx+1 ) ) && iBestRefIdx >= 0 && getSlice()->getViewIndex() != getSlice()->getRefPic( eRefList, iBestRefIdx )->getViewIndex() ) 7061 { 7062 return true; 7063 } 7064 } 7065 } 7066 7067 return false; 7068 } 7069 #if H_3D_DIM_DMM 7070 Void TComDataCU::setDmmWedgeTabIdxSubParts( UInt tabIdx, UInt dmmType, UInt uiAbsPartIdx, UInt uiDepth ) 7071 { 7072 UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); 7073 for( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) { m_dmmWedgeTabIdx[dmmType][uiAbsPartIdx+ui] = tabIdx; } 7074 } 7075 Void TComDataCU::setDmm2DeltaEndSubParts( Int iDelta, UInt uiAbsPartIdx, UInt uiDepth ) 7076 { 7077 UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); 7078 for( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) { m_dmm2DeltaEnd[uiAbsPartIdx+ui] = iDelta; } 7079 } 7080 Void TComDataCU::setDmm3IntraTabIdxSubParts( UInt uiTIdx, UInt uiAbsPartIdx, UInt uiDepth ) 7081 { 7082 UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); 7083 for( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) { m_dmm3IntraTabIdx[uiAbsPartIdx+ui] = uiTIdx; } 7084 } 7085 #endif 7086 #if H_3D_DIM_RBC 7087 Void TComDataCU::reconPartition( UInt uiAbsPartIdx, UInt uiDepth, Bool bLeft, UChar ucStartPos, UChar ucNumEdge, UChar* pucEdgeCode, Bool* pbRegion ) 7088 { 7089 Int iWidth; 7090 Int iHeight; 7091 if( uiDepth == 0 ) 7092 { 7093 iWidth = 64; 7094 iHeight = 64; 7095 } 7096 else if( uiDepth == 1 ) 7097 { 7098 iWidth = 32; 7099 iHeight = 32; 7100 } 7101 else if( uiDepth == 2 ) 7102 { 7103 iWidth = 16; 7104 iHeight = 16; 7105 } 7106 else if( uiDepth == 3 ) 7107 { 7108 iWidth = 8; 7109 iHeight = 8; 7110 } 7111 else // uiDepth == 4 7112 { 7113 iWidth = 4; 7114 iHeight = 4; 7115 } 7116 7117 Int iPtr = 0; 7118 Int iX, iY; 7119 Int iDir = -1; 7120 Int iDiffX = 0, iDiffY = 0; 7121 7122 // 1. Edge Code -> Vert & Horz Edges 7123 Bool* pbEdge = (Bool*) xMalloc( Bool, 4 * iWidth * iHeight ); 7124 7125 for( UInt ui = 0; ui < 4 * iWidth * iHeight; ui++ ) 7126 pbEdge [ ui ] = false; 7127 7128 // Direction : left(0), right(1), top(2), bottom(3), left-top(4), right-top(5), left-bottom(6), right-bottom(7) 7129 // Code : 0deg(0), 45deg(1), -45deg(2), 90deg(3), -90deg(4), 135deg(5), -135deg(6) 7130 const UChar tableDir[8][7] = { { 0, 6, 4, 3, 2, 7, 5 }, 7131 { 1, 5, 7, 2, 3, 4, 6 }, 7132 { 2, 4, 5, 0, 1, 6, 7 }, 7133 { 3, 7, 6, 1, 0, 5, 4 }, 7134 { 4, 0, 2, 6, 5, 3, 1 }, 7135 { 5, 2, 1, 4, 7, 0, 3 }, 7136 { 6, 3, 0, 7, 4, 1, 2 }, 7137 { 7, 1, 3, 5, 6, 2, 0 }}; 7138 7139 UChar ucCode = pucEdgeCode[iPtr++]; 7140 7141 if( !bLeft ) 7142 { 7143 iX = ucStartPos; 7144 iY = 0; 7145 7146 switch(ucCode) 7147 { 7148 case 0: // bottom 7149 iDir = 3; 7150 if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true; 7151 break; 7152 case 2: // left-bottom 7153 iDir = 6; 7154 if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true; 7155 break; 7156 case 1: // right-bottom 7157 iDir = 7; 7158 if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true; 7159 if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true; 7160 break; 7161 case 4: // left 7162 iDir = 0; 7163 assert(false); 7164 break; 7165 case 3: // right 7166 iDir = 1; 7167 if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true; 7168 if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true; 7169 break; 7170 } 7171 } 7172 else 7173 { 7174 iX = 0; 7175 iY = ucStartPos; 7176 7177 switch(ucCode) 7178 { 7179 case 0: // right 7180 iDir = 1; 7181 if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true; 7182 break; 7183 case 1: // right-top 7184 iDir = 5; 7185 if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true; 7186 if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true; 7187 break; 7188 case 2: // right-bottom 7189 iDir = 7; 7190 if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true; 7191 break; 7192 case 3: // top 7193 iDir = 2; 7194 if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true; 7195 if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true; 7196 break; 7197 case 4: // bottom 7198 iDir = 3; 7199 assert(false); 7200 break; 7201 } 7202 } 7203 7204 switch( iDir ) 7205 { 7206 case 0: // left 7207 iDiffX = -1; 7208 iDiffY = 0; 7209 break; 7210 case 1: // right 7211 iDiffX = +1; 7212 iDiffY = 0; 7213 break; 7214 case 2: // top 7215 iDiffX = 0; 7216 iDiffY = -1; 7217 break; 7218 case 3: // bottom 7219 iDiffX = 0; 7220 iDiffY = +1; 7221 break; 7222 case 4: // left-top 7223 iDiffX = -1; 7224 iDiffY = -1; 7225 break; 7226 case 5: // right-top 7227 iDiffX = +1; 7228 iDiffY = -1; 7229 break; 7230 case 6: // left-bottom 7231 iDiffX = -1; 7232 iDiffY = +1; 7233 break; 7234 case 7: // right-bottom 7235 iDiffX = +1; 7236 iDiffY = +1; 7237 break; 7238 } 7239 7240 iX += iDiffX; 7241 iY += iDiffY; 7242 7243 while( iPtr < ucNumEdge ) 7244 { 7245 ucCode = pucEdgeCode[iPtr++]; 7246 7247 Int iNewDir = tableDir[iDir][ucCode]; 7248 7249 switch( iNewDir ) 7250 { 7251 case 0: // left 7252 iDiffX = -1; 7253 iDiffY = 0; 7254 break; 7255 case 1: // right 7256 iDiffX = +1; 7257 iDiffY = 0; 7258 break; 7259 case 2: // top 7260 iDiffX = 0; 7261 iDiffY = -1; 7262 break; 7263 case 3: // bottom 7264 iDiffX = 0; 7265 iDiffY = +1; 7266 break; 7267 case 4: // left-top 7268 iDiffX = -1; 7269 iDiffY = -1; 7270 break; 7271 case 5: // right-top 7272 iDiffX = +1; 7273 iDiffY = -1; 7274 break; 7275 case 6: // left-bottom 7276 iDiffX = -1; 7277 iDiffY = +1; 7278 break; 7279 case 7: // right-bottom 7280 iDiffX = +1; 7281 iDiffY = +1; 7282 break; 7283 } 7284 7285 switch( iDir ) 7286 { 7287 case 0: // left 7288 switch( ucCode ) 7289 { 7290 case 0: 7291 case 2: 7292 if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true; 7293 break; 7294 case 1: 7295 case 3: 7296 if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true; 7297 if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true; 7298 break; 7299 case 4: 7300 case 6: 7301 // no 7302 break; 7303 case 5: 7304 if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true; 7305 if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true; 7306 if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true; 7307 break; 7308 } 7309 break; 7310 case 1: // right 7311 switch( ucCode ) 7312 { 7313 case 0: 7314 case 2: 7315 if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true; 7316 break; 7317 case 1: 7318 case 3: 7319 if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true; 7320 if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true; 7321 break; 7322 case 4: 7323 case 6: 7324 // no 7325 break; 7326 case 5: 7327 if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true; 7328 if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true; 7329 if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true; 7330 break; 7331 } 7332 break; 7333 case 2: // top 7334 switch( ucCode ) 7335 { 7336 case 0: 7337 case 2: 7338 if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true; 7339 break; 7340 case 1: 7341 case 3: 7342 if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true; 7343 if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true; 7344 break; 7345 case 4: 7346 case 6: 7347 // no 7348 break; 7349 case 5: 7350 if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true; 7351 if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true; 7352 if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true; 7353 break; 7354 } 7355 break; 7356 case 3: // bottom 7357 switch( ucCode ) 7358 { 7359 case 0: 7360 case 2: 7361 if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true; 7362 break; 7363 case 1: 7364 case 3: 7365 if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true; 7366 if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true; 7367 break; 7368 case 4: 7369 case 6: 7370 // no 7371 break; 7372 case 5: 7373 if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true; 7374 if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true; 7375 if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true; 7376 break; 7377 } 7378 break; 7379 case 4: // left-top 7380 switch( ucCode ) 7381 { 7382 case 0: 7383 case 1: 7384 if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true; 7385 if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true; 7386 break; 7387 case 2: 7388 case 4: 7389 if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true; 7390 break; 7391 case 3: 7392 case 5: 7393 if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true; 7394 if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true; 7395 if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true; 7396 break; 7397 case 6: 7398 // no 7399 break; 7400 } 7401 break; 7402 case 5: // right-top 7403 switch( ucCode ) 7404 { 7405 case 0: 7406 case 1: 7407 if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true; 7408 if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true; 7409 break; 7410 case 2: 7411 case 4: 7412 if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true; 7413 break; 7414 case 3: 7415 case 5: 7416 if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true; 7417 if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true; 7418 if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true; 7419 break; 7420 case 6: 7421 // no 7422 break; 7423 } 7424 break; 7425 case 6: // left-bottom 7426 switch( ucCode ) 7427 { 7428 case 0: 7429 case 1: 7430 if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true; 7431 if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true; 7432 break; 7433 case 2: 7434 case 4: 7435 if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true; 7436 break; 7437 case 3: 7438 case 5: 7439 if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true; 7440 if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true; 7441 if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true; 7442 break; 7443 case 6: 7444 // no 7445 break; 7446 } 7447 break; 7448 case 7: // right-bottom 7449 switch( ucCode ) 7450 { 7451 case 0: 7452 case 1: 7453 if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true; 7454 if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true; 7455 break; 7456 case 2: 7457 case 4: 7458 if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true; 7459 break; 7460 case 3: 7461 case 5: 7462 if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true; 7463 if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true; 7464 if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true; 7465 break; 7466 case 6: 7467 // no 7468 break; 7469 } 7470 break; 7471 } 7472 7473 assert( iX >= 0 && iX <= iWidth ); 7474 assert( iY >= 0 && iY <= iHeight ); 7475 7476 iX += iDiffX; 7477 iY += iDiffY; 7478 iDir = iNewDir; 7479 } 7480 7481 // finalize edge chain 7482 if( iX == iWidth-1 ) 7483 { 7484 if( iY == 0 ) 7485 { 7486 if( iDir == 1 ) 7487 { 7488 pbEdge[ 2 * iX + (2 * iY + 1) * 2 * iWidth ] = true; 7489 } 7490 else if( iDir == 5 ) 7491 { 7492 pbEdge[ 2 * iX + (2 * iY + 1) * 2 * iWidth ] = true; 7493 } 7494 else 7495 { 7496 assert(false); 7497 } 7498 } 7499 else if( iY == iHeight-1 ) 7500 { 7501 if( iDir == 3 ) 7502 { 7503 pbEdge[ 2 * iX - 1 + 2 * iY * 2 * iWidth ] = true; 7504 } 7505 else if( iDir == 7 ) 7506 { 7507 pbEdge[ 2 * iX - 1 + 2 * iY * 2 * iWidth ] = true; 7508 } 7509 else 7510 { 7511 assert(false); 7512 } 7513 } 7514 else 7515 { 7516 if( iDir == 1 ) 7517 { 7518 pbEdge[ 2 * iX + (2 * iY + 1) * 2 * iWidth ] = true; 7519 } 7520 else if( iDir == 3 ) 7521 { 7522 pbEdge[ 2 * iX - 1 + 2 * iY * 2 * iWidth ] = true; 7523 pbEdge[ 2 * iX + (2 * iY + 1) * 2 * iWidth ] = true; 7524 } 7525 else if( iDir == 5 ) 7526 { 7527 pbEdge[ 2 * iX + (2 * iY + 1) * 2 * iWidth ] = true; 7528 } 7529 else if( iDir == 7 ) 7530 { 7531 pbEdge[ 2 * iX - 1 + 2 * iY * 2 * iWidth ] = true; 7532 pbEdge[ 2 * iX + (2 * iY + 1) * 2 * iWidth ] = true; 7533 } 7534 else 7535 { 7536 assert(false); 7537 } 7538 } 7539 } 7540 else if( iX == 0 ) 7541 { 7542 if( iY == 0 ) 7543 { 7544 if( iDir == 2 ) 7545 { 7546 pbEdge[ 2 * iX + 1 + 2 * iY * 2 * iWidth ] = true; 7547 } 7548 else if( iDir == 4 ) 7549 { 7550 pbEdge[ 2 * iX + 1 + 2 * iY * 2 * iWidth ] = true; 7551 } 7552 else 7553 { 7554 assert(false); 7555 } 7556 } 7557 else if( iY == iHeight-1 ) 7558 { 7559 if( iDir == 0 ) 7560 { 7561 pbEdge[ 2 * iX + (2 * iY - 1) * 2 * iWidth ] = true; 7562 } 7563 else if( iDir == 6 ) 7564 { 7565 pbEdge[ 2 * iX + (2 * iY - 1) * 2 * iWidth ] = true; 7566 } 7567 else 7568 { 7569 assert(false); 7570 } 7571 } 7572 else 7573 { 7574 if( iDir == 0 ) 7575 { 7576 pbEdge[ 2 * iX + (2 * iY - 1) * 2 * iWidth ] = true; 7577 } 7578 else if( iDir == 2 ) 7579 { 7580 pbEdge[ 2 * iX + 1 + 2 * iY * 2 * iWidth ] = true; 7581 pbEdge[ 2 * iX + (2 * iY - 1) * 2 * iWidth ] = true; 7582 } 7583 else if( iDir == 4 ) 7584 { 7585 pbEdge[ 2 * iX + 1 + 2 * iY * 2 * iWidth ] = true; 7586 pbEdge[ 2 * iX + (2 * iY - 1) * 2 * iWidth ] = true; 7587 } 7588 else if( iDir == 6 ) 7589 { 7590 pbEdge[ 2 * iX + (2 * iY - 1) * 2 * iWidth ] = true; 7591 } 7592 else 7593 { 7594 assert(false); 7595 } 7596 } 7597 } 7598 else if( iY == 0 ) 7599 { 7600 if( iDir == 1 ) 7601 { 7602 pbEdge[ 2 * iX + (2 * iY + 1) * 2 * iWidth ] = true; 7603 pbEdge[ 2 * iX + 1 + 2 * iY * 2 * iWidth ] = true; 7604 } 7605 else if( iDir == 2 ) 7606 { 7607 pbEdge[ 2 * iX + 1 + 2 * iY * 2 * iWidth ] = true; 7608 } 7609 else if( iDir == 4 ) 7610 { 7611 pbEdge[ 2 * iX + 1 + 2 * iY * 2 * iWidth ] = true; 7612 } 7613 else if( iDir == 5 ) 7614 { 7615 pbEdge[ 2 * iX + (2 * iY + 1) * 2 * iWidth ] = true; 7616 pbEdge[ 2 * iX + 1 + 2 * iY * 2 * iWidth ] = true; 7617 } 7618 else 7619 { 7620 assert(false); 7621 } 7622 } 7623 else if( iY == iHeight-1 ) 7624 { 7625 if( iDir == 0 ) 7626 { 7627 pbEdge[ 2 * iX + (2 * iY - 1) * 2 * iWidth ] = true; 7628 pbEdge[ 2 * iX - 1 + 2 * iY * 2 * iWidth ] = true; 7629 } 7630 else if( iDir == 3 ) 7631 { 7632 pbEdge[ 2 * iX - 1 + 2 * iY * 2 * iWidth ] = true; 7633 } 7634 else if( iDir == 6 ) 7635 { 7636 pbEdge[ 2 * iX + (2 * iY - 1) * 2 * iWidth ] = true; 7637 pbEdge[ 2 * iX - 1 + 2 * iY * 2 * iWidth ] = true; 7638 } 7639 else if( iDir == 7 ) 7640 { 7641 pbEdge[ 2 * iX - 1 + 2 * iY * 2 * iWidth ] = true; 7642 } 7643 else 7644 { 7645 assert(false); 7646 } 7647 } 7648 else 7649 { 7650 printf("reconPartiton: wrong termination\n"); 7651 assert(false); 7652 } 7653 7654 // Reconstruct Region from Chain Code 7655 Bool* pbVisit = (Bool*) xMalloc( Bool, iWidth * iHeight ); 7656 Int* piStack = (Int* ) xMalloc( Int, iWidth * iHeight ); 7657 7658 for( UInt ui = 0; ui < iWidth * iHeight; ui++ ) 7659 { 7660 pbRegion[ ui ] = true; // fill it as region 1 (we'll discover region 0 next) 7661 pbVisit [ ui ] = false; 7662 } 7663 7664 iPtr = 0; 7665 piStack[iPtr++] = (0 << 8) | (0); 7666 pbRegion[ 0 ] = false; 7667 7668 while(iPtr > 0) 7669 { 7670 Int iTmp = piStack[--iPtr]; 7671 Int iX1, iY1; 7672 iX1 = iTmp & 0xff; 7673 iY1 = (iTmp >> 8) & 0xff; 7674 7675 pbVisit[ iX1 + iY1 * iWidth ] = true; 7676 7677 assert( iX1 >= 0 && iX1 < iWidth ); 7678 assert( iY1 >= 0 && iY1 < iHeight ); 7679 7680 if( iX1 > 0 && !pbEdge[ 2 * iX1 - 1 + 4 * iY1 * iWidth ] && !pbVisit[ iX1 - 1 + iY1 * iWidth ] ) 7681 { 7682 piStack[iPtr++] = (iY1 << 8) | (iX1 - 1); 7683 pbRegion[ iX1 - 1 + iY1 * iWidth ] = false; 7684 } 7685 if( iX1 < iWidth - 1 && !pbEdge[ 2 * iX1 + 1 + 4 * iY1 * iWidth ] && !pbVisit[ iX1 + 1 + iY1 * iWidth ] ) 7686 { 7687 piStack[iPtr++] = (iY1 << 8) | (iX1 + 1); 7688 pbRegion[ iX1 + 1 + iY1 * iWidth ] = false; 7689 } 7690 if( iY1 > 0 && !pbEdge[ 2 * iX1 + 2 * (2 * iY1 - 1) * iWidth ] && !pbVisit[ iX1 + (iY1 - 1) * iWidth ] ) 7691 { 7692 piStack[iPtr++] = ((iY1 - 1) << 8) | iX1; 7693 pbRegion[ iX1 + (iY1 - 1) * iWidth ] = false; 7694 } 7695 if( iY1 < iHeight - 1 && !pbEdge[ 2 * iX1 + 2 * (2 * iY1 + 1) * iWidth ] && !pbVisit[ iX1 + (iY1 + 1) * iWidth ] ) 7696 { 7697 piStack[iPtr++] = ((iY1 + 1) << 8) | iX1; 7698 pbRegion[ iX1 + (iY1 + 1) * iWidth ] = false; 7699 } 7700 } 7701 7702 xFree( pbEdge ); 7703 xFree( pbVisit ); 7704 xFree( piStack ); 7705 } 7706 #endif 7707 #endif 7708 #endif 7014 7709 7015 7710 7016 //! \} -
branches/HTM-DEV-2.0-dev0/source/Lib/TLibCommon/TypeDef.h
r598 r600 165 165 // FIX_SDC_ENC_RD_WVSO_D0163 166 166 // MTK_SAMPLE_BASED_SDC_D0110 167 #define H_3D_FIX 1 167 168 168 #if H_3D_FIX 169 169 #define H_3D_BVSP_FIX 1 //DV from NBDV instead of DoNBDV should be used
Note: See TracChangeset for help on using the changeset viewer.