Changeset 296 in 3DVCSoftware for trunk/source/Lib/TLibCommon/TComResidualGenerator.cpp
- Timestamp:
- 20 Feb 2013, 22:07:43 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/Lib/TLibCommon/TComResidualGenerator.cpp
r189 r296 44 44 45 45 46 #if H HI_INTER_VIEW_RESIDUAL_PRED46 #if H3D_IVRP 47 47 48 48 … … 184 184 AOF ( pcPic ); 185 185 186 #if MTK_MDIVRP_C0138 187 if (pcPic->getSPS()->getViewId() != 0) 188 { 189 return; 190 } 191 #endif 192 186 193 if( pcPic->getPOC() == 0 ) 187 194 { … … 219 226 } 220 227 221 #if QC_MULTI_DIS_CAN_A0097 228 #if H3D_NBDV 229 #if MTK_RELEASE_DV_CONSTRAINT_C0129 222 230 Bool 223 TComResidualGenerator::getResidualSamples( TComDataCU* pcCU, UInt uiPUIdx, TComYuv* pcYuv, Int iDisp 224 #if QC_SIMPLIFIEDIVRP_M24938 225 , Bool bRecon 226 #endif 227 ) 231 TComResidualGenerator::getResidualSamples( TComDataCU* pcCU, UInt uiPUIdx, TComYuv* pcYuv, TComMv iDisp, Bool bRecon ) 228 232 #else 229 233 Bool 230 TComResidualGenerator::getResidualSamples( TComDataCU* pcCU, UInt uiPUIdx, TComYuv* pcYuv 231 # if QC_SIMPLIFIEDIVRP_M24938232 , Bool bRecon 233 #endif 234 ) 235 #endif 234 TComResidualGenerator::getResidualSamples( TComDataCU* pcCU, UInt uiPUIdx, TComYuv* pcYuv, Int iDisp, Bool bRecon ) 235 #endif 236 #else 237 Bool 238 TComResidualGenerator::getResidualSamples( TComDataCU* pcCU, UInt uiPUIdx, TComYuv* pcYuv, Bool bRecon ) 239 #endif //H3D_NBDV 236 240 { 237 241 AOF( pcCU ); … … 243 247 iBlkHeight = pcCU->getHeight ( 0 ); 244 248 pcCU->getPic()->getPicYuvRec()->getTopLeftSamplePos( pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiPartAddr, iXPos, iYPos ); 245 #if QC_MULTI_DIS_CAN_A0097 246 return getResidualSamples( pcCU->getPic(), (UInt)iXPos, (UInt)iYPos, (UInt)iBlkWidth, (UInt)iBlkHeight, pcYuv, iDisp 247 #if QC_SIMPLIFIEDIVRP_M24938 248 , bRecon 249 #endif 250 ); 251 #else 252 return getResidualSamples( pcCU->getPic(), (UInt)iXPos, (UInt)iYPos, (UInt)iBlkWidth, (UInt)iBlkHeight, pcYuv 253 #if QC_SIMPLIFIEDIVRP_M24938 254 , bRecon 255 #endif 256 ); 257 #endif 249 #if H3D_NBDV 250 #if MTK_RELEASE_DV_CONSTRAINT_C0129 251 return getResidualSamples( pcCU->getPic(), (UInt)iXPos, (UInt)iYPos, (UInt)iBlkWidth, (UInt)iBlkHeight, pcYuv, iDisp, bRecon); 252 #else 253 return getResidualSamples( pcCU->getPic(), (UInt)iXPos, (UInt)iYPos, (UInt)iBlkWidth, (UInt)iBlkHeight, pcYuv, iDisp, bRecon); 254 #endif 255 #else 256 return getResidualSamples( pcCU->getPic(), (UInt)iXPos, (UInt)iYPos, (UInt)iBlkWidth, (UInt)iBlkHeight, pcYuv, bRecon); 257 #endif // H3D_NBDV 258 258 } 259 259 260 #if QC_MULTI_DIS_CAN_A0097 260 #if H3D_NBDV 261 #if MTK_RELEASE_DV_CONSTRAINT_C0129 261 262 Bool 262 TComResidualGenerator::getResidualSamples( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, Int iDisp 263 #if QC_SIMPLIFIEDIVRP_M24938 264 , Bool bRecon 265 #endif 266 ) 263 TComResidualGenerator::getResidualSamples( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, TComMv iDisp, Bool bRecon) 267 264 #else 268 265 Bool 269 TComResidualGenerator::getResidualSamples( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv 270 #if QC_SIMPLIFIEDIVRP_M24938 271 , Bool bRecon 272 #endif 273 ) 274 #endif 275 { 266 TComResidualGenerator::getResidualSamples( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, Int iDisp, Bool bRecon) 267 #endif 268 #else 269 Bool 270 TComResidualGenerator::getResidualSamples( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, Bool bRecon) 271 #endif 272 { 273 #if MTK_C0138_FIXED 274 UInt uiBaseViewId = 0; 275 #else 276 276 UInt uiBaseViewId = m_pcDepthMapGenerator->getBaseViewId( 0 ); 277 277 #endif 278 278 if( !pcYuv ) 279 279 { 280 280 pcYuv = m_ppcYuvTmp[1]; 281 281 } 282 #if QC_SIMPLIFIEDIVRP_M24938283 282 UInt uiXPosInRefView = uiXPos , uiYPosInRefView = uiYPos; 284 #endif 285 #if QC_MULTI_DIS_CAN_A0097 286 xSetPredResidualBlock( pcPic, uiBaseViewId, uiXPos, uiYPos, uiBlkWidth, uiBlkHeight, pcYuv, iDisp 287 #if QC_SIMPLIFIEDIVRP_M24938 288 , &uiXPosInRefView , &uiYPosInRefView , bRecon 289 #endif 290 ); 291 #else 292 xSetPredResidualBlock( pcPic, uiBaseViewId, uiXPos, uiYPos, uiBlkWidth, uiBlkHeight, pcYuv 293 #if QC_SIMPLIFIEDIVRP_M24938 294 , &uiXPosInRefView , &uiYPosInRefView , bRecon 295 #endif 296 ); 297 #endif 298 #if QC_SIMPLIFIEDIVRP_M24938 283 #if H3D_NBDV 284 #if MTK_RELEASE_DV_CONSTRAINT_C0129 285 xSetPredResidualBlock( pcPic, uiBaseViewId, uiXPos, uiYPos, uiBlkWidth, uiBlkHeight, pcYuv, iDisp, &uiXPosInRefView , &uiYPosInRefView , bRecon ); 286 #else 287 xSetPredResidualBlock( pcPic, uiBaseViewId, uiXPos, uiYPos, uiBlkWidth, uiBlkHeight, pcYuv, iDisp, &uiXPosInRefView , &uiYPosInRefView , bRecon ); 288 #endif 289 #else 290 xSetPredResidualBlock( pcPic, uiBaseViewId, uiXPos, uiYPos, uiBlkWidth, uiBlkHeight, pcYuv, &uiXPosInRefView , &uiYPosInRefView , bRecon ); 291 #endif 292 #if MTK_MDIVRP_C0138 293 return true; 294 #else 299 295 return xIsNonZeroByCBF( uiBaseViewId , uiXPosInRefView , uiYPosInRefView , uiBlkWidth , uiBlkHeight ); 300 #else 301 return xIsNonZero( pcYuv, uiBlkWidth, uiBlkHeight ); 302 #endif 303 } 304 305 #if QC_SIMPLIFIEDIVRP_M24938 296 #endif 297 } 298 306 299 Bool TComResidualGenerator::xIsNonZeroByCBF( UInt uiBaseViewId , UInt uiXPos , UInt uiYPos, UInt uiBlkWidth , UInt uiBlkHeight ) 307 300 { … … 329 322 return( false ); 330 323 } 331 #endif332 324 333 325 … … 419 411 Pel* pRes = pcCUResidual->getLumaAddr(); 420 412 UInt uiLumaTrMode, uiChromaTrMode; 421 #if LG_RESTRICTEDRESPRED_M24766 413 #if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138 422 414 Int iPUPredResiShift[4]; 423 415 #endif 424 416 pcCU->convertTransIdx ( 0, pcCU->getTransformIdx( 0 ), uiLumaTrMode, uiChromaTrMode ); 425 #if H0736_AVC_STYLE_QP_RANGE426 417 m_pcTrQuant->setQPforQuant ( pcCU->getQP( 0 ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 ); 427 #else428 m_pcTrQuant->setQPforQuant ( pcCU->getQP( 0 ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA, 0 );429 #endif430 418 m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_LUMA, pRes, 0, pcCUResidual->getStride(), uiWidth, uiHeight, uiLumaTrMode, 0, piCoeff ); 431 419 // chroma Cb … … 434 422 piCoeff = pcCU->getCoeffCb(); 435 423 pRes = pcCUResidual->getCbAddr(); 436 #if H0736_AVC_STYLE_QP_RANGE437 424 m_pcTrQuant->setQPforQuant ( pcCU->getQP( 0 ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), pcCU->getSlice()->getPPS()->getChromaQpOffset() ); 438 #else439 m_pcTrQuant->setQPforQuant ( pcCU->getQP( 0 ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC() );440 #endif441 425 m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_CHROMA_U, pRes, 0, pcCUResidual->getCStride(), uiWidth, uiHeight, uiChromaTrMode, 0, piCoeff ); 442 426 // chroma Cr … … 445 429 m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_CHROMA_V, pRes, 0, pcCUResidual->getCStride(), uiWidth, uiHeight, uiChromaTrMode, 0, piCoeff ); 446 430 431 #if !MTK_MDIVRP_C0138 447 432 if( pcCU->getResPredFlag( 0 ) ) 448 433 { 449 434 AOF( pcCU->getResPredAvail( 0 ) ); 450 Bool bOK = pcCU->getResidualSamples( 0, 451 #if QC_SIMPLIFIEDIVRP_M24938 452 true, 453 #endif 454 m_ppcYuvTmp[0] ); 435 Bool bOK = pcCU->getResidualSamples( 0, true, m_ppcYuvTmp[0] ); 455 436 AOF( bOK ); 456 437 #if LG_RESTRICTEDRESPRED_M24766 … … 461 442 #endif 462 443 } 444 #endif 463 445 464 446 //===== clear inter-view predicted parts ===== … … 517 499 518 500 519 #if QC_MULTI_DIS_CAN_A0097 501 #if H3D_NBDV 502 #if MTK_RELEASE_DV_CONSTRAINT_C0129 503 Void 504 TComResidualGenerator::xSetPredResidualBlock( TComPic* pcPic, UInt uiBaseViewId, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, TComMv iDisp 505 ,UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon ) 506 #else // MTK_RELEASE_DV_CONSTRAINT_C0129 520 507 Void 521 508 TComResidualGenerator::xSetPredResidualBlock( TComPic* pcPic, UInt uiBaseViewId, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, Int iDisp 522 #if QC_SIMPLIFIEDIVRP_M24938 523 , UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon 524 #endif 525 ) 526 #else 509 ,UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon) 510 #endif // MTK_RELEASE_DV_CONSTRAINT_C0129 511 #else // H3D_NBDV 527 512 Void 528 513 TComResidualGenerator::xSetPredResidualBlock( TComPic* pcPic, UInt uiBaseViewId, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv 529 #if QC_SIMPLIFIEDIVRP_M24938 530 , UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon 531 #endif 532 ) 533 #endif 514 , UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon ) 515 #endif // H3D_NBDV 534 516 { 535 517 //===== set and check some basic variables ===== … … 548 530 549 531 //===== get disparity ===== 550 #if QC_MULTI_DIS_CAN_A0097 532 #if H3D_NBDV 533 #if MTK_RELEASE_DV_CONSTRAINT_C0129 534 Int iDisparity_y = iDisp.getVer(); 535 Int iDisparity = iDisp.getHor(); 536 #else 551 537 Int iDisparity = iDisp; 552 #else 538 #endif 539 #else //H3D_NBDV 553 540 Int iMidPosX = Int( uiXPos + ( ( uiBlkWidth - 1 ) >> 1 ) ) >> m_pcDepthMapGenerator->getSubSampExpX(); 554 541 Int iMidPosY = Int( uiYPos + ( ( uiBlkHeight - 1 ) >> 1 ) ) >> m_pcDepthMapGenerator->getSubSampExpY(); 555 542 Int iDisparity = m_pcDepthMapGenerator->getDisparity( pcPic, iMidPosX, iMidPosY, uiBaseViewId ); 556 #endif 543 #endif //H3D_NBDV 557 544 //===== compensate luma ===== 558 545 Int iYWidth = Int( uiBlkWidth ); … … 562 549 Int iYRefPosX0 = Int( uiXPos ) + ( iDisparity >> 2 ); 563 550 Int iYRefPosX1 = iYRefPosX0 + 1; 551 #if MTK_RELEASE_DV_CONSTRAINT_C0129 552 Int iYMaxPosY = Int( uiPicHeight ) - 1; 553 Int iYWeight3 = ( iDisparity_y & 3 ); 554 Int iYWeight2 = 4 - iYWeight3; 555 Int iYRefPosY0 = Max( 0, Min( iYMaxPosY, Int( uiYPos ) + ( iDisparity_y >> 2 )) ); 556 Int iYRefPosY1 = Max( 0, Min( iYMaxPosY, iYRefPosY0 + 1 )); 557 #endif 564 558 Int iYMaxPosX = Int( uiPicWidth ) - 1; 565 559 Int iSrcStrideY = pcBaseRes->getStride (); 566 560 Int iDesStrideY = pcYuv ->getStride (); 561 #if MTK_RELEASE_DV_CONSTRAINT_C0129 562 Pel* pSrcSamplesY0= pcBaseRes->getLumaAddr ( 0 ) + iYRefPosY0 * iSrcStrideY; 563 Pel* pSrcSamplesY1= pcBaseRes->getLumaAddr ( 0 ) + iYRefPosY1 * iSrcStrideY; 564 #else 567 565 Pel* pSrcSamplesY= pcBaseRes->getLumaAddr ( 0 ) + uiYPos * iSrcStrideY; 566 #endif 568 567 Pel* pDesSamplesY= pcYuv ->getLumaAddr (); 569 568 570 #if QC_SIMPLIFIEDIVRP_M24938 569 571 570 if( puiXPosInRefView != NULL ) 572 571 *puiXPosInRefView = Max( 0, Min( iYMaxPosX, iYRefPosX0 ) ); … … 575 574 if( bRecon == false ) 576 575 return; 577 #endif 578 576 577 #if MTK_RELEASE_DV_CONSTRAINT_C0129 578 for( Int iY = 0; iY < iYHeight; iY++, pSrcSamplesY0 += iSrcStrideY, pSrcSamplesY1 += iSrcStrideY, pDesSamplesY += iDesStrideY ) 579 #else 579 580 for( Int iY = 0; iY < iYHeight; iY++, pSrcSamplesY += iSrcStrideY, pDesSamplesY += iDesStrideY ) 581 #endif 580 582 { 581 583 for( Int iX = 0; iX < iYWidth; iX++ ) … … 583 585 Int iXPic0 = Max( 0, Min( iYMaxPosX, iYRefPosX0 + iX ) ); 584 586 Int iXPic1 = Max( 0, Min( iYMaxPosX, iYRefPosX1 + iX ) ); 587 #if MTK_RELEASE_DV_CONSTRAINT_C0129 588 Pel Temp1,Temp2; 589 Temp1 =( iYWeight0 * pSrcSamplesY0[iXPic0] + iYWeight1 * pSrcSamplesY0[iXPic1] + 2 ) >> 2; 590 Temp2 =( iYWeight0 * pSrcSamplesY1[iXPic0] + iYWeight1 * pSrcSamplesY1[iXPic1] + 2 ) >> 2; 591 pDesSamplesY[iX] = ( iYWeight2 * Temp1 + iYWeight3 * Temp2 + 2 ) >> 2; 592 #else 585 593 pDesSamplesY[iX] = ( iYWeight0 * pSrcSamplesY[iXPic0] + iYWeight1 * pSrcSamplesY[iXPic1] + 2 ) >> 2; 594 #endif 586 595 } 587 596 } … … 594 603 Int iCRefPosX0 = Int( uiXPos >> 1 ) + ( iDisparity >> 3 ); 595 604 Int iCRefPosX1 = iCRefPosX0 + 1; 605 #if MTK_RELEASE_DV_CONSTRAINT_C0129 606 Int iCMaxPosY = Int( uiPicHeight >> 1 ) - 1; 607 Int iCWeight3 = ( iDisparity_y & 7 ); 608 Int iCWeight2 = 8 - iCWeight3; 609 Int iCRefPosY0 = Max( 0, Min( iCMaxPosY, Int( uiYPos >> 1 ) + ( iDisparity_y >> 3 )) ); 610 Int iCRefPosY1 = Max( 0, Min( iCMaxPosY, iCRefPosY0 + 1 )); 611 #endif 596 612 Int iCMaxPosX = Int( uiPicWidth >> 1 ) - 1; 597 613 Int iSrcStrideC = pcBaseRes->getCStride(); 598 614 Int iDesStrideC = pcYuv ->getCStride(); 615 #if MTK_RELEASE_DV_CONSTRAINT_C0129 616 Pel* pSrcSamplesU0= pcBaseRes->getCbAddr ( 0 ) + ( iCRefPosY0 >> 1 ) * iSrcStrideC; 617 Pel* pSrcSamplesU1= pcBaseRes->getCbAddr ( 0 ) + ( iCRefPosY1 >> 1 ) * iSrcStrideC; 618 Pel* pSrcSamplesV0= pcBaseRes->getCrAddr ( 0 ) + ( iCRefPosY0 >> 1 ) * iSrcStrideC; 619 Pel* pSrcSamplesV1= pcBaseRes->getCrAddr ( 0 ) + ( iCRefPosY1 >> 1 ) * iSrcStrideC; 620 #else 599 621 Pel* pSrcSamplesU= pcBaseRes->getCbAddr ( 0 ) + ( uiYPos >> 1 ) * iSrcStrideC; 600 622 Pel* pSrcSamplesV= pcBaseRes->getCrAddr ( 0 ) + ( uiYPos >> 1 ) * iSrcStrideC; 623 #endif 601 624 Pel* pDesSamplesU= pcYuv ->getCbAddr (); 602 625 Pel* pDesSamplesV= pcYuv ->getCrAddr (); 626 #if MTK_RELEASE_DV_CONSTRAINT_C0129 627 for( Int iY = 0; iY < iCHeight; iY++, pSrcSamplesU0 += iSrcStrideC, pSrcSamplesU1 += iSrcStrideC, pDesSamplesU += iDesStrideC, 628 pSrcSamplesV0 += iSrcStrideC, pSrcSamplesV1 += iSrcStrideC, pDesSamplesV += iDesStrideC ) 629 #else 603 630 for( Int iY = 0; iY < iCHeight; iY++, pSrcSamplesU += iSrcStrideC, pDesSamplesU += iDesStrideC, 604 631 pSrcSamplesV += iSrcStrideC, pDesSamplesV += iDesStrideC ) 632 #endif 605 633 { 606 634 for( Int iX = 0; iX < iCWidth; iX++ ) … … 608 636 Int iXPic0 = Max( 0, Min( iCMaxPosX, iCRefPosX0 + iX ) ); 609 637 Int iXPic1 = Max( 0, Min( iCMaxPosX, iCRefPosX1 + iX ) ); 638 #if MTK_RELEASE_DV_CONSTRAINT_C0129 639 Pel Temp1,Temp2; 640 Temp1 =( iCWeight0 * pSrcSamplesU0[iXPic0] + iCWeight1 * pSrcSamplesU0[iXPic1] + 4 ) >> 3; 641 Temp2 =( iCWeight0 * pSrcSamplesU1[iXPic0] + iCWeight1 * pSrcSamplesU1[iXPic1] + 4 ) >> 3; 642 pDesSamplesU[iX] = ( iCWeight2 * Temp1 + iCWeight3 * Temp2 + 4 ) >> 3; 643 Temp1 =( iCWeight0 * pSrcSamplesV0[iXPic0] + iCWeight1 * pSrcSamplesV0[iXPic1] + 4 ) >> 3; 644 Temp2 =( iCWeight0 * pSrcSamplesV1[iXPic0] + iCWeight1 * pSrcSamplesV1[iXPic1] + 4 ) >> 3; 645 pDesSamplesV[iX] = ( iCWeight2 * Temp1 + iCWeight3 * Temp2 + 4 ) >> 3; 646 #else 610 647 pDesSamplesU[iX] = ( iCWeight0 * pSrcSamplesU[iXPic0] + iCWeight1 * pSrcSamplesU[iXPic1] + 4 ) >> 3; 611 648 pDesSamplesV[iX] = ( iCWeight0 * pSrcSamplesV[iXPic0] + iCWeight1 * pSrcSamplesV[iXPic1] + 4 ) >> 3; 649 #endif 612 650 } 613 651 } … … 705 743 706 744 707 #endif // H HI_INTER_VIEW_RESIDUAL_PRED708 745 #endif // H3D_IVRP 746
Note: See TracChangeset for help on using the changeset viewer.