Changeset 443 in 3DVCSoftware for trunk/source
- Timestamp:
- 26 May 2013, 15:41:34 (12 years ago)
- Location:
- trunk/source
- Files:
-
- 61 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/App/TAppDecoder/TAppDecTop.cpp
r296 r443 735 735 736 736 #if MERL_VSP_C0152 737 Void TAppDecTop::setBWVSPLUT(TComSlice* pcSlice, Int iCodedViewIdx, Int iCurPoc) 737 Void TAppDecTop::setBWVSPLUT( 738 #if MERL_VSP_NBDV_RefVId_Fix_D0166 739 Int iNeighborViewId, 740 #endif 741 TComSlice* pcSlice, Int iCodedViewIdx, Int iCurPoc) 742 738 743 { 739 744 //first view does not have VSP … … 742 747 AOT( iCodedViewIdx <= 0); 743 748 //AOT( iCodedViewIdx >= m_iNumberOfViews ); 749 #if !MERL_VSP_NBDV_RefVId_Fix_D0166 744 750 Int iNeighborViewId = 0; 751 #endif 745 752 // Int* piShiftLUT = bRenderFromLeft ? m_cCamParsCollector.getBaseViewShiftLUTI()[iCodedViewIdx][iNeighborViewId][0] : m_cCamParsCollector.getBaseViewShiftLUTI()[iNeighborViewId][iCodedViewIdx][0]; 746 753 Int* piShiftLUT = m_cCamParsCollector.getBaseViewShiftLUTI()[iNeighborViewId][iCodedViewIdx][0]; 754 #if MERL_VSP_NBDV_RefVId_Fix_D0166 755 pcSlice->setBWVSPLUTParam(piShiftLUT, 2-LOG2_DISP_PREC_LUT, iNeighborViewId ); 756 #else 747 757 pcSlice->setBWVSPLUTParam(piShiftLUT, 2-LOG2_DISP_PREC_LUT ); 758 #endif 748 759 } 749 760 #endif -
trunk/source/App/TAppDecoder/TAppDecTop.h
r296 r443 113 113 114 114 #if MERL_VSP_C0152 115 #if MERL_VSP_NBDV_RefVId_Fix_D0166 116 Void setBWVSPLUT( Int iNeighborViewId, TComSlice* pcSlice, Int iCodedViewIdx, Int iCurPoc ); 117 #else 115 118 Void setBWVSPLUT( TComSlice* pcSlice, Int iCodedViewIdx, Int iCurPoc ); 119 #endif 116 120 #endif 117 121 -
trunk/source/App/TAppEncoder/TAppEncCfg.cpp
r332 r443 383 383 #endif 384 384 #if H3D_IVRP 385 #if QC_ARP_D0177 386 ("MultiviewResPred", m_nUseAdvResPred, (UInt)0, "usage of Advanced residual prediction" ) 387 #else 385 388 ("MultiviewResPred", m_uiMultiviewResPredMode, (UInt)0, "usage of inter-view residual prediction" ) 389 #endif 390 #endif 391 #if MTK_D0156 392 ("UseVSPCompensation", m_bUseVSPCompensation, true, "Depth dependent tools: BVSP" ) 393 ("UseDVPRefine", m_bUseDVPRefine, true, "Depth dependent tools: DoNBDV" ) 386 394 #endif 387 395 … … 392 400 ("SAO", m_abUseSAO, std::vector<Bool>(1, true), "SAO") 393 401 ("MaxNumOffsetsPerPic", m_maxNumOffsetsPerPic, 2048, "2048: default") 402 #if LGE_SAO_MIGRATION_D0091 403 ("SAOLcuBoundary", m_saoLcuBoundary, false, "0: right/bottom LCU boundary areas skipped from SAO parameter estimation, 1: non-deblocked pixels are used for those areas") 404 ("SAOLcuBasedOptimization", m_saoLcuBasedOptimization, true, "0: SAO picture-based optimization, 1: SAO LCU-based optimization ") 405 #else 394 406 ("SAOInterleaving", m_saoInterleavingFlag, false, "0: SAO Picture Mode, 1: SAO Interleaving ") 407 #endif 395 408 396 409 ("ALFEncodePassReduction", m_iALFEncodePassReduction, 0, "0:Original 16-pass, 1: 1-pass, 2: 2-pass encoding") … … 917 930 #endif 918 931 #if H3D_IVRP 932 #if QC_ARP_D0177 933 #if QC_ARP_WARNING_FIX 934 xConfirmPara ( m_nUseAdvResPred > 1 , "0<=ARP<=1" ); 935 #else 936 xConfirmPara ( m_nUseAdvResPred < 0 || m_nUseAdvResPred > 1 , "0<=ARP<=1" ); 937 #endif 938 #else 919 939 xConfirmPara ( m_uiMultiviewResPredMode > 1, "MultiviewResPred must be less than or equal to 1" ); 920 940 xConfirmPara ( m_uiMultiviewResPredMode > 0 && m_uiPredDepthMapGeneration == 0 , "MultiviewResPred > 0 requires PredDepthMapGen > 0" ); 941 #endif 921 942 #endif 922 943 if( m_bUsingDepthMaps ) … … 1625 1646 printf("CIP:%d ", m_bUseConstrainedIntraPred); 1626 1647 printf("PCM:%d ", (m_usePCM && (1<<m_uiPCMLog2MinSize) <= m_uiMaxCUWidth)? 1 : 0); 1648 #if LGE_SAO_MIGRATION_D0091 1649 printf("SAOLcuBasedOptimization:%d ", (m_saoLcuBasedOptimization)?(1):(0)); 1650 #else 1627 1651 printf("SAOInterleaving:%d ", (m_saoInterleavingFlag)?(1):(0)); 1652 #endif 1628 1653 #if LOSSLESS_CODING 1629 1654 printf("LosslessCuEnabled:%d ", (m_useLossless)? 1:0 ); … … 1672 1697 printf("IVSEnable: %d ", m_bUseIVS); 1673 1698 #endif 1699 #if QC_ARP_D0177 1700 printf(" ARP:%d " , m_nUseAdvResPred ); 1701 #endif 1674 1702 printf("\n"); 1675 1703 … … 1708 1736 printf("DLT:%d ", m_bUseDLT ? 1 : 0 ); 1709 1737 #endif 1738 1739 #if MTK_D0156 1740 printf("BVSP:%d ", m_bUseVSPCompensation ? 1 : 0 ); 1741 printf("DoNBDV:%d ", m_bUseDVPRefine ? 1 : 0 ); 1742 #endif 1743 1710 1744 #if LGE_WVSO_A0119 1711 1745 if ( m_bUseWVSO ) -
trunk/source/App/TAppEncoder/TAppEncCfg.h
r332 r443 165 165 #endif 166 166 Int m_maxNumOffsetsPerPic; ///< SAO maximun number of offset per picture 167 #if LGE_SAO_MIGRATION_D0091 168 Bool m_saoLcuBoundary; ///< SAO parameter estimation using non-deblocked pixels for LCU bottom and right boundary areas 169 Bool m_saoLcuBasedOptimization; ///< SAO LCU-based optimization 170 #else 167 171 Bool m_saoInterleavingFlag; ///< SAO interleaving flag 172 #endif 168 173 // coding tools (loop filter) 169 174 vector<Bool> m_abUseALF; ///< flag for using adaptive loop filter [0] - video, [1] - depth … … 217 222 Double m_dMultiviewMvRegLambdaScale; ///< lambda scale for multiview motion vectors regularization 218 223 #endif 219 #if H3D_IVRP 224 #if H3D_IVRP 225 #if QC_ARP_D0177 226 UInt m_nUseAdvResPred; 227 #else 220 228 UInt m_uiMultiviewResPredMode; ///< using multiview residual prediction 229 #endif 221 230 #endif 222 231 … … 317 326 #endif 318 327 328 #if MTK_D0156 329 330 #if MERL_VSP_COMPENSATION_C0152 331 Bool m_bUseVSPCompensation; 332 #endif 333 334 Bool m_bUseDVPRefine; 335 #endif 336 319 337 // internal member functions 320 338 Void xSetGlobal (); ///< set global variables -
trunk/source/App/TAppEncoder/TAppEncTop.cpp
r332 r443 223 223 #endif 224 224 #if H3D_IVRP 225 #if QC_ARP_D0177 226 m_acTEncTopList[iViewIdx]->setUseAdvRP ( iViewIdx ? m_nUseAdvResPred : 0 ); 227 m_acTEncTopList[iViewIdx]->setARPStepNum ( iViewIdx ? QC_ARP_WFNR : 1 ); 228 #else 225 229 m_acTEncTopList[iViewIdx]->setMultiviewResPredMode ( m_uiMultiviewResPredMode ); 230 #endif 231 #endif 232 #if MTK_D0156 233 #if MERL_VSP_COMPENSATION_C0152 234 m_acTEncTopList[iViewIdx]->setUseVSPCompensation ( iViewIdx ? m_bUseVSPCompensation : 0 ); 235 #endif 236 m_acTEncTopList[iViewIdx]->setUseDVPRefine ( iViewIdx ? m_bUseDVPRefine : 0 ); 226 237 #endif 227 238 … … 303 314 #endif 304 315 m_acTEncTopList[iViewIdx]->setMaxNumOffsetsPerPic (m_maxNumOffsetsPerPic); 316 #if LGE_SAO_MIGRATION_D0091 317 m_acTEncTopList[iViewIdx]->setSaoLcuBoundary (m_saoLcuBoundary); 318 m_acTEncTopList[iViewIdx]->setSaoLcuBasedOptimization (m_saoLcuBasedOptimization); 319 #else 305 320 m_acTEncTopList[iViewIdx]->setSaoInterleavingFlag (m_saoInterleavingFlag); 321 #endif 306 322 m_acTEncTopList[iViewIdx]->setPCMInputBitDepthFlag ( m_bPCMInputBitDepthFlag); 307 323 m_acTEncTopList[iViewIdx]->setPCMFilterDisableFlag ( m_bPCMFilterDisableFlag); … … 560 576 m_acTEncDepthTopList[iViewIdx]->setMultiviewMvRegLambdaScale ( 0.0 ); 561 577 #endif 562 #if H3D_IVRP 563 m_acTEncDepthTopList[iViewIdx]->setMultiviewResPredMode ( 0 ); 578 #if H3D_IVRP 579 #if QC_ARP_D0177 580 m_acTEncDepthTopList[iViewIdx]->setUseAdvRP ( 0 ); 581 m_acTEncDepthTopList[iViewIdx]->setARPStepNum ( 1 ); 582 #else 583 m_acTEncDepthTopList[iViewIdx]->setMultiviewResPredMode ( 0 ); 584 #endif 585 #endif 586 #if MTK_D0156 587 588 #if MERL_VSP_COMPENSATION_C0152 589 m_acTEncDepthTopList[iViewIdx]->setUseVSPCompensation ( iViewIdx ? true : false ); 590 #endif 591 592 m_acTEncDepthTopList[iViewIdx]->setUseDVPRefine ( iViewIdx ? true : false ); 564 593 #endif 565 594 … … 605 634 #endif 606 635 m_acTEncDepthTopList[iViewIdx]->setMaxNumOffsetsPerPic (m_maxNumOffsetsPerPic); 636 #if LGE_SAO_MIGRATION_D0091 637 m_acTEncDepthTopList[iViewIdx]->setSaoLcuBoundary (m_saoLcuBoundary); 638 m_acTEncDepthTopList[iViewIdx]->setSaoLcuBasedOptimization (m_saoLcuBasedOptimization); 639 #else 607 640 m_acTEncDepthTopList[iViewIdx]->setSaoInterleavingFlag (m_saoInterleavingFlag); 641 #endif 608 642 m_acTEncDepthTopList[iViewIdx]->setPCMInputBitDepthFlag ( m_bPCMInputBitDepthFlag); 609 643 m_acTEncDepthTopList[iViewIdx]->setPCMFilterDisableFlag ( m_bPCMFilterDisableFlag); … … 1076 1110 #if MERL_VSP_C0152 1077 1111 #if MERL_VSP_C0152_BugFix_ForNoDepthCase 1078 if(m_bUsingDepthMaps) // VSP can be used only when depth is available as input1112 if(m_bUsingDepthMaps) // VSP can be used only when depth is available as input 1079 1113 { 1080 1114 #endif … … 1087 1121 pEncSlice->setRefPicBaseTxt(pcBaseTxtPic); 1088 1122 pEncSlice->setRefPicBaseDepth(pcBaseDepthPic); 1123 #if MERL_VSP_NBDV_RefVId_Fix_D0166 1124 for (Int refViewId=0; refViewId < iViewIdx; refViewId++ ) 1125 { 1126 pEncSlice->setListDepthPic(m_acTEncDepthTopList[refViewId]->getListPic(), refViewId ); // The list will store only the depth pictures 1127 setBWVSPLUT(refViewId, iViewIdx, gopId, false); 1128 } 1129 #endif 1089 1130 } 1131 #if !MERL_VSP_NBDV_RefVId_Fix_D0166 1090 1132 setBWVSPLUT( iViewIdx, gopId, false); 1133 #endif 1134 #endif 1135 1091 1136 #if MERL_VSP_C0152_BugFix_ForNoDepthCase 1092 1137 } … … 1103 1148 #endif 1104 1149 1105 #endif1106 1150 // call encoding function for one frame 1107 1151 m_acTEncTopList[iViewIdx]->encode( eos[iViewIdx], pcPicYuvOrg, *m_picYuvRec[iViewIdx], outputAccessUnits, iNumEncoded, gopId ); … … 1118 1162 TEncSlice* pcSlice = (TEncSlice*) m_acTEncDepthTopList[iViewIdx]->getSliceEncoder(); 1119 1163 pcSlice->setRefPicBaseDepth(pcBaseDepthPic); 1164 #if MERL_VSP_NBDV_RefVId_Fix_D0166 1165 for (Int refViewId=0; refViewId < iViewIdx; refViewId++ ) 1166 { 1167 pcSlice->setListDepthPic(m_acTEncDepthTopList[refViewId]->getListPic(), refViewId ); // The list will store only the depth pictures 1168 setBWVSPLUT( refViewId, iViewIdx, gopId, true); 1169 } 1170 #endif 1120 1171 } 1172 #if !MERL_VSP_NBDV_RefVId_Fix_D0166 1121 1173 setBWVSPLUT( iViewIdx, gopId, true); 1174 #endif 1122 1175 #endif 1123 1176 … … 1636 1689 1637 1690 #if MERL_VSP_C0152 1638 Void TAppEncTop::setBWVSPLUT(Int iCodedViewIdx, Int gopId, Bool isDepth) 1691 1692 Void TAppEncTop::setBWVSPLUT( 1693 #if MERL_VSP_NBDV_RefVId_Fix_D0166 1694 Int iNeighborViewId, 1695 #endif 1696 Int iCodedViewIdx, Int gopId, Bool isDepth) 1639 1697 { 1640 1698 //first view does not have VSP … … 1643 1701 AOT( iCodedViewIdx <= 0); 1644 1702 AOT( iCodedViewIdx >= m_iNumberOfViews ); 1645 1703 #if !MERL_VSP_NBDV_RefVId_Fix_D0166 1646 1704 Int iNeighborViewId = 0; 1705 #endif 1647 1706 //setting look-up table 1648 1707 Int* piShiftLUT = m_cCameraData.getBaseViewShiftLUTI()[iNeighborViewId][iCodedViewIdx][0]; … … 1651 1710 { 1652 1711 TEncSlice* pcEncSlice = (TEncSlice*) m_acTEncDepthTopList[iCodedViewIdx]->getSliceEncoder(); 1712 #if MERL_VSP_NBDV_RefVId_Fix_D0166 1713 pcEncSlice->setBWVSPLUTParam( piShiftLUT, LOG2_DISP_PREC_LUT, iNeighborViewId ); 1714 #else 1653 1715 pcEncSlice->setBWVSPLUTParam( piShiftLUT, LOG2_DISP_PREC_LUT ); 1716 #endif 1654 1717 } 1655 1718 else 1656 1719 { 1657 1720 TEncSlice* pcEncSlice = (TEncSlice*) m_acTEncTopList[iCodedViewIdx]->getSliceEncoder(); 1721 #if MERL_VSP_NBDV_RefVId_Fix_D0166 1722 pcEncSlice->setBWVSPLUTParam( piShiftLUT, LOG2_DISP_PREC_LUT, iNeighborViewId ); 1723 #else 1658 1724 pcEncSlice->setBWVSPLUTParam( piShiftLUT, LOG2_DISP_PREC_LUT ); 1725 #endif 1659 1726 } 1660 1727 -
trunk/source/App/TAppEncoder/TAppEncTop.h
r296 r443 167 167 168 168 #if MERL_VSP_C0152 169 #if MERL_VSP_NBDV_RefVId_Fix_D0166 170 Void setBWVSPLUT( Int refViewIdx, Int iCodedViewIdx, Int gopId, Bool isDepth); 171 #else 169 172 Void setBWVSPLUT( Int iCodedViewIdx, Int gopId, Bool isDepth); 173 #endif 170 174 #endif 171 175 };// END CLASS DEFINITION TAppEncTop -
trunk/source/Lib/TLibCommon/CommonDef.h
r333 r443 58 58 59 59 #define HM_VERSION "6.1" 60 #define NV_VERSION " 6.2" ///< Current software version60 #define NV_VERSION "7.0" ///< Current software version 61 61 62 62 // ==================================================================================================================== -
trunk/source/Lib/TLibCommon/ContextTables.h
r332 r443 101 101 #define NUM_ALF_SVLC_CTX 3 ///< number of context models for ALF SVLC (filter coeff.) 102 102 103 #if LGE_SAO_MIGRATION_D0091 104 #define NUM_SAO_MERGE_FLAG_CTX 1 ///< number of context models for SAO merge flags 105 #define NUM_SAO_TYPE_IDX_CTX 1 ///< number of context models for SAO type index 106 #else 103 107 #define NUM_SAO_FLAG_CTX 1 ///< number of context models for SAO flag 104 108 #define NUM_SAO_UVLC_CTX 2 ///< number of context models for SAO UVLC … … 108 112 #define NUM_SAO_MERGE_UP_FLAG_CTX 1 ///< number of context models for AO SVLC (filter coeff.) 109 113 #define NUM_SAO_TYPE_IDX_CTX 2 ///< number of context models for AO SVLC (filter coeff.) 114 #endif 110 115 #define CNU 154 ///< dummy initialization value for unused context models 'Context model Not Used' 111 116 … … 128 133 129 134 #if RWTH_SDC_DLT_B0036 135 #if PKU_QC_DEPTH_INTRA_UNI_D0195 136 #define DEPTH_MODE_NUM_FLAG_CTX 8 137 #define DMM_DELTA_NUM_FLAG_CTX 1 138 #else 130 139 #define SDC_NUM_FLAG_CTX 3 140 #endif 131 141 #define SDC_NUM_RESIDUAL_FLAG_CTX 1 142 #if !RWTH_SDC_CTX_SIMPL_D0032 132 143 #define SDC_NUM_SIGN_FLAG_CTX 1 144 #endif 145 #if LGE_CONCATENATE_D0141 146 #define SDC_NUM_RESIDUAL_CTX 1 147 #else 148 #if RWTH_SDC_CTX_SIMPL_D0032 149 #define SDC_NUM_RESIDUAL_CTX 8 150 #else 133 151 #define SDC_NUM_RESIDUAL_CTX 10 152 #endif 153 #endif 134 154 135 155 #define SDC_NUM_PRED_MODE_CTX 5 … … 376 396 { 141, 154, 159, }, 377 397 }; 378 398 #if LGE_SAO_MIGRATION_D0091 399 static const UChar 400 INIT_SAO_MERGE_FLAG[3][NUM_SAO_MERGE_FLAG_CTX] = 401 { 402 { 153, }, 403 { 153, }, 404 { 153, }, 405 }; 406 407 static const UChar 408 INIT_SAO_TYPE_IDX[3][NUM_SAO_TYPE_IDX_CTX] = 409 { 410 { 200, }, 411 { 185, }, 412 { 160, }, 413 }; 414 #else 379 415 static const UChar 380 416 INIT_SAO_FLAG[3][NUM_SAO_FLAG_CTX] = … … 424 460 { 200, 140, }, 425 461 }; 462 #endif 426 463 427 464 static const UChar … … 487 524 #endif 488 525 }; 526 #if QC_ARP_D0177 527 #define NUM_ARPW_CTX 4 ///< number of context models for generalized residual prediction weighting factor 528 static const UChar 529 INIT_ARPW[3][NUM_ARPW_CTX] = 530 { 531 { 154 , 154 , 154 , 154 }, 532 { 154 , 154 , 154 , 154 }, 533 { 154 , 154 , 154 , 154 }, 534 }; 535 #endif 489 536 490 537 #if LGE_EDGE_INTRA_A0070 … … 523 570 524 571 #if RWTH_SDC_DLT_B0036 572 #if PKU_QC_DEPTH_INTRA_UNI_D0195 573 static const UChar INIT_DEPTHMODE_FLAG[3][DEPTH_MODE_NUM_FLAG_CTX]= 574 { 575 {0, 0, 64, 0, CNU, 0, CNU, 0}, 576 {0, 64, 0, CNU, 0, CNU, 0, 0}, 577 {64, 0, CNU, 0, CNU, 0, 0, 0} 578 }; 579 static const UChar INIT_DMMDELTA_FLAG[3][DMM_DELTA_NUM_FLAG_CTX]= 580 { 581 {0}, 582 {0}, 583 {64} 584 }; 585 #else 525 586 static const Short INIT_SDC_FLAG[3][SDC_NUM_FLAG_CTX][2] = 526 587 { … … 535 596 } 536 597 }; 537 598 #endif 599 600 #if RWTH_SDC_CTX_SIMPL_D0032 601 static const UChar INIT_SDC_RESIDUAL_FLAG[3][SDC_NUM_RESIDUAL_FLAG_CTX] = 602 { 603 { 604 CNU 605 606 }, 607 { 608 CNU 609 }, 610 { 611 CNU 612 } 613 }; 614 615 #if LGE_CONCATENATE_D0141 616 static const UChar INIT_SDC_RESIDUAL[3][SDC_NUM_RESIDUAL_CTX] = 617 { 618 { 619 155 620 }, 621 { 622 155 623 }, 624 { 625 155 626 } 627 }; 628 #else 629 static const UChar INIT_SDC_RESIDUAL[3][SDC_NUM_RESIDUAL_CTX] = 630 { 631 { 632 CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU 633 }, 634 { 635 CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU 636 }, 637 { 638 CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU 639 } 640 }; 641 #endif 642 643 static const UChar INIT_SDC_PRED_MODE[3][3*SDC_NUM_PRED_MODE_CTX] = 644 { 645 { 646 CNU, CNU 647 ,CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU 648 }, 649 { 650 CNU, CNU 651 ,CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU 652 }, 653 { 654 CNU, CNU 655 ,CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU 656 } 657 }; 658 #else 538 659 static const Short INIT_SDC_RESIDUAL_FLAG[3][3*SDC_NUM_RESIDUAL_FLAG_CTX][2] = 539 660 { … … 613 734 }; 614 735 #endif 736 #endif 615 737 616 738 //! \} -
trunk/source/Lib/TLibCommon/TComDataCU.cpp
r332 r443 53 53 #if MERL_VSP_C0152 54 54 55 #if MTK_D0156 56 #define CHECK_ADD_YET(pcCURef,uiIdx,vspIdx) && ( (!m_pcSlice->getSPS()->getUseVSPCompensation()) || (!( (pcCURef)->getVSPIndex(uiIdx) == vspIdx && bVspMvZeroDone[vspIdx-1] ))) 57 #else 55 58 #define CHECK_ADD_YET(pcCURef,uiIdx,vspIdx) && !( (pcCURef)->getVSPIndex(uiIdx) == vspIdx && bVspMvZeroDone[vspIdx-1] ) 56 57 inline Void TComDataCU::xInheritVspMode( TComDataCU* pcCURef, UInt uiIdx, Bool* bVspMvZeroDone, Int iCount, Int* iVSPIndexTrue, TComMvField* pcMvFieldNeighbours, DisInfo* pDInfo ) 58 { 59 #endif 60 61 inline Void TComDataCU::xInheritVspMode( TComDataCU* pcCURef, UInt uiIdx, Bool* bVspMvZeroDone, Int iCount, Int* iVSPIndexTrue, TComMvField* pcMvFieldNeighbours, DisInfo* pDInfo 62 #if QC_BVSP_CleanUP_D0191 63 , UChar *puhInterDirNeighbours 64 #endif 65 #if MERL_VSP_NBDV_RefVId_Fix_D0166 66 , Int* iVSPDirTrue 67 #endif 68 ) 69 { 70 #if MTK_D0156 71 if( !m_pcSlice->getSPS()->getUseVSPCompensation() ) 72 { 73 return; 74 } 75 #endif 76 59 77 Int vspIdx = (Int) pcCURef->getVSPIndex(uiIdx); 60 78 if( vspIdx != 0 ) … … 69 87 if (vspIdx < 4) 70 88 { 89 #if QC_BVSP_CleanUP_D0191 90 puhInterDirNeighbours[ iCount] = 1; 91 #endif 92 #if MERL_VSP_NBDV_RefVId_Fix_D0166 93 if(pDInfo->iN > 0 ) 94 { // using derived disparity and store corresponding used reference list and ref idx 95 iVSPDirTrue[idx] = pDInfo->m_aListIdx[0]; 96 assert(pDInfo->m_aRefIdx[0] < 0); 97 #if MTK_VSP_USING_NBDV_D0105 98 pcMvFieldNeighbours[iCount<<1].setMvField( pDInfo->m_acMvCandNoRef[0], pDInfo->m_aRefIdx[0] ); 99 #else 100 pcMvFieldNeighbours[iCount<<1].setMvField( pDInfo->m_acMvCand[0], pDInfo->m_aRefIdx[0] ); 101 #endif 102 if ( pcCURef->getSlice()->isInterB() ) 103 { 104 #if MTK_VSP_USING_NBDV_D0105 105 pcMvFieldNeighbours[(iCount<<1)+1].setMvField( pDInfo->m_acMvCandNoRef[0], pDInfo->m_aRefIdx[0] ); 106 #else 107 pcMvFieldNeighbours[(iCount<<1)+1].setMvField( pDInfo->m_acMvCand[0], pDInfo->m_aRefIdx[0] ); 108 #endif 109 } 110 } 111 else 112 { // using the original neighboring block vsp reference list 113 TComMv cMvPred = pcCURef->getCUMvField(REF_PIC_LIST_0)->getMv(uiIdx); 114 Int refId = pcCURef->getCUMvField(REF_PIC_LIST_0)->getRefIdx(uiIdx); 115 116 assert(refId < 0); 117 iVSPDirTrue[idx] = pcCURef->getVSPDir(uiIdx); 118 pcMvFieldNeighbours[iCount<<1].setMvField( cMvPred, refId ); 119 if ( pcCURef->getSlice()->isInterB() ) 120 { 121 pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cMvPred, refId ); 122 } 123 } 124 125 #else // !MERL_VSP_NBDV_RefVId_Fix_D0166 126 127 #if MTK_VSP_USING_NBDV_D0105 128 pcMvFieldNeighbours[ iCount<<1].setMvField ( pDInfo->m_acMvCandNoRef[0], NOT_VALID ); 129 #else 71 130 pcMvFieldNeighbours[ iCount<<1].setMvField ( pDInfo->m_acMvCand[0], NOT_VALID ); 131 #endif 72 132 if ( pcCURef->getSlice()->isInterB() ) 73 133 { 134 #if MTK_VSP_USING_NBDV_D0105 135 pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField ( pDInfo->m_acMvCandNoRef[0], NOT_VALID ); 136 #else 74 137 pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField ( pDInfo->m_acMvCand[0], NOT_VALID ); 75 } 76 } 77 } 78 } 79 80 inline Bool TComDataCU::xAddVspMergeCand( UChar ucVspMergePos, Int vspIdx, Bool* bVspMvZeroDone, UInt uiDepth, Bool* abCandIsInter, Int& iCount, 81 UChar* puhInterDirNeighbours, TComMvField* pcMvFieldNeighbours, Int* iVSPIndexTrue, Int mrgCandIdx, DisInfo* pDInfo ) 82 { 138 #endif 139 } 140 #endif 141 } 142 } 143 } 144 145 inline Bool TComDataCU::xAddVspMergeCand( 146 UChar ucVspMergePos, 147 #if !LGE_VSP_INHERIT_D0092 148 Int vspIdx, 149 Bool* bVspMvZeroDone, 150 #endif 151 UInt uiDepth, 152 Bool* abCandIsInter, 153 Int& iCount, 154 UChar* puhInterDirNeighbours, 155 TComMvField* pcMvFieldNeighbours, 156 Int* iVSPIndexTrue, 157 Int mrgCandIdx, 158 DisInfo* pDInfo 159 #if MERL_VSP_NBDV_RefVId_Fix_D0166 160 , Int* iVspDirTrue 161 #endif 162 ) 163 { 164 #if MTK_D0156 165 if( !m_pcSlice->getSPS()->getUseVSPCompensation() ) 166 { 167 return true; 168 } 169 #endif 170 171 #if MTK_LGE_VSP_DEPTH_OFF_D0105_D0139 172 if (getSlice()->getSPS()->isDepth()) 173 { 174 return true; 175 } 176 #endif 177 83 178 #if MERL_VSP_C0152_BugFix_ForNoDepthCase 84 179 TComPic* pRefPicBaseDepth = NULL; 85 180 pRefPicBaseDepth = getSlice()->getRefPicBaseDepth(); 86 if(ucVspMergePos == VSP_MERGE_POS && pRefPicBaseDepth) // VSP can be used only when depth is used as input181 if(ucVspMergePos == VSP_MERGE_POS && pRefPicBaseDepth) // VSP can be used only when depth is used as input 87 182 #else 88 183 if( ucVspMergePos == VSP_MERGE_POS ) … … 90 185 if( ucVspMergePos == VSP_MERGE_POS ) 91 186 { 187 #if !LGE_VSP_INHERIT_D0092 92 188 Int idx = vspIdx - 1; 93 { 189 #endif 190 { 191 #if LGE_VSP_INHERIT_D0092 192 if( getSlice()->getSPS()->getViewId() != 0 ) 193 #else 94 194 if( getSlice()->getSPS()->getViewId() != 0 && bVspMvZeroDone[idx] == false ) 195 #endif 95 196 { 96 197 { 97 198 abCandIsInter [iCount] = true; 199 #if !LGE_VSP_INHERIT_D0092 98 200 bVspMvZeroDone[idx] = true; 201 #endif 99 202 100 203 // get Inter Dir … … 102 205 (getSlice()->getNumRefIdx(REF_PIC_LIST_0) > 0 ? 1 : 2)); 103 206 puhInterDirNeighbours[iCount] = iInterDir; // The direction information does not matter 207 #if QC_BVSP_CleanUP_D0191 208 puhInterDirNeighbours[iCount] = 1; 209 #endif 210 #if LGE_VSP_INHERIT_D0092 211 #if MERL_VSP_NBDV_RefVId_Fix_D0166 212 assert(pDInfo->m_aRefIdx[0] < 0); 213 iVspDirTrue[0] = pDInfo->m_aListIdx[0]; 214 Int iRefIdxList0 = NOT_VALID; 215 Int iRefIdxList1 = NOT_VALID; 216 iRefIdxList0 = getSlice()->getRefPic(REF_PIC_LIST_0, 0)->getPOC()==getSlice()->getPOC() ? 0 : (getSlice()->getNewRefIdx(REF_PIC_LIST_0)==-1 ? NOT_VALID : getSlice()->getNewRefIdx(REF_PIC_LIST_0)); 217 if ( getSlice()->isInterB() ) 218 { 219 iRefIdxList1 = getSlice()->getRefPic(REF_PIC_LIST_1, 0)->getPOC()==getSlice()->getPOC() ? 0 : (getSlice()->getNewRefIdx(REF_PIC_LIST_1)==-1 ? NOT_VALID : getSlice()->getNewRefIdx(REF_PIC_LIST_1)); 220 } 221 222 #if MTK_VSP_USING_NBDV_D0105 223 //pcMvFieldNeighbours[iCount<<1].setMvField(pDInfo->m_acMvCandNoRef[0], pDInfo->m_aListIdx[0]==REF_PIC_LIST_0 ? iRefIdxList0 :NOT_VALID ); 224 pcMvFieldNeighbours[iCount<<1].setMvField(pDInfo->m_acMvCandNoRef[0], iRefIdxList0 ); 225 #else 226 pcMvFieldNeighbours[iCount<<1].setMvField(pDInfo->m_acMvCand[0], iRefIdxList0 ); 227 #endif 228 if ( getSlice()->isInterB() ) 229 { 230 #if MTK_VSP_USING_NBDV_D0105 231 pcMvFieldNeighbours[(iCount<<1)+1].setMvField( pDInfo->m_acMvCandNoRef[0], iRefIdxList1 ); 232 //pcMvFieldNeighbours[(iCount<<1)+1].setMvField( pDInfo->m_acMvCandNoRef[0], iRefIdxList1); 233 #else 234 pcMvFieldNeighbours[(iCount<<1)+1].setMvField( pDInfo->m_acMvCand[0], iRefIdxList1); 235 #endif 236 } 237 iVSPIndexTrue[iCount] = 1; 238 #else 239 240 #if !MERL_General_Fix 241 Int iRefIdxList0 = NOT_VALID; 242 Int iRefIdxList1 = NOT_VALID; 243 iRefIdxList0 = getSlice()->getRefPic(REF_PIC_LIST_0, 0)->getPOC()==getSlice()->getPOC() ? 0 : (getSlice()->getNewRefIdx(REF_PIC_LIST_0)==-1 ? NOT_VALID : getSlice()->getNewRefIdx(REF_PIC_LIST_0)); 244 if ( getSlice()->isInterB() ) 245 { 246 iRefIdxList1 = getSlice()->getRefPic(REF_PIC_LIST_1, 0)->getPOC()==getSlice()->getPOC() ? 0 : (getSlice()->getNewRefIdx(REF_PIC_LIST_1)==-1 ? NOT_VALID : getSlice()->getNewRefIdx(REF_PIC_LIST_1)); 247 } 248 #if MTK_VSP_USING_NBDV_D0105 249 pcMvFieldNeighbours[iCount<<1].setMvField(pDInfo->m_acMvCandNoRef[0], iRefIdxList0 ); 250 #else 251 pcMvFieldNeighbours[iCount<<1].setMvField(pDInfo->m_acMvCand[0], iRefIdxList0 ); 252 #endif 253 if ( getSlice()->isInterB() ) 254 { 255 #if MTK_VSP_USING_NBDV_D0105 256 pcMvFieldNeighbours[(iCount<<1)+1].setMvField( pDInfo->m_acMvCandNoRef[0], iRefIdxList1 ); 257 #else 258 pcMvFieldNeighbours[(iCount<<1)+1].setMvField( pDInfo->m_acMvCand[0], iRefIdxList1); 259 #endif 260 } 261 iVSPIndexTrue[iCount] = 1; 262 #else 263 Int iRefIdx = NOT_VALID; 264 265 #if QC_BVSP_CleanUP_D0191 266 iRefIdx = getSlice()->getRefPic(REF_PIC_LIST_0, 0)->getPOC()==getSlice()->getPOC() ? 0: getSlice()->getNewRefIdx(REF_PIC_LIST_0); 267 #endif 268 #if MTK_VSP_USING_NBDV_D0105 269 pcMvFieldNeighbours[iCount<<1].setMvField(pDInfo->m_acMvCandNoRef[0], iRefIdx ); 270 #else 271 pcMvFieldNeighbours[iCount<<1].setMvField(pDInfo->m_acMvCand[0], iRefIdx ); 272 #endif 273 if ( getSlice()->isInterB() ) 274 { 275 #if MTK_VSP_USING_NBDV_D0105 276 pcMvFieldNeighbours[(iCount<<1)+1].setMvField( pDInfo->m_acMvCandNoRef[0], iRefIdx ); 277 #else 278 pcMvFieldNeighbours[(iCount<<1)+1].setMvField( pDInfo->m_acMvCand[0], iRefIdx ); 279 #endif 280 } 281 iVSPIndexTrue[iCount] = 1; 282 #endif 283 #endif 284 #else 104 285 // get Mv using checked disparity vector 105 286 if (vspIdx < 4) // spatial 106 287 { 107 pcMvFieldNeighbours[iCount<<1].setMvField(pDInfo->m_acMvCand[0], NOT_VALID ); 288 #if MERL_VSP_NBDV_RefVId_Fix_D0166 289 assert(pDInfo->m_aRefIdx[0] < 0); 290 iVspDirTrue[idx] = pDInfo->m_aListIdx[0]; 291 292 #if MTK_VSP_USING_NBDV_D0105 293 pcMvFieldNeighbours[iCount<<1].setMvField(pDInfo->m_acMvCandNoRef[0], pDInfo->m_aRefIdx[0] ); 294 #else 295 pcMvFieldNeighbours[iCount<<1].setMvField(pDInfo->m_acMvCand[0], pDInfo->m_aRefIdx[0] ); 296 #endif 108 297 if ( getSlice()->isInterB() ) 109 298 { 299 #if MTK_VSP_USING_NBDV_D0105 300 pcMvFieldNeighbours[(iCount<<1)+1].setMvField( pDInfo->m_acMvCandNoRef[0], pDInfo->m_aRefIdx[0] ); 301 #else 302 pcMvFieldNeighbours[(iCount<<1)+1].setMvField( pDInfo->m_acMvCand[0], pDInfo->m_aRefIdx[0] ); 303 #endif 304 } 305 306 #else 307 308 #if MTK_VSP_USING_NBDV_D0105 309 pcMvFieldNeighbours[iCount<<1].setMvField(pDInfo->m_acMvCandNoRef[0], NOT_VALID ); 310 #else 311 pcMvFieldNeighbours[iCount<<1].setMvField(pDInfo->m_acMvCand[0], NOT_VALID ); 312 #endif 313 if ( getSlice()->isInterB() ) 314 { 315 #if MTK_VSP_USING_NBDV_D0105 316 pcMvFieldNeighbours[(iCount<<1)+1].setMvField( pDInfo->m_acMvCandNoRef[0], NOT_VALID ); 317 #else 110 318 pcMvFieldNeighbours[(iCount<<1)+1].setMvField( pDInfo->m_acMvCand[0], NOT_VALID ); 319 #endif 111 320 } 321 #endif 112 322 } 113 323 iVSPIndexTrue[idx] = iCount; 324 #endif 114 325 if ( mrgCandIdx == iCount ) 115 326 { … … 155 366 #if MERL_VSP_C0152 156 367 m_piVSPIndex = NULL; 368 #if MERL_VSP_NBDV_RefVId_Fix_D0166 369 m_piVSPDir = NULL; 370 #endif 157 371 #endif 158 372 m_puhLumaIntraDir = NULL; … … 225 439 m_pbResPredFlag = NULL; 226 440 #endif 441 #if QC_ARP_D0177 442 m_puhARPW = NULL; 443 #endif 227 444 #if LGE_EDGE_INTRA_A0070 228 445 m_pucEdgeCode = NULL; … … 241 458 m_apSegmentDCOffset[1] = NULL; 242 459 #endif 460 #if QC_CU_NBDV_D0181 461 m_pDvInfo = NULL; 462 #endif 243 463 } 244 464 … … 288 508 m_pbICFlag = (Bool* )xMalloc(Bool, uiNumPartition); 289 509 #endif 510 #if QC_CU_NBDV_D0181 511 m_pDvInfo = (DisInfo* )xMalloc(DisInfo, uiNumPartition); 512 #endif 290 513 m_puhMergeIndex = (UChar* )xMalloc(UChar, uiNumPartition); 291 514 #if MERL_VSP_C0152 292 515 m_piVSPIndex = (Char* )xMalloc(Char, uiNumPartition); 516 #if MERL_VSP_NBDV_RefVId_Fix_D0166 517 m_piVSPDir = (Char* )xMalloc(Char, uiNumPartition); 518 #endif 293 519 #endif 294 520 #if H3D_IVRP 295 521 m_pbResPredAvailable = (Bool* )xMalloc(Bool, uiNumPartition); 296 522 m_pbResPredFlag = (Bool* )xMalloc(Bool, uiNumPartition); 523 #if QC_ARP_D0177 524 m_puhARPW = new UChar[ uiNumPartition]; 525 #endif 297 526 #endif 298 527 m_puhLumaIntraDir = (UChar* )xMalloc(UChar, uiNumPartition); … … 448 677 #if MERL_VSP_C0152 449 678 if ( m_piVSPIndex ) { xFree(m_piVSPIndex); m_piVSPIndex = NULL; } 679 #if MERL_VSP_NBDV_RefVId_Fix_D0166 680 if ( m_piVSPDir ) { xFree(m_piVSPDir ); m_piVSPDir = NULL; } 681 #endif 450 682 #endif 451 683 if ( m_puhMergeIndex ) { xFree(m_puhMergeIndex); m_puhMergeIndex = NULL; } … … 453 685 if ( m_pbResPredAvailable ) { xFree(m_pbResPredAvailable); m_pbResPredAvailable= NULL; } 454 686 if ( m_pbResPredFlag ) { xFree(m_pbResPredFlag); m_pbResPredFlag = NULL; } 687 #endif 688 #if QC_CU_NBDV_D0181 689 if ( m_pDvInfo ) { xFree(m_pDvInfo); m_pDvInfo = NULL; } 690 #endif 691 #if QC_ARP_D0177 692 if ( m_puhARPW ) { delete[] m_puhARPW; m_puhARPW = NULL; } 455 693 #endif 456 694 if ( m_puhLumaIntraDir ) { xFree(m_puhLumaIntraDir); m_puhLumaIntraDir = NULL; } … … 627 865 m_pbSDCFlag[ui] = pcFrom->getSDCFlag(ui); 628 866 #endif 867 #if QC_ARP_D0177 868 m_puhARPW[ui] = pcFrom->getARPW( ui ); 869 #endif 629 870 m_puhWidth [ui] = pcFrom->getWidth(ui); 630 871 m_puhHeight [ui] = pcFrom->getHeight(ui); … … 644 885 #if MERL_VSP_C0152 645 886 m_piVSPIndex[ui] = pcFrom->m_piVSPIndex[ui]; 887 #if MERL_VSP_NBDV_RefVId_Fix_D0166 888 m_piVSPDir [ui] = pcFrom->m_piVSPDir [ui]; 889 #endif 646 890 #endif 647 891 m_puhLumaIntraDir[ui]=pcFrom->m_puhLumaIntraDir[ui]; … … 687 931 #if MERL_VSP_C0152 688 932 memset( m_piVSPIndex + firstElement, 0, numElements * sizeof( *m_piVSPIndex ) ); 933 #if MERL_VSP_NBDV_RefVId_Fix_D0166 934 memset( m_piVSPDir + firstElement, 0, numElements * sizeof( *m_piVSPDir ) ); 935 #endif 689 936 #endif 690 937 memset( m_puhLumaIntraDir + firstElement, 2, numElements * sizeof( *m_puhLumaIntraDir ) ); … … 723 970 memset( m_pbResPredAvailable + firstElement, 0 , sizeof( Bool ) * numElements ); 724 971 memset( m_pbResPredFlag + firstElement, 0 , sizeof( Bool ) * numElements ); 972 #endif 973 #if QC_ARP_D0177 974 memset( m_puhARPW + firstElement, 0 , sizeof( UChar ) * numElements ); 725 975 #endif 726 976 } … … 861 1111 #if MERL_VSP_C0152 862 1112 m_piVSPIndex[ui] = 0; 1113 #if MERL_VSP_NBDV_RefVId_Fix_D0166 1114 m_piVSPDir [ui] = 0; 1115 #endif 863 1116 #endif 864 1117 #if H3D_IVRP 865 1118 m_pbResPredAvailable[ui] = 0; 866 1119 m_pbResPredFlag[ui] = 0; 1120 #endif 1121 #if QC_ARP_D0177 1122 m_puhARPW[ui] = 0; 867 1123 #endif 868 1124 m_puhLumaIntraDir[ui] = 2; … … 972 1228 #if MERL_VSP_C0152 973 1229 memset( m_piVSPIndex, 0, iSizeInChar ); 1230 #if MERL_VSP_NBDV_RefVId_Fix_D0166 1231 memset( m_piVSPDir , 0, iSizeInChar ); 1232 #endif 974 1233 #endif 975 1234 #if H3D_IVRP 976 1235 memset( m_pbResPredAvailable, 0, iSizeInBool ); 977 1236 memset( m_pbResPredFlag, 0, iSizeInBool ); 1237 #endif 1238 #if QC_ARP_D0177 1239 memset( m_puhARPW, 0, iSizeInUchar ); 978 1240 #endif 979 1241 memset( m_puhLumaIntraDir, 2, iSizeInUchar ); … … 1015 1277 memset( m_apSegmentDCOffset[1], 0, sizeof(Pel) * m_uiNumPartition); 1016 1278 #endif 1017 1279 #if QC_CU_NBDV_D0181 1280 m_pDvInfo->bDV = false; 1281 #endif 1018 1282 UChar uhWidth = g_uiMaxCUWidth >> uiDepth; 1019 1283 UChar uhHeight = g_uiMaxCUHeight >> uiDepth; … … 1058 1322 #if MERL_VSP_C0152 1059 1323 m_piVSPIndex[ui]=pcCU->m_piVSPIndex[uiPartOffset+ui]; 1324 #if MERL_VSP_NBDV_RefVId_Fix_D0166 1325 m_piVSPDir [ui]=pcCU->m_piVSPDir [uiPartOffset+ui]; 1326 #endif 1060 1327 #endif 1061 1328 m_puhLumaIntraDir[ui]=pcCU->m_puhLumaIntraDir[uiPartOffset+ui]; … … 1090 1357 m_pbResPredAvailable[ui] = pcCU->m_pbResPredAvailable[ uiPartOffset + ui ]; 1091 1358 m_pbResPredFlag [ui] = pcCU->m_pbResPredFlag [ uiPartOffset + ui ]; 1359 #endif 1360 #if QC_ARP_D0177 1361 m_puhARPW [ui] = pcCU->getARPW( uiPartOffset+ui ); 1092 1362 #endif 1093 1363 #if RWTH_SDC_DLT_B0036 … … 1208 1478 #if MERL_VSP_C0152 1209 1479 m_piVSPIndex = pcCU->getVSPIndex() + uiPart; 1480 #if MERL_VSP_NBDV_RefVId_Fix_D0166 1481 m_piVSPDir = pcCU->getVSPDir () + uiPart; 1482 #endif 1210 1483 #endif 1211 1484 #if H3D_IVRP 1212 1485 m_pbResPredAvailable = pcCU->getResPredAvail() + uiPart; 1213 1486 m_pbResPredFlag = pcCU->getResPredFlag () + uiPart; 1487 #endif 1488 #if QC_ARP_D0177 1489 m_puhARPW = pcCU->getARPW() + uiPart; 1214 1490 #endif 1215 1491 m_puhLumaIntraDir = pcCU->getLumaIntraDir() + uiPart; … … 1313 1589 m_apSegmentDCOffset[1] = pcCU->getSDCSegmentDCOffset(1) + uiPart; 1314 1590 #endif 1315 } 1316 1591 #if QC_CU_NBDV_D0181 1592 m_pDvInfo = pcCU->getDvInfo() + uiPart; 1593 #endif 1594 } 1595 #if QC_CU_NBDV_D0181 1596 Void TComDataCU::copyDVInfoFrom (TComDataCU* pcCU, UInt uiAbsPartIdx) 1597 { 1598 m_pDvInfo = pcCU->getDvInfo() + uiAbsPartIdx; 1599 } 1600 #endif 1317 1601 // Copy inter prediction info from the biggest CU 1318 Void TComDataCU::copyInterPredInfoFrom ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList ) 1602 Void TComDataCU::copyInterPredInfoFrom ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList 1603 #if QC_CU_NBDV_D0181 1604 , Bool bNBDV 1605 #endif 1606 ) 1319 1607 { 1320 1608 m_pcPic = pcCU->getPic(); … … 1336 1624 1337 1625 m_pePartSize = pcCU->getPartitionSize () + uiAbsPartIdx; 1626 #if QC_CU_NBDV_D0181 1627 if(bNBDV == true) 1628 { 1629 m_puhWidth = pcCU->getWidth () + uiAbsPartIdx; 1630 m_puhHeight = pcCU->getHeight() + uiAbsPartIdx; 1631 m_puhDepth = pcCU->getDepth () + uiAbsPartIdx; 1632 } 1633 else 1634 { 1635 #endif 1338 1636 #if HHI_INTERVIEW_SKIP 1339 1637 m_pbRenderable = pcCU->getRenderable() + uiAbsPartIdx; … … 1354 1652 #if MERL_VSP_C0152 1355 1653 m_piVSPIndex = pcCU->getVSPIndex() + uiAbsPartIdx; 1654 #if MERL_VSP_NBDV_RefVId_Fix_D0166 1655 m_piVSPDir = pcCU->getVSPDir () + uiAbsPartIdx; 1656 #endif 1356 1657 #endif 1357 1658 #if H3D_IVRP … … 1359 1660 m_pbResPredFlag = pcCU->getResPredFlag () + uiAbsPartIdx; 1360 1661 #endif 1662 #if QC_ARP_D0177 1663 m_puhARPW = pcCU->getARPW() + uiAbsPartIdx; 1664 #endif 1361 1665 m_apiMVPIdx[eRefPicList] = pcCU->getMVPIdx(eRefPicList) + uiAbsPartIdx; 1362 1666 m_apiMVPNum[eRefPicList] = pcCU->getMVPNum(eRefPicList) + uiAbsPartIdx; … … 1369 1673 memcpy(m_uiSliceStartCU,pcCU->m_uiSliceStartCU+uiAbsPartIdx,sizeof(UInt)*m_uiNumPartition); 1370 1674 memcpy(m_uiEntropySliceStartCU,pcCU->m_uiEntropySliceStartCU+uiAbsPartIdx,sizeof(UInt)*m_uiNumPartition); 1675 #if QC_CU_NBDV_D0181 1676 } 1677 #endif 1371 1678 } 1372 1679 1373 1680 // Copy small CU to bigger CU. 1374 1681 // One of quarter parts overwritten by predicted sub part. 1375 Void TComDataCU::copyPartFrom( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth ) 1682 Void TComDataCU::copyPartFrom( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth 1683 #if QC_ARP_D0177 1684 , 1685 Bool bRP 1686 #endif 1687 ) 1376 1688 { 1377 1689 assert( uiPartUnitIdx<4 ); … … 1405 1717 #if MERL_VSP_C0152 1406 1718 memcpy( m_piVSPIndex + uiOffset, pcCU->getVSPIndex(), iSizeInChar ); 1719 #if MERL_VSP_NBDV_RefVId_Fix_D0166 1720 memcpy( m_piVSPDir + uiOffset, pcCU->getVSPDir (), iSizeInChar ); 1721 #endif 1407 1722 #endif 1408 1723 #if H3D_IVRP 1409 1724 memcpy( m_pbResPredAvailable + uiOffset, pcCU->getResPredAvail(), iSizeInBool ); 1410 1725 memcpy( m_pbResPredFlag + uiOffset, pcCU->getResPredFlag(), iSizeInBool ); 1726 #endif 1727 #if QC_ARP_D0177 1728 memcpy( m_puhARPW + uiOffset, pcCU->getARPW(), iSizeInUchar ); 1411 1729 #endif 1412 1730 memcpy( m_puhLumaIntraDir + uiOffset, pcCU->getLumaIntraDir(), iSizeInUchar ); … … 1486 1804 1487 1805 #if LGE_EDGE_INTRA_A0070 1806 #if QC_ARP_D0177 1807 if( !bRP && pcCU->getSlice()->getSPS()->isDepth() ) 1808 #else 1488 1809 if( getSlice()->getSPS()->isDepth() ) 1810 #endif 1489 1811 { 1490 1812 memcpy( getEdgeCode( uiOffset ), pcCU->getEdgeCode(0), iSizeInUchar * LGE_EDGE_INTRA_MAX_EDGE_NUM_PER_4x4 ); … … 1541 1863 memcpy( rpcCU->getICFlag() + m_uiAbsIdxInLCU, m_pbICFlag, iSizeInBool ); 1542 1864 #endif 1865 #if QC_CU_NBDV_D0181 1866 memcpy( rpcCU->getDvInfo() + m_uiAbsIdxInLCU, m_pDvInfo, sizeof(* m_pDvInfo) * m_uiNumPartition ); 1867 #endif 1543 1868 memcpy( rpcCU->getMergeIndex() + m_uiAbsIdxInLCU, m_puhMergeIndex, iSizeInUchar ); 1544 1869 #if MERL_VSP_C0152 1545 1870 memcpy( rpcCU->getVSPIndex() + m_uiAbsIdxInLCU, m_piVSPIndex, iSizeInChar ); 1871 #if MERL_VSP_NBDV_RefVId_Fix_D0166 1872 memcpy( rpcCU->getVSPDir () + m_uiAbsIdxInLCU, m_piVSPDir , iSizeInChar ); 1873 #endif 1546 1874 #endif 1547 1875 #if H3D_IVRP 1548 1876 memcpy( rpcCU->getResPredAvail() + m_uiAbsIdxInLCU, m_pbResPredAvailable, iSizeInBool ); 1549 1877 memcpy( rpcCU->getResPredFlag() + m_uiAbsIdxInLCU, m_pbResPredFlag, iSizeInBool ); 1878 #endif 1879 #if QC_ARP_D0177 1880 memcpy( rpcCU->getARPW() + m_uiAbsIdxInLCU, m_puhARPW, iSizeInUchar ); 1550 1881 #endif 1551 1882 memcpy( rpcCU->getLumaIntraDir() + m_uiAbsIdxInLCU, m_puhLumaIntraDir, iSizeInUchar ); … … 1674 2005 memcpy( rpcCU->getMergeIndex() + uiPartOffset, m_puhMergeIndex, iSizeInUchar ); 1675 2006 #if MERL_VSP_C0152 1676 memcpy( rpcCU->getVSPIndex() + uiPartOffset, m_piVSPIndex, iSizeInChar ); 2007 memcpy( rpcCU->getVSPIndex() + uiPartOffset, m_piVSPIndex, iSizeInChar ); 2008 #if MERL_VSP_NBDV_RefVId_Fix_D0166 2009 memcpy( rpcCU->getVSPDir () + uiPartOffset, m_piVSPDir , iSizeInChar ); 2010 #endif 1677 2011 #endif 1678 2012 #if H3D_IVRP 1679 2013 memcpy( rpcCU->getResPredAvail() + uiPartOffset, m_pbResPredAvailable, iSizeInBool ); 1680 2014 memcpy( rpcCU->getResPredFlag() + uiPartOffset, m_pbResPredFlag, iSizeInBool ); 2015 #endif 2016 #if QC_ARP_D0177 2017 memcpy( rpcCU->getARPW() + uiPartOffset, m_puhARPW, iSizeInUchar ); 1681 2018 #endif 1682 2019 memcpy( rpcCU->getLumaIntraDir() + uiPartOffset, m_puhLumaIntraDir, iSizeInUchar ); … … 2670 3007 return uiCtx; 2671 3008 } 2672 3009 #if QC_ARP_D0177 3010 UInt TComDataCU::getCTXARPWFlag( UInt uiAbsPartIdx ) 3011 { 3012 TComDataCU* pcTempCU; 3013 UInt uiTempPartIdx; 3014 UInt uiCtx = 0; 3015 3016 pcTempCU = getPULeft( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx ); 3017 uiCtx = ( pcTempCU ) ? ((pcTempCU->getARPW( uiTempPartIdx )==0)?0:1) : 0; 3018 3019 pcTempCU = getPUAbove( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx ); 3020 uiCtx += ( pcTempCU ) ? ((pcTempCU->getARPW( uiTempPartIdx )==0)?0:1): 0; 3021 3022 return uiCtx; 3023 } 3024 #endif 2673 3025 #if LGE_ILLUCOMP_B0045 2674 3026 UInt TComDataCU::getCtxICFlag( UInt uiAbsPartIdx ) … … 2907 3259 } 2908 3260 3261 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 2909 3262 UInt TComDataCU::getCtxSDCFlag( UInt uiAbsPartIdx ) 2910 3263 { … … 2923 3276 return uiCtx; 2924 3277 } 3278 #endif 2925 3279 2926 3280 Bool TComDataCU::getSDCAvailable( UInt uiAbsPartIdx ) … … 2954 3308 setSubPart<Char>( iVSPIdx, m_piVSPIndex, uiAbsPartIdx, uiDepth, uiPartIdx ); 2955 3309 } 2956 #endif 3310 3311 #if MERL_VSP_NBDV_RefVId_Fix_D0166 3312 Void TComDataCU::setVSPDirSubParts ( Char iVSPDir, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) 3313 { 3314 setSubPart<Char>( iVSPDir, m_piVSPDir, uiAbsPartIdx, uiDepth, uiPartIdx ); 3315 } 3316 #endif 3317 3318 #endif // MERL_VSP_C0152 2957 3319 2958 3320 #if H3D_IVRP … … 2967 3329 } 2968 3330 #endif 2969 3331 #if QC_CU_NBDV_D0181 3332 Void TComDataCU::setDvInfoSubParts( DisInfo cDvInfo, UInt uiAbsPartIdx, UInt uiDepth ) 3333 { 3334 UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1); 3335 for (UInt ui = 0; ui < uiCurrPartNumb; ui++ ) 3336 { 3337 m_pDvInfo[uiAbsPartIdx + ui] = cDvInfo; 3338 } 3339 } 3340 #endif 2970 3341 Void TComDataCU::setChromIntraDirSubParts( UInt uiDir, UInt uiAbsPartIdx, UInt uiDepth ) 2971 3342 { … … 2993 3364 UInt iNumbPart; 2994 3365 3366 #if SHARP_ILLUCOMP_PARSE_D0060 3367 if (!(getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N)) 3368 { 3369 return false; 3370 } 3371 if (getSlice()->getIcSkipParseFlag()) 3372 { 3373 if (getMergeFlag(uiAbsPartIdx) && getMergeIndex(uiAbsPartIdx) == 0) 3374 { 3375 return false; 3376 } 3377 } 3378 if (getMergeFlag(uiAbsPartIdx)) 3379 { 3380 return true; 3381 } 3382 #endif 3383 #if !SHARP_ILLUCOMP_PARSE_D0060 2995 3384 if(!getSlice()->getIsDepth()) 2996 3385 { 3386 #endif 2997 3387 Int iWidth, iHeight; 2998 3388 … … 3015 3405 } 3016 3406 } 3407 #if !SHARP_ILLUCOMP_PARSE_D0060 3017 3408 } 3018 3409 else … … 3036 3427 } 3037 3428 } 3429 #endif 3038 3430 3039 3431 return false; … … 3046 3438 Int iWidth, iHeight; 3047 3439 3440 #if SHARP_ILLUCOMP_PARSE_D0060 3441 if (!(getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N)) 3442 { 3443 return false; 3444 } 3445 if (getSlice()->getIcSkipParseFlag()) 3446 { 3447 if (getMergeFlag(uiAbsPartIdx) && getMergeIndex(uiAbsPartIdx) == 0) 3448 { 3449 return false; 3450 } 3451 } 3452 if (getMergeFlag(uiAbsPartIdx)) 3453 { 3454 return true; 3455 } 3456 #endif 3048 3457 UInt uiPartMode = getPartitionSize(uiAbsPartIdx); 3049 3458 … … 3527 3936 */ 3528 3937 #if MERL_VSP_C0152 3529 Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int* iVSPIndexTrue, Int mrgCandIdx ) 3938 Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int* iVSPIndexTrue 3939 #if MERL_VSP_NBDV_RefVId_Fix_D0166 3940 , Int* iVSPDirTrue 3941 #endif 3942 , Int mrgCandIdx ) 3530 3943 #else 3531 3944 Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx ) … … 3560 3973 this->getPartPosition(uiPUIdx, xP, yP, nPSW, nPSH); 3561 3974 3562 #if MERL_VSP_C0152 3975 #if MERL_VSP_C0152 && !LGE_VSP_INHERIT_D0092 3563 3976 Bool bVspMvZeroDone[3] = {false, false, false}; 3564 3977 #endif … … 3584 3997 #endif //H3D_NBDV 3585 3998 3586 #if H3D_IVRP 3999 #if H3D_IVRP & !QC_ARP_D0177 3587 4000 Bool bDVAvail = true; 3588 4001 #endif … … 3590 4003 #if H3D_NBDV 3591 4004 DisInfo cDisInfo; 4005 #if MERL_VSP_NBDV_RefVId_Fix_D0166 4006 cDisInfo.bDV = false; // default setting 4007 cDisInfo.iN = 0; 4008 #endif 4009 4010 #if !QC_CU_NBDV_D0181 3592 4011 cDisInfo.iN = 0; 4012 #endif 3593 4013 if(!bNoPdmMerge) 3594 4014 { … … 3596 4016 if( !getPic()->getDepthCoded() ) 3597 4017 #endif 4018 #if QC_CU_NBDV_D0181 4019 { 4020 cDisInfo.iN = getDvInfo(uiAbsPartIdx).iN; 4021 cDisInfo.bDV = getDvInfo(uiAbsPartIdx).bDV; 4022 cDisInfo.m_acMvCand[0] = getDvInfo(uiAbsPartIdx).m_acMvCand[0]; 4023 cDisInfo.m_aVIdxCan[0] = getDvInfo(uiAbsPartIdx).m_aVIdxCan[0]; 4024 #if MTK_VSP_USING_NBDV_D0105 4025 cDisInfo.m_acMvCandNoRef[0] = getDvInfo(uiAbsPartIdx).m_acMvCandNoRef[0]; 4026 #endif 4027 #if MERL_General_Fix 4028 #if MERL_VSP_C0152 4029 #if MERL_VSP_NBDV_RefVId_Fix_D0166 4030 cDisInfo.m_aListIdx[0] = getDvInfo(uiAbsPartIdx).m_aListIdx[0]; 4031 cDisInfo.m_aRefIdx[0] = getDvInfo(uiAbsPartIdx).m_aRefIdx[0]; 4032 #endif 4033 #endif 4034 #endif 4035 } 4036 #else 3598 4037 getDisMvpCandNBDV(uiPUIdx, uiAbsPartIdx, &cDisInfo , true 3599 4038 #if MERL_VSP_C0152 … … 3601 4040 #endif 3602 4041 ); 3603 } 4042 #endif 4043 } 4044 3604 4045 #if FCO_DVP_REFINE_C0132_C0170 3605 4046 if(getPic()->getDepthCoded() ) … … 3618 4059 } 3619 4060 #endif 4061 #if !QC_CU_NBDV_D0181 3620 4062 if(cDisInfo.iN==0) 3621 { 4063 #else 4064 if(cDisInfo.bDV == false) 4065 #endif 4066 { 4067 #if !QC_CU_NBDV_D0181 3622 4068 cDisInfo.iN = 1; 3623 4069 cDisInfo.m_acMvCand[0].setHor(0); 3624 4070 cDisInfo.m_acMvCand[0].setVer(0); 3625 4071 cDisInfo.m_aVIdxCan[0] = 0; 3626 #if H3D_IVRP 4072 #endif 4073 #if H3D_IVRP & !QC_ARP_D0177 3627 4074 bDVAvail = false; 3628 4075 #endif 3629 4076 } 4077 4078 #if MERL_VSP_NBDV_RefVId_Fix_D0166 && !MTK_LGE_VSP_DEPTH_OFF_D0105_D0139 4079 if (bNoPdmMerge && cDisInfo.bDV == false) 4080 { // purely for default setting 4081 cDisInfo.iN = 1; 4082 cDisInfo.m_acMvCand[0].setHor(0); 4083 cDisInfo.m_acMvCand[0].setVer(0); 4084 cDisInfo.m_acMvCandNoRef[0].setHor(0); 4085 cDisInfo.m_acMvCandNoRef[0].setVer(0); 4086 cDisInfo.m_aVIdxCan[0] = 0; 4087 4088 RefPicList eRefPicList = REF_PIC_LIST_0 ; 4089 Int refFrmIdx = 0; 4090 getRefListAndRefFrmIdx(0, eRefPicList, refFrmIdx); 4091 cDisInfo.m_aListIdx[0] = eRefPicList; 4092 cDisInfo.m_aRefIdx [0] = -1-refFrmIdx; 4093 } 4094 #endif 3630 4095 3631 4096 #if MTK_DEPTH_MERGE_TEXTURE_CANDIDATE_C0137 … … 3652 4117 clipMv(cMvPred); 3653 4118 pcMvFieldNeighbours[iCount<<1].setMvField(cMvPred,pcMvFieldNeighbours[iCount<<1].getRefIdx()); 4119 #if MTK_LGE_VSP_DEPTH_OFF_D0105_D0139 4120 if (pcMvFieldNeighbours[iCount<<1].getRefIdx()<0) 4121 { 4122 assert(pcTextureCU->getVSPIndex(uiPartIdxCenter)!=0); 4123 for (Int i=0; i<getSlice()->getNumRefIdx(REF_PIC_LIST_0); i++) 4124 { 4125 if (getSlice()->getRefPOC(REF_PIC_LIST_0, i) == getSlice()->getPOC()) 4126 { 4127 pcMvFieldNeighbours[iCount<<1].setMvField(cMvPred,i); 4128 break; 4129 } 4130 } 4131 } 4132 #endif 3654 4133 } 3655 4134 if ( getSlice()->isInterB() ) … … 3664 4143 clipMv(cMvPred); 3665 4144 pcMvFieldNeighbours[(iCount<<1)+1].setMvField(cMvPred,pcMvFieldNeighbours[(iCount<<1)+1].getRefIdx()); 4145 #if MTK_LGE_VSP_DEPTH_OFF_D0105_D0139 4146 if (pcMvFieldNeighbours[(iCount<<1)+1].getRefIdx()<0) 4147 { 4148 assert(pcTextureCU->getVSPIndex(uiPartIdxCenter)!=0); 4149 for (Int i=0; i<getSlice()->getNumRefIdx(REF_PIC_LIST_1); i++) 4150 { 4151 if (getSlice()->getRefPOC(REF_PIC_LIST_1, i) == getSlice()->getPOC()) 4152 { 4153 pcMvFieldNeighbours[(iCount<<1)+1].setMvField(cMvPred,i); 4154 break; 4155 } 4156 } 4157 } 4158 #endif 3666 4159 } 3667 4160 } 3668 #if MERL_VSP_C0152 3669 xInheritVspMode( pcTextureCU, uiPartIdxCenter, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo ) ; 3670 #endif 3671 if ( mrgCandIdx == iCount ) 3672 { 3673 return; 3674 } 3675 iCount ++; 4161 #if MERL_VSP_C0152 && !QC_BVSP_CleanUP_D0191 && !LGE_VSP_INHERIT_D0092 4162 #if !MTK_LGE_VSP_DEPTH_OFF_D0105_D0139 4163 xInheritVspMode( pcTextureCU, uiPartIdxCenter, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo 4164 #if MERL_VSP_NBDV_RefVId_Fix_D0166 4165 , iVSPDirTrue 4166 #endif 4167 ) ; 4168 #endif 4169 #endif 4170 #if MTK_LGE_VSP_DEPTH_OFF_D0105_D0139 4171 if (!((pcMvFieldNeighbours[iCount<<1].getRefIdx()<0 && !getSlice()->isInterB()) 4172 || (pcMvFieldNeighbours[iCount<<1].getRefIdx()<0 && pcMvFieldNeighbours[(iCount<<1)+1].getRefIdx()<0 && getSlice()->isInterB()))) 4173 { 4174 #endif 4175 if ( mrgCandIdx == iCount ) 4176 { 4177 return; 4178 } 4179 iCount ++; 4180 #if MTK_LGE_VSP_DEPTH_OFF_D0105_D0139 4181 } 4182 else 4183 { 4184 assert(0); 4185 } 4186 #endif 3676 4187 } 3677 4188 } … … 3687 4198 iPdmDir[1] = iPdmInterDir; 3688 4199 #endif // H3D_NBDV 3689 #if H3D_IVRP 4200 #if H3D_IVRP & !QC_ARP_D0177 3690 4201 if (m_pcSlice->getSPS()->getMultiviewResPredMode()==1 && iPdmDir[0] && !bNoPdmMerge && cCurPS == SIZE_2Nx2N && bDVAvail) 3691 4202 { … … 3727 4238 } 3728 4239 3729 #endif // H3D_IVMP 3730 4240 #endif // H3D_IVMP 4241 4242 #if !FIX_MERGE_D 3731 4243 #if MERL_VSP_COMPENSATION_C0152 3732 4244 //===== vsp 0 ===== 3733 4245 if( iCount < 4 + extraMergeCand ) 3734 if ( !xAddVspMergeCand(0, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo) ) 4246 if ( !xAddVspMergeCand(0, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo 4247 #if MERL_VSP_NBDV_RefVId_Fix_D0166 4248 , iVSPDirTrue 4249 #endif 4250 ) 4251 ) 3735 4252 return; 4253 #endif 3736 4254 #endif 3737 4255 … … 3751 4269 { 3752 4270 if ( pcCULeft && !pcCULeft->isIntra( uiLeftPartIdx ) 3753 #if MERL_VSP_C0152 4271 #if MERL_VSP_C0152 && !LGE_VSP_INHERIT_D0092 3754 4272 CHECK_ADD_YET(pcCULeft, uiLeftPartIdx, 1) 3755 4273 #endif … … 3800 4318 #endif 3801 4319 #if MERL_VSP_C0152 3802 xInheritVspMode( pcCULeft, uiLeftPartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo ) ; 4320 #if LGE_VSP_INHERIT_D0092 4321 if (pcCULeft->getVSPIndex(uiLeftPartIdx)==1) 4322 { 4323 iVSPIndexTrue[iCount] = 1; 4324 } 4325 #else 4326 xInheritVspMode( pcCULeft, uiLeftPartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo 4327 #if QC_BVSP_CleanUP_D0191 4328 ,puhInterDirNeighbours 4329 #endif 4330 #if MERL_VSP_NBDV_RefVId_Fix_D0166 4331 , iVSPDirTrue 4332 #endif 4333 ); 4334 #endif 3803 4335 #endif 3804 4336 if ( mrgCandIdx == iCount ) … … 3825 4357 } 3826 4358 if ( pcCUAbove && !pcCUAbove->isIntra( uiAbovePartIdx ) 3827 #if MERL_VSP_C0152 4359 #if MERL_VSP_C0152 && !LGE_VSP_INHERIT_D0092 3828 4360 CHECK_ADD_YET(pcCUAbove, uiAbovePartIdx, 1) 3829 4361 #endif … … 3873 4405 #endif 3874 4406 #if MERL_VSP_C0152 3875 xInheritVspMode( pcCUAbove, uiAbovePartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo ) ; 4407 #if LGE_VSP_INHERIT_D0092 4408 if (pcCUAbove->getVSPIndex(uiAbovePartIdx)==1) 4409 { 4410 iVSPIndexTrue[iCount] = 1; 4411 } 4412 #else 4413 xInheritVspMode( pcCUAbove, uiAbovePartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo 4414 #if QC_BVSP_CleanUP_D0191 4415 ,puhInterDirNeighbours 4416 #endif 4417 #if MERL_VSP_NBDV_RefVId_Fix_D0166 4418 , iVSPDirTrue 4419 #endif 4420 ) ; 4421 #endif 3876 4422 #endif 3877 4423 if ( mrgCandIdx == iCount ) … … 3897 4443 } 3898 4444 if ( pcCUAboveRight && !pcCUAboveRight->isIntra( uiAboveRightPartIdx ) 3899 #if MERL_VSP_C0152 4445 #if MERL_VSP_C0152 && !LGE_VSP_INHERIT_D0092 3900 4446 CHECK_ADD_YET(pcCUAboveRight, uiAboveRightPartIdx, 1) 3901 4447 #endif … … 3922 4468 #endif 3923 4469 #if MERL_VSP_C0152 3924 xInheritVspMode( pcCUAboveRight, uiAboveRightPartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo ) ; 4470 #if LGE_VSP_INHERIT_D0092 4471 if (pcCUAboveRight->getVSPIndex(uiAboveRightPartIdx)==1) 4472 { 4473 iVSPIndexTrue[iCount] = 1; 4474 } 4475 #else 4476 xInheritVspMode( pcCUAboveRight, uiAboveRightPartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo 4477 #if QC_BVSP_CleanUP_D0191 4478 ,puhInterDirNeighbours 4479 #endif 4480 #if MERL_VSP_NBDV_RefVId_Fix_D0166 4481 , iVSPDirTrue 4482 #endif 4483 ) ; 4484 #endif 3925 4485 #endif 3926 4486 if ( mrgCandIdx == iCount ) … … 3980 4540 #endif // H3D_IVMP 3981 4541 4542 #if MERL_VSP_COMPENSATION_C0152 4543 //===== vsp 3 ===== 4544 #if LGE_VSP_INHERIT_D0092 4545 if ( !xAddVspMergeCand(3, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo 4546 #if MERL_VSP_NBDV_RefVId_Fix_D0166 4547 , iVSPDirTrue 4548 #endif 4549 ) ) 4550 #else 4551 if( iCount < 4 + extraMergeCand ) 4552 if ( !xAddVspMergeCand(3, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo 4553 #if MERL_VSP_NBDV_RefVId_Fix_D0166 4554 , iVSPDirTrue 4555 #endif 4556 ) ) 4557 #endif 4558 return; 4559 #endif 4560 4561 #if MERL_VSP_C0152 4562 #if VSP_MERGE_POS < 4 4563 #if H3D_IVMP 4564 if( iCount < 4 + extraMergeCand ) 4565 #else 4566 if( iCount < 4 ) 4567 #endif 4568 { 4569 #endif 4570 #endif 3982 4571 3983 4572 //left bottom … … 3993 4582 } 3994 4583 if ( pcCULeftBottom && !pcCULeftBottom->isIntra( uiLeftBottomPartIdx ) 3995 #if MERL_VSP_C0152 4584 #if MERL_VSP_C0152 && !LGE_VSP_INHERIT_D0092 3996 4585 CHECK_ADD_YET(pcCULeftBottom, uiLeftBottomPartIdx, 1) 3997 4586 #endif … … 4018 4607 #endif 4019 4608 #if MERL_VSP_C0152 4020 xInheritVspMode( pcCULeftBottom, uiLeftBottomPartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo ) ; 4609 #if LGE_VSP_INHERIT_D0092 4610 if (pcCULeftBottom->getVSPIndex(uiLeftBottomPartIdx)==1) 4611 { 4612 iVSPIndexTrue[iCount] = 1; 4613 } 4614 #else 4615 xInheritVspMode( pcCULeftBottom, uiLeftBottomPartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo 4616 #if QC_BVSP_CleanUP_D0191 4617 ,puhInterDirNeighbours 4618 #endif 4619 #if MERL_VSP_NBDV_RefVId_Fix_D0166 4620 , iVSPDirTrue 4621 #endif 4622 ) ; 4623 #endif 4021 4624 #endif 4022 4625 if ( mrgCandIdx == iCount ) … … 4026 4629 iCount ++; 4027 4630 } 4028 4029 4631 4632 #if MERL_VSP_C0152 // Is this correct here? 4633 #if VSP_MERGE_POS < 4 4634 } 4635 #endif 4636 #endif 4637 4030 4638 // above left 4031 4639 #if H3D_IVMP … … 4046 4654 } 4047 4655 if( pcCUAboveLeft && !pcCUAboveLeft->isIntra( uiAboveLeftPartIdx ) 4048 #if MERL_VSP_C0152 4656 #if MERL_VSP_C0152 && !LGE_VSP_INHERIT_D0092 4049 4657 CHECK_ADD_YET(pcCUAboveLeft, uiAboveLeftPartIdx, 1) 4050 4658 #endif … … 4073 4681 #endif 4074 4682 #if MERL_VSP_C0152 4075 xInheritVspMode( pcCUAboveLeft, uiAboveLeftPartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo ) ; 4683 #if LGE_VSP_INHERIT_D0092 4684 if (pcCUAboveLeft->getVSPIndex(uiAboveLeftPartIdx)==1) 4685 { 4686 iVSPIndexTrue[iCount] = 1; 4687 } 4688 #else 4689 xInheritVspMode( pcCUAboveLeft, uiAboveLeftPartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo 4690 #if QC_BVSP_CleanUP_D0191 4691 ,puhInterDirNeighbours 4692 #endif 4693 #if MERL_VSP_NBDV_RefVId_Fix_D0166 4694 , iVSPDirTrue 4695 #endif 4696 ) ; 4697 #endif 4076 4698 #endif 4077 4699 if ( mrgCandIdx == iCount ) … … 4086 4708 //===== vsp 5 ===== 4087 4709 if( iCount < 4 + extraMergeCand ) 4088 if ( !xAddVspMergeCand(5, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo) ) 4710 #if LGE_VSP_INHERIT_D0092 4711 if ( !xAddVspMergeCand(5, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo 4712 #if MERL_VSP_NBDV_RefVId_Fix_D0166 4713 , iVSPDirTrue 4714 #endif 4715 )) 4716 #else 4717 if ( !xAddVspMergeCand(5, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo 4718 #if MERL_VSP_NBDV_RefVId_Fix_D0166 4719 , iVSPDirTrue 4720 #endif 4721 )) 4722 #endif 4089 4723 return; 4090 4724 #endif … … 4276 4910 #if MERL_VSP_C0152 4277 4911 Bool bValid = true; 4912 #if LGE_VSP_INHERIT_D0092 4913 if (iVSPIndexTrue[i]==1 || iVSPIndexTrue[j]==1) // NOT_VALID 4914 #else 4278 4915 if (pcMvFieldNeighbours[i<<1].getRefIdx() < 0 || pcMvFieldNeighbours[(j<<1)+1].getRefIdx() < 0) // NOT_VALID 4916 #endif 4279 4917 bValid = false; 4280 4918 #endif 4919 4920 #if MTK_D0156 4921 if( !m_pcSlice->getSPS()->getUseVSPCompensation()) 4922 { 4923 bValid = true; 4924 } 4925 #endif 4926 4281 4927 if (abCandIsInter[i] && abCandIsInter[j]&& (puhInterDirNeighbours[i]&0x1)&&(puhInterDirNeighbours[j]&0x2) 4282 4928 #if MERL_VSP_C0152 … … 4447 5093 { 4448 5094 if( pcCorner && !pcCorner->isIntra( uiCornerPUIdx ) 4449 #if MERL_VSP_C0152 5095 #if MERL_VSP_C0152 & !QC_BVSP_CleanUP_D0191 4450 5096 && !pcCorner->getVSPIndex( uiCornerPUIdx ) 4451 5097 #endif … … 4593 5239 pcTmpCU = getPULeft(uiIdx, uiPartIdxLB, true, false); 4594 5240 if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ) ) 4595 #if MERL_VSP_C0152 5241 #if MERL_VSP_C0152 & !QC_BVSP_CleanUP_D0191 4596 5242 if(! pcTmpCU->getVSPIndex(uiIdx)) 4597 5243 #endif … … 4618 5264 4619 5265 if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx )) 4620 #if MERL_VSP_C0152 5266 #if MERL_VSP_C0152 & !QC_BVSP_CleanUP_D0191 4621 5267 if(! pcTmpCU->getVSPIndex(uiIdx)) 4622 5268 #endif … … 4643 5289 pcTmpCU = getPUAboveRight(uiIdx, uiPartIdxRT, true, false, true); 4644 5290 if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ) ) 4645 #if MERL_VSP_C0152 5291 #if MERL_VSP_C0152 & !QC_BVSP_CleanUP_D0191 4646 5292 if(! pcTmpCU->getVSPIndex(uiIdx)) 4647 5293 #endif … … 4667 5313 pcTmpCU = getPUBelowLeft(uiIdx, uiPartIdxLB, true, false); 4668 5314 if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx )) 4669 #if MERL_VSP_C0152 5315 #if MERL_VSP_C0152 & !QC_BVSP_CleanUP_D0191 4670 5316 if(! pcTmpCU->getVSPIndex(uiIdx)) 4671 5317 #endif … … 4694 5340 assert(uiPartIdxLT == (m_uiAbsIdxInLCU + uiPartAddr)); 4695 5341 if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx )) 4696 #if MERL_VSP_C0152 5342 #if MERL_VSP_C0152 & !QC_BVSP_CleanUP_D0191 4697 5343 if(! pcTmpCU->getVSPIndex(uiIdx)) 4698 5344 #endif … … 4902 5548 Int iPictureWidth = pcBaseViewDepthPicYuv->getWidth(); 4903 5549 Int iPictureHeight = pcBaseViewDepthPicYuv->getHeight(); 4904 5550 #if !QC_BVSP_CleanUP_D0191 5551 #if LGE_ROUND_OFFSET_D0135 5552 Int depthPosX = Clip3(0, iPictureWidth - iBlkWidth, iBlkX + ((mv->getHor()+2)>>2)); 5553 Int depthPosY = Clip3(0, iPictureHeight- iBlkHeight, iBlkY + ((mv->getVer()+2)>>2)); 5554 #else 4905 5555 Int depthPosX = Clip3(0, iPictureWidth - iBlkWidth, iBlkX + (mv->getHor()>>2)); 4906 5556 Int depthPosY = Clip3(0, iPictureHeight- iBlkHeight, iBlkY + (mv->getVer()>>2)); 5557 #endif 4907 5558 4908 5559 Pel *pDepthPel = pcBaseViewDepthPicYuv->getLumaAddr() + depthPosX + depthPosY * depStride; 5560 #endif 4909 5561 Pel maxDepthVal = 0; 4910 5562 4911 5563 if ( bSimpleDvpRefine ) 4912 5564 { 5565 #if LGE_ROUND_OFFSET_D0135 5566 Int depthStartPosX = Clip3(0, iPictureWidth - iBlkWidth, iBlkX + ((mv->getHor()+2)>>2)); 5567 Int depthStartPosY = Clip3(0, iPictureHeight- iBlkHeight, iBlkY + ((mv->getVer()+2)>>2)); 5568 Int depthEndPosX = Clip3(0, iPictureWidth - 1, iBlkX + iBlkWidth - 1 + ((mv->getHor()+2)>>2)); 5569 Int depthEndPosY = Clip3(0, iPictureHeight - 1, iBlkY + iBlkHeight - 1 + ((mv->getVer()+2)>>2)); 5570 #else 4913 5571 Int depthStartPosX = Clip3(0, iPictureWidth - iBlkWidth, iBlkX + (mv->getHor()>>2)); 4914 5572 Int depthStartPosY = Clip3(0, iPictureHeight- iBlkHeight, iBlkY + (mv->getVer()>>2)); 4915 5573 Int depthEndPosX = Clip3(0, iPictureWidth - 1, iBlkX + iBlkWidth - 1 + (mv->getHor()>>2)); 4916 5574 Int depthEndPosY = Clip3(0, iPictureHeight - 1, iBlkY + iBlkHeight - 1 + (mv->getVer()>>2)); 5575 #endif 5576 #if !MTK_DEPTH_TO_DISP_D0138 4917 5577 Int iCenterX = (depthStartPosX + depthEndPosX) >> 1; 4918 5578 Int iCenterY = (depthStartPosY + depthEndPosY) >> 1; 5579 #endif 4919 5580 4920 5581 Pel *depthTL = pcBaseViewDepthPicYuv->getLumaAddr(); … … 4924 5585 aiDepth[2] = depthTL[ (depthStartPosY) * depStride + depthEndPosX ]; // Right Top 4925 5586 aiDepth[3] = depthTL[ (depthEndPosY) * depStride + depthEndPosX ]; // Right Bottom 5587 #if MTK_DEPTH_TO_DISP_D0138 5588 for (Int i = 0; i < 4; i++) 5589 #else 4926 5590 aiDepth[4] = depthTL[ (iCenterY) * depStride + iCenterX ]; // Center 4927 5591 for (Int i = 0; i < 5; i++) 5592 #endif 4928 5593 { 4929 5594 if (maxDepthVal < aiDepth[i]) … … 4931 5596 } 4932 5597 } 5598 #if !QC_BVSP_CleanUP_D0191 4933 5599 else 4934 5600 { … … 4943 5609 } 4944 5610 } 5611 #endif 4945 5612 4946 5613 Int iDisp = aiShiftLUT[ maxDepthVal ] << iShiftPrec; … … 4948 5615 return iDisp; 4949 5616 } 4950 Void TComDataCU::estimateDVFromDM(UInt uiPartIdx, TComPic* picDepth, UInt uiPartAddr, TComMv* cMvPred, Bool bSimpleDvpRefine) 5617 5618 Void TComDataCU::estimateDVFromDM( 5619 #if MERL_VSP_NBDV_RefVId_Fix_D0166 5620 Int refViewIdx, 5621 #endif 5622 UInt uiPartIdx, TComPic* picDepth, UInt uiPartAddr, TComMv* cMvPred, Bool bSimpleDvpRefine) 4951 5623 { 4952 5624 if (picDepth) … … 4962 5634 Int iShiftPrec; 4963 5635 4964 getSlice()->getBWVSPLUTParam(aiShiftLUT, iShiftPrec); 5636 getSlice()->getBWVSPLUTParam(aiShiftLUT, iShiftPrec 5637 #if MERL_VSP_NBDV_RefVId_Fix_D0166 5638 , refViewIdx 5639 #endif 5640 ); 4965 5641 4966 5642 Pel iDisp = getMcpFromDM( pcBaseViewDepthPicYuv, cMvPred, iBlkX, iBlkY, iWidth, iHeight, aiShiftLUT, iShiftPrec, bSimpleDvpRefine ); … … 4991 5667 clipMv(cMvPred); 4992 5668 4993 TComPic* picDepth = getSlice()->getRefPicBaseDepth(); 4994 5669 TComPic* picDepth = NULL; 5670 #if MERL_General_Fix 5671 #if MERL_VSP_C0152 5672 #if MERL_VSP_NBDV_RefVId_Fix_D0166 5673 Int refPOC = getSlice()->getRefPic(eRefPicList, refId)->getPOC(); 5674 picDepth = getSlice()->getDepthRefPic(refViewIdx, refPOC); 5675 assert(refPOC == getSlice()->getPOC()); 5676 assert(picDepth != NULL); 5677 #else 5678 picDepth = getSlice()->getRefPicBaseDepth(); 5679 #endif 5680 #endif 5681 #else 5682 picDepth = getSlice()->getRefPicBaseDepth(); 5683 #endif 5684 5685 #if QC_CU_NBDV_D0181 && MERL_VSP_C0152 5686 pNbDvInfo->m_acMvCandNoRef[pNbDvInfo->iN] = cMvPred; 5687 #endif 4995 5688 if (picDepth && bDepthRefine) 4996 estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred, true); 4997 5689 estimateDVFromDM( 5690 #if MERL_VSP_NBDV_RefVId_Fix_D0166 5691 refViewIdx, 5692 #endif 5693 uiPartIdx, picDepth, uiPartAddr, &cMvPred, true); 5694 5695 5696 #if MERL_VSP_NBDV_RefVId_Fix_D0166 5697 pNbDvInfo->m_aListIdx[ pNbDvInfo->iN ] = eRefPicList; 5698 pNbDvInfo->m_aRefIdx [ pNbDvInfo->iN ] = -1-refId; 5699 assert(pNbDvInfo->m_aRefIdx [ pNbDvInfo->iN ] < 0); 5700 #endif 4998 5701 pNbDvInfo->m_acMvCand[ pNbDvInfo->iN ] = cMvPred; 4999 5702 pNbDvInfo->m_aVIdxCan[ pNbDvInfo->iN++ ] = refViewIdx; … … 5010 5713 } 5011 5714 } 5012 #if MERL_VSP_C0152 5715 #if MERL_VSP_C0152 & !QC_BVSP_CleanUP_D0191 5013 5716 else if (pcTmpCU->getVSPIndex(uiIdx) != 0) // is VSP 5014 5717 { 5015 TComPic* picDepth = pcTmpCU->getSlice()->getRefPicBaseDepth(); 5718 TComPic* picDepth = NULL; 5719 5720 #if MERL_VSP_NBDV_RefVId_Fix_D0166 5721 RefPicList privateRefPicList = (RefPicList) pcTmpCU->getVSPDir( uiIdx ); 5722 assert(privateRefPicList == REF_PIC_LIST_0 || privateRefPicList == REF_PIC_LIST_1); 5723 Int refIdx = -1-pcTmpCU->getCUMvField( privateRefPicList )->getRefIdx( uiIdx ); // a trick when storing refIdx for temporal BVSP 5724 assert(refIdx >= 0); 5725 Int refViewIdx = getSlice()->getRefViewId(privateRefPicList, refIdx); 5726 Int refPOC = getSlice()->getRefPOC(privateRefPicList, refIdx); 5727 5728 picDepth = getSlice()->getDepthRefPic(refViewIdx, refPOC); 5729 assert(refPOC == getSlice()->getPOC()); 5730 assert(picDepth != NULL); 5731 #else 5732 picDepth = pcTmpCU->getSlice()->getRefPicBaseDepth(); 5733 #endif 5734 5735 #if QC_CU_NBDV_D0181 && MERL_VSP_C0152 5736 pNbDvInfo->m_acMvCandNoRef[pNbDvInfo->iN] = cMvPred; 5737 #endif 5016 5738 if (picDepth && bDepthRefine) 5017 estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred); 5739 estimateDVFromDM( 5740 #if MERL_VSP_NBDV_RefVId_Fix_D0166 5741 refViewIdx, 5742 #endif 5743 uiPartIdx, picDepth, uiPartAddr, &cMvPred); 5018 5744 5019 5745 cMvPred.setVer(0); 5020 5746 5747 #if MERL_VSP_NBDV_RefVId_Fix_D0166 5748 pNbDvInfo->m_aRefIdx [ pNbDvInfo->iN ] = -1-refIdx; 5749 pNbDvInfo->m_aListIdx[ pNbDvInfo->iN ] = privateRefPicList; 5750 pNbDvInfo->m_acMvCand[ pNbDvInfo->iN ] = cMvPred; 5751 pNbDvInfo->m_aVIdxCan[ pNbDvInfo->iN ] = refViewIdx; 5752 assert(pNbDvInfo->m_aRefIdx [ pNbDvInfo->iN ] < 0); 5753 pNbDvInfo->iN++; 5754 #else 5021 5755 pNbDvInfo->m_acMvCand[ pNbDvInfo->iN] = cMvPred; 5022 5756 pNbDvInfo->m_aVIdxCan[ pNbDvInfo->iN++] = 0; // refViewIdx; 5757 #endif 5023 5758 return true; 5024 5759 } … … 5075 5810 } 5076 5811 5077 5812 #if MERL_VSP_NBDV_RefVId_Fix_D0166 5813 Bool TComDataCU::getRefListAndRefFrmIdx(Int targetRefViewIdx, RefPicList& eRefPicList, Int& refFrmIdx) 5814 { 5815 Bool isFound = false; 5816 RefPicList privateRefPicList = REF_PIC_LIST_0; 5817 5818 refFrmIdx = 0; 5819 for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1) && isFound == false; iList++) 5820 { 5821 privateRefPicList = RefPicList(iList); 5822 for (Int refIdx = 0; refIdx < getSlice()->getNumRefIdx(privateRefPicList); refIdx++) 5823 { 5824 Int refViewIdx = getSlice()->getRefViewId( privateRefPicList, refIdx); 5825 if ( refViewIdx == targetRefViewIdx) 5826 { 5827 refFrmIdx = refIdx; 5828 eRefPicList = privateRefPicList; 5829 isFound = true; 5830 break; 5831 } 5832 } 5833 } 5834 5835 return isFound; 5836 } 5837 #endif 5838 5839 #if QC_CU_NBDV_D0181 5840 Bool TComDataCU::getDisMvpCandNBDV( UInt uiPartIdx, UInt uiPartAddr, DisInfo* pDInfo , Bool bParMerge 5841 #else 5078 5842 Void TComDataCU::getDisMvpCandNBDV( UInt uiPartIdx, UInt uiPartAddr, DisInfo* pDInfo , Bool bParMerge 5843 #endif 5079 5844 #if MERL_VSP_C0152 5080 5845 , Bool bDepthRefine … … 5099 5864 } 5100 5865 5866 #if MTK_D0156 5867 if( !m_pcSlice->getSPS()->getUseDVPRefine() ) 5868 { 5869 bDepthRefine = false; 5870 } 5871 #endif 5872 5101 5873 // Get Positions 5102 5874 PartSize eCUMode = getPartitionSize( uiPartAddr ); 5875 #if QC_CU_NBDV_D0181 5876 assert(eCUMode == SIZE_2Nx2N); 5877 #endif 5103 5878 UInt uiPartIdxLT, uiPartIdxRT, uiPartIdxLB; 5104 5879 … … 5168 5943 { 5169 5944 clipMv(cColMv); 5170 TComPic* picDepth = getSlice()->getRefPicBaseDepth(); 5945 TComPic* picDepth = NULL; 5946 #if MERL_VSP_NBDV_RefVId_Fix_D0166 5947 Int currPoc = getSlice()->getPOC(); 5948 picDepth = getSlice()->getDepthRefPic(iTargetViewIdx, currPoc); 5949 assert(picDepth != NULL); 5950 #else 5951 picDepth = getSlice()->getRefPicBaseDepth(); 5952 #endif 5953 #if QC_CU_NBDV_D0181 && MERL_VSP_C0152 5954 pDInfo->m_acMvCandNoRef[pDInfo->iN] = cColMv; 5955 #endif 5171 5956 if (picDepth && bDepthRefine) 5957 #if MERL_VSP_NBDV_RefVId_Fix_D0166 5958 estimateDVFromDM(iTargetViewIdx, uiPartIdx, picDepth, uiPartAddr, &cColMv, true); 5959 #else 5172 5960 estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv, true); 5173 5174 pDInfo->m_acMvCand[ pDInfo->iN] = cColMv; 5961 #endif 5962 5963 #if MERL_VSP_NBDV_RefVId_Fix_D0166 5964 Int refFrmIdx = 0; 5965 RefPicList privateRefPicList = REF_PIC_LIST_0; 5966 getRefListAndRefFrmIdx(iTargetViewIdx, privateRefPicList, refFrmIdx); 5967 5968 pDInfo->m_aListIdx[ pDInfo->iN ] = privateRefPicList; 5969 pDInfo->m_aRefIdx [ pDInfo->iN ] = -1-refFrmIdx; 5970 assert(pDInfo->m_aRefIdx [ pDInfo->iN ] < 0); 5971 #endif 5972 pDInfo->m_acMvCand[ pDInfo->iN ] = cColMv; 5175 5973 pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx; 5974 #if QC_CU_NBDV_D0181 5975 return true; 5976 #else 5176 5977 return ; 5978 #endif 5177 5979 } 5178 5980 } // Loop positions … … 5203 6005 bCheckMcpDv = true; 5204 6006 if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, uiPartIdx, uiPartAddr, pDInfo, bCheckMcpDv, &cMvpDvInfo, DVFROM_LEFT, bDepthRefine ) ) 6007 #if !QC_CU_NBDV_D0181 5205 6008 return; 5206 6009 #else 6010 return true; 6011 #endif 5207 6012 5208 6013 //// ******* Get disparity from above block ******* ///// … … 5225 6030 bCheckMcpDv = ( ( getAddr() - pcTmpCU->getAddr() ) == 0); 5226 6031 if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, uiPartIdx, uiPartAddr, pDInfo, bCheckMcpDv, &cMvpDvInfo, DVFROM_ABOVE, bDepthRefine ) ) 6032 #if !QC_CU_NBDV_D0181 5227 6033 return; 6034 #else 6035 return true; 6036 #endif 5228 6037 } 5229 6038 … … 5243 6052 bCheckMcpDv = ( ( getAddr() - pcTmpCU->getAddr() ) == 0); 5244 6053 if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, uiPartIdx, uiPartAddr, pDInfo, bCheckMcpDv, &cMvpDvInfo, DVFROM_ABOVERIGHT, bDepthRefine ) ) 6054 #if !QC_CU_NBDV_D0181 5245 6055 return; 6056 #else 6057 return true; 6058 #endif 5246 6059 } 5247 6060 … … 5262 6075 bCheckMcpDv = true; 5263 6076 if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, uiPartIdx, uiPartAddr, pDInfo, bCheckMcpDv, &cMvpDvInfo, DVFROM_LEFTBELOW, bDepthRefine ) ) 6077 #if !QC_CU_NBDV_D0181 5264 6078 return; 6079 #else 6080 return true; 6081 #endif 5265 6082 } 5266 6083 … … 5282 6099 bCheckMcpDv = (( getAddr() - pcTmpCU->getAddr() ) <= 1); 5283 6100 if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, uiPartIdx, uiPartAddr, pDInfo, bCheckMcpDv, &cMvpDvInfo, DVFROM_ABOVELEFT, bDepthRefine ) ) 6101 #if !QC_CU_NBDV_D0181 5284 6102 return; 6103 #else 6104 return true; 6105 #endif 5285 6106 } 5286 6107 … … 5297 6118 clipMv( cDispVec ); 5298 6119 5299 TComPic* picDepth = getSlice()->getRefPicBaseDepth(); 6120 TComPic* picDepth = NULL; 6121 #if MERL_VSP_NBDV_RefVId_Fix_D0166 6122 Int refPOC = getSlice()->getPOC(); 6123 picDepth = getSlice()->getDepthRefPic(0, refPOC); 6124 assert(picDepth!=NULL); 6125 #else 6126 picDepth = getSlice()->getRefPicBaseDepth(); 6127 #endif 6128 6129 #if QC_CU_NBDV_D0181 && MERL_VSP_C0152 6130 pDInfo->m_acMvCandNoRef[pDInfo->iN] = cDispVec; 6131 #endif 5300 6132 if (picDepth && bDepthRefine) 6133 #if MERL_VSP_NBDV_RefVId_Fix_D0166 6134 estimateDVFromDM(0, uiPartIdx, picDepth, uiPartAddr, &cDispVec, true); // from base view 6135 #else 5301 6136 estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cDispVec, true); 5302 5303 pDInfo->m_acMvCand[ pDInfo->iN] = cDispVec; 6137 #endif 6138 6139 #if MERL_VSP_NBDV_RefVId_Fix_D0166 //if DVMCP is used, do a local reference frame list and idx search 6140 Int refFrmIdx = 0; 6141 RefPicList privateRefPicList = REF_PIC_LIST_0 ; 6142 getRefListAndRefFrmIdx(0, privateRefPicList, refFrmIdx); // find the reference picture from base view 6143 6144 pDInfo->m_aListIdx[ pDInfo->iN ] = privateRefPicList; 6145 pDInfo->m_aRefIdx [ pDInfo->iN ] = -1-refFrmIdx; 6146 assert(pDInfo->m_aRefIdx [ pDInfo->iN ] < 0); 6147 #endif 6148 6149 pDInfo->m_acMvCand[ pDInfo->iN ] = cDispVec; 5304 6150 pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0; 6151 #if !QC_CU_NBDV_D0181 5305 6152 return; 6153 #else 6154 return true; 6155 #endif 5306 6156 } 5307 6157 } 5308 6158 } 5309 6159 } 6160 6161 #if SEC_DEFAULT_DV_D0112 6162 { 6163 TComPic* picDepth = NULL; 6164 TComMv defaultDV(0, 0); 6165 6166 #if MERL_VSP_NBDV_RefVId_Fix_D0166 6167 Int refPOC = getSlice()->getPOC(); 6168 picDepth = getSlice()->getDepthRefPic(0, refPOC); 6169 assert(picDepth!=NULL); 6170 #else 6171 picDepth = getSlice()->getRefPicBaseDepth(); 6172 #endif 6173 6174 #if MERL_General_Fix 6175 #if QC_CU_NBDV_D0181 && MERL_VSP_C0152 6176 pDInfo->m_acMvCandNoRef[pDInfo->iN] = defaultDV; 6177 #endif 6178 #endif 6179 6180 if (picDepth && bDepthRefine) 6181 { 6182 #if MERL_VSP_NBDV_RefVId_Fix_D0166 6183 estimateDVFromDM(0, uiPartIdx, picDepth, uiPartAddr, &defaultDV, true); // from base view 6184 #else 6185 estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &defaultDV, true); 6186 #endif 6187 } 6188 6189 #if MERL_VSP_NBDV_RefVId_Fix_D0166 6190 Int refFrmIdx = 0; 6191 RefPicList privateRefPicList = REF_PIC_LIST_0 ; 6192 getRefListAndRefFrmIdx(0, privateRefPicList, refFrmIdx); // find the reference picture from base view 6193 6194 pDInfo->m_aListIdx[ pDInfo->iN ] = privateRefPicList; 6195 pDInfo->m_aRefIdx [ pDInfo->iN ] = -1-refFrmIdx; 6196 assert(pDInfo->m_aRefIdx [ pDInfo->iN ] < 0); 6197 #endif 6198 pDInfo->m_acMvCand[pDInfo->iN] = defaultDV; 6199 pDInfo->m_aVIdxCan[pDInfo->iN] = 0; 6200 #if MERL_VSP_NBDV_RefVId_Fix_D0166 // Bug fix for Samsung code. 6201 pDInfo->iN++; 6202 #endif 6203 } 6204 #endif 6205 6206 #if QC_CU_NBDV_D0181 6207 return false; 6208 #else 5310 6209 return; 6210 #endif 5311 6211 } 5312 6212 #endif … … 5322 6222 */ 5323 6223 #if H3D_IVMP 6224 #if SEC_TWO_CANDIDATES_FOR_AMVP_D0122 5324 6225 Void TComDataCU::fillMvpCand ( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo, Int iMVPIdx) 5325 6226 { 6227 fillMvpCandBase(uiPartIdx, uiPartAddr, eRefPicList, iRefIdx, pInfo); 6228 } 6229 #else 6230 Void TComDataCU::fillMvpCand ( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo, Int iMVPIdx) 6231 { 6232 5326 6233 if (!m_pcSlice->getSPS()->getViewId() || !m_pcSlice->getSPS()->getMultiviewMvPredMode()) 5327 6234 { … … 5350 6257 // Extension part 5351 6258 DisInfo cDisInfo; 6259 #if QC_CU_NBDV_D0181 6260 cDisInfo.iN = this->getDvInfo(0).iN; 6261 cDisInfo.m_acMvCand[0]=this->getDvInfo(0).m_acMvCand[0]; 6262 cDisInfo.m_aVIdxCan[0] = this->getDvInfo(0).m_aVIdxCan[0]; 6263 cDisInfo.bDV = this->getDvInfo(0).bDV; 6264 #else 5352 6265 cDisInfo.iN = 0; 5353 6266 #if FCO_DVP_REFINE_C0132_C0170 … … 5382 6295 cDisInfo.m_aVIdxCan[0] = 0; 5383 6296 } 6297 #endif 5384 6298 Int paiPdmRefIdx[4] = {-1, -1, -1, -1}; 5385 6299 Int iPdmDir[4] = {-1, -1, -1, -1}; … … 5402 6316 } 5403 6317 } 6318 #endif 5404 6319 5405 6320 … … 5700 6615 } 5701 6616 5702 #if MERL_VSP_C0152 6617 #if MERL_VSP_C0152&!QC_BVSP_CleanUP_D0191 5703 6618 if(pcTmpCU != NULL && pcTmpCU->getVSPIndex(uiIdx)) 5704 6619 { … … 5816 6731 } 5817 6732 5818 #if MERL_VSP_C0152 6733 #if MERL_VSP_C0152 &!QC_BVSP_CleanUP_D0191 5819 6734 if(pcTmpCU->getVSPIndex(uiIdx)) 5820 6735 { … … 5979 6894 TComDataCU *pColCU = pColPic->getCU( uiCUAddr ); 5980 6895 iColViewIdx = pColCU->getSlice()->getViewId(); 5981 #if MERL_VSP_C0152 6896 #if MERL_VSP_C0152 & !QC_BVSP_CleanUP_D0191 5982 6897 if( pColCU->getCUMvField(eColRefPicList)->getRefIdx(uiAbsPartAddr) < 0) 5983 6898 { … … 7080 7995 memcpy( m_piVSPIndex + uiAbsPartIdxDst, pcCU->getVSPIndex() + uiAbsPartIdxSrc, sizeof( m_piVSPIndex[0] ) * uiNumPartition ); 7081 7996 #endif 7997 #if MERL_VSP_NBDV_RefVId_Fix_D0166 7998 memcpy( m_piVSPDir + uiAbsPartIdxDst, pcCU->getVSPDir () + uiAbsPartIdxSrc, sizeof( m_piVSPDir [0] ) * uiNumPartition ); 7999 #endif 7082 8000 7083 8001 #if !MTK_UNCONSTRAINED_MVI_B0083 … … 7158 8076 TComDataCU::getResidualSamples( UInt uiPartIdx, Bool bRecon, TComYuv* pcYuv ) 7159 8077 { 8078 #if !QC_ARP_D0177 7160 8079 TComResidualGenerator* pcResidualGenerator = m_pcSlice->getSPS()->getResidualGenerator(); 7161 8080 ROFRS( pcResidualGenerator, false ); 8081 #endif 8082 7162 8083 #if H3D_NBDV 7163 8084 DisInfo cDisInfo; 8085 #if !QC_CU_NBDV_D0181 7164 8086 cDisInfo.iN = 0; 8087 #else 8088 cDisInfo.bDV = false; 8089 #endif 7165 8090 PartSize m_peSaved = getPartitionSize( 0 ); 7166 8091 m_pePartSize[0] = SIZE_2Nx2N; … … 7182 8107 else 7183 8108 #endif 7184 8109 #if !QC_CU_NBDV_D0181 7185 8110 getDisMvpCandNBDV( 0, 0, &cDisInfo, false ); 7186 7187 8111 if( cDisInfo.iN == 0) 8112 #else 8113 cDisInfo.bDV = getDvInfo(0).bDV; 8114 #if MERL_VSP_C0152 8115 cDisInfo.m_acMvCand[0] = getDvInfo(0).m_acMvCandNoRef[0]; 8116 #else 8117 cDisInfo.m_acMvCand[0] = getDvInfo(0).m_acMvCand[0]; 8118 #endif 8119 cDisInfo.m_aVIdxCan[0] = 0; 8120 cDisInfo.iN = getDvInfo(0).iN; 8121 if( cDisInfo.bDV == false) 8122 #endif 7188 8123 { 7189 8124 m_pePartSize[0] = m_peSaved; … … 7191 8126 } 7192 8127 else 8128 #if QC_ARP_D0177 8129 if(m_pcSlice->getSPS()->getUseAdvRP()) 8130 { 8131 m_pePartSize[0] = m_peSaved; 8132 return true; 8133 } 8134 else 8135 return false; 8136 #else 7193 8137 { 7194 8138 Bool bAvailable = pcResidualGenerator->getResidualSamples( this, uiPartIdx, pcYuv, cDisInfo.m_acMvCand[0], bRecon ); … … 7196 8140 return bAvailable; 7197 8141 } 8142 #endif 7198 8143 #else 7199 8144 return pcResidualGenerator->getResidualSamples( this, uiPartIdx, pcYuv, bRecon ); … … 7201 8146 } 7202 8147 #endif 7203 8148 #if QC_ARP_D0177 8149 Void TComDataCU::setARPWSubParts ( UChar w, UInt uiAbsPartIdx, UInt uiDepth ) 8150 { 8151 assert( sizeof( *m_puhARPW) == 1 ); 8152 memset( m_puhARPW + uiAbsPartIdx, w, m_pcPic->getNumPartInCU() >> ( 2 * uiDepth ) ); 8153 } 8154 #endif 7204 8155 #if LGE_EDGE_INTRA_A0070 7205 8156 Void TComDataCU::reconPartition( UInt uiAbsPartIdx, UInt uiDepth, Bool bLeft, UChar ucStartPos, UChar ucNumEdge, UChar* pucEdgeCode, Bool* pbRegion ) -
trunk/source/Lib/TLibCommon/TComDataCU.h
r332 r443 195 195 ///< value 0: non-VSP, value 1: VSP 196 196 #endif 197 #if MERL_VSP_NBDV_RefVId_Fix_D0166 198 Char* m_piVSPDir; ///< 0: LIST0; 1: LIST1 199 #endif 197 200 #if AMP_MRG 198 201 Bool m_bIsMergeAMP; … … 214 217 Bool* m_pbResPredFlag; ///< array of residual prediction flags 215 218 #endif 216 219 #if QC_ARP_D0177 220 UChar* m_puhARPW; 221 #endif 217 222 #if LGE_EDGE_INTRA_A0070 218 223 UChar* m_pucEdgeCode; ///< array of edge code … … 268 273 Pel* m_apSegmentDCOffset[2]; 269 274 #endif 270 275 #if QC_CU_NBDV_D0181 276 DisInfo* m_pDvInfo; 277 #endif 271 278 protected: 272 279 … … 275 282 Bool xAddMVPCandOrder ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir ); 276 283 #if MERL_VSP_C0152 277 inline Bool xAddVspMergeCand ( UChar ucVspMergePos, Int vspIdx, Bool* bVspMvZeroDone, UInt uiDepth, Bool* abCandIsInter, Int& iCount, 278 UChar* puhInterDirNeighbours, TComMvField* pcMvFieldNeighbours, Int* iVSPIndexTrue, Int mrgCandIdx, DisInfo* pDisInfo ); 279 inline Void xInheritVspMode ( TComDataCU* pcCURef, UInt uiIdx, Bool* bVspMvZeroDone, Int iCount, Int* iVSPIndexTrue, TComMvField* pcMvFieldNeighbours, DisInfo* pDInfo ) ; 284 inline Bool xAddVspMergeCand ( 285 UChar ucVspMergePos, 286 #if !LGE_VSP_INHERIT_D0092 287 Int vspIdx, 288 Bool* bVspMvZeroDone, 289 #endif 290 UInt uiDepth, 291 Bool* abCandIsInter, 292 Int& iCount, 293 UChar* puhInterDirNeighbours, 294 TComMvField* pcMvFieldNeighbours, 295 Int* iVSPIndexTrue, 296 Int mrgCandIdx, 297 DisInfo* pDisInfo 298 #if MERL_VSP_NBDV_RefVId_Fix_D0166 299 , Int* iVspDirTrue = NULL 300 #endif 301 ); 302 inline Void xInheritVspMode ( TComDataCU* pcCURef, UInt uiIdx, Bool* bVspMvZeroDone, Int iCount, Int* iVSPIndexTrue, TComMvField* pcMvFieldNeighbours, DisInfo* pDInfo 303 #if QC_BVSP_CleanUP_D0191 304 ,UChar *puhInterDirNeighbours 305 #endif 306 #if MERL_VSP_NBDV_RefVId_Fix_D0166 307 , Int *iVSPDirTrue 308 #endif 309 ) ; 280 310 #endif 281 311 Void deriveRightBottomIdx ( PartSize eCUMode, UInt uiPartIdx, UInt& ruiPartIdxRB ); … … 299 329 300 330 /// compute scaling factor from POC difference 331 #if !QC_ARP_D0177 301 332 Int xGetDistScaleFactor ( Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC ); 302 333 #endif 303 334 Void xDeriveCenterIdx( PartSize eCUMode, UInt uiPartIdx, UInt& ruiPartIdxCenter ); 304 335 Bool xGetCenterCol( UInt uiPartIdx, RefPicList eRefPicList, int iRefIdx, TComMv *pcMv ); … … 314 345 // create / destroy / initialize / copy 315 346 // ------------------------------------------------------------------------------------------------------------------- 316 347 #if QC_ARP_D0177 348 Int xGetDistScaleFactor ( Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC ); 349 #endif 350 317 351 Void create ( UInt uiNumPartition, UInt uiWidth, UInt uiHeight, Bool bDecSubCu, Int unitSize 318 352 #if ADAPTIVE_QP_SELECTION … … 326 360 Void initSubCU ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth, Int qp ); 327 361 Void setOutsideCUPart ( UInt uiAbsPartIdx, UInt uiDepth ); 328 362 #if QC_CU_NBDV_D0181 363 Void copyDVInfoFrom (TComDataCU* pcCU, UInt uiAbsPartIdx); 364 #endif 329 365 Void copySubCU ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth ); 330 Void copyInterPredInfoFrom ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList ); 331 Void copyPartFrom ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth ); 366 Void copyInterPredInfoFrom ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList 367 #if QC_CU_NBDV_D0181 368 , Bool bNBDV = false 369 #endif 370 ); 371 Void copyPartFrom ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth 372 #if QC_ARP_D0177 373 , 374 Bool bRP = false 375 #endif 376 ); 332 377 333 378 Void copyToPic ( UChar uiDepth ); … … 458 503 Void setVSPIndex ( UInt uiIdx, Int n ) { m_piVSPIndex[uiIdx] = n; } 459 504 Void setVSPIndexSubParts( Char bVSPIndex, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); 505 #endif 506 #if MERL_VSP_NBDV_RefVId_Fix_D0166 507 Char* getVSPDir () { return m_piVSPDir; } 508 Char getVSPDir ( UInt uiIdx ) { return m_piVSPDir[uiIdx]; } 509 Void setVSPDir ( UInt uiIdx, Int n ) { m_piVSPDir[uiIdx] = n; } 510 Void setVSPDirSubParts ( Char bVSPDir, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); 511 Bool getRefListAndRefFrmIdx(Int targetRefViewIdx, RefPicList& eRefPicList, Int& refFrmIdx); 460 512 #endif 461 513 … … 474 526 #endif 475 527 #endif 528 #if QC_CU_NBDV_D0181 529 DisInfo* getDvInfo () { return m_pDvInfo; } 530 DisInfo getDvInfo (UInt uiIdx) { return m_pDvInfo[uiIdx]; } 531 Void setDvInfoSubParts( DisInfo cDvInfo, UInt uiAbsPartIdx, UInt uiDepth ); 532 #endif 476 533 477 534 #if AMP_MRG … … 537 594 Bool getUnifiedMvPredCan ( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* iPdm, Bool bMerge ); 538 595 Void getDisMvpCand ( UInt uiPartIdx, UInt uiPartAddr, DisInfo* pDInfo ); 596 #if QC_CU_NBDV_D0181 597 Bool getDisMvpCandNBDV( UInt uiPartIdx, UInt uiPartAddr, DisInfo* pDInfo , Bool bParMerg = false 598 #else 539 599 Void getDisMvpCandNBDV( UInt uiPartIdx, UInt uiPartAddr, DisInfo* pDInfo , Bool bParMerg = false 600 #endif 540 601 #if MERL_VSP_C0152 541 602 , Bool bDepthRefine = false … … 548 609 #if MERL_VSP_C0152 549 610 Pel getMcpFromDM(TComPicYuv* pcBaseViewDepthPicYuv, TComMv* mv, Int iBlkX, Int iBlkY, Int iWidth, Int iHeight, Int* aiShiftLUT, Int iShiftPrec, Bool bSimpleDvpRefine = false); 550 Void estimateDVFromDM(UInt uiPartIdx, TComPic* picDepth, UInt uiPartAddr, TComMv* cMvPred, Bool bSimpleDvpRefine = false); 611 Void estimateDVFromDM( 612 #if MERL_VSP_NBDV_RefVId_Fix_D0166 613 Int refViewIdx, 614 #endif 615 UInt uiPartIdx, TComPic* picDepth, UInt uiPartAddr, TComMv* cMvPred, Bool bSimpleDvpRefine = false); 551 616 #endif 552 617 Bool getIViewOrgDepthMvPred( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv ); … … 568 633 Bool getResidualSamples( UInt uiPartIdx, Bool bRecon, TComYuv* pcYuv = 0 ); 569 634 #endif 635 #if QC_ARP_D0177 636 UChar* getARPW () { return m_puhARPW; } 637 UChar getARPW ( UInt uiIdx ) { return m_puhARPW[uiIdx]; } 638 Void setARPW ( UInt uiIdx, UChar w ) { m_puhARPW[uiIdx] = w; } 639 Void setARPWSubParts ( UChar w, UInt uiAbsPartIdx, UInt uiDepth ); 640 Double getARPWFactor ( UInt uiIdx ); 641 #endif 570 642 // ------------------------------------------------------------------------------------------------------------------- 571 643 // member functions for accessing partition information … … 647 719 Bool hasEqualMotion ( UInt uiAbsPartIdx, TComDataCU* pcCandCU, UInt uiCandAbsPartIdx ); 648 720 #if MERL_VSP_C0152 649 Void getInterMergeCandidates ( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int* uiVSPIndexTrue, Int mrgCandIdx = -1 ); 721 Void getInterMergeCandidates ( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int* uiVSPIndexTrue, 722 #if MERL_VSP_NBDV_RefVId_Fix_D0166 723 Int* iVSPDir, 724 #endif 725 Int mrgCandIdx = -1 ); 650 726 #else 651 727 Void getInterMergeCandidates ( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx = -1 ); … … 688 764 UInt getCtxResPredFlag ( UInt uiAbsPartIdx ); 689 765 #endif 690 766 #if QC_ARP_D0177 767 UInt getCTXARPWFlag ( UInt uiAbsPartIdx ); 768 #endif 691 769 UInt getSliceStartCU ( UInt pos ) { return m_uiSliceStartCU[pos-m_uiAbsIdxInLCU]; } 692 770 UInt getEntropySliceStartCU ( UInt pos ) { return m_uiEntropySliceStartCU[pos-m_uiAbsIdxInLCU]; } … … 808 886 Void setSDCFlagSubParts ( Bool bSDCFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); 809 887 888 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 810 889 UInt getCtxSDCFlag ( UInt uiAbsPartIdx ); 890 #endif 811 891 812 892 Bool getSDCAvailable ( UInt uiAbsPartIdx ); -
trunk/source/Lib/TLibCommon/TComDepthMapGenerator.h
r332 r443 80 80 81 81 UInt getPdm () { if( m_aacActiveSPS[0][1] ) { return m_aacActiveSPS[0][1]->getPredDepthMapGeneration(); } return 0; } 82 #if H3D_IVRP 82 #if H3D_IVRP & !QC_ARP_D0177 83 83 UInt getResPrd () { if( m_aacActiveSPS[0][1] ) { return m_aacActiveSPS[0][1]->getMultiviewResPredMode (); } return 0; } 84 84 #endif -
trunk/source/Lib/TLibCommon/TComInterpolationFilter.cpp
r56 r443 72 72 { -2, 10, 58, -2 } 73 73 }; 74 74 #if QC_ARP_D0177 75 const Short TComInterpolationFilter::m_lumaFilterARP[4][NTAPS_LUMA_ARP] = 76 { 77 {64, 0}, 78 {48, 16}, 79 {32, 32}, 80 {16, 48} 81 }; 82 const Short TComInterpolationFilter::m_chromaFilterARP[8][NTAPS_CHROMA_ARP] = 83 { 84 {64, 0}, 85 {56, 8}, 86 {48, 16}, 87 {40, 24}, 88 {32, 32}, 89 {24, 40}, 90 {16, 48}, 91 {8, 56} 92 }; 93 #endif 75 94 // ==================================================================================================================== 76 95 // Private member functions … … 320 339 * \param isLast Flag indicating whether it is the last filtering operation 321 340 */ 322 Void TComInterpolationFilter::filterHorLuma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isLast ) 341 Void TComInterpolationFilter::filterHorLuma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isLast 342 #if QC_ARP_D0177 343 , 344 Bool filterType 345 #endif 346 ) 323 347 { 324 348 assert(frac >= 0 && frac < 4); … … 330 354 else 331 355 { 332 filterHor<NTAPS_LUMA>(src, srcStride, dst, dstStride, width, height, isLast, m_lumaFilter[frac]); 356 #if QC_ARP_D0177 357 if(filterType) 358 filterHor<NTAPS_LUMA_ARP>(src, srcStride, dst, dstStride, width, height, isLast, m_lumaFilterARP[frac]); 359 else 360 #endif 361 filterHor<NTAPS_LUMA>(src, srcStride, dst, dstStride, width, height, isLast, m_lumaFilter[frac]); 333 362 } 334 363 } … … 347 376 * \param isLast Flag indicating whether it is the last filtering operation 348 377 */ 349 Void TComInterpolationFilter::filterVerLuma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast ) 378 Void TComInterpolationFilter::filterVerLuma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast 379 #if QC_ARP_D0177 380 , 381 Bool filterType 382 #endif 383 ) 350 384 { 351 385 assert(frac >= 0 && frac < 4); … … 357 391 else 358 392 { 359 filterVer<NTAPS_LUMA>(src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_lumaFilter[frac]); 393 #if QC_ARP_D0177 394 if(filterType) 395 filterVer<NTAPS_LUMA_ARP>(src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_lumaFilterARP[frac]); 396 else 397 #endif 398 filterVer<NTAPS_LUMA>(src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_lumaFilter[frac]); 360 399 } 361 400 } … … 373 412 * \param isLast Flag indicating whether it is the last filtering operation 374 413 */ 375 Void TComInterpolationFilter::filterHorChroma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isLast ) 414 Void TComInterpolationFilter::filterHorChroma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isLast 415 #if QC_ARP_D0177 416 , 417 Bool filterType 418 #endif 419 ) 376 420 { 377 421 assert(frac >= 0 && frac < 8); … … 383 427 else 384 428 { 429 #if QC_ARP_D0177 430 if(filterType) 431 filterHor<NTAPS_CHROMA_ARP>(src, srcStride, dst, dstStride, width, height, isLast, m_chromaFilterARP[frac]); 432 else 433 #endif 385 434 filterHor<NTAPS_CHROMA>(src, srcStride, dst, dstStride, width, height, isLast, m_chromaFilter[frac]); 386 435 } … … 400 449 * \param isLast Flag indicating whether it is the last filtering operation 401 450 */ 402 Void TComInterpolationFilter::filterVerChroma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast ) 451 Void TComInterpolationFilter::filterVerChroma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast 452 #if QC_ARP_D0177 453 , 454 Bool filterType 455 #endif 456 ) 403 457 { 404 458 assert(frac >= 0 && frac < 8); … … 410 464 else 411 465 { 412 filterVer<NTAPS_CHROMA>(src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_chromaFilter[frac]); 466 #if QC_ARP_D0177 467 if(filterType) 468 filterVer<NTAPS_CHROMA_ARP>(src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_chromaFilterARP[frac]); 469 else 470 #endif 471 filterVer<NTAPS_CHROMA>(src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_chromaFilter[frac]); 413 472 } 414 473 } -
trunk/source/Lib/TLibCommon/TComInterpolationFilter.h
r56 r443 44 44 //! \ingroup TLibCommon 45 45 //! \{ 46 #if QC_ARP_D0177 47 #define NTAPS_LUMA_ARP 2 ///< Number of taps for luma 48 #define NTAPS_CHROMA_ARP 2 ///< Number of taps for chroma 49 #endif 46 50 47 51 #define NTAPS_LUMA 8 ///< Number of taps for luma … … 58 62 static const Short m_lumaFilter[4][NTAPS_LUMA]; ///< Luma filter taps 59 63 static const Short m_chromaFilter[8][NTAPS_CHROMA]; ///< Chroma filter taps 60 64 #if QC_ARP_D0177 65 static const Short m_lumaFilterARP [4][NTAPS_LUMA_ARP]; ///< Luma filter taps 66 static const Short m_chromaFilterARP[8][NTAPS_CHROMA_ARP]; ///< Chroma filter taps 67 #endif 68 61 69 static Void filterCopy(const Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Bool isFirst, Bool isLast); 62 70 … … 73 81 ~TComInterpolationFilter() {} 74 82 75 Void filterHorLuma (Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isLast ); 76 Void filterVerLuma (Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast ); 77 Void filterHorChroma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isLast ); 78 Void filterVerChroma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast ); 83 Void filterHorLuma (Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isLast 84 #if QC_ARP_D0177 85 , 86 Bool filterType = 0 87 #endif 88 ); 89 Void filterVerLuma (Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast 90 #if QC_ARP_D0177 91 , 92 Bool filterType = 0 93 #endif 94 ); 95 Void filterHorChroma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isLast 96 #if QC_ARP_D0177 97 , 98 Bool filterType = 0 99 #endif 100 ); 101 Void filterVerChroma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast 102 #if QC_ARP_D0177 103 , 104 Bool filterType = 0 105 #endif 106 ); 79 107 }; 80 108 -
trunk/source/Lib/TLibCommon/TComLoopFilter.cpp
r296 r443 428 428 //-- Set BS for Intra MB : BS = 4 or 3 429 429 if ( pcCUP->isIntra(uiPartP) || pcCUQ->isIntra(uiPartQ) 430 #if MERL_VSP_C0152 430 #if MERL_VSP_C0152 & !QC_BVSP_CleanUP_D0191 431 431 || pcCUP->getVSPIndex(uiPartP) || pcCUQ->getVSPIndex(uiPartQ) 432 432 #endif … … 438 438 //-- Set BS for not Intra MB : BS = 2 or 1 or 0 439 439 if ( !pcCUP->isIntra(uiPartP) && !pcCUQ->isIntra(uiPartQ) 440 #if MERL_VSP_C0152 440 #if MERL_VSP_C0152 & !QC_BVSP_CleanUP_D0191 441 441 && !pcCUP->getVSPIndex(uiPartP) && !pcCUQ->getVSPIndex(uiPartQ) 442 442 #endif … … 534 534 } // enf of "if( not Intra )" 535 535 536 #if MERL_VSP_C0152 536 #if MERL_VSP_C0152 & !QC_BVSP_CleanUP_D0191 537 537 if ( pcCUP->getVSPIndex(uiPartP) || pcCUQ->getVSPIndex(uiPartQ)) 538 538 { -
trunk/source/Lib/TLibCommon/TComMotionInfo.h
r332 r443 64 64 TComMv m_acMvCand[ DIS_CANS ]; ///< array of motion vector predictor candidates 65 65 Int m_aVIdxCan[ DIS_CANS ]; ///< array of motion vector predictor candidates 66 #if QC_CU_NBDV_D0181 67 Bool bDV; 68 #if MERL_VSP_C0152 69 TComMv m_acMvCandNoRef[ DIS_CANS ]; 70 #endif 71 #endif 66 72 Int iN; ///< number of motion vector predictor candidates 73 #if MERL_VSP_NBDV_RefVId_Fix_D0166 74 Int m_aListIdx[ DIS_CANS ]; ///< array of reference list of derived NBDV 75 Int m_aRefIdx [ DIS_CANS ]; ///< array of reference frame index corresponding to either RefList0/1 76 #endif 67 77 } DisInfo; 68 78 -
trunk/source/Lib/TLibCommon/TComPicYuv.cpp
r332 r443 488 488 } 489 489 } 490 490 #if QC_ARP_D0177 491 Void TComPicYuv::clearPic() 492 { 493 ::memset ( m_apiPicBufY, 0 , sizeof (Pel) * ( m_iPicWidth + (m_iLumaMarginX << 1)) * ( m_iPicHeight + (m_iLumaMarginY << 1)) ); 494 ::memset ( m_apiPicBufU, 0 , sizeof (Pel) * ((m_iPicWidth >> 1) + (m_iChromaMarginX << 1)) * ((m_iPicHeight >> 1) + (m_iChromaMarginY << 1)) ); 495 ::memset ( m_apiPicBufV, 0 , sizeof (Pel) * ((m_iPicWidth >> 1) + (m_iChromaMarginX << 1)) * ((m_iPicHeight >> 1) + (m_iChromaMarginY << 1)) ); 496 } 497 #endif 491 498 //! \} -
trunk/source/Lib/TLibCommon/TComPicYuv.h
r56 r443 183 183 Void setLumaTo ( Pel pVal ); 184 184 Void setChromaTo ( Pel pVal ); 185 185 #if QC_ARP_D0177 186 Void clearPic(); 187 #endif 186 188 };// END CLASS DEFINITION TComPicYuv 187 189 -
trunk/source/Lib/TLibCommon/TComPrediction.cpp
r332 r443 50 50 #endif 51 51 52 #if HHI_DELTADC_DLT_D0035 53 #define GetDepthValue2Idx(val) (pcCU->getSlice()->getSPS()->depthValue2idx(val)) 54 #define GetIdx2DepthValue(val) (pcCU->getSlice()->getSPS()->idx2DepthValue(val)) 55 #endif 56 57 #if MERL_General_Fix 58 #if MERL_VSP_C0152 59 #if MERL_CVSP_D0165 60 Int TComPrediction::m_iRangeLuma[12] = {14, 34, 21, 15, 36, 26, 21, 49, 41, 36, 80, 72}; 61 Int TComPrediction::m_iRangeChroma[12] = { 2, 8, 5, 4, 11, 9, 8, 19, 17, 15, 34, 32}; 62 #endif 63 #endif 64 #endif 65 52 66 TComPrediction::TComPrediction() 53 67 : m_pLumaRecBuffer(0) … … 78 92 79 93 m_cYuvPredTemp.destroy(); 80 94 #if QC_ARP_D0177 95 m_acYuvPredBase[0].destroy(); 96 m_acYuvPredBase[1].destroy(); 97 m_acYuvDiff[0].destroy(); 98 m_acYuvDiff[1].destroy(); 99 #endif 81 100 if( m_pLumaRecBuffer ) 82 101 { … … 119 138 120 139 m_cYuvPredTemp.create( g_uiMaxCUWidth, g_uiMaxCUHeight ); 140 #if QC_ARP_D0177 141 m_acYuvPredBase[0] .create( g_uiMaxCUWidth, g_uiMaxCUHeight ); 142 m_acYuvPredBase[1] .create( g_uiMaxCUWidth, g_uiMaxCUHeight ); 143 m_acYuvDiff [0] .create( g_uiMaxCUWidth, g_uiMaxCUHeight ); 144 m_acYuvDiff [1] .create( g_uiMaxCUWidth, g_uiMaxCUHeight ); 145 #endif 121 146 } 122 147 … … 535 560 // Do prediction 536 561 { 562 #if QC_DC_PREDICTOR_D0183 563 Int iMean0, iMean1; 564 getPredDCs( pbRegion, iWidth, pSrc+srcStride+1, srcStride, iMean0, iMean1 ); 565 #else 537 566 //UInt uiSum0 = 0, uiSum1 = 0; 538 567 Int iSum0 = 0, iSum1 = 0; … … 573 602 iMean0 = iSum0 / iCount0; // TODO : integer op. 574 603 iMean1 = iSum1 / iCount1; 604 #endif 575 605 #if LGE_EDGE_INTRA_DELTA_DC 576 606 if( bDelta ) … … 751 781 } 752 782 753 #if H3D_IVRP 783 #if H3D_IVRP & !QC_ARP_D0177 754 784 Void TComPrediction::residualPrediction(TComDataCU* pcCU, TComYuv* pcYuvPred, TComYuv* pcYuvResPred) 755 785 { … … 768 798 pcYuvPred->add(pcYuvResPred, iWidth, iHeight); 769 799 } 800 #endif 801 802 #if MERL_General_Fix 803 #if MERL_VSP_C0152 804 // Function to perform VSP block compensation 805 Void TComPrediction::xPredInterVSPBlk(TComDataCU* pcCU, UInt uiPartAddr, UInt uiAbsPartIdx, Int iWidth, Int iHeight, TComMv cMv, RefPicList eRefPicList, TComYuv*& rpcYuvPred 806 , Bool bi 807 #if !MERL_Bi_VSP_D0166 808 , Int vspIdx 809 #endif 810 ) 811 { 812 TComPic* pRefPicBaseTxt = NULL; 813 TComPicYuv* pcBaseViewTxtPicYuv = NULL; 814 TComPicYuv* pcBaseViewDepthPicYuv = NULL; 815 Int iBlkX = 0; 816 Int iBlkY = 0; 817 Int* pShiftLUT; 818 Int iShiftPrec; 819 820 #if !MERL_VSP_NBDV_RefVId_Fix_D0166 821 pRefPicBaseTxt = pcCU->getSlice()->getRefPicBaseTxt(); 822 pcBaseViewTxtPicYuv = pRefPicBaseTxt->getPicYuvRec(); 823 TComPic* pRefPicBaseDepth = pcCU->getSlice()->getRefPicBaseDepth(); 824 pcBaseViewDepthPicYuv = pRefPicBaseDepth->getPicYuvRec(); 825 826 Int iBlkX = ( pcCU->getAddr() % pRefPicBaseDepth->getFrameWidthInCU() ) * g_uiMaxCUWidth + g_auiRasterToPelX[ g_auiZscanToRaster[ uiAbsPartIdx ] ]; 827 Int iBlkY = ( pcCU->getAddr() / pRefPicBaseDepth->getFrameWidthInCU() ) * g_uiMaxCUHeight + g_auiRasterToPelY[ g_auiZscanToRaster[ uiAbsPartIdx ] ]; 828 pcCU->getSlice()->getBWVSPLUTParam(pShiftLUT, iShiftPrec); 829 xPredInterLumaBlkFromDM ( pcBaseViewTxtPicYuv, pcBaseViewDepthPicYuv, pShiftLUT, iShiftPrec, &cMv, uiPartAddr, iBlkX, iBlkY, iWidth, iHeight, pcCU->getSlice()->getSPS()->isDepth(), rpcYuvPred ); 830 xPredInterChromaBlkFromDM( pcBaseViewTxtPicYuv, pcBaseViewDepthPicYuv, pShiftLUT, iShiftPrec, &cMv, uiPartAddr, iBlkX>>1, iBlkY>>1, iWidth>>1, iHeight>>1, pcCU->getSlice()->getSPS()->isDepth(), rpcYuvPred ); 831 832 #else // MERL_VSP_NBDV_RefVId_Fix_D0166 833 // Step 1: get depth reference 834 #if QC_BVSP_CleanUP_D0191 835 RefPicList privateRefPicList = REF_PIC_LIST_0; 836 Int refIdxList0 = pcCU->getCUMvField( REF_PIC_LIST_0 )->getRefIdx( uiPartAddr ); 837 Int refIdxList1 = pcCU->getCUMvField( REF_PIC_LIST_1 )->getRefIdx( uiPartAddr ); 838 privateRefPicList = refIdxList0 != NOT_VALID ? REF_PIC_LIST_0 : REF_PIC_LIST_1; 839 if(privateRefPicList == REF_PIC_LIST_1 && refIdxList1== NOT_VALID ) 840 { 841 assert(0); 842 } 843 Int privateRefIdx = privateRefPicList == REF_PIC_LIST_0 ? refIdxList0 : refIdxList1; 844 Int viewId = pcCU->getSlice()->getRefViewId(privateRefPicList, privateRefIdx); 845 Int refPoc = pcCU->getSlice()->getRefPOC(privateRefPicList, privateRefIdx); 846 #else 847 //recover VSP reference frame according to negative refIdx number 848 RefPicList privateRefPicList = (RefPicList) pcCU->getVSPDir( uiPartAddr ); 849 assert(privateRefPicList == REF_PIC_LIST_0 || privateRefPicList == REF_PIC_LIST_1); 850 Int refIdx = -1-pcCU->getCUMvField( privateRefPicList )->getRefIdx( uiPartAddr ); // texture ref index, a trick when storing refIdx 851 Int viewId = pcCU->getSlice()->getRefViewId(privateRefPicList, refIdx); // texture view id 852 Int refPoc = pcCU->getSlice()->getRefPOC(privateRefPicList, refIdx); // texture POC 853 #endif 854 TComPic* pRefPicBaseDepth = pcCU->getSlice()->getDepthRefPic(viewId, refPoc); 855 856 pcBaseViewDepthPicYuv = pRefPicBaseDepth->getPicYuvRec(); 857 assert(refPoc == pcCU->getSlice()->getPOC()); 858 assert(pRefPicBaseDepth != NULL); 859 assert(pcBaseViewDepthPicYuv != NULL); 860 861 iBlkX = ( pcCU->getAddr() % pRefPicBaseDepth->getFrameWidthInCU() ) * g_uiMaxCUWidth + g_auiRasterToPelX[ g_auiZscanToRaster[ uiAbsPartIdx ] ]; 862 iBlkY = ( pcCU->getAddr() / pRefPicBaseDepth->getFrameWidthInCU() ) * g_uiMaxCUHeight + g_auiRasterToPelY[ g_auiZscanToRaster[ uiAbsPartIdx ] ]; 863 #if MERL_Bi_VSP_D0166 864 // Step 2: get texture reference 865 pRefPicBaseTxt = xGetVspRefTxt( pcCU, uiPartAddr, eRefPicList); 866 pcBaseViewTxtPicYuv = pRefPicBaseTxt->getPicYuvRec(); 867 assert(pcBaseViewTxtPicYuv != NULL); 868 869 // initialize the LUT according to the reference view idx 870 pcCU->getSlice()->getBWVSPLUTParam(pShiftLUT, iShiftPrec, pRefPicBaseTxt->getViewId()); 871 872 // Step 3: Do compensation 873 xPredInterLumaBlkFromDM ( pcBaseViewTxtPicYuv, pcBaseViewDepthPicYuv, pShiftLUT, iShiftPrec, &cMv, uiPartAddr, iBlkX, iBlkY, iWidth, iHeight, pcCU->getSlice()->getSPS()->isDepth(), rpcYuvPred, bi ); 874 xPredInterChromaBlkFromDM( pcBaseViewTxtPicYuv, pcBaseViewDepthPicYuv, pShiftLUT, iShiftPrec, &cMv, uiPartAddr, iBlkX>>1, iBlkY>>1, iWidth>>1, iHeight>>1, pcCU->getSlice()->getSPS()->isDepth(), rpcYuvPred, bi ); 875 #else 876 // Step 2: get texture reference 877 pRefPicBaseTxt = pcCU->getSlice()->getRefPic(privateRefPicList, refIdx); 878 pcBaseViewTxtPicYuv = pRefPicBaseTxt->getPicYuvRec(); 879 assert(pcBaseViewTxtPicYuv != NULL); 880 881 //initialize the LUT according to the reference view idx 882 pcCU->getSlice()->getBWVSPLUTParam(pShiftLUT, iShiftPrec, pRefPicBaseTxt->getViewId()); 883 884 // Step 3: Do compensation 885 xPredInterLumaBlkFromDM ( pcBaseViewTxtPicYuv, pcBaseViewDepthPicYuv, pShiftLUT, iShiftPrec, &cMv, uiPartAddr, iBlkX, iBlkY, iWidth, iHeight, pcCU->getSlice()->getSPS()->isDepth(), vspIdx, rpcYuvPred ); 886 xPredInterChromaBlkFromDM( pcBaseViewTxtPicYuv, pcBaseViewDepthPicYuv, pShiftLUT, iShiftPrec, &cMv, uiPartAddr, iBlkX>>1, iBlkY>>1, iWidth>>1, iHeight>>1, pcCU->getSlice()->getSPS()->isDepth(), vspIdx, rpcYuvPred ); 887 #endif 888 889 #endif 890 } 891 892 #endif 893 894 #if MERL_Bi_VSP_D0166 895 TComPic* TComPrediction::xGetVspRefTxt(TComDataCU* pcCU, UInt uiPartAddr, RefPicList eRefPicList) 896 { 897 #if QC_BVSP_CleanUP_D0191 898 RefPicList privateRefPicList = REF_PIC_LIST_0; 899 Int refIdxList0 = pcCU->getCUMvField( REF_PIC_LIST_0 )->getRefIdx( uiPartAddr ); 900 Int refIdxList1 = pcCU->getCUMvField( REF_PIC_LIST_1 )->getRefIdx( uiPartAddr ); 901 privateRefPicList = refIdxList0 != NOT_VALID ? REF_PIC_LIST_0 : REF_PIC_LIST_1; 902 if(privateRefPicList == REF_PIC_LIST_1 && refIdxList1==NOT_VALID ) 903 { 904 assert(0); 905 } 906 Int privateRefIdx = privateRefPicList == REF_PIC_LIST_0 ? refIdxList0 : refIdxList1; 907 Int viewId = pcCU->getSlice()->getRefViewId(privateRefPicList, privateRefIdx); 908 #else 909 RefPicList privateRefPicList = (RefPicList) pcCU->getVSPDir( uiPartAddr ); 910 Int refIdx = -1-pcCU->getCUMvField( privateRefPicList )->getRefIdx( uiPartAddr ); // texture ref index, a trick when storing refIdx 911 Int viewId = pcCU->getSlice()->getRefViewId(privateRefPicList, refIdx); // texture view id 912 #endif 913 TComPic* refPic = NULL; 914 915 assert(privateRefPicList == REF_PIC_LIST_0 || privateRefPicList == REF_PIC_LIST_1); 916 917 if (privateRefPicList == eRefPicList) 918 { 919 #if QC_BVSP_CleanUP_D0191 920 Int refIdxt = pcCU->getCUMvField( eRefPicList )->getRefIdx( uiPartAddr ); 921 #else 922 Int refIdxt = -1-pcCU->getCUMvField( eRefPicList )->getRefIdx( uiPartAddr ); 923 #endif 924 assert(refIdxt>= 0); 925 refPic = pcCU->getSlice()->getRefPic(eRefPicList, refIdxt); 926 } 927 else 928 { 929 // Find the other interview reference in order to do VSP 930 RefPicList otherRefPicList = privateRefPicList == REF_PIC_LIST_0 ? REF_PIC_LIST_1 : REF_PIC_LIST_0; 931 Bool isFound = false; 932 for (Int iRefIdx = 0; iRefIdx <pcCU->getSlice()->getNumRefIdx(otherRefPicList); iRefIdx ++ ) 933 { 934 Int refViewIdx = pcCU->getSlice()->getRefViewId( otherRefPicList, iRefIdx); 935 if ( (refViewIdx != pcCU->getSlice()->getViewId()) && (refViewIdx != viewId ) ) 936 { 937 refPic = pcCU->getSlice()->getRefPic(otherRefPicList, iRefIdx); 938 isFound = true; 939 break; 940 } 941 } 942 943 if (isFound == false) 944 { 945 #if QC_BVSP_CleanUP_D0191 946 Int refIdxTxt = pcCU->getCUMvField( privateRefPicList )->getRefIdx( uiPartAddr ); 947 #else 948 Int refIdxTxt = -1-pcCU->getCUMvField( privateRefPicList )->getRefIdx( uiPartAddr ); 949 #endif 950 assert(refIdxTxt >= 0); 951 refPic = pcCU->getSlice()->getRefPic(privateRefPicList, refIdxTxt); 952 } 953 assert(isFound); 954 } 955 assert(refPic != NULL); 956 return refPic; 957 } 958 #endif 770 959 #endif 771 960 … … 781 970 if (vspIdx != 0) 782 971 { 972 #if !QC_BVSP_CleanUP_D0191 783 973 if (iRefIdx >= 0) 784 974 { … … 786 976 } 787 977 assert (iRefIdx < 0); // assert (iRefIdx == NOT_VALID); 978 #endif 788 979 } 789 980 else … … 810 1001 } 811 1002 #endif 812 1003 #if QC_ARP_D0177 1004 if( 1005 #if MERL_General_Fix // TODO: Maybe logically redundant, but easier to read. Need verification before being removed 1006 #if MERL_VSP_C0152 1007 vspIdx == 0 && 1008 #endif 1009 #endif 1010 pcCU->getSlice()->getSPS()->isDepth() == false 1011 && pcCU->getSlice()->getSPS()->getViewId() > 0 1012 && pcCU->getSlice()->getSPS()->getUseAdvRP() > 0 1013 && pcCU->getARPW( uiPartAddr ) > 0 1014 && pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPOC()!= pcCU->getSlice()->getPOC() 1015 && (pcCU->getPartitionSize(uiPartAddr)==SIZE_2Nx2N || pcCU->isSkipped(uiPartAddr)) 1016 ) 1017 { 1018 xPredInterUniARP( pcCU , uiPartAddr , iWidth , iHeight , eRefPicList , rpcYuvPred , iPartIdx , bi ); 1019 } 1020 else 1021 { 1022 #endif 813 1023 #if HHI_FULL_PEL_DEPTH_MAP_MV_ACC 814 1024 if( pcCU->getSlice()->getSPS()->isDepth() ) … … 816 1026 #if MERL_VSP_C0152 817 1027 if (vspIdx != 0) 818 { // depth, vsp 1028 { // depth, vsp compensation 1029 #if !MERL_General_Fix 819 1030 // get depth estimator here 820 1031 TComPic* pRefPicBaseDepth = pcCU->getSlice()->getRefPicBaseDepth(); … … 833 1044 xPredInterLumaBlkFromDM ( pcBaseViewDepthPicYuv, pcBaseViewDepthPicYuv, pShiftLUT, iShiftPrec, &cMv, uiPartAddr, iBlkX, iBlkY, iWidth, iHeight, pcCU->getSlice()->getSPS()->isDepth(), vspIdx, rpcYuvPred ); 834 1045 xPredInterChromaBlkFromDM( pcBaseViewDepthPicYuv, pcBaseViewDepthPicYuv, pShiftLUT, iShiftPrec, &cMv, uiPartAddr, iBlkX>>1, iBlkY>>1, iWidth>>1, iHeight>>1, pcCU->getSlice()->getSPS()->isDepth(), vspIdx, rpcYuvPred ); 1046 #else 1047 #if MERL_Bi_VSP_D0166 1048 xPredInterVSPBlk(pcCU, uiPartAddr, uiAbsPartIdx, iWidth, iHeight, cMv, eRefPicList, rpcYuvPred, bi ); 1049 #else 1050 xPredInterVSPBlk(pcCU, uiPartAddr, uiAbsPartIdx, iWidth, iHeight, cMv, eRefPicList, rpcYuvPred, bi, vspIdx ); 1051 #endif 1052 #endif 835 1053 } 836 1054 else … … 855 1073 #endif// MERL_VSP_C0152 //else 856 1074 } 857 else 1075 else // texture 858 1076 { 859 1077 #endif 860 1078 #if MERL_VSP_C0152 861 1079 if ( vspIdx != 0 ) 862 { // texture, vsp 1080 { // texture, vsp compensation 1081 #if !MERL_General_Fix 863 1082 TComPic* pRefPicBaseTxt = pcCU->getSlice()->getRefPicBaseTxt(); 864 1083 TComPicYuv* pcBaseViewTxtPicYuv = pRefPicBaseTxt->getPicYuvRec(); … … 879 1098 xPredInterLumaBlkFromDM ( pcBaseViewTxtPicYuv, pcBaseViewDepthPicYuv, pShiftLUT, iShiftPrec, &cMv, uiPartAddr, iBlkX, iBlkY, iWidth, iHeight, pcCU->getSlice()->getSPS()->isDepth(), vspIdx, rpcYuvPred ); 880 1099 xPredInterChromaBlkFromDM( pcBaseViewTxtPicYuv, pcBaseViewDepthPicYuv, pShiftLUT, iShiftPrec, &cMv, uiPartAddr, iBlkX>>1, iBlkY>>1, iWidth>>1, iHeight>>1, pcCU->getSlice()->getSPS()->isDepth(), vspIdx, rpcYuvPred ); 1100 #else 1101 #if MERL_Bi_VSP_D0166 1102 xPredInterVSPBlk(pcCU, uiPartAddr, uiAbsPartIdx, iWidth, iHeight, cMv, eRefPicList, rpcYuvPred, bi ); 1103 #else 1104 xPredInterVSPBlk(pcCU, uiPartAddr, uiAbsPartIdx, iWidth, iHeight, cMv, eRefPicList, rpcYuvPred, bi, vspIdx ); 1105 #endif 1106 #endif 881 1107 } 882 1108 else//texture not VSP … … 911 1137 } 912 1138 #endif 913 } 914 1139 #if QC_ARP_D0177 1140 } 1141 #endif 1142 } 1143 1144 #if QC_ARP_D0177 1145 Void TComPrediction::xPredInterUniARP( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bi, TComMvField * pNewMvFiled ) 1146 { 1147 Int iRefIdx = pcCU->getCUMvField( eRefPicList )->getRefIdx( uiPartAddr ); 1148 TComMv cMv = pcCU->getCUMvField( eRefPicList )->getMv( uiPartAddr ); 1149 Bool bTobeScaled = false; 1150 UChar dW = pcCU->getARPW ( uiPartAddr ); 1151 TComPic* pcPicYuvBaseCol = NULL; 1152 TComPic* pcPicYuvBaseRef = NULL; 1153 DisInfo cDistparity; 1154 1155 if( pNewMvFiled ) 1156 { 1157 iRefIdx = pNewMvFiled->getRefIdx(); 1158 cMv = pNewMvFiled->getMv(); 1159 } 1160 1161 #if QC_CU_NBDV_D0181 1162 cDistparity.bDV = pcCU->getDvInfo(uiPartAddr).bDV; 1163 if( cDistparity.bDV ) 1164 { 1165 #if MERL_VSP_C0152 1166 cDistparity.m_acMvCand[0] = pcCU->getDvInfo(0).m_acMvCandNoRef[0]; 1167 #else 1168 cDistparity.m_acMvCand[0] = pcCU->getDvInfo(0).m_acMvCand[0]; 1169 #endif 1170 assert(pcCU->getDvInfo(uiPartAddr).bDV == pcCU->getDvInfo(0).bDV); 1171 cDistparity.m_aVIdxCan[0] = pcCU->getDvInfo(uiPartAddr).m_aVIdxCan[0]; 1172 cDistparity.iN = pcCU->getDvInfo(uiPartAddr).iN; 1173 } 1174 else 1175 cDistparity.iN = 0; 1176 #else 1177 pcCU->getDisMvpCandNBDV( iPartIdx, uiPartAddr, &cDistparity, false ); 1178 #endif 1179 1180 dW = !cDistparity.iN ? 0: dW; 1181 if( cDistparity.iN ) 1182 { 1183 if(dW > 0 && pcCU->getSlice()->getRefPic( eRefPicList, 0 )->getPOC()!= pcCU->getSlice()->getPOC()) 1184 bTobeScaled = true; 1185 pcPicYuvBaseCol = pcCU->getSlice()->getBaseViewRefPic( pcCU->getSlice()->getPOC(), cDistparity.m_aVIdxCan[0] ); 1186 pcPicYuvBaseRef = pcCU->getSlice()->getBaseViewRefPic( pcCU->getSlice()->getRefPic( eRefPicList, 0 )->getPOC(), cDistparity.m_aVIdxCan[0] ); 1187 if( (!pcPicYuvBaseCol || pcPicYuvBaseCol->getPOC() != pcCU->getSlice()->getPOC()) || (!pcPicYuvBaseRef || pcPicYuvBaseRef->getPOC() != pcCU->getSlice()->getRefPic( eRefPicList, 0 )->getPOC() )) 1188 { 1189 dW = 0; 1190 bTobeScaled = false; 1191 } 1192 else 1193 assert( pcPicYuvBaseCol->getPOC() == pcCU->getSlice()->getPOC() && pcPicYuvBaseRef->getPOC() == pcCU->getSlice()->getRefPic( eRefPicList, 0 )->getPOC() ); 1194 if(bTobeScaled) 1195 { 1196 Int iCurrPOC = pcCU->getSlice()->getPOC(); 1197 Int iColRefPOC = pcCU->getSlice()->getRefPOC( eRefPicList, iRefIdx ); 1198 Int iCurrRefPOC = pcCU->getSlice()->getRefPOC( eRefPicList, 0); 1199 Int iScale = pcCU-> xGetDistScaleFactor(iCurrPOC, iCurrRefPOC, iCurrPOC, iColRefPOC); 1200 if ( iScale != 4096 ) 1201 cMv = cMv.scaleMv( iScale ); 1202 iRefIdx = 0; 1203 } 1204 } 1205 pcCU->clipMv(cMv); 1206 TComPicYuv* pcPicYuvRef = pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(); 1207 xPredInterLumaBlk ( pcCU, pcPicYuvRef, uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi 1208 #if LGE_ILLUCOMP_B0045 1209 , false 1210 #endif 1211 , true 1212 ); 1213 xPredInterChromaBlk( pcCU, pcPicYuvRef, uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi 1214 #if LGE_ILLUCOMP_B0045 1215 , false 1216 #endif 1217 , true 1218 ); 1219 if( dW > 0 ) 1220 { 1221 TComYuv * pYuvmB0 = &m_acYuvPredBase[0]; 1222 TComYuv * pYuvB1 = &m_acYuvPredBase[1]; 1223 assert ( cDistparity.iN == 1 ); 1224 pcPicYuvRef = pcPicYuvBaseCol->getPicYuvRec(); 1225 xPredInterLumaBlk ( pcCU, pcPicYuvRef, uiPartAddr, &cDistparity.m_acMvCand[0], iWidth, iHeight, pYuvB1, bi 1226 #if LGE_ILLUCOMP_B0045 1227 , false 1228 #endif 1229 , true 1230 ); 1231 xPredInterChromaBlk( pcCU, pcPicYuvRef, uiPartAddr, &cDistparity.m_acMvCand[0], iWidth, iHeight, pYuvB1, bi 1232 #if LGE_ILLUCOMP_B0045 1233 , false 1234 #endif 1235 , true 1236 ); 1237 pcPicYuvRef = pcPicYuvBaseRef->getPicYuvRec(); 1238 TComMv cMVwithDisparity = cMv + cDistparity.m_acMvCand[0]; 1239 pcCU->clipMv(cMVwithDisparity); 1240 xPredInterLumaBlk ( pcCU, pcPicYuvRef, uiPartAddr, &cMVwithDisparity, iWidth, iHeight, pYuvmB0, bi 1241 #if LGE_ILLUCOMP_B0045 1242 , false 1243 #endif 1244 , true 1245 ); 1246 xPredInterChromaBlk( pcCU, pcPicYuvRef, uiPartAddr, &cMVwithDisparity, iWidth, iHeight, pYuvmB0, bi 1247 #if LGE_ILLUCOMP_B0045 1248 , false 1249 #endif 1250 , true 1251 ); 1252 pYuvB1->subtractARP( pYuvB1 , pYuvmB0 , uiPartAddr , iWidth , iHeight ); 1253 if(dW == 2) 1254 pYuvB1->multiplyARP( uiPartAddr , iWidth , iHeight , dW ); 1255 rpcYuvPred->addARP( rpcYuvPred , pYuvB1 , uiPartAddr , iWidth , iHeight , !bi ); 1256 } 1257 } 1258 #endif 915 1259 916 1260 #if MERL_VSP_C0152 … … 923 1267 Int iRefIdx[2] = {-1, -1}; 924 1268 1269 #if MERL_Bi_VSP_D0166 1270 Bool biDecision = 0; 1271 Int predDirVSP = 0; 1272 #if QC_BVSP_CleanUP_D0191 1273 RefPicList privateRefPicList = REF_PIC_LIST_0; 1274 #endif 1275 if (pcCU->getVSPIndex(uiPartAddr) != 0) // is VSP 1276 { 1277 Int biVSPAvail = 0; 1278 //test whether VSP is Bi or Uni 1279 //Step1. Get derived DV view id 1280 #if QC_BVSP_CleanUP_D0191 1281 RefPicList otherRefPicList = REF_PIC_LIST_1; 1282 Int refIdxList0 = pcCU->getCUMvField( REF_PIC_LIST_0 )->getRefIdx( uiPartAddr ); 1283 Int refIdxList1 = pcCU->getCUMvField( REF_PIC_LIST_1 )->getRefIdx( uiPartAddr ); 1284 privateRefPicList = refIdxList0 != NOT_VALID ? REF_PIC_LIST_0 : REF_PIC_LIST_1; 1285 if(privateRefPicList == REF_PIC_LIST_1 && refIdxList1==NOT_VALID ) 1286 { 1287 assert(0); 1288 } 1289 Int privateRefIdx = privateRefPicList == REF_PIC_LIST_0 ? refIdxList0 : refIdxList1; 1290 Int viewId = pcCU->getSlice()->getRefViewId(privateRefPicList, privateRefIdx); 1291 Int refPoc = pcCU->getSlice()->getRefPOC(privateRefPicList, privateRefIdx); 1292 #else 1293 Int refIdx = pcCU->getCUMvField( privateRefPicList )->getRefIdx( uiPartAddr ); 1294 RefPicList privateRefPicList = (RefPicList) pcCU->getVSPDir( uiPartAddr ); 1295 RefPicList otherRefPicList = privateRefPicList == REF_PIC_LIST_0 ? REF_PIC_LIST_1 : REF_PIC_LIST_0; 1296 assert(privateRefPicList == REF_PIC_LIST_0 || privateRefPicList == REF_PIC_LIST_1); 1297 Int refIdx = -1-pcCU->getCUMvField( privateRefPicList )->getRefIdx( uiPartAddr ); 1298 assert(refIdx >= 0); 1299 Int viewId = pcCU->getSlice()->getRefViewId(privateRefPicList, refIdx); 1300 Int refPoc = pcCU->getSlice()->getRefPOC(privateRefPicList, refIdx); 1301 #endif 1302 assert(refPoc == pcCU->getSlice()->getPOC()); 1303 // if(refPoc != pcCU->getSlice()->getPOC() ) 1304 // { 1305 // printf("refPOC= %d, and current POC=%d\n", refPoc, pcCU->getSlice()->getPOC() ); 1306 // } 1307 //Step 2. Get initial prediction direction value according to reference picture list availability 1308 Int iInterDir = ((pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_0) > 0 && pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_1) > 0) ? 3 : 1309 (pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_0) > 0 ? 1 : 2)); 1310 //Step 3. Check the availability of Bi VSP by checking the interview reference availability in the other reference list 1311 if(iInterDir == 3) 1312 { 1313 for (Int jRefIdx = 0; jRefIdx <pcCU->getSlice()->getNumRefIdx(otherRefPicList); jRefIdx++ ) 1314 { 1315 Int refViewIdx = pcCU->getSlice()->getRefViewId( otherRefPicList, jRefIdx); 1316 if ( (refViewIdx != pcCU->getSlice()->getViewId()) && (refViewIdx != viewId ) ) 1317 { 1318 biVSPAvail = 1; 1319 break; 1320 } 1321 } 1322 } 1323 //Step 4. Update the Bi VSP prediction direction 1324 if ( iInterDir == 3 && biVSPAvail == 1) 1325 { 1326 biDecision = 1; 1327 predDirVSP = 3; 1328 } 1329 else 1330 { 1331 biDecision = 0; 1332 if ( privateRefPicList == REF_PIC_LIST_0 ) 1333 predDirVSP = 1; 1334 else 1335 predDirVSP = 2; 1336 } 1337 } 1338 else 1339 {//not VSP 1340 if( ( pcCU->getCUMvField( REF_PIC_LIST_0 )->getRefIdx( uiPartAddr ) >= 0 && pcCU->getCUMvField( REF_PIC_LIST_1 )->getRefIdx( uiPartAddr ) >= 0 ) ) 1341 biDecision = 1; 1342 else 1343 biDecision = 0; 1344 } 1345 #endif 1346 925 1347 for ( Int iRefList = 0; iRefList < 2; iRefList++ ) 926 1348 { … … 938 1360 else 939 1361 { 940 if ( iRefList== REF_PIC_LIST_1 && iRefIdx[iRefList] < 0 ) // iRefIdx[iRefList] ==NOT_VALID 1362 1363 #if !MERL_Bi_VSP_D0166 //both lists should go 1364 if ( iRefList == REF_PIC_LIST_1 && iRefIdx[iRefList] < 0 ) // iRefIdx[iRefList] ==NOT_VALID 941 1365 { 942 1366 continue; 943 1367 } 1368 #else 1369 //Reference list loop termination 1370 #if QC_BVSP_CleanUP_D0191 1371 RefPicList privateVSPRefPicList = privateRefPicList; 1372 #else 1373 RefPicList privateVSPRefPicList = (RefPicList) pcCU->getVSPDir( uiPartAddr ); 1374 #endif 1375 if( (pcCU->getVSPIndex(uiPartAddr)!=0) && iRefList != privateVSPRefPicList && !biDecision ) 1376 {//when VSP mode, if it is uni prediction, the other reference list should skip 1377 continue; 1378 } 1379 #endif 1380 944 1381 } 945 1382 #else … … 953 1390 954 1391 pcMbYuv = &m_acYuvPred[iRefList]; 1392 1393 #if MERL_Bi_VSP_D0166 1394 if(biDecision == 1) 1395 #else 955 1396 if( pcCU->getCUMvField( REF_PIC_LIST_0 )->getRefIdx( uiPartAddr ) >= 0 && pcCU->getCUMvField( REF_PIC_LIST_1 )->getRefIdx( uiPartAddr ) >= 0 ) 1397 #endif 956 1398 { 957 1399 #if MERL_VSP_C0152 … … 993 1435 { 994 1436 #if MERL_VSP_C0152 1437 #if !MERL_Bi_VSP_D0166 995 1438 if(pcCU->getVSPIndex(uiPartAddr)) 996 1439 m_acYuvPred[0].copyPartToPartYuv( rpcYuvPred, uiPartAddr, iWidth, iHeight ); 997 1440 else 998 1441 #endif 1442 #endif 999 1443 xWeightedPredictionBi( pcCU, &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iWidth, iHeight, rpcYuvPred ); 1000 1444 } … … 1004 1448 { 1005 1449 #if MERL_VSP_C0152 1450 #if !MERL_Bi_VSP_D0166 1006 1451 if(pcCU->getVSPIndex(uiPartAddr)) 1007 1452 m_acYuvPred[0].copyPartToPartYuv( rpcYuvPred, uiPartAddr, iWidth, iHeight ); 1008 1453 else 1009 1454 #endif 1455 #endif 1010 1456 xWeightedPredictionUni( pcCU, &m_acYuvPred[0], uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, rpcYuvPred, iPartIdx ); 1011 1457 } … … 1020 1466 { 1021 1467 #if MERL_VSP_C0152 1468 #if !MERL_Bi_VSP_D0166 1022 1469 if(pcCU->getVSPIndex(uiPartAddr)) 1023 1470 m_acYuvPred[0].copyPartToPartYuv( rpcYuvPred, uiPartAddr, iWidth, iHeight ); 1024 1471 else 1025 #endif 1472 xWeightedAverage( pcCU, &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iWidth, iHeight, rpcYuvPred ); 1473 #else 1474 xWeightedAverage( pcCU, &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iWidth, iHeight, rpcYuvPred, predDirVSP ); 1475 #endif 1476 #else 1026 1477 xWeightedAverage( pcCU, &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iWidth, iHeight, rpcYuvPred ); 1478 #endif 1027 1479 } 1028 1480 } … … 1108 1560 */ 1109 1561 #if LGE_ILLUCOMP_B0045 1110 Void TComPrediction::xPredInterLumaBlk( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi, Bool bICFlag) 1111 #else 1112 Void TComPrediction::xPredInterLumaBlk( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi ) 1562 Void TComPrediction::xPredInterLumaBlk( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi, Bool bICFlag 1563 #if QC_ARP_D0177 1564 , 1565 Int filterType 1566 #endif 1567 ) 1568 #else 1569 Void TComPrediction::xPredInterLumaBlk( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi 1570 #if QC_ARP_D0177 1571 , 1572 Int filterType 1573 #endif 1574 ) 1113 1575 #endif 1114 1576 { … … 1129 1591 if ( yFrac == 0 ) 1130 1592 { 1131 m_if.filterHorLuma( ref, refStride, dst, dstStride, width, height, xFrac, !bi ); 1593 m_if.filterHorLuma( ref, refStride, dst, dstStride, width, height, xFrac, !bi 1594 #if QC_ARP_D0177 1595 , 1596 filterType 1597 #endif 1598 ); 1132 1599 } 1133 1600 else if ( xFrac == 0 ) 1134 1601 { 1135 m_if.filterVerLuma( ref, refStride, dst, dstStride, width, height, yFrac, true, !bi ); 1602 m_if.filterVerLuma( ref, refStride, dst, dstStride, width, height, yFrac, true, !bi 1603 #if QC_ARP_D0177 1604 , 1605 filterType 1606 #endif 1607 ); 1136 1608 } 1137 1609 else … … 1143 1615 Int halfFilterSize = ( filterSize >> 1 ); 1144 1616 1145 m_if.filterHorLuma(ref - (halfFilterSize-1)*refStride, refStride, tmp, tmpStride, width, height+filterSize-1, xFrac, false ); 1146 m_if.filterVerLuma(tmp + (halfFilterSize-1)*tmpStride, tmpStride, dst, dstStride, width, height, yFrac, false, !bi); 1617 m_if.filterHorLuma(ref - (halfFilterSize-1)*refStride, refStride, tmp, tmpStride, width, height+filterSize-1, xFrac, false 1618 #if QC_ARP_D0177 1619 , 1620 filterType 1621 #endif 1622 ); 1623 m_if.filterVerLuma(tmp + (halfFilterSize-1)*tmpStride, tmpStride, dst, dstStride, width, height, yFrac, false, !bi 1624 #if QC_ARP_D0177 1625 , 1626 filterType 1627 #endif 1628 ); 1147 1629 } 1148 1630 … … 1185 1667 */ 1186 1668 #if LGE_ILLUCOMP_B0045 1187 Void TComPrediction::xPredInterChromaBlk( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi, Bool bICFlag ) 1188 #else 1189 Void TComPrediction::xPredInterChromaBlk( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi ) 1669 Void TComPrediction::xPredInterChromaBlk( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi, Bool bICFlag 1670 #if QC_ARP_D0177 1671 , 1672 Int filterType 1673 #endif 1674 ) 1675 #else 1676 Void TComPrediction::xPredInterChromaBlk( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi 1677 #if QC_ARP_D0177 1678 , Int filterType 1679 #endif 1680 ) 1190 1681 #endif 1191 1682 { … … 1215 1706 if ( yFrac == 0 ) 1216 1707 { 1217 m_if.filterHorChroma(refCb, refStride, dstCb, dstStride, cxWidth, cxHeight, xFrac, !bi); 1218 m_if.filterHorChroma(refCr, refStride, dstCr, dstStride, cxWidth, cxHeight, xFrac, !bi); 1708 m_if.filterHorChroma(refCb, refStride, dstCb, dstStride, cxWidth, cxHeight, xFrac, !bi 1709 #if QC_ARP_D0177 1710 , 1711 filterType 1712 #endif 1713 ); 1714 m_if.filterHorChroma(refCr, refStride, dstCr, dstStride, cxWidth, cxHeight, xFrac, !bi 1715 #if QC_ARP_D0177 1716 , 1717 filterType 1718 #endif 1719 ); 1219 1720 } 1220 1721 else if ( xFrac == 0 ) 1221 1722 { 1222 m_if.filterVerChroma(refCb, refStride, dstCb, dstStride, cxWidth, cxHeight, yFrac, true, !bi); 1223 m_if.filterVerChroma(refCr, refStride, dstCr, dstStride, cxWidth, cxHeight, yFrac, true, !bi); 1723 m_if.filterVerChroma(refCb, refStride, dstCb, dstStride, cxWidth, cxHeight, yFrac, true, !bi 1724 #if QC_ARP_D0177 1725 , 1726 filterType 1727 #endif 1728 ); 1729 m_if.filterVerChroma(refCr, refStride, dstCr, dstStride, cxWidth, cxHeight, yFrac, true, !bi 1730 #if QC_ARP_D0177 1731 , 1732 filterType 1733 #endif 1734 ); 1224 1735 } 1225 1736 else 1226 1737 { 1227 m_if.filterHorChroma(refCb - (halfFilterSize-1)*refStride, refStride, extY, extStride, cxWidth, cxHeight+filterSize-1, xFrac, false); 1228 m_if.filterVerChroma(extY + (halfFilterSize-1)*extStride, extStride, dstCb, dstStride, cxWidth, cxHeight , yFrac, false, !bi); 1738 m_if.filterHorChroma(refCb - (halfFilterSize-1)*refStride, refStride, extY, extStride, cxWidth, cxHeight+filterSize-1, xFrac, false 1739 #if QC_ARP_D0177 1740 , 1741 filterType 1742 #endif 1743 ); 1744 m_if.filterVerChroma(extY + (halfFilterSize-1)*extStride, extStride, dstCb, dstStride, cxWidth, cxHeight , yFrac, false, !bi 1745 #if QC_ARP_D0177 1746 , 1747 filterType 1748 #endif 1749 ); 1229 1750 1230 m_if.filterHorChroma(refCr - (halfFilterSize-1)*refStride, refStride, extY, extStride, cxWidth, cxHeight+filterSize-1, xFrac, false); 1231 m_if.filterVerChroma(extY + (halfFilterSize-1)*extStride, extStride, dstCr, dstStride, cxWidth, cxHeight , yFrac, false, !bi); 1751 m_if.filterHorChroma(refCr - (halfFilterSize-1)*refStride, refStride, extY, extStride, cxWidth, cxHeight+filterSize-1, xFrac, false 1752 #if QC_ARP_D0177 1753 , 1754 filterType 1755 #endif 1756 ); 1757 m_if.filterVerChroma(extY + (halfFilterSize-1)*extStride, extStride, dstCr, dstStride, cxWidth, cxHeight , yFrac, false, !bi 1758 #if QC_ARP_D0177 1759 , 1760 filterType 1761 #endif 1762 ); 1232 1763 } 1233 1764 #if LGE_ILLUCOMP_B0045 … … 1274 1805 // refPic: Ref picture. Full picture, with padding 1275 1806 // posX, posY: PU position, texture 1276 // size _x, size_y: PU size1807 // sizeX, sizeY: PU size 1277 1808 // partAddr: z-order index 1278 1809 // mv: disparity vector. derived from neighboring blocks 1279 1810 // 1280 1811 // Output: dstPic, PU predictor 64x64 1281 Void TComPrediction::xPredInterLumaBlkFromDM( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, Int iShiftPrec, TComMv* mv, UInt partAddr,Int posX, Int posY, Int size_x, Int size_y, Bool isDepth, Int vspIdx 1282 , TComYuv *&dstPic ) 1812 Void TComPrediction::xPredInterLumaBlkFromDM( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, Int iShiftPrec, TComMv* mv, UInt partAddr,Int posX, Int posY, Int sizeX, Int sizeY, Bool isDepth 1813 #if !MERL_Bi_VSP_D0166 1814 , Int vspIdx 1815 #endif 1816 , TComYuv *&dstPic 1817 #if MERL_Bi_VSP_D0166 1818 , Bool bi 1819 #endif 1820 ) 1283 1821 { 1284 1822 Int widthLuma; … … 1301 1839 #endif 1302 1840 1841 #if MERL_CVSP_D0165 1842 Int widthDepth = pPicBaseDepth->getWidth(); 1843 Int heightDepth = pPicBaseDepth->getHeight(); 1844 #endif 1845 1303 1846 Int nTxtPerDepthX = widthLuma / ( pPicBaseDepth->getWidth() ); // texture pixel # per depth pixel 1304 1847 Int nTxtPerDepthY = heightLuma / ( pPicBaseDepth->getHeight() ); … … 1307 1850 Int dstStride = dstPic->getStride(); 1308 1851 Int depStride = pPicBaseDepth->getStride(); 1309 Int depthPosX = Clip3(0, widthLuma - size_x, (posX/nTxtPerDepthX) + (mv->getHor()>>2)); 1310 Int depthPosY = Clip3(0, heightLuma- size_y, (posY/nTxtPerDepthY) + (mv->getVer()>>2)); 1852 #if LGE_ROUND_OFFSET_D0135 1853 Int depthPosX = Clip3(0, widthLuma - sizeX, (posX/nTxtPerDepthX) + ((mv->getHor()+2)>>2)); 1854 Int depthPosY = Clip3(0, heightLuma- sizeY, (posY/nTxtPerDepthY) + ((mv->getVer()+2)>>2)); 1855 #else 1856 Int depthPosX = Clip3(0, widthLuma - sizeX, (posX/nTxtPerDepthX) + (mv->getHor()>>2)); 1857 Int depthPosY = Clip3(0, heightLuma- sizeY, (posY/nTxtPerDepthY) + (mv->getVer()>>2)); 1858 #endif 1311 1859 Pel *ref = refPic->getLumaAddr() + posX + posY * refStride; 1312 1860 Pel *dst = dstPic->getLumaAddr(partAddr); … … 1315 1863 #if MERL_VSP_BLOCKSIZE_C0152 != 1 1316 1864 #if MERL_VSP_BLOCKSIZE_C0152 == 2 1317 Int dW = size _x>>1;1318 Int dH = size _y>>1;1865 Int dW = sizeX>>1; 1866 Int dH = sizeY>>1; 1319 1867 #endif 1320 1868 #if MERL_VSP_BLOCKSIZE_C0152 == 4 1321 Int dW = size _x>>2;1322 Int dH = size _y>>2;1869 Int dW = sizeX>>2; 1870 Int dH = sizeY>>2; 1323 1871 #endif 1324 1872 { … … 1342 1890 #endif 1343 1891 Int maxV = 0; 1892 #if MTK_DEPTH_TO_DISP_D0138 1893 for (Int blockj = 0; blockj < MERL_VSP_BLOCKSIZE_C0152; blockj+=(MERL_VSP_BLOCKSIZE_C0152-1)) 1894 #else 1344 1895 for (Int blockj = 0; blockj < MERL_VSP_BLOCKSIZE_C0152; blockj++) 1896 #endif 1345 1897 { 1346 1898 Int iX = 0; 1899 #if MTK_DEPTH_TO_DISP_D0138 1900 for (Int blocki = 0; blocki < MERL_VSP_BLOCKSIZE_C0152; blocki+=(MERL_VSP_BLOCKSIZE_C0152-1)) 1901 #else 1347 1902 for (Int blocki = 0; blocki < MERL_VSP_BLOCKSIZE_C0152; blocki++) 1903 #endif 1348 1904 { 1349 1905 if (maxV < depthTmp[iX]) … … 1381 1937 #endif 1382 1938 1939 #if MERL_General_Fix 1940 #if MERL_VSP_BLOCKSIZE_C0152 == 1 1941 #if MERL_CVSP_D0165 1942 //get LUT based horizontal reference range 1943 Int range = 0; 1944 if( sizeX == 4 && sizeY == 8 ) 1945 range = m_iRangeLuma[0]; 1946 else if( sizeX == 8 && sizeY == 4 ) 1947 range = m_iRangeLuma[1]; 1948 else if( sizeX == 8 && sizeY == 8 ) 1949 range = m_iRangeLuma[2]; 1950 else if( sizeX == 8 && sizeY == 16 ) 1951 range = m_iRangeLuma[3]; 1952 else if( sizeX == 16 && sizeY == 8 ) 1953 range = m_iRangeLuma[4]; 1954 else if( sizeX == 16 && sizeY == 16 ) 1955 range = m_iRangeLuma[5]; 1956 else if( sizeX == 16 && sizeY == 32 ) 1957 range = m_iRangeLuma[6]; 1958 else if( sizeX == 32 && sizeY == 16 ) 1959 range = m_iRangeLuma[7]; 1960 else if( sizeX == 32 && sizeY == 32 ) 1961 range = m_iRangeLuma[8]; 1962 else if( sizeX == 32 && sizeY == 64 ) 1963 range = m_iRangeLuma[9]; 1964 else if( sizeX == 64 && sizeY == 32 ) 1965 range = m_iRangeLuma[10]; 1966 else if( sizeX == 64 && sizeY == 64 ) 1967 range = m_iRangeLuma[11]; 1968 else 1969 assert(0); 1970 1971 // The minimum depth value 1972 Int minRelativePos = 5000; 1973 Int maxRelativePos = -5000; 1974 1975 Pel* depthTemp, *depthInitial=depth; 1976 for (Int yTxt =0; yTxt<sizeY; yTxt++) 1977 { 1978 for (Int xTxt =0; xTxt<sizeX; xTxt++) 1979 { 1980 if (depthPosX+xTxt < widthDepth) 1981 depthTemp = depthInitial + xTxt; 1982 else 1983 depthTemp = depthInitial + (widthDepth - depthPosX - 1); 1984 1985 Int disparity = pShiftLUT[ *depthTemp ] << iShiftPrec; 1986 Int disparityInt = disparity >> 2; 1987 1988 if( disparity <= 0) 1989 { 1990 if (minRelativePos > disparityInt+xTxt) 1991 minRelativePos = disparityInt+xTxt; 1992 } 1993 else 1994 { 1995 if (maxRelativePos < disparityInt+xTxt) 1996 maxRelativePos = disparityInt+xTxt; 1997 } 1998 } 1999 if (depthPosY+yTxt < heightDepth) 2000 depthInitial = depthInitial + depStride; 2001 } 2002 2003 Int disparity_tmp = pShiftLUT[ *depth ] << iShiftPrec; 2004 if (disparity_tmp <= 0) 2005 maxRelativePos = minRelativePos + range -1 ; 2006 else 2007 minRelativePos = maxRelativePos - range +1 ; 2008 #endif 2009 #endif 2010 #endif 2011 1383 2012 #if MERL_VSP_BLOCKSIZE_C0152 != 1 1384 2013 Int yDepth = 0; 1385 2014 #endif 1386 for ( Int yTxt = 0; yTxt < size _y; yTxt += nTxtPerDepthY )1387 { 1388 for ( Int xTxt = 0, xDepth = 0; xTxt < size _x; xTxt += nTxtPerDepthX, xDepth++ )1389 { 1390 Pel rep _depth = 0; // to store the depth value used for warping2015 for ( Int yTxt = 0; yTxt < sizeY; yTxt += nTxtPerDepthY ) 2016 { 2017 for ( Int xTxt = 0, xDepth = 0; xTxt < sizeX; xTxt += nTxtPerDepthX, xDepth++ ) 2018 { 2019 Pel repDepth = 0; // to store the depth value used for warping 1391 2020 #if MERL_VSP_BLOCKSIZE_C0152 == 1 1392 rep _depth = depth[xDepth];2021 repDepth = depth[xDepth]; 1393 2022 #endif 1394 2023 #if MERL_VSP_BLOCKSIZE_C0152 == 2 1395 rep _depth = m_pDepth[(xTxt>>1) + (yTxt>>1)*dW];2024 repDepth = m_pDepth[(xTxt>>1) + (yTxt>>1)*dW]; 1396 2025 #endif 1397 2026 #if MERL_VSP_BLOCKSIZE_C0152 == 4 1398 rep _depth = m_pDepth[(xTxt>>2) + (yTxt>>2)*dW];1399 #endif 1400 1401 assert( rep _depth >= 0 && rep_depth <= 255 );1402 Int disparity = pShiftLUT[ rep _depth ] << iShiftPrec;2027 repDepth = m_pDepth[(xTxt>>2) + (yTxt>>2)*dW]; 2028 #endif 2029 2030 assert( repDepth >= 0 && repDepth <= 255 ); 2031 Int disparity = pShiftLUT[ repDepth ] << iShiftPrec; 1403 2032 Int refOffset = xTxt + (disparity >> 2); 1404 2033 Int xFrac = disparity & 0x3; 2034 #if MERL_CVSP_D0165 2035 if(refOffset<minRelativePos || refOffset>maxRelativePos) 2036 xFrac = 0; 2037 refOffset = Clip3(minRelativePos, maxRelativePos, refOffset); 2038 #endif 1405 2039 Int absX = posX + refOffset; 1406 2040 … … 1413 2047 1414 2048 assert( ref[refOffset] >= 0 && ref[refOffset]<= 255 ); 2049 #if MERL_Bi_VSP_D0166 2050 m_if.filterHorLuma( &ref[refOffset], refStride, &dst[xTxt], dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, !bi ); 2051 #else 1415 2052 m_if.filterHorLuma( &ref[refOffset], refStride, &dst[xTxt], dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, true ); 2053 #endif 2054 1416 2055 } 1417 2056 ref += refStride*nTxtPerDepthY; … … 1421 2060 yDepth++; 1422 2061 #endif 1423 } 1424 } 1425 1426 Void TComPrediction::xPredInterChromaBlkFromDM ( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, Int iShiftPrec, TComMv*mv, UInt partAddr, Int posX, Int posY, Int size_x, Int size_y, Bool isDepth, Int vspIdx 1427 , TComYuv *&dstPic ) 2062 2063 } 2064 } 2065 2066 Void TComPrediction::xPredInterChromaBlkFromDM ( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, Int iShiftPrec, TComMv*mv, UInt partAddr, Int posX, Int posY, Int sizeX, Int sizeY, Bool isDepth 2067 #if !MERL_Bi_VSP_D0166 2068 , Int vspIdx 2069 #endif 2070 , TComYuv *&dstPic 2071 #if MERL_Bi_VSP_D0166 2072 , Bool bi 2073 #endif 2074 ) 1428 2075 { 1429 2076 Int refStride = refPic->getCStride(); … … 1458 2105 nTxtPerDepthX = widthChroma / widthDepth; 1459 2106 nDepthPerTxtX = 1; 2107 #if LGE_ROUND_OFFSET_D0135 2108 depthPosX = posX / nTxtPerDepthX + ((mv->getHor()+2)>>2); //mv denotes the disparity for VSP 2109 #else 1460 2110 depthPosX = posX / nTxtPerDepthX + (mv->getHor()>>2); //mv denotes the disparity for VSP 2111 #endif 1461 2112 } 1462 2113 else … … 1464 2115 nTxtPerDepthX = 1; 1465 2116 nDepthPerTxtX = widthDepth / widthChroma; 2117 #if LGE_ROUND_OFFSET_D0135 2118 depthPosX = posX * nDepthPerTxtX + ((mv->getHor()+2)>>2); //mv denotes the disparity for VSP 2119 #else 1466 2120 depthPosX = posX * nDepthPerTxtX + (mv->getHor()>>2); //mv denotes the disparity for VSP 1467 } 1468 depthPosX = Clip3(0, widthDepth - (size_x<<1), depthPosX); 2121 #endif 2122 } 2123 depthPosX = Clip3(0, widthDepth - (sizeX<<1), depthPosX); 1469 2124 if ( heightChroma > heightDepth ) 1470 2125 { 1471 2126 nTxtPerDepthY = heightChroma / heightDepth; 1472 2127 nDepthPerTxtY = 1; 2128 #if LGE_ROUND_OFFSET_D0135 2129 depthPosY = posY / nTxtPerDepthY + ((mv->getVer()+2)>>2); //mv denotes the disparity for VSP 2130 #else 1473 2131 depthPosY = posY / nTxtPerDepthY + (mv->getVer()>>2); //mv denotes the disparity for VSP 2132 #endif 1474 2133 } 1475 2134 else … … 1477 2136 nTxtPerDepthY = 1; 1478 2137 nDepthPerTxtY = heightDepth / heightChroma; 2138 #if LGE_ROUND_OFFSET_D0135 2139 depthPosY = posY * nDepthPerTxtY + ((mv->getVer()+2)>>2); //mv denotes the disparity for VSP 2140 #else 1479 2141 depthPosY = posY * nDepthPerTxtY + (mv->getVer()>>2); //mv denotes the disparity for VSP 1480 } 1481 depthPosY = Clip3(0, heightDepth - (size_y<<1), depthPosY); 2142 #endif 2143 } 2144 depthPosY = Clip3(0, heightDepth - (sizeY<<1), depthPosY); 1482 2145 1483 2146 Pel *refCb = refPic->getCbAddr() + posX + posY * refStride; … … 1491 2154 Int depStrideBlock = depStride * nDepthPerTxtY; 1492 2155 2156 #if !MERL_Bi_VSP_D0166 1493 2157 if (isDepth) 1494 2158 { 1495 2159 // DT: Since the call for this function is redundant, .. 1496 for (Int y = 0; y < size _y; y++)2160 for (Int y = 0; y < sizeY; y++) 1497 2161 { 1498 for (Int x = 0; x < size _x; x++)2162 for (Int x = 0; x < sizeX; x++) 1499 2163 { 1500 2164 dstCb[x] = 128; … … 1506 2170 return; 1507 2171 } 1508 2172 #endif 2173 1509 2174 if ( widthChroma > widthDepth ) // We assume 1510 2175 { … … 1516 2181 { 1517 2182 #if MERL_VSP_BLOCKSIZE_C0152 == 1 1518 Int dW = size _x;1519 Int dH = size _y;2183 Int dW = sizeX; 2184 Int dH = sizeY; 1520 2185 Int sW = 2; // search window size 1521 2186 Int sH = 2; 1522 2187 #endif 1523 2188 #if MERL_VSP_BLOCKSIZE_C0152 == 2 1524 Int dW = size _x;1525 Int dH = size _y;2189 Int dW = sizeX; 2190 Int dH = sizeY; 1526 2191 Int sW = 2; // search window size 1527 2192 Int sH = 2; 1528 2193 #endif 1529 2194 #if MERL_VSP_BLOCKSIZE_C0152 == 4 1530 Int dW = size _x>>1;1531 Int dH = size _y>>1;2195 Int dW = sizeX>>1; 2196 Int dH = sizeY>>1; 1532 2197 Int sW = 4; // search window size 1533 2198 Int sH = 4; … … 1594 2259 1595 2260 1596 // (size_x, size_y) is Chroma block size 1597 for ( Int yTxt = 0, yDepth = 0; yTxt < size_y; yTxt += nTxtPerDepthY, yDepth += nDepthPerTxtY ) 1598 { 1599 for ( Int xTxt = 0, xDepth = 0; xTxt < size_x; xTxt += nTxtPerDepthX, xDepth += nDepthPerTxtX ) 1600 { 1601 Pel rep_depth = 0; // to store the depth value used for warping 2261 #if MERL_General_Fix 1602 2262 #if MERL_VSP_BLOCKSIZE_C0152 == 1 1603 rep_depth = m_pDepth[(xTxt) + (yTxt)*dW]; 2263 #if MERL_CVSP_D0165 2264 //get LUT based horizontal reference range 2265 Int range=0; 2266 if( sizeX == 2 && sizeY == 4 ) 2267 range = m_iRangeChroma[0]; 2268 else if( sizeX == 4 && sizeY == 2 ) 2269 range = m_iRangeChroma[1]; 2270 else if( sizeX == 4 && sizeY == 4 ) 2271 range = m_iRangeChroma[2]; 2272 else if( sizeX == 4 && sizeY == 8 ) 2273 range = m_iRangeChroma[3]; 2274 else if( sizeX == 8 && sizeY == 4 ) 2275 range = m_iRangeChroma[4]; 2276 else if( sizeX == 8 && sizeY == 8 ) 2277 range = m_iRangeChroma[5]; 2278 else if( sizeX == 8 && sizeY == 16 ) 2279 range = m_iRangeChroma[6]; 2280 else if( sizeX == 16 && sizeY == 8 ) 2281 range = m_iRangeChroma[7]; 2282 else if( sizeX == 16 && sizeY == 16 ) 2283 range = m_iRangeChroma[8]; 2284 else if( sizeX == 16 && sizeY == 32 ) 2285 range = m_iRangeChroma[9]; 2286 else if( sizeX == 32 && sizeY == 16 ) 2287 range = m_iRangeChroma[10]; 2288 else if( sizeX == 32 && sizeY == 32 ) 2289 range = m_iRangeChroma[11]; 2290 else 2291 assert(0); 2292 2293 // The minimum depth value 2294 Int minRelativePos = 5000; 2295 Int maxRelativePos = -5000; 2296 2297 Int depthTmp; 2298 for (Int yTxt=0; yTxt<sizeY; yTxt++) 2299 { 2300 for (Int xTxt=0; xTxt<sizeX; xTxt++) 2301 { 2302 depthTmp = m_pDepth[xTxt+yTxt*dW]; 2303 Int disparity = pShiftLUT[ depthTmp ] << iShiftPrec; 2304 Int disparityInt = disparity >> 3;//in chroma resolution 2305 2306 if (disparityInt < 0) 2307 { 2308 if (minRelativePos > disparityInt+xTxt) 2309 minRelativePos = disparityInt+xTxt; 2310 } 2311 else 2312 { 2313 if (maxRelativePos < disparityInt+xTxt) 2314 maxRelativePos = disparityInt+xTxt; 2315 } 2316 } 2317 } 2318 2319 depthTmp = m_pDepth[0]; 2320 Int disparity_tmp = pShiftLUT[ depthTmp ] << iShiftPrec; 2321 if ( disparity_tmp < 0 ) 2322 maxRelativePos = minRelativePos + range - 1; 2323 else 2324 minRelativePos = maxRelativePos - range + 1; 2325 2326 #endif 2327 #endif 2328 #endif 2329 2330 // (sizeX, sizeY) is Chroma block size 2331 for ( Int yTxt = 0, yDepth = 0; yTxt < sizeY; yTxt += nTxtPerDepthY, yDepth += nDepthPerTxtY ) 2332 { 2333 for ( Int xTxt = 0, xDepth = 0; xTxt < sizeX; xTxt += nTxtPerDepthX, xDepth += nDepthPerTxtX ) 2334 { 2335 Pel repDepth = 0; // to store the depth value used for warping 2336 #if MERL_VSP_BLOCKSIZE_C0152 == 1 2337 repDepth = m_pDepth[(xTxt) + (yTxt)*dW]; 1604 2338 #endif 1605 2339 #if MERL_VSP_BLOCKSIZE_C0152 == 2 1606 rep _depth = m_pDepth[(xTxt) + (yTxt)*dW];2340 repDepth = m_pDepth[(xTxt) + (yTxt)*dW]; 1607 2341 #endif 1608 2342 #if MERL_VSP_BLOCKSIZE_C0152 == 4 1609 rep _depth = m_pDepth[(xTxt>>1) + (yTxt>>1)*dW];2343 repDepth = m_pDepth[(xTxt>>1) + (yTxt>>1)*dW]; 1610 2344 #endif 1611 2345 1612 2346 // calculate the offset in the reference picture 1613 Int disparity = pShiftLUT[ rep _depth ] << iShiftPrec;2347 Int disparity = pShiftLUT[ repDepth ] << iShiftPrec; 1614 2348 Int refOffset = xTxt + (disparity >> 3); // in integer pixel in chroma image 1615 2349 Int xFrac = disparity & 0x7; 2350 #if MERL_CVSP_D0165 2351 if(refOffset < minRelativePos || refOffset > maxRelativePos) 2352 xFrac = 0; 2353 refOffset = Clip3(minRelativePos, maxRelativePos, refOffset); 2354 #endif 1616 2355 Int absX = posX + refOffset; 1617 2356 … … 1625 2364 assert( refCb[refOffset] >= 0 && refCb[refOffset]<= 255 ); 1626 2365 assert( refCr[refOffset] >= 0 && refCr[refOffset]<= 255 ); 2366 #if MERL_Bi_VSP_D0166 2367 m_if.filterHorChroma(&refCb[refOffset], refStride, &dstCb[xTxt], dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, !bi); 2368 m_if.filterHorChroma(&refCr[refOffset], refStride, &dstCr[xTxt], dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, !bi); 2369 #else 1627 2370 m_if.filterHorChroma(&refCb[refOffset], refStride, &dstCb[xTxt], dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, true); 1628 2371 m_if.filterHorChroma(&refCr[refOffset], refStride, &dstCr[xTxt], dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, true); 2372 #endif 2373 1629 2374 } 1630 2375 refCb += refStrideBlock; … … 1635 2380 } 1636 2381 } 2382 1637 2383 } 1638 2384 … … 1642 2388 Void TComPrediction::xWeightedAveragePdm( TComDataCU* pcCU, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartIdx, Int iWidth, Int iHeight, TComYuv*& rpcYuvDst, UInt uiSubSampExpX, UInt uiSubSampExpY ) 1643 2389 { 2390 1644 2391 if( iRefIdx0 >= 0 && iRefIdx1 >= 0 ) 1645 2392 { … … 1661 2408 #endif 1662 2409 1663 Void TComPrediction::xWeightedAverage( TComDataCU* pcCU, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartIdx, Int iWidth, Int iHeight, TComYuv*& rpcYuvDst ) 1664 { 2410 Void TComPrediction::xWeightedAverage( TComDataCU* pcCU, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartIdx, Int iWidth, Int iHeight, TComYuv*& rpcYuvDst 2411 #if MERL_Bi_VSP_D0166 2412 , Int predDirVSP 2413 #endif 2414 ) 2415 { 2416 #if MERL_Bi_VSP_D0166 2417 Bool isVSP = 0; 2418 if (pcCU->getVSPIndex(uiPartIdx)!=0)//is VSP 2419 { 2420 isVSP = 1; 2421 } 2422 2423 if(( !isVSP && iRefIdx0 >= 0 && iRefIdx1 >= 0 ) || ( isVSP && predDirVSP == 3 )) 2424 #else 1665 2425 if( iRefIdx0 >= 0 && iRefIdx1 >= 0 ) 2426 #endif 1666 2427 { 1667 2428 rpcYuvDst->addAvg( pcYuvSrc0, pcYuvSrc1, uiPartIdx, iWidth, iHeight ); 1668 2429 } 2430 #if MERL_Bi_VSP_D0166 2431 else if ( ( !isVSP && iRefIdx0 >= 0 && iRefIdx1 < 0 ) || ( isVSP && predDirVSP == 1)) 2432 #else 1669 2433 else if ( iRefIdx0 >= 0 && iRefIdx1 < 0 ) 2434 #endif 1670 2435 { 1671 2436 pcYuvSrc0->copyPartToPartYuv( rpcYuvDst, uiPartIdx, iWidth, iHeight ); 1672 2437 } 2438 #if MERL_Bi_VSP_D0166 2439 else if (( !isVSP && iRefIdx0 < 0 && iRefIdx1 >= 0 ) || ( isVSP && predDirVSP == 2)) 2440 #else 1673 2441 else if ( iRefIdx0 < 0 && iRefIdx1 >= 0 ) 2442 #endif 1674 2443 { 1675 2444 pcYuvSrc1->copyPartToPartYuv( rpcYuvDst, uiPartIdx, iWidth, iHeight ); 1676 2445 } 2446 #if MERL_Bi_VSP_D0166 2447 else 2448 {//for debug test only 2449 assert(0); 2450 } 2451 #endif 1677 2452 } 1678 2453 … … 2076 2851 iCUPelX = pcCU->getCUPelX() + g_auiRasterToPelX[g_auiZscanToRaster[pcCU->getZorderIdxInCU()]]; 2077 2852 iCUPelY = pcCU->getCUPelY() + g_auiRasterToPelY[g_auiZscanToRaster[pcCU->getZorderIdxInCU()]]; 2853 #if LGE_ROUND_OFFSET_D0135 2854 iRefX = iCUPelX + ((pMv->getHor()+2) >> 2); 2855 iRefY = iCUPelY + ((pMv->getVer()+2) >> 2); 2856 #else 2078 2857 iRefX = iCUPelX + (pMv->getHor() >> 2); 2079 2858 iRefY = iCUPelY + (pMv->getVer() >> 2); 2859 #endif 2080 2860 uiWidth = pcCU->getWidth(0); 2081 2861 uiHeight = pcCU->getHeight(0); … … 2089 2869 if(pcCU->getPUAbove(uiTmpPartIdx, pcCU->getZorderIdxInCU()) && iCUPelY > 0 && iRefY > 0) 2090 2870 { 2871 #if LGE_ROUND_OFFSET_D0135 2872 iRefOffset = ( (pMv->getHor()+2) >> 2 ) + ( (pMv->getVer()+2) >> 2 ) * iRefStride - iRefStride; 2873 #else 2091 2874 iRefOffset = ( pMv->getHor() >> 2 ) + ( pMv->getVer() >> 2 ) * iRefStride - iRefStride; 2875 #endif 2092 2876 pRef = pRefPic->getLumaAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) + iRefOffset; 2093 2877 pRec = pRecPic->getLumaAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) - iRecStride; … … 2106 2890 if(pcCU->getPULeft(uiTmpPartIdx, pcCU->getZorderIdxInCU()) && iCUPelX > 0 && iRefX > 0) 2107 2891 { 2892 #if LGE_ROUND_OFFSET_D0135 2893 iRefOffset = ( (pMv->getHor()+2) >> 2 ) + ( (pMv->getVer()+2) >> 2 ) * iRefStride - 1; 2894 #else 2108 2895 iRefOffset = ( pMv->getHor() >> 2 ) + ( pMv->getVer() >> 2 ) * iRefStride - 1; 2896 #endif 2109 2897 pRef = pRefPic->getLumaAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) + iRefOffset; 2110 2898 pRec = pRecPic->getLumaAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) - 1; … … 2224 3012 iCUPelX = pcCU->getCUPelX() + g_auiRasterToPelX[g_auiZscanToRaster[pcCU->getZorderIdxInCU()]]; 2225 3013 iCUPelY = pcCU->getCUPelY() + g_auiRasterToPelY[g_auiZscanToRaster[pcCU->getZorderIdxInCU()]]; 3014 #if LGE_ROUND_OFFSET_D0135 3015 iRefX = iCUPelX + ((pMv->getHor()+2) >> 2); 3016 iRefY = iCUPelY + ((pMv->getVer()+2) >> 2); 3017 #else 2226 3018 iRefX = iCUPelX + (pMv->getHor() >> 2); 2227 3019 iRefY = iCUPelY + (pMv->getVer() >> 2); 3020 #endif 2228 3021 uiWidth = pcCU->getWidth(0) >> 1; 2229 3022 uiHeight = pcCU->getHeight(0) >> 1; … … 2237 3030 if(pcCU->getPUAbove(uiTmpPartIdx, pcCU->getZorderIdxInCU()) && iCUPelY > 0 && iRefY > 0) 2238 3031 { 3032 #if LGE_ROUND_OFFSET_D0135 3033 iRefOffset = ( (pMv->getHor()+4) >> 3 ) + ( (pMv->getVer()+4) >> 3 ) * iRefStride - iRefStride; 3034 #else 2239 3035 iRefOffset = ( pMv->getHor() >> 3 ) + ( pMv->getVer() >> 3 ) * iRefStride - iRefStride; 3036 #endif 2240 3037 if (iChromaId == 0) // Cb 2241 3038 { … … 2262 3059 if(pcCU->getPULeft(uiTmpPartIdx, pcCU->getZorderIdxInCU()) && iCUPelX > 0 && iRefX > 0) 2263 3060 { 3061 #if LGE_ROUND_OFFSET_D0135 3062 iRefOffset = ( (pMv->getHor()+4) >> 3 ) + ( (pMv->getVer()+4) >> 3 ) * iRefStride - 1; 3063 #else 2264 3064 iRefOffset = ( pMv->getHor() >> 3 ) + ( pMv->getVer() >> 3 ) * iRefStride - 1; 3065 #endif 2265 3066 if (iChromaId == 0) // Cb 2266 3067 { … … 2426 3227 } 2427 3228 3229 #if QC_DC_PREDICTOR_D0183 3230 Void TComPrediction::getPredDCs( Bool* pbPattern, Int iStride, Int* piMask, Int iMaskStride, Int& riPredDC1, Int& riPredDC2 ) 3231 { 3232 Int iDC1, iDC2; 3233 const Int iTR = ( iStride - 1 ) - iMaskStride; 3234 const Int iTM = ( ( iStride - 1 ) >> 1 ) - iMaskStride; 3235 const Int iLB = ( iStride - 1 ) * iMaskStride - 1; 3236 const Int iLM = ( ( iStride - 1 ) >> 1 ) * iMaskStride - 1; 3237 const UInt uiBitDepth = g_uiBitDepth + g_uiBitIncrement; 3238 3239 Bool bL = ( pbPattern[0] != pbPattern[(iStride-1)*iStride] ); 3240 Bool bT = ( pbPattern[0] != pbPattern[(iStride-1)] ); 3241 3242 if( bL == bT ) 3243 { 3244 iDC1 = bL ? ( piMask[iTR] + piMask[iLB] )>>1 : 1<<( uiBitDepth - 1 ); 3245 iDC2 = ( piMask[ -1] + piMask[-iMaskStride] )>>1; 3246 } 3247 else 3248 { 3249 iDC1 = bL ? piMask[iLB] : piMask[iTR]; 3250 iDC2 = bL ? piMask[iTM] : piMask[iLM]; 3251 } 3252 3253 riPredDC1 = pbPattern[0] ? iDC1 : iDC2; 3254 riPredDC2 = pbPattern[0] ? iDC2 : iDC1; 3255 } 3256 #else 2428 3257 Void TComPrediction::getWedgePredDCs( TComWedgelet* pcWedgelet, Int* piMask, Int iMaskStride, Int& riPredDC1, Int& riPredDC2, Bool bAbove, Bool bLeft ) 2429 3258 { … … 2503 3332 } 2504 3333 } 3334 #endif 2505 3335 2506 3336 Void TComPrediction::calcWedgeDCs( TComWedgelet* pcWedgelet, Pel* piOrig, UInt uiStride, Int& riDC1, Int& riDC2 ) … … 2870 3700 Int iMaskStride = ( iWidth<<1 ) + 1; 2871 3701 piMask += iMaskStride+1; 3702 #if QC_DC_PREDICTOR_D0183 3703 getPredDCs( pcWedgelet->getPattern(), pcWedgelet->getStride(), piMask, iMaskStride, iPredDC1, iPredDC2 ); 3704 #else 2872 3705 getWedgePredDCs( pcWedgelet, piMask, iMaskStride, iPredDC1, iPredDC2, bAbove, bLeft ); 3706 #endif 2873 3707 2874 3708 // assign wedge pred DCs to prediction 2875 if( bDelta ) { assignWedgeDCs2Pred( pcWedgelet, piPred, uiStride, Clip ( iPredDC1+iDeltaDC1 ), Clip( iPredDC2+iDeltaDC2 ) ); } 2876 else { assignWedgeDCs2Pred( pcWedgelet, piPred, uiStride, iPredDC1, iPredDC2 ); } 3709 if( bDelta ) 3710 { 3711 #if HHI_DELTADC_DLT_D0035 3712 assignWedgeDCs2Pred( pcWedgelet, piPred, uiStride, GetIdx2DepthValue( GetDepthValue2Idx(iPredDC1) + iDeltaDC1 ), GetIdx2DepthValue( GetDepthValue2Idx(iPredDC2) + iDeltaDC2 ) ); 3713 #else 3714 assignWedgeDCs2Pred( pcWedgelet, piPred, uiStride, Clip( iPredDC1+iDeltaDC1 ), Clip( iPredDC2+iDeltaDC2 ) ); 3715 #endif 3716 } 3717 else 3718 { 3719 assignWedgeDCs2Pred( pcWedgelet, piPred, uiStride, iPredDC1, iPredDC2 ); 3720 } 2877 3721 } 2878 3722 … … 2889 3733 Int iMaskStride = ( iWidth<<1 ) + 1; 2890 3734 piMask += iMaskStride+1; 3735 #if QC_DC_PREDICTOR_D0183 3736 getPredDCs( pcContourWedge->getPattern(), pcContourWedge->getStride(), piMask, iMaskStride, iPredDC1, iPredDC2 ); 3737 #else 2891 3738 getWedgePredDCs( pcContourWedge, piMask, iMaskStride, iPredDC1, iPredDC2, bAbove, bLeft ); 3739 #endif 2892 3740 2893 3741 // assign wedge pred DCs to prediction 2894 if( bDelta ) { assignWedgeDCs2Pred( pcContourWedge, piPred, uiStride, Clip ( iPredDC1+iDeltaDC1 ), Clip( iPredDC2+iDeltaDC2 ) ); } 2895 else { assignWedgeDCs2Pred( pcContourWedge, piPred, uiStride, iPredDC1, iPredDC2 ); } 3742 if( bDelta ) 3743 { 3744 #if HHI_DELTADC_DLT_D0035 3745 assignWedgeDCs2Pred( pcContourWedge, piPred, uiStride, GetIdx2DepthValue( GetDepthValue2Idx(iPredDC1) + iDeltaDC1 ), GetIdx2DepthValue( GetDepthValue2Idx(iPredDC2) + iDeltaDC2 ) ); 3746 #else 3747 assignWedgeDCs2Pred( pcContourWedge, piPred, uiStride, Clip( iPredDC1+iDeltaDC1 ), Clip( iPredDC2+iDeltaDC2 ) ); 3748 #endif 3749 } 3750 else 3751 { 3752 assignWedgeDCs2Pred( pcContourWedge, piPred, uiStride, iPredDC1, iPredDC2 ); 3753 } 2896 3754 2897 3755 pcContourWedge->destroy(); … … 3064 3922 Int iMaskStride = ( iWidth<<1 ) + 1; 3065 3923 piMask += iMaskStride+1; 3924 #if QC_DC_PREDICTOR_D0183 3925 getPredDCs( pcWedgelet->getPattern(), pcWedgelet->getStride(), piMask, iMaskStride, iPredDC1, iPredDC2 ); 3926 #else 3066 3927 getWedgePredDCs( pcWedgelet, piMask, iMaskStride, iPredDC1, iPredDC2, bAbove, bLeft ); 3928 #endif 3067 3929 3068 3930 // assign wedge pred DCs to prediction 3069 if( bDelta ) { assignWedgeDCs2Pred( pcWedgelet, piPred, uiStride, Clip( iPredDC1+iDeltaDC1 ), Clip( iPredDC2+iDeltaDC2 ) ); } 3070 else { assignWedgeDCs2Pred( pcWedgelet, piPred, uiStride, iPredDC1, iPredDC2 ); } 3931 if( bDelta ) 3932 { 3933 #if HHI_DELTADC_DLT_D0035 3934 assignWedgeDCs2Pred( pcWedgelet, piPred, uiStride, GetIdx2DepthValue( GetDepthValue2Idx(iPredDC1) + iDeltaDC1 ), GetIdx2DepthValue( GetDepthValue2Idx(iPredDC2) + iDeltaDC2 ) ); 3935 #else 3936 assignWedgeDCs2Pred( pcWedgelet, piPred, uiStride, Clip( iPredDC1+iDeltaDC1 ), Clip( iPredDC2+iDeltaDC2 ) ); 3937 #endif 3938 } 3939 else 3940 { 3941 assignWedgeDCs2Pred( pcWedgelet, piPred, uiStride, iPredDC1, iPredDC2 ); 3942 } 3071 3943 } 3072 3944 … … 3099 3971 Int iMaskStride = ( iWidth<<1 ) + 1; 3100 3972 piMask += iMaskStride+1; 3973 #if QC_DC_PREDICTOR_D0183 3974 getPredDCs( pcWedgelet->getPattern(), pcWedgelet->getStride(), piMask, iMaskStride, iPredDC1, iPredDC2 ); 3975 #else 3101 3976 getWedgePredDCs( pcWedgelet, piMask, iMaskStride, iPredDC1, iPredDC2, bAbove, bLeft ); 3977 #endif 3102 3978 3103 3979 // assign wedge pred DCs to prediction 3104 if( bDelta ) { assignWedgeDCs2Pred( pcWedgelet, piPred, uiStride, Clip( iPredDC1+iDeltaDC1 ), Clip( iPredDC2+iDeltaDC2 ) ); } 3105 else { assignWedgeDCs2Pred( pcWedgelet, piPred, uiStride, iPredDC1, iPredDC2 ); } 3980 if( bDelta ) 3981 { 3982 #if HHI_DELTADC_DLT_D0035 3983 assignWedgeDCs2Pred( pcWedgelet, piPred, uiStride, GetIdx2DepthValue( GetDepthValue2Idx(iPredDC1) + iDeltaDC1 ), GetIdx2DepthValue( GetDepthValue2Idx(iPredDC2) + iDeltaDC2 ) ); 3984 #else 3985 assignWedgeDCs2Pred( pcWedgelet, piPred, uiStride, Clip( iPredDC1+iDeltaDC1 ), Clip( iPredDC2+iDeltaDC2 ) ); 3986 #endif 3987 } 3988 else 3989 { 3990 assignWedgeDCs2Pred( pcWedgelet, piPred, uiStride, iPredDC1, iPredDC2 ); 3991 } 3106 3992 } 3107 3993 -
trunk/source/Lib/TLibCommon/TComPrediction.h
r332 r443 69 69 TComYuv m_acYuvPred[2]; 70 70 TComYuv m_cYuvPredTemp; 71 #if QC_ARP_D0177 72 TComYuv m_acYuvPredBase[2]; 73 TComYuv m_acYuvDiff[2]; 74 #endif 71 75 TComYuv m_filteredBlock[4][4]; 72 76 TComYuv m_filteredBlockTmp[4]; … … 80 84 #if MERL_VSP_C0152 81 85 Int* m_pDepth; ///< Local variable, to store a depth block, just to prevent allocate memory every time 86 87 #if MERL_CVSP_D0165 88 static Int m_iRangeLuma[12]; 89 static Int m_iRangeChroma[12]; 90 #endif 82 91 #endif 83 92 … … 86 95 87 96 // motion compensation functions 97 #if QC_ARP_D0177 98 Void xPredInterUniARP ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bi=false, TComMvField * pNewMvFiled = NULL ); 99 #endif 88 100 #if MERL_VSP_C0152 89 101 Void xPredInterUni ( TComDataCU* pcCU, UInt uiPartAddr, UInt uiAbsPartIdx, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap, UInt uiSubSampExpX = 0, UInt uiSubSampExpY = 0, Bool bi=false ); … … 103 115 ); 104 116 117 #if !MERL_General_Fix 105 118 #if MERL_VSP_C0152 106 119 Void xPredInterUniBWVSP ( TComDataCU* pcCU, UInt uiPartAddr, UInt uiAbsPartIdx, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap, UInt uiSubSampExpX, UInt uiSubSampExpY, Bool bi=false ); 107 120 Void xPredInterBiBWVSP ( TComDataCU* pcCU, UInt uiPartAddr, UInt uiAbsPartIdx, Int iWidth, Int iHeight, UInt uiSubSampExpX, UInt uiSubSampExpY, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap ); 108 121 #endif 122 #endif 109 123 110 124 #if DEPTH_MAP_GENERATION … … 113 127 114 128 #if LGE_ILLUCOMP_B0045 115 Void xPredInterLumaBlk ( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi, Bool bICFlag = false ); 116 Void xPredInterChromaBlk( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi, Bool bICFlag = false ); 117 #else 118 Void xPredInterLumaBlk ( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi ); 119 Void xPredInterChromaBlk( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi ); 120 #endif 129 Void xPredInterLumaBlk ( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi, Bool bICFlag = false 130 #if QC_ARP_D0177 131 , 132 Int filterType = 0 133 #endif 134 ); 135 Void xPredInterChromaBlk( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi, Bool bICFlag = false 136 #if QC_ARP_D0177 137 , 138 Int filterType = 0 139 #endif 140 ); 141 #else 142 Void xPredInterLumaBlk ( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi 143 #if QC_ARP_D0177 144 , 145 Int filterType = 0 146 #endif 147 ); 148 Void xPredInterChromaBlk( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi 149 #if QC_ARP_D0177 150 , 151 Int filterType = 0 152 #endif 153 ); 154 #endif 155 156 #if MERL_Bi_VSP_D0166 157 Void xWeightedAverage ( TComDataCU* pcCU, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*& rpcYuvDst, Int predDir); 158 #else 121 159 Void xWeightedAverage ( TComDataCU* pcCU, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*& rpcYuvDst ); 122 123 #if MERL_VSP_C0152 124 Void xPredInterLumaBlkFromDM ( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, Int iShiftPrec, TComMv *mv, UInt partAddr,Int posX, Int posY, Int size_x, Int size_y, Bool isDepth, Int vspIdx 160 #endif 161 162 #if MERL_VSP_C0152 163 #if !MERL_Bi_VSP_D0166 164 Void xPredInterLumaBlkFromDM ( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, Int iShiftPrec, TComMv *mv, UInt partAddr,Int posX, Int posY, Int sizeX, Int sizeY, Bool isDepth, Int vspIdx 125 165 , TComYuv *&dstPic ); 126 Void xPredInterChromaBlkFromDM ( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, Int iShiftPrec, TComMv *mv, UInt partAddr,Int posX, Int posY, Int size _x, Int size_y, Bool isDepth, Int vspIdx166 Void xPredInterChromaBlkFromDM ( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, Int iShiftPrec, TComMv *mv, UInt partAddr,Int posX, Int posY, Int sizeX, Int sizeY, Bool isDepth, Int vspIdx 127 167 , TComYuv *&dstPic ); 128 #endif 168 #else 169 TComPic* xGetVspRefTxt(TComDataCU* pcCU, UInt uiPartAddr, RefPicList eRefPicList); 170 Void xPredInterLumaBlkFromDM ( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, Int iShiftPrec, TComMv *mv, UInt partAddr,Int posX, Int posY, Int sizeX, Int sizeY, Bool isDepth, 171 TComYuv *&dstPic, Bool bi); 172 Void xPredInterChromaBlkFromDM ( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, Int iShiftPrec, TComMv *mv, UInt partAddr,Int posX, Int posY, Int sizeX, Int sizeY, Bool isDepth, 173 TComYuv *&dstPic, Bool bi); 174 #endif 175 #endif 176 129 177 Void xGetLLSPrediction ( TComPattern* pcPattern, Int* pSrc0, Int iSrcStride, Pel* pDst0, Int iDstStride, UInt uiWidth, UInt uiHeight, UInt uiExt0 ); 130 178 #if LGE_ILLUCOMP_B0045 … … 134 182 Void xDCPredFiltering( Int* pSrc, Int iSrcStride, Pel*& rpDst, Int iDstStride, Int iWidth, Int iHeight ); 135 183 Bool xCheckIdenticalMotion ( TComDataCU* pcCU, UInt PartAddr); 184 185 #if MERL_General_Fix 186 #if MERL_VSP_C0152 187 Void xPredInterVSPBlk(TComDataCU* pcCU, UInt uiPartAddr, UInt uiAbsPartIdx, Int iWidth, Int iHeight, TComMv cMv, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi 188 #if !MERL_Bi_VSP_D0166 189 , Int vspIdx 190 #endif 191 ); 192 #endif 193 #endif 136 194 137 195 #if HHI_DMM_WEDGE_INTRA … … 169 227 #endif 170 228 171 #if H3D_IVRP 229 #if H3D_IVRP & !QC_ARP_D0177 172 230 Void residualPrediction (TComDataCU* pcCU, TComYuv* pcYuvPred, TComYuv* pcYuvResPred); 173 231 #endif … … 191 249 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 192 250 Void predIntraLumaDMM ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiMode, Pel* piPred, UInt uiStride, Int iWidth, Int iHeight, Bool bAbove, Bool bLeft, Bool bEncoder ); 193 251 #if QC_DC_PREDICTOR_D0183 252 Void getPredDCs ( Bool* pbPattern, Int iPatternStride, Int* piMask, Int iMaskStride, Int& riPredDC1, Int& riPredDC2 ); 253 #else 194 254 Void getWedgePredDCs ( TComWedgelet* pcWedgelet, Int* piMask, Int iMaskStride, Int& riPredDC1, Int& riPredDC2, Bool bAbove, Bool bLeft ); 255 #endif 195 256 Void calcWedgeDCs ( TComWedgelet* pcWedgelet, Pel* piOrig, UInt uiStride, Int& riDC1, Int& riDC2 ); 196 257 Void assignWedgeDCs2Pred ( TComWedgelet* pcWedgelet, Pel* piPred, UInt uiStride, Int iDC1, Int iDC2 ); -
trunk/source/Lib/TLibCommon/TComResidualGenerator.cpp
r332 r443 44 44 45 45 46 #if H3D_IVRP 46 #if H3D_IVRP & !QC_ARP_D0177 47 47 48 48 … … 225 225 } 226 226 } 227 227 #endif 228 229 #if !QC_ARP_D0177 228 230 #if H3D_NBDV 229 231 Bool … … 249 251 } 250 252 251 #if H3D_NBDV 253 #if H3D_NBDV 252 254 Bool 253 255 TComResidualGenerator::getResidualSamples( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, TComMv iDisp, Bool bRecon) … … 263 265 } 264 266 UInt uiXPosInRefView = uiXPos , uiYPosInRefView = uiYPos; 267 #if QC_ARP_D0177 268 if(pcPic->getSPS()->getMultiviewResPredMode()) 269 { 270 #endif 265 271 #if H3D_NBDV 266 272 xSetPredResidualBlock( pcPic, uiBaseViewId, uiXPos, uiYPos, uiBlkWidth, uiBlkHeight, pcYuv, iDisp, &uiXPosInRefView , &uiYPosInRefView , bRecon ); … … 269 275 #endif 270 276 return true; 277 #if QC_ARP_D0177 278 } 279 else 280 return true; 281 #endif 271 282 } 272 283 … … 345 356 UInt uiCUAddr = pcCU->getAddr(); 346 357 pcSubCU->copySubCU( pcCU, uiAbsPartIdx, uiDepth ); 347 358 #if QC_CU_NBDV_D0181 359 pcSubCU->copyDVInfoFrom( pcCU, uiAbsPartIdx); 360 #endif 348 361 //--- set residual --- 349 362 switch( pcSubCU->getPredictionMode( 0 ) ) -
trunk/source/Lib/TLibCommon/TComResidualGenerator.h
r332 r443 50 50 51 51 52 #if H3D_IVRP 52 #if H3D_IVRP & !QC_ARP_D0177 53 53 54 54 class TComResidualGenerator -
trunk/source/Lib/TLibCommon/TComSampleAdaptiveOffset.cpp
r296 r443 62 62 TComSampleAdaptiveOffset::TComSampleAdaptiveOffset() 63 63 { 64 #if !LGE_SAO_MIGRATION_D0091 64 65 m_pcPic = NULL; 66 #endif 65 67 m_iOffsetBo = NULL; 66 68 m_pClipTable = NULL; … … 71 73 m_iUpBufft = NULL; 72 74 ipSwap = NULL; 75 #if !LGE_SAO_MIGRATION_D0091 73 76 m_pcYuvTmp = NULL; 77 #endif 74 78 75 79 m_pTmpU1 = NULL; … … 85 89 } 86 90 91 #if !LGE_SAO_MIGRATION_D0091 87 92 const Int TComSampleAdaptiveOffset::m_aiNumPartsInRow[5] = 88 93 { … … 102 107 256 //level 4 103 108 }; 109 #endif 104 110 105 111 const Int TComSampleAdaptiveOffset::m_aiNumCulPartsLevel[5] = … … 124 130 0 125 131 }; 126 132 #if !LGE_SAO_MIGRATION_D0091 127 133 const UInt TComSampleAdaptiveOffset::m_iWeightSao[MAX_NUM_SAO_TYPE] = 128 134 { … … 146 152 6 147 153 }; 154 #endif 148 155 149 156 Int TComSampleAdaptiveOffset::m_iNumClass[MAX_NUM_SAO_TYPE] = … … 187 194 return idx; 188 195 } 196 #if !LGE_SAO_MIGRATION_D0091 189 197 /** convert quadtree Idx to Level, Row, and Col 190 198 * \param idx, *level, *row, *col … … 223 231 } 224 232 } 233 #endif 225 234 /** create SampleAdaptiveOffset memory. 226 235 * \param … … 317 326 } 318 327 319 328 #if LGE_SAO_MIGRATION_D0091 329 if (m_iUpBuff1) 330 { 331 m_iUpBuff1--; 332 delete [] m_iUpBuff1; m_iUpBuff1 = NULL; 333 } 334 if (m_iUpBuff2) 335 { 336 m_iUpBuff2--; 337 delete [] m_iUpBuff2; m_iUpBuff2 = NULL; 338 } 339 if (m_iUpBufft) 340 { 341 m_iUpBufft--; 342 delete [] m_iUpBufft; m_iUpBufft = NULL; 343 } 344 #else 320 345 m_iUpBuff1--; 321 346 m_iUpBuff2--; … … 334 359 delete [] m_iUpBufft; m_iUpBufft = NULL; 335 360 } 361 #endif 336 362 if (m_pTmpL1) 337 363 { … … 368 394 initSAOParam(pcSaoParam, 0, 0, 0, -1, 0, m_iNumCuInWidth-1, 0, m_iNumCuInHeight-1,1); 369 395 initSAOParam(pcSaoParam, 0, 0, 0, -1, 0, m_iNumCuInWidth-1, 0, m_iNumCuInHeight-1,2); 396 #if !LGE_SAO_MIGRATION_D0091 370 397 for(Int j=0;j<MAX_NUM_SAO_TYPE;j++) 371 398 { 372 399 pcSaoParam->iNumClass[j] = m_iNumClass[j]; 373 400 } 401 #endif 374 402 pcSaoParam->numCuInWidth = m_iNumCuInWidth; 375 403 pcSaoParam->numCuInHeight = m_iNumCuInHeight; … … 405 433 pSaoPart->iLength = 0; 406 434 435 #if LGE_SAO_MIGRATION_D0091 436 pSaoPart->subTypeIdx = 0; 437 #else 407 438 pSaoPart->bandPosition = 0; 439 #endif 408 440 409 441 for (j=0;j<MAX_NUM_SAO_OFFSETS;j++) … … 514 546 for(Int c=0; c<iNumComponet; c++) 515 547 { 548 #if LGE_SAO_MIGRATION_D0091 549 if (c<2) 550 { 516 551 pcSaoParam->bSaoFlag[c] = 0; 552 } 553 #else 554 pcSaoParam->bSaoFlag[c] = 0; 555 #endif 517 556 for(Int i=0; i< m_aiNumCulPartsLevel[m_uiMaxSplitLevel]; i++) 518 557 { … … 524 563 pcSaoParam->psSaoPart[c][i].iMinDist = MAX_INT; 525 564 pcSaoParam->psSaoPart[c][i].iMinRate = MAX_INT; 565 #if LGE_SAO_MIGRATION_D0091 566 pcSaoParam->psSaoPart[c][i].subTypeIdx = 0; 567 #else 526 568 pcSaoParam->psSaoPart[c][i].bandPosition = 0; 569 #endif 527 570 for (Int j=0;j<MAX_NUM_SAO_OFFSETS;j++) 528 571 { … … 557 600 m_pcPic = pcPic; 558 601 m_uiNumSlicesInPic = numSlicesInPic; 602 #if LGE_SAO_MIGRATION_D0091 603 m_iSGDepth = 0; 604 #else 559 605 m_iSGDepth = pcPic->getSliceGranularityForNDBFilter(); 606 #endif 560 607 m_bUseNIF = ( pcPic->getIndependentSliceBoundaryForNDBFilter() || pcPic->getIndependentTileBoundaryForNDBFilter() ); 561 608 if(m_bUseNIF) … … 958 1005 uiEdgeType = iSignDown + m_iUpBuff1[x] + 2; 959 1006 m_iUpBuff1[x]= -iSignDown; 960 961 1007 pRec[x] = m_pClipTable[pRec[x] + m_iOffsetEo[uiEdgeType]]; 962 1008 } … … 1065 1111 Void TComSampleAdaptiveOffset::SAOProcess(TComPic* pcPic, SAOParam* pcSaoParam) 1066 1112 { 1113 #if LGE_SAO_MIGRATION_D0091 1114 if (pcSaoParam->bSaoFlag[0] || pcSaoParam->bSaoFlag[1]) 1115 #else 1067 1116 if (pcSaoParam->bSaoFlag[0]) 1117 #endif 1068 1118 { 1069 1119 #if FULL_NBIT … … 1077 1127 m_pcPic->getPicYuvRec()->copyToPic(m_pcYuvTmp); 1078 1128 } 1079 1129 #if LGE_SAO_MIGRATION_D0091 1130 if (m_saoLcuBasedOptimization) 1131 #else 1080 1132 if (m_saoInterleavingFlag) 1133 #endif 1081 1134 { 1082 1135 pcSaoParam->oneUnitFlag[0] = 0; … … 1085 1138 } 1086 1139 Int iY = 0; 1140 #if LGE_SAO_MIGRATION_D0091 1141 if (pcSaoParam->bSaoFlag[0]) 1142 { 1143 processSaoUnitAll( pcSaoParam->saoLcuParam[iY], pcSaoParam->oneUnitFlag[iY], iY); 1144 } 1145 if(pcSaoParam->bSaoFlag[1]) 1146 { 1147 processSaoUnitAll( pcSaoParam->saoLcuParam[1], pcSaoParam->oneUnitFlag[1], 1);//Cb 1148 processSaoUnitAll( pcSaoParam->saoLcuParam[2], pcSaoParam->oneUnitFlag[2], 2);//Cr 1149 } 1150 #else 1087 1151 processSaoUnitAll( pcSaoParam->saoLcuParam[iY], pcSaoParam->oneUnitFlag[iY], iY); 1088 1152 … … 1097 1161 processSaoUnitAll( pcSaoParam->saoLcuParam[iCr], pcSaoParam->oneUnitFlag[iCr], iCr); 1098 1162 } 1099 1100 1163 #endif 1101 1164 m_pcPic = NULL; 1102 1165 } … … 1154 1217 Int typeIdx; 1155 1218 1219 #if LGE_SAO_MIGRATION_D0091 1220 Int offset[LUMA_GROUP_NUM+1]; 1221 #else 1156 1222 static Int offset[LUMA_GROUP_NUM+1]; 1223 #endif 1157 1224 Int idxX; 1158 1225 Int idxY; … … 1164 1231 Int isChroma = (yCbCr == 0) ? 0:1; 1165 1232 Bool mergeLeftFlag; 1166 1167 1233 #if LGE_SAO_MIGRATION_D0091 1234 offset[0] = 0; 1235 #endif 1168 1236 for (idxY = 0; idxY< frameHeightInCU; idxY++) 1169 1237 { … … 1201 1269 { 1202 1270 addr = idxY * frameWidthInCU + idxX; 1203 1204 1271 if (oneUnitFlag) 1205 1272 { … … 1225 1292 for (i=0; i<saoLcuParam[addr].length; i++) 1226 1293 { 1294 #if LGE_SAO_MIGRATION_D0091 1295 offset[ (saoLcuParam[addr].subTypeIdx +i)%SAO_MAX_BO_CLASSES +1] = saoLcuParam[addr].offset[i] << m_uiSaoBitIncrease; 1296 #else 1227 1297 offset[ (saoLcuParam[addr].bandPosition +i)%SAO_MAX_BO_CLASSES +1] = saoLcuParam[addr].offset[i] << m_uiSaoBitIncrease; 1298 #endif 1228 1299 } 1229 1300 … … 1304 1375 saoLcuParam[i].offset[j] = 0; 1305 1376 } 1377 #if LGE_SAO_MIGRATION_D0091 1378 saoLcuParam[i].subTypeIdx = 0; 1379 #else 1306 1380 saoLcuParam[i].bandPosition = 0; 1381 #endif 1307 1382 } 1308 1383 } … … 1353 1428 saoLcuParam[addr].partIdxTmp = (Int)partIdx; 1354 1429 saoLcuParam[addr].typeIdx = saoQTPart[partIdx].iBestType; 1430 #if LGE_SAO_MIGRATION_D0091 1431 saoLcuParam[addr].subTypeIdx = saoQTPart[partIdx].subTypeIdx; 1432 #else 1355 1433 saoLcuParam[addr].bandPosition = saoQTPart[partIdx].bandPosition; 1434 #endif 1356 1435 if (saoLcuParam[addr].typeIdx!=-1) 1357 1436 { … … 1365 1444 { 1366 1445 saoLcuParam[addr].length = 0; 1446 #if LGE_SAO_MIGRATION_D0091 1447 saoLcuParam[addr].subTypeIdx = saoQTPart[partIdx].subTypeIdx; 1448 #else 1367 1449 saoLcuParam[addr].bandPosition = saoQTPart[partIdx].bandPosition; 1450 #endif 1368 1451 for (j=0;j<MAX_NUM_SAO_OFFSETS;j++) 1369 1452 { … … 1375 1458 } 1376 1459 1377 1378 1460 #if LGE_SAO_MIGRATION_D0091 1461 Void TComSampleAdaptiveOffset::resetSaoUnit(SaoLcuParam* saoUnit) 1462 { 1463 saoUnit->partIdx = 0; 1464 saoUnit->partIdxTmp = 0; 1465 saoUnit->mergeLeftFlag = 0; 1466 saoUnit->mergeUpFlag = 0; 1467 saoUnit->typeIdx = -1; 1468 saoUnit->length = 0; 1469 saoUnit->subTypeIdx = 0; 1470 1471 for (Int i=0;i<4;i++) 1472 { 1473 saoUnit->offset[i] = 0; 1474 } 1475 } 1476 1477 Void TComSampleAdaptiveOffset::copySaoUnit(SaoLcuParam* saoUnitDst, SaoLcuParam* saoUnitSrc ) 1478 { 1479 saoUnitDst->mergeLeftFlag = saoUnitSrc->mergeLeftFlag; 1480 saoUnitDst->mergeUpFlag = saoUnitSrc->mergeUpFlag; 1481 saoUnitDst->typeIdx = saoUnitSrc->typeIdx; 1482 saoUnitDst->length = saoUnitSrc->length; 1483 1484 saoUnitDst->subTypeIdx = saoUnitSrc->subTypeIdx; 1485 for (Int i=0;i<4;i++) 1486 { 1487 saoUnitDst->offset[i] = saoUnitSrc->offset[i]; 1488 } 1489 } 1490 1491 /** PCM LF disable process. 1492 * \param pcPic picture (TComPic) pointer 1493 * \returns Void 1494 * 1495 * \note Replace filtered sample values of PCM mode blocks with the transmitted and reconstructed ones. 1496 */ 1497 Void TComSampleAdaptiveOffset::PCMLFDisableProcess (TComPic* pcPic) 1498 { 1499 xPCMRestoration(pcPic); 1500 } 1501 1502 /** Picture-level PCM restoration. 1503 * \param pcPic picture (TComPic) pointer 1504 * \returns Void 1505 */ 1506 Void TComSampleAdaptiveOffset::xPCMRestoration(TComPic* pcPic) 1507 { 1508 Bool bPCMFilter = (pcPic->getSlice(0)->getSPS()->getUsePCM() && pcPic->getSlice(0)->getSPS()->getPCMFilterDisableFlag())? true : false; 1509 #if LOSSLESS_CODING 1510 if(bPCMFilter || pcPic->getSlice(0)->getSPS()->getUseLossless()) 1511 #else 1512 if(bPCMFilter) 1513 #endif 1514 { 1515 for( UInt uiCUAddr = 0; uiCUAddr < pcPic->getNumCUsInFrame() ; uiCUAddr++ ) 1516 { 1517 TComDataCU* pcCU = pcPic->getCU(uiCUAddr); 1518 xPCMCURestoration(pcCU, 0, 0); 1519 } 1520 } 1521 } 1522 1523 /** PCM CU restoration. 1524 * \param pcCU pointer to current CU 1525 * \param uiAbsPartIdx part index 1526 * \param uiDepth CU depth 1527 * \returns Void 1528 */ 1529 Void TComSampleAdaptiveOffset::xPCMCURestoration ( TComDataCU* pcCU, UInt uiAbsZorderIdx, UInt uiDepth ) 1530 { 1531 TComPic* pcPic = pcCU->getPic(); 1532 UInt uiCurNumParts = pcPic->getNumPartInCU() >> (uiDepth<<1); 1533 UInt uiQNumParts = uiCurNumParts>>2; 1534 1535 // go to sub-CU 1536 if( pcCU->getDepth(uiAbsZorderIdx) > uiDepth ) 1537 { 1538 for ( UInt uiPartIdx = 0; uiPartIdx < 4; uiPartIdx++, uiAbsZorderIdx+=uiQNumParts ) 1539 { 1540 UInt uiLPelX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsZorderIdx] ]; 1541 UInt uiTPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsZorderIdx] ]; 1542 if( ( uiLPelX < pcCU->getSlice()->getSPS()->getPicWidthInLumaSamples() ) && ( uiTPelY < pcCU->getSlice()->getSPS()->getPicHeightInLumaSamples() ) ) 1543 xPCMCURestoration( pcCU, uiAbsZorderIdx, uiDepth+1 ); 1544 } 1545 return; 1546 } 1547 1548 // restore PCM samples 1549 if ((pcCU->getIPCMFlag(uiAbsZorderIdx)&& pcPic->getSlice(0)->getSPS()->getPCMFilterDisableFlag()) || pcCU->isLosslessCoded( uiAbsZorderIdx)) 1550 { 1551 xPCMSampleRestoration (pcCU, uiAbsZorderIdx, uiDepth, TEXT_LUMA ); 1552 xPCMSampleRestoration (pcCU, uiAbsZorderIdx, uiDepth, TEXT_CHROMA_U); 1553 xPCMSampleRestoration (pcCU, uiAbsZorderIdx, uiDepth, TEXT_CHROMA_V); 1554 } 1555 } 1556 1557 /** PCM sample restoration. 1558 * \param pcCU pointer to current CU 1559 * \param uiAbsPartIdx part index 1560 * \param uiDepth CU depth 1561 * \param ttText texture component type 1562 * \returns Void 1563 */ 1564 Void TComSampleAdaptiveOffset::xPCMSampleRestoration (TComDataCU* pcCU, UInt uiAbsZorderIdx, UInt uiDepth, TextType ttText) 1565 { 1566 TComPicYuv* pcPicYuvRec = pcCU->getPic()->getPicYuvRec(); 1567 Pel* piSrc; 1568 Pel* piPcm; 1569 UInt uiStride; 1570 UInt uiWidth; 1571 UInt uiHeight; 1572 UInt uiPcmLeftShiftBit; 1573 UInt uiX, uiY; 1574 UInt uiMinCoeffSize = pcCU->getPic()->getMinCUWidth()*pcCU->getPic()->getMinCUHeight(); 1575 UInt uiLumaOffset = uiMinCoeffSize*uiAbsZorderIdx; 1576 UInt uiChromaOffset = uiLumaOffset>>2; 1577 1578 if( ttText == TEXT_LUMA ) 1579 { 1580 piSrc = pcPicYuvRec->getLumaAddr( pcCU->getAddr(), uiAbsZorderIdx); 1581 piPcm = pcCU->getPCMSampleY() + uiLumaOffset; 1582 uiStride = pcPicYuvRec->getStride(); 1583 uiWidth = (g_uiMaxCUWidth >> uiDepth); 1584 uiHeight = (g_uiMaxCUHeight >> uiDepth); 1585 if ( pcCU->isLosslessCoded(uiAbsZorderIdx) ) 1586 { 1587 uiPcmLeftShiftBit = 0; 1588 } 1589 else 1590 { 1591 uiPcmLeftShiftBit = g_uiBitDepth + g_uiBitIncrement - pcCU->getSlice()->getSPS()->getPCMBitDepthLuma(); 1592 } 1593 } 1594 else 1595 { 1596 if( ttText == TEXT_CHROMA_U ) 1597 { 1598 piSrc = pcPicYuvRec->getCbAddr( pcCU->getAddr(), uiAbsZorderIdx ); 1599 piPcm = pcCU->getPCMSampleCb() + uiChromaOffset; 1600 } 1601 else 1602 { 1603 piSrc = pcPicYuvRec->getCrAddr( pcCU->getAddr(), uiAbsZorderIdx ); 1604 piPcm = pcCU->getPCMSampleCr() + uiChromaOffset; 1605 } 1606 1607 uiStride = pcPicYuvRec->getCStride(); 1608 uiWidth = ((g_uiMaxCUWidth >> uiDepth)/2); 1609 uiHeight = ((g_uiMaxCUWidth >> uiDepth)/2); 1610 if ( pcCU->isLosslessCoded(uiAbsZorderIdx) ) 1611 { 1612 uiPcmLeftShiftBit = 0; 1613 } 1614 else 1615 { 1616 uiPcmLeftShiftBit = g_uiBitDepth + g_uiBitIncrement - pcCU->getSlice()->getSPS()->getPCMBitDepthChroma(); 1617 } 1618 } 1619 1620 for( uiY = 0; uiY < uiHeight; uiY++ ) 1621 { 1622 for( uiX = 0; uiX < uiWidth; uiX++ ) 1623 { 1624 piSrc[uiX] = (piPcm[uiX] << uiPcmLeftShiftBit); 1625 } 1626 piPcm += uiWidth; 1627 piSrc += uiStride; 1628 } 1629 } 1630 #endif 1379 1631 //! \} -
trunk/source/Lib/TLibCommon/TComSampleAdaptiveOffset.h
r296 r443 65 65 66 66 static UInt m_uiMaxDepth; 67 #if !LGE_SAO_MIGRATION_D0091 67 68 static const Int m_aiNumPartsInRow[5]; 68 69 static const Int m_aiNumPartsLevel[5]; 70 #endif 69 71 static const Int m_aiNumCulPartsLevel[5]; 70 72 static const UInt m_auiEoTable[9]; 73 #if !LGE_SAO_MIGRATION_D0091 71 74 static const UInt m_auiEoTable2D[9]; 72 75 static const UInt m_iWeightSao[MAX_NUM_SAO_TYPE]; 76 #endif 73 77 Int *m_iOffsetBo; 74 78 Int m_iOffsetEo[LUMA_GROUP_NUM]; … … 107 111 Int* m_iLcuPartIdx; 108 112 Int m_maxNumOffsetsPerPic; 113 #if LGE_SAO_MIGRATION_D0091 114 Bool m_saoLcuBoundary; 115 Bool m_saoLcuBasedOptimization; 116 117 Void xPCMRestoration (TComPic* pcPic); 118 Void xPCMCURestoration (TComDataCU* pcCU, UInt uiAbsZorderIdx, UInt uiDepth); 119 Void xPCMSampleRestoration (TComDataCU* pcCU, UInt uiAbsZorderIdx, UInt uiDepth, TextType ttText); 120 #else 109 121 Bool m_saoInterleavingFlag; 122 #endif 110 123 public: 111 124 TComSampleAdaptiveOffset (); … … 116 129 117 130 Int convertLevelRowCol2Idx(int level, int row, int col); 131 #if !LGE_SAO_MIGRATION_D0091 118 132 void convertIdx2LevelRowCol(int idx, int *level, int *row, int *col); 133 #endif 119 134 120 135 Void initSAOParam (SAOParam *pcSaoParam, Int iPartLevel, Int iPartRow, Int iPartCol, Int iParentPartIdx, Int StartCUX, Int EndCUX, Int StartCUY, Int EndCUY, Int iYCbCr); 121 136 Void allocSaoParam (SAOParam* pcSaoParam); 122 137 Void resetSAOParam (SAOParam *pcSaoParam); 138 #if LGE_SAO_MIGRATION_D0091 139 static Void freeSaoParam (SAOParam *pcSaoParam); 140 #else 123 141 Void freeSaoParam (SAOParam *pcSaoParam); 142 #endif 143 124 144 125 145 Void SAOProcess(TComPic* pcPic, SAOParam* pcSaoParam); 126 146 Void processSaoCu(Int iAddr, Int iSaoType, Int iYCbCr); 147 #if !LGE_SAO_MIGRATION_D0091 127 148 Void processSaoOnePart(SAOQTPart *psQTPart, UInt uiPartIdx, Int iYCbCr); 128 149 Void processSaoQuadTree(SAOQTPart *psQTPart, UInt uiPartIdx, Int iYCbCr); 150 #endif 129 151 Pel* getPicYuvAddr(TComPicYuv* pcPicYuv, Int iYCbCr,Int iAddr = 0); 130 152 … … 138 160 Void convertOnePart2SaoUnit(SAOParam *saoParam, UInt partIdx, Int yCbCr); 139 161 Void processSaoUnitAll(SaoLcuParam* saoLcuParam, Bool oneUnitFlag, Int yCbCr); 162 #if LGE_SAO_MIGRATION_D0091 163 Void setSaoLcuBoundary (Bool bVal) {m_saoLcuBoundary = bVal;} 164 Bool getSaoLcuBoundary () {return m_saoLcuBoundary;} 165 Void setSaoLcuBasedOptimization (Bool bVal) {m_saoLcuBasedOptimization = bVal;} 166 Bool getSaoLcuBasedOptimization () {return m_saoLcuBasedOptimization;} 167 Void resetSaoUnit(SaoLcuParam* saoUnit); 168 Void copySaoUnit(SaoLcuParam* saoUnitDst, SaoLcuParam* saoUnitSrc ); 169 Void PCMLFDisableProcess ( TComPic* pcPic); ///< interface function for ALF process 170 #else 140 171 Void setSaoInterleavingFlag (Bool bVal) {m_saoInterleavingFlag = bVal;} 141 172 Bool getSaoInterleavingFlag () {return m_saoInterleavingFlag;} 173 #endif 142 174 }; 143 175 -
trunk/source/Lib/TLibCommon/TComSlice.cpp
r332 r443 113 113 #if LGE_ILLUCOMP_B0045 114 114 , m_bApplyIC ( false ) 115 #if SHARP_ILLUCOMP_PARSE_D0060 116 , m_icSkipParseFlag ( false ) 117 #endif 115 118 #endif 116 119 #if INTER_VIEW_VECTOR_SCALING_C0115 … … 119 122 #endif 120 123 { 124 #if MERL_VSP_NBDV_RefVId_Fix_D0166 125 for(Int iNumCount = 0; iNumCount < MAX_VIEW_NUM; iNumCount++) 126 m_pcListDepthPic[iNumCount] =NULL; 127 #endif 121 128 m_aiNumRefIdx[0] = m_aiNumRefIdx[1] = m_aiNumRefIdx[2] = 0; 122 129 … … 818 825 819 826 m_saoEnabledFlag = pSrc->m_saoEnabledFlag; 827 #if LGE_SAO_MIGRATION_D0091 828 m_saoEnabledFlagChroma = pSrc->m_saoEnabledFlagChroma; 829 #else 820 830 m_saoInterleavingFlag = pSrc->m_saoInterleavingFlag; 821 831 m_saoEnabledFlagCb = pSrc->m_saoEnabledFlagCb; 822 832 m_saoEnabledFlagCr = pSrc->m_saoEnabledFlagCr; 833 #endif 823 834 #if CABAC_INIT_FLAG 824 835 m_cabacInitFlag = pSrc->m_cabacInitFlag; … … 827 838 828 839 m_bLMvdL1Zero = pSrc->m_bLMvdL1Zero; 840 #if SHARP_ILLUCOMP_PARSE_D0060 841 m_bApplyIC = pSrc->m_bApplyIC; 842 m_icSkipParseFlag = pSrc->m_icSkipParseFlag; 843 #endif 829 844 } 830 845 … … 1387 1402 #endif 1388 1403 1404 #if MERL_VSP_NBDV_RefVId_Fix_D0166 1405 TComPic* TComSlice::getDepthRefPic(Int viewId, Int poc) 1406 { 1407 TComPic* pPic = NULL; 1408 1409 if (m_pcListDepthPic[viewId] == NULL) 1410 return NULL; 1411 1412 for( TComList<TComPic*>::iterator it = m_pcListDepthPic[viewId]->begin(); it != m_pcListDepthPic[viewId]->end(); it++ ) 1413 { 1414 TComPic* currPic = *it; 1415 TComSlice* currSlice = currPic->getCurrSlice(); 1416 Bool isDepth = currSlice->getIsDepth(); 1417 //assert(isDepth); 1418 if( isDepth && currPic->getPOC() == poc && currPic->getViewId() == viewId ) // (*it)->getSPS()->isDepth() 1419 { 1420 pPic = *it; 1421 break; 1422 } 1423 } 1424 1425 return pPic; 1426 } 1427 #endif 1428 1429 1430 #if QC_ARP_D0177 1431 Void TComSlice::setARPStepNum() 1432 { 1433 Bool bAllIvRef = false; 1434 if(!getSPS()->getUseAdvRP()) 1435 m_nARPStepNum = 0; 1436 else 1437 { 1438 for( Int iRefListId = 0; iRefListId < 2; iRefListId++ ) 1439 { 1440 RefPicList eRefPicList = RefPicList( iRefListId ); 1441 Int iNumRefIdx = getNumRefIdx(eRefPicList); 1442 if( iNumRefIdx <= 0 ) 1443 continue; 1444 for (Int i = 0; i < iNumRefIdx; i++) 1445 { 1446 if(getRefPic( REF_PIC_LIST_0, i)->getPOC() != getPOC()) 1447 { 1448 bAllIvRef = true; 1449 break; 1450 } 1451 } 1452 if( bAllIvRef == true ) 1453 break; 1454 } 1455 if(bAllIvRef== true) 1456 m_nARPStepNum = getSPS()->getARPStepNum(); 1457 else 1458 m_nARPStepNum = 0; 1459 } 1460 } 1461 #endif 1389 1462 // ------------------------------------------------------------------------------------------------ 1390 1463 // Video parameter set (VPS) … … 1576 1649 m_uiMultiviewMvPredMode = 0; 1577 1650 #endif 1578 1651 #if QC_ARP_D0177 1652 m_nUseAdvResPred = 0; 1653 m_nARPStepNum = 1; 1654 #endif 1579 1655 ::memset( m_aiUsableInterViewRefs, 0, sizeof( m_aiUsableInterViewRefs ) ); 1580 1656 … … 2044 2120 m_scalingList = src.m_scalingList; 2045 2121 m_scalingListEnabled = src.m_scalingListEnabled; 2122 #if !LGE_SAO_MIGRATION_D0091 2046 2123 m_saoInterleavingFlag = src.m_saoInterleavingFlag; 2124 #endif 2047 2125 2048 2126 return *this; -
trunk/source/Lib/TLibCommon/TComSlice.h
r332 r443 54 54 class TComDepthMapGenerator; 55 55 #endif 56 #if H3D_IVRP 56 #if H3D_IVRP & !QC_ARP_D0177 57 57 class TComResidualGenerator; 58 58 #endif … … 180 180 Bool m_bIVScalingFlag; 181 181 #endif 182 183 #if MTK_D0156 184 #if MERL_VSP_COMPENSATION_C0152 185 Bool m_abUseVSPCompensation[ MAX_TLAYER ]; 186 #endif 187 Bool m_abUseDVPRefine[ MAX_TLAYER ]; 188 #endif 189 182 190 public: 183 191 TComVPS(); … … 245 253 246 254 #endif 255 256 #if MTK_D0156 257 #if MERL_VSP_COMPENSATION_C0152 258 Bool getUseVSPCompensation( UInt tLayer ){ return m_abUseVSPCompensation[ tLayer ];} 259 Void setUseVSPCompensation( Bool bValue, UInt tLayer ){ m_abUseVSPCompensation[ tLayer ] = bValue;} 260 #endif 261 Bool getUseDVPRefine( UInt tLayer ){ return m_abUseDVPRefine[ tLayer ];} 262 Void setUseDVPRefine( Bool bValue, UInt tLayer ){ m_abUseDVPRefine[ tLayer ] = bValue;} 263 #endif 247 264 }; 248 265 … … 390 407 #endif 391 408 #if H3D_IVRP 409 #if QC_ARP_D0177 410 UInt m_nUseAdvResPred; 411 UInt m_nARPStepNum; 412 #else 392 413 UInt m_uiMultiviewResPredMode; 414 #endif 393 415 #endif 394 416 … … 396 418 TComDepthMapGenerator* m_pcDepthMapGenerator; 397 419 #endif 398 #if H3D_IVRP 420 #if H3D_IVRP & !QC_ARP_D0177 399 421 TComResidualGenerator* m_pcResidualGenerator; 422 #endif 423 424 #if MTK_D0156 425 #if MERL_VSP_COMPENSATION_C0152 426 Bool m_bUseVSPCompensation; 427 #endif 428 Bool m_bUseDVPRefine; 400 429 #endif 401 430 … … 643 672 Void setPredDepthMapGeneration( UInt uiViewId, Bool bIsDepth, UInt uiPdmGenMode = 0, UInt uiPdmMvPredMode = 0, UInt uiPdmPrec = 0, Int** aaiPdmScaleNomDelta = 0, Int** aaiPdmOffset = 0 ); 644 673 #endif 645 #if H3D_IVRP 674 #if H3D_IVRP & !QC_ARP_D0177 646 675 Void setMultiviewResPredMode ( UInt uiResPrdMode ) { m_uiMultiviewResPredMode = uiResPrdMode; } 647 676 #endif … … 658 687 #endif 659 688 #if H3D_IVRP 689 #if QC_ARP_D0177 690 UInt getUseAdvRP() { return m_nUseAdvResPred; } 691 Void setUseAdvRP(UInt n) { m_nUseAdvResPred = n; } 692 UInt getARPStepNum() { return m_nARPStepNum; } 693 Void setARPStepNum(UInt n) { m_nARPStepNum = n; } 694 #else 660 695 UInt getMultiviewResPredMode () { return m_uiMultiviewResPredMode; } 696 #endif 661 697 #endif 662 698 … … 665 701 TComDepthMapGenerator* getDepthMapGenerator() { return m_pcDepthMapGenerator; } 666 702 #endif 667 #if H3D_IVRP 703 #if H3D_IVRP & !QC_ARP_D0177 668 704 Void setResidualGenerator( TComResidualGenerator* pcResidualGenerator ) { m_pcResidualGenerator = pcResidualGenerator; } 669 705 TComResidualGenerator* getResidualGenerator() { return m_pcResidualGenerator; } 706 #endif 707 708 #if MTK_D0156 709 710 #if MERL_VSP_COMPENSATION_C0152 711 Bool getUseVSPCompensation( ){ return m_bUseVSPCompensation;} 712 Void setUseVSPCompensation( Bool bValue ){ m_bUseVSPCompensation = bValue;} 713 #endif 714 715 Bool getUseDVPRefine( ){ return m_bUseDVPRefine;} 716 Void setUseDVPRefine( Bool bValue ){ m_bUseDVPRefine = bValue;} 717 670 718 #endif 671 719 }; … … 928 976 Bool getScalingListEnabled () { return m_scalingListEnabled; } //!< get ScalingList enabled/disabled in APS 929 977 TComScalingList* getScalingList () { return m_scalingList; } //!< get ScalingList class pointer in APS 978 #if !LGE_SAO_MIGRATION_D0091 930 979 Bool getSaoInterleavingFlag() {return m_saoInterleavingFlag;} //!< get SAO interleaving flag in APS 931 980 Void setSaoInterleavingFlag(Bool bVal) {m_saoInterleavingFlag = bVal;} //!< set SAO interleaving flag in APS 981 #endif 932 982 933 983 private: … … 943 993 Bool m_scalingListEnabled; //!< ScalingList enabled/disabled in APS (true for enabled) 944 994 TComScalingList* m_scalingList; //!< ScalingList class pointer 995 #if !LGE_SAO_MIGRATION_D0091 945 996 Bool m_saoInterleavingFlag; //!< SAO interleaving flag 997 #endif 946 998 947 999 public: … … 975 1027 bool m_alfEnabledFlag; 976 1028 bool m_saoEnabledFlag; 1029 #if LGE_SAO_MIGRATION_D0091 1030 bool m_saoEnabledFlagChroma; ///< SAO Cb&Cr enabled flag 1031 #else 977 1032 bool m_saoInterleavingFlag; ///< SAO interleaving flag 978 1033 bool m_saoEnabledFlagCb; ///< SAO Cb enabled flag 979 1034 bool m_saoEnabledFlagCr; ///< SAO Cr enabled flag 1035 #endif 980 1036 Int m_iPPSId; ///< picture parameter set ID 981 1037 Bool m_PicOutputFlag; ///< pic_output_flag … … 1106 1162 #if LGE_ILLUCOMP_B0045 1107 1163 Bool m_bApplyIC; 1164 #if SHARP_ILLUCOMP_PARSE_D0060 1165 Bool m_icSkipParseFlag; 1166 #endif 1167 #endif 1168 #if MERL_VSP_NBDV_RefVId_Fix_D0166 1169 TComList<TComPic*>* m_pcListDepthPic[MAX_VIEW_NUM]; // For encoder, the list may also include texture pictures. Three views with ViewIdx = 0, 1, 2 1170 #endif 1171 #if QC_ARP_D0177 1172 TComList<TComPic*> * m_pBaseViewRefPicList[MAX_VIEW_NUM]; 1173 UInt m_nARPStepNum; 1108 1174 #endif 1109 1175 #if INTER_VIEW_VECTOR_SCALING_C0115|QC_MVHEVC_B0046 … … 1115 1181 TComPic* m_apcRefPicBaseTxt; 1116 1182 TComPic* m_apcRefPicBaseDepth; 1183 #if MERL_VSP_NBDV_RefVId_Fix_D0166 1184 Int* m_aiShiftLUT[2]; // For reference views 1185 #else 1117 1186 Int* m_aiShiftLUT; 1187 #endif 1118 1188 Int m_iShiftPrec; 1119 1189 #endif … … 1158 1228 Void setSaoEnabledFlag(Bool s) {m_saoEnabledFlag =s; } 1159 1229 Bool getSaoEnabledFlag() { return m_saoEnabledFlag; } 1230 #if LGE_SAO_MIGRATION_D0091 1231 Void setSaoEnabledFlagChroma(Bool s) {m_saoEnabledFlagChroma =s; } //!< set SAO Cb&Cr enabled flag 1232 Bool getSaoEnabledFlagChroma() { return m_saoEnabledFlagChroma; } //!< get SAO Cb&Cr enabled flag 1233 #else 1160 1234 Void setSaoInterleavingFlag(Bool s) {m_saoInterleavingFlag =s; } //!< set SAO interleaving flag 1161 1235 Bool getSaoInterleavingFlag() { return m_saoInterleavingFlag; } //!< get SAO interleaving flag … … 1164 1238 Void setSaoEnabledFlagCr(Bool s) {m_saoEnabledFlagCr =s; } //!< set SAO Cr enabled flag 1165 1239 Bool getSaoEnabledFlagCr() { return m_saoEnabledFlagCr; } //!< get SAO Cr enabled flag 1240 #endif 1166 1241 Void setRPS ( TComReferencePictureSet *pcRPS ) { m_pcRPS = pcRPS; } 1167 1242 TComReferencePictureSet* getRPS () { return m_pcRPS; } … … 1253 1328 Void setRefPicListMvc ( TComList<TComPic*>& rcListPic, std::vector<TComPic*>& rapcInterViewRefPics ); 1254 1329 Void setRefPOCnViewListsMvc(); 1255 1330 #if QC_ARP_D0177 1331 Void setBaseViewRefPicList( TComList<TComPic*> *pListPic, Int iViewIdx ) { m_pBaseViewRefPicList[iViewIdx] = pListPic; } 1332 TComPic* getBaseViewRefPic ( UInt uiPOC , Int iViewIdx ) { return xGetRefPic( *m_pBaseViewRefPicList[iViewIdx], uiPOC ); } 1333 Void setARPStepNum(); 1334 UInt getARPStepNum( ) { return m_nARPStepNum; } 1335 #endif 1256 1336 Void setColDir ( UInt uiDir ) { m_uiColDir = uiDir; } 1257 1337 #if COLLOCATED_REF_IDX … … 1401 1481 Bool getApplyIC () { return m_bApplyIC; } 1402 1482 Void xSetApplyIC (); 1483 #if SHARP_ILLUCOMP_PARSE_D0060 1484 Void setIcSkipParseFlag( Bool b ) { m_icSkipParseFlag = b; } 1485 Bool getIcSkipParseFlag() { return m_icSkipParseFlag; } 1486 #endif 1403 1487 #endif 1404 1488 #if QC_TMVP_MRG_REFIDX_C0047 … … 1418 1502 TComPic* getRefPicBaseDepth () { return m_apcRefPicBaseDepth; } 1419 1503 Void setRefPicBaseDepth ( TComPic* RefPic) { m_apcRefPicBaseDepth = RefPic; } 1420 1504 #if MERL_VSP_NBDV_RefVId_Fix_D0166 1505 Void setBWVSPLUTParam( Int *pShiftLUT, Int iLoG2LUTPrec, Int iNeighborViewId) { m_aiShiftLUT[iNeighborViewId] = pShiftLUT; m_iShiftPrec = iLoG2LUTPrec; } 1506 Void getBWVSPLUTParam( Int*&pShiftLUT, Int&iLoG2LUTPrec, Int iNeighborViewId) { pShiftLUT = m_aiShiftLUT[iNeighborViewId]; iLoG2LUTPrec = m_iShiftPrec; } 1507 #else 1421 1508 Void setBWVSPLUTParam( Int *pShiftLUT, Int iLoG2LUTPrec) { m_aiShiftLUT = pShiftLUT; m_iShiftPrec = iLoG2LUTPrec; } 1422 1509 Void getBWVSPLUTParam( Int*&pShiftLUT, Int&iLoG2LUTPrec) { pShiftLUT = m_aiShiftLUT; iLoG2LUTPrec = m_iShiftPrec; } 1510 #endif 1511 #endif 1512 1513 #if MERL_VSP_NBDV_RefVId_Fix_D0166 1514 Void setListDepthPic( TComList<TComPic*>* pListDepthPic, Int viewId) { m_pcListDepthPic[viewId] = pListDepthPic; } 1515 TComList<TComPic*>* getListDepthPic(Int viewId) { return m_pcListDepthPic[viewId]; } 1516 TComPic* getDepthRefPic(Int viewId, Int poc); 1517 TComPic* getDepthRefPic(Int refIdx); 1423 1518 #endif 1424 1519 -
trunk/source/Lib/TLibCommon/TComWedgelet.cpp
r296 r443 783 783 Int deltax = x1 - x0; 784 784 Int deltay = abs(y1 - y0); 785 #if FIX_WEDGE_NOFLOAT_D0036 786 Int error = 0; 787 Int deltaerr = (deltay<<1); 788 #else 785 789 double error = 0.0; 786 790 double deltaerr = (double)deltay / (double)deltax; 791 #endif 787 792 788 793 Int ystep; … … 797 802 798 803 error += deltaerr; 804 #if FIX_WEDGE_NOFLOAT_D0036 805 if( error >= deltax ) 806 #else 799 807 if( error >= 0.5) 808 #endif 800 809 { 801 810 y += ystep; 811 #if FIX_WEDGE_NOFLOAT_D0036 812 error = error - (deltax<<1); 813 #else 802 814 error = error - 1.0; 815 #endif 803 816 } 804 817 } -
trunk/source/Lib/TLibCommon/TComYuv.cpp
r332 r443 741 741 } 742 742 } 743 #if QC_ARP_D0177 744 Void TComYuv::addARP(TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight , Bool bClip ) 745 { 746 addARPLuma ( pcYuvSrc0, pcYuvSrc1, uiAbsPartIdx, uiWidth , uiHeight , bClip ); 747 addARPChroma ( pcYuvSrc0, pcYuvSrc1, uiAbsPartIdx, uiWidth>>1, uiHeight>>1 , bClip ); 748 } 749 750 Void TComYuv::addARPLuma(TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight , Bool bClip ) 751 { 752 Int x, y; 753 754 Pel* pSrc0 = pcYuvSrc0->getLumaAddr( uiAbsPartIdx ); 755 Pel* pSrc1 = pcYuvSrc1->getLumaAddr( uiAbsPartIdx ); 756 Pel* pDst = getLumaAddr( uiAbsPartIdx ); 757 758 UInt iSrc0Stride = pcYuvSrc0->getStride(); 759 UInt iSrc1Stride = pcYuvSrc1->getStride(); 760 UInt iDstStride = getStride(); 761 for ( y = uiHeight-1; y >= 0; y-- ) 762 { 763 for ( x = uiWidth-1; x >= 0; x-- ) 764 { 765 pDst[x] = pSrc0[x] + pSrc1[x]; 766 if( bClip ) 767 pDst[x] = Clip( pDst[x] ); 768 } 769 pSrc0 += iSrc0Stride; 770 pSrc1 += iSrc1Stride; 771 pDst += iDstStride; 772 } 773 } 774 775 Void TComYuv::addARPChroma(TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight , Bool bClip ) 776 { 777 Int x, y; 778 779 Pel* pSrcU0 = pcYuvSrc0->getCbAddr( uiAbsPartIdx ); 780 Pel* pSrcU1 = pcYuvSrc1->getCbAddr( uiAbsPartIdx ); 781 Pel* pSrcV0 = pcYuvSrc0->getCrAddr( uiAbsPartIdx ); 782 Pel* pSrcV1 = pcYuvSrc1->getCrAddr( uiAbsPartIdx ); 783 Pel* pDstU = getCbAddr( uiAbsPartIdx ); 784 Pel* pDstV = getCrAddr( uiAbsPartIdx ); 785 786 UInt iSrc0Stride = pcYuvSrc0->getCStride(); 787 UInt iSrc1Stride = pcYuvSrc1->getCStride(); 788 UInt iDstStride = getCStride(); 789 for ( y = uiHeight-1; y >= 0; y-- ) 790 { 791 for ( x = uiWidth-1; x >= 0; x-- ) 792 { 793 pDstU[x] = pSrcU0[x] + pSrcU1[x]; 794 pDstV[x] = pSrcV0[x] + pSrcV1[x]; 795 if( bClip ) 796 { 797 pDstU[x] = Clip( pDstU[x] ); 798 pDstV[x] = Clip( pDstV[x] ); 799 } 800 } 801 802 pSrcU0 += iSrc0Stride; 803 pSrcU1 += iSrc1Stride; 804 pSrcV0 += iSrc0Stride; 805 pSrcV1 += iSrc1Stride; 806 pDstU += iDstStride; 807 pDstV += iDstStride; 808 } 809 } 810 811 Void TComYuv::subtractARP(TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight) 812 { 813 subtractARPLuma ( pcYuvSrc0, pcYuvSrc1, uiAbsPartIdx, uiWidth , uiHeight ); 814 subtractARPChroma( pcYuvSrc0, pcYuvSrc1, uiAbsPartIdx, uiWidth>>1 , uiHeight>>1 ); 815 } 816 817 Void TComYuv::subtractARPLuma(TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight) 818 { 819 Int x, y; 820 821 Pel* pSrc0 = pcYuvSrc0->getLumaAddr( uiAbsPartIdx ); 822 Pel* pSrc1 = pcYuvSrc1->getLumaAddr( uiAbsPartIdx ); 823 Pel* pDst = getLumaAddr( uiAbsPartIdx ); 824 825 Int iSrc0Stride = pcYuvSrc0->getStride(); 826 Int iSrc1Stride = pcYuvSrc1->getStride(); 827 Int iDstStride = getStride(); 828 for ( y = uiHeight-1; y >= 0; y-- ) 829 { 830 for ( x = uiWidth-1; x >= 0; x-- ) 831 { 832 pDst[x] = pSrc0[x] - pSrc1[x]; 833 } 834 pSrc0 += iSrc0Stride; 835 pSrc1 += iSrc1Stride; 836 pDst += iDstStride; 837 } 838 } 839 840 Void TComYuv::subtractARPChroma(TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight) 841 { 842 Int x, y; 843 844 Pel* pSrcU0 = pcYuvSrc0->getCbAddr( uiAbsPartIdx ); 845 Pel* pSrcU1 = pcYuvSrc1->getCbAddr( uiAbsPartIdx ); 846 Pel* pSrcV0 = pcYuvSrc0->getCrAddr( uiAbsPartIdx ); 847 Pel* pSrcV1 = pcYuvSrc1->getCrAddr( uiAbsPartIdx ); 848 Pel* pDstU = getCbAddr( uiAbsPartIdx ); 849 Pel* pDstV = getCrAddr( uiAbsPartIdx ); 850 851 Int iSrc0Stride = pcYuvSrc0->getCStride(); 852 Int iSrc1Stride = pcYuvSrc1->getCStride(); 853 Int iDstStride = getCStride(); 854 for ( y = uiHeight-1; y >= 0; y-- ) 855 { 856 for ( x = uiWidth-1; x >= 0; x-- ) 857 { 858 pDstU[x] = pSrcU0[x] - pSrcU1[x]; 859 pDstV[x] = pSrcV0[x] - pSrcV1[x]; 860 } 861 pSrcU0 += iSrc0Stride; 862 pSrcU1 += iSrc1Stride; 863 pSrcV0 += iSrc0Stride; 864 pSrcV1 += iSrc1Stride; 865 pDstU += iDstStride; 866 pDstV += iDstStride; 867 } 868 } 869 870 Void TComYuv::multiplyARP( UInt uiAbsPartIdx , UInt uiWidth , UInt uiHeight , UChar dW ) 871 { 872 multiplyARPLuma( uiAbsPartIdx , uiWidth , uiHeight , dW ); 873 multiplyARPChroma( uiAbsPartIdx , uiWidth >> 1 , uiHeight >> 1 , dW ); 874 } 875 876 Void TComYuv::xxMultiplyLine( Pel * pSrcDst , UInt uiWidth , UChar dW ) 877 { 878 assert( dW == 2 ); 879 for( UInt x = 0 ; x < uiWidth ; x++ ) 880 pSrcDst[x] = pSrcDst[x] >> 1; 881 } 882 883 Void TComYuv::multiplyARPLuma( UInt uiAbsPartIdx , UInt uiWidth , UInt uiHeight , UChar dW ) 884 { 885 Pel* pDst = getLumaAddr( uiAbsPartIdx ); 886 Int iDstStride = getStride(); 887 for ( Int y = uiHeight-1; y >= 0; y-- ) 888 { 889 xxMultiplyLine( pDst , uiWidth , dW ); 890 pDst += iDstStride; 891 } 892 } 893 894 Void TComYuv::multiplyARPChroma( UInt uiAbsPartIdx , UInt uiWidth , UInt uiHeight , UChar dW ) 895 { 896 Pel* pDstU = getCbAddr( uiAbsPartIdx ); 897 Pel* pDstV = getCrAddr( uiAbsPartIdx ); 898 899 Int iDstStride = getCStride(); 900 for ( Int y = uiHeight-1; y >= 0; y-- ) 901 { 902 xxMultiplyLine( pDstU , uiWidth , dW ); 903 xxMultiplyLine( pDstV , uiWidth , dW ); 904 pDstU += iDstStride; 905 pDstV += iDstStride; 906 } 907 } 908 #endif 743 909 //! \} -
trunk/source/Lib/TLibCommon/TComYuv.h
r332 r443 199 199 200 200 __inline Pel xClip (Pel x ) { return ( (x < 0) ? 0 : (x > (Pel)g_uiIBDI_MAX) ? (Pel)g_uiIBDI_MAX : x ); } 201 #if QC_ARP_D0177 202 Void addARP ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight , Bool bClip ); 203 Void addARPLuma ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight , Bool bClip ); 204 Void addARPChroma ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight , Bool bClip ); 205 Void subtractARP ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight ); 206 Void subtractARPLuma ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight ); 207 Void subtractARPChroma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight ); 208 Void multiplyARP ( UInt uiAbsPartIdx , UInt uiWidth , UInt uiHeight , UChar dW ); 209 Void multiplyARPLuma ( UInt uiAbsPartIdx , UInt uiWidth , UInt uiHeight , UChar dW ); 210 Void multiplyARPChroma( UInt uiAbsPartIdx , UInt uiWidth , UInt uiHeight , UChar dW ); 211 private: 212 Void xxMultiplyLine( Pel * pSrcDst , UInt uiWidth , UChar dW ); 213 #endif 201 214 };// END CLASS DEFINITION TComYuv 202 215 -
trunk/source/Lib/TLibCommon/TypeDef.h
r332 r443 59 59 // HHI_DMM_DELTADC_Q1_C0034 JCT3V-C0034: no quantization and fast encoder search for DMM delta DC values 60 60 // FIX_DMM_CTX_INIT_C0034 JCT3V-C0034 fix for wrong init type of DMM contexts (UChar instead of Short) 61 #define FIX_WEDGE_NOFLOAT_D0036 1 // JCT3V-D0036: Fix for aligning SW and spec (Wedgelet segmentation line generation without float) 61 62 62 63 #define LGE_EDGE_INTRA_A0070 1 // JCT3V-A0070 63 64 #define LGE_DMM3_SIMP_C0044 1 65 66 #define QC_DC_PREDICTOR_D0183 1 // JCT3V-D0183: Simplified DC predictor for depth intra modes 64 67 65 68 ///// ***** SDC ********* … … 67 70 // SAIT_SDC_C0096 JCT3V-C0096: Improved Simple Depth Coding(removal of DMM2 among four SDC modes(DC, Planar, DMM1 and DMM2)) 68 71 // FIX_SDC_ENC_C0143, JCT3V-C0143 fix for unnecessary encoder checks in case of SDC 69 72 #if RWTH_SDC_DLT_B0036 73 #define HHI_DELTADC_DLT_D0035 1 // JCT3V-D0035: DLT for DMM deltaDC coding 74 #define INTEL_SDC64_D0193 1 // JCT3V-D0193: SDC binary clean up (use a 1 bit binary code to signal sdc_pred_mode when CU size is 64x64) 75 #define RWTH_SDC_CTX_SIMPL_D0032 1 // JCT3V-D0032: CABAC Context Reduction for Simplified Depth Coding 76 #define LGE_CONCATENATE_D0141 1 // JCT3V-D0141: concatenate binarization for residual index coding 77 #endif 78 #define FIX_SDC_ENC_RD_WVSO_D0163 1 // JCT3V-D0163: fix for SDC encoder rd-cost (VSO -> WVSO) 79 80 #define PKU_QC_DEPTH_INTRA_UNI_D0195 1 // JCT3V-D0195: unified syntax table for depth intra coding tools 81 #define MTK_SAMPLE_BASED_SDC_D0110 1 // JCT3V-D0110: sample based SDC 70 82 ///// ***** TMVP/AMVP ********* 71 83 #define TMVP_DEPTH_SWITCH 1 // JCT3V-B0092 additional encoder option only … … 84 96 // QC_C0051_FIXED_BY_MTK 1 // Bug fix for C0051 implementation 85 97 // QC_AMVP_MRG_UNIFY_IVCAN_C0051 1 98 #define SEC_TWO_CANDIDATES_FOR_AMVP_D0122 1 // SEC_TWO_CANDIDATES_FOR_AMVP_D0122, fixing # of AMVP candidates 3 to 2 86 99 87 100 … … 95 108 // FIX_LG_RESTRICTEDRESPRED_M24766 1 96 109 110 #define QC_ARP_D0177 1 ////< advanced residual prediction 111 #if QC_ARP_D0177 112 #define QC_ARP_WFNR 3 113 #define QC_ARP_WARNING_FIX 1 // Fix warning message for ARP 114 #endif 97 115 ///// ***** DISPARITY VECTOR DERIVATION ********* 98 116 #define H3D_NBDV 1 // Neighboring block disparity derivation … … 111 129 // MTK_SIMPLIFY_DVTC_C0135 112 130 // FIX_CHROMA_RESIDUAL_C0129 131 #define QC_CU_NBDV_D0181 1 132 133 #define SEC_DEFAULT_DV_D0112 1 113 134 114 135 ///// ***** MOTION PARAMETER INHERITANCE ********* … … 143 164 #endif 144 165 166 #define SHARP_ILLUCOMP_PARSE_D0060 1 // JCT3V-D0060 Removal of IC's parsing dependency 167 145 168 ///// ***** INTERVIEW SKIP ********* 146 169 #define HHI_INTERVIEW_SKIP 1 … … 159 182 #define FIX_APPENCTOP_T_ONLY 1 // For Texture-only coding 160 183 184 #define LGE_ROUND_OFFSET_D0135 1 // JCT3V-D0135 Rounding offset 185 #define LGE_SAO_MIGRATION_D0091 1 186 #if LGE_SAO_MIGRATION_D0091 187 #define SAO_SKIP_RIGHT 1 ///< H1101: disallow using unavailable pixel during RDO 188 #define SAO_ENCODING_CHOICE 1 ///< I0184: picture early termination 189 #if SAO_ENCODING_CHOICE 190 #define SAO_ENCODING_RATE 0.75 191 #define SAO_ENCODING_CHOICE_CHROMA 1 ///< J0044: picture early termination Luma and Chroma are handled separatenly 192 #if SAO_ENCODING_CHOICE_CHROMA 193 #define SAO_ENCODING_RATE_CHROMA 0.5 194 #define SAO_ENCODING_CHOICE_CHROMA_BF 1 /// K0156: Bug fix for SAO selection consistency 195 #endif 196 #endif 197 #endif 198 161 199 ///// ***** FCO ********* 162 200 #define FLEX_CODING_ORDER_M23723 1 … … 174 212 175 213 ///// ***** VSP ********* 176 #define MERL_VSP_C0152 1 // JCT3V-C0152: 1: enable VSP-related tools; 0: disable VSP-related tools177 // LGE_SIMP_DVP_REFINE_C0112178 // MERL_MTK_VSP_DVP_REFINE_C0152_C0131214 #define MERL_VSP_C0152 1 // JCT3V-C0152: 1: enable VSP-related tools; 0: disable VSP-related tools 215 // LGE_SIMP_DVP_REFINE_C0112 216 // MERL_MTK_VSP_DVP_REFINE_C0152_C0131 179 217 #if MERL_VSP_C0152 180 #define MERL_VSP_C0152_BugFix_ForNoDepthCase 1// MERL bugfix for test condition of no depth 181 /* 182 * Two macros are used to configure combinations of JCT3V-C0152 and JCT3V-C0131 183 * 184 * a) (full) A full JCT3V-C0152 implementation, including JCT3V-C0131 185 * #define MERL_VSP_COMPENSATION_C0152 1 186 * #define MERL_MTK_VSP_DVP_REFINE_C0152_C0131 1 187 * 188 * b) (mvp2off) For partial JCT3V-C0152 excluding overlaps from JCT3V-C0131 189 * #define MERL_VSP_COMPENSATION_C0152 1 190 * #define MERL_MTK_VSP_DVP_REFINE_C0152_C0131 0 191 * 192 * c) (nocand) For JCT3V-C0131 only 193 * #define MERL_VSP_COMPENSATION_C0152 0 194 * #define MERL_MTK_VSP_DVP_REFINE_C0152_C0131 1 195 */ 196 197 #define MERL_VSP_COMPENSATION_C0152 1 // JCT3V-C0152: 1: add VSP merge candidate to merging candidate list; 0: not to add (nocand). 198 218 219 220 #define FIX_MERGE_D 1 // Fix to compile merged version 221 222 223 #define MERL_General_Fix 1// General fix by MERL 224 #define MERL_VSP_C0152_BugFix_ForNoDepthCase 1 // MERL bugfix for test condition of no depth 225 #define QC_BVSP_CleanUP_D0191 1 226 227 #define MTK_D0156 1 228 #define LGE_VSP_INHERIT_D0092 1 229 230 #define MERL_VSP_COMPENSATION_C0152 1 // JCT3V-C0152: 1: add VSP merge candidate to merging candidate list; 0: not to add (nocand). 199 231 200 232 #define MERL_VSP_BLOCKSIZE_C0152 4 // JCT3V-C0152: VSP block size, supported values: 1, 2 and 4. 233 #if MERL_VSP_BLOCKSIZE_C0152 == 1 234 #define MERL_CVSP_D0165 1 // JCT3V-D0165: 1: enable CVSP; 0: disable CVSP. 235 #else 236 #define MERL_CVSP_D0165 0 // JCT3V-D0165: 1: enable CVSP; 0: disable CVSP. 237 #endif 238 #if LGE_VSP_INHERIT_D0092 239 #define VSP_MERGE_POS 3 // JCT3V-C0152: fixed position of VSP candidate in merge list, supported values: 3. 240 #else 201 241 #define VSP_MERGE_POS 5 // JCT3V-C0152: fixed position of VSP candidate in merge list, supported values: 5. 202 //MTK_DVPREFINE_BVSP_BUG_FIX 1 242 #endif // MTK_DVPREFINE_BVSP_BUG_FIX 1 243 #define MTK_DEPTH_TO_DISP_D0138 1 // JCT3V-D0138: Use max among four corners for DoNBDV and BVSP 244 245 #if MERL_General_Fix 246 #define MTK_LGE_VSP_DEPTH_OFF_D0105_D0139 1 // JCT3V-D0105/JCT3V-D0139: disable VSP for depth map 247 #define MTK_VSP_USING_NBDV_D0105 1 // JCT3V-D0105: use NBDV instead of DoNBDV for BVSP 248 #endif 249 250 #if MERL_General_Fix 251 #define MERL_VSP_NBDV_RefVId_Fix_D0166 1 // JCT3V-D0166: 1: fix the NBDV with ref view selectioin; 0: always use base view with refViewIdx=0 252 #else 253 #define MERL_VSP_NBDV_RefVId_Fix_D0166 0 254 #endif 255 256 #if MERL_VSP_NBDV_RefVId_Fix_D0166 257 #define MERL_Bi_VSP_D0166 1 // JCT3V-D0166: 1: add supporting for Bi-VSP, the code under the macro can also handle uni-direction VSP 258 #else 259 #define MERL_Bi_VSP_D0166 0 260 #endif 203 261 204 262 #else // !MERL_VSP_C0152 205 263 #define MERL_VSP_COMPENSATION_C0152 0 // JCT3V-C0152: 1: add VSP merge candidate to merging candidate list; 0: not to add 206 264 #define MERL_VSP_BLOCKSIZE_C0152 4 // JCT3V-C0152: VSP block size, supported values: 1, 2 and 4. 207 #endif 208 265 #define MERL_VSP_C0152_BugFix_ForNoDepthCase 0 // MERL bugfix for test condition of no depth 266 #define MERL_CVSP_D0165 0 // JCT3V-D0165: 1: enable CVSP; 0: disable CVSP. 267 #define MERL_VSP_NBDV_RefVId_Fix_D0166 0 // JCT3V-D0166: 1: fix the NBDV with ref view selectioin; 0: always use base view with refViewIdx=0 268 #define MERL_Bi_VSP_D0166 0 // JCT3V-D0166: 1: add supporting for Bi-VSP, the code under the macro can also handle uni-direction VSP 269 #define MTK_VSP_USING_NBDV_D0105 0 270 #define MERL_General_Fix 0 271 #endif 272 273 #if !MERL_General_Fix 274 #define MTK_LGE_VSP_DEPTH_OFF_D0105_D0139 1 // JCT3V-D0105/JCT3V-D0139: disable VSP for depth map 275 #define MTK_VSP_USING_NBDV_D0105 1 // JCT3V-D0105: use NBDV instead of DoNBDV for BVSP 276 #endif 209 277 210 278 ///// ***** DERIVED PARAMETERS ********* … … 342 410 #define C2FLAG_NUMBER 1 // maximum number of largerThan2 flag coded in one chunk: 16 in HM5 343 411 412 #if !LGE_SAO_MIGRATION_D0091 344 413 #define REMOVE_SAO_LCU_ENC_CONSTRAINTS_1 0 ///< disable the encoder constraint that does not test SAO/BO mode for chroma in interleaved mode 345 414 #define REMOVE_SAO_LCU_ENC_CONSTRAINTS_2 0 ///< disable the encoder constraint that reduce the range of SAO/EO for chroma in interleaved mode 415 #endif 346 416 #define REMOVE_SAO_LCU_ENC_CONSTRAINTS_3 0 ///< disable the encoder constraint that conditionally disable SAO for chroma for entire slice in interleaved mode 347 417 #define COLLOCATED_REF_IDX 1 ///< H0442: signal collocated reference index … … 616 686 Int iBestType; 617 687 Int iLength; 688 #if LGE_SAO_MIGRATION_D0091 689 Int subTypeIdx ; ///< indicates EO class or BO band position 690 #else 618 691 Int bandPosition ; 692 #endif 619 693 Int iOffset[4]; 620 694 Int StartCUX; … … 646 720 Bool mergeLeftFlag; 647 721 Int typeIdx; 722 #if LGE_SAO_MIGRATION_D0091 723 Int subTypeIdx; 724 #else 648 725 Int bandPosition; 726 #endif 649 727 Int offset[4]; 728 #if !LGE_SAO_MIGRATION_D0091 650 729 Int runDiff; 651 730 Int run; 731 #endif 652 732 Int partIdx; 653 733 Int partIdxTmp; -
trunk/source/Lib/TLibDecoder/TDecCAVLC.cpp
r332 r443 265 265 xParseDblParam( aps ); 266 266 } 267 #if !LGE_SAO_MIGRATION_D0091 267 268 READ_FLAG(uiCode, "aps_sao_interleaving_flag"); aps->setSaoInterleavingFlag( (uiCode==1)?true:false ); 268 269 if(!aps->getSaoInterleavingFlag()) … … 275 276 } 276 277 } 278 #endif 277 279 READ_FLAG(uiCode, "aps_adaptive_loop_filter_flag"); aps->setAlfEnabled( (uiCode==1)?true:false ); 278 280 if(aps->getAlfEnabled()) … … 307 309 } 308 310 } 311 #if !LGE_SAO_MIGRATION_D0091 309 312 /** parse SAO parameters 310 313 * \param pSaoParam … … 532 535 } 533 536 } 534 537 #endif 535 538 536 539 Void TDecCavlc::xParseAlfParam(AlfParamSet* pAlfParamSet, Bool bSentInAPS, Int firstLCUAddr, Bool acrossSlice, Int numLCUInWidth, Int numLCUInHeight) … … 1493 1496 #endif 1494 1497 #if H3D_IVRP 1495 pcSPS->setMultiviewResPredMode ( 0 ); 1496 #endif 1498 #if QC_ARP_D0177 1499 pcSPS->setUseAdvRP ( 0 ); 1500 pcSPS->setARPStepNum( 1 ); 1501 #else 1502 pcSPS->setMultiviewResPredMode ( 0 ); 1503 #endif 1504 #endif 1505 1497 1506 } 1498 1507 else … … 1544 1553 #endif 1545 1554 #if H3D_IVRP 1555 #if QC_ARP_D0177 1556 pcSPS->setUseAdvRP ( 0 ); 1557 pcSPS->setARPStepNum( 1 ); 1558 #else 1546 1559 pcSPS->setMultiviewResPredMode ( 0 ); 1547 1560 #endif 1561 #endif 1562 1548 1563 } 1549 1564 else … … 1573 1588 UInt uiMultiviewMvPredMode = 0; 1574 1589 #endif 1575 #if H3D_IVRP 1590 #if H3D_IVRP & !QC_ARP_D0177 1576 1591 UInt uiMultiviewResPredMode = 0; 1577 1592 #endif … … 1588 1603 READ_UVLC( uiMultiviewMvPredMode, "multi_view_mv_pred_mode" ); 1589 1604 #endif 1590 #if H3D_IVRP 1605 #if H3D_IVRP & !QC_ARP_D0177 1591 1606 READ_FLAG( uiMultiviewResPredMode, "multi_view_residual_pred_mode" ); 1592 1607 #endif … … 1599 1614 #endif 1600 1615 #if H3D_IVRP 1616 #if QC_ARP_D0177 1617 READ_FLAG( uiCode , "advanced_residual_pred_flag" ); pcSPS->setUseAdvRP( uiCode ); 1618 if( pcSPS->getUseAdvRP() ) 1619 pcSPS->setARPStepNum( QC_ARP_WFNR ); 1620 else 1621 pcSPS->setARPStepNum( 1 ); 1622 #else 1601 1623 pcSPS->setMultiviewResPredMode ( uiMultiviewResPredMode ); 1602 1624 #endif 1603 } 1625 #endif 1626 1627 } 1628 1629 #if MTK_D0156 1630 1631 pcSPS->setUseVSPCompensation( false ); 1632 pcSPS->setUseDVPRefine( false ); 1633 1634 //Comments: Currently, BVSP and DoNBDV are not used for depth coding 1635 #if MERL_VSP_COMPENSATION_C0152 1636 READ_FLAG( uiCode, "view_synthesis_pred_flag" );pcSPS->setUseVSPCompensation( uiCode ? true : false ); 1637 #endif 1638 READ_FLAG( uiCode, "dv_refine_flag" ); pcSPS->setUseDVPRefine( uiCode ? true : false ); 1639 #endif 1604 1640 } 1605 1641 READ_FLAG( uiCode, "sps_extension2_flag"); … … 1665 1701 } 1666 1702 rpcSlice->setApplyIC(uiCodeTmp); 1703 #if SHARP_ILLUCOMP_PARSE_D0060 1704 if (rpcSlice->getApplyIC()) 1705 { 1706 READ_FLAG (uiCodeTmp, "ic_skip_mergeidx0"); 1707 rpcSlice->setIcSkipParseFlag(uiCodeTmp); 1708 } 1709 #endif 1667 1710 } 1668 1711 #endif … … 1847 1890 if (sps->getUseSAO()) 1848 1891 { 1892 #if LGE_SAO_MIGRATION_D0091 1893 READ_FLAG(uiCode, "slice_sao_luma_flag"); rpcSlice->setSaoEnabledFlag((Bool)uiCode); 1894 READ_FLAG(uiCode, "slice_sao_chroma_flag"); rpcSlice->setSaoEnabledFlagChroma((Bool)uiCode); 1895 #else 1849 1896 READ_FLAG(uiCode, "slice_sao_interleaving_flag"); rpcSlice->setSaoInterleavingFlag(uiCode); 1850 1897 READ_FLAG(uiCode, "slice_sample_adaptive_offset_flag"); rpcSlice->setSaoEnabledFlag((Bool)uiCode); … … 1859 1906 rpcSlice->setSaoEnabledFlagCr(0); 1860 1907 } 1908 #endif 1861 1909 } 1862 1910 READ_UVLC ( uiCode, "aps_id" ); rpcSlice->setAPSId(uiCode); … … 2424 2472 } 2425 2473 #endif 2426 2474 #if QC_ARP_D0177 2475 Void TDecCavlc::parseARPW( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 2476 { 2477 assert( false ); 2478 } 2479 #endif 2427 2480 #if RWTH_SDC_DLT_B0036 2481 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 2428 2482 Void TDecCavlc::parseSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 2429 2483 { … … 2434 2488 assert(0); 2435 2489 } 2490 #endif 2436 2491 Void TDecCavlc::parseSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPart ) 2437 2492 { -
trunk/source/Lib/TLibDecoder/TDecCAVLC.h
r332 r443 144 144 Void parseResPredFlag ( TComDataCU* pcCU, Bool& rbResPredFlag, UInt uiAbsPartIdx, UInt uiDepth ); 145 145 #endif 146 #if QC_ARP_D0177 147 Void parseARPW( TComDataCU* pcCU, UInt uiAbsPartIdx,UInt uiDepth ); 148 #endif 146 149 Void parseSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 147 150 Void parsePartSize ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); … … 171 174 Void parseDFSvlc ( Int& riVal, const Char *pSymbolName ); 172 175 #if RWTH_SDC_DLT_B0036 176 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 173 177 Void parseSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 174 178 Void parseSDCPredMode ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 179 #endif 175 180 Void parseSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPart ); 176 181 #endif 177 182 protected: 178 183 Void xParseDblParam ( TComAPS* aps ); 184 #if !LGE_SAO_MIGRATION_D0091 179 185 Void xParseSaoParam ( SAOParam* pSaoParam ); 180 186 Void xParseSaoOffset (SaoLcuParam* saoLcuParam); 181 187 Void xParseSaoUnit (Int rx, Int ry, Int compIdx, SAOParam* saoParam, Bool& repeatedRow ); 188 #endif 182 189 Void xParseAlfParam(AlfParamSet* pAlfParamSet, Bool bSentInAPS = true, Int firstLCUAddr = 0, Bool acrossSlice = true, Int numLCUInWidth= -1, Int numLCUInHeight= -1); 183 190 Void parseAlfParamSet(AlfParamSet* pAlfParamSet, Int firstLCUAddr, Bool alfAcrossSlice); -
trunk/source/Lib/TLibDecoder/TDecCu.cpp
r332 r443 54 54 m_ppcYuvResi = NULL; 55 55 m_ppcYuvReco = NULL; 56 #if H3D_IVRP 56 #if H3D_IVRP & !QC_ARP_D0177 57 57 m_ppcYuvResPred = NULL; 58 58 #endif … … 82 82 m_ppcYuvResi = new TComYuv*[m_uiMaxDepth-1]; 83 83 m_ppcYuvReco = new TComYuv*[m_uiMaxDepth-1]; 84 #if H3D_IVRP 84 #if H3D_IVRP & !QC_ARP_D0177 85 85 m_ppcYuvResPred = new TComYuv* [m_uiMaxDepth-1]; 86 86 #endif … … 96 96 m_ppcYuvResi[ui] = new TComYuv; m_ppcYuvResi[ui]->create( uiWidth, uiHeight ); 97 97 m_ppcYuvReco[ui] = new TComYuv; m_ppcYuvReco[ui]->create( uiWidth, uiHeight ); 98 #if H3D_IVRP 98 #if H3D_IVRP & !QC_ARP_D0177 99 99 m_ppcYuvResPred[ui] = new TComYuv; m_ppcYuvResPred[ui]->create( uiWidth, uiHeight ); 100 100 #endif … … 120 120 m_ppcYuvResi[ui]->destroy(); delete m_ppcYuvResi[ui]; m_ppcYuvResi[ui] = NULL; 121 121 m_ppcYuvReco[ui]->destroy(); delete m_ppcYuvReco[ui]; m_ppcYuvReco[ui] = NULL; 122 #if H3D_IVRP 122 #if H3D_IVRP & !QC_ARP_D0177 123 123 m_ppcYuvResPred[ui]->destroy(); delete m_ppcYuvResPred[ui]; m_ppcYuvResPred[ui] = NULL; 124 124 #endif … … 128 128 delete [] m_ppcYuvResi; m_ppcYuvResi = NULL; 129 129 delete [] m_ppcYuvReco; m_ppcYuvReco = NULL; 130 #if H3D_IVRP 130 #if H3D_IVRP & !QC_ARP_D0177 131 131 delete [] m_ppcYuvResPred; m_ppcYuvResPred = NULL; 132 132 #endif … … 312 312 pcCU->setQPSubParts( pcCU->getRefQP(uiAbsPartIdx), uiAbsPartIdx, uiDepth ); // set QP to default QP 313 313 } 314 314 #if QC_CU_NBDV_D0181 315 DisInfo DvInfo; 316 DvInfo.bDV = false; 317 if(!pcCU->getSlice()->isIntra()) 318 { 319 #if QC_ARP_D0177 320 if(( pcCU->getSlice()->getSPS()->getMultiviewMvPredMode() || pcCU->getSlice()->getSPS()->getUseAdvRP()) && pcCU->getSlice()->getViewId()) 321 #else 322 if(( pcCU->getSlice()->getSPS()->getMultiviewMvPredMode() || pcCU->getSlice()->getSPS()->getMultiviewResPredMode()) && pcCU->getSlice()->getViewId()) 323 #endif 324 { 325 m_ppcCU[uiDepth]->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_0, true ); 326 m_ppcCU[uiDepth]->copyDVInfoFrom( pcCU, uiAbsPartIdx); 327 PartSize ePartTemp = m_ppcCU[uiDepth]->getPartitionSize(0); 328 UChar cWidTemp = m_ppcCU[uiDepth]->getWidth(0); 329 UChar cHeightTemp = m_ppcCU[uiDepth]->getHeight(0); 330 m_ppcCU[uiDepth]->setWidth ( 0, pcCU->getSlice()->getSPS()->getMaxCUWidth ()/(1<<uiDepth) ); 331 m_ppcCU[uiDepth]->setHeight ( 0, pcCU->getSlice()->getSPS()->getMaxCUHeight()/(1<<uiDepth) ); 332 m_ppcCU[uiDepth]->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth ); 333 #if MERL_VSP_C0152 334 DvInfo.bDV = m_ppcCU[uiDepth]->getDisMvpCandNBDV(0, 0, &DvInfo, false, true); 335 #else 336 DvInfo.bDV = m_ppcCU[uiDepth]->getDisMvpCandNBDV(0, 0, &DvInfo, false); 337 #endif 338 pcCU->setDvInfoSubParts(DvInfo, uiAbsPartIdx, uiDepth); 339 m_ppcCU[uiDepth]->setPartSizeSubParts( ePartTemp, 0, uiDepth ); 340 m_ppcCU[uiDepth]->setWidth ( 0, cWidTemp ); 341 m_ppcCU[uiDepth]->setHeight ( 0, cHeightTemp ); 342 } 343 if(DvInfo.bDV==false) 344 { 345 DvInfo.iN=1; 346 #if !SEC_DEFAULT_DV_D0112 347 DvInfo.m_acMvCand[0].setHor(0); 348 DvInfo.m_acMvCand[0].setVer(0); 349 DvInfo.m_aVIdxCan[0] = 0; 350 #endif 351 pcCU->setDvInfoSubParts(DvInfo, uiAbsPartIdx, uiDepth); 352 } 353 } 354 #endif 315 355 // decode CU mode and the partition size 316 356 if( !pcCU->getSlice()->isIntra() && pcCU->getNumSucIPCM() == 0 ) … … 353 393 const UChar uhNewDepth = max<UInt>( uiDepth, pcTextureCU->getDepth( uiAbsPartIdx + ui ) ); 354 394 #if MERL_VSP_C0152 355 Int vspIdx = pcTextureCU->getVSPIndex( uiAbsPartIdx + ui); 356 pcCU->setVSPIndex( uiAbsPartIdx + ui, vspIdx); 395 Int vspIdx = pcTextureCU->getVSPIndex( uiAbsPartIdx + ui ); 396 pcCU->setVSPIndex( uiAbsPartIdx + ui, vspIdx ); 397 #endif 398 #if MERL_VSP_NBDV_RefVId_Fix_D0166 399 Int vspDir = pcTextureCU->getVSPDir( uiAbsPartIdx + ui ); 400 pcCU->setVSPDir( uiAbsPartIdx + ui, vspDir ); 357 401 #endif 358 402 pcCU->setPredictionMode( uiAbsPartIdx + ui, MODE_SKIP ); … … 371 415 UInt uiMergeIndex = pcCU->getMergeIndex(uiAbsPartIdx); 372 416 #if MERL_VSP_C0152 417 #if LGE_VSP_INHERIT_D0092 418 Int iVSPIndexTrue[MRG_MAX_NUM_CANDS_MEM]; 419 for (Int i=0; i<MRG_MAX_NUM_CANDS_MEM; i++) 420 { 421 iVSPIndexTrue[i] = 0; 422 } 423 #else 373 424 Int iVSPIndexTrue[3] = {-1, -1, -1}; 425 #endif 426 #if MERL_VSP_NBDV_RefVId_Fix_D0166 427 Int iVSPDirTrue[3] = {-1, -1, -1}; 428 m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, iVSPIndexTrue, iVSPDirTrue, uiMergeIndex ); 429 #else 374 430 m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, iVSPIndexTrue, uiMergeIndex ); 431 #endif 432 #if MTK_D0156 433 if( !pcCU->getSlice()->getSPS()->getUseVSPCompensation() ) 434 { 435 pcCU->setVSPIndexSubParts( 0, uiAbsPartIdx, 0, uiDepth ); 436 } 437 else 438 #endif 375 439 { 376 440 Int iVSPIdx = 0; 441 #if LGE_VSP_INHERIT_D0092 442 if (iVSPIndexTrue[uiMergeIndex] == 1) 443 { 444 iVSPIdx = 1; 445 } 446 #else 377 447 Int numVspIdx; 378 448 numVspIdx = 3; … … 385 455 } 386 456 } 387 pcCU->setVSPIndexSubParts( iVSPIdx, uiAbsPartIdx, 0, uiDepth ); //Initialize the VSP, may change later in get InterMergeCandidates() 457 #endif 458 pcCU->setVSPIndexSubParts( iVSPIdx, uiAbsPartIdx, 0, uiDepth ); // Initialize 459 #if MERL_VSP_NBDV_RefVId_Fix_D0166 460 pcCU->setVSPDirSubParts( 0, uiAbsPartIdx, 0, uiDepth ); 461 #endif 462 #if QC_BVSP_CleanUP_D0191 && !LGE_VSP_INHERIT_D0092 463 if(iVSPIdx != 0) 464 { 465 Int iIVCIdx = pcCU->getSlice()->getRefPic(REF_PIC_LIST_0, 0)->getPOC()==pcCU->getSlice()->getPOC() ? 0: pcCU->getSlice()->getNewRefIdx(REF_PIC_LIST_0); 466 cMvFieldNeighbours[ 2*uiMergeIndex].setRefIdx(iIVCIdx); 467 } 468 #endif 388 469 } 389 470 #else … … 409 490 } 410 491 #endif 492 #if QC_ARP_D0177 493 if( pcCU->getSlice()->getSPS()->getUseAdvRP() ) 494 { 495 pcCU->setResPredAvailSubParts ( false, uiAbsPartIdx, 0, uiDepth ); 496 pcCU->setResPredFlagSubParts ( false, uiAbsPartIdx, 0, uiDepth ); 497 m_pcEntropyDecoder->decodeARPW( pcCU , uiAbsPartIdx , uiDepth, m_ppcCU[uiDepth], 0 ); 498 } 499 #endif 411 500 xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, ruiIsLast ); 412 501 return; … … 460 549 } 461 550 #endif 462 551 #if QC_ARP_D0177 552 if (pcCU->getSlice()->getSPS()->getUseAdvRP() && pcCU->isIntra( uiAbsPartIdx ) ) 553 { 554 pcCU->setResPredAvailSubParts ( 0, uiAbsPartIdx, 0, uiDepth ); 555 pcCU->setResPredFlagSubParts ( 0, uiAbsPartIdx, 0, uiDepth ); 556 } 557 #endif 463 558 #if HHI_MPI 464 559 if( pcCU->getTextureModeDepth( uiAbsPartIdx ) == uiDepth ) … … 476 571 Int vspIdx = pcTextureCU->getVSPIndex( uiAbsPartIdx + ui); 477 572 pcCU->setVSPIndex( uiAbsPartIdx + ui, vspIdx); 573 #endif 574 #if MERL_VSP_NBDV_RefVId_Fix_D0166 575 if (pcCU->getSlice()->getIsDepth()) { 576 pcCU->setVSPDir( uiAbsPartIdx + ui, 0); 577 } 578 else { 579 Int vspDir = pcTextureCU->getVSPDir( uiAbsPartIdx + ui); 580 pcCU->setVSPDir( uiAbsPartIdx + ui, vspDir); 581 } 478 582 #endif 479 583 pcCU->setPredictionMode( uiAbsPartIdx + ui, MODE_INTER ); … … 670 774 m_pcPrediction->motionCompensation( pcCU, m_ppcYuvReco[uiDepth] ); 671 775 #endif 672 #if H3D_IVRP 776 #if H3D_IVRP & !QC_ARP_D0177 673 777 if (pcCU->getMergeFlag(0) && pcCU->getMergeIndex(0)==0 && pcCU->getResPredAvail(0)) 674 778 { … … 1032 1136 // reconstruct residual based on mask + DC residuals 1033 1137 Pel apDCResiValues[2]; 1138 #if !MERL_General_Fix 1034 1139 Pel apDCRecoValues[2]; 1140 #endif 1035 1141 for( UInt ui = 0; ui < uiNumSegments; ui++ ) 1036 1142 { … … 1039 1145 Pel pRecoValue = GetIdx2DepthValue( pPredIdx + pResiIdx ); 1040 1146 1147 #if !MERL_General_Fix 1041 1148 apDCRecoValues[ui] = pRecoValue; 1149 #endif 1042 1150 apDCResiValues[ui] = pRecoValue - apDCPredValues[ui]; 1043 1151 } … … 1056 1164 UChar ucSegment = pMask?(UChar)pMask[uiX]:0; 1057 1165 assert( ucSegment < uiNumSegments ); 1166 #if MTK_SAMPLE_BASED_SDC_D0110 1167 Pel pResiDC = apDCResiValues[ucSegment]; 1058 1168 1169 pReco [ uiX ] = Clip( pPred[ uiX ] + pResiDC ); 1170 #else 1059 1171 Pel pPredVal= apDCPredValues[ucSegment]; 1060 1172 Pel pResiDC = apDCResiValues[ucSegment]; 1061 1173 1062 1174 pReco [ uiX ] = Clip( pPredVal + pResiDC ); 1175 #endif 1063 1176 pRecIPred[ uiX ] = pReco[ uiX ]; 1064 1177 } -
trunk/source/Lib/TLibDecoder/TDecCu.h
r296 r443 61 61 TComYuv** m_ppcYuvResi; ///< array of residual buffer 62 62 TComYuv** m_ppcYuvReco; ///< array of prediction & reconstruction buffer 63 #if H3D_IVRP 63 #if H3D_IVRP & !QC_ARP_D0177 64 64 TComYuv** m_ppcYuvResPred; ///< residual prediction buffer 65 65 #endif -
trunk/source/Lib/TLibDecoder/TDecEntropy.cpp
r332 r443 108 108 } 109 109 110 #if QC_ARP_D0177 111 Void TDecEntropy::decodeARPW( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, TComDataCU* pcSubCU, UInt uiPUIdx ) 112 { 113 if( pcCU->getSlice()->getViewId() == 0 || pcCU->getSlice()->getIsDepth() == true || !pcCU->getSlice()->getARPStepNum() ) 114 return; 115 assert( !pcCU->isIntra( uiAbsPartIdx ) ); 116 Bool bResPredAvailable = !pcCU->getSlice()->getARPStepNum() ? false: ((pcCU->getPartitionSize(uiAbsPartIdx)==SIZE_2Nx2N || pcCU->isSkipped(uiAbsPartIdx)) ? true: false); 117 if(!bResPredAvailable) 118 pcCU->setARPWSubParts( 0 , uiAbsPartIdx, uiDepth ); 119 else 120 m_pcEntropyDecoderIf->parseARPW( pcCU , uiAbsPartIdx , uiDepth ); 121 } 122 #endif 110 123 Void TDecEntropy::decodeSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 111 124 { … … 117 130 m_pcEntropyDecoderIf->parsePredMode( pcCU, uiAbsPartIdx, uiDepth ); 118 131 132 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 119 133 #if RWTH_SDC_DLT_B0036 120 134 // if B-Slice, code SDC flag later … … 125 139 } 126 140 #endif 141 #endif 127 142 } 128 143 129 144 Void TDecEntropy::decodePartSize( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 130 145 { 146 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 131 147 #if RWTH_SDC_DLT_B0036 132 148 if( !pcCU->getSlice()->isInterB() && pcCU->isIntra(uiAbsPartIdx) && pcCU->getSDCFlag(uiAbsPartIdx) ) … … 137 153 } 138 154 #endif 155 #endif 139 156 140 157 m_pcEntropyDecoderIf->parsePartSize( pcCU, uiAbsPartIdx, uiDepth ); 141 158 159 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 142 160 #if RWTH_SDC_DLT_B0036 143 161 if( pcCU->getSlice()->isInterB() && pcCU->getSlice()->getSPS()->isDepth() && pcCU->isIntra(uiAbsPartIdx) ) … … 154 172 } 155 173 #endif 174 #endif 156 175 } 157 176 158 177 Void TDecEntropy::decodePredInfo ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, TComDataCU* pcSubCU ) 159 178 { 179 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 160 180 #if RWTH_SDC_DLT_B0036 161 181 if( pcCU->getSDCFlag(uiAbsPartIdx) ) … … 164 184 return; 165 185 } 186 #endif 166 187 #endif 167 188 … … 178 199 decodeIntraDirModeLuma( pcCU, uiAbsPartIdx + uiPartOffset*2, uiDepth+1 ); 179 200 decodeIntraDirModeLuma( pcCU, uiAbsPartIdx + uiPartOffset*3, uiDepth+1 ); 201 #if PKU_QC_DEPTH_INTRA_UNI_D0195 202 if(!pcCU->getSDCFlag(uiAbsPartIdx)) 203 #endif 180 204 decodeIntraDirModeChroma( pcCU, uiAbsPartIdx, uiDepth ); 181 205 } … … 183 207 { 184 208 decodeIntraDirModeLuma ( pcCU, uiAbsPartIdx, uiDepth ); 209 #if PKU_QC_DEPTH_INTRA_UNI_D0195 210 if(!pcCU->getSDCFlag(uiAbsPartIdx)) 211 #endif 185 212 decodeIntraDirModeChroma( pcCU, uiAbsPartIdx, uiDepth ); 186 213 } … … 189 216 { 190 217 decodePUWise( pcCU, uiAbsPartIdx, uiDepth, pcSubCU ); 218 #if QC_ARP_D0177 219 if( pcCU->getSlice()->getSPS()->getUseAdvRP() ) 220 { 221 decodeARPW( pcCU , uiAbsPartIdx , uiDepth, pcSubCU, 0 ); 222 } 223 #endif 191 224 } 192 225 } … … 301 334 UInt uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx); 302 335 #if MERL_VSP_C0152 336 #if LGE_VSP_INHERIT_D0092 337 Int iVSPIndexTrue[MRG_MAX_NUM_CANDS_MEM]; 338 for (Int i=0; i<MRG_MAX_NUM_CANDS_MEM; i++) 339 { 340 iVSPIndexTrue[i] = 0; 341 } 342 #else 303 343 Int iVSPIndexTrue[3] = {-1, -1, -1}; 344 #endif 345 #if MERL_VSP_NBDV_RefVId_Fix_D0166 346 Int iVSPDirTrue[3] = {-1, -1, -1}; 347 pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, iVSPIndexTrue, iVSPDirTrue, uiMergeIndex ); 348 #else 304 349 pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, iVSPIndexTrue, uiMergeIndex ); 305 350 #endif 306 351 #if HHI_MPI 307 352 if(pcCU->getTextureModeDepth( uiSubPartIdx ) == uiDepth)//MPI is used … … 311 356 for( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) 312 357 { 313 Int vspIdx = pcTextureCU->getVSPIndex( uiAbsPartIdx + ui );358 Int vspIdx = pcTextureCU->getVSPIndex( uiAbsPartIdx + ui ); 314 359 pcCU->setVSPIndex( uiAbsPartIdx + ui, vspIdx); 360 #if MERL_VSP_NBDV_RefVId_Fix_D0166 361 Int vspDir = pcTextureCU->getVSPDir( uiAbsPartIdx + ui ); 362 pcCU->setVSPDir( uiAbsPartIdx + ui, vspDir); 363 #endif 315 364 } 316 365 } 317 366 else // MPI not used 318 367 #endif 368 #if MTK_D0156 369 if( !pcCU->getSlice()->getSPS()->getUseVSPCompensation() ) 370 { 371 pcCU->setVSPIndexSubParts( 0, uiSubPartIdx, uiPartIdx, uiDepth ); 372 } 373 else 374 #endif 319 375 { 320 376 Int iVSPIdx = 0; 377 #if LGE_VSP_INHERIT_D0092 378 if (iVSPIndexTrue[uiMergeIndex] == 1) 379 { 380 iVSPIdx = 1; 381 } 382 #else 321 383 Int numVspIdx; 322 384 numVspIdx = 3; … … 329 391 } 330 392 } 331 pcCU->setVSPIndexSubParts( iVSPIdx, uiSubPartIdx, uiPartIdx, uiDepth ); //Initialize the VSP, may change later in get InterMergeCandidates() 393 #endif 394 pcCU->setVSPIndexSubParts( iVSPIdx, uiSubPartIdx, uiPartIdx, uiDepth ); // Initialize 395 #if MERL_VSP_NBDV_RefVId_Fix_D0166 396 pcCU->setVSPDirSubParts( 0, uiSubPartIdx, uiPartIdx, uiDepth ); // Initialize 397 #endif 398 #if QC_BVSP_CleanUP_D0191 && !LGE_VSP_INHERIT_D0092 399 if(iVSPIdx != 0) 400 { 401 Int iIVCIdx = pcCU->getSlice()->getRefPic(REF_PIC_LIST_0, 0)->getPOC()==pcCU->getSlice()->getPOC() ? 0: pcCU->getSlice()->getNewRefIdx(REF_PIC_LIST_0); 402 cMvFieldNeighbours[ 2*uiMergeIndex].setRefIdx(iIVCIdx); 403 } 404 #endif 332 405 } 333 406 … … 479 552 { 480 553 #if H3D_IVMP 554 #if SEC_TWO_CANDIDATES_FOR_AMVP_D0122 555 const Int iNumAMVPCands = AMVP_MAX_NUM_CANDS; 556 #else 481 557 const Int iNumAMVPCands = AMVP_MAX_NUM_CANDS + ( pcSubCU->getSlice()->getSPS()->getMultiviewMvPredMode() ? 1 : 0 ); 558 #endif 482 559 m_pcEntropyDecoderIf->parseMVPIdx( iMVPIdx, iNumAMVPCands ); 483 560 #else … … 789 866 assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_U) == 1 ); 790 867 assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_V) == 1 ); 791 868 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 792 869 decodeSDCResidualData(pcCU, uiAbsPartIdx, uiDepth); 870 #endif 793 871 return; 794 872 } … … 847 925 848 926 #if RWTH_SDC_DLT_B0036 927 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 849 928 Void TDecEntropy::decodeSDCPredMode( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 850 929 { … … 861 940 m_pcEntropyDecoderIf->parseSDCFlag(pcCU, uiAbsPartIdx, uiDepth ); 862 941 } 863 942 #endif 864 943 Void TDecEntropy::decodeSDCResidualData( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 865 944 { -
trunk/source/Lib/TLibDecoder/TDecEntropy.h
r332 r443 106 106 virtual Void parseResPredFlag ( TComDataCU* pcCU, Bool& rbResPredFlag, UInt uiAbsPartIdx, UInt uiDepth ) = 0; 107 107 #endif 108 #if QC_ARP_D0177 109 virtual Void parseARPW ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0; 110 #endif 108 111 virtual Void parsePartSize ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0; 109 112 virtual Void parsePredMode ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0; … … 137 140 138 141 #if RWTH_SDC_DLT_B0036 142 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 139 143 virtual Void parseSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0; 140 144 virtual Void parseSDCPredMode ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0; 145 #endif 141 146 virtual Void parseSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPart ) = 0; 142 147 #endif … … 198 203 Void decodeMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx ); 199 204 Void decodeMergeIndex ( TComDataCU* pcSubCU, UInt uiPartIdx, UInt uiPartAddr, PartSize eCUMode, UChar* puhInterDirNeighbours, TComMvField* pcMvFieldNeighbours, UInt uiDepth ); 205 #if QC_ARP_D0177 206 Void decodeARPW ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, TComDataCU* pcSubCU, UInt uiPUIdx ); 207 #endif 200 208 Void decodePredMode ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 201 209 Void decodePartSize ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); … … 225 233 Void setSliceGranularity (Int iSliceGranularity) {m_pcEntropyDecoderIf->setSliceGranularity(iSliceGranularity);} 226 234 235 #if !LGE_SAO_MIGRATION_D0091 227 236 Void decodeSaoParam (SAOParam* saoParam); 228 237 void decodeSaoLcu(Int rx, Int ry, Int compIdx, SAOParam* saoParam, Bool &repeatedRow ); 229 238 Void decodeSaoOneLcu(SaoLcuParam* saoLcuParam); 239 #endif 230 240 231 241 Void decodeFlush() { m_pcEntropyDecoderIf->decodeFlush(); } 232 242 233 243 #if RWTH_SDC_DLT_B0036 244 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 234 245 Void decodeSDCPredMode( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 235 246 Void decodeSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 247 #endif 236 248 Void decodeSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 237 249 #endif -
trunk/source/Lib/TLibDecoder/TDecGop.cpp
r296 r443 93 93 ,TComDepthMapGenerator* pcDepthMapGenerator 94 94 #endif 95 #if H3D_IVRP 95 #if H3D_IVRP & !QC_ARP_D0177 96 96 ,TComResidualGenerator* pcResidualGenerator 97 97 #endif … … 109 109 m_pcDepthMapGenerator = pcDepthMapGenerator; 110 110 #endif 111 #if H3D_IVRP 111 #if H3D_IVRP & !QC_ARP_D0177 112 112 m_pcResidualGenerator = pcResidualGenerator; 113 113 #endif … … 298 298 m_pcDepthMapGenerator->predictDepthMap ( rpcPic ); 299 299 #endif 300 #if H3D_IVRP 300 #if H3D_IVRP & !QC_ARP_D0177 301 301 m_pcResidualGenerator->initViewComponent( rpcPic ); 302 302 #endif … … 331 331 else 332 332 { 333 #if H3D_IVRP 333 #if H3D_IVRP & !QC_ARP_D0177 334 334 // set residual picture 335 335 m_pcResidualGenerator->setRecResidualPic( rpcPic ); … … 372 372 if( pcSlice->getSPS()->getUseSAO() ) 373 373 { 374 #if LGE_SAO_MIGRATION_D0091 375 if(pcSlice->getSaoEnabledFlag()||pcSlice->getSaoEnabledFlagChroma()) 376 { 377 SAOParam *saoParam = pcSlice->getAPS()->getSaoParam(); 378 saoParam->bSaoFlag[0] = pcSlice->getSaoEnabledFlag(); 379 saoParam->bSaoFlag[1] = pcSlice->getSaoEnabledFlagChroma(); 380 m_pcSAO->setSaoLcuBasedOptimization(1); 381 m_pcSAO->createPicSaoInfo(rpcPic, m_uiILSliceCount); 382 m_pcSAO->SAOProcess(rpcPic, saoParam); 383 m_pcSAO->PCMLFDisableProcess(rpcPic); 384 m_pcSAO->destroyPicSaoInfo(); 385 } 386 #else 374 387 if(pcSlice->getSaoEnabledFlag()) 375 388 { … … 388 401 m_pcSAO->destroyPicSaoInfo(); 389 402 } 403 #endif 390 404 } 391 405 -
trunk/source/Lib/TLibDecoder/TDecGop.h
r296 r443 90 90 TComDepthMapGenerator* m_pcDepthMapGenerator; 91 91 #endif 92 #if H3D_IVRP 92 #if H3D_IVRP & !QC_ARP_D0177 93 93 TComResidualGenerator* m_pcResidualGenerator; 94 94 #endif … … 118 118 ,TComDepthMapGenerator* pcDepthMapGenerator 119 119 #endif 120 #if H3D_IVRP 120 #if H3D_IVRP & !QC_ARP_D0177 121 121 ,TComResidualGenerator* pcResidualGenerator 122 122 #endif -
trunk/source/Lib/TLibDecoder/TDecSbac.cpp
r332 r443 38 38 #include "TDecSbac.h" 39 39 40 #if RWTH_SDC_DLT_B003641 #define GetNumDepthValues() (pcCU->getSlice()->getSPS()->getNumDepthValues())42 #define GetBitsPerDepthValue() (pcCU->getSlice()->getSPS()->getBitsPerDepthValue())43 #endif44 45 40 //! \ingroup TLibDecoder 46 41 //! \{ … … 64 59 #if H3D_IVRP 65 60 , m_cResPredFlagSCModel ( 1, 1, NUM_RES_PRED_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 61 #endif 62 #if QC_ARP_D0177 63 , m_cCUPUARPW ( 1, 1, NUM_ARPW_CTX , m_contextModels + m_numContextModels, m_numContextModels) 66 64 #endif 67 65 , m_cCUPartSizeSCModel ( 1, 1, NUM_PART_SIZE_CTX , m_contextModels + m_numContextModels, m_numContextModels) … … 88 86 , m_cALFSvlcSCModel ( 1, 1, NUM_ALF_SVLC_CTX , m_contextModels + m_numContextModels, m_numContextModels) 89 87 , m_cCUAMPSCModel ( 1, 1, NUM_CU_AMP_CTX , m_contextModels + m_numContextModels, m_numContextModels) 88 #if LGE_SAO_MIGRATION_D0091 89 , m_cSaoMergeSCModel ( 1, 1, NUM_SAO_MERGE_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 90 , m_cSaoTypeIdxSCModel ( 1, 1, NUM_SAO_TYPE_IDX_CTX , m_contextModels + m_numContextModels, m_numContextModels) 91 #else 90 92 , m_cSaoFlagSCModel ( 1, 1, NUM_SAO_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 91 93 , m_cSaoUvlcSCModel ( 1, 1, NUM_SAO_UVLC_CTX , m_contextModels + m_numContextModels, m_numContextModels) … … 94 96 , m_cSaoMergeUpSCModel ( 1, 1, NUM_SAO_MERGE_UP_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 95 97 , m_cSaoTypeIdxSCModel ( 1, 1, NUM_SAO_TYPE_IDX_CTX , m_contextModels + m_numContextModels, m_numContextModels) 98 #endif 96 99 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 100 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 97 101 , m_cDmmFlagSCModel ( 1, 1, NUM_DMM_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 98 102 , m_cDmmModeSCModel ( 1, 1, NUM_DMM_MODE_CTX , m_contextModels + m_numContextModels, m_numContextModels) 103 #endif 99 104 , m_cDmmDataSCModel ( 1, 1, NUM_DMM_DATA_CTX , m_contextModels + m_numContextModels, m_numContextModels) 100 105 #endif … … 106 111 #endif 107 112 #if RWTH_SDC_DLT_B0036 113 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 108 114 , m_cSDCFlagSCModel ( 1, 1, SDC_NUM_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 115 #else 116 , m_cDepthModeModel ( 1, 1, DEPTH_MODE_NUM_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 117 , m_cDmmDeltaFlagModel ( 1, 1, DMM_DELTA_NUM_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 118 #endif 119 #if RWTH_SDC_CTX_SIMPL_D0032 120 , m_cSDCResidualFlagSCModel ( 1, 1, SDC_NUM_RESIDUAL_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 121 , m_cSDCResidualSCModel ( 1, 1, SDC_NUM_RESIDUAL_CTX , m_contextModels + m_numContextModels, m_numContextModels) 122 , m_cSDCPredModeSCModel ( 1, 3, SDC_NUM_PRED_MODE_CTX , m_contextModels + m_numContextModels, m_numContextModels) 123 #else 109 124 , m_cSDCResidualFlagSCModel ( 1, 2, SDC_NUM_RESIDUAL_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 110 125 , m_cSDCResidualSignFlagSCModel ( 1, 2, SDC_NUM_SIGN_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 111 126 , m_cSDCResidualSCModel ( 1, 2, SDC_NUM_RESIDUAL_CTX , m_contextModels + m_numContextModels, m_numContextModels) 112 127 , m_cSDCPredModeSCModel ( 1, 3, SDC_NUM_PRED_MODE_CTX , m_contextModels + m_numContextModels, m_numContextModels) 128 #endif 113 129 #endif 114 130 { … … 161 177 #if H3D_IVRP 162 178 m_cResPredFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_RES_PRED_FLAG ); 179 #endif 180 #if QC_ARP_D0177 181 m_cCUPUARPW.initBuffer ( sliceType, qp, (UChar*)INIT_ARPW ); 163 182 #endif 164 183 m_cCUAlfCtrlFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_ALF_CTRL_FLAG ); … … 184 203 m_cALFUvlcSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_ALF_UVLC ); 185 204 m_cALFSvlcSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_ALF_SVLC ); 205 #if LGE_SAO_MIGRATION_D0091 206 m_cSaoMergeSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SAO_MERGE_FLAG ); 207 m_cSaoTypeIdxSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SAO_TYPE_IDX ); 208 #else 186 209 m_cSaoFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SAO_FLAG ); 187 210 m_cSaoUvlcSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SAO_UVLC ); … … 190 213 m_cSaoMergeUpSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SAO_MERGE_UP_FLAG ); 191 214 m_cSaoTypeIdxSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SAO_TYPE_IDX ); 215 #endif 192 216 193 217 m_cCUTransSubdivFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_TRANS_SUBDIV_FLAG ); … … 200 224 m_uiLastDQpNonZero = 0; 201 225 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 226 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 202 227 m_cDmmFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_DMM_FLAG ); 203 228 m_cDmmModeSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_DMM_MODE ); 229 #endif 204 230 m_cDmmDataSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_DMM_DATA ); 205 231 #endif 206 232 #if RWTH_SDC_DLT_B0036 233 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 207 234 m_cSDCFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SDC_FLAG ); 235 #else 236 m_cDepthModeModel.initBuffer ( sliceType, qp, (UChar*)INIT_DEPTHMODE_FLAG ); 237 m_cDmmDeltaFlagModel.initBuffer ( sliceType, qp, (UChar*)INIT_DMMDELTA_FLAG ); 238 #endif 208 239 m_cSDCResidualFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SDC_RESIDUAL_FLAG ); 209 240 m_cSDCResidualSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SDC_RESIDUAL ); 241 #if !RWTH_SDC_CTX_SIMPL_D0032 210 242 m_cSDCResidualSignFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SDC_SIGN_FLAG ); 243 #endif 211 244 m_cSDCPredModeSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SDC_PRED_MODE ); 212 245 #endif … … 248 281 #if H3D_IVRP 249 282 m_cResPredFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_RES_PRED_FLAG ); 283 #endif 284 #if QC_ARP_D0177 285 m_cCUPUARPW.initBuffer ( eSliceType, iQp, (UChar*)INIT_ARPW ); 250 286 #endif 251 287 m_cCUAlfCtrlFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_ALF_CTRL_FLAG ); … … 271 307 m_cALFUvlcSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_ALF_UVLC ); 272 308 m_cALFSvlcSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_ALF_SVLC ); 309 #if LGE_SAO_MIGRATION_D0091 310 m_cSaoMergeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SAO_MERGE_FLAG ); 311 m_cSaoTypeIdxSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SAO_TYPE_IDX ); 312 #else 273 313 m_cSaoFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SAO_FLAG ); 274 314 m_cSaoUvlcSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SAO_UVLC ); … … 277 317 m_cSaoMergeUpSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SAO_MERGE_UP_FLAG ); 278 318 m_cSaoTypeIdxSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SAO_TYPE_IDX ); 319 #endif 279 320 m_cCUTransSubdivFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_TRANS_SUBDIV_FLAG ); 280 321 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 322 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 281 323 m_cDmmFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DMM_FLAG ); 282 324 m_cDmmModeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DMM_MODE ); 325 #endif 283 326 m_cDmmDataSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DMM_DATA ); 284 327 #endif 285 328 #if RWTH_SDC_DLT_B0036 329 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 286 330 m_cSDCFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_FLAG ); 331 #else 332 m_cDepthModeModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DEPTHMODE_FLAG ); 333 m_cDmmDeltaFlagModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DMMDELTA_FLAG ); 334 #endif 287 335 m_cSDCResidualFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL_FLAG ); 288 336 m_cSDCResidualSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL ); 337 #if !RWTH_SDC_CTX_SIMPL_D0032 289 338 m_cSDCResidualSignFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_SIGN_FLAG ); 339 #endif 290 340 m_cSDCPredModeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_PRED_MODE ); 291 341 #endif … … 869 919 pcCU->setPredModeSubParts( (PredMode)iPredMode, uiAbsPartIdx, uiDepth ); 870 920 } 871 921 #if PKU_QC_DEPTH_INTRA_UNI_D0195 922 Void TDecSbac::parseDepthIntraMode ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 923 { 924 UInt uiPuIdx = ( pcCU->getWidth(uiAbsPartIdx) == 64 )? 2 : ( ( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_NxN && pcCU->getWidth(uiAbsPartIdx) == 8 )? 0 : 1); 925 UInt uiDir = 0; 926 Bool bSDCFlag = 0; 927 UInt uiSymbol = 1; 928 UInt uiCode = 0 ; 929 UInt uiBinNum = 0; 930 UInt uiCtxDepthMode = 0; 931 if ( uiPuIdx ==2 ) 932 { 933 while(uiBinNum<2 && uiSymbol) 934 { 935 uiCtxDepthMode = uiPuIdx*3 + uiBinNum; 936 m_pcTDecBinIf->decodeBin(uiSymbol,m_cDepthModeModel.get(0,0,uiCtxDepthMode)); 937 uiCode = (uiCode<<1)+uiSymbol; 938 uiBinNum++; 939 } 940 if (uiCode == 0) { uiDir = PLANAR_IDX; bSDCFlag = 1;} 941 else if (uiCode == 2) { uiDir = 0; bSDCFlag = 0;} 942 else if (uiCode == 3) { uiDir = DC_IDX; bSDCFlag = 1;} 943 } 944 else if ( uiPuIdx ==0 ) 945 { 946 while(uiBinNum<3 && uiSymbol) 947 { 948 uiCtxDepthMode = uiPuIdx*3 + ( uiBinNum >= 2? 2 : uiBinNum ); 949 m_pcTDecBinIf->decodeBin(uiSymbol,m_cDepthModeModel.get(0,0,uiCtxDepthMode)); 950 uiCode = (uiCode<<1)+uiSymbol; 951 uiBinNum++; 952 } 953 if (uiCode == 0) { uiDir = 0; bSDCFlag = 0;} 954 else if (uiCode == 2) { uiDir = DMM_WEDGE_FULL_IDX; bSDCFlag = 0;} 955 else if (uiCode == 6) { uiDir = DMM_WEDGE_PREDTEX_IDX; bSDCFlag = 0;} 956 else if (uiCode == 7) { uiDir = EDGE_INTRA_IDX; bSDCFlag = 0;} 957 } 958 else 959 { 960 uiCtxDepthMode = uiPuIdx*3 ; 961 m_pcTDecBinIf->decodeBin(uiSymbol,m_cDepthModeModel.get(0,0,uiCtxDepthMode)); 962 uiCode = (uiCode<<1)+uiSymbol; 963 if (!uiSymbol) 964 { 965 uiCtxDepthMode = uiPuIdx*3 + 1; 966 m_pcTDecBinIf->decodeBin(uiSymbol,m_cDepthModeModel.get(0,0,uiCtxDepthMode)); 967 uiCode = (uiCode<<1)+uiSymbol; 968 if (uiSymbol) 969 { 970 uiCtxDepthMode = uiPuIdx*3 + 2; 971 m_pcTDecBinIf->decodeBin(uiSymbol,m_cDepthModeModel.get(0,0,uiCtxDepthMode)); 972 uiCode = (uiCode<<1)+uiSymbol; 973 } 974 } 975 else 976 { 977 uiCtxDepthMode = uiPuIdx*3 + 1; 978 m_pcTDecBinIf->decodeBin(uiSymbol,m_cDepthModeModel.get(0,0,uiCtxDepthMode)); 979 uiCode = (uiCode<<1)+uiSymbol; 980 if (!uiSymbol) 981 { 982 uiCtxDepthMode = uiPuIdx*3 + 2; 983 m_pcTDecBinIf->decodeBin(uiSymbol,m_cDepthModeModel.get(0,0,uiCtxDepthMode)); 984 uiCode = (uiCode<<1)+uiSymbol; 985 } 986 else 987 { 988 uiBinNum = 0; 989 while( uiSymbol && uiBinNum<3 ) 990 { 991 uiCtxDepthMode = uiPuIdx*3 + 2; 992 m_pcTDecBinIf->decodeBin(uiSymbol,m_cDepthModeModel.get(0,0,uiCtxDepthMode)); 993 uiCode = (uiCode<<1)+uiSymbol; 994 uiBinNum++; 995 } 996 } 997 } 998 if (uiCode == 0) { uiDir = PLANAR_IDX; bSDCFlag = 1;} 999 else if (uiCode == 2) { uiDir = 5; bSDCFlag = 0;} 1000 else if (uiCode == 3) { uiDir = DMM_WEDGE_FULL_IDX; bSDCFlag = 1;} 1001 else if (uiCode == 4) { uiDir = DMM_WEDGE_FULL_IDX; bSDCFlag = 0;} 1002 else if (uiCode == 5) { uiDir = DMM_CONTOUR_PREDTEX_IDX; bSDCFlag = 0;} 1003 else if (uiCode == 6) { uiDir = DMM_WEDGE_PREDTEX_IDX; bSDCFlag = 0;} 1004 else if (uiCode == 14) { uiDir = DC_IDX; bSDCFlag = 1;} 1005 else if (uiCode == 31) { uiDir = DMM_WEDGE_PREDDIR_IDX; bSDCFlag = 0;} 1006 else if (uiCode == 30) { uiDir = EDGE_INTRA_IDX; bSDCFlag = 0;} 1007 } 1008 pcCU->setLumaIntraDirSubParts( (UChar)uiDir, uiAbsPartIdx, uiDepth ); 1009 pcCU->setSDCFlagSubParts(bSDCFlag, uiAbsPartIdx, 0, uiDepth); 1010 } 1011 Void TDecSbac::parseDepthModelingTable ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 1012 { 1013 parseDepthIntraMode(pcCU,uiAbsPartIdx,uiDepth); 1014 1015 UInt uiDir = pcCU->getLumaIntraDir(uiAbsPartIdx); 1016 Bool bSdcFlag = pcCU->getSDCAvailable(uiAbsPartIdx) && pcCU->getSDCFlag(uiAbsPartIdx); 1017 Bool bDmmFlag = (uiDir >= NUM_INTRA_MODE && uiDir < EDGE_INTRA_IDX &&(!bSdcFlag))? 1:0; 1018 if (uiDir >= NUM_INTRA_MODE && uiDir < EDGE_INTRA_IDX)//DMM modes and SDC DMM1 1019 { 1020 if( uiDir == DMM_WEDGE_FULL_IDX ) { xParseWedgeFullInfo ( pcCU, uiAbsPartIdx, uiDepth ); } 1021 else if( uiDir == DMM_WEDGE_PREDTEX_IDX ) { xParseWedgePredTexInfo ( pcCU, uiAbsPartIdx, uiDepth ); } 1022 else if( uiDir == DMM_WEDGE_PREDDIR_IDX ) { xParseWedgePredDirInfo ( pcCU, uiAbsPartIdx, uiDepth ); } 1023 } 1024 else if(uiDir >= EDGE_INTRA_IDX)//CCM mode 1025 { 1026 xParseEdgeIntraInfo( pcCU, uiAbsPartIdx, uiDepth ); 1027 } 1028 1029 UInt uiSymbol; 1030 if (bDmmFlag) 1031 { 1032 if (bDmmFlag) 1033 { 1034 m_pcTDecBinIf->decodeBin( uiSymbol , m_cDmmDeltaFlagModel.get(0, 0, 0) ); 1035 uiDir += uiSymbol; 1036 } 1037 if (uiSymbol) 1038 { 1039 UInt uiDC; 1040 Int iDC = 0,iDC1 = 0,iDC2 = 0; 1041 for ( Int i = 0; i <2; i++ ) 1042 { 1043 xReadExGolombLevel( uiDC, m_cDmmDataSCModel.get(0, 0, 1) ); 1044 iDC = uiDC; 1045 if ( uiDC ) 1046 { 1047 UInt uiSign; 1048 m_pcTDecBinIf->decodeBinEP( uiSign ); 1049 if ( uiSign ) 1050 { 1051 iDC = -iDC; 1052 } 1053 } 1054 if ( i == 0 ) { iDC1 = iDC; } 1055 else { iDC2 = iDC; } 1056 } 1057 1058 if( uiDir == DMM_WEDGE_FULL_D_IDX ) 1059 { 1060 pcCU->setWedgeFullDeltaDC1SubParts( iDC1, uiAbsPartIdx, uiDepth ); 1061 pcCU->setWedgeFullDeltaDC2SubParts( iDC2, uiAbsPartIdx, uiDepth ); 1062 } 1063 else if( uiDir == DMM_WEDGE_PREDDIR_D_IDX ) 1064 { 1065 pcCU->setWedgePredDirDeltaDC1SubParts( iDC1, uiAbsPartIdx, uiDepth ); 1066 pcCU->setWedgePredDirDeltaDC2SubParts( iDC2, uiAbsPartIdx, uiDepth ); 1067 } 1068 else if( uiDir == DMM_WEDGE_PREDTEX_D_IDX) 1069 { 1070 pcCU->setWedgePredTexDeltaDC1SubParts( iDC1, uiAbsPartIdx, uiDepth ); 1071 pcCU->setWedgePredTexDeltaDC2SubParts( iDC2, uiAbsPartIdx, uiDepth ); 1072 } 1073 else if (uiDir== DMM_CONTOUR_PREDTEX_D_IDX ) 1074 { 1075 pcCU->setContourPredTexDeltaDC1SubParts( iDC1, uiAbsPartIdx, uiDepth ); 1076 pcCU->setContourPredTexDeltaDC2SubParts( iDC2, uiAbsPartIdx, uiDepth ); 1077 } 1078 } 1079 } 1080 else if (uiDir >= EDGE_INTRA_IDX) 1081 { 1082 m_pcTDecBinIf->decodeBin( uiSymbol, m_cEdgeIntraDeltaDCSCModel.get(0, 0, 0) ); 1083 if( uiSymbol ) 1084 { 1085 uiDir = EDGE_INTRA_DELTA_IDX; 1086 Int iDeltaDC = 0,iDeltaDC0 = 0,iDeltaDC1 = 0; 1087 for (Int i = 0; i<2; i++) 1088 { 1089 xReadExGolombLevel( (UInt &) iDeltaDC, m_cEdgeIntraDeltaDCSCModel.get(0, 0, 1) ); 1090 if( iDeltaDC != 0 ) 1091 { 1092 UInt uiSign; 1093 m_pcTDecBinIf->decodeBinEP( uiSign ); 1094 if ( uiSign ) 1095 { 1096 iDeltaDC = -iDeltaDC; 1097 } 1098 } 1099 if ( i == 0 ) { iDeltaDC0 = iDeltaDC; } 1100 else { iDeltaDC1 = iDeltaDC; } 1101 } 1102 1103 pcCU->setEdgeDeltaDC0( uiAbsPartIdx, iDeltaDC0 ); 1104 pcCU->setEdgeDeltaDC1( uiAbsPartIdx, iDeltaDC1 ); 1105 } 1106 } 1107 else if(bSdcFlag)//SDC mode 1108 { 1109 assert(pcCU->getPartitionSize(uiAbsPartIdx)!=SIZE_NxN); 1110 pcCU->setTrIdxSubParts(0, uiAbsPartIdx, uiDepth); 1111 pcCU->setCbfSubParts(1, 1, 1, uiAbsPartIdx, uiDepth); 1112 1113 UInt uiNumSegments = ( uiDir == DC_IDX || uiDir == PLANAR_IDX )? 1 : 2; 1114 for (int uiSeg=0; uiSeg<uiNumSegments; uiSeg++) 1115 { 1116 parseSDCResidualData(pcCU, uiAbsPartIdx, uiDepth, uiSeg); 1117 } 1118 } 1119 1120 pcCU->setLumaIntraDirSubParts( (UChar)uiDir, uiAbsPartIdx, uiDepth ); 1121 } 1122 #endif 872 1123 Void TDecSbac::parseIntraDirLumaAng ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 873 1124 { 874 1125 UInt uiSymbol; 875 1126 Int intraPredMode; 876 1127 #if PKU_QC_DEPTH_INTRA_UNI_D0195 1128 if (pcCU->getSlice()->getSPS()->isDepth()) 1129 { 1130 parseDepthModelingTable(pcCU, uiAbsPartIdx, uiDepth); 1131 } 1132 if (pcCU->getLumaIntraDir(uiAbsPartIdx)<NUM_INTRA_MODE && !pcCU->getSDCFlag(uiAbsPartIdx)) 1133 { 1134 #else 877 1135 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 878 1136 UInt uiFlag = 0; … … 928 1186 } 929 1187 #endif 930 1188 #endif 931 1189 Int uiPreds[3] = {-1, -1, -1}; 932 1190 Int uiPredNum = pcCU->getIntraDirLumaPredictor(uiAbsPartIdx, uiPreds); 1191 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 933 1192 #if LGE_EDGE_INTRA_A0070 934 1193 UInt uiCheckBit = 0; 935 1194 #endif 1195 #endif 936 1196 937 1197 m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUIntraPredSCModel.get( 0, 0, 0) ); … … 953 1213 954 1214 m_pcTDecBinIf->decodeBinsEP( uiSymbol, 5 ); 1215 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 955 1216 #if LGE_EDGE_INTRA_A0070 956 1217 if (bCodeEdgeIntra) … … 963 1224 } 964 1225 } 1226 #endif 965 1227 #endif 966 1228 intraPredMode = uiSymbol; … … 979 1241 std::swap(uiPreds[1], uiPreds[2]); 980 1242 } 1243 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 981 1244 #if LGE_EDGE_INTRA_A0070 982 1245 if ( intraPredMode != EDGE_INTRA_IDX) 983 1246 { 984 1247 #endif 1248 #endif 985 1249 for ( Int i = 0; i < uiPredNum; i++ ) 986 1250 { 987 1251 intraPredMode += ( intraPredMode >= uiPreds[i] ); 988 1252 } 1253 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 989 1254 #if LGE_EDGE_INTRA_A0070 990 1255 } 991 1256 #endif 992 } 993 1257 #endif 1258 } 1259 1260 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 994 1261 #if LGE_EDGE_INTRA_A0070 995 1262 if( intraPredMode == EDGE_INTRA_IDX ) … … 1035 1302 } 1036 1303 #endif 1037 1038 1304 pcCU->setLumaIntraDirSubParts( (UChar)intraPredMode, uiAbsPartIdx, uiDepth ); 1305 #else 1306 pcCU->setLumaIntraDirSubParts( (UChar)intraPredMode, uiAbsPartIdx, uiDepth ); 1307 } 1308 #endif 1039 1309 } 1040 1310 … … 1672 1942 } 1673 1943 1674 1944 #if LGE_SAO_MIGRATION_D0091 1945 Void TDecSbac::parseSaoMaxUvlc ( UInt& val, UInt maxSymbol ) 1946 { 1947 if (maxSymbol == 0) 1948 { 1949 val = 0; 1950 return; 1951 } 1952 1953 UInt code; 1954 Int i; 1955 m_pcTDecBinIf->decodeBinEP( code ); 1956 if ( code == 0 ) 1957 { 1958 val = 0; 1959 return; 1960 } 1961 1962 i=1; 1963 while (1) 1964 { 1965 m_pcTDecBinIf->decodeBinEP( code ); 1966 if ( code == 0 ) 1967 { 1968 break; 1969 } 1970 i++; 1971 if (i == maxSymbol) 1972 { 1973 break; 1974 } 1975 } 1976 1977 val = i; 1978 } 1979 1980 Void TDecSbac::parseSaoUflc (UInt uiLength, UInt& riVal) 1981 { 1982 m_pcTDecBinIf->decodeBinsEP ( riVal, uiLength ); 1983 } 1984 1985 Void TDecSbac::parseSaoMerge (UInt& ruiVal) 1986 { 1987 UInt uiCode; 1988 m_pcTDecBinIf->decodeBin( uiCode, m_cSaoMergeSCModel.get( 0, 0, 0 ) ); 1989 ruiVal = (Int)uiCode; 1990 } 1991 1992 Void TDecSbac::parseSaoTypeIdx (UInt& ruiVal) 1993 { 1994 UInt uiCode; 1995 m_pcTDecBinIf->decodeBin( uiCode, m_cSaoTypeIdxSCModel.get( 0, 0, 0 ) ); 1996 if (uiCode == 0) 1997 { 1998 ruiVal = 0; 1999 } 2000 else 2001 { 2002 m_pcTDecBinIf->decodeBinEP( uiCode ); 2003 if (uiCode == 0) 2004 { 2005 ruiVal = 5; 2006 } 2007 else 2008 { 2009 ruiVal = 1; 2010 } 2011 } 2012 } 2013 2014 inline Void copySaoOneLcuParam(SaoLcuParam* psDst, SaoLcuParam* psSrc) 2015 { 2016 Int i; 2017 psDst->partIdx = psSrc->partIdx; 2018 psDst->typeIdx = psSrc->typeIdx; 2019 if (psDst->typeIdx != -1) 2020 { 2021 psDst->subTypeIdx = psSrc->subTypeIdx ; 2022 psDst->length = psSrc->length; 2023 for (i=0;i<psDst->length;i++) 2024 { 2025 psDst->offset[i] = psSrc->offset[i]; 2026 } 2027 } 2028 else 2029 { 2030 psDst->length = 0; 2031 for (i=0;i<SAO_BO_LEN;i++) 2032 { 2033 psDst->offset[i] = 0; 2034 } 2035 } 2036 } 2037 2038 Void TDecSbac::parseSaoOffset(SaoLcuParam* psSaoLcuParam, UInt compIdx) 2039 { 2040 UInt uiSymbol; 2041 static Int iTypeLength[MAX_NUM_SAO_TYPE] = 2042 { 2043 SAO_EO_LEN, 2044 SAO_EO_LEN, 2045 SAO_EO_LEN, 2046 SAO_EO_LEN, 2047 SAO_BO_LEN 2048 }; 2049 2050 if (compIdx==2) 2051 { 2052 uiSymbol = (UInt)( psSaoLcuParam->typeIdx + 1); 2053 } 2054 else 2055 { 2056 parseSaoTypeIdx(uiSymbol); 2057 } 2058 psSaoLcuParam->typeIdx = (Int)uiSymbol - 1; 2059 2060 if (uiSymbol) 2061 { 2062 psSaoLcuParam->length = iTypeLength[psSaoLcuParam->typeIdx]; 2063 #if FULL_NBIT 2064 Int offsetTh = 1 << ( min((Int)(g_uiBitDepth + (g_uiBitDepth-8)-5),5) ); 2065 #else 2066 Int offsetTh = 1 << ( min((Int)(g_uiBitDepth + g_uiBitIncrement-5),5) ); 2067 #endif 2068 2069 if( psSaoLcuParam->typeIdx == SAO_BO ) 2070 { 2071 for(Int i=0; i< psSaoLcuParam->length; i++) 2072 { 2073 parseSaoMaxUvlc(uiSymbol, offsetTh -1 ); 2074 psSaoLcuParam->offset[i] = uiSymbol; 2075 } 2076 for(Int i=0; i< psSaoLcuParam->length; i++) 2077 { 2078 if (psSaoLcuParam->offset[i] != 0) 2079 { 2080 m_pcTDecBinIf->decodeBinEP ( uiSymbol); 2081 if (uiSymbol) 2082 { 2083 psSaoLcuParam->offset[i] = -psSaoLcuParam->offset[i] ; 2084 } 2085 } 2086 } 2087 parseSaoUflc(5, uiSymbol ); 2088 psSaoLcuParam->subTypeIdx = uiSymbol; 2089 } 2090 else if( psSaoLcuParam->typeIdx < 4 ) 2091 { 2092 parseSaoMaxUvlc(uiSymbol, offsetTh -1 ); psSaoLcuParam->offset[0] = uiSymbol; 2093 parseSaoMaxUvlc(uiSymbol, offsetTh -1 ); psSaoLcuParam->offset[1] = uiSymbol; 2094 parseSaoMaxUvlc(uiSymbol, offsetTh -1 ); psSaoLcuParam->offset[2] = -(Int)uiSymbol; 2095 parseSaoMaxUvlc(uiSymbol, offsetTh -1 ); psSaoLcuParam->offset[3] = -(Int)uiSymbol; 2096 if (compIdx != 2) 2097 { 2098 parseSaoUflc(2, uiSymbol ); 2099 psSaoLcuParam->subTypeIdx = uiSymbol; 2100 psSaoLcuParam->typeIdx += psSaoLcuParam->subTypeIdx; 2101 } 2102 } 2103 } 2104 else 2105 { 2106 psSaoLcuParam->length = 0; 2107 } 2108 } 2109 2110 Void TDecSbac::parseSaoOneLcuInterleaving(Int rx, Int ry, SAOParam* pSaoParam, TComDataCU* pcCU, Int iCUAddrInSlice, Int iCUAddrUpInSlice, Int allowMergeLeft, Int allowMergeUp) 2111 { 2112 Int iAddr = pcCU->getAddr(); 2113 UInt uiSymbol; 2114 2115 for (Int iCompIdx=0; iCompIdx<3; iCompIdx++) 2116 { 2117 pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeUpFlag = 0; 2118 pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeLeftFlag = 0; 2119 pSaoParam->saoLcuParam[iCompIdx][iAddr].subTypeIdx = 0; 2120 pSaoParam->saoLcuParam[iCompIdx][iAddr].typeIdx =-1; 2121 pSaoParam->saoLcuParam[iCompIdx][iAddr].offset[0] = 0; 2122 pSaoParam->saoLcuParam[iCompIdx][iAddr].offset[1] = 0; 2123 pSaoParam->saoLcuParam[iCompIdx][iAddr].offset[2] = 0; 2124 pSaoParam->saoLcuParam[iCompIdx][iAddr].offset[3] = 0; 2125 } 2126 if (pSaoParam->bSaoFlag[0] || pSaoParam->bSaoFlag[1] ) 2127 { 2128 if (rx>0 && iCUAddrInSlice!=0 && allowMergeLeft) 2129 { 2130 parseSaoMerge(uiSymbol); 2131 pSaoParam->saoLcuParam[0][iAddr].mergeLeftFlag = (Bool)uiSymbol; 2132 } 2133 if (pSaoParam->saoLcuParam[0][iAddr].mergeLeftFlag==0) 2134 { 2135 if ((ry > 0) && (iCUAddrUpInSlice>=0) && allowMergeUp) 2136 { 2137 parseSaoMerge(uiSymbol); 2138 pSaoParam->saoLcuParam[0][iAddr].mergeUpFlag = (Bool)uiSymbol; 2139 } 2140 } 2141 } 2142 2143 for (Int iCompIdx=0; iCompIdx<3; iCompIdx++) 2144 { 2145 if ((iCompIdx == 0 && pSaoParam->bSaoFlag[0]) || (iCompIdx > 0 && pSaoParam->bSaoFlag[1]) ) 2146 { 2147 if (rx>0 && iCUAddrInSlice!=0 && allowMergeLeft) 2148 { 2149 pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeLeftFlag = pSaoParam->saoLcuParam[0][iAddr].mergeLeftFlag; 2150 } 2151 else 2152 { 2153 pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeLeftFlag = 0; 2154 } 2155 2156 if (pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeLeftFlag==0) 2157 { 2158 if ((ry > 0) && (iCUAddrUpInSlice>=0) && allowMergeUp) 2159 { 2160 pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeUpFlag = pSaoParam->saoLcuParam[0][iAddr].mergeUpFlag; 2161 } 2162 else 2163 { 2164 pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeUpFlag = 0; 2165 } 2166 2167 if (!pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeUpFlag) 2168 { 2169 pSaoParam->saoLcuParam[2][iAddr].typeIdx = pSaoParam->saoLcuParam[1][iAddr].typeIdx; 2170 parseSaoOffset(&(pSaoParam->saoLcuParam[iCompIdx][iAddr]), iCompIdx); 2171 } 2172 else 2173 { 2174 copySaoOneLcuParam(&pSaoParam->saoLcuParam[iCompIdx][iAddr], &pSaoParam->saoLcuParam[iCompIdx][iAddr-pSaoParam->numCuInWidth]); 2175 } 2176 } 2177 else 2178 { 2179 copySaoOneLcuParam(&pSaoParam->saoLcuParam[iCompIdx][iAddr], &pSaoParam->saoLcuParam[iCompIdx][iAddr-1]); 2180 } 2181 } 2182 else 2183 { 2184 pSaoParam->saoLcuParam[iCompIdx][iAddr].typeIdx = -1; 2185 pSaoParam->saoLcuParam[iCompIdx][iAddr].subTypeIdx = 0; 2186 } 2187 } 2188 } 2189 #else 1675 2190 Void TDecSbac::parseSaoUvlc (UInt& ruiVal) 1676 2191 { … … 1909 2424 } 1910 2425 } 1911 2426 #endif 1912 2427 /** 1913 2428 - Initialize our contexts from the nominated source. … … 2235 2750 } 2236 2751 #endif 2237 2752 #if QC_ARP_D0177 2753 Void TDecSbac::parseARPW( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 2754 { 2755 UInt nMaxW = pcCU->getSlice()->getARPStepNum() - 1; 2756 #if !QC_ARP_WARNING_FIX 2757 assert (nMaxW >= 0); 2758 #endif 2759 UInt nW = 0; 2760 if( nMaxW > 0 ) 2761 { 2762 UInt nOffset = pcCU->getCTXARPWFlag(uiAbsPartIdx); 2763 #if !QC_ARP_WARNING_FIX 2764 assert( 0 <= nOffset && nOffset <= 2 ); 2765 #endif 2766 UInt uiCode = 0; 2767 m_pcTDecBinIf->decodeBin( uiCode , m_cCUPUARPW.get( 0, 0, 0 + nOffset ) ); 2768 nW = uiCode; 2769 if( nW == 1 ) 2770 { 2771 m_pcTDecBinIf->decodeBin( uiCode , m_cCUPUARPW.get( 0, 0, 3 ) ); 2772 nW += ( uiCode == 1 ); 2773 } 2774 } 2775 pcCU->setARPWSubParts( ( UChar )( nW ) , uiAbsPartIdx, uiDepth ); 2776 } 2777 #endif 2238 2778 #if LGE_EDGE_INTRA_A0070 2239 2779 Void TDecSbac::xParseEdgeIntraInfo( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) … … 2335 2875 2336 2876 #if RWTH_SDC_DLT_B0036 2877 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 2337 2878 Void TDecSbac::parseSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 2338 2879 { … … 2367 2908 { 2368 2909 UInt uiIsMostProb = 0; 2910 #if INTEL_SDC64_D0193 2911 if( !(pcCU->getWidth(uiAbsPartIdx) == 64 && i == 1)) 2912 #endif 2369 2913 m_pcTDecBinIf->decodeBin( uiIsMostProb, m_cSDCPredModeSCModel.get( 0, i, uiCtx ) ); 2370 2914 … … 2385 2929 pcCU->setLumaIntraDirSubParts((UChar)intraPredMode, uiAbsPartIdx, uiDepth); 2386 2930 } 2931 #endif 2387 2932 2388 2933 Void TDecSbac::parseSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiSegment ) … … 2398 2943 Int iIdx = 0; 2399 2944 2400 UInt uiMaxResidualBits = GetBitsPerDepthValue();2945 UInt uiMaxResidualBits = pcCU->getSlice()->getSPS()->getBitsPerDepthValue(); 2401 2946 assert( uiMaxResidualBits <= g_uiBitDepth ); 2402 2947 2948 #if RWTH_SDC_CTX_SIMPL_D0032 2949 m_pcTDecBinIf->decodeBin(uiResidual, m_cSDCResidualFlagSCModel.get( 0, 0, 0 ) ); 2950 #else 2403 2951 m_pcTDecBinIf->decodeBin(uiResidual, m_cSDCResidualFlagSCModel.get( 0, uiSegment, 0 ) ); 2952 #endif 2404 2953 2405 2954 if (uiResidual) 2406 2955 { 2407 2956 // decode residual sign bit 2957 #if RWTH_SDC_CTX_SIMPL_D0032 2958 m_pcTDecBinIf->decodeBinEP(uiSign); 2959 #else 2408 2960 m_pcTDecBinIf->decodeBin(uiSign, m_cSDCResidualSignFlagSCModel.get( 0, uiSegment, 0 ) ); 2961 #endif 2409 2962 2410 2963 // decode residual magnitude 2964 #if LGE_CONCATENATE_D0141 2965 //prefix part 2966 UInt uiCount = 0; 2967 UInt uiNumDepthValues = pcCU->getSlice()->getSPS()->getNumDepthValues(); 2968 UInt uiPrefixThreshold = ((uiNumDepthValues * 3) >> 2); 2969 for ( UInt ui = 0; ui < uiPrefixThreshold; ui++) 2970 { 2971 m_pcTDecBinIf->decodeBin( uiBit, m_cSDCResidualSCModel.get(0, 0, 0) ); 2972 if ( uiBit == 0 ) 2973 break; 2974 else 2975 uiCount++; 2976 } 2977 //suffix part 2978 if ( uiCount == uiPrefixThreshold ) 2979 { 2980 for ( UInt ui = 0; ui < ( (UInt)ceil( Log2(uiNumDepthValues - uiPrefixThreshold) ) ); ui++ ) 2981 { 2982 m_pcTDecBinIf->decodeBinEP( uiBit ); 2983 uiAbsIdx |= uiBit << ui; 2984 } 2985 uiAbsIdx += uiCount; 2986 } 2987 else 2988 uiAbsIdx = uiCount; 2989 #else 2411 2990 for (Int i=0; i<uiMaxResidualBits; i++) 2412 2991 { 2992 #if RWTH_SDC_CTX_SIMPL_D0032 2993 m_pcTDecBinIf->decodeBin(uiBit, m_cSDCResidualSCModel.get( 0, 0, i ) ); 2994 #else 2413 2995 m_pcTDecBinIf->decodeBin(uiBit, m_cSDCResidualSCModel.get( 0, uiSegment, i ) ); 2996 #endif 2414 2997 uiAbsIdx |= uiBit << i; 2415 2998 } 2999 #endif 2416 3000 2417 3001 uiAbsIdx += 1; -
trunk/source/Lib/TLibDecoder/TDecSbac.h
r332 r443 110 110 #endif 111 111 112 #if LGE_SAO_MIGRATION_D0091 113 Void parseSaoMaxUvlc ( UInt& val, UInt maxSymbol ); 114 Void parseSaoMerge ( UInt& ruiVal ); 115 Void parseSaoTypeIdx ( UInt& ruiVal ); 116 Void parseSaoUflc ( UInt uiLength, UInt& ruiVal ); 117 Void parseSaoOneLcuInterleaving(Int rx, Int ry, SAOParam* pSaoParam, TComDataCU* pcCU, Int iCUAddrInSlice, Int iCUAddrUpInSlice, Int allowMergeLeft, Int allowMergeUp); 118 Void parseSaoOffset (SaoLcuParam* psSaoLcuParam, UInt compIdx); 119 #else 112 120 Void parseSaoUvlc ( UInt& ruiVal ); 113 121 Void parseSaoSvlc ( Int& riVal ); … … 118 126 Void parseSaoOneLcuInterleaving(Int rx, Int ry, SAOParam* pSaoParam, TComDataCU* pcCU, Int iCUAddrInSlice, Int iCUAddrUpInSlice, Bool bLFCrossSliceBoundaryFlag); 119 127 Void parseSaoOffset (SaoLcuParam* psSaoLcuParam); 128 #endif 120 129 121 130 #if RWTH_SDC_DLT_B0036 131 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 122 132 Void parseSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 123 133 Void parseSDCPredMode ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 134 #endif 124 135 Void parseSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPart ); 125 136 #endif … … 176 187 Void parseResPredFlag ( TComDataCU* pcCU, Bool& rbResPredFlag, UInt uiAbsPartIdx, UInt uiDepth ); 177 188 #endif 189 #if QC_ARP_D0177 190 Void parseARPW ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 191 #endif 178 192 Void parsePartSize ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 179 193 Void parsePredMode ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 180 194 #if PKU_QC_DEPTH_INTRA_UNI_D0195 195 Void parseDepthIntraMode ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 196 Void parseDepthModelingTable( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 197 #endif 181 198 Void parseIntraDirLumaAng( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 182 199 … … 218 235 #if H3D_IVRP 219 236 ContextModel3DBuffer m_cResPredFlagSCModel; 237 #endif 238 #if QC_ARP_D0177 239 ContextModel3DBuffer m_cCUPUARPW; 220 240 #endif 221 241 ContextModel3DBuffer m_cCUPartSizeSCModel; … … 245 265 ContextModel3DBuffer m_cALFSvlcSCModel; 246 266 ContextModel3DBuffer m_cCUAMPSCModel; 267 #if LGE_SAO_MIGRATION_D0091 268 ContextModel3DBuffer m_cSaoMergeSCModel; 269 ContextModel3DBuffer m_cSaoTypeIdxSCModel; 270 #else 247 271 ContextModel3DBuffer m_cSaoFlagSCModel; 248 272 ContextModel3DBuffer m_cSaoUvlcSCModel; … … 251 275 ContextModel3DBuffer m_cSaoMergeUpSCModel; 252 276 ContextModel3DBuffer m_cSaoTypeIdxSCModel; 277 #endif 253 278 254 279 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 280 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 255 281 ContextModel3DBuffer m_cDmmFlagSCModel; 256 282 ContextModel3DBuffer m_cDmmModeSCModel; 283 #endif 257 284 ContextModel3DBuffer m_cDmmDataSCModel; 258 285 #endif … … 265 292 266 293 #if RWTH_SDC_DLT_B0036 294 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 267 295 ContextModel3DBuffer m_cSDCFlagSCModel; 296 #else 297 ContextModel3DBuffer m_cDepthModeModel; 298 ContextModel3DBuffer m_cDmmDeltaFlagModel; 299 #endif 268 300 269 301 ContextModel3DBuffer m_cSDCResidualFlagSCModel; 302 #if !RWTH_SDC_CTX_SIMPL_D0032 270 303 ContextModel3DBuffer m_cSDCResidualSignFlagSCModel; 304 #endif 271 305 ContextModel3DBuffer m_cSDCResidualSCModel; 272 306 -
trunk/source/Lib/TLibDecoder/TDecSlice.cpp
r296 r443 286 286 g_bJustDoIt = g_bEncDecTraceEnable; 287 287 #endif 288 #if LGE_SAO_MIGRATION_D0091 289 if ( pcSlice->getSPS()->getUseSAO() && (pcSlice->getSaoEnabledFlag()||pcSlice->getSaoEnabledFlagChroma()) ) 290 { 291 SAOParam *saoParam = pcSlice->getAPS()->getSaoParam(); 292 saoParam->bSaoFlag[0] = pcSlice->getSaoEnabledFlag(); 293 if (iCUAddr == iStartCUAddr) 294 { 295 saoParam->bSaoFlag[1] = pcSlice->getSaoEnabledFlagChroma(); 296 } 297 Int numCuInWidth = saoParam->numCuInWidth; 298 Int cuAddrInSlice = iCUAddr - rpcPic->getPicSym()->getCUOrderMap(pcSlice->getSliceCurStartCUAddr()/rpcPic->getNumPartInCU()); 299 Int cuAddrUpInSlice = cuAddrInSlice - numCuInWidth; 300 Int rx = iCUAddr % numCuInWidth; 301 Int ry = iCUAddr / numCuInWidth; 302 Int allowMergeLeft = 1; 303 Int allowMergeUp = 1; 304 if (rx!=0) 305 { 306 if (rpcPic->getPicSym()->getTileIdxMap(iCUAddr-1) != rpcPic->getPicSym()->getTileIdxMap(iCUAddr)) 307 { 308 allowMergeLeft = 0; 309 } 310 } 311 if (ry!=0) 312 { 313 if (rpcPic->getPicSym()->getTileIdxMap(iCUAddr-numCuInWidth) != rpcPic->getPicSym()->getTileIdxMap(iCUAddr)) 314 { 315 allowMergeUp = 0; 316 } 317 } 318 pcSbacDecoder->parseSaoOneLcuInterleaving(rx, ry, saoParam,pcCU, cuAddrInSlice, cuAddrUpInSlice, allowMergeLeft, allowMergeUp); 319 } 320 #else 288 321 if ( pcSlice->getSPS()->getUseSAO() && pcSlice->getSaoInterleavingFlag() && pcSlice->getSaoEnabledFlag() ) 289 322 { … … 301 334 pcSbacDecoder->parseSaoOneLcuInterleaving(rx, ry, pcSlice->getAPS()->getSaoParam(),pcCU, cuAddrInSlice, cuAddrUpInSlice, pcSlice->getSPS()->getLFCrossSliceBoundaryFlag() ); 302 335 } 336 #endif 303 337 304 338 m_pcCuDecoder->decodeCU ( pcCU, uiIsLast ); -
trunk/source/Lib/TLibDecoder/TDecTop.cpp
r332 r443 403 403 m_cDepthMapGenerator.destroy(); 404 404 #endif 405 #if H3D_IVRP 405 #if H3D_IVRP & !QC_ARP_D0177 406 406 m_cResidualGenerator.destroy(); 407 407 #endif … … 420 420 , &m_cDepthMapGenerator 421 421 #endif 422 #if H3D_IVRP 422 #if H3D_IVRP & !QC_ARP_D0177 423 423 , &m_cResidualGenerator 424 424 #endif … … 434 434 #endif 435 435 #endif 436 #if H3D_IVRP 436 #if H3D_IVRP & !QC_ARP_D0177 437 437 m_cResidualGenerator.init( &m_cTrQuant, &m_cDepthMapGenerator ); 438 438 #endif … … 860 860 } 861 861 #endif 862 #if H3D_IVRP 862 #if H3D_IVRP & !QC_ARP_D0177 863 863 m_cResidualGenerator.create( true, m_apcSlicePilot->getSPS()->getPicWidthInLumaSamples(), m_apcSlicePilot->getSPS()->getPicHeightInLumaSamples(), g_uiMaxCUDepth, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiBitDepth + g_uiBitIncrement ); 864 864 #endif … … 1083 1083 std::vector<TComPic*> apcInterViewRefPics = m_tAppDecTop->getInterViewRefPics( m_viewId, pcSlice->getPOC(), m_isDepth, pcSlice->getSPS() ); 1084 1084 pcSlice->setRefPicListMvc( m_cListPic, apcInterViewRefPics ); 1085 1085 #if QC_ARP_D0177 1086 //pcSlice->setBaseViewRefPicList( m_tAppDecTop->getTDecTop( 0 , false )->getListPic() ); 1087 pcSlice->setARPStepNum(); 1088 if(pcSlice->getARPStepNum() > 1) 1089 { 1090 for(Int iViewIdx = 0; iViewIdx < pcSlice->getViewId(); iViewIdx ++ ) 1091 pcSlice->setBaseViewRefPicList( m_tAppDecTop->getTDecTop( iViewIdx, false )->getListPic(), iViewIdx ); 1092 } 1093 #endif 1086 1094 // For generalized B 1087 1095 // note: maybe not existed case (always L0 is copied to L1 if L1 is empty) … … 1214 1222 pcSlice->setRefPicBaseDepth(pcBaseDepthPic); 1215 1223 } 1224 #if !MERL_VSP_NBDV_RefVId_Fix_D0166 1216 1225 getTAppDecTop()->setBWVSPLUT( pcSlice, pcSlice->getViewId(), pcSlice->getPOC() ); // get the LUT for backward warping 1226 #else 1227 if (pcSlice->getViewId() != 0) 1228 { 1229 Bool isDepth = true; 1230 for(Int refviewId = 0; refviewId < (pcSlice->getViewId()); refviewId++) 1231 { 1232 if (m_tAppDecTop->getTDecTop( refviewId, isDepth )) 1233 { 1234 pcSlice->setListDepthPic(m_tAppDecTop->getTDecTop( refviewId, isDepth )->getListPic(), refviewId); // The list will store only the depth pictures 1235 } 1236 getTAppDecTop()->setBWVSPLUT( refviewId, pcSlice, pcSlice->getViewId(), pcSlice->getPOC() ); // get the LUT for backward warping 1237 } 1238 } 1239 #endif 1217 1240 #endif 1218 1241 -
trunk/source/Lib/TLibDecoder/TDecTop.h
r296 r443 213 213 TComDepthMapGenerator m_cDepthMapGenerator; 214 214 #endif 215 #if H3D_IVRP 215 #if H3D_IVRP & !QC_ARP_D0177 216 216 TComResidualGenerator m_cResidualGenerator; 217 217 #endif -
trunk/source/Lib/TLibEncoder/TEncCavlc.cpp
r332 r443 711 711 WRITE_UVLC( pcSPS->getMultiviewMvPredMode(), "multi_view_mv_pred_mode" ); 712 712 #endif 713 #if H3D_IVRP 713 #if H3D_IVRP & !QC_ARP_D0177 714 714 WRITE_FLAG ( pcSPS->getMultiviewResPredMode(), "multi_view_residual_pred_mode" ); 715 715 #endif 716 716 } 717 717 #endif 718 } 718 #if QC_ARP_D0177 719 WRITE_FLAG( pcSPS->getUseAdvRP () ? 1 : 0, "advanced_residual_pred_flag" ); 720 #endif 721 } 722 723 #if MTK_D0156 724 #if MERL_VSP_COMPENSATION_C0152 725 WRITE_FLAG( pcSPS->getUseVSPCompensation() ? 1 : 0, "view_synthesis_pred_flag" ); 726 #endif 727 728 WRITE_FLAG( pcSPS->getUseDVPRefine() ? 1 : 0, "dv_refine_flag" ); 729 #endif 719 730 } 720 731 else … … 790 801 WRITE_FLAG( pcSlice->getApplyIC() ? 1 : 0, "applying IC flag" ); 791 802 } 803 #if SHARP_ILLUCOMP_PARSE_D0060 804 if (pcSlice->getApplyIC()) 805 { 806 WRITE_FLAG( pcSlice->getIcSkipParseFlag() ? 1 : 0, "ic_skip_mergeidx0" ); 807 } 808 #endif 792 809 } 793 810 #endif … … 957 974 if (pcSlice->getSPS()->getUseSAO()) 958 975 { 976 #if LGE_SAO_MIGRATION_D0091 977 WRITE_FLAG( pcSlice->getSaoEnabledFlag(), "slice_sao_luma_flag" ); 978 { 979 SAOParam *saoParam = pcSlice->getAPS()->getSaoParam(); 980 WRITE_FLAG( saoParam->bSaoFlag[1], "slice_sao_chroma_flag" ); 981 } 982 #else 959 983 WRITE_FLAG( pcSlice->getSaoInterleavingFlag(), "SAO interleaving flag" ); 960 984 assert (pcSlice->getSaoEnabledFlag() == pcSlice->getAPS()->getSaoEnabled()); … … 965 989 WRITE_FLAG( pcSlice->getAPS()->getSaoParam()->bSaoFlag[2], "SAO on/off flag for Cr in slice header" ); 966 990 } 991 #endif 967 992 } 968 993 WRITE_UVLC( pcSlice->getAPS()->getAPSID(), "aps_id"); … … 1321 1346 } 1322 1347 #endif 1323 1348 #if QC_ARP_D0177 1349 Void TEncCavlc::codeARPW( TComDataCU* pcCU, UInt uiAbsPartIdx ) 1350 { 1351 assert( false ); 1352 } 1353 #endif 1324 1354 Void TEncCavlc::codeAlfCtrlFlag( TComDataCU* pcCU, UInt uiAbsPartIdx ) 1325 1355 { … … 1406 1436 } 1407 1437 1408 Void TEncCavlc::codeIntraDirLumaAng( TComDataCU* pcCU, UInt uiAbsPartIdx ) 1438 Void TEncCavlc::codeIntraDirLumaAng( TComDataCU* pcCU, UInt uiAbsPartIdx 1439 #if PKU_QC_DEPTH_INTRA_UNI_D0195 1440 , Bool bSdcRD 1441 #endif 1442 ) 1409 1443 { 1410 1444 assert(0); … … 1491 1525 } 1492 1526 } 1493 1527 #if !LGE_SAO_MIGRATION_D0091 1494 1528 Void TEncCavlc::codeSaoFlag( UInt uiCode ) 1495 1529 { … … 1529 1563 WRITE_CODE( uiCode, uiLength, "sao_run_diff"); 1530 1564 } 1565 #endif 1531 1566 1532 1567 Void TEncCavlc::estBit( estBitsSbacStruct* pcEstBitsCabac, Int width, Int height, TextType eTType ) … … 1884 1919 1885 1920 #if RWTH_SDC_DLT_B0036 1921 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 1886 1922 Void TEncCavlc::codeSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ) 1887 1923 { 1888 1924 assert(0); 1889 1925 } 1890 1926 #endif 1891 1927 Void TEncCavlc::codeSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiSegment ) 1892 1928 { 1893 1929 assert(0); 1894 1930 } 1895 1931 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 1896 1932 Void TEncCavlc::codeSDCPredMode ( TComDataCU* pcCU, UInt uiAbsPartIdx ) 1897 1933 { … … 1899 1935 } 1900 1936 #endif 1937 #endif 1901 1938 //! \} -
trunk/source/Lib/TLibEncoder/TEncCavlc.h
r332 r443 142 142 Void codeAPSAlflag(UInt uiCode); 143 143 Void codeAlfFixedLengthIdx( UInt idx, UInt numFilterSetsInBuffer); 144 #if LGE_SAO_MIGRATION_D0091 145 Void codeSAOSign ( UInt code ) { printf("Not supported\n"); assert (0); } 146 Void codeSaoMaxUvlc ( UInt code, UInt maxSymbol ){printf("Not supported\n"); assert (0);} 147 Void codeSaoMerge ( UInt uiCode ){printf("Not supported\n"); assert (0);} 148 Void codeSaoTypeIdx ( UInt uiCode ){printf("Not supported\n"); assert (0);} 149 Void codeSaoUflc ( UInt uiLength, UInt uiCode ){ assert(uiCode < 32); printf("Not supported\n"); assert (0);} 150 #else 144 151 Void codeSaoFlag ( UInt uiCode ); 145 152 Void codeSaoUvlc ( UInt uiCode ); … … 150 157 Void codeSaoTypeIdx ( UInt uiCode ){ xWriteUvlc(uiCode );} 151 158 Void codeSaoUflc ( UInt uiCode ){ assert(uiCode < 32); xWriteCode(uiCode, 5);} 159 #endif 152 160 153 161 Void codeSkipFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ); … … 160 168 Void codeResPredFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 161 169 #endif 170 #if QC_ARP_D0177 171 virtual Void codeARPW ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 172 #endif 162 173 Void codeAlfCtrlFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 163 174 … … 183 194 Void codeQtRootCbf ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 184 195 185 Void codeIntraDirLumaAng( TComDataCU* pcCU, UInt uiAbsPartIdx ); 196 Void codeIntraDirLumaAng( TComDataCU* pcCU, UInt uiAbsPartIdx 197 #if PKU_QC_DEPTH_INTRA_UNI_D0195 198 , Bool bSdcRD = false 199 #endif 200 ); 186 201 187 202 Void codeIntraDirChroma( TComDataCU* pcCU, UInt uiAbsPartIdx ); … … 209 224 210 225 #if RWTH_SDC_DLT_B0036 226 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 211 227 Void codeSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 228 #endif 212 229 Void codeSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiSegment ); 230 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 213 231 Void codeSDCPredMode ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 214 232 #endif 233 #endif 215 234 216 235 }; -
trunk/source/Lib/TLibEncoder/TEncCfg.h
r332 r443 160 160 #endif 161 161 Int m_maxNumOffsetsPerPic; 162 #if LGE_SAO_MIGRATION_D0091 163 Bool m_saoLcuBoundary; 164 Bool m_saoLcuBasedOptimization; 165 #else 162 166 Bool m_saoInterleavingFlag; 167 #endif 163 168 164 169 //====== Lossless ======== … … 333 338 #endif 334 339 #if H3D_IVRP 340 #if QC_ARP_D0177 341 UInt m_nUseAdvResPred; 342 UInt m_nARPStepNum; 343 #else 335 344 UInt m_uiMultiviewResPredMode; 345 #endif 346 #endif 347 348 #if MTK_D0156 349 #if MERL_VSP_COMPENSATION_C0152 350 Bool m_bUseVSPCompensation; 351 #endif 352 Bool m_bUseDVPRefine; 336 353 #endif 337 354 … … 414 431 #endif 415 432 #if H3D_IVRP 433 #if QC_ARP_D0177 434 UInt getUseAdvRP () { return m_nUseAdvResPred; } 435 Void setUseAdvRP ( UInt u ) { m_nUseAdvResPred = u; } 436 UInt getARPStepNum () { return m_nARPStepNum; } 437 Void setARPStepNum ( UInt u ) { m_nARPStepNum = u; } 438 #else 416 439 Void setMultiviewResPredMode ( UInt u ) { m_uiMultiviewResPredMode = u; } 440 #endif 417 441 #endif 418 442 … … 661 685 Void setMaxNumOffsetsPerPic (Int iVal) { m_maxNumOffsetsPerPic = iVal; } 662 686 Int getMaxNumOffsetsPerPic () { return m_maxNumOffsetsPerPic; } 687 #if LGE_SAO_MIGRATION_D0091 688 Void setSaoLcuBoundary (Bool val) { m_saoLcuBoundary = val; } 689 Bool getSaoLcuBoundary () { return m_saoLcuBoundary; } 690 Void setSaoLcuBasedOptimization (Bool val) { m_saoLcuBasedOptimization = val; } 691 Bool getSaoLcuBasedOptimization () { return m_saoLcuBasedOptimization; } 692 #else 663 693 Void setSaoInterleavingFlag (bool bVal) { m_saoInterleavingFlag = bVal; } 664 694 Bool getSaoInterleavingFlag () { return m_saoInterleavingFlag; } 695 #endif 665 696 Void setTileBehaviorControlPresentFlag ( Int i ) { m_iTileBehaviorControlPresentFlag = i; } 666 697 Int getTileBehaviorControlPresentFlag () { return m_iTileBehaviorControlPresentFlag; } … … 809 840 Int getViewOrderIdx () { return m_iViewOrderIdx; } // will be changed to view_id 810 841 #endif 842 843 #if MTK_D0156 844 845 #if MERL_VSP_COMPENSATION_C0152 846 Bool getUseVSPCompensation( ){ return m_bUseVSPCompensation;} 847 Void setUseVSPCompensation( Bool bValue ){ m_bUseVSPCompensation = bValue;} 848 #endif 849 850 851 Bool getUseDVPRefine( ){ return m_bUseDVPRefine;} 852 Void setUseDVPRefine( Bool bValue ){ m_bUseDVPRefine = bValue;} 853 #endif 854 811 855 }; 812 856 -
trunk/source/Lib/TLibEncoder/TEncCu.cpp
r332 r443 64 64 m_ppcBestCU = new TComDataCU*[m_uhTotalDepth-1]; 65 65 m_ppcTempCU = new TComDataCU*[m_uhTotalDepth-1]; 66 66 #if QC_ARP_D0177 67 m_ppcWeightedTempCU = new TComDataCU*[m_uhTotalDepth-1]; 68 #endif 67 69 m_ppcPredYuvBest = new TComYuv*[m_uhTotalDepth-1]; 68 70 m_ppcResiYuvBest = new TComYuv*[m_uhTotalDepth-1]; … … 91 93 m_ppcBestCU[i] = new TComDataCU; m_ppcBestCU[i]->create( uiNumPartitions, uiWidth, uiHeight, false, uiMaxWidth >> (m_uhTotalDepth - 1) ); 92 94 m_ppcTempCU[i] = new TComDataCU; m_ppcTempCU[i]->create( uiNumPartitions, uiWidth, uiHeight, false, uiMaxWidth >> (m_uhTotalDepth - 1) ); 93 95 #if QC_ARP_D0177 96 m_ppcWeightedTempCU[i] = new TComDataCU; m_ppcWeightedTempCU[i]->create( uiNumPartitions, uiWidth, uiHeight, false, uiMaxWidth >> (m_uhTotalDepth - 1) ); 97 #endif 94 98 m_ppcPredYuvBest[i] = new TComYuv; m_ppcPredYuvBest[i]->create(uiWidth, uiHeight); 95 99 m_ppcResiYuvBest[i] = new TComYuv; m_ppcResiYuvBest[i]->create(uiWidth, uiHeight); … … 170 174 { 171 175 m_ppcResPredTmp [i]->destroy(); delete m_ppcResPredTmp[i]; m_ppcResPredTmp[i] = NULL; 176 } 177 #endif 178 #if QC_ARP_D0177 179 if(m_ppcWeightedTempCU[i]) 180 { 181 m_ppcWeightedTempCU[i]->destroy(); delete m_ppcWeightedTempCU[i]; m_ppcWeightedTempCU[i] = NULL; 172 182 } 173 183 #endif … … 591 601 } 592 602 #endif 593 603 #if QC_CU_NBDV_D0181 604 DisInfo DvInfo; 605 DvInfo.bDV = false; 606 if( rpcTempCU->getSlice()->getSliceType() != I_SLICE ) 607 { 608 #if QC_ARP_D0177 609 if(( rpcTempCU->getSlice()->getSPS()->getMultiviewMvPredMode() || rpcTempCU->getSlice()->getSPS()->getUseAdvRP()) && rpcTempCU->getSlice()->getViewId()) 610 #else 611 if(( rpcTempCU->getSlice()->getSPS()->getMultiviewMvPredMode() || rpcTempCU->getSlice()->getSPS()->getMultiviewResPredMode()) && rpcTempCU->getSlice()->getViewId()) 612 #endif 613 { 614 PartSize ePartTemp = rpcTempCU->getPartitionSize(0); 615 rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth ); 616 #if MERL_VSP_C0152 617 DvInfo.bDV = rpcTempCU->getDisMvpCandNBDV(0, 0, &DvInfo, false, true); 618 #else 619 DvInfo.bDV = rpcTempCU->getDisMvpCandNBDV(0, 0, &DvInfo, false); 620 #endif 621 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth); 622 rpcBestCU->setDvInfoSubParts(DvInfo, 0, uiDepth); 623 rpcTempCU->setPartSizeSubParts( ePartTemp, 0, uiDepth ); 624 } 625 626 if(DvInfo.bDV==false) 627 { 628 DvInfo.iN=1; 629 #if !SEC_DEFAULT_DV_D0112 630 DvInfo.m_acMvCand[0].setHor(0); 631 DvInfo.m_acMvCand[0].setVer(0); 632 DvInfo.m_aVIdxCan[0] = 0; 633 #endif 634 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth); 635 rpcBestCU->setDvInfoSubParts(DvInfo, 0, uiDepth); 636 } 637 } 638 #endif 594 639 // do inter modes, SKIP and 2Nx2N 595 640 if( rpcBestCU->getSlice()->getSliceType() != I_SLICE ) 596 641 { 597 642 #if H3D_IVRP 643 #if QC_ARP_D0177 644 Bool bResPredAvailable = false; 645 Bool bResPredAllowed = (!rpcBestCU->getSlice()->getSPS()->isDepth () ); 646 bResPredAllowed = bResPredAllowed && ( rpcBestCU->getSlice()->getSPS()->getViewId () ); 647 if( bResPredAllowed ) 648 { 649 bResPredAvailable = rpcBestCU->getResidualSamples( 0, true, m_ppcResPredTmp[uiDepth] ); 650 } 651 for( UInt uiResPrdId = 0; uiResPrdId < (rpcBestCU->getSlice()->getSPS()->getUseAdvRP()? 1: ( bResPredAvailable ? 2 : 1 )); uiResPrdId++ ) 652 #else 598 653 Bool bResPredAvailable = false; 599 654 UInt uiResPrdId = 0; 655 #endif 600 656 { 601 657 Bool bResPredFlag = ( uiResPrdId > 0 ); … … 665 721 666 722 #if LGE_ILLUCOMP_B0045 723 #if SHARP_ILLUCOMP_PARSE_D0060 724 bICEnabled = false; 725 #else 667 726 bICEnabled = rpcBestCU->getICFlag(0); 727 #endif 668 728 #endif 669 729 … … 715 775 { 716 776 #if H3D_IVRP 777 #if QC_ARP_D0177 778 Bool bResPredAvailable = false; 779 Bool bResPredAllowed = (!rpcBestCU->getSlice()->getSPS()->isDepth () ); 780 bResPredAllowed = bResPredAllowed && ( rpcBestCU->getSlice()->getSPS()->getViewId () ); 781 if( bResPredAllowed ) 782 { 783 bResPredAvailable = rpcBestCU->getResidualSamples( 0, true, m_ppcResPredTmp[uiDepth] ); 784 } 785 for( UInt uiResPrdId = 0; uiResPrdId < (rpcBestCU->getSlice()->getSPS()->getUseAdvRP()? 1: ( bResPredAvailable ? 2 : 1 )); uiResPrdId++ ) 786 #else 717 787 Bool bResPredAvailable = false; 718 788 UInt uiResPrdId = 0; 789 #endif 719 790 { 720 791 Bool bResPredFlag = ( uiResPrdId > 0 ); 721 792 #if LGE_ILLUCOMP_B0045 793 #if SHARP_ILLUCOMP_PARSE_D0060 794 { 795 Bool bICFlag = false; 796 rpcTempCU->setICFlagSubParts(bICFlag, 0, 0, uiDepth); 797 #else 722 798 for(UInt uiICId = 0; uiICId < (bICEnabled ? 2 : 1); uiICId++) 723 799 { 724 800 Bool bICFlag = (uiICId ? true : false); 725 801 rpcTempCU->setICFlagSubParts(bICFlag, 0, 0, uiDepth); 802 #endif 726 803 #endif 727 804 #endif … … 1648 1725 UInt uiTPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ]; 1649 1726 UInt uiBPelY = uiTPelY + (g_uiMaxCUHeight>>uiDepth) - 1; 1650 1727 1651 1728 if( getCheckBurstIPCMFlag() ) 1652 1729 { … … 1760 1837 { 1761 1838 m_pcEntropyCoder->encodeMergeIndex( pcCU, uiAbsPartIdx, 0 ); 1839 1762 1840 #if LGE_ILLUCOMP_B0045 1763 1841 m_pcEntropyCoder->encodeICFlag ( pcCU, uiAbsPartIdx … … 1767 1845 ); 1768 1846 #endif 1847 #if QC_ARP_D0177 1848 m_pcEntropyCoder->encodeARPW( pcCU , uiAbsPartIdx, 0, uiDepth); 1849 #endif 1769 1850 finishCU(pcCU,uiAbsPartIdx,uiDepth); 1770 1851 return; … … 1775 1856 #endif 1776 1857 m_pcEntropyCoder->encodePredMode( pcCU, uiAbsPartIdx ); 1777 1858 1778 1859 m_pcEntropyCoder->encodePartSize( pcCU, uiAbsPartIdx, uiDepth ); 1779 1860 1780 1861 if (pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N ) 1781 1862 { … … 1792 1873 // prediction Info ( Intra : direction mode, Inter : Mv, reference idx ) 1793 1874 m_pcEntropyCoder->encodePredInfo( pcCU, uiAbsPartIdx ); 1875 1794 1876 #if LGE_ILLUCOMP_B0045 1795 1877 m_pcEntropyCoder->encodeICFlag ( pcCU, uiAbsPartIdx … … 1833 1915 Int numValidMergeCand = 0; 1834 1916 1917 #if QC_ARP_D0177 1918 Bool bResPrdAvail = rpcTempCU->getResPredAvail( 0 ); 1919 Bool bResPrdFlag = rpcTempCU->getResPredFlag ( 0 ); 1920 #endif 1835 1921 #if LGE_ILLUCOMP_B0045 1836 1922 Bool bICFlag = rpcTempCU->getICFlag(0); … … 1860 1946 rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uhDepth ); // interprets depth relative to LCU level 1861 1947 #if MERL_VSP_C0152 1948 #if LGE_VSP_INHERIT_D0092 1949 Int iVSPIndexTrue[MRG_MAX_NUM_CANDS_MEM]; 1950 for (Int i=0; i<MRG_MAX_NUM_CANDS_MEM; i++) 1951 { 1952 iVSPIndexTrue[i] = 0; 1953 } 1954 #else 1862 1955 Int iVSPIndexTrue[3] = {-1, -1, -1}; 1956 #endif 1957 #if MERL_VSP_NBDV_RefVId_Fix_D0166 1958 Int iVSPDirTrue[3] = {-1, -1, -1}; 1959 rpcTempCU->getInterMergeCandidates( 0, 0, uhDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, iVSPIndexTrue, iVSPDirTrue ); 1960 #else 1863 1961 rpcTempCU->getInterMergeCandidates( 0, 0, uhDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, iVSPIndexTrue ); 1962 #endif 1864 1963 #else 1865 1964 rpcTempCU->getInterMergeCandidates( 0, 0, uhDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand ); 1866 1965 #endif 1867 #if H3D_IVRP 1966 #if H3D_IVRP & !QC_ARP_D0177 1868 1967 Bool bResPredAvail = rpcTempCU->getResPredAvail(0); 1869 1968 #endif 1870 1969 1871 1970 Bool bestIsSkip = false; 1872 1971 #if QC_ARP_D0177 1972 Int nGRPW = rpcTempCU->getSlice()->getARPStepNum() - 1; 1973 if(nGRPW < 0 || !bResPrdAvail ) 1974 nGRPW = 0; 1975 for( ; nGRPW >= 0 ; nGRPW-- ) 1976 { 1977 #endif 1873 1978 for( UInt uiMergeCand = 0; uiMergeCand < numValidMergeCand; ++uiMergeCand ) 1874 1979 { 1875 1980 { 1876 1981 TComYuv* pcPredYuvTemp = NULL; 1982 #if SHARP_ILLUCOMP_PARSE_D0060 1983 if (rpcTempCU->getSlice()->getApplyIC() && rpcTempCU->getSlice()->getIcSkipParseFlag()) 1984 { 1985 if (bICFlag && uiMergeCand == 0) 1986 { 1987 continue; 1988 } 1989 } 1990 #endif 1877 1991 #if LOSSLESS_CODING 1878 1992 UInt iteration; … … 1904 2018 rpcTempCU->setPredModeSubParts( MODE_SKIP, 0, uhDepth ); // interprets depth relative to LCU level 1905 2019 rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uhDepth ); // interprets depth relative to LCU level 2020 #if QC_ARP_D0177 2021 if(rpcTempCU->getSlice()->getSPS()->getUseAdvRP()) 2022 rpcTempCU->setARPWSubParts( ( UChar )nGRPW , 0 , uhDepth ); 2023 #endif 1906 2024 rpcTempCU->setMergeFlagSubParts( true, 0, 0, uhDepth ); // interprets depth relative to LCU level 1907 2025 rpcTempCU->setMergeIndexSubParts( uiMergeCand, 0, 0, uhDepth ); // interprets depth relative to LCU level 1908 2026 #if MERL_VSP_C0152 2027 2028 #if MTK_D0156 2029 if( !rpcTempCU->getSlice()->getSPS()->getUseVSPCompensation() ) 2030 { 2031 rpcTempCU->setVSPIndexSubParts( 0, 0, 0, uhDepth ); 2032 } 2033 else 2034 #endif 1909 2035 { 1910 2036 Int iVSPIdx = 0; 2037 #if LGE_VSP_INHERIT_D0092 2038 if (iVSPIndexTrue[uiMergeCand] == 1) 2039 { 2040 iVSPIdx = 1; 2041 } 2042 #else 1911 2043 Int numVSPIdx; 1912 2044 numVSPIdx = 3; … … 1919 2051 } 1920 2052 } 2053 #endif 1921 2054 rpcTempCU->setVSPIndexSubParts( iVSPIdx, 0, 0, uhDepth ); 2055 #if MERL_VSP_NBDV_RefVId_Fix_D0166 2056 rpcTempCU->setVSPDirSubParts(0, 0, 0, uhDepth ); // interprets depth relative to LCU level 2057 #endif 2058 #if QC_BVSP_CleanUP_D0191 && !LGE_VSP_INHERIT_D0092 2059 if(iVSPIdx != 0) 2060 { 2061 Int iIVCIdx = rpcTempCU->getSlice()->getRefPic(REF_PIC_LIST_0, 0)->getPOC()==rpcTempCU->getSlice()->getPOC() ? 0: rpcTempCU->getSlice()->getNewRefIdx(REF_PIC_LIST_0); 2062 cMvFieldNeighbours[2*uiMergeCand].setRefIdx(iIVCIdx); 2063 } 2064 #endif 1922 2065 } 1923 2066 #endif … … 1927 2070 1928 2071 #if H3D_IVRP 2072 #if !QC_ARP_D0177 1929 2073 rpcTempCU->setResPredAvailSubParts(bResPredAvail, 0, 0, uhDepth); 2074 #else 2075 rpcTempCU->setResPredAvailSubParts( bResPrdAvail, 0, 0, uhDepth ); 2076 rpcTempCU->setResPredFlagSubParts ( bResPrdFlag, 0, 0, uhDepth ); 2077 #endif 1930 2078 #endif 1931 2079 #if LGE_ILLUCOMP_B0045 1932 2080 rpcTempCU->setICFlagSubParts(bICFlag, 0, 0, uhDepth); 1933 2081 #endif 1934 2082 #if QC_ARP_D0177 2083 if(rpcTempCU->getSlice()->getSPS()->getUseAdvRP()) 2084 { 2085 bool bSignalflag[2] = {true, true}; 2086 for(UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx ++ ) 2087 { 2088 Int iRefIdx = cMvFieldNeighbours[uiRefListIdx + 2*uiMergeCand].getRefIdx(); 2089 RefPicList eRefList = uiRefListIdx ? REF_PIC_LIST_1 : REF_PIC_LIST_0; 2090 if(iRefIdx < 0 || rpcTempCU->getSlice()->getPOC() == rpcTempCU->getSlice()->getRefPOC(eRefList, iRefIdx)) 2091 bSignalflag[uiRefListIdx] = false; 2092 } 2093 if(!bSignalflag[0]&& !bSignalflag[1]) 2094 { 2095 rpcTempCU->setARPWSubParts( 0 , 0 , uhDepth ); 2096 } 2097 } 2098 #endif 1935 2099 // do MC 1936 2100 #if HHI_INTERVIEW_SKIP … … 1945 2109 m_pcPredSearch->motionCompensation ( rpcTempCU, m_ppcPredYuvTemp[uhDepth] ); 1946 2110 #endif 1947 #if H3D_IVRP 2111 #if H3D_IVRP & !QC_ARP_D0177 1948 2112 if (uiMergeCand == 0 && rpcTempCU->getResPredAvail(0)) 1949 2113 { … … 1964 2128 m_pcPredSearch->motionCompensation ( rpcTempCU, m_ppcPredYuvTemp[uhDepth] ); 1965 2129 #endif 1966 #if H3D_IVRP 2130 #if H3D_IVRP & !QC_ARP_D0177 1967 2131 if (uiMergeCand == 0 && rpcTempCU->getResPredAvail(0)) 1968 2132 { … … 2021 2185 } 2022 2186 } 2187 #if QC_ARP_D0177 2188 } 2189 #endif 2023 2190 } 2024 2191 … … 2038 2205 { 2039 2206 UChar uhDepth = rpcTempCU->getDepth( 0 ); 2040 2207 #if QC_ARP_D0177 2208 Bool bFirstTime = true; 2209 Int nARPWMax = rpcTempCU->getSlice()->getARPStepNum() - 1; 2210 if(nARPWMax < 0 || !rpcTempCU->getResPredAvail( 0 ) ) 2211 nARPWMax = 0; 2212 if( ePartSize != SIZE_2Nx2N) 2213 nARPWMax = 0; 2214 Int nARPWStart = 0 , nARPWStep = 1; 2215 for( Int nCount = 0 , nGRPW = nARPWStart ; nCount <= nARPWMax ; nCount++ , nGRPW += nARPWStep ) 2216 { 2217 if( bFirstTime == false && rpcTempCU->getSlice()->getSPS()->getUseAdvRP() ) 2218 rpcTempCU->initEstData( rpcTempCU->getDepth(0), rpcTempCU->getQP(0) ); 2219 #endif 2041 2220 #if HHI_VSO 2042 2221 if( m_pcRdCost->getUseRenModel() ) … … 2065 2244 rpcTempCU->setPredModeSubParts ( MODE_INTER, 0, uhDepth ); 2066 2245 2246 #if QC_ARP_D0177 2247 if(rpcTempCU->getSlice()->getSPS()->getUseAdvRP()) 2248 rpcTempCU->setARPWSubParts( ( UChar )nGRPW , 0 , uhDepth ); 2249 #endif 2250 #if QC_ARP_D0177 2251 if( bFirstTime == false && rpcTempCU->getSlice()->getSPS()->getUseAdvRP()) 2252 { 2253 assert(!rpcTempCU->getSlice()->getSPS()->isDepth()); 2254 rpcTempCU->copyPartFrom( m_ppcWeightedTempCU[uhDepth] , 0 , uhDepth, true ); 2255 rpcTempCU->setARPWSubParts( ( UChar )nGRPW , 0 , uhDepth ); 2256 #if MERL_VSP_C0152 2257 m_pcPredSearch->motionCompensation( rpcTempCU , m_ppcPredYuvTemp[uhDepth], 0); 2258 #else 2259 m_pcPredSearch->motionCompensation( rpcTempCU , m_ppcPredYuvTemp[uhDepth] ); 2260 #endif 2261 if(rpcTempCU->getPartitionSize(0)==SIZE_2Nx2N) 2262 { 2263 bool bSignalflag[2] = {true, true}; 2264 for(UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx ++ ) 2265 { 2266 RefPicList eRefList = uiRefListIdx ? REF_PIC_LIST_1 : REF_PIC_LIST_0; 2267 Int iRefIdx = rpcTempCU->getCUMvField(eRefList)->getRefIdx(0); 2268 if(iRefIdx < 0 || rpcTempCU->getSlice()->getPOC() == rpcTempCU->getSlice()->getRefPOC(eRefList, iRefIdx)) 2269 bSignalflag[uiRefListIdx] = false; 2270 } 2271 if(!bSignalflag[0]&& !bSignalflag[1]) 2272 rpcTempCU->setARPWSubParts( 0 , 0 , uhDepth ); 2273 } 2274 } 2275 else 2276 { 2277 bFirstTime = false; 2278 #endif 2067 2279 #if AMP_MRG 2068 2280 rpcTempCU->setMergeAMP (true); … … 2079 2291 #endif 2080 2292 #endif 2293 #if QC_ARP_D0177 2294 if(rpcTempCU->getSlice()->getSPS()->getUseAdvRP()) 2295 { 2296 m_ppcWeightedTempCU[uhDepth]->copyPartFrom( rpcTempCU , 0 , uhDepth ); 2297 if(rpcTempCU->getSlice()->getSPS()->getUseAdvRP() && rpcTempCU->getPartitionSize(0)==SIZE_2Nx2N) 2298 { 2299 bool bSignalflag[2] = {true, true}; 2300 for(UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx ++ ) 2301 { 2302 RefPicList eRefList = uiRefListIdx ? REF_PIC_LIST_1 : REF_PIC_LIST_0; 2303 Int iRefIdx = rpcTempCU->getCUMvField(eRefList)->getRefIdx(0); 2304 if(iRefIdx < 0 || rpcTempCU->getSlice()->getPOC() == rpcTempCU->getSlice()->getRefPOC(eRefList, iRefIdx)) 2305 bSignalflag[uiRefListIdx] = false; 2306 } 2307 if(!bSignalflag[0]&& !bSignalflag[1]) 2308 rpcTempCU->setARPWSubParts( 0 , 0 , uhDepth ); 2309 } 2310 } 2311 } 2312 #endif 2081 2313 2082 2314 #if AMP_MRG 2083 2315 if ( !rpcTempCU->getMergeAMP() ) 2084 2316 { 2317 #if QC_ARP_D0177 2318 if(rpcTempCU->getSlice()->getSPS()->getUseAdvRP()) 2319 continue; 2320 else 2321 #endif 2085 2322 return; 2086 2323 } … … 2123 2360 xCheckDQP( rpcTempCU ); 2124 2361 xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth); 2362 #if QC_ARP_D0177 2363 } 2364 #endif 2125 2365 } 2126 2366 … … 2758 2998 assert( rpcTempCU->getPredictionMode( ui ) != MODE_NONE ); 2759 2999 #if MERL_VSP_C0152 2760 Int vspIdx = pcTextureCU->getVSPIndex( rpcTempCU->getZorderIdxInCU() + ui );3000 Int vspIdx = pcTextureCU->getVSPIndex( rpcTempCU->getZorderIdxInCU() + ui ); 2761 3001 rpcTempCU->setVSPIndex( ui , vspIdx); 3002 #if MERL_VSP_NBDV_RefVId_Fix_D0166 3003 Int vspDir = pcTextureCU->getVSPDir ( rpcTempCU->getZorderIdxInCU() + ui ); 3004 rpcTempCU->setVSPDir( ui, vspDir); 3005 #endif 2762 3006 #endif 2763 3007 } -
trunk/source/Lib/TLibEncoder/TEncCu.h
r296 r443 69 69 TComDataCU** m_ppcBestCU; ///< Best CUs in each depth 70 70 TComDataCU** m_ppcTempCU; ///< Temporary CUs in each depth 71 #if QC_ARP_D0177 72 TComDataCU** m_ppcWeightedTempCU; 73 #endif 71 74 UChar m_uhTotalDepth; 72 75 -
trunk/source/Lib/TLibEncoder/TEncEntropy.cpp
r332 r443 54 54 if (pcSlice->getSPS()->getUseSAO()) 55 55 { 56 #if LGE_SAO_MIGRATION_D0091 57 if (pcSlice->getSPS()->getUseSAO()) 58 { 59 SAOParam *saoParam = pcSlice->getAPS()->getSaoParam(); 60 pcSlice->setSaoEnabledFlag (saoParam->bSaoFlag[0]); 61 { 62 pcSlice->setSaoEnabledFlagChroma (saoParam->bSaoFlag[1]); 63 } 64 } 65 #else 56 66 pcSlice->setSaoInterleavingFlag(pcSlice->getAPS()->getSaoInterleavingFlag()); 57 67 pcSlice->setSaoEnabledFlag (pcSlice->getAPS()->getSaoParam()->bSaoFlag[0]); … … 66 76 pcSlice->setSaoEnabledFlagCr (0); 67 77 } 78 #endif 68 79 } 69 80 … … 456 467 457 468 469 #if QC_ARP_D0177 470 Void TEncEntropy::encodeARPW( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD, UInt uiDepth) 471 { 472 if( pcCU->getSlice()->getViewId() == 0 || pcCU->getSlice()->getIsDepth() == true || !pcCU->getSlice()->getARPStepNum() ) 473 { 474 return; 475 } 476 assert( pcCU->isIntra( uiAbsPartIdx ) == false ); 477 if( bRD ) 478 { 479 uiAbsPartIdx = 0; 480 } 481 bool bSignalflag[2] = {true, true}; 482 if (!(pcCU->getPartitionSize(uiAbsPartIdx)==SIZE_2Nx2N || pcCU->isSkipped(uiAbsPartIdx))) 483 { 484 assert(pcCU->getARPW (uiAbsPartIdx) == 0); 485 bSignalflag[0] = false; 486 bSignalflag[1] = false; 487 } 488 if (!(bSignalflag[0]|| bSignalflag[1])) 489 { 490 assert(pcCU->getARPW (uiAbsPartIdx) == 0); 491 if (uiDepth != -1) 492 pcCU->setARPWSubParts(0, uiAbsPartIdx, uiDepth); 493 } 494 else 495 m_pcEntropyCoderIf->codeARPW( pcCU, uiAbsPartIdx ); 496 497 } 498 #endif 458 499 /** parse the fixed length code (smaller than one max value) in ALF 459 500 * \param run: coded value … … 828 869 m_pcEntropyCoderIf->codePredMode( pcCU, uiAbsPartIdx ); 829 870 871 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 830 872 #if RWTH_SDC_DLT_B0036 831 873 // if B-Slice, code SDC flag later … … 835 877 encodeSDCFlag(pcCU, uiAbsPartIdx, bRD); 836 878 } 879 #endif 837 880 #endif 838 881 } … … 876 919 } 877 920 } 921 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 878 922 #if RWTH_SDC_DLT_B0036 879 923 if( !pcCU->getSlice()->isInterB() && pcCU->isIntra(uiAbsPartIdx) && pcCU->getSDCFlag(uiAbsPartIdx) ) … … 883 927 } 884 928 #endif 929 #endif 885 930 886 931 m_pcEntropyCoderIf->codePartSize( pcCU, uiAbsPartIdx, uiDepth ); 887 932 933 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 888 934 #if RWTH_SDC_DLT_B0036 889 935 // code SDC flag now! … … 899 945 } 900 946 } 947 #endif 901 948 #endif 902 949 } … … 1179 1226 1180 1227 // Intra direction for Luma 1181 Void TEncEntropy::encodeIntraDirModeLuma ( TComDataCU* pcCU, UInt uiAbsPartIdx ) 1182 { 1183 m_pcEntropyCoderIf->codeIntraDirLumaAng( pcCU, uiAbsPartIdx ); 1228 Void TEncEntropy::encodeIntraDirModeLuma ( TComDataCU* pcCU, UInt uiAbsPartIdx 1229 #if PKU_QC_DEPTH_INTRA_UNI_D0195 1230 ,Bool bSdcRD 1231 #endif 1232 ) 1233 { 1234 m_pcEntropyCoderIf->codeIntraDirLumaAng( pcCU, uiAbsPartIdx 1235 #if PKU_QC_DEPTH_INTRA_UNI_D0195 1236 ,bSdcRD 1237 #endif 1238 ); 1184 1239 } 1185 1240 … … 1195 1250 } 1196 1251 1197 Void TEncEntropy::encodePredInfo( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD ) 1252 Void TEncEntropy::encodePredInfo( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD 1253 #if PKU_QC_DEPTH_INTRA_UNI_D0195 1254 ,Bool bSdcRD 1255 #endif 1256 ) 1198 1257 { 1199 1258 if( bRD ) … … 1202 1261 } 1203 1262 1263 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 1204 1264 #if RWTH_SDC_DLT_B0036 1205 1265 if( pcCU->getSDCFlag(uiAbsPartIdx) ) … … 1208 1268 return; 1209 1269 } 1270 #endif 1210 1271 #endif 1211 1272 … … 1222 1283 encodeIntraDirModeLuma( pcCU, uiAbsPartIdx + uiPartOffset*2 ); 1223 1284 encodeIntraDirModeLuma( pcCU, uiAbsPartIdx + uiPartOffset*3 ); 1285 #if PKU_QC_DEPTH_INTRA_UNI_D0195 1286 if(!pcCU->getSDCFlag(uiAbsPartIdx)) 1287 #endif 1224 1288 encodeIntraDirModeChroma( pcCU, uiAbsPartIdx, bRD ); 1225 1289 } 1226 1290 else // if it is not NxN size, encode 1 intra directions 1227 1291 { 1228 encodeIntraDirModeLuma ( pcCU, uiAbsPartIdx ); 1292 encodeIntraDirModeLuma ( pcCU, uiAbsPartIdx 1293 #if PKU_QC_DEPTH_INTRA_UNI_D0195 1294 ,bSdcRD 1295 #endif 1296 ); 1297 #if PKU_QC_DEPTH_INTRA_UNI_D0195 1298 if(!pcCU->getSDCFlag(uiAbsPartIdx)) 1299 #endif 1229 1300 encodeIntraDirModeChroma( pcCU, uiAbsPartIdx, bRD ); 1230 1301 } … … 1233 1304 { 1234 1305 encodePUWise( pcCU, uiAbsPartIdx, bRD ); 1306 #if QC_ARP_D0177 1307 encodeARPW( pcCU , uiAbsPartIdx , bRD ); 1308 #endif 1235 1309 } 1236 1310 } … … 1351 1425 { 1352 1426 #if H3D_IVMP 1427 #if SEC_TWO_CANDIDATES_FOR_AMVP_D0122 1428 const Int iNumCands = AMVP_MAX_NUM_CANDS; 1429 #else 1353 1430 const Int iNumCands = AMVP_MAX_NUM_CANDS + ( pcCU->getSlice()->getSPS()->getMultiviewMvPredMode() ? 1 : 0 ); 1431 #endif 1354 1432 m_pcEntropyCoderIf->codeMVPIdx( pcCU, uiAbsPartIdx, eRefList, iNumCands ); 1355 1433 #else … … 1417 1495 assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_U) == 1 ); 1418 1496 assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_V) == 1 ); 1419 1497 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 1420 1498 encodeSDCResidualData(pcCU, uiAbsPartIdx); 1499 #endif 1421 1500 return; 1422 1501 } … … 1495 1574 } 1496 1575 1576 #if LGE_SAO_MIGRATION_D0091 1577 Void TEncEntropy::encodeSaoOffset(SaoLcuParam* saoLcuParam, UInt compIdx) 1578 { 1579 UInt uiSymbol; 1580 Int i; 1581 1582 uiSymbol = saoLcuParam->typeIdx + 1; 1583 if (compIdx!=2) 1584 { 1585 m_pcEntropyCoderIf->codeSaoTypeIdx(uiSymbol); 1586 } 1587 1588 if (uiSymbol) 1589 { 1590 if (saoLcuParam->typeIdx < 4 && compIdx != 2) 1591 { 1592 saoLcuParam->subTypeIdx = saoLcuParam->typeIdx; 1593 } 1594 #if FULL_NBIT 1595 Int offsetTh = 1 << ( min((Int)(g_uiBitDepth + (g_uiBitDepth-8)-5),5) ); 1596 #else 1597 Int offsetTh = 1 << ( min((Int)(g_uiBitDepth + g_uiBitIncrement-5),5) ); 1598 #endif 1599 if( saoLcuParam->typeIdx == SAO_BO ) 1600 { 1601 for( i=0; i< saoLcuParam->length; i++) 1602 { 1603 UInt absOffset = ( (saoLcuParam->offset[i] < 0) ? -saoLcuParam->offset[i] : saoLcuParam->offset[i]); 1604 m_pcEntropyCoderIf->codeSaoMaxUvlc(absOffset, offsetTh-1); 1605 } 1606 for( i=0; i< saoLcuParam->length; i++) 1607 { 1608 if (saoLcuParam->offset[i] != 0) 1609 { 1610 UInt sign = (saoLcuParam->offset[i] < 0) ? 1 : 0 ; 1611 m_pcEntropyCoderIf->codeSAOSign(sign); 1612 } 1613 } 1614 uiSymbol = (UInt) (saoLcuParam->subTypeIdx); 1615 m_pcEntropyCoderIf->codeSaoUflc(5, uiSymbol); 1616 } 1617 else if( saoLcuParam->typeIdx < 4 ) 1618 { 1619 m_pcEntropyCoderIf->codeSaoMaxUvlc( saoLcuParam->offset[0], offsetTh-1); 1620 m_pcEntropyCoderIf->codeSaoMaxUvlc( saoLcuParam->offset[1], offsetTh-1); 1621 m_pcEntropyCoderIf->codeSaoMaxUvlc(-saoLcuParam->offset[2], offsetTh-1); 1622 m_pcEntropyCoderIf->codeSaoMaxUvlc(-saoLcuParam->offset[3], offsetTh-1); 1623 1624 if (compIdx!=2) 1625 { 1626 uiSymbol = (UInt) (saoLcuParam->subTypeIdx); 1627 m_pcEntropyCoderIf->codeSaoUflc(2, uiSymbol); 1628 } 1629 } 1630 } 1631 } 1632 1633 /** Encode SAO unit interleaving 1634 * \param rx 1635 * \param ry 1636 * \param pSaoParam 1637 * \param pcCU 1638 * \param iCUAddrInSlice 1639 * \param iCUAddrUpInSlice 1640 * \param bLFCrossSliceBoundaryFlag 1641 */ 1642 Void TEncEntropy::encodeSaoUnitInterleaving(Int compIdx, Bool saoFlag, Int rx, Int ry, SaoLcuParam* saoLcuParam, Int cuAddrInSlice, Int cuAddrUpInSlice, Int allowMergeLeft, Int allowMergeUp) 1643 { 1644 if (saoFlag) 1645 { 1646 if (rx>0 && cuAddrInSlice!=0 && allowMergeLeft) 1647 { 1648 m_pcEntropyCoderIf->codeSaoMerge(saoLcuParam->mergeLeftFlag); 1649 } 1650 else 1651 { 1652 saoLcuParam->mergeLeftFlag = 0; 1653 } 1654 1655 if (saoLcuParam->mergeLeftFlag == 0) 1656 { 1657 if ( (ry > 0) && (cuAddrUpInSlice>=0) && allowMergeUp ) 1658 { 1659 m_pcEntropyCoderIf->codeSaoMerge(saoLcuParam->mergeUpFlag); 1660 } 1661 else 1662 { 1663 saoLcuParam->mergeUpFlag = 0; 1664 } 1665 1666 if (!saoLcuParam->mergeUpFlag) 1667 { 1668 encodeSaoOffset(saoLcuParam, compIdx); 1669 } 1670 } 1671 } 1672 } 1673 #else 1497 1674 /** Encode SAO Offset 1498 1675 * \param saoLcuParam SAO LCU paramters … … 1682 1859 } 1683 1860 } 1861 #endif 1684 1862 1685 1863 Int TEncEntropy::countNonZeroCoeffs( TCoeff* pcCoef, UInt uiSize ) … … 1715 1893 1716 1894 #if RWTH_SDC_DLT_B0036 1895 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 1717 1896 Void TEncEntropy::encodeSDCPredMode( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD ) 1718 1897 { … … 1734 1913 m_pcEntropyCoderIf->codeSDCFlag(pcCU, uiAbsPartIdx); 1735 1914 } 1736 1915 #endif 1737 1916 Void TEncEntropy::encodeSDCResidualData( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD ) 1738 1917 { -
trunk/source/Lib/TLibEncoder/TEncEntropy.h
r332 r443 117 117 virtual Void codeResPredFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0; 118 118 #endif 119 #if QC_ARP_D0177 120 virtual Void codeARPW ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0; 121 #endif 119 122 virtual Void codeSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0; 120 123 … … 123 126 124 127 #if RWTH_SDC_DLT_B0036 128 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 125 129 virtual Void codeSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0; 130 #endif 126 131 virtual Void codeSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiSegment ) = 0; 132 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 127 133 virtual Void codeSDCPredMode ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0; 134 #endif 128 135 #endif 129 136 … … 133 140 virtual Void codeQtCbf ( TComDataCU* pcCU, UInt uiAbsPartIdx, TextType eType, UInt uiTrDepth ) = 0; 134 141 virtual Void codeQtRootCbf ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0; 135 virtual Void codeIntraDirLumaAng( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0; 142 virtual Void codeIntraDirLumaAng( TComDataCU* pcCU, UInt uiAbsPartIdx 143 #if PKU_QC_DEPTH_INTRA_UNI_D0195 144 , Bool bSdcRD = false 145 #endif 146 ) = 0; 136 147 137 148 virtual Void codeIntraDirChroma( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0; … … 154 165 155 166 virtual Void codeAlfCtrlFlag ( UInt uiSymbol ) = 0; 167 #if LGE_SAO_MIGRATION_D0091 168 virtual Void codeSAOSign ( UInt code ) = 0; 169 virtual Void codeSaoMaxUvlc ( UInt code, UInt maxSymbol ) = 0; 170 virtual Void codeSaoMerge ( UInt uiCode ) = 0; 171 virtual Void codeSaoTypeIdx ( UInt uiCode) = 0; 172 virtual Void codeSaoUflc ( UInt uiLength, UInt uiCode ) = 0; 173 #else 156 174 virtual Void codeSaoFlag ( UInt uiCode ) = 0; 157 175 virtual Void codeSaoUvlc ( UInt uiCode ) = 0; … … 162 180 virtual Void codeSaoTypeIdx ( UInt uiCode) = 0; 163 181 virtual Void codeSaoUflc ( UInt uiCode) = 0; 182 #endif 164 183 virtual Void estBit (estBitsSbacStruct* pcEstBitsSbac, Int width, Int height, TextType eTType) = 0; 165 184 … … 250 269 Void encodeMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiPUIdx ); 251 270 Void encodeMergeIndex ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiPUIdx, Bool bRD = false ); 271 #if QC_ARP_D0177 272 Void encodeARPW ( TComDataCU* pcCU, UInt uiAbspartIdx , Bool bRD = false, UInt uiDepth = -1); 273 #endif 252 274 Void encodeAlfCtrlFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false ); 253 275 … … 265 287 Void encodePartSize ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, Bool bRD = false ); 266 288 Void encodeIPCMInfo ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false ); 267 Void encodePredInfo ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false ); 268 Void encodeIntraDirModeLuma ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 289 Void encodePredInfo ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false 290 #if PKU_QC_DEPTH_INTRA_UNI_D0195 291 ,Bool bSdcRD = false 292 #endif 293 ); 294 Void encodeIntraDirModeLuma ( TComDataCU* pcCU, UInt uiAbsPartIdx 295 #if PKU_QC_DEPTH_INTRA_UNI_D0195 296 ,Bool bSdcRD = false 297 #endif 298 ); 269 299 270 300 Void encodeIntraDirModeChroma( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false ); … … 284 314 285 315 #if RWTH_SDC_DLT_B0036 316 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 286 317 Void encodeSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false ); 318 #endif 287 319 Void encodeSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false ); 320 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 288 321 Void encodeSDCPredMode ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false ); 322 #endif 289 323 #endif 290 324 … … 310 344 Int golombEncode(int coeff, int k); 311 345 Int lengthGolomb(int coeffVal, int k); 346 #if LGE_SAO_MIGRATION_D0091 347 Void encodeSaoOffset(SaoLcuParam* saoLcuParam, UInt compIdx); 348 Void encodeSaoUnitInterleaving(Int compIdx, Bool saoFlag, Int rx, Int ry, SaoLcuParam* saoLcuParam, Int cuAddrInSlice, Int cuAddrUpInSlice, Int allowMergeLeft, Int allowMergeUp); 349 #else 312 350 Void encodeSaoUnit(Int rx, Int ry, Int compIdx, SAOParam* saoParam, Int repeatedRow); 313 351 Void encodeSaoOffset(SaoLcuParam* saoLcuParam); 314 352 Void encodeSaoUnitInterleaving(Int rx, Int ry, SAOParam* saoParam, TComDataCU* cu, Int cuAddrInSlice, Int cuAddrUpInSlice, Bool lfCrossSliceBoundaryFlag); 315 353 Void encodeSaoParam (TComAPS* aps); 354 #endif 316 355 317 356 static Int countNonZeroCoeffs( TCoeff* pcCoef, UInt uiSize ); -
trunk/source/Lib/TLibEncoder/TEncGOP.cpp
r332 r443 78 78 m_pcDepthMapGenerator = NULL; 79 79 #endif 80 #if H3D_IVRP 80 #if H3D_IVRP & !QC_ARP_D0177 81 81 m_pcResidualGenerator = NULL; 82 82 #endif … … 131 131 m_pcDepthMapGenerator = pcTEncTop->getDepthMapGenerator(); 132 132 #endif 133 #if H3D_IVRP 133 #if H3D_IVRP & !QC_ARP_D0177 134 134 m_pcResidualGenerator = pcTEncTop->getResidualGenerator(); 135 135 #endif … … 390 390 std::vector<TComPic*> apcInterViewRefPics = tAppEncTop->getInterViewRefPics( m_pcEncTop->getViewId(), pcSlice->getPOC(), m_pcEncTop->getIsDepth(), pcSlice->getSPS() ); 391 391 pcSlice->setRefPicListMvc( rcListPic, apcInterViewRefPics ); 392 392 #if QC_ARP_D0177 393 pcSlice->setARPStepNum(); 394 if(pcSlice->getARPStepNum() > 1) 395 { 396 for(Int iViewIdx = 0; iViewIdx < pcSlice->getViewId(); iViewIdx ++ ) 397 pcSlice->setBaseViewRefPicList( tAppEncTop->getTEncTop( iViewIdx , false )->getListPic(), iViewIdx ); 398 } 399 #endif 393 400 // Slice info. refinement 394 401 if( pcSlice->getSliceType() == B_SLICE ) … … 754 761 m_pcDepthMapGenerator->covertOrgDepthMap( pcPic ); 755 762 #endif 756 #if H3D_IVRP 763 #if H3D_IVRP & !QC_ARP_D0177 757 764 m_pcResidualGenerator->initViewComponent( pcPic ); 758 765 #endif … … 818 825 pcSlice = pcPic->getSlice(0); 819 826 820 #if H3D_IVRP 827 #if H3D_IVRP & !QC_ARP_D0177 821 828 // set residual picture 822 829 m_pcResidualGenerator->setRecResidualPic( pcPic ); … … 1257 1264 TComAPS cAPS; 1258 1265 allocAPS(&cAPS, pcSlice->getSPS()); 1266 #if !LGE_SAO_MIGRATION_D0091 1259 1267 cAPS.setSaoInterleavingFlag(m_pcCfg->getSaoInterleavingFlag()); 1268 #endif 1260 1269 // set entropy coder for RD 1261 1270 m_pcEntropyCoder->setEntropyCoder ( m_pcCavlcCoder, pcSlice ); … … 1265 1274 m_pcEntropyCoder->resetEntropy(); 1266 1275 m_pcEntropyCoder->setBitstream( m_pcBitCounter ); 1276 #if LGE_SAO_MIGRATION_D0091 1277 m_pcSAO->startSaoEnc(pcPic, m_pcEntropyCoder, m_pcEncTop->getRDSbacCoder(), m_pcEncTop->getRDGoOnSbacCoder()); 1278 #else 1267 1279 m_pcSAO->startSaoEnc(pcPic, m_pcEntropyCoder, m_pcEncTop->getRDSbacCoder(), NULL); 1280 #endif 1268 1281 SAOParam& cSaoParam = *(cAPS.getSaoParam()); 1269 1282 1270 1283 #if SAO_CHROMA_LAMBDA 1284 #if LGE_SAO_MIGRATION_D0091 1285 #if SAO_ENCODING_CHOICE 1286 m_pcSAO->SAOProcess(&cSaoParam, pcPic->getSlice(0)->getLambdaLuma(), pcPic->getSlice(0)->getLambdaChroma(), pcPic->getSlice(0)->getDepth()); 1287 #else 1271 1288 m_pcSAO->SAOProcess(&cSaoParam, pcPic->getSlice(0)->getLambdaLuma(), pcPic->getSlice(0)->getLambdaChroma()); 1289 #endif 1290 #else 1291 m_pcSAO->SAOProcess(&cSaoParam, pcPic->getSlice(0)->getLambdaLuma(), pcPic->getSlice(0)->getLambdaChroma()); 1292 #endif 1272 1293 #else 1273 1294 #if ALF_CHROMA_LAMBDA … … 1554 1575 m_pcEntropyCoder->encodeDFParams(pcAPS); 1555 1576 } 1577 #if !LGE_SAO_MIGRATION_D0091 1556 1578 m_pcEntropyCoder->encodeSaoParam(pcAPS); 1579 #endif 1557 1580 m_pcEntropyCoder->encodeAPSAlfFlag( pcAPS->getAlfEnabled()?1:0); 1558 1581 if(pcAPS->getAlfEnabled()) -
trunk/source/Lib/TLibEncoder/TEncGOP.h
r296 r443 97 97 TComDepthMapGenerator* m_pcDepthMapGenerator; 98 98 #endif 99 #if H3D_IVRP 99 #if H3D_IVRP & !QC_ARP_D0177 100 100 TComResidualGenerator* m_pcResidualGenerator; 101 101 #endif -
trunk/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp
r296 r443 43 43 //! \ingroup TLibEncoder 44 44 //! \{ 45 45 #if LGE_SAO_MIGRATION_D0091 46 46 TEncSampleAdaptiveOffset::TEncSampleAdaptiveOffset() 47 47 { 48 m_pcEntropyCoder = NULL; 49 m_pppcRDSbacCoder = NULL; 50 m_pcRDGoOnSbacCoder = NULL; 51 m_pppcBinCoderCABAC = NULL; 52 m_iCount = NULL; 53 m_iOffset = NULL; 54 m_iOffsetOrg = NULL; 55 m_iRate = NULL; 56 m_iDist = NULL; 57 m_dCost = NULL; 58 m_dCostPartBest = NULL; 59 m_iDistOrg = NULL; 60 m_iTypePartBest = NULL; 61 } 48 m_pcEntropyCoder= NULL; 49 m_pppcRDSbacCoder = NULL; 50 m_pcRDGoOnSbacCoder = NULL; 51 m_pppcBinCoderCABAC = NULL; 52 m_iCount = NULL; 53 m_iOffset = NULL; 54 m_iOffsetOrg = NULL; 55 m_iRate = NULL; 56 m_iDist = NULL; 57 m_dCost = NULL; 58 m_dCostPartBest = NULL; 59 m_iDistOrg = NULL; 60 m_iTypePartBest = NULL; 61 #if SAO_ENCODING_CHOICE_CHROMA 62 m_depthSaoRate[0][0] = 0; 63 m_depthSaoRate[0][1] = 0; 64 m_depthSaoRate[0][2] = 0; 65 m_depthSaoRate[0][3] = 0; 66 m_depthSaoRate[1][0] = 0; 67 m_depthSaoRate[1][1] = 0; 68 m_depthSaoRate[1][2] = 0; 69 m_depthSaoRate[1][3] = 0; 70 #endif 71 } 72 62 73 TEncSampleAdaptiveOffset::~TEncSampleAdaptiveOffset() 63 74 { … … 76 87 { 77 88 #if FULL_NBIT 78 Int bitDepthMinus8 = g_uiBitDepth - 8;79 return ((x)>0) ? (Int)(((Int)(x)+(1<<(bitDepthMinus8-1)))/(1<<bitDepthMinus8)) : ((Int)(((Int)(x)-(1<<(bitDepthMinus8-1)))/(1<<bitDepthMinus8)));89 Int bitDepthMinus8 = g_uiBitDepth - 8; 90 return ((x)>0) ? (Int)(((Int)(x)+(1<<(bitDepthMinus8-1)))/(1<<bitDepthMinus8)) : ((Int)(((Int)(x)-(1<<(bitDepthMinus8-1)))/(1<<bitDepthMinus8))); 80 91 #else 81 return ((x)>0) ? (Int)(((Int)(x)+(1<<(g_uiBitIncrement-1)))/(1<<g_uiBitIncrement)) : ((Int)(((Int)(x)-(1<<(g_uiBitIncrement-1)))/(1<<g_uiBitIncrement)));92 return ((x)>0) ? (Int)(((Int)(x)+(1<<(g_uiBitIncrement-1)))/(1<<g_uiBitIncrement)) : ((Int)(((Int)(x)-(1<<(g_uiBitIncrement-1)))/(1<<g_uiBitIncrement))); 82 93 #endif 83 94 } … … 89 100 { 90 101 #if FULL_NBIT 91 return (g_uiBitDepth > 8 ? xRoundIbdi2((x)) : ((x)>=0 ? ((Int)((x)+0.5)) : ((Int)((x)-0.5)))) ;102 return (g_uiBitDepth > 8 ? xRoundIbdi2((x)) : ((x)>=0 ? ((Int)((x)+0.5)) : ((Int)((x)-0.5)))) ; 92 103 #else 93 return (g_uiBitIncrement >0 ? xRoundIbdi2((x)) : ((x)>=0 ? ((Int)((x)+0.5)) : ((Int)((x)-0.5)))) ; 94 #endif 95 } 96 97 104 return (g_uiBitIncrement >0 ? xRoundIbdi2((x)) : ((x)>=0 ? ((Int)((x)+0.5)) : ((Int)((x)-0.5)))) ; 105 #endif 106 } 98 107 99 108 /** process SAO for one partition 100 109 * \param *psQTPart, iPartIdx, dLambda 101 110 */ 102 Void TEncSampleAdaptiveOffset::rdoSaoOnePart(SAOQTPart *psQTPart, Int iPartIdx, Double dLambda) 103 { 104 Int iTypeIdx; 105 Int iNumTotalType = MAX_NUM_SAO_TYPE; 106 SAOQTPart* pOnePart = &(psQTPart[iPartIdx]); 107 108 Int64 iEstDist; 109 Int64 iOffsetOrg; 110 Int64 iOffset; 111 Int64 iCount; 112 Int iClassIdx; 113 Int uiShift = g_uiBitIncrement << 1; 114 UInt uiDepth = pOnePart->PartLevel; 115 116 m_iDistOrg [iPartIdx] = 0; 117 118 Double bestRDCostTableBo = MAX_DOUBLE; 119 Int bestClassTableBo = 0; 120 Int currentDistortionTableBo[MAX_NUM_SAO_CLASS]; 121 Double currentRdCostTableBo[MAX_NUM_SAO_CLASS]; 122 123 #if HHI_INTERVIEW_SKIP 124 Int iFrameWidthInCU = m_pcPic->getFrameWidthInCU(); 125 Int LcuIdxX = psQTPart->StartCUX; 126 Int LcuIdxY = psQTPart->StartCUY; 127 Int iAddr = LcuIdxY*iFrameWidthInCU + LcuIdxX; 128 TComDataCU *pcCU = m_pcPic->getCU(iAddr); 129 Bool bRenderable = pcCU->getRenderable(0) ; 130 131 #endif 132 for (iTypeIdx=-1; iTypeIdx<iNumTotalType; iTypeIdx++) 133 { 134 if( m_bUseSBACRD ) 135 { 136 m_pcRDGoOnSbacCoder->load(m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST]); 137 m_pcRDGoOnSbacCoder->resetBits(); 111 Void TEncSampleAdaptiveOffset::rdoSaoOnePart(SAOQTPart *psQTPart, Int iPartIdx, Double dLambda, Int yCbCr) 112 { 113 Int iTypeIdx; 114 Int iNumTotalType = MAX_NUM_SAO_TYPE; 115 SAOQTPart* pOnePart = &(psQTPart[iPartIdx]); 116 117 Int64 iEstDist; 118 Int iClassIdx; 119 Int uiShift = g_uiBitIncrement << 1; 120 UInt uiDepth = pOnePart->PartLevel; 121 122 m_iDistOrg [iPartIdx] = 0; 123 124 Double bestRDCostTableBo = MAX_DOUBLE; 125 Int bestClassTableBo = 0; 126 Int currentDistortionTableBo[MAX_NUM_SAO_CLASS]; 127 Double currentRdCostTableBo[MAX_NUM_SAO_CLASS]; 128 129 Int addr; 130 Int allowMergeLeft; 131 Int allowMergeUp; 132 Int frameWidthInCU = m_pcPic->getFrameWidthInCU(); 133 SaoLcuParam saoLcuParamRdo; 134 135 for (iTypeIdx=-1; iTypeIdx<iNumTotalType; iTypeIdx++) 136 { 137 if( m_bUseSBACRD ) 138 { 139 m_pcRDGoOnSbacCoder->load(m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST]); 140 m_pcRDGoOnSbacCoder->resetBits(); 141 } 142 else 143 { 144 m_pcEntropyCoder->resetEntropy(); 145 m_pcEntropyCoder->resetBits(); 146 } 147 148 iEstDist = 0; 149 150 if (iTypeIdx == -1) 151 { 152 for (Int ry = pOnePart->StartCUY; ry<= pOnePart->EndCUY; ry++) 153 { 154 for (Int rx = pOnePart->StartCUX; rx <= pOnePart->EndCUX; rx++) 155 { 156 addr = ry * frameWidthInCU + rx; 157 // get bits for iTypeIdx = -1 158 allowMergeLeft = 1; 159 allowMergeUp = 1; 160 if (rx != 0) 161 { 162 // check tile id and slice id 163 if ( (m_pcPic->getPicSym()->getTileIdxMap(addr-1) != m_pcPic->getPicSym()->getTileIdxMap(addr)) || (m_pcPic->getCU(addr-1)->getSlice()->getSliceIdx() != m_pcPic->getCU(addr)->getSlice()->getSliceIdx())) 164 { 165 allowMergeLeft = 0; 166 } 167 } 168 if (ry!=0) 169 { 170 if ( (m_pcPic->getPicSym()->getTileIdxMap(addr-m_iNumCuInWidth) != m_pcPic->getPicSym()->getTileIdxMap(addr)) || (m_pcPic->getCU(addr-m_iNumCuInWidth)->getSlice()->getSliceIdx() != m_pcPic->getCU(addr)->getSlice()->getSliceIdx())) 171 { 172 allowMergeUp = 0; 173 } 174 } 175 176 // reset 177 resetSaoUnit(&saoLcuParamRdo); 178 179 // set merge flag 180 saoLcuParamRdo.mergeUpFlag = 1; 181 saoLcuParamRdo.mergeLeftFlag = 1; 182 183 if (ry == pOnePart->StartCUY) 184 { 185 saoLcuParamRdo.mergeUpFlag = 0; 186 } 187 188 if (rx == pOnePart->StartCUX) 189 { 190 saoLcuParamRdo.mergeLeftFlag = 0; 191 } 192 193 m_pcEntropyCoder->encodeSaoUnitInterleaving(yCbCr, 1, rx, ry, &saoLcuParamRdo, 1, 1, allowMergeLeft, allowMergeUp); 194 195 } 196 } 197 } 198 199 if (iTypeIdx>=0) 200 { 201 iEstDist = estSaoTypeDist(iPartIdx, iTypeIdx, uiShift, dLambda, currentDistortionTableBo, currentRdCostTableBo); 202 if( iTypeIdx == SAO_BO ) 203 { 204 // Estimate Best Position 205 Double currentRDCost = 0.0; 206 207 for(Int i=0; i< SAO_MAX_BO_CLASSES -SAO_BO_LEN +1; i++) 208 { 209 currentRDCost = 0.0; 210 for(UInt uj = i; uj < i+SAO_BO_LEN; uj++) 211 { 212 currentRDCost += currentRdCostTableBo[uj]; 213 } 214 215 if( currentRDCost < bestRDCostTableBo) 216 { 217 bestRDCostTableBo = currentRDCost; 218 bestClassTableBo = i; 219 } 220 } 221 222 // Re code all Offsets 223 // Code Center 224 for(iClassIdx = bestClassTableBo; iClassIdx < bestClassTableBo+SAO_BO_LEN; iClassIdx++) 225 { 226 iEstDist += currentDistortionTableBo[iClassIdx]; 227 } 228 } 229 230 for (Int ry = pOnePart->StartCUY; ry<= pOnePart->EndCUY; ry++) 231 { 232 for (Int rx = pOnePart->StartCUX; rx <= pOnePart->EndCUX; rx++) 233 { 234 addr = ry * frameWidthInCU + rx; 235 236 // get bits for iTypeIdx = -1 237 allowMergeLeft = 1; 238 allowMergeUp = 1; 239 if (rx != 0) 240 { 241 // check tile id and slice id 242 if ( (m_pcPic->getPicSym()->getTileIdxMap(addr-1) != m_pcPic->getPicSym()->getTileIdxMap(addr)) || (m_pcPic->getCU(addr-1)->getSlice()->getSliceIdx() != m_pcPic->getCU(addr)->getSlice()->getSliceIdx())) 243 { 244 allowMergeLeft = 0; 245 } 246 } 247 if (ry!=0) 248 { 249 if ( (m_pcPic->getPicSym()->getTileIdxMap(addr-m_iNumCuInWidth) != m_pcPic->getPicSym()->getTileIdxMap(addr)) || (m_pcPic->getCU(addr-m_iNumCuInWidth)->getSlice()->getSliceIdx() != m_pcPic->getCU(addr)->getSlice()->getSliceIdx())) 250 { 251 allowMergeUp = 0; 252 } 253 } 254 255 // reset 256 resetSaoUnit(&saoLcuParamRdo); 257 258 // set merge flag 259 saoLcuParamRdo.mergeUpFlag = 1; 260 saoLcuParamRdo.mergeLeftFlag = 1; 261 262 if (ry == pOnePart->StartCUY) 263 { 264 saoLcuParamRdo.mergeUpFlag = 0; 265 } 266 267 if (rx == pOnePart->StartCUX) 268 { 269 saoLcuParamRdo.mergeLeftFlag = 0; 270 } 271 272 // set type and offsets 273 saoLcuParamRdo.typeIdx = iTypeIdx; 274 saoLcuParamRdo.subTypeIdx = (iTypeIdx==SAO_BO)?bestClassTableBo:0; 275 saoLcuParamRdo.length = m_iNumClass[iTypeIdx]; 276 for (iClassIdx = 0; iClassIdx < saoLcuParamRdo.length; iClassIdx++) 277 { 278 saoLcuParamRdo.offset[iClassIdx] = (Int)m_iOffset[iPartIdx][iTypeIdx][iClassIdx+saoLcuParamRdo.subTypeIdx+1]; 279 } 280 281 m_pcEntropyCoder->encodeSaoUnitInterleaving(yCbCr, 1, rx, ry, &saoLcuParamRdo, 1, 1, allowMergeLeft, allowMergeUp); 282 283 } 284 } 285 286 m_iDist[iPartIdx][iTypeIdx] = iEstDist; 287 m_iRate[iPartIdx][iTypeIdx] = m_pcEntropyCoder->getNumberOfWrittenBits(); 288 289 m_dCost[iPartIdx][iTypeIdx] = (Double)((Double)m_iDist[iPartIdx][iTypeIdx] + dLambda * (Double) m_iRate[iPartIdx][iTypeIdx]); 290 291 if(m_dCost[iPartIdx][iTypeIdx] < m_dCostPartBest[iPartIdx]) 292 { 293 m_iDistOrg [iPartIdx] = 0; 294 m_dCostPartBest[iPartIdx] = m_dCost[iPartIdx][iTypeIdx]; 295 m_iTypePartBest[iPartIdx] = iTypeIdx; 296 if( m_bUseSBACRD ) 297 m_pcRDGoOnSbacCoder->store( m_pppcRDSbacCoder[pOnePart->PartLevel][CI_TEMP_BEST] ); 298 } 299 } 300 else 301 { 302 if(m_iDistOrg[iPartIdx] < m_dCostPartBest[iPartIdx] ) 303 { 304 m_dCostPartBest[iPartIdx] = (Double) m_iDistOrg[iPartIdx] + m_pcEntropyCoder->getNumberOfWrittenBits()*dLambda ; 305 m_iTypePartBest[iPartIdx] = -1; 306 if( m_bUseSBACRD ) 307 m_pcRDGoOnSbacCoder->store( m_pppcRDSbacCoder[pOnePart->PartLevel][CI_TEMP_BEST] ); 308 } 309 } 310 } 311 312 pOnePart->bProcessed = true; 313 pOnePart->bSplit = false; 314 pOnePart->iMinDist = m_iTypePartBest[iPartIdx] >= 0 ? m_iDist[iPartIdx][m_iTypePartBest[iPartIdx]] : m_iDistOrg[iPartIdx]; 315 pOnePart->iMinRate = (Int) (m_iTypePartBest[iPartIdx] >= 0 ? m_iRate[iPartIdx][m_iTypePartBest[iPartIdx]] : 0); 316 pOnePart->dMinCost = pOnePart->iMinDist + dLambda * pOnePart->iMinRate; 317 pOnePart->iBestType = m_iTypePartBest[iPartIdx]; 318 if (pOnePart->iBestType != -1) 319 { 320 // pOnePart->bEnableFlag = 1; 321 pOnePart->iLength = m_iNumClass[pOnePart->iBestType]; 322 Int minIndex = 0; 323 if( pOnePart->iBestType == SAO_BO ) 324 { 325 pOnePart->subTypeIdx = bestClassTableBo; 326 minIndex = pOnePart->subTypeIdx; 327 } 328 for (Int i=0; i< pOnePart->iLength ; i++) 329 { 330 pOnePart->iOffset[i] = (Int) m_iOffset[iPartIdx][pOnePart->iBestType][minIndex+i+1]; 331 } 332 138 333 } 139 334 else 140 335 { 141 m_pcEntropyCoder->resetEntropy(); 142 m_pcEntropyCoder->resetBits(); 143 } 144 145 iEstDist = 0; 146 147 m_pcEntropyCoder->m_pcEntropyCoderIf->codeSaoTypeIdx(iTypeIdx+1); 148 149 if (iTypeIdx>=0) 150 { 151 152 for(iClassIdx=1; iClassIdx < ( (iTypeIdx < SAO_BO) ? m_iNumClass[iTypeIdx]+1 : SAO_MAX_BO_CLASSES+1); iClassIdx++) 153 { 154 if( iTypeIdx == SAO_BO) 155 { 156 currentDistortionTableBo[iClassIdx-1] = 0; 157 currentRdCostTableBo[iClassIdx-1] = dLambda; 158 } 159 #if HHI_INTERVIEW_SKIP 160 if(m_iCount [iPartIdx][iTypeIdx][iClassIdx] && !bRenderable) 161 #else 162 if(m_iCount [iPartIdx][iTypeIdx][iClassIdx]) 163 #endif 164 { 165 #if FULL_NBIT 166 m_iOffset[iPartIdx][iTypeIdx][iClassIdx] = (Int64) xRoundIbdi((Double)(m_iOffsetOrg[iPartIdx][iTypeIdx][iClassIdx]<<g_uiBitDepth-8) / (Double)(m_iCount [iPartIdx][iTypeIdx][iClassIdx]<<m_uiSaoBitIncrease)); 167 #else 168 m_iOffset[iPartIdx][iTypeIdx][iClassIdx] = (Int64) xRoundIbdi((Double)(m_iOffsetOrg[iPartIdx][iTypeIdx][iClassIdx]<<g_uiBitIncrement) / (Double)(m_iCount [iPartIdx][iTypeIdx][iClassIdx]<<m_uiSaoBitIncrease)); 169 #endif 170 m_iOffset[iPartIdx][iTypeIdx][iClassIdx] = Clip3(-m_iOffsetTh, m_iOffsetTh-1, (Int)m_iOffset[iPartIdx][iTypeIdx][iClassIdx]); 171 172 if (iTypeIdx < 4) 173 { 174 if ( m_iOffset[iPartIdx][iTypeIdx][iClassIdx]<0 && iClassIdx<3 ) 175 { 176 m_iOffset[iPartIdx][iTypeIdx][iClassIdx] = 0; 177 } 178 if ( m_iOffset[iPartIdx][iTypeIdx][iClassIdx]>0 && iClassIdx>=3) 179 { 180 m_iOffset[iPartIdx][iTypeIdx][iClassIdx] = 0; 181 } 182 } 183 { 184 //Clean up, best_q_offset. 185 Int64 iIterOffset, iTempOffset; 186 Int64 iTempDist, iTempRate; 187 Double dTempCost, dTempMinCost; 188 UInt uiLength, uiTemp; 189 190 iIterOffset = m_iOffset[iPartIdx][iTypeIdx][iClassIdx]; 191 m_iOffset[iPartIdx][iTypeIdx][iClassIdx] = 0; 192 dTempMinCost = dLambda; // Assuming sending quantized value 0 results in zero offset and sending the value zero needs 1 bit. entropy coder can be used to measure the exact rate here. 193 194 while (iIterOffset != 0) 195 { 196 // Calculate the bits required for signalling the offset 197 uiLength = 1; 198 uiTemp = (UInt)((iIterOffset <= 0) ? ( (-iIterOffset<<1) + 1 ) : (iIterOffset<<1)); 199 while( 1 != uiTemp ) 200 { 201 uiTemp >>= 1; 202 uiLength += 2; 203 } 204 iTempRate = (uiLength >> 1) + ((uiLength+1) >> 1); 205 206 // Do the dequntization before distorion calculation 207 iTempOffset = iIterOffset << m_uiSaoBitIncrease; 208 iTempDist = (( m_iCount [iPartIdx][iTypeIdx][iClassIdx]*iTempOffset*iTempOffset-m_iOffsetOrg[iPartIdx][iTypeIdx][iClassIdx]*iTempOffset*2 ) >> uiShift); 209 210 dTempCost = ((Double)iTempDist + dLambda * (Double) iTempRate); 211 if(dTempCost < dTempMinCost) 212 { 213 dTempMinCost = dTempCost; 214 m_iOffset[iPartIdx][iTypeIdx][iClassIdx] = iIterOffset; 215 if(iTypeIdx == SAO_BO) 216 { 217 currentDistortionTableBo[iClassIdx-1] = (Int) iTempDist; 218 currentRdCostTableBo[iClassIdx-1] = dTempCost; 219 } 220 } 221 iIterOffset = (iIterOffset > 0) ? (iIterOffset-1):(iIterOffset+1); 222 } 223 224 } 225 } 226 else 227 { 228 m_iOffsetOrg[iPartIdx][iTypeIdx][iClassIdx] = 0; 229 m_iOffset[iPartIdx][iTypeIdx][iClassIdx] = 0; 230 } 231 if( iTypeIdx != SAO_BO ) 232 { 233 iCount = m_iCount [iPartIdx][iTypeIdx][iClassIdx]; 234 iOffset = m_iOffset[iPartIdx][iTypeIdx][iClassIdx] << m_uiSaoBitIncrease; 235 iOffsetOrg = m_iOffsetOrg[iPartIdx][iTypeIdx][iClassIdx]; 236 iEstDist += (( iCount*iOffset*iOffset-iOffsetOrg*iOffset*2 ) >> uiShift); 237 if (iTypeIdx < 4) 238 { 239 if (iClassIdx<3) 240 { 241 m_pcEntropyCoder->m_pcEntropyCoderIf->codeSaoUvlc((Int)m_iOffset[iPartIdx][iTypeIdx][iClassIdx]); 242 } 243 else 244 { 245 m_pcEntropyCoder->m_pcEntropyCoderIf->codeSaoUvlc((Int)-m_iOffset[iPartIdx][iTypeIdx][iClassIdx]); 246 } 247 } 248 else 249 { 250 m_pcEntropyCoder->m_pcEntropyCoderIf->codeSaoSvlc((Int)m_iOffset[iPartIdx][iTypeIdx][iClassIdx]); 251 } 252 } 253 } 254 255 if( iTypeIdx == SAO_BO ) 256 { 257 // Estimate Best Position 258 Double currentRDCost = 0.0; 259 260 for(Int i=0; i< SAO_MAX_BO_CLASSES -SAO_BO_LEN +1; i++) 261 { 262 currentRDCost = 0.0; 263 for(UInt uj = i; uj < i+SAO_BO_LEN; uj++) 264 { 265 currentRDCost += currentRdCostTableBo[uj]; 266 } 267 268 if( currentRDCost < bestRDCostTableBo) 269 { 270 bestRDCostTableBo = currentRDCost; 271 bestClassTableBo = i; 272 } 273 } 274 275 // Re code all Offsets 276 // Code Center 277 m_pcEntropyCoder->m_pcEntropyCoderIf->codeSaoUflc( (UInt) (bestClassTableBo) ); 278 279 for(iClassIdx = bestClassTableBo; iClassIdx < bestClassTableBo+SAO_BO_LEN; iClassIdx++) 280 { 281 m_pcEntropyCoder->m_pcEntropyCoderIf->codeSaoSvlc((Int)m_iOffset[iPartIdx][iTypeIdx][iClassIdx+1]); 282 iEstDist += currentDistortionTableBo[iClassIdx]; 283 } 284 } 285 286 m_iDist[iPartIdx][iTypeIdx] = iEstDist; 287 m_iRate[iPartIdx][iTypeIdx] = m_pcEntropyCoder->getNumberOfWrittenBits(); 288 289 m_dCost[iPartIdx][iTypeIdx] = (Double)((Double)m_iDist[iPartIdx][iTypeIdx] + dLambda * (Double) m_iRate[iPartIdx][iTypeIdx]); 290 291 if(m_dCost[iPartIdx][iTypeIdx] < m_dCostPartBest[iPartIdx]) 292 { 293 m_iDistOrg [iPartIdx] = 0; 294 m_dCostPartBest[iPartIdx] = m_dCost[iPartIdx][iTypeIdx]; 295 m_iTypePartBest[iPartIdx] = iTypeIdx; 296 if( m_bUseSBACRD ) 297 m_pcRDGoOnSbacCoder->store( m_pppcRDSbacCoder[pOnePart->PartLevel][CI_TEMP_BEST] ); 298 } 299 } 300 else 301 { 302 if(m_iDistOrg[iPartIdx] < m_dCostPartBest[iPartIdx] ) 303 { 304 m_dCostPartBest[iPartIdx] = (Double) m_iDistOrg[iPartIdx] + m_pcEntropyCoder->getNumberOfWrittenBits()*dLambda ; 305 m_iTypePartBest[iPartIdx] = -1; 306 if( m_bUseSBACRD ) 307 m_pcRDGoOnSbacCoder->store( m_pppcRDSbacCoder[pOnePart->PartLevel][CI_TEMP_BEST] ); 308 } 309 } 310 } 311 312 pOnePart->bProcessed = true; 313 pOnePart->bSplit = false; 314 pOnePart->iMinDist = m_iTypePartBest[iPartIdx] >= 0 ? m_iDist[iPartIdx][m_iTypePartBest[iPartIdx]] : m_iDistOrg[iPartIdx]; 315 pOnePart->iMinRate = (Int) (m_iTypePartBest[iPartIdx] >= 0 ? m_iRate[iPartIdx][m_iTypePartBest[iPartIdx]] : 0); 316 pOnePart->dMinCost = pOnePart->iMinDist + dLambda * pOnePart->iMinRate; 317 pOnePart->iBestType = m_iTypePartBest[iPartIdx]; 318 if (pOnePart->iBestType != -1) 319 { 320 // pOnePart->bEnableFlag = 1; 321 pOnePart->iLength = m_iNumClass[pOnePart->iBestType]; 322 Int minIndex = 0; 323 if( pOnePart->iBestType == SAO_BO ) 324 { 325 pOnePart->bandPosition = bestClassTableBo; 326 minIndex = pOnePart->bandPosition; 327 } 328 for (Int i=0; i< pOnePart->iLength ; i++) 329 { 330 pOnePart->iOffset[i] = (Int) m_iOffset[iPartIdx][pOnePart->iBestType][minIndex+i+1]; 331 } 332 333 } 334 else 335 { 336 // pOnePart->bEnableFlag = 0; 337 pOnePart->iLength = 0; 338 } 336 // pOnePart->bEnableFlag = 0; 337 pOnePart->iLength = 0; 338 } 339 339 } 340 340 … … 343 343 Void TEncSampleAdaptiveOffset::disablePartTree(SAOQTPart *psQTPart, Int iPartIdx) 344 344 { 345 SAOQTPart* pOnePart= &(psQTPart[iPartIdx]);346 pOnePart->bSplit = false;347 pOnePart->iLength = 0;348 pOnePart->iBestType = -1;349 350 if (pOnePart->PartLevel < m_uiMaxSplitLevel)351 {352 for (Int i=0; i<NUM_DOWN_PART; i++)353 {354 disablePartTree(psQTPart, pOnePart->DownPartsIdx[i]);355 }356 }345 SAOQTPart* pOnePart= &(psQTPart[iPartIdx]); 346 pOnePart->bSplit = false; 347 pOnePart->iLength = 0; 348 pOnePart->iBestType = -1; 349 350 if (pOnePart->PartLevel < m_uiMaxSplitLevel) 351 { 352 for (Int i=0; i<NUM_DOWN_PART; i++) 353 { 354 disablePartTree(psQTPart, pOnePart->DownPartsIdx[i]); 355 } 356 } 357 357 } 358 358 … … 360 360 * \param iPartIdx, pcPicOrg, pcPicDec, pcPicRest, &dCostFinal 361 361 */ 362 Void TEncSampleAdaptiveOffset::runQuadTreeDecision(SAOQTPart *psQTPart, Int iPartIdx, Double &dCostFinal, Int iMaxLevel, Double dLambda) 363 { 364 SAOQTPart* pOnePart = &(psQTPart[iPartIdx]); 365 366 UInt uiDepth = pOnePart->PartLevel; 367 UInt uhNextDepth = uiDepth+1; 368 369 if (iPartIdx == 0) 370 { 371 dCostFinal = 0; 372 } 373 374 //SAO for this part 375 if(!pOnePart->bProcessed) 376 { 377 rdoSaoOnePart (psQTPart, iPartIdx, dLambda); 378 } 379 380 //SAO for sub 4 parts 381 if (pOnePart->PartLevel < iMaxLevel) 382 { 383 Double dCostNotSplit = dLambda + pOnePart->dMinCost; 384 Double dCostSplit = dLambda; 385 386 for (Int i=0; i< NUM_DOWN_PART ;i++) 387 { 388 if( m_bUseSBACRD ) 389 { 390 if ( 0 == i) //initialize RD with previous depth buffer 391 { 392 m_pppcRDSbacCoder[uhNextDepth][CI_CURR_BEST]->load(m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST]); 362 Void TEncSampleAdaptiveOffset::runQuadTreeDecision(SAOQTPart *psQTPart, Int iPartIdx, Double &dCostFinal, Int iMaxLevel, Double dLambda, Int yCbCr) 363 { 364 SAOQTPart* pOnePart = &(psQTPart[iPartIdx]); 365 366 UInt uiDepth = pOnePart->PartLevel; 367 UInt uhNextDepth = uiDepth+1; 368 369 if (iPartIdx == 0) 370 { 371 dCostFinal = 0; 372 } 373 374 //SAO for this part 375 if(!pOnePart->bProcessed) 376 { 377 rdoSaoOnePart (psQTPart, iPartIdx, dLambda, yCbCr); 378 } 379 380 //SAO for sub 4 parts 381 if (pOnePart->PartLevel < iMaxLevel) 382 { 383 Double dCostNotSplit = dLambda + pOnePart->dMinCost; 384 Double dCostSplit = dLambda; 385 386 for (Int i=0; i< NUM_DOWN_PART ;i++) 387 { 388 if( m_bUseSBACRD ) 389 { 390 if ( 0 == i) //initialize RD with previous depth buffer 391 { 392 m_pppcRDSbacCoder[uhNextDepth][CI_CURR_BEST]->load(m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST]); 393 } 394 else 395 { 396 m_pppcRDSbacCoder[uhNextDepth][CI_CURR_BEST]->load(m_pppcRDSbacCoder[uhNextDepth][CI_NEXT_BEST]); 397 } 398 } 399 runQuadTreeDecision(psQTPart, pOnePart->DownPartsIdx[i], dCostFinal, iMaxLevel, dLambda, yCbCr); 400 dCostSplit += dCostFinal; 401 if( m_bUseSBACRD ) 402 { 403 m_pppcRDSbacCoder[uhNextDepth][CI_NEXT_BEST]->load(m_pppcRDSbacCoder[uhNextDepth][CI_TEMP_BEST]); 404 } 405 } 406 407 if(dCostSplit < dCostNotSplit) 408 { 409 dCostFinal = dCostSplit; 410 pOnePart->bSplit = true; 411 pOnePart->iLength = 0; 412 pOnePart->iBestType = -1; 413 if( m_bUseSBACRD ) 414 { 415 m_pppcRDSbacCoder[uiDepth][CI_NEXT_BEST]->load(m_pppcRDSbacCoder[uhNextDepth][CI_NEXT_BEST]); 416 } 393 417 } 394 418 else 395 419 { 396 m_pppcRDSbacCoder[uhNextDepth][CI_CURR_BEST]->load(m_pppcRDSbacCoder[uhNextDepth][CI_NEXT_BEST]); 397 } 398 } 399 runQuadTreeDecision(psQTPart, pOnePart->DownPartsIdx[i], dCostFinal, iMaxLevel, dLambda); 400 dCostSplit += dCostFinal; 401 if( m_bUseSBACRD ) 402 { 403 m_pppcRDSbacCoder[uhNextDepth][CI_NEXT_BEST]->load(m_pppcRDSbacCoder[uhNextDepth][CI_TEMP_BEST]); 404 } 405 } 406 407 if(dCostSplit < dCostNotSplit) 408 { 409 dCostFinal = dCostSplit; 410 pOnePart->bSplit = true; 411 pOnePart->iLength = 0; 412 pOnePart->iBestType = -1; 413 if( m_bUseSBACRD ) 414 { 415 m_pppcRDSbacCoder[uiDepth][CI_NEXT_BEST]->load(m_pppcRDSbacCoder[uhNextDepth][CI_NEXT_BEST]); 416 } 420 dCostFinal = dCostNotSplit; 421 pOnePart->bSplit = false; 422 for (Int i=0; i<NUM_DOWN_PART; i++) 423 { 424 disablePartTree(psQTPart, pOnePart->DownPartsIdx[i]); 425 } 426 if( m_bUseSBACRD ) 427 { 428 m_pppcRDSbacCoder[uiDepth][CI_NEXT_BEST]->load(m_pppcRDSbacCoder[uiDepth][CI_TEMP_BEST]); 429 } 430 } 417 431 } 418 432 else 419 433 { 420 dCostFinal = dCostNotSplit; 421 pOnePart->bSplit = false; 422 for (Int i=0; i<NUM_DOWN_PART; i++) 423 { 424 disablePartTree(psQTPart, pOnePart->DownPartsIdx[i]); 425 } 426 if( m_bUseSBACRD ) 427 { 428 m_pppcRDSbacCoder[uiDepth][CI_NEXT_BEST]->load(m_pppcRDSbacCoder[uiDepth][CI_TEMP_BEST]); 429 } 430 } 431 } 432 else 433 { 434 dCostFinal = pOnePart->dMinCost; 435 } 434 dCostFinal = pOnePart->dMinCost; 435 } 436 436 } 437 437 … … 446 446 if (m_iCount [i][j]) 447 447 { 448 delete [] m_iCount [i][j]; 448 delete [] m_iCount [i][j]; 449 449 } 450 450 if (m_iOffset[i][j]) … … 454 454 if (m_iOffsetOrg[i][j]) 455 455 { 456 delete [] m_iOffsetOrg[i][j]; 456 delete [] m_iOffsetOrg[i][j]; 457 457 } 458 458 } … … 463 463 if (m_iDist[i]) 464 464 { 465 delete [] m_iDist[i]; 465 delete [] m_iDist[i]; 466 466 } 467 467 if (m_dCost[i]) … … 471 471 if (m_iCount [i]) 472 472 { 473 delete [] m_iCount [i]; 473 delete [] m_iCount [i]; 474 474 } 475 475 if (m_iOffset[i]) … … 479 479 if (m_iOffsetOrg[i]) 480 480 { 481 delete [] m_iOffsetOrg[i]; 482 } 483 481 delete [] m_iOffsetOrg[i]; 482 } 484 483 } 485 484 if (m_iDistOrg) … … 518 517 { 519 518 delete [] m_iOffsetOrg ; m_iOffsetOrg = NULL; 519 } 520 Int numLcu = m_iNumCuInWidth * m_iNumCuInHeight; 521 522 for (Int i=0;i<numLcu;i++) 523 { 524 for (Int j=0;j<3;j++) 525 { 526 for (Int k=0;k<MAX_NUM_SAO_TYPE;k++) 527 { 528 if (m_count_PreDblk [i][j][k]) 529 { 530 delete [] m_count_PreDblk [i][j][k]; 531 } 532 if (m_offsetOrg_PreDblk[i][j][k]) 533 { 534 delete [] m_offsetOrg_PreDblk[i][j][k]; 535 } 536 } 537 if (m_count_PreDblk [i][j]) 538 { 539 delete [] m_count_PreDblk [i][j]; 540 } 541 if (m_offsetOrg_PreDblk[i][j]) 542 { 543 delete [] m_offsetOrg_PreDblk[i][j]; 544 } 545 } 546 if (m_count_PreDblk [i]) 547 { 548 delete [] m_count_PreDblk [i]; 549 } 550 if (m_offsetOrg_PreDblk[i]) 551 { 552 delete [] m_offsetOrg_PreDblk[i]; 553 } 554 } 555 if (m_count_PreDblk) 556 { 557 delete [] m_count_PreDblk ; m_count_PreDblk = NULL; 558 } 559 if (m_offsetOrg_PreDblk) 560 { 561 delete [] m_offsetOrg_PreDblk ; m_offsetOrg_PreDblk = NULL; 520 562 } 521 563 … … 546 588 Void TEncSampleAdaptiveOffset::createEncBuffer() 547 589 { 548 m_iDistOrg = new Int64 [m_iNumTotalParts]; 549 m_dCostPartBest = new Double [m_iNumTotalParts]; 550 m_iTypePartBest = new Int [m_iNumTotalParts]; 590 m_iDistOrg = new Int64 [m_iNumTotalParts]; 591 m_dCostPartBest = new Double [m_iNumTotalParts]; 592 m_iTypePartBest = new Int [m_iNumTotalParts]; 551 593 552 594 m_iRate = new Int64* [m_iNumTotalParts]; … … 561 603 { 562 604 m_iRate[i] = new Int64 [MAX_NUM_SAO_TYPE]; 563 m_iDist[i] = new Int64 [MAX_NUM_SAO_TYPE]; 564 m_dCost[i] = new Double [MAX_NUM_SAO_TYPE]; 565 566 m_iCount [i] = new Int64 *[MAX_NUM_SAO_TYPE]; 567 m_iOffset[i] = new Int64 *[MAX_NUM_SAO_TYPE]; 568 m_iOffsetOrg[i] = new Int64 *[MAX_NUM_SAO_TYPE]; 605 m_iDist[i] = new Int64 [MAX_NUM_SAO_TYPE]; 606 m_dCost[i] = new Double [MAX_NUM_SAO_TYPE]; 607 608 m_iCount [i] = new Int64 *[MAX_NUM_SAO_TYPE]; 609 m_iOffset[i] = new Int64 *[MAX_NUM_SAO_TYPE]; 610 m_iOffsetOrg[i] = new Int64 *[MAX_NUM_SAO_TYPE]; 569 611 570 612 for (Int j=0;j<MAX_NUM_SAO_TYPE;j++) 571 613 { 572 m_iCount [i][j] = new Int64 [MAX_NUM_SAO_CLASS]; 573 m_iOffset[i][j] = new Int64 [MAX_NUM_SAO_CLASS]; 574 m_iOffsetOrg[i][j]= new Int64 [MAX_NUM_SAO_CLASS]; 614 m_iCount [i][j] = new Int64 [MAX_NUM_SAO_CLASS]; 615 m_iOffset[i][j] = new Int64 [MAX_NUM_SAO_CLASS]; 616 m_iOffsetOrg[i][j]= new Int64 [MAX_NUM_SAO_CLASS]; 617 } 618 } 619 Int numLcu = m_iNumCuInWidth * m_iNumCuInHeight; 620 m_count_PreDblk = new Int64 ***[numLcu]; 621 m_offsetOrg_PreDblk = new Int64 ***[numLcu]; 622 for (Int i=0; i<numLcu; i++) 623 { 624 m_count_PreDblk[i] = new Int64 **[3]; 625 m_offsetOrg_PreDblk[i] = new Int64 **[3]; 626 627 for (Int j=0;j<3;j++) 628 { 629 m_count_PreDblk [i][j] = new Int64 *[MAX_NUM_SAO_TYPE]; 630 m_offsetOrg_PreDblk[i][j] = new Int64 *[MAX_NUM_SAO_TYPE]; 631 632 for (Int k=0;k<MAX_NUM_SAO_TYPE;k++) 633 { 634 m_count_PreDblk [i][j][k] = new Int64 [MAX_NUM_SAO_CLASS]; 635 m_offsetOrg_PreDblk[i][j][k]= new Int64 [MAX_NUM_SAO_CLASS]; 636 } 575 637 } 576 638 } … … 606 668 607 669 /** Start SAO encoder 608 * \param pcPic, pcEntropyCoder, pppcRDSbacCoder, pcRDGoOnSbacCoder 670 * \param pcPic, pcEntropyCoder, pppcRDSbacCoder, pcRDGoOnSbacCoder 609 671 */ 610 672 Void TEncSampleAdaptiveOffset::startSaoEnc( TComPic* pcPic, TEncEntropy* pcEntropyCoder, TEncSbac*** pppcRDSbacCoder, TEncSbac* pcRDGoOnSbacCoder) 611 673 { 612 if( pcRDGoOnSbacCoder ) 613 m_bUseSBACRD = true; 614 else 615 m_bUseSBACRD = false; 616 674 m_bUseSBACRD = true; 617 675 m_pcPic = pcPic; 618 676 m_pcEntropyCoder = pcEntropyCoder; 619 677 620 678 m_pcRDGoOnSbacCoder = pcRDGoOnSbacCoder; 679 m_pcEntropyCoder->setEntropyCoder(m_pcRDGoOnSbacCoder, pcPic->getSlice(0)); 621 680 m_pcEntropyCoder->resetEntropy(); 622 681 m_pcEntropyCoder->resetBits(); … … 672 731 if (classIdx) 673 732 { 674 stats[classIdx] += (pOrg[x] - pRec[x]); 733 stats[classIdx] += (pOrg[x] - pRec[x]); 675 734 count[classIdx] ++; 676 735 } … … 685 744 pRec = pRecStart; 686 745 687 688 746 startX = (pbBorderAvail[SGU_L]) ? 0 : 1; 689 747 endX = (pbBorderAvail[SGU_R]) ? width : (width -1); … … 693 751 for (x=startX; x< endX; x++) 694 752 { 695 signRight = xSign(pRec[x] - pRec[x+1]); 753 signRight = xSign(pRec[x] - pRec[x+1]); 696 754 edgeType = signRight + signLeft + 2; 697 755 signLeft = -signRight; … … 726 784 for (x=0; x< width; x++) 727 785 { 728 signDown = xSign(pRec[x] - pRec[x+stride]); 786 signDown = xSign(pRec[x] - pRec[x+stride]); 729 787 edgeType = signDown + m_iUpBuff1[x] + 2; 730 788 m_iUpBuff1[x] = -signDown; … … 785 843 count[m_auiEoTable[edgeType]] ++; 786 844 787 m_iUpBufft[x+1] = -signDown1; 845 m_iUpBufft[x+1] = -signDown1; 788 846 } 789 847 m_iUpBufft[startX] = xSign(pRec[stride+startX] - pRec[startX-1]); … … 931 989 posOffset = (yPos* stride) + xPos; 932 990 933 #if HHI_INTERVIEW_SKIP934 if( !m_pcPic->getCU(iAddr)->getRenderable(0 ))935 {936 991 calcSaoStatsBlock(pPicRec+ posOffset, pPicOrg+ posOffset, stride, ppStats, ppCount,width, height, pbBorderAvail); 937 } 938 #else 939 calcSaoStatsBlock(pPicRec+ posOffset, pPicOrg+ posOffset, stride, ppStats, ppCount,width, height, pbBorderAvail); 940 #endif 941 } 942 } 943 992 } 993 } 944 994 } 945 995 … … 974 1024 Int iIsChroma = (iYCbCr!=0)? 1:0; 975 1025 Int numSkipLine = iIsChroma? 2:4; 1026 if (m_saoLcuBasedOptimization == 0) 1027 { 1028 numSkipLine = 0; 1029 } 1030 1031 #if SAO_SKIP_RIGHT 1032 Int numSkipLineRight = iIsChroma? 3:5; 1033 if (m_saoLcuBasedOptimization == 0) 1034 { 1035 numSkipLineRight = 0; 1036 } 1037 #endif 1038 1039 iPicWidthTmp = m_iPicWidth >> iIsChroma; 1040 iPicHeightTmp = m_iPicHeight >> iIsChroma; 1041 iLcuWidth = iLcuWidth >> iIsChroma; 1042 iLcuHeight = iLcuHeight >> iIsChroma; 1043 uiLPelX = uiLPelX >> iIsChroma; 1044 uiTPelY = uiTPelY >> iIsChroma; 1045 uiRPelX = uiLPelX + iLcuWidth ; 1046 uiBPelY = uiTPelY + iLcuHeight ; 1047 uiRPelX = uiRPelX > iPicWidthTmp ? iPicWidthTmp : uiRPelX; 1048 uiBPelY = uiBPelY > iPicHeightTmp ? iPicHeightTmp : uiBPelY; 1049 iLcuWidth = uiRPelX - uiLPelX; 1050 iLcuHeight = uiBPelY - uiTPelY; 1051 1052 iStride = (iYCbCr == 0)? m_pcPic->getStride(): m_pcPic->getCStride(); 1053 1054 //if(iSaoType == BO_0 || iSaoType == BO_1) 1055 { 1056 if( m_saoLcuBasedOptimization && m_saoLcuBoundary ) 1057 { 1058 numSkipLine = iIsChroma? 1:3; 1059 numSkipLineRight = iIsChroma? 2:4; 1060 } 1061 iStats = m_iOffsetOrg[iPartIdx][SAO_BO]; 1062 iCount = m_iCount [iPartIdx][SAO_BO]; 1063 1064 pOrg = getPicYuvAddr(m_pcPic->getPicYuvOrg(), iYCbCr, iAddr); 1065 pRec = getPicYuvAddr(m_pcPic->getPicYuvRec(), iYCbCr, iAddr); 1066 1067 #if SAO_SKIP_RIGHT 1068 iEndX = (uiRPelX == iPicWidthTmp) ? iLcuWidth : iLcuWidth-numSkipLineRight; 1069 #endif 1070 1071 iEndY = (uiBPelY == iPicHeightTmp) ? iLcuHeight : iLcuHeight-numSkipLine; 1072 for (y=0; y<iEndY; y++) 1073 { 1074 #if SAO_SKIP_RIGHT 1075 for (x=0; x<iEndX; x++) 1076 #else 1077 for (x=0; x<iLcuWidth; x++) 1078 #endif 1079 { 1080 iClassIdx = m_lumaTableBo[pRec[x]]; 1081 if (iClassIdx) 1082 { 1083 iStats[iClassIdx] += (pOrg[x] - pRec[x]); 1084 iCount[iClassIdx] ++; 1085 } 1086 } 1087 pOrg += iStride; 1088 pRec += iStride; 1089 } 1090 1091 } 1092 Int iSignLeft; 1093 Int iSignRight; 1094 Int iSignDown; 1095 Int iSignDown1; 1096 Int iSignDown2; 1097 1098 UInt uiEdgeType; 1099 1100 //if (iSaoType == EO_0 || iSaoType == EO_1 || iSaoType == EO_2 || iSaoType == EO_3) 1101 { 1102 //if (iSaoType == EO_0) 1103 { 1104 if( m_saoLcuBasedOptimization && m_saoLcuBoundary ) 1105 { 1106 numSkipLine = iIsChroma? 1:3; 1107 numSkipLineRight = iIsChroma? 3:5; 1108 } 1109 iStats = m_iOffsetOrg[iPartIdx][SAO_EO_0]; 1110 iCount = m_iCount [iPartIdx][SAO_EO_0]; 1111 1112 pOrg = getPicYuvAddr(m_pcPic->getPicYuvOrg(), iYCbCr, iAddr); 1113 pRec = getPicYuvAddr(m_pcPic->getPicYuvRec(), iYCbCr, iAddr); 1114 1115 iStartX = (uiLPelX == 0) ? 1 : 0; 1116 #if SAO_SKIP_RIGHT 1117 iEndX = (uiRPelX == iPicWidthTmp) ? iLcuWidth-1 : iLcuWidth-numSkipLineRight; 1118 #else 1119 iEndX = (uiRPelX == iPicWidthTmp) ? iLcuWidth-1 : iLcuWidth; 1120 #endif 1121 for (y=0; y<iLcuHeight-numSkipLine; y++) 1122 { 1123 iSignLeft = xSign(pRec[iStartX] - pRec[iStartX-1]); 1124 for (x=iStartX; x< iEndX; x++) 1125 { 1126 iSignRight = xSign(pRec[x] - pRec[x+1]); 1127 uiEdgeType = iSignRight + iSignLeft + 2; 1128 iSignLeft = -iSignRight; 1129 1130 iStats[m_auiEoTable[uiEdgeType]] += (pOrg[x] - pRec[x]); 1131 iCount[m_auiEoTable[uiEdgeType]] ++; 1132 } 1133 pOrg += iStride; 1134 pRec += iStride; 1135 } 1136 } 1137 1138 //if (iSaoType == EO_1) 1139 { 1140 if( m_saoLcuBasedOptimization && m_saoLcuBoundary ) 1141 { 1142 numSkipLine = iIsChroma? 2:4; 1143 numSkipLineRight = iIsChroma? 2:4; 1144 } 1145 iStats = m_iOffsetOrg[iPartIdx][SAO_EO_1]; 1146 iCount = m_iCount [iPartIdx][SAO_EO_1]; 1147 1148 pOrg = getPicYuvAddr(m_pcPic->getPicYuvOrg(), iYCbCr, iAddr); 1149 pRec = getPicYuvAddr(m_pcPic->getPicYuvRec(), iYCbCr, iAddr); 1150 1151 iStartY = (uiTPelY == 0) ? 1 : 0; 1152 #if SAO_SKIP_RIGHT 1153 iEndX = (uiRPelX == iPicWidthTmp) ? iLcuWidth : iLcuWidth-numSkipLineRight; 1154 #endif 1155 iEndY = (uiBPelY == iPicHeightTmp) ? iLcuHeight-1 : iLcuHeight-numSkipLine; 1156 if (uiTPelY == 0) 1157 { 1158 pOrg += iStride; 1159 pRec += iStride; 1160 } 1161 1162 for (x=0; x< iLcuWidth; x++) 1163 { 1164 m_iUpBuff1[x] = xSign(pRec[x] - pRec[x-iStride]); 1165 } 1166 for (y=iStartY; y<iEndY; y++) 1167 { 1168 #if SAO_SKIP_RIGHT 1169 for (x=0; x<iEndX; x++) 1170 #else 1171 for (x=0; x<iLcuWidth; x++) 1172 #endif 1173 { 1174 iSignDown = xSign(pRec[x] - pRec[x+iStride]); 1175 uiEdgeType = iSignDown + m_iUpBuff1[x] + 2; 1176 m_iUpBuff1[x] = -iSignDown; 1177 1178 iStats[m_auiEoTable[uiEdgeType]] += (pOrg[x] - pRec[x]); 1179 iCount[m_auiEoTable[uiEdgeType]] ++; 1180 } 1181 pOrg += iStride; 1182 pRec += iStride; 1183 } 1184 } 1185 //if (iSaoType == EO_2) 1186 { 1187 if( m_saoLcuBasedOptimization && m_saoLcuBoundary ) 1188 { 1189 numSkipLine = iIsChroma? 2:4; 1190 numSkipLineRight = iIsChroma? 3:5; 1191 } 1192 iStats = m_iOffsetOrg[iPartIdx][SAO_EO_2]; 1193 iCount = m_iCount [iPartIdx][SAO_EO_2]; 1194 1195 pOrg = getPicYuvAddr(m_pcPic->getPicYuvOrg(), iYCbCr, iAddr); 1196 pRec = getPicYuvAddr(m_pcPic->getPicYuvRec(), iYCbCr, iAddr); 1197 1198 iStartX = (uiLPelX == 0) ? 1 : 0; 1199 #if SAO_SKIP_RIGHT 1200 iEndX = (uiRPelX == iPicWidthTmp) ? iLcuWidth-1 : iLcuWidth-numSkipLineRight; 1201 #else 1202 iEndX = (uiRPelX == iPicWidthTmp) ? iLcuWidth-1 : iLcuWidth; 1203 #endif 1204 1205 iStartY = (uiTPelY == 0) ? 1 : 0; 1206 iEndY = (uiBPelY == iPicHeightTmp) ? iLcuHeight-1 : iLcuHeight-numSkipLine; 1207 if (uiTPelY == 0) 1208 { 1209 pOrg += iStride; 1210 pRec += iStride; 1211 } 1212 1213 for (x=iStartX; x<iEndX; x++) 1214 { 1215 m_iUpBuff1[x] = xSign(pRec[x] - pRec[x-iStride-1]); 1216 } 1217 for (y=iStartY; y<iEndY; y++) 1218 { 1219 iSignDown2 = xSign(pRec[iStride+iStartX] - pRec[iStartX-1]); 1220 for (x=iStartX; x<iEndX; x++) 1221 { 1222 iSignDown1 = xSign(pRec[x] - pRec[x+iStride+1]) ; 1223 uiEdgeType = iSignDown1 + m_iUpBuff1[x] + 2; 1224 m_iUpBufft[x+1] = -iSignDown1; 1225 iStats[m_auiEoTable[uiEdgeType]] += (pOrg[x] - pRec[x]); 1226 iCount[m_auiEoTable[uiEdgeType]] ++; 1227 } 1228 m_iUpBufft[iStartX] = iSignDown2; 1229 ipSwap = m_iUpBuff1; 1230 m_iUpBuff1 = m_iUpBufft; 1231 m_iUpBufft = ipSwap; 1232 1233 pRec += iStride; 1234 pOrg += iStride; 1235 } 1236 } 1237 //if (iSaoType == EO_3 ) 1238 { 1239 if( m_saoLcuBasedOptimization && m_saoLcuBoundary ) 1240 { 1241 numSkipLine = iIsChroma? 2:4; 1242 numSkipLineRight = iIsChroma? 3:5; 1243 } 1244 iStats = m_iOffsetOrg[iPartIdx][SAO_EO_3]; 1245 iCount = m_iCount [iPartIdx][SAO_EO_3]; 1246 1247 pOrg = getPicYuvAddr(m_pcPic->getPicYuvOrg(), iYCbCr, iAddr); 1248 pRec = getPicYuvAddr(m_pcPic->getPicYuvRec(), iYCbCr, iAddr); 1249 1250 iStartX = (uiLPelX == 0) ? 1 : 0; 1251 #if SAO_SKIP_RIGHT 1252 iEndX = (uiRPelX == iPicWidthTmp) ? iLcuWidth-1 : iLcuWidth-numSkipLineRight; 1253 #else 1254 iEndX = (uiRPelX == iPicWidthTmp) ? iLcuWidth-1 : iLcuWidth; 1255 #endif 1256 1257 iStartY = (uiTPelY == 0) ? 1 : 0; 1258 iEndY = (uiBPelY == iPicHeightTmp) ? iLcuHeight-1 : iLcuHeight-numSkipLine; 1259 if (iStartY == 1) 1260 { 1261 pOrg += iStride; 1262 pRec += iStride; 1263 } 1264 1265 for (x=iStartX-1; x<iEndX; x++) 1266 { 1267 m_iUpBuff1[x] = xSign(pRec[x] - pRec[x-iStride+1]); 1268 } 1269 1270 for (y=iStartY; y<iEndY; y++) 1271 { 1272 for (x=iStartX; x<iEndX; x++) 1273 { 1274 iSignDown1 = xSign(pRec[x] - pRec[x+iStride-1]) ; 1275 uiEdgeType = iSignDown1 + m_iUpBuff1[x] + 2; 1276 m_iUpBuff1[x-1] = -iSignDown1; 1277 iStats[m_auiEoTable[uiEdgeType]] += (pOrg[x] - pRec[x]); 1278 iCount[m_auiEoTable[uiEdgeType]] ++; 1279 } 1280 m_iUpBuff1[iEndX-1] = xSign(pRec[iEndX-1 + iStride] - pRec[iEndX]); 1281 1282 pRec += iStride; 1283 pOrg += iStride; 1284 } 1285 } 1286 } 1287 } 1288 1289 1290 Void TEncSampleAdaptiveOffset::calcSaoStatsCu_BeforeDblk( TComPic* pcPic ) 1291 { 1292 Int addr, yCbCr; 1293 Int x,y; 1294 TComSPS *pTmpSPS = pcPic->getSlice(0)->getSPS(); 1295 1296 Pel* pOrg; 1297 Pel* pRec; 1298 Int stride; 1299 Int lcuWidth = pTmpSPS->getMaxCUHeight(); 1300 Int lcuHeight = pTmpSPS->getMaxCUWidth(); 1301 UInt rPelX; 1302 UInt bPelY; 1303 Int64* stats; 1304 Int64* count; 1305 Int classIdx; 1306 Int picWidthTmp = 0; 1307 Int picHeightTmp = 0; 1308 Int startX; 1309 Int startY; 1310 Int endX; 1311 Int endY; 1312 Int firstX, firstY; 1313 1314 Int idxY; 1315 Int idxX; 1316 Int frameHeightInCU = m_iNumCuInHeight; 1317 Int frameWidthInCU = m_iNumCuInWidth; 1318 Int j, k; 1319 1320 Int isChroma; 1321 Int numSkipLine, numSkipLineRight; 1322 1323 UInt lPelX, tPelY; 1324 TComDataCU *pTmpCu; 1325 1326 for (idxY = 0; idxY< frameHeightInCU; idxY++) 1327 { 1328 for (idxX = 0; idxX< frameWidthInCU; idxX++) 1329 { 1330 lcuWidth = pTmpSPS->getMaxCUHeight(); 1331 lcuHeight = pTmpSPS->getMaxCUWidth(); 1332 addr = idxX + frameWidthInCU*idxY; 1333 pTmpCu = pcPic->getCU(addr); 1334 lPelX = pTmpCu->getCUPelX(); 1335 tPelY = pTmpCu->getCUPelY(); 1336 for( yCbCr = 0; yCbCr < 3; yCbCr++ ) 1337 { 1338 isChroma = (yCbCr!=0)? 1:0; 1339 1340 for ( j=0;j<MAX_NUM_SAO_TYPE;j++) 1341 { 1342 for ( k=0;k< MAX_NUM_SAO_CLASS;k++) 1343 { 1344 m_count_PreDblk [addr][yCbCr][j][k] = 0; 1345 m_offsetOrg_PreDblk[addr][yCbCr][j][k] = 0; 1346 } 1347 } 1348 if( yCbCr == 0 ) 1349 { 1350 picWidthTmp = m_iPicWidth; 1351 picHeightTmp = m_iPicHeight; 1352 } 1353 else if( yCbCr == 1 ) 1354 { 1355 picWidthTmp = m_iPicWidth >> isChroma; 1356 picHeightTmp = m_iPicHeight >> isChroma; 1357 lcuWidth = lcuWidth >> isChroma; 1358 lcuHeight = lcuHeight >> isChroma; 1359 lPelX = lPelX >> isChroma; 1360 tPelY = tPelY >> isChroma; 1361 } 1362 rPelX = lPelX + lcuWidth ; 1363 bPelY = tPelY + lcuHeight ; 1364 rPelX = rPelX > picWidthTmp ? picWidthTmp : rPelX; 1365 bPelY = bPelY > picHeightTmp ? picHeightTmp : bPelY; 1366 lcuWidth = rPelX - lPelX; 1367 lcuHeight = bPelY - tPelY; 1368 1369 stride = (yCbCr == 0)? pcPic->getStride(): pcPic->getCStride(); 1370 1371 //if(iSaoType == BO) 1372 1373 numSkipLine = isChroma? 1:3; 1374 numSkipLineRight = isChroma? 2:4; 1375 1376 stats = m_offsetOrg_PreDblk[addr][yCbCr][SAO_BO]; 1377 count = m_count_PreDblk[addr][yCbCr][SAO_BO]; 1378 1379 pOrg = getPicYuvAddr(pcPic->getPicYuvOrg(), yCbCr, addr); 1380 pRec = getPicYuvAddr(pcPic->getPicYuvRec(), yCbCr, addr); 1381 1382 startX = (rPelX == picWidthTmp) ? lcuWidth : lcuWidth-numSkipLineRight; 1383 startY = (bPelY == picHeightTmp) ? lcuHeight : lcuHeight-numSkipLine; 1384 1385 for (y=0; y<lcuHeight; y++) 1386 { 1387 for (x=0; x<lcuWidth; x++) 1388 { 1389 if( x < startX && y < startY ) 1390 continue; 1391 1392 classIdx = m_lumaTableBo[pRec[x]]; 1393 if (classIdx) 1394 { 1395 stats[classIdx] += (pOrg[x] - pRec[x]); 1396 count[classIdx] ++; 1397 } 1398 } 1399 pOrg += stride; 1400 pRec += stride; 1401 } 1402 1403 Int signLeft; 1404 Int signRight; 1405 Int signDown; 1406 Int signDown1; 1407 Int signDown2; 1408 1409 UInt uiEdgeType; 1410 1411 //if (iSaoType == EO_0) 1412 1413 numSkipLine = isChroma? 1:3; 1414 numSkipLineRight = isChroma? 3:5; 1415 1416 stats = m_offsetOrg_PreDblk[addr][yCbCr][SAO_EO_0]; 1417 count = m_count_PreDblk[addr][yCbCr][SAO_EO_0]; 1418 1419 pOrg = getPicYuvAddr(pcPic->getPicYuvOrg(), yCbCr, addr); 1420 pRec = getPicYuvAddr(pcPic->getPicYuvRec(), yCbCr, addr); 1421 1422 startX = (rPelX == picWidthTmp) ? lcuWidth-1 : lcuWidth-numSkipLineRight; 1423 startY = (bPelY == picHeightTmp) ? lcuHeight : lcuHeight-numSkipLine; 1424 firstX = (lPelX == 0) ? 1 : 0; 1425 endX = (rPelX == picWidthTmp) ? lcuWidth-1 : lcuWidth; 1426 1427 for (y=0; y<lcuHeight; y++) 1428 { 1429 signLeft = xSign(pRec[firstX] - pRec[firstX-1]); 1430 for (x=firstX; x< endX; x++) 1431 { 1432 signRight = xSign(pRec[x] - pRec[x+1]); 1433 uiEdgeType = signRight + signLeft + 2; 1434 signLeft = -signRight; 1435 1436 if( x < startX && y < startY ) 1437 continue; 1438 1439 stats[m_auiEoTable[uiEdgeType]] += (pOrg[x] - pRec[x]); 1440 count[m_auiEoTable[uiEdgeType]] ++; 1441 } 1442 pOrg += stride; 1443 pRec += stride; 1444 } 1445 1446 //if (iSaoType == EO_1) 1447 1448 numSkipLine = isChroma? 2:4; 1449 numSkipLineRight = isChroma? 2:4; 1450 1451 stats = m_offsetOrg_PreDblk[addr][yCbCr][SAO_EO_1]; 1452 count = m_count_PreDblk[addr][yCbCr][SAO_EO_1]; 1453 1454 pOrg = getPicYuvAddr(pcPic->getPicYuvOrg(), yCbCr, addr); 1455 pRec = getPicYuvAddr(pcPic->getPicYuvRec(), yCbCr, addr); 1456 1457 startX = (rPelX == picWidthTmp) ? lcuWidth : lcuWidth-numSkipLineRight; 1458 startY = (bPelY == picHeightTmp) ? lcuHeight-1 : lcuHeight-numSkipLine; 1459 firstY = (tPelY == 0) ? 1 : 0; 1460 endY = (bPelY == picHeightTmp) ? lcuHeight-1 : lcuHeight; 1461 if (firstY == 1) 1462 { 1463 pOrg += stride; 1464 pRec += stride; 1465 } 1466 1467 for (x=0; x< lcuWidth; x++) 1468 { 1469 m_iUpBuff1[x] = xSign(pRec[x] - pRec[x-stride]); 1470 } 1471 for (y=firstY; y<endY; y++) 1472 { 1473 for (x=0; x<lcuWidth; x++) 1474 { 1475 signDown = xSign(pRec[x] - pRec[x+stride]); 1476 uiEdgeType = signDown + m_iUpBuff1[x] + 2; 1477 m_iUpBuff1[x] = -signDown; 1478 1479 if( x < startX && y < startY ) 1480 continue; 1481 1482 stats[m_auiEoTable[uiEdgeType]] += (pOrg[x] - pRec[x]); 1483 count[m_auiEoTable[uiEdgeType]] ++; 1484 } 1485 pOrg += stride; 1486 pRec += stride; 1487 } 1488 1489 //if (iSaoType == EO_2) 1490 1491 numSkipLine = isChroma? 2:4; 1492 numSkipLineRight = isChroma? 3:5; 1493 1494 stats = m_offsetOrg_PreDblk[addr][yCbCr][SAO_EO_2]; 1495 count = m_count_PreDblk[addr][yCbCr][SAO_EO_2]; 1496 1497 pOrg = getPicYuvAddr(pcPic->getPicYuvOrg(), yCbCr, addr); 1498 pRec = getPicYuvAddr(pcPic->getPicYuvRec(), yCbCr, addr); 1499 1500 startX = (rPelX == picWidthTmp) ? lcuWidth-1 : lcuWidth-numSkipLineRight; 1501 startY = (bPelY == picHeightTmp) ? lcuHeight-1 : lcuHeight-numSkipLine; 1502 firstX = (lPelX == 0) ? 1 : 0; 1503 firstY = (tPelY == 0) ? 1 : 0; 1504 endX = (rPelX == picWidthTmp) ? lcuWidth-1 : lcuWidth; 1505 endY = (bPelY == picHeightTmp) ? lcuHeight-1 : lcuHeight; 1506 if (firstY == 1) 1507 { 1508 pOrg += stride; 1509 pRec += stride; 1510 } 1511 1512 for (x=firstX; x<endX; x++) 1513 { 1514 m_iUpBuff1[x] = xSign(pRec[x] - pRec[x-stride-1]); 1515 } 1516 for (y=firstY; y<endY; y++) 1517 { 1518 signDown2 = xSign(pRec[stride+startX] - pRec[startX-1]); 1519 for (x=firstX; x<endX; x++) 1520 { 1521 signDown1 = xSign(pRec[x] - pRec[x+stride+1]) ; 1522 uiEdgeType = signDown1 + m_iUpBuff1[x] + 2; 1523 m_iUpBufft[x+1] = -signDown1; 1524 1525 if( x < startX && y < startY ) 1526 continue; 1527 1528 stats[m_auiEoTable[uiEdgeType]] += (pOrg[x] - pRec[x]); 1529 count[m_auiEoTable[uiEdgeType]] ++; 1530 } 1531 m_iUpBufft[firstX] = signDown2; 1532 ipSwap = m_iUpBuff1; 1533 m_iUpBuff1 = m_iUpBufft; 1534 m_iUpBufft = ipSwap; 1535 1536 pRec += stride; 1537 pOrg += stride; 1538 } 1539 1540 //if (iSaoType == EO_3) 1541 1542 numSkipLine = isChroma? 2:4; 1543 numSkipLineRight = isChroma? 3:5; 1544 1545 stats = m_offsetOrg_PreDblk[addr][yCbCr][SAO_EO_3]; 1546 count = m_count_PreDblk[addr][yCbCr][SAO_EO_3]; 1547 1548 pOrg = getPicYuvAddr(pcPic->getPicYuvOrg(), yCbCr, addr); 1549 pRec = getPicYuvAddr(pcPic->getPicYuvRec(), yCbCr, addr); 1550 1551 startX = (rPelX == picWidthTmp) ? lcuWidth-1 : lcuWidth-numSkipLineRight; 1552 startY = (bPelY == picHeightTmp) ? lcuHeight-1 : lcuHeight-numSkipLine; 1553 firstX = (lPelX == 0) ? 1 : 0; 1554 firstY = (tPelY == 0) ? 1 : 0; 1555 endX = (rPelX == picWidthTmp) ? lcuWidth-1 : lcuWidth; 1556 endY = (bPelY == picHeightTmp) ? lcuHeight-1 : lcuHeight; 1557 if (firstY == 1) 1558 { 1559 pOrg += stride; 1560 pRec += stride; 1561 } 1562 1563 for (x=firstX-1; x<endX; x++) 1564 { 1565 m_iUpBuff1[x] = xSign(pRec[x] - pRec[x-stride+1]); 1566 } 1567 1568 for (y=firstY; y<endY; y++) 1569 { 1570 for (x=firstX; x<endX; x++) 1571 { 1572 signDown1 = xSign(pRec[x] - pRec[x+stride-1]) ; 1573 uiEdgeType = signDown1 + m_iUpBuff1[x] + 2; 1574 m_iUpBuff1[x-1] = -signDown1; 1575 1576 if( x < startX && y < startY ) 1577 continue; 1578 1579 stats[m_auiEoTable[uiEdgeType]] += (pOrg[x] - pRec[x]); 1580 count[m_auiEoTable[uiEdgeType]] ++; 1581 } 1582 m_iUpBuff1[endX-1] = xSign(pRec[endX-1 + stride] - pRec[endX]); 1583 1584 pRec += stride; 1585 pOrg += stride; 1586 } 1587 } 1588 } 1589 } 1590 } 1591 1592 1593 /** get SAO statistics 1594 * \param *psQTPart, iYCbCr 1595 */ 1596 Void TEncSampleAdaptiveOffset::getSaoStats(SAOQTPart *psQTPart, Int iYCbCr) 1597 { 1598 Int iLevelIdx, iPartIdx, iTypeIdx, iClassIdx; 1599 Int i; 1600 Int iNumTotalType = MAX_NUM_SAO_TYPE; 1601 Int LcuIdxX; 1602 Int LcuIdxY; 1603 Int iAddr; 1604 Int iFrameWidthInCU = m_pcPic->getFrameWidthInCU(); 1605 Int iDownPartIdx; 1606 Int iPartStart; 1607 Int iPartEnd; 1608 SAOQTPart* pOnePart; 1609 1610 if (m_uiMaxSplitLevel == 0) 1611 { 1612 iPartIdx = 0; 1613 pOnePart = &(psQTPart[iPartIdx]); 1614 for (LcuIdxY = pOnePart->StartCUY; LcuIdxY<= pOnePart->EndCUY; LcuIdxY++) 1615 { 1616 for (LcuIdxX = pOnePart->StartCUX; LcuIdxX<= pOnePart->EndCUX; LcuIdxX++) 1617 { 1618 iAddr = LcuIdxY*iFrameWidthInCU + LcuIdxX; 1619 calcSaoStatsCu(iAddr, iPartIdx, iYCbCr); 1620 } 1621 } 1622 } 1623 else 1624 { 1625 for(iPartIdx=m_aiNumCulPartsLevel[m_uiMaxSplitLevel-1]; iPartIdx<m_aiNumCulPartsLevel[m_uiMaxSplitLevel]; iPartIdx++) 1626 { 1627 pOnePart = &(psQTPart[iPartIdx]); 1628 for (LcuIdxY = pOnePart->StartCUY; LcuIdxY<= pOnePart->EndCUY; LcuIdxY++) 1629 { 1630 for (LcuIdxX = pOnePart->StartCUX; LcuIdxX<= pOnePart->EndCUX; LcuIdxX++) 1631 { 1632 iAddr = LcuIdxY*iFrameWidthInCU + LcuIdxX; 1633 calcSaoStatsCu(iAddr, iPartIdx, iYCbCr); 1634 } 1635 } 1636 } 1637 for (iLevelIdx = m_uiMaxSplitLevel-1; iLevelIdx>=0; iLevelIdx-- ) 1638 { 1639 iPartStart = (iLevelIdx > 0) ? m_aiNumCulPartsLevel[iLevelIdx-1] : 0; 1640 iPartEnd = m_aiNumCulPartsLevel[iLevelIdx]; 1641 1642 for(iPartIdx = iPartStart; iPartIdx < iPartEnd; iPartIdx++) 1643 { 1644 pOnePart = &(psQTPart[iPartIdx]); 1645 for (i=0; i< NUM_DOWN_PART; i++) 1646 { 1647 iDownPartIdx = pOnePart->DownPartsIdx[i]; 1648 for (iTypeIdx=0; iTypeIdx<iNumTotalType; iTypeIdx++) 1649 { 1650 for (iClassIdx=0; iClassIdx< (iTypeIdx < SAO_BO ? m_iNumClass[iTypeIdx] : SAO_MAX_BO_CLASSES) +1; iClassIdx++) 1651 { 1652 m_iOffsetOrg[iPartIdx][iTypeIdx][iClassIdx] += m_iOffsetOrg[iDownPartIdx][iTypeIdx][iClassIdx]; 1653 m_iCount [iPartIdx][iTypeIdx][iClassIdx] += m_iCount [iDownPartIdx][iTypeIdx][iClassIdx]; 1654 } 1655 } 1656 } 1657 } 1658 } 1659 } 1660 } 1661 1662 /** reset offset statistics 1663 * \param 1664 */ 1665 Void TEncSampleAdaptiveOffset::resetStats() 1666 { 1667 for (Int i=0;i<m_iNumTotalParts;i++) 1668 { 1669 m_dCostPartBest[i] = MAX_DOUBLE; 1670 m_iTypePartBest[i] = -1; 1671 m_iDistOrg[i] = 0; 1672 for (Int j=0;j<MAX_NUM_SAO_TYPE;j++) 1673 { 1674 m_iDist[i][j] = 0; 1675 m_iRate[i][j] = 0; 1676 m_dCost[i][j] = 0; 1677 for (Int k=0;k<MAX_NUM_SAO_CLASS;k++) 1678 { 1679 m_iCount [i][j][k] = 0; 1680 m_iOffset[i][j][k] = 0; 1681 m_iOffsetOrg[i][j][k] = 0; 1682 } 1683 } 1684 } 1685 } 1686 1687 #if SAO_CHROMA_LAMBDA 1688 /** Sample adaptive offset process 1689 * \param pcSaoParam 1690 * \param dLambdaLuma 1691 * \param dLambdaChroma 1692 */ 1693 #if SAO_ENCODING_CHOICE 1694 Void TEncSampleAdaptiveOffset::SAOProcess(SAOParam *pcSaoParam, Double dLambdaLuma, Double dLambdaChroma, Int depth) 1695 #else 1696 Void TEncSampleAdaptiveOffset::SAOProcess(SAOParam *pcSaoParam, Double dLambdaLuma, Double dLambdaChroma) 1697 #endif 1698 #else 1699 /** Sample adaptive offset process 1700 * \param dLambda 1701 */ 1702 Void TEncSampleAdaptiveOffset::SAOProcess(SAOParam *pcSaoParam, Double dLambda) 1703 #endif 1704 { 1705 m_eSliceType = m_pcPic->getSlice(0)->getSliceType(); 1706 m_iPicNalReferenceIdc = (m_pcPic->getSlice(0)->isReferenced() ? 1 :0); 1707 1708 #if SAO_CHROMA_LAMBDA 1709 m_dLambdaLuma = dLambdaLuma; 1710 m_dLambdaChroma = dLambdaChroma; 1711 #else 1712 m_dLambdaLuma = dLambda; 1713 m_dLambdaChroma = dLambda; 1714 #endif 1715 1716 if(m_bUseNIF) 1717 { 1718 m_pcPic->getPicYuvRec()->copyToPic(m_pcYuvTmp); 1719 } 1720 1721 #if FULL_NBIT 1722 m_uiSaoBitIncrease = g_uiBitDepth + (g_uiBitDepth-8) - min((Int)(g_uiBitDepth + (g_uiBitDepth-8)), 10); 1723 #else 1724 m_uiSaoBitIncrease = g_uiBitDepth + g_uiBitIncrement - min((Int)(g_uiBitDepth + g_uiBitIncrement), 10); 1725 #endif 1726 1727 #if FULL_NBIT 1728 m_iOffsetTh = 1 << ( min((Int)(g_uiBitDepth + (g_uiBitDepth-8)-5),5) ); 1729 #else 1730 m_iOffsetTh = 1 << ( min((Int)(g_uiBitDepth + g_uiBitIncrement-5),5) ); 1731 #endif 1732 1733 resetSAOParam(pcSaoParam); 1734 if( !m_saoLcuBasedOptimization || !m_saoLcuBoundary ) 1735 { 1736 resetStats(); 1737 } 1738 Double dCostFinal = 0; 1739 if ( m_saoLcuBasedOptimization) 1740 { 1741 #if SAO_ENCODING_CHOICE 1742 rdoSaoUnitAll(pcSaoParam, dLambdaLuma, dLambdaChroma, depth); 1743 #else 1744 rdoSaoUnitAll(pcSaoParam, dLambdaLuma, dLambdaChroma); 1745 #endif 1746 } 1747 else 1748 { 1749 pcSaoParam->bSaoFlag[0] = 1; 1750 pcSaoParam->bSaoFlag[1] = 0; 1751 dCostFinal = 0; 1752 Double lambdaRdo = dLambdaLuma; 1753 resetStats(); 1754 getSaoStats(pcSaoParam->psSaoPart[0], 0); 1755 runQuadTreeDecision(pcSaoParam->psSaoPart[0], 0, dCostFinal, m_uiMaxSplitLevel, lambdaRdo, 0); 1756 pcSaoParam->bSaoFlag[0] = dCostFinal < 0 ? 1:0; 1757 if(pcSaoParam->bSaoFlag[0]) 1758 { 1759 convertQT2SaoUnit(pcSaoParam, 0, 0); 1760 assignSaoUnitSyntax(pcSaoParam->saoLcuParam[0], pcSaoParam->psSaoPart[0], pcSaoParam->oneUnitFlag[0], 0); 1761 } 1762 } 1763 1764 if (pcSaoParam->bSaoFlag[0]) 1765 { 1766 processSaoUnitAll( pcSaoParam->saoLcuParam[0], pcSaoParam->oneUnitFlag[0], 0); 1767 } 1768 if (pcSaoParam->bSaoFlag[1]) 1769 { 1770 processSaoUnitAll( pcSaoParam->saoLcuParam[1], pcSaoParam->oneUnitFlag[1], 1); 1771 processSaoUnitAll( pcSaoParam->saoLcuParam[2], pcSaoParam->oneUnitFlag[2], 2); 1772 } 1773 } 1774 /** Check merge SAO unit 1775 * \param saoUnitCurr current SAO unit 1776 * \param saoUnitCheck SAO unit tobe check 1777 * \param dir direction 1778 */ 1779 Void TEncSampleAdaptiveOffset::checkMerge(SaoLcuParam * saoUnitCurr, SaoLcuParam * saoUnitCheck, Int dir) 1780 { 1781 Int i ; 1782 Int countDiff = 0; 1783 if (saoUnitCurr->partIdx != saoUnitCheck->partIdx) 1784 { 1785 if (saoUnitCurr->typeIdx !=-1) 1786 { 1787 if (saoUnitCurr->typeIdx == saoUnitCheck->typeIdx) 1788 { 1789 for (i=0;i<saoUnitCurr->length;i++) 1790 { 1791 countDiff += (saoUnitCurr->offset[i] != saoUnitCheck->offset[i]); 1792 } 1793 countDiff += (saoUnitCurr->subTypeIdx != saoUnitCheck->subTypeIdx); 1794 if (countDiff ==0) 1795 { 1796 saoUnitCurr->partIdx = saoUnitCheck->partIdx; 1797 if (dir == 1) 1798 { 1799 saoUnitCurr->mergeUpFlag = 1; 1800 saoUnitCurr->mergeLeftFlag = 0; 1801 } 1802 else 1803 { 1804 saoUnitCurr->mergeUpFlag = 0; 1805 saoUnitCurr->mergeLeftFlag = 1; 1806 } 1807 } 1808 } 1809 } 1810 else 1811 { 1812 if (saoUnitCurr->typeIdx == saoUnitCheck->typeIdx) 1813 { 1814 saoUnitCurr->partIdx = saoUnitCheck->partIdx; 1815 if (dir == 1) 1816 { 1817 saoUnitCurr->mergeUpFlag = 1; 1818 saoUnitCurr->mergeLeftFlag = 0; 1819 } 1820 else 1821 { 1822 saoUnitCurr->mergeUpFlag = 0; 1823 saoUnitCurr->mergeLeftFlag = 1; 1824 } 1825 } 1826 } 1827 } 1828 } 1829 /** Assign SAO unit syntax from picture-based algorithm 1830 * \param saoLcuParam SAO LCU parameters 1831 * \param saoPart SAO part 1832 * \param oneUnitFlag SAO one unit flag 1833 * \param iYCbCr color component Index 1834 */ 1835 Void TEncSampleAdaptiveOffset::assignSaoUnitSyntax(SaoLcuParam* saoLcuParam, SAOQTPart* saoPart, Bool &oneUnitFlag, Int yCbCr) 1836 { 1837 if (saoPart->bSplit == 0) 1838 { 1839 oneUnitFlag = 1; 1840 } 1841 else 1842 { 1843 Int i,j, addr, addrUp, addrLeft, idx, idxUp, idxLeft, idxCount; 1844 1845 oneUnitFlag = 0; 1846 1847 idxCount = -1; 1848 saoLcuParam[0].mergeUpFlag = 0; 1849 saoLcuParam[0].mergeLeftFlag = 0; 1850 1851 for (j=0;j<m_iNumCuInHeight;j++) 1852 { 1853 for (i=0;i<m_iNumCuInWidth;i++) 1854 { 1855 addr = i + j*m_iNumCuInWidth; 1856 addrLeft = (addr%m_iNumCuInWidth == 0) ? -1 : addr - 1; 1857 addrUp = (addr<m_iNumCuInWidth) ? -1 : addr - m_iNumCuInWidth; 1858 idx = saoLcuParam[addr].partIdxTmp; 1859 idxLeft = (addrLeft == -1) ? -1 : saoLcuParam[addrLeft].partIdxTmp; 1860 idxUp = (addrUp == -1) ? -1 : saoLcuParam[addrUp].partIdxTmp; 1861 1862 if(idx!=idxLeft && idx!=idxUp) 1863 { 1864 saoLcuParam[addr].mergeUpFlag = 0; idxCount++; 1865 saoLcuParam[addr].mergeLeftFlag = 0; 1866 saoLcuParam[addr].partIdx = idxCount; 1867 } 1868 else if (idx==idxLeft) 1869 { 1870 saoLcuParam[addr].mergeUpFlag = 1; 1871 saoLcuParam[addr].mergeLeftFlag = 1; 1872 saoLcuParam[addr].partIdx = saoLcuParam[addrLeft].partIdx; 1873 } 1874 else if (idx==idxUp) 1875 { 1876 saoLcuParam[addr].mergeUpFlag = 1; 1877 saoLcuParam[addr].mergeLeftFlag = 0; 1878 saoLcuParam[addr].partIdx = saoLcuParam[addrUp].partIdx; 1879 } 1880 if (addrUp != -1) 1881 { 1882 checkMerge(&saoLcuParam[addr], &saoLcuParam[addrUp], 1); 1883 } 1884 if (addrLeft != -1) 1885 { 1886 checkMerge(&saoLcuParam[addr], &saoLcuParam[addrLeft], 0); 1887 } 1888 } 1889 } 1890 } 1891 } 1892 /** rate distortion optimization of all SAO units 1893 * \param saoParam SAO parameters 1894 * \param lambda 1895 * \param lambdaChroma 1896 */ 1897 #if SAO_ENCODING_CHOICE 1898 Void TEncSampleAdaptiveOffset::rdoSaoUnitAll(SAOParam *saoParam, Double lambda, Double lambdaChroma, Int depth) 1899 #else 1900 Void TEncSampleAdaptiveOffset::rdoSaoUnitAll(SAOParam *saoParam, Double lambda, Double lambdaChroma) 1901 #endif 1902 { 1903 Int idxY; 1904 Int idxX; 1905 Int frameHeightInCU = saoParam->numCuInHeight; 1906 Int frameWidthInCU = saoParam->numCuInWidth; 1907 Int j, k; 1908 Int addr = 0; 1909 Int addrUp = -1; 1910 Int addrLeft = -1; 1911 Int compIdx = 0; 1912 SaoLcuParam mergeSaoParam[3][2]; 1913 Double compDistortion[3]; 1914 1915 saoParam->bSaoFlag[0] = true; 1916 saoParam->bSaoFlag[1] = true; 1917 saoParam->oneUnitFlag[0] = false; 1918 saoParam->oneUnitFlag[1] = false; 1919 saoParam->oneUnitFlag[2] = false; 1920 1921 #if SAO_ENCODING_CHOICE 1922 #if SAO_ENCODING_CHOICE_CHROMA 1923 Int numNoSao[2]; 1924 numNoSao[0] = 0;// Luma 1925 numNoSao[1] = 0;// Chroma 1926 if( depth > 0 && m_depthSaoRate[0][depth-1] > SAO_ENCODING_RATE ) 1927 { 1928 saoParam->bSaoFlag[0] = false; 1929 } 1930 1931 if( depth > 0 && m_depthSaoRate[1][depth-1] > SAO_ENCODING_RATE_CHROMA ) 1932 { 1933 saoParam->bSaoFlag[1] = false; 1934 } 1935 #else 1936 Int numNoSao = 0; 1937 1938 if( depth > 0 && m_depth0SaoRate > SAO_ENCODING_RATE ) 1939 { 1940 saoParam->bSaoFlag[0] = false; 1941 saoParam->bSaoFlag[1] = false; 1942 } 1943 #endif 1944 #endif 1945 1946 for (idxY = 0; idxY< frameHeightInCU; idxY++) 1947 { 1948 for (idxX = 0; idxX< frameWidthInCU; idxX++) 1949 { 1950 addr = idxX + frameWidthInCU*idxY; 1951 addrUp = addr < frameWidthInCU ? -1:idxX + frameWidthInCU*(idxY-1); 1952 addrLeft = idxX == 0 ? -1:idxX-1 + frameWidthInCU*idxY; 1953 Int allowMergeLeft = 1; 1954 Int allowMergeUp = 1; 1955 UInt rate; 1956 Double bestCost, mergeCost; 1957 1958 if (idxX!=0) 1959 { 1960 // check tile id and slice id 1961 if ( (m_pcPic->getPicSym()->getTileIdxMap(addr-1) != m_pcPic->getPicSym()->getTileIdxMap(addr)) || (m_pcPic->getCU(addr-1)->getSlice()->getSliceIdx() != m_pcPic->getCU(addr)->getSlice()->getSliceIdx())) 1962 { 1963 allowMergeLeft = 0; 1964 } 1965 } 1966 else 1967 { 1968 allowMergeLeft = 0; 1969 } 1970 if (idxY!=0) 1971 { 1972 if ( (m_pcPic->getPicSym()->getTileIdxMap(addr-m_iNumCuInWidth) != m_pcPic->getPicSym()->getTileIdxMap(addr)) || (m_pcPic->getCU(addr-m_iNumCuInWidth)->getSlice()->getSliceIdx() != m_pcPic->getCU(addr)->getSlice()->getSliceIdx())) 1973 { 1974 allowMergeUp = 0; 1975 } 1976 } 1977 else 1978 { 1979 allowMergeUp = 0; 1980 } 1981 1982 compDistortion[0] = 0; 1983 compDistortion[1] = 0; 1984 compDistortion[2] = 0; 1985 m_pcRDGoOnSbacCoder->load(m_pppcRDSbacCoder[0][CI_CURR_BEST]); 1986 1987 if (allowMergeLeft) 1988 { 1989 m_pcEntropyCoder->m_pcEntropyCoderIf->codeSaoMerge(0); 1990 } 1991 if (allowMergeUp) 1992 { 1993 m_pcEntropyCoder->m_pcEntropyCoderIf->codeSaoMerge(0); 1994 } 1995 1996 m_pcRDGoOnSbacCoder->store( m_pppcRDSbacCoder[0][CI_TEMP_BEST] ); 1997 1998 // reset stats Y, Cb, Cr 1999 for ( compIdx=0;compIdx<3;compIdx++) 2000 { 2001 for ( j=0;j<MAX_NUM_SAO_TYPE;j++) 2002 { 2003 for ( k=0;k< MAX_NUM_SAO_CLASS;k++) 2004 { 2005 m_iOffset [compIdx][j][k] = 0; 2006 if( m_saoLcuBasedOptimization && m_saoLcuBoundary ) 2007 { 2008 m_iCount [compIdx][j][k] = m_count_PreDblk [addr][compIdx][j][k]; 2009 m_iOffsetOrg[compIdx][j][k] = m_offsetOrg_PreDblk[addr][compIdx][j][k]; 2010 } 2011 else 2012 { 2013 m_iCount [compIdx][j][k] = 0; 2014 m_iOffsetOrg[compIdx][j][k] = 0; 2015 } 2016 } 2017 } 2018 saoParam->saoLcuParam[compIdx][addr].typeIdx = -1; 2019 saoParam->saoLcuParam[compIdx][addr].mergeUpFlag = 0; 2020 saoParam->saoLcuParam[compIdx][addr].mergeLeftFlag = 0; 2021 saoParam->saoLcuParam[compIdx][addr].subTypeIdx = 0; 2022 #if SAO_ENCODING_CHOICE 2023 if( (compIdx ==0 && saoParam->bSaoFlag[0])|| (compIdx >0 && saoParam->bSaoFlag[1]) ) 2024 #endif 2025 { 2026 calcSaoStatsCu(addr, compIdx, compIdx); 2027 } 2028 } 2029 saoComponentParamDist(allowMergeLeft, allowMergeUp, saoParam, addr, addrUp, addrLeft, 0, lambda, &mergeSaoParam[0][0], &compDistortion[0]); 2030 sao2ChromaParamDist(allowMergeLeft, allowMergeUp, saoParam, addr, addrUp, addrLeft, lambdaChroma, &mergeSaoParam[1][0], &mergeSaoParam[2][0], &compDistortion[0]); 2031 if( saoParam->bSaoFlag[0] || saoParam->bSaoFlag[1] ) 2032 { 2033 // Cost of new SAO_params 2034 m_pcRDGoOnSbacCoder->load(m_pppcRDSbacCoder[0][CI_CURR_BEST]); 2035 m_pcRDGoOnSbacCoder->resetBits(); 2036 if (allowMergeLeft) 2037 { 2038 m_pcEntropyCoder->m_pcEntropyCoderIf->codeSaoMerge(0); 2039 } 2040 if (allowMergeUp) 2041 { 2042 m_pcEntropyCoder->m_pcEntropyCoderIf->codeSaoMerge(0); 2043 } 2044 for ( compIdx=0;compIdx<3;compIdx++) 2045 { 2046 if( (compIdx ==0 && saoParam->bSaoFlag[0]) || (compIdx >0 && saoParam->bSaoFlag[1])) 2047 { 2048 m_pcEntropyCoder->encodeSaoOffset(&saoParam->saoLcuParam[compIdx][addr], compIdx); 2049 } 2050 } 2051 2052 rate = m_pcEntropyCoder->getNumberOfWrittenBits(); 2053 bestCost = compDistortion[0] + (Double)rate; 2054 m_pcRDGoOnSbacCoder->store(m_pppcRDSbacCoder[0][CI_TEMP_BEST]); 2055 2056 // Cost of Merge 2057 for(Int mergeUp=0; mergeUp<2; ++mergeUp) 2058 { 2059 if ( (allowMergeLeft && (mergeUp==0)) || (allowMergeUp && (mergeUp==1)) ) 2060 { 2061 m_pcRDGoOnSbacCoder->load(m_pppcRDSbacCoder[0][CI_CURR_BEST]); 2062 m_pcRDGoOnSbacCoder->resetBits(); 2063 if (allowMergeLeft) 2064 { 2065 m_pcEntropyCoder->m_pcEntropyCoderIf->codeSaoMerge(1-mergeUp); 2066 } 2067 if ( allowMergeUp && (mergeUp==1) ) 2068 { 2069 m_pcEntropyCoder->m_pcEntropyCoderIf->codeSaoMerge(1); 2070 } 2071 2072 rate = m_pcEntropyCoder->getNumberOfWrittenBits(); 2073 mergeCost = compDistortion[mergeUp+1] + (Double)rate; 2074 if (mergeCost < bestCost) 2075 { 2076 bestCost = mergeCost; 2077 m_pcRDGoOnSbacCoder->store(m_pppcRDSbacCoder[0][CI_TEMP_BEST]); 2078 for ( compIdx=0;compIdx<3;compIdx++) 2079 { 2080 mergeSaoParam[compIdx][mergeUp].mergeLeftFlag = 1-mergeUp; 2081 mergeSaoParam[compIdx][mergeUp].mergeUpFlag = mergeUp; 2082 if( (compIdx==0 && saoParam->bSaoFlag[0]) || (compIdx>0 && saoParam->bSaoFlag[1])) 2083 { 2084 copySaoUnit(&saoParam->saoLcuParam[compIdx][addr], &mergeSaoParam[compIdx][mergeUp] ); 2085 } 2086 } 2087 } 2088 } 2089 } 2090 #if SAO_ENCODING_CHOICE 2091 #if SAO_ENCODING_CHOICE_CHROMA 2092 if( saoParam->saoLcuParam[0][addr].typeIdx == -1) 2093 { 2094 numNoSao[0]++; 2095 } 2096 if( saoParam->saoLcuParam[1][addr].typeIdx == -1) 2097 { 2098 numNoSao[1]+=2; 2099 } 2100 #else 2101 for ( compIdx=0;compIdx<3;compIdx++) 2102 { 2103 if( depth == 0 && saoParam->saoLcuParam[compIdx][addr].typeIdx == -1) 2104 { 2105 numNoSao++; 2106 } 2107 } 2108 #endif 2109 #endif 2110 m_pcRDGoOnSbacCoder->load(m_pppcRDSbacCoder[0][CI_TEMP_BEST]); 2111 m_pcRDGoOnSbacCoder->store(m_pppcRDSbacCoder[0][CI_CURR_BEST]); 2112 } 2113 } 2114 } 2115 #if SAO_ENCODING_CHOICE 2116 #if SAO_ENCODING_CHOICE_CHROMA 2117 #if SAO_ENCODING_CHOICE_CHROMA_BF 2118 if( !saoParam->bSaoFlag[0]) 2119 { 2120 m_depthSaoRate[0][depth] = 1.0; 2121 } 2122 else 2123 { 2124 m_depthSaoRate[0][depth] = numNoSao[0]/((Double) frameHeightInCU*frameWidthInCU); 2125 } 2126 if( !saoParam->bSaoFlag[1]) 2127 { 2128 m_depthSaoRate[1][depth] = 1.0; 2129 } 2130 else 2131 { 2132 m_depthSaoRate[1][depth] = numNoSao[1]/((Double) frameHeightInCU*frameWidthInCU*2); 2133 } 2134 #else 2135 m_depthSaoRate[0][depth] = numNoSao[0]/((Double) frameHeightInCU*frameWidthInCU); 2136 m_depthSaoRate[1][depth] = numNoSao[1]/((Double) frameHeightInCU*frameWidthInCU*2); 2137 #endif 2138 #else 2139 if( depth == 0) 2140 { 2141 // update SAO Rate 2142 m_depth0SaoRate = numNoSao/((Double) frameHeightInCU*frameWidthInCU*3); 2143 } 2144 #endif 2145 #endif 2146 } 2147 /** rate distortion optimization of SAO unit 2148 * \param saoParam SAO parameters 2149 * \param addr address 2150 * \param addrUp above address 2151 * \param addrLeft left address 2152 * \param yCbCr color component index 2153 * \param lambda 2154 */ 2155 inline Int64 TEncSampleAdaptiveOffset::estSaoTypeDist(Int compIdx, Int typeIdx, Int shift, Double lambda, Int *currentDistortionTableBo, Double *currentRdCostTableBo) 2156 { 2157 Int64 estDist = 0; 2158 Int classIdx; 2159 for(classIdx=1; classIdx < ( (typeIdx < SAO_BO) ? m_iNumClass[typeIdx]+1 : SAO_MAX_BO_CLASSES+1); classIdx++) 2160 { 2161 if( typeIdx == SAO_BO) 2162 { 2163 currentDistortionTableBo[classIdx-1] = 0; 2164 currentRdCostTableBo[classIdx-1] = lambda; 2165 } 2166 if(m_iCount [compIdx][typeIdx][classIdx]) 2167 { 2168 #if FULL_NBIT 2169 m_iOffset[compIdx][typeIdx][classIdx] = (Int64) xRoundIbdi((Double)(m_iOffsetOrg[compIdx][typeIdx][classIdx]<<g_uiBitDepth-8) / (Double)(m_iCount [compIdx][typeIdx][classIdx]<<m_uiSaoBitIncrease)); 2170 #else 2171 m_iOffset[compIdx][typeIdx][classIdx] = (Int64) xRoundIbdi((Double)(m_iOffsetOrg[compIdx][typeIdx][classIdx]<<g_uiBitIncrement) / (Double)(m_iCount [compIdx][typeIdx][classIdx]<<m_uiSaoBitIncrease)); 2172 #endif 2173 m_iOffset[compIdx][typeIdx][classIdx] = Clip3(-m_iOffsetTh+1, m_iOffsetTh-1, (Int)m_iOffset[compIdx][typeIdx][classIdx]); 2174 if (typeIdx < 4) 2175 { 2176 if ( m_iOffset[compIdx][typeIdx][classIdx]<0 && classIdx<3 ) 2177 { 2178 m_iOffset[compIdx][typeIdx][classIdx] = 0; 2179 } 2180 if ( m_iOffset[compIdx][typeIdx][classIdx]>0 && classIdx>=3) 2181 { 2182 m_iOffset[compIdx][typeIdx][classIdx] = 0; 2183 } 2184 } 2185 m_iOffset[compIdx][typeIdx][classIdx] = estIterOffset( typeIdx, classIdx, lambda, m_iOffset[compIdx][typeIdx][classIdx], m_iCount [compIdx][typeIdx][classIdx], m_iOffsetOrg[compIdx][typeIdx][classIdx], shift, m_uiSaoBitIncrease, currentDistortionTableBo, currentRdCostTableBo ); 2186 } 2187 else 2188 { 2189 m_iOffsetOrg[compIdx][typeIdx][classIdx] = 0; 2190 m_iOffset[compIdx][typeIdx][classIdx] = 0; 2191 } 2192 if( typeIdx != SAO_BO ) 2193 { 2194 estDist += estSaoDist( m_iCount [compIdx][typeIdx][classIdx], m_iOffset[compIdx][typeIdx][classIdx] << m_uiSaoBitIncrease, m_iOffsetOrg[compIdx][typeIdx][classIdx], shift); 2195 } 2196 } 2197 return estDist; 2198 } 2199 2200 inline Int64 TEncSampleAdaptiveOffset::estSaoDist(Int64 count, Int64 offset, Int64 offsetOrg, Int shift) 2201 { 2202 return (( count*offset*offset-offsetOrg*offset*2 ) >> shift); 2203 } 2204 inline Int64 TEncSampleAdaptiveOffset::estIterOffset(Int typeIdx, Int classIdx, double lambda, Int64 offsetInput, Int64 count, Int64 offsetOrg, Int shift, Int bitIncrease, Int *currentDistortionTableBo, Double *currentRdCostTableBo ) 2205 { 2206 //Clean up, best_q_offset. 2207 Int64 iterOffset, tempOffset; 2208 Int64 tempDist, tempRate; 2209 Double tempCost, tempMinCost; 2210 Int64 offsetOutput = 0; 2211 iterOffset = offsetInput; 2212 // Assuming sending quantized value 0 results in zero offset and sending the value zero needs 1 bit. entropy coder can be used to measure the exact rate here. 2213 tempMinCost = lambda; 2214 while (iterOffset != 0) 2215 { 2216 // Calculate the bits required for signalling the offset 2217 tempRate = (typeIdx == SAO_BO) ? (abs((Int)iterOffset)+2) : (abs((Int)iterOffset)+1); 2218 if (abs((Int)iterOffset)==m_iOffsetTh-1) 2219 { 2220 tempRate --; 2221 } 2222 // Do the dequntization before distorion calculation 2223 tempOffset = iterOffset << bitIncrease; 2224 tempDist = estSaoDist( count, tempOffset, offsetOrg, shift); 2225 tempCost = ((Double)tempDist + lambda * (Double) tempRate); 2226 if(tempCost < tempMinCost) 2227 { 2228 tempMinCost = tempCost; 2229 offsetOutput = iterOffset; 2230 if(typeIdx == SAO_BO) 2231 { 2232 currentDistortionTableBo[classIdx-1] = (Int) tempDist; 2233 currentRdCostTableBo[classIdx-1] = tempCost; 2234 } 2235 } 2236 iterOffset = (iterOffset > 0) ? (iterOffset-1):(iterOffset+1); 2237 } 2238 return offsetOutput; 2239 } 2240 2241 Void TEncSampleAdaptiveOffset::saoComponentParamDist(Int allowMergeLeft, Int allowMergeUp, SAOParam *saoParam, Int addr, Int addrUp, Int addrLeft, Int yCbCr, Double lambda, SaoLcuParam *compSaoParam, Double *compDistortion) 2242 { 2243 Int typeIdx; 2244 Int64 estDist; 2245 Int classIdx; 2246 2247 Int shift = g_uiBitIncrement << 1; 2248 2249 Int64 bestDist; 2250 2251 SaoLcuParam* saoLcuParam = &(saoParam->saoLcuParam[yCbCr][addr]); 2252 SaoLcuParam* saoLcuParamNeighbor = NULL; 2253 2254 resetSaoUnit(saoLcuParam); 2255 resetSaoUnit(&compSaoParam[0]); 2256 resetSaoUnit(&compSaoParam[1]); 2257 2258 Double dCostPartBest = MAX_DOUBLE; 2259 2260 Double bestRDCostTableBo = MAX_DOUBLE; 2261 Int bestClassTableBo = 0; 2262 Int currentDistortionTableBo[MAX_NUM_SAO_CLASS]; 2263 Double currentRdCostTableBo[MAX_NUM_SAO_CLASS]; 2264 2265 SaoLcuParam saoLcuParamRdo; 2266 Double estRate = 0; 2267 2268 resetSaoUnit(&saoLcuParamRdo); 2269 2270 m_pcRDGoOnSbacCoder->load(m_pppcRDSbacCoder[0][CI_TEMP_BEST]); 2271 m_pcRDGoOnSbacCoder->resetBits(); 2272 m_pcEntropyCoder->encodeSaoOffset(&saoLcuParamRdo, yCbCr); 2273 dCostPartBest = m_pcEntropyCoder->getNumberOfWrittenBits()*lambda ; 2274 2275 copySaoUnit(saoLcuParam, &saoLcuParamRdo ); 2276 2277 bestDist = 0; 2278 2279 for (typeIdx=0; typeIdx<MAX_NUM_SAO_TYPE; typeIdx++) 2280 { 2281 estDist = estSaoTypeDist(yCbCr, typeIdx, shift, lambda, currentDistortionTableBo, currentRdCostTableBo); 2282 if( typeIdx == SAO_BO ) 2283 { 2284 // Estimate Best Position 2285 Double currentRDCost = 0.0; 2286 2287 for(Int i=0; i< SAO_MAX_BO_CLASSES -SAO_BO_LEN +1; i++) 2288 { 2289 currentRDCost = 0.0; 2290 for(UInt uj = i; uj < i+SAO_BO_LEN; uj++) 2291 { 2292 currentRDCost += currentRdCostTableBo[uj]; 2293 } 2294 2295 if( currentRDCost < bestRDCostTableBo) 2296 { 2297 bestRDCostTableBo = currentRDCost; 2298 bestClassTableBo = i; 2299 } 2300 } 2301 2302 // Re code all Offsets 2303 // Code Center 2304 estDist = 0; 2305 for(classIdx = bestClassTableBo; classIdx < bestClassTableBo+SAO_BO_LEN; classIdx++) 2306 { 2307 estDist += currentDistortionTableBo[classIdx]; 2308 } 2309 } 2310 resetSaoUnit(&saoLcuParamRdo); 2311 saoLcuParamRdo.length = m_iNumClass[typeIdx]; 2312 saoLcuParamRdo.typeIdx = typeIdx; 2313 saoLcuParamRdo.mergeLeftFlag = 0; 2314 saoLcuParamRdo.mergeUpFlag = 0; 2315 saoLcuParamRdo.subTypeIdx = (typeIdx == SAO_BO) ? bestClassTableBo : 0; 2316 for (classIdx = 0; classIdx < saoLcuParamRdo.length; classIdx++) 2317 { 2318 saoLcuParamRdo.offset[classIdx] = (Int)m_iOffset[yCbCr][typeIdx][classIdx+saoLcuParamRdo.subTypeIdx+1]; 2319 } 2320 m_pcRDGoOnSbacCoder->load(m_pppcRDSbacCoder[0][CI_TEMP_BEST]); 2321 m_pcRDGoOnSbacCoder->resetBits(); 2322 m_pcEntropyCoder->encodeSaoOffset(&saoLcuParamRdo, yCbCr); 2323 2324 estRate = m_pcEntropyCoder->getNumberOfWrittenBits(); 2325 m_dCost[yCbCr][typeIdx] = (Double)((Double)estDist + lambda * (Double) estRate); 2326 2327 if(m_dCost[yCbCr][typeIdx] < dCostPartBest) 2328 { 2329 dCostPartBest = m_dCost[yCbCr][typeIdx]; 2330 copySaoUnit(saoLcuParam, &saoLcuParamRdo ); 2331 bestDist = estDist; 2332 } 2333 } 2334 2335 compDistortion[0] += ((Double)bestDist/lambda); 2336 m_pcRDGoOnSbacCoder->load(m_pppcRDSbacCoder[0][CI_TEMP_BEST]); 2337 m_pcEntropyCoder->encodeSaoOffset(saoLcuParam, yCbCr); 2338 m_pcRDGoOnSbacCoder->store( m_pppcRDSbacCoder[0][CI_TEMP_BEST] ); 2339 2340 // merge left or merge up 2341 for (Int idxNeighbor=0;idxNeighbor<2;idxNeighbor++) 2342 { 2343 saoLcuParamNeighbor = NULL; 2344 if (allowMergeLeft && addrLeft>=0 && idxNeighbor ==0) 2345 { 2346 saoLcuParamNeighbor = &(saoParam->saoLcuParam[yCbCr][addrLeft]); 2347 } 2348 else if (allowMergeUp && addrUp>=0 && idxNeighbor ==1) 2349 { 2350 saoLcuParamNeighbor = &(saoParam->saoLcuParam[yCbCr][addrUp]); 2351 } 2352 if (saoLcuParamNeighbor!=NULL) 2353 { 2354 estDist = 0; 2355 typeIdx = saoLcuParamNeighbor->typeIdx; 2356 if (typeIdx>=0) 2357 { 2358 Int mergeBandPosition = (typeIdx == SAO_BO)?saoLcuParamNeighbor->subTypeIdx:0; 2359 Int merge_iOffset; 2360 for(classIdx = 0; classIdx < m_iNumClass[typeIdx]; classIdx++) 2361 { 2362 merge_iOffset = saoLcuParamNeighbor->offset[classIdx]; 2363 estDist += estSaoDist(m_iCount [yCbCr][typeIdx][classIdx+mergeBandPosition+1], merge_iOffset, m_iOffsetOrg[yCbCr][typeIdx][classIdx+mergeBandPosition+1], shift); 2364 } 2365 } 2366 else 2367 { 2368 estDist = 0; 2369 } 2370 2371 copySaoUnit(&compSaoParam[idxNeighbor], saoLcuParamNeighbor ); 2372 compSaoParam[idxNeighbor].mergeUpFlag = idxNeighbor; 2373 compSaoParam[idxNeighbor].mergeLeftFlag = !idxNeighbor; 2374 2375 compDistortion[idxNeighbor+1] += ((Double)estDist/lambda); 2376 } 2377 } 2378 } 2379 2380 Void TEncSampleAdaptiveOffset::sao2ChromaParamDist(Int allowMergeLeft, Int allowMergeUp, SAOParam *saoParam, Int addr, Int addrUp, Int addrLeft, Double lambda, SaoLcuParam *crSaoParam, SaoLcuParam *cbSaoParam, Double *distortion) 2381 { 2382 Int typeIdx; 2383 2384 Int64 estDist[2]; 2385 Int classIdx; 2386 Int shift = g_uiBitIncrement << 1; 2387 Int64 bestDist = 0; 2388 2389 SaoLcuParam* saoLcuParam[2] = {&(saoParam->saoLcuParam[1][addr]), &(saoParam->saoLcuParam[2][addr])}; 2390 SaoLcuParam* saoLcuParamNeighbor[2] = {NULL, NULL}; 2391 SaoLcuParam* saoMergeParam[2][2]; 2392 saoMergeParam[0][0] = &crSaoParam[0]; 2393 saoMergeParam[0][1] = &crSaoParam[1]; 2394 saoMergeParam[1][0] = &cbSaoParam[0]; 2395 saoMergeParam[1][1] = &cbSaoParam[1]; 2396 2397 resetSaoUnit(saoLcuParam[0]); 2398 resetSaoUnit(saoLcuParam[1]); 2399 resetSaoUnit(saoMergeParam[0][0]); 2400 resetSaoUnit(saoMergeParam[0][1]); 2401 resetSaoUnit(saoMergeParam[1][0]); 2402 resetSaoUnit(saoMergeParam[1][1]); 2403 2404 Double costPartBest = MAX_DOUBLE; 2405 2406 Double bestRDCostTableBo; 2407 Int bestClassTableBo[2] = {0, 0}; 2408 Int currentDistortionTableBo[MAX_NUM_SAO_CLASS]; 2409 Double currentRdCostTableBo[MAX_NUM_SAO_CLASS]; 2410 2411 SaoLcuParam saoLcuParamRdo[2]; 2412 Double estRate = 0; 2413 2414 resetSaoUnit(&saoLcuParamRdo[0]); 2415 resetSaoUnit(&saoLcuParamRdo[1]); 2416 2417 m_pcRDGoOnSbacCoder->load(m_pppcRDSbacCoder[0][CI_TEMP_BEST]); 2418 m_pcRDGoOnSbacCoder->resetBits(); 2419 m_pcEntropyCoder->encodeSaoOffset(&saoLcuParamRdo[0], 1); 2420 m_pcEntropyCoder->encodeSaoOffset(&saoLcuParamRdo[1], 2); 2421 2422 costPartBest = m_pcEntropyCoder->getNumberOfWrittenBits()*lambda ; 2423 copySaoUnit(saoLcuParam[0], &saoLcuParamRdo[0] ); 2424 copySaoUnit(saoLcuParam[1], &saoLcuParamRdo[1] ); 2425 2426 for (typeIdx=0; typeIdx<MAX_NUM_SAO_TYPE; typeIdx++) 2427 { 2428 if( typeIdx == SAO_BO ) 2429 { 2430 // Estimate Best Position 2431 for(Int compIdx = 0; compIdx < 2; compIdx++) 2432 { 2433 Double currentRDCost = 0.0; 2434 bestRDCostTableBo = MAX_DOUBLE; 2435 estDist[compIdx] = estSaoTypeDist(compIdx+1, typeIdx, shift, lambda, currentDistortionTableBo, currentRdCostTableBo); 2436 2437 for(Int i=0; i< SAO_MAX_BO_CLASSES -SAO_BO_LEN +1; i++) 2438 { 2439 currentRDCost = 0.0; 2440 for(UInt uj = i; uj < i+SAO_BO_LEN; uj++) 2441 { 2442 currentRDCost += currentRdCostTableBo[uj]; 2443 } 2444 2445 if( currentRDCost < bestRDCostTableBo) 2446 { 2447 bestRDCostTableBo = currentRDCost; 2448 bestClassTableBo[compIdx] = i; 2449 } 2450 } 2451 2452 // Re code all Offsets 2453 // Code Center 2454 estDist[compIdx] = 0; 2455 for(classIdx = bestClassTableBo[compIdx]; classIdx < bestClassTableBo[compIdx]+SAO_BO_LEN; classIdx++) 2456 { 2457 estDist[compIdx] += currentDistortionTableBo[classIdx]; 2458 } 2459 } 2460 } 2461 else 2462 { 2463 estDist[0] = estSaoTypeDist(1, typeIdx, shift, lambda, currentDistortionTableBo, currentRdCostTableBo); 2464 estDist[1] = estSaoTypeDist(2, typeIdx, shift, lambda, currentDistortionTableBo, currentRdCostTableBo); 2465 } 2466 2467 m_pcRDGoOnSbacCoder->load(m_pppcRDSbacCoder[0][CI_TEMP_BEST]); 2468 m_pcRDGoOnSbacCoder->resetBits(); 2469 2470 for(Int compIdx = 0; compIdx < 2; compIdx++) 2471 { 2472 resetSaoUnit(&saoLcuParamRdo[compIdx]); 2473 saoLcuParamRdo[compIdx].length = m_iNumClass[typeIdx]; 2474 saoLcuParamRdo[compIdx].typeIdx = typeIdx; 2475 saoLcuParamRdo[compIdx].mergeLeftFlag = 0; 2476 saoLcuParamRdo[compIdx].mergeUpFlag = 0; 2477 saoLcuParamRdo[compIdx].subTypeIdx = (typeIdx == SAO_BO) ? bestClassTableBo[compIdx] : 0; 2478 for (classIdx = 0; classIdx < saoLcuParamRdo[compIdx].length; classIdx++) 2479 { 2480 saoLcuParamRdo[compIdx].offset[classIdx] = (Int)m_iOffset[compIdx+1][typeIdx][classIdx+saoLcuParamRdo[compIdx].subTypeIdx+1]; 2481 } 2482 m_pcEntropyCoder->encodeSaoOffset(&saoLcuParamRdo[compIdx], compIdx+1); 2483 } 2484 estRate = m_pcEntropyCoder->getNumberOfWrittenBits(); 2485 m_dCost[1][typeIdx] = (Double)((Double)(estDist[0] + estDist[1]) + lambda * (Double) estRate); 2486 2487 if(m_dCost[1][typeIdx] < costPartBest) 2488 { 2489 costPartBest = m_dCost[1][typeIdx]; 2490 copySaoUnit(saoLcuParam[0], &saoLcuParamRdo[0] ); 2491 copySaoUnit(saoLcuParam[1], &saoLcuParamRdo[1] ); 2492 bestDist = (estDist[0]+estDist[1]); 2493 } 2494 } 2495 2496 distortion[0] += ((Double)bestDist/lambda); 2497 m_pcRDGoOnSbacCoder->load(m_pppcRDSbacCoder[0][CI_TEMP_BEST]); 2498 m_pcEntropyCoder->encodeSaoOffset(saoLcuParam[0], 1); 2499 m_pcEntropyCoder->encodeSaoOffset(saoLcuParam[1], 2); 2500 m_pcRDGoOnSbacCoder->store( m_pppcRDSbacCoder[0][CI_TEMP_BEST] ); 2501 2502 // merge left or merge up 2503 2504 for (Int idxNeighbor=0;idxNeighbor<2;idxNeighbor++) 2505 { 2506 for(Int compIdx = 0; compIdx < 2; compIdx++) 2507 { 2508 saoLcuParamNeighbor[compIdx] = NULL; 2509 if (allowMergeLeft && addrLeft>=0 && idxNeighbor ==0) 2510 { 2511 saoLcuParamNeighbor[compIdx] = &(saoParam->saoLcuParam[compIdx+1][addrLeft]); 2512 } 2513 else if (allowMergeUp && addrUp>=0 && idxNeighbor ==1) 2514 { 2515 saoLcuParamNeighbor[compIdx] = &(saoParam->saoLcuParam[compIdx+1][addrUp]); 2516 } 2517 if (saoLcuParamNeighbor[compIdx]!=NULL) 2518 { 2519 estDist[compIdx] = 0; 2520 typeIdx = saoLcuParamNeighbor[compIdx]->typeIdx; 2521 if (typeIdx>=0) 2522 { 2523 Int mergeBandPosition = (typeIdx == SAO_BO)?saoLcuParamNeighbor[compIdx]->subTypeIdx:0; 2524 Int merge_iOffset; 2525 for(classIdx = 0; classIdx < m_iNumClass[typeIdx]; classIdx++) 2526 { 2527 merge_iOffset = saoLcuParamNeighbor[compIdx]->offset[classIdx]; 2528 estDist[compIdx] += estSaoDist(m_iCount [compIdx+1][typeIdx][classIdx+mergeBandPosition+1], merge_iOffset, m_iOffsetOrg[compIdx+1][typeIdx][classIdx+mergeBandPosition+1], shift); 2529 } 2530 } 2531 else 2532 { 2533 estDist[compIdx] = 0; 2534 } 2535 2536 copySaoUnit(saoMergeParam[compIdx][idxNeighbor], saoLcuParamNeighbor[compIdx] ); 2537 saoMergeParam[compIdx][idxNeighbor]->mergeUpFlag = idxNeighbor; 2538 saoMergeParam[compIdx][idxNeighbor]->mergeLeftFlag = !idxNeighbor; 2539 distortion[idxNeighbor+1] += ((Double)estDist[compIdx]/lambda); 2540 } 2541 } 2542 } 2543 } 2544 #else 2545 TEncSampleAdaptiveOffset::TEncSampleAdaptiveOffset() 2546 { 2547 m_pcEntropyCoder = NULL; 2548 m_pppcRDSbacCoder = NULL; 2549 m_pcRDGoOnSbacCoder = NULL; 2550 m_pppcBinCoderCABAC = NULL; 2551 m_iCount = NULL; 2552 m_iOffset = NULL; 2553 m_iOffsetOrg = NULL; 2554 m_iRate = NULL; 2555 m_iDist = NULL; 2556 m_dCost = NULL; 2557 m_dCostPartBest = NULL; 2558 m_iDistOrg = NULL; 2559 m_iTypePartBest = NULL; 2560 } 2561 TEncSampleAdaptiveOffset::~TEncSampleAdaptiveOffset() 2562 { 2563 2564 } 2565 // ==================================================================================================================== 2566 // Constants 2567 // ==================================================================================================================== 2568 2569 2570 // ==================================================================================================================== 2571 // Tables 2572 // ==================================================================================================================== 2573 2574 inline Double xRoundIbdi2(Double x) 2575 { 2576 #if FULL_NBIT 2577 Int bitDepthMinus8 = g_uiBitDepth - 8; 2578 return ((x)>0) ? (Int)(((Int)(x)+(1<<(bitDepthMinus8-1)))/(1<<bitDepthMinus8)) : ((Int)(((Int)(x)-(1<<(bitDepthMinus8-1)))/(1<<bitDepthMinus8))); 2579 #else 2580 return ((x)>0) ? (Int)(((Int)(x)+(1<<(g_uiBitIncrement-1)))/(1<<g_uiBitIncrement)) : ((Int)(((Int)(x)-(1<<(g_uiBitIncrement-1)))/(1<<g_uiBitIncrement))); 2581 #endif 2582 } 2583 2584 /** rounding with IBDI 2585 * \param x 2586 */ 2587 inline Double xRoundIbdi(Double x) 2588 { 2589 #if FULL_NBIT 2590 return (g_uiBitDepth > 8 ? xRoundIbdi2((x)) : ((x)>=0 ? ((Int)((x)+0.5)) : ((Int)((x)-0.5)))) ; 2591 #else 2592 return (g_uiBitIncrement >0 ? xRoundIbdi2((x)) : ((x)>=0 ? ((Int)((x)+0.5)) : ((Int)((x)-0.5)))) ; 2593 #endif 2594 } 2595 2596 2597 2598 /** process SAO for one partition 2599 * \param *psQTPart, iPartIdx, dLambda 2600 */ 2601 Void TEncSampleAdaptiveOffset::rdoSaoOnePart(SAOQTPart *psQTPart, Int iPartIdx, Double dLambda) 2602 { 2603 Int iTypeIdx; 2604 Int iNumTotalType = MAX_NUM_SAO_TYPE; 2605 SAOQTPart* pOnePart = &(psQTPart[iPartIdx]); 2606 2607 Int64 iEstDist; 2608 Int64 iOffsetOrg; 2609 Int64 iOffset; 2610 Int64 iCount; 2611 Int iClassIdx; 2612 Int uiShift = g_uiBitIncrement << 1; 2613 UInt uiDepth = pOnePart->PartLevel; 2614 2615 m_iDistOrg [iPartIdx] = 0; 2616 2617 Double bestRDCostTableBo = MAX_DOUBLE; 2618 Int bestClassTableBo = 0; 2619 Int currentDistortionTableBo[MAX_NUM_SAO_CLASS]; 2620 Double currentRdCostTableBo[MAX_NUM_SAO_CLASS]; 2621 2622 #if HHI_INTERVIEW_SKIP 2623 Int iFrameWidthInCU = m_pcPic->getFrameWidthInCU(); 2624 Int LcuIdxX = psQTPart->StartCUX; 2625 Int LcuIdxY = psQTPart->StartCUY; 2626 Int iAddr = LcuIdxY*iFrameWidthInCU + LcuIdxX; 2627 TComDataCU *pcCU = m_pcPic->getCU(iAddr); 2628 Bool bRenderable = pcCU->getRenderable(0) ; 2629 2630 #endif 2631 for (iTypeIdx=-1; iTypeIdx<iNumTotalType; iTypeIdx++) 2632 { 2633 if( m_bUseSBACRD ) 2634 { 2635 m_pcRDGoOnSbacCoder->load(m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST]); 2636 m_pcRDGoOnSbacCoder->resetBits(); 2637 } 2638 else 2639 { 2640 m_pcEntropyCoder->resetEntropy(); 2641 m_pcEntropyCoder->resetBits(); 2642 } 2643 2644 iEstDist = 0; 2645 2646 m_pcEntropyCoder->m_pcEntropyCoderIf->codeSaoTypeIdx(iTypeIdx+1); 2647 2648 if (iTypeIdx>=0) 2649 { 2650 2651 for(iClassIdx=1; iClassIdx < ( (iTypeIdx < SAO_BO) ? m_iNumClass[iTypeIdx]+1 : SAO_MAX_BO_CLASSES+1); iClassIdx++) 2652 { 2653 if( iTypeIdx == SAO_BO) 2654 { 2655 currentDistortionTableBo[iClassIdx-1] = 0; 2656 currentRdCostTableBo[iClassIdx-1] = dLambda; 2657 } 2658 #if HHI_INTERVIEW_SKIP 2659 if(m_iCount [iPartIdx][iTypeIdx][iClassIdx] && !bRenderable) 2660 #else 2661 if(m_iCount [iPartIdx][iTypeIdx][iClassIdx]) 2662 #endif 2663 { 2664 #if FULL_NBIT 2665 m_iOffset[iPartIdx][iTypeIdx][iClassIdx] = (Int64) xRoundIbdi((Double)(m_iOffsetOrg[iPartIdx][iTypeIdx][iClassIdx]<<g_uiBitDepth-8) / (Double)(m_iCount [iPartIdx][iTypeIdx][iClassIdx]<<m_uiSaoBitIncrease)); 2666 #else 2667 m_iOffset[iPartIdx][iTypeIdx][iClassIdx] = (Int64) xRoundIbdi((Double)(m_iOffsetOrg[iPartIdx][iTypeIdx][iClassIdx]<<g_uiBitIncrement) / (Double)(m_iCount [iPartIdx][iTypeIdx][iClassIdx]<<m_uiSaoBitIncrease)); 2668 #endif 2669 m_iOffset[iPartIdx][iTypeIdx][iClassIdx] = Clip3(-m_iOffsetTh, m_iOffsetTh-1, (Int)m_iOffset[iPartIdx][iTypeIdx][iClassIdx]); 2670 2671 if (iTypeIdx < 4) 2672 { 2673 if ( m_iOffset[iPartIdx][iTypeIdx][iClassIdx]<0 && iClassIdx<3 ) 2674 { 2675 m_iOffset[iPartIdx][iTypeIdx][iClassIdx] = 0; 2676 } 2677 if ( m_iOffset[iPartIdx][iTypeIdx][iClassIdx]>0 && iClassIdx>=3) 2678 { 2679 m_iOffset[iPartIdx][iTypeIdx][iClassIdx] = 0; 2680 } 2681 } 2682 { 2683 //Clean up, best_q_offset. 2684 Int64 iIterOffset, iTempOffset; 2685 Int64 iTempDist, iTempRate; 2686 Double dTempCost, dTempMinCost; 2687 UInt uiLength, uiTemp; 2688 2689 iIterOffset = m_iOffset[iPartIdx][iTypeIdx][iClassIdx]; 2690 m_iOffset[iPartIdx][iTypeIdx][iClassIdx] = 0; 2691 dTempMinCost = dLambda; // Assuming sending quantized value 0 results in zero offset and sending the value zero needs 1 bit. entropy coder can be used to measure the exact rate here. 2692 2693 while (iIterOffset != 0) 2694 { 2695 // Calculate the bits required for signalling the offset 2696 uiLength = 1; 2697 uiTemp = (UInt)((iIterOffset <= 0) ? ( (-iIterOffset<<1) + 1 ) : (iIterOffset<<1)); 2698 while( 1 != uiTemp ) 2699 { 2700 uiTemp >>= 1; 2701 uiLength += 2; 2702 } 2703 iTempRate = (uiLength >> 1) + ((uiLength+1) >> 1); 2704 2705 // Do the dequntization before distorion calculation 2706 iTempOffset = iIterOffset << m_uiSaoBitIncrease; 2707 iTempDist = (( m_iCount [iPartIdx][iTypeIdx][iClassIdx]*iTempOffset*iTempOffset-m_iOffsetOrg[iPartIdx][iTypeIdx][iClassIdx]*iTempOffset*2 ) >> uiShift); 2708 2709 dTempCost = ((Double)iTempDist + dLambda * (Double) iTempRate); 2710 if(dTempCost < dTempMinCost) 2711 { 2712 dTempMinCost = dTempCost; 2713 m_iOffset[iPartIdx][iTypeIdx][iClassIdx] = iIterOffset; 2714 if(iTypeIdx == SAO_BO) 2715 { 2716 currentDistortionTableBo[iClassIdx-1] = (Int) iTempDist; 2717 currentRdCostTableBo[iClassIdx-1] = dTempCost; 2718 } 2719 } 2720 iIterOffset = (iIterOffset > 0) ? (iIterOffset-1):(iIterOffset+1); 2721 } 2722 2723 } 2724 } 2725 else 2726 { 2727 m_iOffsetOrg[iPartIdx][iTypeIdx][iClassIdx] = 0; 2728 m_iOffset[iPartIdx][iTypeIdx][iClassIdx] = 0; 2729 } 2730 if( iTypeIdx != SAO_BO ) 2731 { 2732 iCount = m_iCount [iPartIdx][iTypeIdx][iClassIdx]; 2733 iOffset = m_iOffset[iPartIdx][iTypeIdx][iClassIdx] << m_uiSaoBitIncrease; 2734 iOffsetOrg = m_iOffsetOrg[iPartIdx][iTypeIdx][iClassIdx]; 2735 iEstDist += (( iCount*iOffset*iOffset-iOffsetOrg*iOffset*2 ) >> uiShift); 2736 if (iTypeIdx < 4) 2737 { 2738 if (iClassIdx<3) 2739 { 2740 m_pcEntropyCoder->m_pcEntropyCoderIf->codeSaoUvlc((Int)m_iOffset[iPartIdx][iTypeIdx][iClassIdx]); 2741 } 2742 else 2743 { 2744 m_pcEntropyCoder->m_pcEntropyCoderIf->codeSaoUvlc((Int)-m_iOffset[iPartIdx][iTypeIdx][iClassIdx]); 2745 } 2746 } 2747 else 2748 { 2749 m_pcEntropyCoder->m_pcEntropyCoderIf->codeSaoSvlc((Int)m_iOffset[iPartIdx][iTypeIdx][iClassIdx]); 2750 } 2751 } 2752 } 2753 2754 if( iTypeIdx == SAO_BO ) 2755 { 2756 // Estimate Best Position 2757 Double currentRDCost = 0.0; 2758 2759 for(Int i=0; i< SAO_MAX_BO_CLASSES -SAO_BO_LEN +1; i++) 2760 { 2761 currentRDCost = 0.0; 2762 for(UInt uj = i; uj < i+SAO_BO_LEN; uj++) 2763 { 2764 currentRDCost += currentRdCostTableBo[uj]; 2765 } 2766 2767 if( currentRDCost < bestRDCostTableBo) 2768 { 2769 bestRDCostTableBo = currentRDCost; 2770 bestClassTableBo = i; 2771 } 2772 } 2773 2774 // Re code all Offsets 2775 // Code Center 2776 m_pcEntropyCoder->m_pcEntropyCoderIf->codeSaoUflc( (UInt) (bestClassTableBo) ); 2777 2778 for(iClassIdx = bestClassTableBo; iClassIdx < bestClassTableBo+SAO_BO_LEN; iClassIdx++) 2779 { 2780 m_pcEntropyCoder->m_pcEntropyCoderIf->codeSaoSvlc((Int)m_iOffset[iPartIdx][iTypeIdx][iClassIdx+1]); 2781 iEstDist += currentDistortionTableBo[iClassIdx]; 2782 } 2783 } 2784 2785 m_iDist[iPartIdx][iTypeIdx] = iEstDist; 2786 m_iRate[iPartIdx][iTypeIdx] = m_pcEntropyCoder->getNumberOfWrittenBits(); 2787 2788 m_dCost[iPartIdx][iTypeIdx] = (Double)((Double)m_iDist[iPartIdx][iTypeIdx] + dLambda * (Double) m_iRate[iPartIdx][iTypeIdx]); 2789 2790 if(m_dCost[iPartIdx][iTypeIdx] < m_dCostPartBest[iPartIdx]) 2791 { 2792 m_iDistOrg [iPartIdx] = 0; 2793 m_dCostPartBest[iPartIdx] = m_dCost[iPartIdx][iTypeIdx]; 2794 m_iTypePartBest[iPartIdx] = iTypeIdx; 2795 if( m_bUseSBACRD ) 2796 m_pcRDGoOnSbacCoder->store( m_pppcRDSbacCoder[pOnePart->PartLevel][CI_TEMP_BEST] ); 2797 } 2798 } 2799 else 2800 { 2801 if(m_iDistOrg[iPartIdx] < m_dCostPartBest[iPartIdx] ) 2802 { 2803 m_dCostPartBest[iPartIdx] = (Double) m_iDistOrg[iPartIdx] + m_pcEntropyCoder->getNumberOfWrittenBits()*dLambda ; 2804 m_iTypePartBest[iPartIdx] = -1; 2805 if( m_bUseSBACRD ) 2806 m_pcRDGoOnSbacCoder->store( m_pppcRDSbacCoder[pOnePart->PartLevel][CI_TEMP_BEST] ); 2807 } 2808 } 2809 } 2810 2811 pOnePart->bProcessed = true; 2812 pOnePart->bSplit = false; 2813 pOnePart->iMinDist = m_iTypePartBest[iPartIdx] >= 0 ? m_iDist[iPartIdx][m_iTypePartBest[iPartIdx]] : m_iDistOrg[iPartIdx]; 2814 pOnePart->iMinRate = (Int) (m_iTypePartBest[iPartIdx] >= 0 ? m_iRate[iPartIdx][m_iTypePartBest[iPartIdx]] : 0); 2815 pOnePart->dMinCost = pOnePart->iMinDist + dLambda * pOnePart->iMinRate; 2816 pOnePart->iBestType = m_iTypePartBest[iPartIdx]; 2817 if (pOnePart->iBestType != -1) 2818 { 2819 // pOnePart->bEnableFlag = 1; 2820 pOnePart->iLength = m_iNumClass[pOnePart->iBestType]; 2821 Int minIndex = 0; 2822 if( pOnePart->iBestType == SAO_BO ) 2823 { 2824 pOnePart->bandPosition = bestClassTableBo; 2825 minIndex = pOnePart->bandPosition; 2826 } 2827 for (Int i=0; i< pOnePart->iLength ; i++) 2828 { 2829 pOnePart->iOffset[i] = (Int) m_iOffset[iPartIdx][pOnePart->iBestType][minIndex+i+1]; 2830 } 2831 2832 } 2833 else 2834 { 2835 // pOnePart->bEnableFlag = 0; 2836 pOnePart->iLength = 0; 2837 } 2838 } 2839 2840 /** Run partition tree disable 2841 */ 2842 Void TEncSampleAdaptiveOffset::disablePartTree(SAOQTPart *psQTPart, Int iPartIdx) 2843 { 2844 SAOQTPart* pOnePart= &(psQTPart[iPartIdx]); 2845 pOnePart->bSplit = false; 2846 pOnePart->iLength = 0; 2847 pOnePart->iBestType = -1; 2848 2849 if (pOnePart->PartLevel < m_uiMaxSplitLevel) 2850 { 2851 for (Int i=0; i<NUM_DOWN_PART; i++) 2852 { 2853 disablePartTree(psQTPart, pOnePart->DownPartsIdx[i]); 2854 } 2855 } 2856 } 2857 2858 /** Run quadtree decision function 2859 * \param iPartIdx, pcPicOrg, pcPicDec, pcPicRest, &dCostFinal 2860 */ 2861 Void TEncSampleAdaptiveOffset::runQuadTreeDecision(SAOQTPart *psQTPart, Int iPartIdx, Double &dCostFinal, Int iMaxLevel, Double dLambda) 2862 { 2863 SAOQTPart* pOnePart = &(psQTPart[iPartIdx]); 2864 2865 UInt uiDepth = pOnePart->PartLevel; 2866 UInt uhNextDepth = uiDepth+1; 2867 2868 if (iPartIdx == 0) 2869 { 2870 dCostFinal = 0; 2871 } 2872 2873 //SAO for this part 2874 if(!pOnePart->bProcessed) 2875 { 2876 rdoSaoOnePart (psQTPart, iPartIdx, dLambda); 2877 } 2878 2879 //SAO for sub 4 parts 2880 if (pOnePart->PartLevel < iMaxLevel) 2881 { 2882 Double dCostNotSplit = dLambda + pOnePart->dMinCost; 2883 Double dCostSplit = dLambda; 2884 2885 for (Int i=0; i< NUM_DOWN_PART ;i++) 2886 { 2887 if( m_bUseSBACRD ) 2888 { 2889 if ( 0 == i) //initialize RD with previous depth buffer 2890 { 2891 m_pppcRDSbacCoder[uhNextDepth][CI_CURR_BEST]->load(m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST]); 2892 } 2893 else 2894 { 2895 m_pppcRDSbacCoder[uhNextDepth][CI_CURR_BEST]->load(m_pppcRDSbacCoder[uhNextDepth][CI_NEXT_BEST]); 2896 } 2897 } 2898 runQuadTreeDecision(psQTPart, pOnePart->DownPartsIdx[i], dCostFinal, iMaxLevel, dLambda); 2899 dCostSplit += dCostFinal; 2900 if( m_bUseSBACRD ) 2901 { 2902 m_pppcRDSbacCoder[uhNextDepth][CI_NEXT_BEST]->load(m_pppcRDSbacCoder[uhNextDepth][CI_TEMP_BEST]); 2903 } 2904 } 2905 2906 if(dCostSplit < dCostNotSplit) 2907 { 2908 dCostFinal = dCostSplit; 2909 pOnePart->bSplit = true; 2910 pOnePart->iLength = 0; 2911 pOnePart->iBestType = -1; 2912 if( m_bUseSBACRD ) 2913 { 2914 m_pppcRDSbacCoder[uiDepth][CI_NEXT_BEST]->load(m_pppcRDSbacCoder[uhNextDepth][CI_NEXT_BEST]); 2915 } 2916 } 2917 else 2918 { 2919 dCostFinal = dCostNotSplit; 2920 pOnePart->bSplit = false; 2921 for (Int i=0; i<NUM_DOWN_PART; i++) 2922 { 2923 disablePartTree(psQTPart, pOnePart->DownPartsIdx[i]); 2924 } 2925 if( m_bUseSBACRD ) 2926 { 2927 m_pppcRDSbacCoder[uiDepth][CI_NEXT_BEST]->load(m_pppcRDSbacCoder[uiDepth][CI_TEMP_BEST]); 2928 } 2929 } 2930 } 2931 else 2932 { 2933 dCostFinal = pOnePart->dMinCost; 2934 } 2935 } 2936 2937 /** delete allocated memory of TEncSampleAdaptiveOffset class. 2938 */ 2939 Void TEncSampleAdaptiveOffset::destroyEncBuffer() 2940 { 2941 for (Int i=0;i<m_iNumTotalParts;i++) 2942 { 2943 for (Int j=0;j<MAX_NUM_SAO_TYPE;j++) 2944 { 2945 if (m_iCount [i][j]) 2946 { 2947 delete [] m_iCount [i][j]; 2948 } 2949 if (m_iOffset[i][j]) 2950 { 2951 delete [] m_iOffset[i][j]; 2952 } 2953 if (m_iOffsetOrg[i][j]) 2954 { 2955 delete [] m_iOffsetOrg[i][j]; 2956 } 2957 } 2958 if (m_iRate[i]) 2959 { 2960 delete [] m_iRate[i]; 2961 } 2962 if (m_iDist[i]) 2963 { 2964 delete [] m_iDist[i]; 2965 } 2966 if (m_dCost[i]) 2967 { 2968 delete [] m_dCost[i]; 2969 } 2970 if (m_iCount [i]) 2971 { 2972 delete [] m_iCount [i]; 2973 } 2974 if (m_iOffset[i]) 2975 { 2976 delete [] m_iOffset[i]; 2977 } 2978 if (m_iOffsetOrg[i]) 2979 { 2980 delete [] m_iOffsetOrg[i]; 2981 } 2982 2983 } 2984 if (m_iDistOrg) 2985 { 2986 delete [] m_iDistOrg ; m_iDistOrg = NULL; 2987 } 2988 if (m_dCostPartBest) 2989 { 2990 delete [] m_dCostPartBest ; m_dCostPartBest = NULL; 2991 } 2992 if (m_iTypePartBest) 2993 { 2994 delete [] m_iTypePartBest ; m_iTypePartBest = NULL; 2995 } 2996 if (m_iRate) 2997 { 2998 delete [] m_iRate ; m_iRate = NULL; 2999 } 3000 if (m_iDist) 3001 { 3002 delete [] m_iDist ; m_iDist = NULL; 3003 } 3004 if (m_dCost) 3005 { 3006 delete [] m_dCost ; m_dCost = NULL; 3007 } 3008 if (m_iCount) 3009 { 3010 delete [] m_iCount ; m_iCount = NULL; 3011 } 3012 if (m_iOffset) 3013 { 3014 delete [] m_iOffset ; m_iOffset = NULL; 3015 } 3016 if (m_iOffsetOrg) 3017 { 3018 delete [] m_iOffsetOrg ; m_iOffsetOrg = NULL; 3019 } 3020 3021 Int iMaxDepth = 4; 3022 Int iDepth; 3023 for ( iDepth = 0; iDepth < iMaxDepth+1; iDepth++ ) 3024 { 3025 for (Int iCIIdx = 0; iCIIdx < CI_NUM; iCIIdx ++ ) 3026 { 3027 delete m_pppcRDSbacCoder[iDepth][iCIIdx]; 3028 delete m_pppcBinCoderCABAC[iDepth][iCIIdx]; 3029 } 3030 } 3031 3032 for ( iDepth = 0; iDepth < iMaxDepth+1; iDepth++ ) 3033 { 3034 delete [] m_pppcRDSbacCoder[iDepth]; 3035 delete [] m_pppcBinCoderCABAC[iDepth]; 3036 } 3037 3038 delete [] m_pppcRDSbacCoder; 3039 delete [] m_pppcBinCoderCABAC; 3040 } 3041 3042 /** create Encoder Buffer for SAO 3043 * \param 3044 */ 3045 Void TEncSampleAdaptiveOffset::createEncBuffer() 3046 { 3047 m_iDistOrg = new Int64 [m_iNumTotalParts]; 3048 m_dCostPartBest = new Double [m_iNumTotalParts]; 3049 m_iTypePartBest = new Int [m_iNumTotalParts]; 3050 3051 m_iRate = new Int64* [m_iNumTotalParts]; 3052 m_iDist = new Int64* [m_iNumTotalParts]; 3053 m_dCost = new Double*[m_iNumTotalParts]; 3054 3055 m_iCount = new Int64 **[m_iNumTotalParts]; 3056 m_iOffset = new Int64 **[m_iNumTotalParts]; 3057 m_iOffsetOrg = new Int64 **[m_iNumTotalParts]; 3058 3059 for (Int i=0;i<m_iNumTotalParts;i++) 3060 { 3061 m_iRate[i] = new Int64 [MAX_NUM_SAO_TYPE]; 3062 m_iDist[i] = new Int64 [MAX_NUM_SAO_TYPE]; 3063 m_dCost[i] = new Double [MAX_NUM_SAO_TYPE]; 3064 3065 m_iCount [i] = new Int64 *[MAX_NUM_SAO_TYPE]; 3066 m_iOffset[i] = new Int64 *[MAX_NUM_SAO_TYPE]; 3067 m_iOffsetOrg[i] = new Int64 *[MAX_NUM_SAO_TYPE]; 3068 3069 for (Int j=0;j<MAX_NUM_SAO_TYPE;j++) 3070 { 3071 m_iCount [i][j] = new Int64 [MAX_NUM_SAO_CLASS]; 3072 m_iOffset[i][j] = new Int64 [MAX_NUM_SAO_CLASS]; 3073 m_iOffsetOrg[i][j]= new Int64 [MAX_NUM_SAO_CLASS]; 3074 } 3075 } 3076 3077 Int iMaxDepth = 4; 3078 m_pppcRDSbacCoder = new TEncSbac** [iMaxDepth+1]; 3079 #if FAST_BIT_EST 3080 m_pppcBinCoderCABAC = new TEncBinCABACCounter** [iMaxDepth+1]; 3081 #else 3082 m_pppcBinCoderCABAC = new TEncBinCABAC** [iMaxDepth+1]; 3083 #endif 3084 3085 for ( Int iDepth = 0; iDepth < iMaxDepth+1; iDepth++ ) 3086 { 3087 m_pppcRDSbacCoder[iDepth] = new TEncSbac* [CI_NUM]; 3088 #if FAST_BIT_EST 3089 m_pppcBinCoderCABAC[iDepth] = new TEncBinCABACCounter* [CI_NUM]; 3090 #else 3091 m_pppcBinCoderCABAC[iDepth] = new TEncBinCABAC* [CI_NUM]; 3092 #endif 3093 for (Int iCIIdx = 0; iCIIdx < CI_NUM; iCIIdx ++ ) 3094 { 3095 m_pppcRDSbacCoder[iDepth][iCIIdx] = new TEncSbac; 3096 #if FAST_BIT_EST 3097 m_pppcBinCoderCABAC [iDepth][iCIIdx] = new TEncBinCABACCounter; 3098 #else 3099 m_pppcBinCoderCABAC [iDepth][iCIIdx] = new TEncBinCABAC; 3100 #endif 3101 m_pppcRDSbacCoder [iDepth][iCIIdx]->init( m_pppcBinCoderCABAC [iDepth][iCIIdx] ); 3102 } 3103 } 3104 } 3105 3106 /** Start SAO encoder 3107 * \param pcPic, pcEntropyCoder, pppcRDSbacCoder, pcRDGoOnSbacCoder 3108 */ 3109 Void TEncSampleAdaptiveOffset::startSaoEnc( TComPic* pcPic, TEncEntropy* pcEntropyCoder, TEncSbac*** pppcRDSbacCoder, TEncSbac* pcRDGoOnSbacCoder) 3110 { 3111 if( pcRDGoOnSbacCoder ) 3112 m_bUseSBACRD = true; 3113 else 3114 m_bUseSBACRD = false; 3115 3116 m_pcPic = pcPic; 3117 m_pcEntropyCoder = pcEntropyCoder; 3118 3119 m_pcRDGoOnSbacCoder = pcRDGoOnSbacCoder; 3120 m_pcEntropyCoder->resetEntropy(); 3121 m_pcEntropyCoder->resetBits(); 3122 3123 if( m_bUseSBACRD ) 3124 { 3125 m_pcRDGoOnSbacCoder->store( m_pppcRDSbacCoder[0][CI_NEXT_BEST]); 3126 m_pppcRDSbacCoder[0][CI_CURR_BEST]->load( m_pppcRDSbacCoder[0][CI_NEXT_BEST]); 3127 } 3128 } 3129 3130 /** End SAO encoder 3131 */ 3132 Void TEncSampleAdaptiveOffset::endSaoEnc() 3133 { 3134 m_pcPic = NULL; 3135 m_pcEntropyCoder = NULL; 3136 } 3137 3138 inline int xSign(int x) 3139 { 3140 return ((x >> 31) | ((int)( (((unsigned int) -x)) >> 31))); 3141 } 3142 3143 /** Calculate SAO statistics for non-cross-slice or non-cross-tile processing 3144 * \param pRecStart to-be-filtered block buffer pointer 3145 * \param pOrgStart original block buffer pointer 3146 * \param stride picture buffer stride 3147 * \param ppStat statistics buffer 3148 * \param ppCount counter buffer 3149 * \param width block width 3150 * \param height block height 3151 * \param pbBorderAvail availabilities of block border pixels 3152 */ 3153 Void TEncSampleAdaptiveOffset::calcSaoStatsBlock( Pel* pRecStart, Pel* pOrgStart, Int stride, Int64** ppStats, Int64** ppCount, UInt width, UInt height, Bool* pbBorderAvail) 3154 { 3155 Int64 *stats, *count; 3156 Int classIdx, posShift, startX, endX, startY, endY, signLeft,signRight,signDown,signDown1; 3157 Pel *pOrg, *pRec; 3158 UInt edgeType; 3159 Int x, y; 3160 3161 //--------- Band offset-----------// 3162 stats = ppStats[SAO_BO]; 3163 count = ppCount[SAO_BO]; 3164 pOrg = pOrgStart; 3165 pRec = pRecStart; 3166 for (y=0; y< height; y++) 3167 { 3168 for (x=0; x< width; x++) 3169 { 3170 classIdx = m_lumaTableBo[pRec[x]]; 3171 if (classIdx) 3172 { 3173 stats[classIdx] += (pOrg[x] - pRec[x]); 3174 count[classIdx] ++; 3175 } 3176 } 3177 pOrg += stride; 3178 pRec += stride; 3179 } 3180 //---------- Edge offset 0--------------// 3181 stats = ppStats[SAO_EO_0]; 3182 count = ppCount[SAO_EO_0]; 3183 pOrg = pOrgStart; 3184 pRec = pRecStart; 3185 3186 3187 startX = (pbBorderAvail[SGU_L]) ? 0 : 1; 3188 endX = (pbBorderAvail[SGU_R]) ? width : (width -1); 3189 for (y=0; y< height; y++) 3190 { 3191 signLeft = xSign(pRec[startX] - pRec[startX-1]); 3192 for (x=startX; x< endX; x++) 3193 { 3194 signRight = xSign(pRec[x] - pRec[x+1]); 3195 edgeType = signRight + signLeft + 2; 3196 signLeft = -signRight; 3197 3198 stats[m_auiEoTable[edgeType]] += (pOrg[x] - pRec[x]); 3199 count[m_auiEoTable[edgeType]] ++; 3200 } 3201 pRec += stride; 3202 pOrg += stride; 3203 } 3204 3205 //---------- Edge offset 1--------------// 3206 stats = ppStats[SAO_EO_1]; 3207 count = ppCount[SAO_EO_1]; 3208 pOrg = pOrgStart; 3209 pRec = pRecStart; 3210 3211 startY = (pbBorderAvail[SGU_T]) ? 0 : 1; 3212 endY = (pbBorderAvail[SGU_B]) ? height : height-1; 3213 if (!pbBorderAvail[SGU_T]) 3214 { 3215 pRec += stride; 3216 pOrg += stride; 3217 } 3218 3219 for (x=0; x< width; x++) 3220 { 3221 m_iUpBuff1[x] = xSign(pRec[x] - pRec[x-stride]); 3222 } 3223 for (y=startY; y<endY; y++) 3224 { 3225 for (x=0; x< width; x++) 3226 { 3227 signDown = xSign(pRec[x] - pRec[x+stride]); 3228 edgeType = signDown + m_iUpBuff1[x] + 2; 3229 m_iUpBuff1[x] = -signDown; 3230 3231 stats[m_auiEoTable[edgeType]] += (pOrg[x] - pRec[x]); 3232 count[m_auiEoTable[edgeType]] ++; 3233 } 3234 pOrg += stride; 3235 pRec += stride; 3236 } 3237 //---------- Edge offset 2--------------// 3238 stats = ppStats[SAO_EO_2]; 3239 count = ppCount[SAO_EO_2]; 3240 pOrg = pOrgStart; 3241 pRec = pRecStart; 3242 3243 posShift= stride + 1; 3244 3245 startX = (pbBorderAvail[SGU_L]) ? 0 : 1 ; 3246 endX = (pbBorderAvail[SGU_R]) ? width : (width-1); 3247 3248 //prepare 2nd line upper sign 3249 pRec += stride; 3250 for (x=startX; x< endX+1; x++) 3251 { 3252 m_iUpBuff1[x] = xSign(pRec[x] - pRec[x- posShift]); 3253 } 3254 3255 //1st line 3256 pRec -= stride; 3257 if(pbBorderAvail[SGU_TL]) 3258 { 3259 x= 0; 3260 edgeType = xSign(pRec[x] - pRec[x- posShift]) - m_iUpBuff1[x+1] + 2; 3261 stats[m_auiEoTable[edgeType]] += (pOrg[x] - pRec[x]); 3262 count[m_auiEoTable[edgeType]] ++; 3263 } 3264 if(pbBorderAvail[SGU_T]) 3265 { 3266 for(x= 1; x< endX; x++) 3267 { 3268 edgeType = xSign(pRec[x] - pRec[x- posShift]) - m_iUpBuff1[x+1] + 2; 3269 stats[m_auiEoTable[edgeType]] += (pOrg[x] - pRec[x]); 3270 count[m_auiEoTable[edgeType]] ++; 3271 } 3272 } 3273 pRec += stride; 3274 pOrg += stride; 3275 3276 //middle lines 3277 for (y= 1; y< height-1; y++) 3278 { 3279 for (x=startX; x<endX; x++) 3280 { 3281 signDown1 = xSign(pRec[x] - pRec[x+ posShift]) ; 3282 edgeType = signDown1 + m_iUpBuff1[x] + 2; 3283 stats[m_auiEoTable[edgeType]] += (pOrg[x] - pRec[x]); 3284 count[m_auiEoTable[edgeType]] ++; 3285 3286 m_iUpBufft[x+1] = -signDown1; 3287 } 3288 m_iUpBufft[startX] = xSign(pRec[stride+startX] - pRec[startX-1]); 3289 3290 ipSwap = m_iUpBuff1; 3291 m_iUpBuff1 = m_iUpBufft; 3292 m_iUpBufft = ipSwap; 3293 3294 pRec += stride; 3295 pOrg += stride; 3296 } 3297 3298 //last line 3299 if(pbBorderAvail[SGU_B]) 3300 { 3301 for(x= startX; x< width-1; x++) 3302 { 3303 edgeType = xSign(pRec[x] - pRec[x+ posShift]) + m_iUpBuff1[x] + 2; 3304 stats[m_auiEoTable[edgeType]] += (pOrg[x] - pRec[x]); 3305 count[m_auiEoTable[edgeType]] ++; 3306 } 3307 } 3308 if(pbBorderAvail[SGU_BR]) 3309 { 3310 x= width -1; 3311 edgeType = xSign(pRec[x] - pRec[x+ posShift]) + m_iUpBuff1[x] + 2; 3312 stats[m_auiEoTable[edgeType]] += (pOrg[x] - pRec[x]); 3313 count[m_auiEoTable[edgeType]] ++; 3314 } 3315 3316 //---------- Edge offset 3--------------// 3317 3318 stats = ppStats[SAO_EO_3]; 3319 count = ppCount[SAO_EO_3]; 3320 pOrg = pOrgStart; 3321 pRec = pRecStart; 3322 3323 posShift = stride - 1; 3324 startX = (pbBorderAvail[SGU_L]) ? 0 : 1; 3325 endX = (pbBorderAvail[SGU_R]) ? width : (width -1); 3326 3327 //prepare 2nd line upper sign 3328 pRec += stride; 3329 for (x=startX-1; x< endX; x++) 3330 { 3331 m_iUpBuff1[x] = xSign(pRec[x] - pRec[x- posShift]); 3332 } 3333 3334 3335 //first line 3336 pRec -= stride; 3337 if(pbBorderAvail[SGU_T]) 3338 { 3339 for(x= startX; x< width -1; x++) 3340 { 3341 edgeType = xSign(pRec[x] - pRec[x- posShift]) -m_iUpBuff1[x-1] + 2; 3342 stats[m_auiEoTable[edgeType]] += (pOrg[x] - pRec[x]); 3343 count[m_auiEoTable[edgeType]] ++; 3344 } 3345 } 3346 if(pbBorderAvail[SGU_TR]) 3347 { 3348 x= width-1; 3349 edgeType = xSign(pRec[x] - pRec[x- posShift]) -m_iUpBuff1[x-1] + 2; 3350 stats[m_auiEoTable[edgeType]] += (pOrg[x] - pRec[x]); 3351 count[m_auiEoTable[edgeType]] ++; 3352 } 3353 pRec += stride; 3354 pOrg += stride; 3355 3356 //middle lines 3357 for (y= 1; y< height-1; y++) 3358 { 3359 for(x= startX; x< endX; x++) 3360 { 3361 signDown1 = xSign(pRec[x] - pRec[x+ posShift]) ; 3362 edgeType = signDown1 + m_iUpBuff1[x] + 2; 3363 3364 stats[m_auiEoTable[edgeType]] += (pOrg[x] - pRec[x]); 3365 count[m_auiEoTable[edgeType]] ++; 3366 m_iUpBuff1[x-1] = -signDown1; 3367 3368 } 3369 m_iUpBuff1[endX-1] = xSign(pRec[endX-1 + stride] - pRec[endX]); 3370 3371 pRec += stride; 3372 pOrg += stride; 3373 } 3374 3375 //last line 3376 if(pbBorderAvail[SGU_BL]) 3377 { 3378 x= 0; 3379 edgeType = xSign(pRec[x] - pRec[x+ posShift]) + m_iUpBuff1[x] + 2; 3380 stats[m_auiEoTable[edgeType]] += (pOrg[x] - pRec[x]); 3381 count[m_auiEoTable[edgeType]] ++; 3382 3383 } 3384 if(pbBorderAvail[SGU_B]) 3385 { 3386 for(x= 1; x< endX; x++) 3387 { 3388 edgeType = xSign(pRec[x] - pRec[x+ posShift]) + m_iUpBuff1[x] + 2; 3389 stats[m_auiEoTable[edgeType]] += (pOrg[x] - pRec[x]); 3390 count[m_auiEoTable[edgeType]] ++; 3391 } 3392 } 3393 } 3394 3395 /** Calculate SAO statistics for current LCU 3396 * \param iAddr, iPartIdx, iYCbCr 3397 */ 3398 Void TEncSampleAdaptiveOffset::calcSaoStatsCu(Int iAddr, Int iPartIdx, Int iYCbCr) 3399 { 3400 if(!m_bUseNIF) 3401 { 3402 calcSaoStatsCuOrg( iAddr, iPartIdx, iYCbCr); 3403 } 3404 else 3405 { 3406 Int64** ppStats = m_iOffsetOrg[iPartIdx]; 3407 Int64** ppCount = m_iCount [iPartIdx]; 3408 3409 //parameters 3410 Int isChroma = (iYCbCr != 0)? 1:0; 3411 Int stride = (iYCbCr != 0)?(m_pcPic->getCStride()):(m_pcPic->getStride()); 3412 Pel* pPicOrg = getPicYuvAddr (m_pcPic->getPicYuvOrg(), iYCbCr); 3413 Pel* pPicRec = getPicYuvAddr(m_pcYuvTmp, iYCbCr); 3414 3415 std::vector<NDBFBlockInfo>& vFilterBlocks = *(m_pcPic->getCU(iAddr)->getNDBFilterBlocks()); 3416 3417 //variables 3418 UInt xPos, yPos, width, height; 3419 Bool* pbBorderAvail; 3420 UInt posOffset; 3421 3422 for(Int i=0; i< vFilterBlocks.size(); i++) 3423 { 3424 xPos = vFilterBlocks[i].posX >> isChroma; 3425 yPos = vFilterBlocks[i].posY >> isChroma; 3426 width = vFilterBlocks[i].width >> isChroma; 3427 height = vFilterBlocks[i].height >> isChroma; 3428 pbBorderAvail = vFilterBlocks[i].isBorderAvailable; 3429 3430 posOffset = (yPos* stride) + xPos; 3431 3432 #if HHI_INTERVIEW_SKIP 3433 if( !m_pcPic->getCU(iAddr)->getRenderable(0 )) 3434 { 3435 calcSaoStatsBlock(pPicRec+ posOffset, pPicOrg+ posOffset, stride, ppStats, ppCount,width, height, pbBorderAvail); 3436 } 3437 #else 3438 calcSaoStatsBlock(pPicRec+ posOffset, pPicOrg+ posOffset, stride, ppStats, ppCount,width, height, pbBorderAvail); 3439 #endif 3440 } 3441 } 3442 3443 } 3444 3445 /** Calculate SAO statistics for current LCU without non-crossing slice 3446 * \param iAddr, iPartIdx, iYCbCr 3447 */ 3448 Void TEncSampleAdaptiveOffset::calcSaoStatsCuOrg(Int iAddr, Int iPartIdx, Int iYCbCr) 3449 { 3450 Int x,y; 3451 TComDataCU *pTmpCu = m_pcPic->getCU(iAddr); 3452 TComSPS *pTmpSPS = m_pcPic->getSlice(0)->getSPS(); 3453 3454 Pel* pOrg; 3455 Pel* pRec; 3456 Int iStride; 3457 Int iLcuWidth = pTmpSPS->getMaxCUHeight(); 3458 Int iLcuHeight = pTmpSPS->getMaxCUWidth(); 3459 UInt uiLPelX = pTmpCu->getCUPelX(); 3460 UInt uiTPelY = pTmpCu->getCUPelY(); 3461 UInt uiRPelX; 3462 UInt uiBPelY; 3463 Int64* iStats; 3464 Int64* iCount; 3465 Int iClassIdx; 3466 Int iPicWidthTmp; 3467 Int iPicHeightTmp; 3468 Int iStartX; 3469 Int iStartY; 3470 Int iEndX; 3471 Int iEndY; 3472 3473 Int iIsChroma = (iYCbCr!=0)? 1:0; 3474 Int numSkipLine = iIsChroma? 2:4; 976 3475 if (m_saoInterleavingFlag == 0) 977 3476 { … … 1974 4473 1975 4474 } 4475 #endif 1976 4476 1977 4477 -
trunk/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.h
r296 r443 71 71 Int64 ***m_iOffset; //[MAX_NUM_SAO_PART][MAX_NUM_SAO_TYPE][MAX_NUM_SAO_CLASS]; 72 72 Int64 ***m_iOffsetOrg; //[MAX_NUM_SAO_PART][MAX_NUM_SAO_TYPE]; 73 #if LGE_SAO_MIGRATION_D0091 74 Int64 ****m_count_PreDblk; //[LCU][YCbCr][MAX_NUM_SAO_TYPE][MAX_NUM_SAO_CLASS]; 75 Int64 ****m_offsetOrg_PreDblk; //[LCU][YCbCr][MAX_NUM_SAO_TYPE][MAX_NUM_SAO_CLASS]; 76 #endif 73 77 Int64 **m_iRate; //[MAX_NUM_SAO_PART][MAX_NUM_SAO_TYPE]; 74 78 Int64 **m_iDist; //[MAX_NUM_SAO_PART][MAX_NUM_SAO_TYPE]; … … 79 83 Int m_iOffsetTh; 80 84 Bool m_bUseSBACRD; 85 #if SAO_ENCODING_CHOICE 86 #if SAO_ENCODING_CHOICE_CHROMA 87 Double m_depthSaoRate[2][4]; 88 #else 89 Double m_depth0SaoRate; 90 #endif 91 #endif 81 92 82 93 public: … … 88 99 Void resetStats(); 89 100 #if SAO_CHROMA_LAMBDA 101 #if SAO_ENCODING_CHOICE 102 Void SAOProcess(SAOParam *pcSaoParam, Double dLambda, Double dLambdaChroma, Int depth); 103 #else 90 104 Void SAOProcess(SAOParam *pcSaoParam, Double dLambda, Double dLambdaChroma); 105 #endif 91 106 #else 92 107 Void SAOProcess(SAOParam *pcSaoParam, Double dLambda); 93 108 #endif 109 110 #if LGE_SAO_MIGRATION_D0091 111 Void runQuadTreeDecision(SAOQTPart *psQTPart, Int iPartIdx, Double &dCostFinal, Int iMaxLevel, Double dLambda, Int yCbCr); 112 Void rdoSaoOnePart(SAOQTPart *psQTPart, Int iPartIdx, Double dLambda, Int yCbCr); 113 #else 94 114 Void runQuadTreeDecision(SAOQTPart *psQTPart, Int iPartIdx, Double &dCostFinal, Int iMaxLevel, Double dLambda); 95 115 Void rdoSaoOnePart(SAOQTPart *psQTPart, Int iPartIdx, Double dLambda); 116 #endif 117 96 118 Void disablePartTree(SAOQTPart *psQTPart, Int iPartIdx); 97 119 Void getSaoStats(SAOQTPart *psQTPart, Int iYCbCr); … … 99 121 Void calcSaoStatsBlock( Pel* pRecStart, Pel* pOrgStart, Int stride, Int64** ppStats, Int64** ppCount, UInt width, UInt height, Bool* pbBorderAvail); 100 122 Void calcSaoStatsCuOrg(Int iAddr, Int iPartIdx, Int iYCbCr); 123 #if LGE_SAO_MIGRATION_D0091 124 Void calcSaoStatsCu_BeforeDblk( TComPic* pcPic ); 125 #endif 101 126 Void destroyEncBuffer(); 102 127 Void createEncBuffer(); 103 128 Void assignSaoUnitSyntax(SaoLcuParam* saoLcuParam, SAOQTPart* saoPart, Bool &oneUnitFlag, Int yCbCr); 104 129 Void checkMerge(SaoLcuParam * lcuParamCurr,SaoLcuParam * lcuParamCheck, Int dir); 130 #if SAO_ENCODING_CHOICE 131 Void rdoSaoUnitAll(SAOParam *saoParam, Double lambda, Double lambdaChroma, Int depth); 132 #else 105 133 Void rdoSaoUnitAll(SAOParam *saoParam, Double lambda, Double lambdaChroma); 134 #endif 135 #if LGE_SAO_MIGRATION_D0091 136 Void saoComponentParamDist(Int allowMergeLeft, Int allowMergeUp, SAOParam *saoParam, Int addr, Int addrUp, Int addrLeft, Int yCbCr, Double lambda, SaoLcuParam *compSaoParam, Double *distortion); 137 Void sao2ChromaParamDist(Int allowMergeLeft, Int allowMergeUp, SAOParam *saoParam, Int addr, Int addrUp, Int addrLeft, Double lambda, SaoLcuParam *crSaoParam, SaoLcuParam *cbSaoParam, Double *distortion); 138 inline Int64 estSaoDist(Int64 count, Int64 offset, Int64 offsetOrg, Int shift); 139 inline Int64 estIterOffset(Int typeIdx, Int classIdx, double lambda, Int64 offsetInput, Int64 count, Int64 offsetOrg, Int shift, Int bitIncrease, Int *currentDistortionTableBo, Double *currentRdCostTableBo ); 140 inline Int64 estSaoTypeDist(Int compIdx, Int typeIdx, Int shift, Double lambda, Int *currentDistortionTableBo, Double *currentRdCostTableBo); 141 #else 106 142 Void rdoSaoUnit(SAOParam *saoParam, Int addr, Int addrUp, Int addrLeft, Int yCbCr, Double lambda); 143 #endif 107 144 Void setMaxNumOffsetsPerPic(Int iVal) {m_maxNumOffsetsPerPic = iVal; } 108 145 Int getMaxNumOffsetsPerPic() {return m_maxNumOffsetsPerPic; } -
trunk/source/Lib/TLibEncoder/TEncSbac.cpp
r332 r443 42 42 #include <algorithm> 43 43 44 #if RWTH_SDC_DLT_B003645 #define GetNumDepthValues() (pcCU->getSlice()->getSPS()->getNumDepthValues())46 #define GetBitsPerDepthValue() (pcCU->getSlice()->getSPS()->getBitsPerDepthValue())47 #endif48 49 44 //! \ingroup TLibEncoder 50 45 //! \{ … … 72 67 #if H3D_IVRP 73 68 , m_cResPredFlagSCModel ( 1, 1, NUM_RES_PRED_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 69 #endif 70 #if QC_ARP_D0177 71 , m_cCUPUARPW ( 1, 1, NUM_ARPW_CTX , m_contextModels + m_numContextModels, m_numContextModels) 74 72 #endif 75 73 , m_cCUPartSizeSCModel ( 1, 1, NUM_PART_SIZE_CTX , m_contextModels + m_numContextModels, m_numContextModels) … … 96 94 , m_cALFSvlcSCModel ( 1, 1, NUM_ALF_SVLC_CTX , m_contextModels + m_numContextModels, m_numContextModels) 97 95 , m_cCUAMPSCModel ( 1, 1, NUM_CU_AMP_CTX , m_contextModels + m_numContextModels, m_numContextModels) 96 #if LGE_SAO_MIGRATION_D0091 97 , m_cSaoMergeSCModel ( 1, 1, NUM_SAO_MERGE_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 98 , m_cSaoTypeIdxSCModel ( 1, 1, NUM_SAO_TYPE_IDX_CTX , m_contextModels + m_numContextModels, m_numContextModels) 99 #else 98 100 , m_cSaoFlagSCModel ( 1, 1, NUM_SAO_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 99 101 , m_cSaoUvlcSCModel ( 1, 1, NUM_SAO_UVLC_CTX , m_contextModels + m_numContextModels, m_numContextModels) … … 102 104 , m_cSaoMergeUpSCModel ( 1, 1, NUM_SAO_MERGE_UP_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 103 105 , m_cSaoTypeIdxSCModel ( 1, 1, NUM_SAO_TYPE_IDX_CTX , m_contextModels + m_numContextModels, m_numContextModels) 106 #endif 104 107 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 108 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 105 109 , m_cDmmFlagSCModel ( 1, 1, NUM_DMM_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 106 110 , m_cDmmModeSCModel ( 1, 1, NUM_DMM_MODE_CTX , m_contextModels + m_numContextModels, m_numContextModels) 111 #endif 107 112 , m_cDmmDataSCModel ( 1, 1, NUM_DMM_DATA_CTX , m_contextModels + m_numContextModels, m_numContextModels) 108 113 #endif … … 114 119 #endif 115 120 #if RWTH_SDC_DLT_B0036 121 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 116 122 , m_cSDCFlagSCModel ( 1, 1, SDC_NUM_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 123 #else 124 , m_cDepthModeModel ( 1, 1, DEPTH_MODE_NUM_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 125 , m_cDmmDeltaFlagModel ( 1, 1, DMM_DELTA_NUM_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 126 #endif 127 #if RWTH_SDC_CTX_SIMPL_D0032 128 , m_cSDCResidualFlagSCModel ( 1, 1, SDC_NUM_RESIDUAL_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 129 , m_cSDCResidualSCModel ( 1, 1, SDC_NUM_RESIDUAL_CTX , m_contextModels + m_numContextModels, m_numContextModels) 130 , m_cSDCPredModeSCModel ( 1, 3, SDC_NUM_PRED_MODE_CTX , m_contextModels + m_numContextModels, m_numContextModels) 131 #else 117 132 , m_cSDCResidualFlagSCModel ( 1, 2, SDC_NUM_RESIDUAL_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 118 133 , m_cSDCResidualSignFlagSCModel ( 1, 2, SDC_NUM_SIGN_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 119 134 , m_cSDCResidualSCModel ( 1, 2, SDC_NUM_RESIDUAL_CTX , m_contextModels + m_numContextModels, m_numContextModels) 120 135 , m_cSDCPredModeSCModel ( 1, 3, SDC_NUM_PRED_MODE_CTX , m_contextModels + m_numContextModels, m_numContextModels) 136 #endif 121 137 #endif 122 138 { … … 157 173 #if H3D_IVRP 158 174 m_cResPredFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_RES_PRED_FLAG ); 175 #endif 176 #if QC_ARP_D0177 177 m_cCUPUARPW.initBuffer ( eSliceType, iQp, (UChar*)INIT_ARPW ); 159 178 #endif 160 179 m_cCUPartSizeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_PART_SIZE ); … … 180 199 m_cALFSvlcSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_ALF_SVLC ); 181 200 m_cCUTransSubdivFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_TRANS_SUBDIV_FLAG ); 201 #if LGE_SAO_MIGRATION_D0091 202 m_cSaoMergeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SAO_MERGE_FLAG ); 203 m_cSaoTypeIdxSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SAO_TYPE_IDX ); 204 #else 182 205 m_cSaoFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SAO_FLAG ); 183 206 m_cSaoUvlcSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SAO_UVLC ); … … 186 209 m_cSaoMergeUpSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SAO_MERGE_UP_FLAG ); 187 210 m_cSaoTypeIdxSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SAO_TYPE_IDX ); 211 #endif 188 212 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 213 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 189 214 m_cDmmFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DMM_FLAG ); 190 215 m_cDmmModeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DMM_MODE ); 216 #endif 191 217 m_cDmmDataSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DMM_DATA ); 192 218 #endif … … 198 224 #endif 199 225 #if RWTH_SDC_DLT_B0036 226 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 200 227 m_cSDCFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_FLAG ); 228 #else 229 m_cDepthModeModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DEPTHMODE_FLAG ); 230 m_cDmmDeltaFlagModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DMMDELTA_FLAG ); 231 #endif 201 232 m_cSDCResidualFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL_FLAG ); 202 233 m_cSDCResidualSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL ); 234 #if !RWTH_SDC_CTX_SIMPL_D0032 203 235 m_cSDCResidualSignFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_SIGN_FLAG ); 236 #endif 204 237 m_cSDCPredModeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_PRED_MODE ); 205 238 #endif … … 266 299 curCost += m_cALFSvlcSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_ALF_SVLC ); 267 300 curCost += m_cCUTransSubdivFlagSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_TRANS_SUBDIV_FLAG ); 301 #if LGE_SAO_MIGRATION_D0091 302 curCost += m_cSaoMergeSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_SAO_MERGE_FLAG ); 303 curCost += m_cSaoTypeIdxSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_SAO_TYPE_IDX ); 304 #else 268 305 curCost += m_cSaoFlagSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_SAO_FLAG ); 269 306 curCost += m_cSaoUvlcSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_SAO_UVLC ); … … 272 309 curCost += m_cSaoMergeUpSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_SAO_MERGE_UP_FLAG ); 273 310 curCost += m_cSaoTypeIdxSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_SAO_TYPE_IDX ); 311 #endif 274 312 275 313 if (curCost < bestCost) … … 310 348 #if H3D_IVRP 311 349 m_cResPredFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_RES_PRED_FLAG ); 350 #endif 351 #if QC_ARP_D0177 352 m_cCUPUARPW.initBuffer ( eSliceType, iQp, (UChar*)INIT_ARPW ); 312 353 #endif 313 354 m_cCUPartSizeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_PART_SIZE ); … … 333 374 m_cALFSvlcSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_ALF_SVLC ); 334 375 m_cCUTransSubdivFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_TRANS_SUBDIV_FLAG ); 376 #if LGE_SAO_MIGRATION_D0091 377 m_cSaoMergeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SAO_MERGE_FLAG ); 378 m_cSaoTypeIdxSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SAO_TYPE_IDX ); 379 #else 335 380 m_cSaoFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SAO_FLAG ); 336 381 m_cSaoUvlcSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SAO_UVLC ); … … 339 384 m_cSaoMergeUpSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SAO_MERGE_UP_FLAG ); 340 385 m_cSaoTypeIdxSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SAO_TYPE_IDX ); 386 #endif 341 387 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 388 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 342 389 m_cDmmFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DMM_FLAG ); 343 390 m_cDmmModeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DMM_MODE ); 391 #endif 344 392 m_cDmmDataSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DMM_DATA ); 345 393 #endif 346 394 #if RWTH_SDC_DLT_B0036 395 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 347 396 m_cSDCFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_FLAG ); 397 #else 398 m_cDepthModeModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DEPTHMODE_FLAG ); 399 m_cDmmDeltaFlagModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DMMDELTA_FLAG ); 400 #endif 348 401 m_cSDCResidualFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL_FLAG ); 349 402 m_cSDCResidualSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL ); 403 #if !RWTH_SDC_CTX_SIMPL_D0032 350 404 m_cSDCResidualSignFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_SIGN_FLAG ); 405 #endif 351 406 m_cSDCPredModeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_PRED_MODE ); 352 407 #endif … … 542 597 } 543 598 544 599 #if PKU_QC_DEPTH_INTRA_UNI_D0195 600 Void TEncSbac::loadDepthMode( TEncSbac* pSrc) 601 { 602 m_pcBinIf->copyState( pSrc->m_pcBinIf ); 603 604 this->m_cDepthModeModel .copyFrom( &pSrc->m_cDepthModeModel ); 605 this->m_cDmmDeltaFlagModel .copyFrom( &pSrc->m_cDmmDeltaFlagModel ); 606 } 607 #endif 545 608 Void TEncSbac::store( TEncSbac* pDest) 546 609 { … … 840 903 } 841 904 #endif 842 905 #if QC_ARP_D0177 906 Void TEncSbac::codeARPW( TComDataCU* pcCU, UInt uiAbsPartIdx ) 907 { 908 Int nW = pcCU->getARPW( uiAbsPartIdx ); 909 Int nMaxW = pcCU->getSlice()->getARPStepNum() - 1; 910 assert( 0 <= nW && nW <= nMaxW ); 911 assert(nMaxW > 0); 912 if( nMaxW > 0 ) 913 { 914 Int nOffset = pcCU->getCTXARPWFlag(uiAbsPartIdx); 915 assert( 0 <= nOffset && nOffset <= 2 ); 916 Int nBinNum = nW + ( nW != nMaxW ); 917 m_pcBinIf->encodeBin( nW != 0 , m_cCUPUARPW.get( 0, 0, 0 + nOffset ) ); 918 if( nBinNum > 1 ) 919 m_pcBinIf->encodeBin( nW == nMaxW , m_cCUPUARPW.get( 0, 0, 3 ) ); 920 } 921 } 922 #endif 843 923 Void TEncSbac::codeSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 844 924 { … … 966 1046 } 967 1047 #endif 968 969 Void TEncSbac::codeIntraDirLumaAng( TComDataCU* pcCU, UInt uiAbsPartIdx ) 1048 #if PKU_QC_DEPTH_INTRA_UNI_D0195 1049 Void TEncSbac::codeDepthIntraMode( TComDataCU* pcCU, UInt uiAbsPartIdx ) 1050 { 1051 UInt uiCodeWordTable[3][9] = {{0, 0, 0, 2, 0,6, 0, 0, 7},{0, 2, 3, 4, 5, 6, 14, 31, 30},{0, 2, 0, 0, 0, 0, 3, 0, 0}}; 1052 UInt uiCodeWordLenTable[3][9] = {{0, 1, 0, 2, 0,3, 0, 0, 3},{2, 3, 3, 3, 3, 3, 4, 5, 5},{1, 2, 0, 0, 0, 0, 2, 0, 0}}; 1053 UInt uiDir = pcCU->getLumaIntraDir(uiAbsPartIdx); 1054 Bool bSdcFlag = pcCU->getSDCFlag(uiAbsPartIdx); 1055 UInt uiPuIdx = ( pcCU->getWidth(uiAbsPartIdx) == 64 )? 2 : ( ( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_NxN && pcCU->getWidth(uiAbsPartIdx) == 8 ) ? 0 : 1 ); 1056 UInt uiCodeIdx = 0; 1057 if ( bSdcFlag ) 1058 { 1059 switch(uiDir) 1060 { 1061 case PLANAR_IDX: uiCodeIdx = 0; break; 1062 case DC_IDX: uiCodeIdx = 6; break; 1063 default: uiCodeIdx = 2; 1064 } 1065 } 1066 else if ( uiDir>=EDGE_INTRA_IDX ) 1067 { 1068 uiCodeIdx = 8; 1069 } 1070 else if ( uiDir<NUM_INTRA_MODE ) 1071 { 1072 uiCodeIdx = 1; 1073 } 1074 else 1075 { 1076 if (uiDir== DMM_WEDGE_FULL_IDX || uiDir==DMM_WEDGE_FULL_D_IDX ) {uiCodeIdx = 3;} 1077 if (uiDir== DMM_CONTOUR_PREDTEX_IDX|| uiDir==DMM_CONTOUR_PREDTEX_D_IDX) {uiCodeIdx = 4;} 1078 if (uiDir== DMM_WEDGE_PREDTEX_IDX || uiDir==DMM_WEDGE_PREDTEX_D_IDX ) {uiCodeIdx = 5;} 1079 if (uiDir== DMM_WEDGE_PREDDIR_IDX || uiDir==DMM_WEDGE_PREDDIR_D_IDX ) {uiCodeIdx = 7;} 1080 } 1081 //mode coding 1082 for (UInt i=0; i<uiCodeWordLenTable[uiPuIdx][uiCodeIdx]; i++) 1083 { 1084 UInt uiBit = uiCodeWordTable[uiPuIdx][uiCodeIdx] & ( 1<<(uiCodeWordLenTable[uiPuIdx][uiCodeIdx]-i-1) ); 1085 UInt uiCtxDepthMode = uiPuIdx*3 + ( i >= 2? 2 : i ); 1086 m_pcBinIf->encodeBin( uiBit!=0 , m_cDepthModeModel.get(0, 0, uiCtxDepthMode) ); 1087 } 1088 } 1089 Void TEncSbac::codeDepthModelingTable( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bSdcRD) 1090 { 1091 UInt uiDir = pcCU->getLumaIntraDir( uiAbsPartIdx ); 1092 Bool bSdcFlag = pcCU->getSDCFlag(uiAbsPartIdx); 1093 Bool bDmmFlag = (uiDir >= NUM_INTRA_MODE && uiDir < EDGE_INTRA_IDX &&(!bSdcFlag))? 1:0; 1094 1095 codeDepthIntraMode(pcCU,uiAbsPartIdx); 1096 1097 if (uiDir >= NUM_INTRA_MODE && uiDir < EDGE_INTRA_IDX )//DMM modes or SDC DMM1 1098 { 1099 assert(pcCU->getWidth(uiAbsPartIdx)<64); 1100 assert(pcCU->getWidth(uiAbsPartIdx)<64); 1101 if( uiDir == DMM_WEDGE_FULL_IDX || uiDir == DMM_WEDGE_FULL_D_IDX) { xCodeWedgeFullInfo ( pcCU, uiAbsPartIdx ); } 1102 else if( uiDir == DMM_WEDGE_PREDTEX_IDX || uiDir == DMM_WEDGE_PREDTEX_D_IDX ) { xCodeWedgePredTexInfo ( pcCU, uiAbsPartIdx ); } 1103 else if( uiDir == DMM_WEDGE_PREDDIR_IDX || uiDir == DMM_WEDGE_PREDDIR_D_IDX) { xCodeWedgePredDirInfo ( pcCU, uiAbsPartIdx ); } 1104 } 1105 else if(uiDir >= EDGE_INTRA_IDX)//CCM mode 1106 { 1107 assert(pcCU->getWidth(uiAbsPartIdx)<64); 1108 xCodeEdgeIntraInfo( pcCU, uiAbsPartIdx ); 1109 } 1110 1111 if (bDmmFlag) 1112 { 1113 m_pcBinIf->encodeBin( (uiDir&1) , m_cDmmDeltaFlagModel.get(0, 0, 0) ); 1114 if (uiDir&1) 1115 { 1116 Int iDeltaDC1 = 0,iDeltaDC2 = 0; 1117 if ( uiDir == DMM_WEDGE_FULL_D_IDX ) 1118 { 1119 iDeltaDC1 = pcCU->getWedgeFullDeltaDC1( uiAbsPartIdx ); 1120 iDeltaDC2 = pcCU->getWedgeFullDeltaDC2( uiAbsPartIdx ); 1121 } 1122 else if ( uiDir == DMM_WEDGE_PREDTEX_D_IDX ) 1123 { 1124 iDeltaDC1 = pcCU->getWedgePredTexDeltaDC1( uiAbsPartIdx ); 1125 iDeltaDC2 = pcCU->getWedgePredTexDeltaDC2( uiAbsPartIdx ); 1126 } 1127 else if ( uiDir == DMM_WEDGE_PREDDIR_D_IDX ) 1128 { 1129 iDeltaDC1 = pcCU->getWedgePredDirDeltaDC1( uiAbsPartIdx ); 1130 iDeltaDC2 = pcCU->getWedgePredDirDeltaDC2( uiAbsPartIdx ); 1131 } 1132 else if ( uiDir == DMM_CONTOUR_PREDTEX_D_IDX ) 1133 { 1134 iDeltaDC1 = pcCU->getContourPredTexDeltaDC1( uiAbsPartIdx ); 1135 iDeltaDC2 = pcCU->getContourPredTexDeltaDC2( uiAbsPartIdx ); 1136 1137 } 1138 1139 for ( Int i = 0; i < 2; i++ ) 1140 { 1141 Int iDeltaDC = (i==0)? iDeltaDC1 : iDeltaDC2; 1142 xWriteExGolombLevel( UInt( abs( iDeltaDC ) ), m_cDmmDataSCModel.get(0, 0, 1) ); 1143 if ( iDeltaDC != 0 ) 1144 { 1145 UInt uiSign = iDeltaDC > 0 ? 0 : 1; 1146 m_pcBinIf->encodeBinEP( uiSign ); 1147 } 1148 } 1149 } 1150 } 1151 else if (uiDir>=EDGE_INTRA_IDX) 1152 { 1153 m_pcBinIf->encodeBin( (uiDir == EDGE_INTRA_DELTA_IDX), m_cEdgeIntraDeltaDCSCModel.get(0, 0, 0) ); 1154 if( uiDir == EDGE_INTRA_DELTA_IDX ) 1155 { 1156 Int iDeltaDC0 = pcCU->getEdgeDeltaDC0( uiAbsPartIdx ); 1157 Int iDeltaDC1 = pcCU->getEdgeDeltaDC1( uiAbsPartIdx ); 1158 1159 for ( Int i = 0; i < 2; i++ ) 1160 { 1161 Int iDeltaDC = (i==0)? iDeltaDC0 : iDeltaDC1; 1162 xWriteExGolombLevel( UInt( abs( iDeltaDC ) ), m_cEdgeIntraDeltaDCSCModel.get(0, 0, 1) ); 1163 if ( iDeltaDC != 0 ) 1164 { 1165 UInt uiSign = iDeltaDC > 0 ? 0 : 1; 1166 m_pcBinIf->encodeBinEP( uiSign ); 1167 } 1168 } 1169 } 1170 } 1171 if (pcCU->getSDCFlag(uiAbsPartIdx))//SDC mode 1172 { 1173 assert(pcCU->getPartitionSize(uiAbsPartIdx)==SIZE_2Nx2N); 1174 UInt uiNumSegments = ( uiDir == DC_IDX || uiDir == PLANAR_IDX )? 1 : 2; 1175 if(!bSdcRD) 1176 { 1177 for (int uiSeg=0; uiSeg<uiNumSegments; uiSeg++) 1178 { 1179 codeSDCResidualData(pcCU, uiAbsPartIdx, uiSeg); 1180 } 1181 } 1182 } 1183 } 1184 #endif 1185 Void TEncSbac::codeIntraDirLumaAng( TComDataCU* pcCU, UInt uiAbsPartIdx 1186 #if PKU_QC_DEPTH_INTRA_UNI_D0195 1187 , Bool bSdcRD 1188 #endif 1189 ) 970 1190 { 971 1191 UInt uiDir = pcCU->getLumaIntraDir( uiAbsPartIdx ); 972 1192 1193 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 973 1194 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 974 1195 if( pcCU->getSlice()->getSPS()->getUseDMM() && pcCU->getWidth( uiAbsPartIdx ) <= DMM_WEDGEMODEL_MAX_SIZE ) … … 1070 1291 } 1071 1292 #endif 1072 1293 #else 1294 if (pcCU->getSlice()->getSPS()->isDepth()) 1295 { 1296 codeDepthModelingTable(pcCU, uiAbsPartIdx, bSdcRD); 1297 } 1298 if (pcCU->getLumaIntraDir(uiAbsPartIdx)<NUM_INTRA_MODE && !pcCU->getSDCFlag(uiAbsPartIdx)) 1299 { 1300 #endif 1073 1301 Int uiPreds[3] = {-1, -1, -1}; 1074 1302 Int uiPredNum = pcCU->getIntraDirLumaPredictor(uiAbsPartIdx, uiPreds); … … 1116 1344 1117 1345 m_pcBinIf->encodeBinsEP( uiDir, 5 ); 1346 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 1118 1347 #if LGE_EDGE_INTRA_A0070 1119 1348 if (bCodeEdgeIntra) 1120 1349 if (uiDir == 31) m_pcBinIf->encodeBinsEP(0,1); 1121 1350 #endif 1351 #endif 1122 1352 } 1353 #if PKU_QC_DEPTH_INTRA_UNI_D0195 1354 } 1355 #else 1123 1356 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 1124 1357 } 1125 1358 #endif 1359 #endif 1360 1126 1361 return; 1127 1362 } … … 1887 2122 } 1888 2123 } 1889 2124 #if LGE_SAO_MIGRATION_D0091 2125 Void TEncSbac::codeSAOSign( UInt code ) 2126 { 2127 m_pcBinIf->encodeBinEP( code ); 2128 } 2129 2130 Void TEncSbac::codeSaoMaxUvlc ( UInt code, UInt maxSymbol ) 2131 { 2132 if (maxSymbol == 0) 2133 { 2134 return; 2135 } 2136 2137 Int i; 2138 Bool bCodeLast = ( maxSymbol > code ); 2139 2140 if ( code == 0 ) 2141 { 2142 m_pcBinIf->encodeBinEP( 0 ); 2143 } 2144 else 2145 { 2146 m_pcBinIf->encodeBinEP( 1 ); 2147 for ( i=0; i<code-1; i++ ) 2148 { 2149 m_pcBinIf->encodeBinEP( 1 ); 2150 } 2151 if( bCodeLast ) 2152 { 2153 m_pcBinIf->encodeBinEP( 0 ); 2154 } 2155 } 2156 } 2157 2158 /** Code SAO EO class or BO band position 2159 * \param uiLength 2160 * \param uiCode 2161 */ 2162 Void TEncSbac::codeSaoUflc ( UInt uiLength, UInt uiCode ) 2163 { 2164 m_pcBinIf->encodeBinsEP ( uiCode, uiLength ); 2165 } 2166 /** Code SAO merge flags 2167 * \param uiCode 2168 * \param uiCompIdx 2169 */ 2170 Void TEncSbac::codeSaoMerge ( UInt uiCode ) 2171 { 2172 if (uiCode == 0) 2173 { 2174 m_pcBinIf->encodeBin(0, m_cSaoMergeSCModel.get( 0, 0, 0 )); 2175 } 2176 else 2177 { 2178 m_pcBinIf->encodeBin(1, m_cSaoMergeSCModel.get( 0, 0, 0 )); 2179 } 2180 } 2181 /** Code SAO type index 2182 * \param uiCode 2183 */ 2184 Void TEncSbac::codeSaoTypeIdx ( UInt uiCode) 2185 { 2186 if (uiCode == 0) 2187 { 2188 m_pcBinIf->encodeBin( 0, m_cSaoTypeIdxSCModel.get( 0, 0, 0 ) ); 2189 } 2190 else 2191 { 2192 m_pcBinIf->encodeBin( 1, m_cSaoTypeIdxSCModel.get( 0, 0, 0 ) ); 2193 m_pcBinIf->encodeBinEP( uiCode <= 4 ? 1 : 0 ); //determine edge or band 2194 } 2195 } 2196 #else 1890 2197 Void TEncSbac::codeSaoFlag ( UInt uiCode ) 1891 2198 { … … 2003 2310 } 2004 2311 } 2312 #endif 2005 2313 /*! 2006 2314 **************************************************************************** … … 2397 2705 2398 2706 #if RWTH_SDC_DLT_B0036 2707 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 2399 2708 Void TEncSbac::codeSDCPredMode( TComDataCU* pcCU, UInt uiAbsPartIdx ) 2400 2709 { … … 2411 2720 { 2412 2721 UInt uiBit = (uiPredMode == g_auiSDCPredModes[uiMPModeIdx]) ? 1 : 0; 2722 #if INTEL_SDC64_D0193 2723 if( !(pcCU->getWidth(uiAbsPartIdx) == 64 && i == 1)) 2724 #endif 2413 2725 m_pcBinIf->encodeBin( uiBit, m_cSDCPredModeSCModel.get( 0, i, uiCtx ) ); 2414 2726 … … 2437 2749 2438 2750 } 2751 #endif 2439 2752 2440 2753 Void TEncSbac::codeSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiSegment ) … … 2450 2763 UInt uiSign = segmentDCOffset < 0 ? 1 : 0; 2451 2764 UInt uiAbsIdx = abs(segmentDCOffset); 2765 #if !LGE_CONCATENATE_D0141 2452 2766 UInt uiBit = 0; 2453 2454 UInt uiMaxResidualBits = GetBitsPerDepthValue(); 2767 #endif 2768 2769 UInt uiMaxResidualBits = pcCU->getSlice()->getSPS()->getBitsPerDepthValue(); 2455 2770 assert( uiMaxResidualBits <= g_uiBitDepth ); 2456 2771 2457 2772 // residual flag 2773 #if RWTH_SDC_CTX_SIMPL_D0032 2774 m_pcBinIf->encodeBin( uiResidual, m_cSDCResidualFlagSCModel.get( 0, 0, 0 ) ); 2775 #else 2458 2776 m_pcBinIf->encodeBin( uiResidual, m_cSDCResidualFlagSCModel.get( 0, uiSegment, 0 ) ); //TODO depthmap: more sophisticated context selection 2777 #endif 2459 2778 2460 2779 if (uiResidual) 2461 2780 { 2462 2781 // encode sign bit of residual 2782 #if RWTH_SDC_CTX_SIMPL_D0032 2783 m_pcBinIf->encodeBinEP( uiSign ); 2784 #else 2463 2785 m_pcBinIf->encodeBin( uiSign, m_cSDCResidualSignFlagSCModel.get( 0, uiSegment, 0 ) ); //TODO depthmap: more sophisticated context selection 2786 #endif 2464 2787 2465 assert(uiAbsIdx < GetNumDepthValues()); 2788 UInt uiNumDepthValues = pcCU->getSlice()->getSPS()->getNumDepthValues(); 2789 assert(uiAbsIdx < uiNumDepthValues); 2466 2790 2467 2791 // encode residual magnitude 2468 2792 uiAbsIdx -= 1; 2793 #if LGE_CONCATENATE_D0141 2794 //prefix part 2795 if ( uiAbsIdx == 0 ) 2796 m_pcBinIf->encodeBin( 0, m_cSDCResidualSCModel.get(0, 0, 0) ); 2797 else 2798 { 2799 UInt l = uiAbsIdx; 2800 UInt k = 0; 2801 UInt uiPrefixThreshold = ((uiNumDepthValues * 3) >> 2); 2802 while ( l > 0 && k < uiPrefixThreshold ) 2803 { 2804 m_pcBinIf->encodeBin( 1, m_cSDCResidualSCModel.get(0, 0, 0) ); 2805 l--; 2806 k++; 2807 } 2808 if ( uiAbsIdx < uiPrefixThreshold ) 2809 m_pcBinIf->encodeBin( 0, m_cSDCResidualSCModel.get(0, 0, 0) ); 2810 //suffix part 2811 else 2812 { 2813 uiAbsIdx -= uiPrefixThreshold; 2814 UInt uiSuffixLength = ( (UInt)ceil( Log2(uiNumDepthValues - uiPrefixThreshold) ) ); 2815 UInt uiBitInfo = 0; 2816 for ( Int i = 0; i < uiSuffixLength; i++) 2817 { 2818 uiBitInfo = ( uiAbsIdx & ( 1 << i ) ) >> i; 2819 m_pcBinIf->encodeBinEP( uiBitInfo); 2820 } 2821 } 2822 } 2823 #else 2469 2824 for (Int i=0; i<uiMaxResidualBits; i++) 2470 2825 { 2471 2826 uiBit = (uiAbsIdx & (1<<i))>>i; 2472 2827 2828 #if RWTH_SDC_CTX_SIMPL_D0032 2829 m_pcBinIf->encodeBin( uiBit, m_cSDCResidualSCModel.get( 0, 0, i ) ); 2830 #else 2473 2831 m_pcBinIf->encodeBin( uiBit, m_cSDCResidualSCModel.get( 0, uiSegment, i ) ); //TODO depthmap: more sophisticated context selection 2474 } 2832 #endif 2833 } 2834 #endif 2475 2835 2476 2836 } -
trunk/source/Lib/TLibEncoder/TEncSbac.h
r332 r443 92 92 Void load ( TEncSbac* pScr ); 93 93 Void loadIntraDirModeLuma ( TEncSbac* pScr ); 94 #if PKU_QC_DEPTH_INTRA_UNI_D0195 95 Void loadDepthMode ( TEncSbac* pSrc ); 96 #endif 94 97 Void store ( TEncSbac* pDest ); 95 98 Void loadContexts ( TEncSbac* pScr ); … … 126 129 Void codeAlfCtrlFlag ( UInt uiSymbol ); 127 130 Void codeApsExtensionFlag () { assert (0); return; }; 131 #if LGE_SAO_MIGRATION_D0091 132 Void codeSaoMaxUvlc ( UInt code, UInt maxSymbol ); 133 Void codeSaoMerge ( UInt uiCode ); 134 Void codeSaoTypeIdx ( UInt uiCode); 135 Void codeSaoUflc ( UInt uiLength, UInt uiCode ); 136 Void codeSAOSign ( UInt uiCode); //<! code SAO offset sign 137 #else 128 138 Void codeSaoFlag ( UInt uiCode ); 129 139 Void codeSaoUvlc ( UInt uiCode ); … … 134 144 Void codeSaoTypeIdx ( UInt uiCode); 135 145 Void codeSaoUflc ( UInt uiCode); 146 #endif 136 147 Void codeScalingList ( TComScalingList* scalingList ){ assert (0); return;}; 137 148 138 149 #if RWTH_SDC_DLT_B0036 150 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 139 151 Void codeSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 152 #endif 140 153 Void codeSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiSegment ); 154 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 141 155 Void codeSDCPredMode ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 156 #endif 142 157 #endif 143 158 … … 209 224 Void codeResPredFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 210 225 #endif 226 #if QC_ARP_D0177 227 virtual Void codeARPW ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 228 #endif 211 229 Void codeSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 212 230 #if H3D_IVMP … … 222 240 Void codeQtCbf ( TComDataCU* pcCU, UInt uiAbsPartIdx, TextType eType, UInt uiTrDepth ); 223 241 Void codeQtRootCbf ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 224 225 Void codeIntraDirLumaAng ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 242 #if PKU_QC_DEPTH_INTRA_UNI_D0195 243 Void codeDepthIntraMode ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 244 Void codeDepthModelingTable ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bSdcRD = false ); 245 #endif 246 Void codeIntraDirLumaAng ( TComDataCU* pcCU, UInt uiAbsPartIdx 247 #if PKU_QC_DEPTH_INTRA_UNI_D0195 248 , Bool bSdcRD = false 249 #endif 250 ); 226 251 227 252 Void codeIntraDirChroma ( TComDataCU* pcCU, UInt uiAbsPartIdx ); … … 265 290 #if H3D_IVRP 266 291 ContextModel3DBuffer m_cResPredFlagSCModel; 292 #endif 293 #if QC_ARP_D0177 294 ContextModel3DBuffer m_cCUPUARPW; 267 295 #endif 268 296 ContextModel3DBuffer m_cCUPartSizeSCModel; … … 292 320 ContextModel3DBuffer m_cALFSvlcSCModel; 293 321 ContextModel3DBuffer m_cCUAMPSCModel; 322 #if LGE_SAO_MIGRATION_D0091 323 ContextModel3DBuffer m_cSaoMergeSCModel; 324 ContextModel3DBuffer m_cSaoTypeIdxSCModel; 325 #else 294 326 ContextModel3DBuffer m_cSaoFlagSCModel; 295 327 ContextModel3DBuffer m_cSaoUvlcSCModel; … … 298 330 ContextModel3DBuffer m_cSaoMergeUpSCModel; 299 331 ContextModel3DBuffer m_cSaoTypeIdxSCModel; 332 #endif 300 333 301 334 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 335 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 302 336 ContextModel3DBuffer m_cDmmFlagSCModel; 303 337 ContextModel3DBuffer m_cDmmModeSCModel; 338 #endif 304 339 ContextModel3DBuffer m_cDmmDataSCModel; 305 340 #endif … … 312 347 313 348 #if RWTH_SDC_DLT_B0036 349 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 314 350 ContextModel3DBuffer m_cSDCFlagSCModel; 351 #else 352 ContextModel3DBuffer m_cDepthModeModel; 353 ContextModel3DBuffer m_cDmmDeltaFlagModel; 354 #endif 315 355 316 356 ContextModel3DBuffer m_cSDCResidualFlagSCModel; 357 #if !RWTH_SDC_CTX_SIMPL_D0032 317 358 ContextModel3DBuffer m_cSDCResidualSignFlagSCModel; 359 #endif 318 360 ContextModel3DBuffer m_cSDCResidualSCModel; 319 361 -
trunk/source/Lib/TLibEncoder/TEncSearch.cpp
r332 r443 206 206 207 207 #if H3D_IVMP 208 #if SEC_TWO_CANDIDATES_FOR_AMVP_D0122 209 const Int iNumAMVPCands = AMVP_MAX_NUM_CANDS; 210 #else 208 211 const Int iNumAMVPCands = AMVP_MAX_NUM_CANDS + 1; 212 #endif 209 213 for( Int iNum = 0; iNum < iNumAMVPCands+1; iNum++) 210 214 for( Int iIdx = 0; iIdx < iNumAMVPCands; iIdx++) … … 908 912 if( uiAbsPartIdx == 0 ) 909 913 { 910 m_pcEntropyCoder->encodeIntraDirModeLuma ( pcCU, 0 ); 914 m_pcEntropyCoder->encodeIntraDirModeLuma ( pcCU, 0 915 #if PKU_QC_DEPTH_INTRA_UNI_D0195 916 ,true 917 #endif 918 ); 911 919 } 912 920 } … … 1701 1709 UChar ucSegment = pMask?(UChar)pMask[uiX]:0; 1702 1710 assert( ucSegment < uiNumSegments ); 1711 #if MTK_SAMPLE_BASED_SDC_D0110 1712 Pel pResiDC = apDCResiValues[ucSegment]; 1703 1713 1714 pReco [ uiX ] = Clip( pPred[ uiX ] + pResiDC ); 1715 #else 1704 1716 Pel pPredVal= apDCPredValues[ucSegment]; 1705 1717 Pel pResiDC = apDCResiValues[ucSegment]; 1706 1718 1707 1719 pReco [ uiX ] = Clip( pPredVal + pResiDC ); 1720 #endif 1708 1721 pRecIPred[ uiX ] = pReco[ uiX ]; 1709 1722 } … … 1735 1748 if ( m_pcRdCost->getUseVSO() ) 1736 1749 { 1750 #if FIX_SDC_ENC_RD_WVSO_D0163 && LGE_WVSO_A0119 1751 if ( m_pcRdCost->getUseWVSO() ) 1752 { 1753 Int iDWeight = m_pcRdCost->getDWeight() * m_pcRdCost->getDWeight(); 1754 Int iVSOWeight = m_pcRdCost->getVSOWeight() * m_pcRdCost->getVSOWeight(); 1755 Dist iD = (Dist) m_pcRdCost->getDistPart( piReco, uiStride, piOrg, uiStride, uiWidth, uiHeight ); 1756 Dist iVSO = m_pcRdCost->getDistVS ( pcCU, uiAbsPartIdx, piReco, uiStride, piOrg, uiStride, uiWidth, uiHeight, false, 0 ); 1757 ruiDist += (iDWeight * iD + iVSOWeight * iVSO) / ( iDWeight + iVSOWeight); 1758 } 1759 else 1760 #endif 1737 1761 ruiDist = m_pcRdCost->getDistVS ( pcCU, uiAbsPartIdx, piReco, uiStride, piOrg, uiStride, uiWidth, uiHeight, false, 0 ); 1738 1762 } … … 1751 1775 1752 1776 // encode pred direction + residual data 1753 m_pcEntropyCoder->encodePredInfo( pcCU, 0, true ); 1754 1777 m_pcEntropyCoder->encodePredInfo( pcCU, 0, true 1778 #if PKU_QC_DEPTH_INTRA_UNI_D0195 1779 ,true 1780 #endif 1781 ); 1755 1782 UInt uiBits = m_pcEntropyCoder->getNumberOfWrittenBits(); 1756 1783 … … 2921 2948 , Int* iVSPIndexTrue 2922 2949 #endif 2950 #if MERL_VSP_NBDV_RefVId_Fix_D0166 2951 , Int* iVSPDirTrue 2952 #endif 2923 2953 ) 2924 2954 { … … 2962 2992 } 2963 2993 #else 2994 2964 2995 #if MERL_VSP_C0152 2965 pcCU->getInterMergeCandidates( uiAbsPartIdx, iPUIdx, uiDepth, cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand, iVSPIndexTrue ); 2966 #else 2967 pcCU->getInterMergeCandidates( uiAbsPartIdx, iPUIdx, uiDepth, cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand ); 2968 #endif 2969 #endif 2970 2996 pcCU->getInterMergeCandidates( uiAbsPartIdx, iPUIdx, uiDepth, cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand, iVSPIndexTrue 2997 #if MERL_VSP_NBDV_RefVId_Fix_D0166 2998 , iVSPDirTrue 2999 #endif 3000 ); 3001 3002 #else 3003 pcCU->getInterMergeCandidates( uiAbsPartIdx, iPUIdx, uiDepth, cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand 3004 #if MERL_VSP_NBDV_RefVId_Fix_D0166 3005 , iVSPDirTrue 3006 #endif 3007 ); 3008 #endif 3009 3010 #endif 2971 3011 2972 3012 #if H3D_IVMP … … 2985 3025 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], ePartSize, uiAbsPartIdx, 0, iPUIdx ); 2986 3026 #if MERL_VSP_C0152 3027 #if MTK_D0156 3028 if( !pcCU->getSlice()->getSPS()->getUseVSPCompensation() ) 3029 { 3030 pcCU->setVSPIndexSubParts( 0, uiAbsPartIdx, iPUIdx, pcCU->getDepth( uiAbsPartIdx ) ); 3031 } 3032 else 3033 #endif 2987 3034 { 2988 3035 Int iVSPIdx = 0; 3036 #if LGE_VSP_INHERIT_D0092 3037 if (iVSPIndexTrue[uiMergeCand] == 1) 3038 { 3039 iVSPIdx = 1; 3040 } 3041 #else 2989 3042 Int numVSPIdx; 2990 3043 numVSPIdx = 3; … … 2997 3050 } 2998 3051 } 3052 #endif 2999 3053 pcCU->setVSPIndexSubParts( iVSPIdx, uiAbsPartIdx, iPUIdx, pcCU->getDepth( uiAbsPartIdx ) ); 3054 #if MERL_VSP_NBDV_RefVId_Fix_D0166 3055 pcCU->setVSPDirSubParts(0, uiAbsPartIdx, iPUIdx, pcCU->getDepth( uiAbsPartIdx ) ); 3056 #endif 3057 #if QC_BVSP_CleanUP_D0191 && !LGE_VSP_INHERIT_D0092 3058 if(iVSPIdx != 0) 3059 { 3060 Int iIVCIdx = pcCU->getSlice()->getRefPic(REF_PIC_LIST_0, 0)->getPOC()==pcCU->getSlice()->getPOC() ? 0: pcCU->getSlice()->getNewRefIdx(REF_PIC_LIST_0); 3061 cMvFieldNeighbours[ 2*uiMergeIndex].setRefIdx(iIVCIdx); 3062 } 3063 #endif 3000 3064 } 3001 3065 #endif … … 3109 3173 3110 3174 #if H3D_IVMP 3175 #if SEC_TWO_CANDIDATES_FOR_AMVP_D0122 3176 Int iNumAMVPCands = AMVP_MAX_NUM_CANDS; 3177 #else 3111 3178 Int iNumAMVPCands = AMVP_MAX_NUM_CANDS + ( pcCU->getSlice()->getSPS()->getMultiviewMvPredMode() ? 1 : 0 ); 3179 #endif 3112 3180 #endif 3113 3181 … … 3138 3206 //reset the VSP flag to be 0 3139 3207 pcCU->setVSPIndexSubParts( 0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr) ); 3208 #endif 3209 #if MERL_VSP_NBDV_RefVId_Fix_D0166 3210 pcCU->setVSPDirSubParts( 0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr) ); 3140 3211 #endif 3141 3212 #if AMP_MRG … … 3377 3448 iNumIter = 1; 3378 3449 } 3379 3450 3380 3451 for ( Int iIter = 0; iIter < iNumIter; iIter++ ) 3381 3452 { … … 3657 3728 UInt uiMRGIndex = 0; 3658 3729 #if MERL_VSP_C0152 3730 #if LGE_VSP_INHERIT_D0092 3731 Int iVSPIndexTrue[MRG_MAX_NUM_CANDS_MEM]; 3732 for (Int i=0; i<MRG_MAX_NUM_CANDS_MEM; i++) 3733 { 3734 iVSPIndexTrue[i] = 0; 3735 } 3736 #else 3659 3737 Int iVSPIndexTrue[3] = {-1, -1, -1}; 3738 #endif 3739 #if MERL_VSP_NBDV_RefVId_Fix_D0166 3740 Int iVSPDirTrue[3] = {-1, -1, -1}; 3741 #endif 3660 3742 #endif 3661 3743 UInt uiMEInterDir = 0; … … 3688 3770 3689 3771 3690 xMergeEstimation( pcCU, pcOrgYuv, iPartIdx, uiMRGInterDir, cMRGMvField, uiMRGIndex, uiMRGCost3772 xMergeEstimation( pcCU, pcOrgYuv, iPartIdx, uiMRGInterDir, cMRGMvField, uiMRGIndex, uiMRGCost 3691 3773 #if CU_BASED_MRG_CAND_LIST 3692 3774 , cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, … … 3694 3776 #if MERL_VSP_C0152 3695 3777 , iVSPIndexTrue 3778 #endif 3779 #if MERL_VSP_NBDV_RefVId_Fix_D0166 3780 , iVSPDirTrue 3696 3781 #endif 3697 3782 ); … … 3703 3788 pcCU->setMergeIndexSubParts( uiMRGIndex, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 3704 3789 #if MERL_VSP_C0152 3790 3791 #if MTK_D0156 3792 if( !pcCU->getSlice()->getSPS()->getUseVSPCompensation() ) 3793 { 3794 pcCU->setVSPIndexSubParts( 0, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 3795 } 3796 else 3797 #endif 3705 3798 { 3706 3799 Int iVSPIdx = 0; 3800 #if LGE_VSP_INHERIT_D0092 3801 if (iVSPIndexTrue[uiMRGIndex] == 1) 3802 { 3803 iVSPIdx = 1; 3804 } 3805 #else 3707 3806 Int numVSPIdx; 3708 3807 numVSPIdx = 3; … … 3715 3814 } 3716 3815 } 3816 #endif 3717 3817 pcCU->setVSPIndexSubParts( iVSPIdx, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 3818 #if MERL_VSP_NBDV_RefVId_Fix_D0166 3819 pcCU->setVSPDirSubParts( 0, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 3820 #endif 3821 #if QC_BVSP_CleanUP_D0191 && !LGE_VSP_INHERIT_D0092 3822 if(iVSPIdx != 0) 3823 { 3824 Int iIVCIdx = pcCU->getSlice()->getRefPic(REF_PIC_LIST_0, 0)->getPOC()==pcCU->getSlice()->getPOC() ? 0: pcCU->getSlice()->getNewRefIdx(REF_PIC_LIST_0); 3825 cMRGMvField[ 0].setRefIdx(iIVCIdx); 3826 } 3827 #endif 3718 3828 } 3719 3829 #endif … … 3738 3848 pcCU->setInterDirSubParts ( uiMEInterDir, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 3739 3849 #if MERL_VSP_C0152 3740 pcCU->setVSPIndexSubParts ( 0 , uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 3850 pcCU->setVSPIndexSubParts ( 0, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 3851 #endif 3852 #if MERL_VSP_NBDV_RefVId_Fix_D0166 3853 pcCU->setVSPDirSubParts ( 0, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 3741 3854 #endif 3742 3855 { … … 3799 3912 { 3800 3913 #if H3D_IVMP 3914 #if SEC_TWO_CANDIDATES_FOR_AMVP_D0122 3915 Int iNumAMVPCands = AMVP_MAX_NUM_CANDS; 3916 #else 3801 3917 Int iNumAMVPCands = AMVP_MAX_NUM_CANDS + ( pcCU->getSlice()->getSPS()->getMultiviewMvPredMode() ? 1 : 0 ); 3918 #endif 3802 3919 #if ZERO_MVD_EST 3803 3920 (*puiDistBiP) = xGetTemplateCost( pcCU, uiPartIdx, uiPartAddr, pcOrgYuv, &m_cYuvPredTemp, rcMvPred, 0, iNumAMVPCands, eRefPicList, iRefIdx, iRoiWidth, iRoiHeight, uiDist ); … … 3834 3951 UInt uiTmpCost; 3835 3952 #if H3D_IVMP 3953 #if SEC_TWO_CANDIDATES_FOR_AMVP_D0122 3954 Int iNumAMVPCands = AMVP_MAX_NUM_CANDS; 3955 #else 3836 3956 Int iNumAMVPCands = AMVP_MAX_NUM_CANDS + ( pcCU->getSlice()->getSPS()->getMultiviewMvPredMode() ? 1 : 0 ); 3957 #endif 3837 3958 #if ZERO_MVD_EST 3838 3959 uiTmpCost = xGetTemplateCost( pcCU, uiPartIdx, uiPartAddr, pcOrgYuv, &m_cYuvPredTemp, pcAMVPInfo->m_acMvCand[i], i, iNumAMVPCands, eRefPicList, iRefIdx, iRoiWidth, iRoiHeight, uiDist ); … … 3967 4088 3968 4089 #if H3D_IVMP 4090 #if SEC_TWO_CANDIDATES_FOR_AMVP_D0122 4091 Int iNumAMVPCands = AMVP_MAX_NUM_CANDS; 4092 #else 3969 4093 Int iNumAMVPCands = AMVP_MAX_NUM_CANDS + ( pcCU->getSlice()->getSPS()->getMultiviewMvPredMode() ? 1 : 0 ); 4094 #endif 3970 4095 #endif 3971 4096 … … 4674 4799 #endif 4675 4800 ); 4801 #if QC_ARP_D0177 4802 m_pcEntropyCoder->encodeARPW ( pcCU , 0 , true ); 4803 #endif 4676 4804 #endif 4677 4805 #if HHI_MPI … … 5892 6020 // Reload only contexts required for coding intra mode information 5893 6021 m_pcRDGoOnSbacCoder->loadIntraDirModeLuma( m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST] ); 6022 #if PKU_QC_DEPTH_INTRA_UNI_D0195 6023 m_pcRDGoOnSbacCoder->loadDepthMode( m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST] ); 6024 #endif 5894 6025 } 5895 6026 … … 5897 6028 5898 6029 m_pcEntropyCoder->resetBits(); 5899 m_pcEntropyCoder->encodeIntraDirModeLuma ( pcCU, uiPartOffset); 6030 m_pcEntropyCoder->encodeIntraDirModeLuma ( pcCU, uiPartOffset 6031 #if PKU_QC_DEPTH_INTRA_UNI_D0195 6032 ,true 6033 #endif 6034 ); 5900 6035 5901 6036 return m_pcEntropyCoder->getNumberOfWrittenBits(); … … 5954 6089 ); 5955 6090 #endif 6091 #if QC_ARP_D0177 6092 m_pcEntropyCoder->encodeARPW( pcCU , 0 , true ); 6093 #endif 5956 6094 ruiBits += m_pcEntropyCoder->getNumberOfWrittenBits(); 5957 6095 } … … 5977 6115 #endif 5978 6116 ); 6117 #if QC_ARP_D0177 6118 m_pcEntropyCoder->encodeARPW( pcCU , 0 , true ); 6119 #endif 5979 6120 #endif 5980 6121 #if HHI_MPI … … 6301 6442 Int iMaskStride = ( uiWidth<<1 ) + 1; 6302 6443 piMask += iMaskStride+1; 6444 #if QC_DC_PREDICTOR_D0183 6445 getPredDCs( pcWedgelet->getPattern(), pcWedgelet->getStride(), piMask, iMaskStride, iPredDC1, iPredDC2 ); 6446 #else 6303 6447 getWedgePredDCs( pcWedgelet, piMask, iMaskStride, iPredDC1, iPredDC2, bAboveAvail, bLeftAvail ); 6448 #endif 6304 6449 6305 6450 riDeltaDC1 = iDC1 - iPredDC1; … … 6478 6623 #endif 6479 6624 6625 #if HHI_DELTADC_DLT_D0035 6626 riDeltaDC1 = (Int)GetDepthValue2Idx( Clip(iPredDC1 + riDeltaDC1) ) - (Int)GetDepthValue2Idx( iPredDC1 ); 6627 riDeltaDC2 = (Int)GetDepthValue2Idx( Clip(iPredDC2 + riDeltaDC2) ) - (Int)GetDepthValue2Idx( iPredDC2 ); 6628 #endif 6480 6629 } 6481 6630 #endif … … 7862 8011 7863 8012 // PredDC Calculation 8013 #if QC_DC_PREDICTOR_D0183 8014 getPredDCs( pbRegion, uiWidth, piMask+iMaskStride+1, iMaskStride, iPredDC0, iPredDC1 ); 8015 #else 7864 8016 { 7865 8017 UInt uiSum0 = 0; … … 7901 8053 iPredDC1 = uiSum1 / uiCount1; 7902 8054 } 8055 #endif 7903 8056 7904 8057 iDeltaDC0 = iDC0 - iPredDC0; -
trunk/source/Lib/TLibEncoder/TEncSearch.h
r332 r443 511 511 , Int* iVSPIndexTrue 512 512 #endif 513 #if MERL_VSP_NBDV_RefVId_Fix_D0166 514 , Int* iVSPDirTrue 515 #endif 513 516 ); 514 517 // ------------------------------------------------------------------------------------------------------------------- -
trunk/source/Lib/TLibEncoder/TEncSlice.cpp
r332 r443 60 60 m_pcBufferLowLatSbacCoders = NULL; 61 61 m_pcBufferLowLatBinCoderCABACs = NULL; 62 #if MERL_VSP_NBDV_RefVId_Fix_D0166 63 for(Int iNumCount = 0; iNumCount < MAX_VIEW_NUM; iNumCount++) 64 m_pcListDepthPic[iNumCount] = NULL; 65 #endif 62 66 #if FCO_DVP_REFINE_C0132_C0170 63 67 m_pPicBaseTxt = NULL; … … 148 152 m_pdRdPicQp = (Double*)xMalloc( Double, m_pcCfg->getDeltaQpRD() * 2 + 1 ); 149 153 m_piRdPicQp = (Int* )xMalloc( Int, m_pcCfg->getDeltaQpRD() * 2 + 1 ); 154 155 #if MERL_VSP_NBDV_RefVId_Fix_D0166 156 for(Int iNumCount = 0; iNumCount < MAX_VIEW_NUM; iNumCount++) 157 m_pcListDepthPic[iNumCount] = NULL; 158 #endif 150 159 } 151 160 … … 778 787 { 779 788 pcSlice ->xSetApplyIC(); 789 #if SHARP_ILLUCOMP_PARSE_D0060 790 if (pcSlice->getApplyIC()) 791 { 792 pcSlice->setIcSkipParseFlag(rpcPic->getCurrSlice()->getPOC() % m_pcCfg->getIntraPeriod() != 0); 793 } 794 #endif 780 795 } 781 796 #endif … … 819 834 #if MERL_VSP_C0152 820 835 // Send Depth/Texture pointers to slice level 836 #if !MERL_VSP_NBDV_RefVId_Fix_D0166 821 837 pcSlice->setBWVSPLUTParam(m_aiShiftLUT, m_iShiftPrec); 838 #endif 822 839 pcSlice->setRefPicBaseTxt(m_pPicBaseTxt); 823 840 pcSlice->setRefPicBaseDepth(m_pPicBaseDepth); 841 #if MERL_VSP_NBDV_RefVId_Fix_D0166 842 for (Int refViewId=0; refViewId < pcSlice->getViewId(); refViewId++) 843 { 844 assert( m_pcListDepthPic[refViewId] ); 845 pcSlice->setListDepthPic(m_pcListDepthPic[refViewId], refViewId); 846 pcSlice->setBWVSPLUTParam(m_aiShiftLUT[refViewId], m_iShiftPrec, refViewId); 847 } 848 #endif 824 849 #endif 825 850 … … 1199 1224 TComDataCU*& pcCU = rpcPic->getCU( uiCUAddr ); 1200 1225 1226 #if LGE_SAO_MIGRATION_D0091 1227 if ( pcSlice->getSPS()->getUseSAO() && (pcSlice->getSaoEnabledFlag()||pcSlice->getSaoEnabledFlagChroma()) ) 1228 { 1229 SAOParam *saoParam = pcSlice->getAPS()->getSaoParam(); 1230 Int iNumCuInWidth = saoParam->numCuInWidth; 1231 Int iCUAddrInSlice = uiCUAddr - rpcPic->getPicSym()->getCUOrderMap(pcSlice->getSliceCurStartCUAddr()/rpcPic->getNumPartInCU()); 1232 Int iCUAddrUpInSlice = iCUAddrInSlice - iNumCuInWidth; 1233 Int rx = uiCUAddr % iNumCuInWidth; 1234 Int ry = uiCUAddr / iNumCuInWidth; 1235 Int allowMergeLeft = 1; 1236 Int allowMergeUp = 1; 1237 1238 if (rx!=0) 1239 { 1240 if (rpcPic->getPicSym()->getTileIdxMap(uiCUAddr-1) != rpcPic->getPicSym()->getTileIdxMap(uiCUAddr)) 1241 { 1242 allowMergeLeft = 0; 1243 } 1244 } 1245 if (ry!=0) 1246 { 1247 if (rpcPic->getPicSym()->getTileIdxMap(uiCUAddr-iNumCuInWidth) != rpcPic->getPicSym()->getTileIdxMap(uiCUAddr)) 1248 { 1249 allowMergeUp = 0; 1250 } 1251 } 1252 1253 Int addr = pcCU->getAddr(); 1254 allowMergeLeft = allowMergeLeft && (rx>0) && (iCUAddrInSlice!=0); 1255 allowMergeUp = allowMergeUp && (ry>0) && (iCUAddrUpInSlice>=0); 1256 1257 if( saoParam->bSaoFlag[0] || saoParam->bSaoFlag[1] ) 1258 { 1259 Int mergeLeft = saoParam->saoLcuParam[0][addr].mergeLeftFlag; 1260 Int mergeUp = saoParam->saoLcuParam[0][addr].mergeUpFlag; 1261 1262 if (allowMergeLeft) 1263 { 1264 m_pcEntropyCoder->m_pcEntropyCoderIf->codeSaoMerge(mergeLeft); 1265 } 1266 else 1267 { 1268 mergeLeft = 0; 1269 } 1270 if(mergeLeft == 0) 1271 { 1272 if (allowMergeUp) 1273 { 1274 m_pcEntropyCoder->m_pcEntropyCoderIf->codeSaoMerge(mergeUp); 1275 } 1276 else 1277 { 1278 mergeUp = 0; 1279 } 1280 if(mergeUp == 0) 1281 { 1282 for (Int compIdx=0;compIdx<3;compIdx++) 1283 { 1284 if( (compIdx == 0 && saoParam->bSaoFlag[0]) || (compIdx > 0 && saoParam->bSaoFlag[1])) 1285 { 1286 m_pcEntropyCoder->encodeSaoOffset(&saoParam->saoLcuParam[compIdx][addr], compIdx); 1287 } 1288 } 1289 } 1290 } 1291 } 1292 } 1293 #else 1201 1294 if ( pcSlice->getSPS()->getUseSAO() && pcSlice->getAPS()->getSaoInterleavingFlag() && pcSlice->getSaoEnabledFlag() ) 1202 1295 { … … 1208 1301 m_pcEntropyCoder->encodeSaoUnitInterleaving( rx, ry, pcSlice->getAPS()->getSaoParam(),pcCU, iCUAddrInSlice, iCUAddrUpInSlice, pcSlice->getSPS()->getLFCrossSliceBoundaryFlag()); 1209 1302 } 1303 #endif 1210 1304 #if ENC_DEC_TRACE 1211 1305 g_bJustDoIt = g_bEncDecTraceEnable; -
trunk/source/Lib/TLibEncoder/TEncSlice.h
r296 r443 106 106 TComPic* m_pPicBaseTxt; 107 107 TComPic* m_pPicBaseDepth; 108 #if MERL_VSP_NBDV_RefVId_Fix_D0166 109 Int* m_aiShiftLUT[2]; ///< For reference views from LIST0 and LIST1 110 #else 108 111 Int* m_aiShiftLUT; 112 #endif 109 113 Int m_iShiftPrec; 110 114 #endif 111 115 #if MERL_VSP_NBDV_RefVId_Fix_D0166 116 TComList<TComPic*>* m_pcListDepthPic[MAX_VIEW_NUM]; ///< For three views in total, indexed as viewId = 0, 1, 2 117 #endif 112 118 public: 113 119 TEncSlice(); … … 143 149 144 150 #if MERL_VSP_C0152 145 Void setBWVSPLUTParam ( Int *pShiftLUT, Int iLoG2LUTPrec ) { m_aiShiftLUT = pShiftLUT; m_iShiftPrec = 2-iLoG2LUTPrec; } 151 #if MERL_VSP_NBDV_RefVId_Fix_D0166 152 Void setBWVSPLUTParam ( Int *pShiftLUT, Int iLoG2LUTPrec, Int iNeighborViewId ) { m_aiShiftLUT[iNeighborViewId] = pShiftLUT; m_iShiftPrec = 2-iLoG2LUTPrec; } 153 #else 154 Void setBWVSPLUTParam ( Int *pShiftLUT, Int iLoG2LUTPrec ) { m_aiShiftLUT = pShiftLUT; m_iShiftPrec = 2-iLoG2LUTPrec; } 155 #endif 146 156 Void setRefPicBaseTxt ( TComPic*pPicTxt ) { m_pPicBaseTxt = pPicTxt; } 147 157 Void setRefPicBaseDepth ( TComPic*pPicDepth ) { m_pPicBaseDepth = pPicDepth;} 158 #if MERL_VSP_NBDV_RefVId_Fix_D0166 159 Void getBWVSPLUTParam ( Int*& pShiftLUT, Int& iShiftPrec, Int iNeighborViewId ) { pShiftLUT = m_aiShiftLUT[iNeighborViewId]; iShiftPrec = m_iShiftPrec; } 160 #else 148 161 Void getBWVSPLUTParam ( Int*& pShiftLUT, Int& iShiftPrec ) { pShiftLUT = m_aiShiftLUT; iShiftPrec = m_iShiftPrec; } 162 #endif 149 163 TComPic* getRefPicBaseTxt () { return m_pPicBaseTxt; } 150 164 TComPic* getRefPicBaseDepth () { return m_pPicBaseDepth; } 165 #if MERL_VSP_NBDV_RefVId_Fix_D0166 166 Void setListDepthPic ( TComList<TComPic*>* pListDepthPic, Int viewId ) { m_pcListDepthPic[viewId] = pListDepthPic; } 167 TComList<TComPic*>* getListDepthPic(Int viewId) { return m_pcListDepthPic[viewId]; } 168 #endif 151 169 #endif 152 170 }; -
trunk/source/Lib/TLibEncoder/TEncTop.cpp
r332 r443 103 103 if (m_bUseSAO) 104 104 { 105 #if LGE_SAO_MIGRATION_D0091 106 m_cEncSAO.setSaoLcuBoundary(getSaoLcuBoundary()); 107 m_cEncSAO.setSaoLcuBasedOptimization(getSaoLcuBasedOptimization()); 108 #else 105 109 m_cEncSAO.setSaoInterleavingFlag(getSaoInterleavingFlag()); 110 #endif 106 111 m_cEncSAO.setMaxNumOffsetsPerPic(getMaxNumOffsetsPerPic()); 107 112 m_cEncSAO.create( getSourceWidth(), getSourceHeight(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth ); … … 120 125 m_cDepthMapGenerator. create( false, getSourceWidth(), getSourceHeight(), g_uiMaxCUDepth, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiBitDepth + g_uiBitIncrement, PDM_SUB_SAMP_EXP_X(m_uiPredDepthMapGeneration), PDM_SUB_SAMP_EXP_Y(m_uiPredDepthMapGeneration) ); 121 126 #endif 122 #if H3D_IVRP 127 #if H3D_IVRP & !QC_ARP_D0177 123 128 m_cResidualGenerator. create( false, getSourceWidth(), getSourceHeight(), g_uiMaxCUDepth, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiBitDepth + g_uiBitIncrement ); 124 129 #endif … … 251 256 m_cDepthMapGenerator. destroy(); 252 257 #endif 253 #if H3D_IVRP 258 #if H3D_IVRP & !QC_ARP_D0177 254 259 m_cResidualGenerator. destroy(); 255 260 #endif … … 347 352 #endif 348 353 #endif 349 #if H3D_IVRP 354 #if H3D_IVRP & !QC_ARP_D0177 350 355 m_cResidualGenerator.init( &m_cTrQuant, &m_cDepthMapGenerator ); 351 356 #endif … … 710 715 #endif 711 716 717 718 #if MTK_D0156 719 #if MERL_VSP_COMPENSATION_C0152 720 m_cSPS.setUseVSPCompensation ( m_bUseVSPCompensation ); 721 #endif 722 m_cSPS.setUseDVPRefine ( m_bUseDVPRefine ); 723 #endif 724 712 725 if( m_isDepth ) 713 726 { … … 722 735 #endif 723 736 #if H3D_IVRP 737 #if QC_ARP_D0177 738 m_cSPS.setUseAdvRP ( 0 ); 739 m_cSPS.setARPStepNum ( 1 ); 740 #else 724 741 m_cSPS.setMultiviewResPredMode ( 0 ); 725 742 #endif 743 #endif 744 726 745 } 727 746 else … … 742 761 #endif 743 762 #if H3D_IVRP 744 m_cSPS.setMultiviewResPredMode ( m_uiMultiviewResPredMode ); 763 #if QC_ARP_D0177 764 m_cSPS.setUseAdvRP ( m_viewId > 0 ? m_nUseAdvResPred : 0 ); 765 m_cSPS.setARPStepNum( m_viewId > 0 ? QC_ARP_WFNR : 1 ); 766 #else 767 m_cSPS.setMultiviewResPredMode ( m_uiMultiviewResPredMode ); 768 #endif 745 769 #endif 746 770 } … … 751 775 #endif 752 776 #if H3D_IVRP 777 #if QC_ARP_D0177 778 m_cSPS.setUseAdvRP ( 0 ); 779 m_cSPS.setARPStepNum ( 1 ); 780 #else 753 781 m_cSPS.setMultiviewResPredMode ( 0 ); 782 #endif 754 783 #endif 755 784 } -
trunk/source/Lib/TLibEncoder/TEncTop.h
r296 r443 103 103 TComDepthMapGenerator m_cDepthMapGenerator; ///< depth map generator 104 104 #endif 105 #if H3D_IVRP 105 #if H3D_IVRP & !QC_ARP_D0177 106 106 TComResidualGenerator m_cResidualGenerator; ///< generator for residual pictures 107 107 #endif … … 234 234 TComDepthMapGenerator* getDepthMapGenerator () { return &m_cDepthMapGenerator; } 235 235 #endif 236 #if H3D_IVRP 236 #if H3D_IVRP & !QC_ARP_D0177 237 237 TComResidualGenerator* getResidualGenerator () { return &m_cResidualGenerator; } 238 238 #endif
Note: See TracChangeset for help on using the changeset viewer.