Changeset 1196 in 3DVCSoftware for trunk/source/Lib/TLibEncoder
- Timestamp:
- 4 May 2015, 17:47:40 (10 years ago)
- Location:
- trunk/source/Lib/TLibEncoder
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/Lib/TLibEncoder/TEncCavlc.cpp
r1179 r1196 40 40 #include "SEIwrite.h" 41 41 #include "../TLibCommon/TypeDef.h" 42 #if H_3D _ANNEX_SELECTION_FIX42 #if H_3D 43 43 #include "TEncTop.h" 44 44 #endif … … 862 862 WRITE_FLAG( pcPPS->getPocResetInfoPresentFlag( ) ? 1 : 0 , "poc_reset_info_present_flag" ); 863 863 WRITE_FLAG( pcPPS->getPpsInferScalingListFlag( ) ? 1 : 0 , "pps_infer_scaling_list_flag" ); 864 #if FIX_TICKET_95865 864 if (pcPPS->getPpsInferScalingListFlag()) 866 865 { 867 866 WRITE_CODE( pcPPS->getPpsScalingListRefLayerId( ), 6, "pps_scaling_list_ref_layer_id" ); 868 867 } 869 #else870 WRITE_CODE( pcPPS->getPpsScalingListRefLayerId( ), 6, "pps_scaling_list_ref_layer_id" );871 #endif872 868 WRITE_UVLC( 0, "num_ref_loc_offsets" ); 873 869 WRITE_FLAG( 0 , "colour_mapping_enabled_flag" ); … … 901 897 WRITE_FLAG( sps3dExt->getQtPredFlag( d ) ? 1 : 0 , "qt_pred_flag" ); 902 898 WRITE_FLAG( sps3dExt->getInterSdcFlag( d ) ? 1 : 0 , "inter_sdc_flag" ); 903 #if SEC_DEPTH_INTRA_SKIP_MODE_K0033904 899 WRITE_FLAG( sps3dExt->getDepthIntraSkipFlag( d ) ? 1 : 0 , "intra_skip_flag" ); 905 #else906 WRITE_FLAG( sps3dExt->getIntraSingleFlag( d ) ? 1 : 0 , "intra_single_flag" );907 #endif908 900 } 909 901 } … … 1614 1606 Void TEncCavlc::codeVPS3dExtension( TComVPS* pcVPS ) 1615 1607 { 1616 #if HHI_CAM_PARA_K00521617 1608 WRITE_UVLC( pcVPS->getCpPrecision( ), "cp_precision" ); 1618 1609 for (Int n = 1; n < pcVPS->getNumViews(); n++) … … 1640 1631 } 1641 1632 } 1642 #else1643 WRITE_UVLC( pcVPS->getCamParPrecision(), "cp_precision" );1644 for (UInt viewIndex=1; viewIndex<pcVPS->getNumViews(); viewIndex++)1645 {1646 WRITE_FLAG( pcVPS->getCamParPresent(viewIndex) ? 1 : 0, "cp_present_flag[i]" );1647 if ( pcVPS->getCamParPresent(viewIndex) )1648 {1649 WRITE_FLAG( pcVPS->hasCamParInSliceHeader(viewIndex) ? 1 : 0, "cp_in_slice_segment_header_flag[i]" );1650 if ( !pcVPS->hasCamParInSliceHeader(viewIndex) )1651 {1652 for( UInt uiIndex = 0; uiIndex < viewIndex; uiIndex++ )1653 {1654 WRITE_SVLC( pcVPS->getCodedScale (viewIndex)[ uiIndex ], "vps_cp_scale" );1655 WRITE_SVLC( pcVPS->getCodedOffset (viewIndex)[ uiIndex ], "vps_cp_off" );1656 WRITE_SVLC( pcVPS->getInvCodedScale (viewIndex)[ uiIndex ] + pcVPS->getCodedScale (viewIndex)[ uiIndex ], "vps_cp_inv_scale_plus_scale" );1657 WRITE_SVLC( pcVPS->getInvCodedOffset(viewIndex)[ uiIndex ] + pcVPS->getCodedOffset(viewIndex)[ uiIndex ], "vps_cp_inv_off_plus_off" );1658 }1659 }1660 }1661 }1662 #endif1663 1633 } 1664 1634 #endif … … 1945 1915 #endif 1946 1916 1947 #if HHI_INTER_COMP_PRED_K00521948 1917 #if H_3D 1949 1918 if( getEncTop()->decProcAnnexI() ) … … 1954 1923 } 1955 1924 } 1956 #endif1957 1925 #endif 1958 1926 if(pcSlice->getSPS()->getUseSAO()) … … 2086 2054 } 2087 2055 #if H_3D_IC 2088 #if H_3D_ANNEX_SELECTION_FIX2089 2056 else if( pcSlice->getViewIndex() && ( pcSlice->getSliceType() == P_SLICE || pcSlice->getSliceType() == B_SLICE ) 2090 2057 && !pcSlice->getIsDepth() && vps->getNumRefListLayers( layerId ) > 0 2091 2058 && getEncTop()->decProcAnnexI() 2092 2059 ) 2093 #else2094 else if( pcSlice->getViewIndex() && ( pcSlice->getSliceType() == P_SLICE || pcSlice->getSliceType() == B_SLICE ) && !pcSlice->getIsDepth() && vps->getNumRefListLayers( layerId ) > 0 )2095 #endif2096 2060 { 2097 2061 WRITE_FLAG( pcSlice->getApplyIC() ? 1 : 0, "slice_ic_enable_flag" ); … … 2148 2112 WRITE_FLAG(pcSlice->getLFCrossSliceBoundaryFlag()?1:0, "slice_loop_filter_across_slices_enabled_flag"); 2149 2113 } 2150 #if HHI_CAM_PARA_K00522151 2114 #if H_3D 2152 2115 if (getEncTop()->decProcAnnexI() ) … … 2166 2129 } 2167 2130 #endif 2168 #endif 2169 } 2170 2171 #if !HHI_CAM_PARA_K0052 2172 #if H_3D 2173 #if H_3D_FCO 2174 if( pcSlice->getVPS()->hasCamParInSliceHeader( pcSlice->getViewIndex() ) && pcSlice->getIsDepth() ) 2175 #else 2176 if( pcSlice->getVPS()->hasCamParInSliceHeader( pcSlice->getViewIndex() ) && !pcSlice->getIsDepth() ) 2177 #endif 2178 { 2179 for( UInt uiId = 0; uiId < pcSlice->getViewIndex(); uiId++ ) 2180 { 2181 WRITE_SVLC( pcSlice->getCodedScale ()[ uiId ], "cp_scale" ); 2182 WRITE_SVLC( pcSlice->getCodedOffset ()[ uiId ], "cp_off" ); 2183 WRITE_SVLC( pcSlice->getInvCodedScale ()[ uiId ] + pcSlice->getCodedScale ()[ uiId ], "cp_inv_scale_plus_scale" ); 2184 WRITE_SVLC( pcSlice->getInvCodedOffset()[ uiId ] + pcSlice->getCodedOffset()[ uiId ], "cp_inv_off_plus_off" ); 2185 } 2186 } 2187 #endif 2188 #endif 2131 } 2132 2189 2133 2190 2134 … … 2532 2476 assert(0); 2533 2477 } 2534 2535 #if SEC_DEPTH_INTRA_SKIP_MODE_K0033 2478 #if H_3D 2536 2479 Void TEncCavlc::codeDIS( TComDataCU* pcCU, UInt uiAbsPartIdx ) 2537 2480 { 2538 2481 assert(0); 2539 2482 } 2540 #else2541 #if H_3D_SINGLE_DEPTH2542 Void TEncCavlc::codeSingleDepthMode( TComDataCU* pcCU, UInt uiAbsPartIdx )2543 {2544 assert(0);2545 }2546 #endif2547 2483 #endif 2548 2484 -
trunk/source/Lib/TLibEncoder/TEncCavlc.h
r1179 r1196 68 68 TComSlice* m_pcSlice; 69 69 UInt m_uiCoeffCost; 70 #if H_3D _ANNEX_SELECTION_FIX70 #if H_3D 71 71 TEncTop* m_encTop; 72 72 #endif … … 129 129 Void codeCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx ); 130 130 Void codeSkipFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 131 #if SEC_DEPTH_INTRA_SKIP_MODE_K0033131 #if H_3D 132 132 Void codeDIS ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 133 #else134 #if H_3D_SINGLE_DEPTH135 Void codeSingleDepthMode( TComDataCU* pcCU, UInt uiAbsPartIdx );136 #endif137 133 #endif 138 134 Void codeMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ); … … 187 183 Void codeDFFlag ( UInt uiCode, const Char *pSymbolName ); 188 184 Void codeDFSvlc ( Int iCode, const Char *pSymbolName ); 189 #if H_3D _ANNEX_SELECTION_FIX185 #if H_3D 190 186 TEncTop* getEncTop() { return m_encTop; }; 191 187 Void setEncTop( TEncTop* et ) { m_encTop = et; }; -
trunk/source/Lib/TLibEncoder/TEncCfg.h
r1179 r1196 78 78 Int m_interViewRefPosL[2][MAX_NUM_REF_PICS]; 79 79 #endif 80 #if H HI_INTER_COMP_PRED_K005280 #if H_3D 81 81 Bool m_interCompPredFlag; 82 82 #endif … … 98 98 , m_numActiveRefLayerPics(0) 99 99 #endif 100 #if HHI_INTER_COMP_PRED_K0052101 100 #if H_3D 102 101 , m_interCompPredFlag(false) 103 #endif104 102 #endif 105 103 { … … 188 186 Int m_iSearchRange; // 0:Full frame 189 187 Int m_bipredSearchRange; 190 #if SONY_MV_V_CONST_C0078188 #if H_MV 191 189 Bool m_bUseDisparitySearchRangeRestriction; 192 190 Int m_iVerticalDisparitySearchRange; … … 380 378 381 379 //====== Camera Parameters ====== 382 #if !HHI_CAM_PARA_K0052383 UInt m_uiCamParPrecision;384 Bool m_bCamParInSliceHeader;385 Int** m_aaiCodedScale;386 Int** m_aaiCodedOffset;387 #endif388 380 TAppComCamPara* m_cameraParameters; 389 381 … … 418 410 Bool m_bUseQTL; 419 411 #endif 420 #if H_3D_ANNEX_SELECTION_FIX 412 421 413 Int m_profileIdc; 422 #endif423 414 424 415 #endif … … 435 426 , m_isDepth(false) 436 427 , m_bUseVSO(false) 437 #if H_3D_ANNEX_SELECTION_FIX438 428 , m_profileIdc( -1 ) 439 #endif440 429 #endif 441 430 #endif … … 522 511 Void setSearchRange ( Int i ) { m_iSearchRange = i; } 523 512 Void setBipredSearchRange ( Int i ) { m_bipredSearchRange = i; } 524 #if SONY_MV_V_CONST_C0078513 #if H_MV 525 514 Void setUseDisparitySearchRangeRestriction ( Bool b ) { m_bUseDisparitySearchRangeRestriction = b; } 526 515 Void setVerticalDisparitySearchRange ( Int i ) { m_iVerticalDisparitySearchRange = i; } … … 578 567 Int getFastSearch () { return m_iFastSearch; } 579 568 Int getSearchRange () { return m_iSearchRange; } 580 #if SONY_MV_V_CONST_C0078569 #if H_MV 581 570 Bool getUseDisparitySearchRangeRestriction () { return m_bUseDisparitySearchRangeRestriction; } 582 571 Int getVerticalDisparitySearchRange () { return m_iVerticalDisparitySearchRange; } … … 923 912 924 913 //==== CAMERA PARAMETERS ========== 925 #if !HHI_CAM_PARA_K0052926 Void setCamParPrecision ( UInt u ) { m_uiCamParPrecision = u; }927 Void setCamParInSliceHeader ( Bool b ) { m_bCamParInSliceHeader = b; }928 Void setCodedScale ( Int** p ) { m_aaiCodedScale = p; }929 Void setCodedOffset ( Int** p ) { m_aaiCodedOffset = p; }930 #endif931 914 Void setCameraParameters ( TAppComCamPara* c) { m_cameraParameters = c; } 932 915 … … 976 959 Bool getUseQTL () { return m_bUseQTL; } 977 960 #endif 978 #if H_3D_ANNEX_SELECTION_FIX979 961 Void setProfileIdc( Int a ) { assert( a == 1 || a == 6 || a == 8 ); m_profileIdc = a; } 980 962 Bool decProcAnnexI() { assert( m_profileIdc != -1 ); return ( m_profileIdc == 8); } 981 #endif982 963 983 964 #endif // H_3D -
trunk/source/Lib/TLibEncoder/TEncCu.cpp
r1179 r1196 441 441 #if H_3D_VSP 442 442 DisInfo DvInfo; 443 #if !SEC_ARP_REM_ENC_RESTRICT_K0035444 DvInfo.bDV = false;445 #endif446 443 DvInfo.m_acNBDV.setZero(); 447 444 DvInfo.m_aVIdxCan = 0; … … 544 541 TComDataCU* pcTextureCU = pcTexture->getCU( rpcBestCU->getAddr() ); //Corresponding texture LCU 545 542 UInt uiCUIdx = rpcBestCU->getZorderIdxInCU(); 546 assert(pcTextureCU->getDepth(uiCUIdx) >= uiDepth); //Depth cannot be more partition ned than the texture.543 assert(pcTextureCU->getDepth(uiCUIdx) >= uiDepth); //Depth cannot be more partitioned than the texture. 547 544 if (pcTextureCU->getDepth(uiCUIdx) > uiDepth || pcTextureCU->getPartitionSize(uiCUIdx) == SIZE_NxN) //Texture was split. 548 545 { … … 559 556 { 560 557 if(pcTextureCU->getPartitionSize(uiCUIdx)==SIZE_2NxN || pcTextureCU->getPartitionSize(uiCUIdx)==SIZE_2NxnU|| pcTextureCU->getPartitionSize(uiCUIdx)==SIZE_2NxnD) 558 { 561 559 bTry2NxN = true; 560 } 562 561 else 562 { 563 563 bTryNx2N = true; 564 } 564 565 } 565 566 } … … 589 590 if (rpcTempCU->getSlice()->getIsDepth() ) 590 591 { 591 #if SEC_ARP_REM_ENC_RESTRICT_K0035592 592 rpcTempCU->getDispforDepth(0, 0, &DvInfo); 593 #else594 DvInfo.bDV = rpcTempCU->getDispforDepth(0, 0, &DvInfo);595 #endif596 593 } 597 594 else … … 599 596 #endif 600 597 #if H_3D_NBDV_REF 601 if( rpcTempCU->getSlice()->getDepthRefinementFlag() ) 602 #if SEC_ARP_REM_ENC_RESTRICT_K0035 603 rpcTempCU->getDisMvpCandNBDV(&DvInfo, true); 604 #else 605 DvInfo.bDV = rpcTempCU->getDisMvpCandNBDV(&DvInfo, true); 606 #endif 607 else 598 if( rpcTempCU->getSlice()->getDepthRefinementFlag() ) 599 { 600 rpcTempCU->getDisMvpCandNBDV(&DvInfo, true); 601 } 602 else 608 603 #endif 609 #if SEC_ARP_REM_ENC_RESTRICT_K0035 610 rpcTempCU->getDisMvpCandNBDV(&DvInfo); 611 #else 612 DvInfo.bDV = rpcTempCU->getDisMvpCandNBDV(&DvInfo); 613 #endif 614 604 { 605 rpcTempCU->getDisMvpCandNBDV(&DvInfo); 606 } 615 607 #if H_3D_IV_MERGE 616 608 } … … 639 631 Bool bICFlag = uiICId ? true : false; 640 632 #endif 641 // 2Nx2N 642 if(m_pcEncCfg->getUseEarlySkipDetection()) 643 { 633 // 2Nx2N 634 if(m_pcEncCfg->getUseEarlySkipDetection()) 635 { 636 #if H_3D_IC 637 rpcTempCU->setICFlagSubParts(bICFlag, 0, 0, uiDepth); 638 #endif 639 #if H_3D_FAST_TEXTURE_ENCODING 640 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N, bFMD ); rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );//by Competition for inter_2Nx2N 641 #else 642 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N ); 643 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );//by Competition for inter_2Nx2N 644 #endif 645 #if H_3D_VSP 646 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth); 647 #endif 648 } 649 // SKIP 644 650 #if H_3D_IC 645 651 rpcTempCU->setICFlagSubParts(bICFlag, 0, 0, uiDepth); 646 652 #endif 653 xCheckRDCostMerge2Nx2N( rpcBestCU, rpcTempCU, &earlyDetectionSkipMode );//by Merge for inter_2Nx2N 647 654 #if H_3D_FAST_TEXTURE_ENCODING 648 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N, bFMD ); rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );//by Competition for inter_2Nx2N 649 #else 650 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N ); 651 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );//by Competition for inter_2Nx2N 652 #endif 655 bFMD = bIVFMerge && rpcBestCU->isSkipped(0); 656 #endif 657 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 653 658 #if H_3D_VSP 654 659 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth); 655 660 #endif 656 } 657 // SKIP 658 #if H_3D_IC 659 rpcTempCU->setICFlagSubParts(bICFlag, 0, 0, uiDepth); 660 #endif 661 xCheckRDCostMerge2Nx2N( rpcBestCU, rpcTempCU, &earlyDetectionSkipMode );//by Merge for inter_2Nx2N 662 #if H_3D_FAST_TEXTURE_ENCODING 663 bFMD = bIVFMerge && rpcBestCU->isSkipped(0); 664 #endif 665 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 666 #if H_3D_VSP 667 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth); 668 #endif 669 670 if(!m_pcEncCfg->getUseEarlySkipDetection()) 671 { 672 // 2Nx2N, NxN 661 662 if(!m_pcEncCfg->getUseEarlySkipDetection()) 663 { 664 // 2Nx2N, NxN 673 665 #if H_3D_IC 674 666 rpcTempCU->setICFlagSubParts(bICFlag, 0, 0, uiDepth); … … 677 669 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N, bFMD ); rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 678 670 #else 679 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N );680 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );671 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N ); 672 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 681 673 #endif 682 674 #if H_3D_VSP 683 675 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth); 684 676 #endif 685 677 686 678 #if H_3D_DBBP 687 if( rpcTempCU->getSlice()->getDepthBasedBlkPartFlag() && rpcTempCU->getSlice()->getDefaultRefViewIdxAvailableFlag() )688 {689 xCheckRDCostInterDBBP( rpcBestCU, rpcTempCU, false );690 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );679 if( rpcTempCU->getSlice()->getDepthBasedBlkPartFlag() && rpcTempCU->getSlice()->getDefaultRefViewIdxAvailableFlag() ) 680 { 681 xCheckRDCostInterDBBP( rpcBestCU, rpcTempCU, false ); 682 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 691 683 #if H_3D_VSP 692 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth); 693 #endif 694 } 695 #endif 696 684 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth); 685 #endif 686 } 687 #endif 697 688 if(m_pcEncCfg->getUseCbfFastMode()) 698 689 { 699 690 doNotBlockPu = rpcBestCU->getQtRootCbf( 0 ) != 0; 700 691 } 701 }692 } 702 693 #if H_3D_IC 703 694 } … … 730 721 } 731 722 #endif 732 #if SEC_DEPTH_INTRA_SKIP_MODE_K0033723 #if H_3D 733 724 rpcTempCU->initEstData( uiDepth, iMinQP, isAddLowestQP ); 734 725 if( rpcBestCU->getSlice()->getDepthIntraSkipFlag() ) … … 737 728 rpcTempCU->initEstData( uiDepth, iMinQP, isAddLowestQP ); 738 729 } 739 #else740 #if H_3D_SINGLE_DEPTH741 rpcTempCU->initEstData( uiDepth, iMinQP, isAddLowestQP );742 if( rpcBestCU->getSlice()->getIntraSingleFlag() )743 {744 xCheckRDCostSingleDepth( rpcBestCU, rpcTempCU, SIZE_2Nx2N );745 rpcTempCU->initEstData( uiDepth, iMinQP, isAddLowestQP );746 }747 #endif748 730 #endif 749 731 if(!earlyDetectionSkipMode) … … 1058 1040 // speedup for inter frames 1059 1041 if( rpcBestCU->getSlice()->getSliceType() == I_SLICE || 1060 1061 1062 1042 rpcBestCU->getCbf( 0, TEXT_LUMA ) != 0 || 1043 rpcBestCU->getCbf( 0, TEXT_CHROMA_U ) != 0 || 1044 rpcBestCU->getCbf( 0, TEXT_CHROMA_V ) != 0 1063 1045 #if H_3D_DIM_ENC 1064 1046 || rpcBestCU->getSlice()->getIsDepth() 1065 1047 #endif 1066 1048 ) // avoid very complex intra if it is unlikely … … 1068 1050 #if H_3D_DIM 1069 1051 Bool bOnlyIVP = false; 1070 #if TICKET083_IVPFLAG_FIX1071 1052 Bool bUseIVP = true; 1072 #endif1073 1053 if( rpcBestCU->getSlice()->getIsDepth() && !(rpcBestCU->getSlice()->isIRAP()) && 1074 1075 1076 1077 1054 rpcBestCU->getSlice()->getSliceType() != I_SLICE && 1055 rpcBestCU->getCbf( 0, TEXT_LUMA ) == 0 && 1056 rpcBestCU->getCbf( 0, TEXT_CHROMA_U ) == 0 && 1057 rpcBestCU->getCbf( 0, TEXT_CHROMA_V ) == 0 1078 1058 ) 1079 1059 { 1080 1060 bOnlyIVP = true; 1081 #if TICKET083_IVPFLAG_FIX1082 1061 bUseIVP = rpcBestCU->getSlice()->getIntraContourFlag(); 1083 #endif1084 1062 } 1085 #if TICKET083_IVPFLAG_FIX1086 1063 if( bUseIVP ) 1087 1064 { 1088 #endif 1089 xCheckRDCostIntra( rpcBestCU, rpcTempCU, SIZE_2Nx2N, bOnlyIVP ); 1065 xCheckRDCostIntra( rpcBestCU, rpcTempCU, SIZE_2Nx2N, bOnlyIVP ); 1090 1066 #else 1091 1067 xCheckRDCostIntra( rpcBestCU, rpcTempCU, SIZE_2Nx2N ); … … 1120 1096 #endif 1121 1097 } 1122 #if TICKET083_IVPFLAG_FIX1098 #if H_3D 1123 1099 } 1124 1100 #endif 1125 1101 } 1126 1102 // test PCM 1127 1103 if(pcPic->getSlice(0)->getSPS()->getUsePCM() … … 1607 1583 return; 1608 1584 } 1609 #if SEC_DEPTH_INTRA_SKIP_MODE_K00331585 #if H_3D 1610 1586 m_pcEntropyCoder->encodeDIS( pcCU, uiAbsPartIdx ); 1611 1587 if(!pcCU->getDISFlag(uiAbsPartIdx)) 1612 1588 { 1613 #else 1614 #if H_3D_SINGLE_DEPTH 1615 m_pcEntropyCoder->encodeSingleDepthMode( pcCU, uiAbsPartIdx ); 1616 if(!pcCU->getSingleDepthFlag(uiAbsPartIdx)) 1617 { 1618 #endif 1619 #endif 1589 #endif 1590 1620 1591 m_pcEntropyCoder->encodePredMode( pcCU, uiAbsPartIdx ); 1621 1592 1622 1593 m_pcEntropyCoder->encodePartSize( pcCU, uiAbsPartIdx, uiDepth ); 1623 1594 1624 #if !HHI_MOVE_SYN_K00521625 #if H_3D_DIM_SDC1626 m_pcEntropyCoder->encodeSDCFlag( pcCU, uiAbsPartIdx, false );1627 #endif1628 #endif1629 1595 if (pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N ) 1630 1596 { … … 1632 1598 if(pcCU->getIPCMFlag(uiAbsPartIdx)) 1633 1599 { 1634 #if HHI_MOVE_SYN_K00521635 1600 #if H_3D_DIM_SDC 1636 1601 m_pcEntropyCoder->encodeSDCFlag( pcCU, uiAbsPartIdx, false ); 1637 1602 #endif 1638 #endif1639 1603 // Encode slice finish 1640 1604 finishCU(pcCU,uiAbsPartIdx,uiDepth); … … 1645 1609 // prediction Info ( Intra : direction mode, Inter : Mv, reference idx ) 1646 1610 m_pcEntropyCoder->encodePredInfo( pcCU, uiAbsPartIdx ); 1647 #if H HI_MOVE_SYN_K00521611 #if H_3D 1648 1612 m_pcEntropyCoder->encodeDBBPFlag( pcCU, uiAbsPartIdx ); 1613 #endif 1649 1614 #if H_3D_DIM_SDC 1650 1615 m_pcEntropyCoder->encodeSDCFlag( pcCU, uiAbsPartIdx, false ); 1651 1616 #endif 1652 #endif1653 1617 #if H_3D_ARP 1654 1618 m_pcEntropyCoder->encodeARPW( pcCU , uiAbsPartIdx ); … … 1665 1629 #endif 1666 1630 setdQPFlag( bCodeDQP ); 1667 #if SEC_DEPTH_INTRA_SKIP_MODE_K0033 1668 } 1669 #else 1670 #if H_3D_SINGLE_DEPTH 1671 } 1672 #endif 1631 #if H_3D 1632 } 1673 1633 #endif 1674 1634 // --- write terminating bit --- … … 1817 1777 Bool bICFlag = rpcTempCU->getICFlag( 0 ); 1818 1778 #endif 1819 #if H_3D_VSO // M1 //nece ccary here?1779 #if H_3D_VSO // M1 //necessary here? 1820 1780 if( m_pcRdCost->getUseRenModel() ) 1821 1781 { … … 1889 1849 #if H_3D_ARP 1890 1850 Int nARPWMax = rpcTempCU->getSlice()->getARPStepNum() - 1; 1891 #if SEC_ARP_REM_ENC_RESTRICT_K00351892 1851 if( nARPWMax < 0 || bICFlag ) 1893 #else1894 if( nARPWMax < 0 || !rpcTempCU->getDvInfo(0).bDV || bICFlag )1895 #endif1896 1852 { 1897 1853 nARPWMax = 0; … … 1946 1902 { 1947 1903 #if H_3D_IC 1948 if( rpcTempCU->getSlice()->getApplyIC() && rpcTempCU->getSlice()->getIcSkipParseFlag() ) 1904 if( rpcTempCU->getSlice()->getApplyIC() && rpcTempCU->getSlice()->getIcSkipParseFlag() ) 1905 { 1906 if( bICFlag && uiMergeCand == 0 ) 1949 1907 { 1950 if( bICFlag && uiMergeCand == 0 ) 1951 { 1952 continue; 1953 } 1908 continue; 1954 1909 } 1955 #endif 1956 if(!(uiNoResidual==1 && mergeCandBuffer[uiMergeCand]==1)) 1957 { 1910 } 1911 #endif 1912 if(!(uiNoResidual==1 && mergeCandBuffer[uiMergeCand]==1)) 1913 { 1958 1914 if( !(bestIsSkip && uiNoResidual == 0) ) 1959 1915 { … … 1994 1950 #if H_3D_VSP 1995 1951 { 1996 if ( vspFlag[uiMergeCand] ) 1997 { 1998 UInt partAddr; 1999 Int vspSize; 2000 Int width, height; 2001 rpcTempCU->getPartIndexAndSize( 0, partAddr, width, height ); 2002 if( uhInterDirNeighbours[ uiMergeCand ] & 0x01 ) 1952 if ( vspFlag[uiMergeCand] ) 2003 1953 { 2004 rpcTempCU->setMvFieldPUForVSP( rpcTempCU, partAddr, width, height, REF_PIC_LIST_0, cMvFieldNeighbours[ 2*uiMergeCand + 0 ].getRefIdx(), vspSize ); 2005 rpcTempCU->setVSPFlag( partAddr, vspSize ); 1954 UInt partAddr; 1955 Int vspSize; 1956 Int width, height; 1957 rpcTempCU->getPartIndexAndSize( 0, partAddr, width, height ); 1958 if( uhInterDirNeighbours[ uiMergeCand ] & 0x01 ) 1959 { 1960 rpcTempCU->setMvFieldPUForVSP( rpcTempCU, partAddr, width, height, REF_PIC_LIST_0, cMvFieldNeighbours[ 2*uiMergeCand + 0 ].getRefIdx(), vspSize ); 1961 rpcTempCU->setVSPFlag( partAddr, vspSize ); 1962 } 1963 else 1964 { 1965 rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level 1966 } 1967 if( uhInterDirNeighbours[ uiMergeCand ] & 0x02 ) 1968 { 1969 rpcTempCU->setMvFieldPUForVSP( rpcTempCU, partAddr, width, height, REF_PIC_LIST_1 , cMvFieldNeighbours[ 2*uiMergeCand + 1 ].getRefIdx(), vspSize ); 1970 rpcTempCU->setVSPFlag( partAddr, vspSize ); 1971 } 1972 else 1973 { 1974 rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level 1975 } 1976 rpcTempCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeCand], 0, 0, uhDepth ); // interprets depth relative to LCU level 2006 1977 } 2007 1978 else 2008 1979 { 1980 #endif 1981 rpcTempCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeCand], 0, 0, uhDepth ); // interprets depth relative to LCU level 2009 1982 rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level 1983 rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level 1984 #if H_3D_VSP 2010 1985 } 2011 if( uhInterDirNeighbours[ uiMergeCand ] & 0x02 )2012 {2013 rpcTempCU->setMvFieldPUForVSP( rpcTempCU, partAddr, width, height, REF_PIC_LIST_1 , cMvFieldNeighbours[ 2*uiMergeCand + 1 ].getRefIdx(), vspSize );2014 rpcTempCU->setVSPFlag( partAddr, vspSize );2015 }2016 else2017 {2018 rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level2019 }2020 rpcTempCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeCand], 0, 0, uhDepth ); // interprets depth relative to LCU level2021 1986 } 2022 else 1987 #endif 1988 // do MC 1989 m_pcPredSearch->motionCompensation ( rpcTempCU, m_ppcPredYuvTemp[uhDepth] ); 1990 // estimate residual and encode everything 1991 #if H_3D_VSO //M2 1992 if( m_pcRdCost->getUseRenModel() ) 1993 { //Reset 1994 UInt uiWidth = m_ppcOrigYuv[uhDepth]->getWidth (); 1995 UInt uiHeight = m_ppcOrigYuv[uhDepth]->getHeight (); 1996 Pel* piSrc = m_ppcOrigYuv[uhDepth]->getLumaAddr (); 1997 UInt uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride (); 1998 m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight ); 1999 } 2000 #endif 2001 m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU, 2002 m_ppcOrigYuv [uhDepth], 2003 m_ppcPredYuvTemp[uhDepth], 2004 m_ppcResiYuvTemp[uhDepth], 2005 m_ppcResiYuvBest[uhDepth], 2006 m_ppcRecoYuvTemp[uhDepth], 2007 (uiNoResidual? true:false)); 2008 2009 2010 if ( uiNoResidual == 0 && rpcTempCU->getQtRootCbf(0) == 0 ) 2023 2011 { 2024 #endif 2025 rpcTempCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeCand], 0, 0, uhDepth ); // interprets depth relative to LCU level 2026 rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level 2027 rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level 2028 #if H_3D_VSP 2012 // If no residual when allowing for one, then set mark to not try case where residual is forced to 0 2013 mergeCandBuffer[uiMergeCand] = 1; 2029 2014 } 2030 }2031 #endif2032 // do MC2033 m_pcPredSearch->motionCompensation ( rpcTempCU, m_ppcPredYuvTemp[uhDepth] );2034 // estimate residual and encode everything2035 #if H_3D_VSO //M22036 if( m_pcRdCost->getUseRenModel() )2037 { //Reset2038 UInt uiWidth = m_ppcOrigYuv[uhDepth]->getWidth ();2039 UInt uiHeight = m_ppcOrigYuv[uhDepth]->getHeight ();2040 Pel* piSrc = m_ppcOrigYuv[uhDepth]->getLumaAddr ();2041 UInt uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride ();2042 m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );2043 }2044 #endif2045 m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU,2046 m_ppcOrigYuv [uhDepth],2047 m_ppcPredYuvTemp[uhDepth],2048 m_ppcResiYuvTemp[uhDepth],2049 m_ppcResiYuvBest[uhDepth],2050 m_ppcRecoYuvTemp[uhDepth],2051 (uiNoResidual? true:false));2052 2053 2054 if ( uiNoResidual == 0 && rpcTempCU->getQtRootCbf(0) == 0 )2055 {2056 // If no residual when allowing for one, then set mark to not try case where residual is forced to 02057 mergeCandBuffer[uiMergeCand] = 1;2058 }2059 2015 2060 2016 rpcTempCU->setSkipFlagSubParts( rpcTempCU->getQtRootCbf(0) == 0, 0, uhDepth ); 2061 #if SEC_DEPTH_INTRA_SKIP_MODE_K00332017 #if H_3D 2062 2018 rpcTempCU->setDISFlagSubParts( false, 0, uhDepth ); 2063 #else2064 #if H_3D_SINGLE_DEPTH2065 rpcTempCU->setSingleDepthFlagSubParts( false, 0, uhDepth );2066 #endif2067 2019 #endif 2068 2020 #if H_3D_VSP // possible bug fix … … 2105 2057 } 2106 2058 rpcTempCU->setSkipFlagSubParts( false, 0, uhDepth ); 2107 #if SEC_DEPTH_INTRA_SKIP_MODE_K00332059 #if H_3D 2108 2060 rpcTempCU->setDISFlagSubParts( false, 0, uhDepth ); 2109 #else2110 #if H_3D_SINGLE_DEPTH2111 rpcTempCU->setSingleDepthFlagSubParts( false, 0, uhDepth );2112 #endif2113 2061 #endif 2114 2062 rpcTempCU->setTrIdxSubParts( 0, 0, uhDepth ); … … 2152 2100 rpcTempCU->initEstData( uhDepth, orgQP, bTransquantBypassFlag ); 2153 2101 2154 if( m_pcEncCfg->getUseFastDecisionForMerge() && !bestIsSkip ) 2102 if( m_pcEncCfg->getUseFastDecisionForMerge() && !bestIsSkip ) 2103 { 2104 #if H_3D_INTER_SDC 2105 if( rpcTempCU->getSlice()->getInterSdcFlag() ) 2106 { 2107 bestIsSkip = !rpcBestCU->getSDCFlag( 0 ) && ( rpcBestCU->getQtRootCbf(0) == 0 ); 2108 } 2109 else 2110 { 2111 #endif 2112 bestIsSkip = rpcBestCU->getQtRootCbf(0) == 0; 2113 #if H_3D_INTER_SDC 2114 } 2115 #endif 2116 } 2117 } 2118 } 2119 } 2120 2121 if(uiNoResidual == 0 && m_pcEncCfg->getUseEarlySkipDetection()) 2122 { 2123 if(rpcBestCU->getQtRootCbf( 0 ) == 0) 2155 2124 { 2156 #if H_3D_INTER_SDC 2157 if( rpcTempCU->getSlice()->getInterSdcFlag() ) 2125 if( rpcBestCU->getMergeFlag( 0 )) 2158 2126 { 2159 bestIsSkip = !rpcBestCU->getSDCFlag( 0 ) && ( rpcBestCU->getQtRootCbf(0) == 0 );2127 *earlyDetectionSkipMode = true; 2160 2128 } 2161 2129 else 2162 2130 { 2163 #endif 2164 bestIsSkip = rpcBestCU->getQtRootCbf(0) == 0; 2165 #if H_3D_INTER_SDC 2166 } 2167 #endif 2168 } 2169 } 2170 } 2171 } 2172 2173 if(uiNoResidual == 0 && m_pcEncCfg->getUseEarlySkipDetection()) 2174 { 2175 if(rpcBestCU->getQtRootCbf( 0 ) == 0) 2176 { 2177 if( rpcBestCU->getMergeFlag( 0 )) 2178 { 2179 *earlyDetectionSkipMode = true; 2180 } 2181 else 2182 { 2183 Int absoulte_MV=0; 2184 for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) 2185 { 2186 if ( rpcBestCU->getSlice()->getNumRefIdx( RefPicList( uiRefListIdx ) ) > 0 ) 2131 Int absoulte_MV=0; 2132 for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) 2187 2133 { 2188 TComCUMvField* pcCUMvField = rpcBestCU->getCUMvField(RefPicList( uiRefListIdx )); 2189 Int iHor = pcCUMvField->getMvd( 0 ).getAbsHor(); 2190 Int iVer = pcCUMvField->getMvd( 0 ).getAbsVer(); 2191 absoulte_MV+=iHor+iVer; 2134 if ( rpcBestCU->getSlice()->getNumRefIdx( RefPicList( uiRefListIdx ) ) > 0 ) 2135 { 2136 TComCUMvField* pcCUMvField = rpcBestCU->getCUMvField(RefPicList( uiRefListIdx )); 2137 Int iHor = pcCUMvField->getMvd( 0 ).getAbsHor(); 2138 Int iVer = pcCUMvField->getMvd( 0 ).getAbsVer(); 2139 absoulte_MV+=iHor+iVer; 2140 } 2141 } 2142 2143 if(absoulte_MV == 0) 2144 { 2145 *earlyDetectionSkipMode = true; 2192 2146 } 2193 2147 } 2194 2195 if(absoulte_MV == 0)2196 {2197 *earlyDetectionSkipMode = true;2198 }2199 2148 } 2200 2149 } 2201 2150 } 2202 }2203 2151 #if H_3D_SPIVMP 2204 2152 delete[] pcMvFieldSP; … … 2221 2169 #endif 2222 2170 { 2223 2224 2171 #if H_3D 2225 2172 const Bool bTransquantBypassFlag = rpcTempCU->getCUTransquantBypass(0); … … 2229 2176 { 2230 2177 #endif 2231 UChar uhDepth = rpcTempCU->getDepth( 0 );2178 UChar uhDepth = rpcTempCU->getDepth( 0 ); 2232 2179 #if H_3D_ARP 2233 Bool bFirstTime = true; 2234 Int nARPWMax = rpcTempCU->getSlice()->getARPStepNum() - 1; 2235 #if SEC_ARP_REM_ENC_RESTRICT_K0035 2236 if( nARPWMax < 0 || ePartSize != SIZE_2Nx2N || rpcTempCU->getICFlag(0) ) 2237 #else 2238 if( nARPWMax < 0 || ePartSize != SIZE_2Nx2N || !rpcTempCU->getDvInfo(0).bDV || rpcTempCU->getICFlag(0) ) 2239 #endif 2240 { 2241 nARPWMax = 0; 2242 } 2243 2244 for( Int nARPW = 0; nARPW <= nARPWMax; nARPW++ ) 2245 { 2246 if( !bFirstTime && rpcTempCU->getSlice()->getIvResPredFlag() ) 2247 { 2248 rpcTempCU->initEstData( rpcTempCU->getDepth(0), rpcTempCU->getQP(0),bTransquantBypassFlag ); 2249 } 2250 #endif 2251 #if H_3D_VSO // M3 2252 if( m_pcRdCost->getUseRenModel() ) 2253 { 2254 UInt uiWidth = m_ppcOrigYuv[uhDepth]->getWidth ( ); 2255 UInt uiHeight = m_ppcOrigYuv[uhDepth]->getHeight( ); 2256 Pel* piSrc = m_ppcOrigYuv[uhDepth]->getLumaAddr( ); 2257 UInt uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride(); 2258 m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight ); 2259 } 2260 #endif 2261 2262 rpcTempCU->setDepthSubParts( uhDepth, 0 ); 2263 2264 rpcTempCU->setSkipFlagSubParts( false, 0, uhDepth ); 2265 #if SEC_DEPTH_INTRA_SKIP_MODE_K0033 2266 rpcTempCU->setDISFlagSubParts( false, 0, uhDepth ); 2267 #else 2268 #if H_3D_SINGLE_DEPTH 2269 rpcTempCU->setSingleDepthFlagSubParts( false, 0, uhDepth ); 2270 #endif 2271 #endif 2272 rpcTempCU->setPartSizeSubParts ( ePartSize, 0, uhDepth ); 2273 rpcTempCU->setPredModeSubParts ( MODE_INTER, 0, uhDepth ); 2274 2275 #if H_3D_ARP 2276 rpcTempCU->setARPWSubParts( (UChar)nARPW , 0 , uhDepth ); 2277 #endif 2278 2279 #if H_3D_ARP 2280 if( bFirstTime == false && nARPWMax ) 2281 { 2282 rpcTempCU->copyPartFrom( m_ppcWeightedTempCU[uhDepth] , 0 , uhDepth ); 2283 rpcTempCU->setARPWSubParts( (UChar)nARPW , 0 , uhDepth ); 2284 2285 m_pcPredSearch->motionCompensation( rpcTempCU , m_ppcPredYuvTemp[uhDepth] ); 2286 } 2287 else 2288 { 2289 bFirstTime = false; 2290 #endif 2291 #if AMP_MRG 2292 rpcTempCU->setMergeAMP (true); 2293 #if H_3D_FAST_TEXTURE_ENCODING 2294 m_pcPredSearch->predInterSearch ( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcRecoYuvTemp[uhDepth], bFMD, false, bUseMRG ); 2295 #else 2296 m_pcPredSearch->predInterSearch ( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcRecoYuvTemp[uhDepth], false, bUseMRG ); 2297 #endif 2298 #else 2299 m_pcPredSearch->predInterSearch ( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcRecoYuvTemp[uhDepth] ); 2300 #endif 2301 #if H_3D_ARP 2302 if( nARPWMax ) 2303 { 2304 m_ppcWeightedTempCU[uhDepth]->copyPartFrom( rpcTempCU , 0 , uhDepth ); 2305 } 2306 } 2307 #endif 2308 2309 #if AMP_MRG 2310 if ( !rpcTempCU->getMergeAMP() ) 2311 { 2312 #if H_3D_ARP 2313 if( nARPWMax ) 2314 { 2315 continue; 2316 } 2317 else 2318 #endif 2319 return; 2320 } 2321 #endif 2322 2323 #if KWU_RC_MADPRED_E0227 2324 if ( m_pcEncCfg->getUseRateCtrl() && m_pcEncCfg->getLCULevelRC() && ePartSize == SIZE_2Nx2N && uhDepth <= m_addSADDepth ) 2325 { 2326 UInt SAD = m_pcRdCost->getSADPart( g_bitDepthY, m_ppcPredYuvTemp[uhDepth]->getLumaAddr(), m_ppcPredYuvTemp[uhDepth]->getStride(), 2327 m_ppcOrigYuv[uhDepth]->getLumaAddr(), m_ppcOrigYuv[uhDepth]->getStride(), 2328 rpcTempCU->getWidth(0), rpcTempCU->getHeight(0) ); 2329 m_temporalSAD = (Int)SAD; 2330 } 2331 #endif 2332 m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcResiYuvBest[uhDepth], m_ppcRecoYuvTemp[uhDepth], false ); 2333 #if H_3D_VSP // possible bug fix 2334 if( rpcTempCU->getQtRootCbf(0)==0 ) 2335 { 2336 rpcTempCU->setTrIdxSubParts(0, 0, uhDepth); 2337 } 2338 #endif 2339 #if H_3D_VSO // M4 2340 if( m_pcRdCost->getUseLambdaScaleVSO() ) 2341 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCostVSO( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 2342 else 2343 #endif 2344 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 2345 #if H_3D_INTER_SDC 2346 TComDataCU *rpcTempCUPre = rpcTempCU; 2347 #endif 2348 xCheckDQP( rpcTempCU ); 2349 xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth); 2350 #if H_3D_INTER_SDC 2351 if( rpcTempCU->getSlice()->getInterSdcFlag() && ePartSize == SIZE_2Nx2N) 2352 { 2353 Double dOffsetCost[3] = {MAX_DOUBLE,MAX_DOUBLE,MAX_DOUBLE}; 2354 for( Int uiOffest = 1 ; uiOffest <= 5 ; uiOffest++ ) 2355 { 2356 if( uiOffest > 3) 2180 Bool bFirstTime = true; 2181 Int nARPWMax = rpcTempCU->getSlice()->getARPStepNum() - 1; 2182 if( nARPWMax < 0 || ePartSize != SIZE_2Nx2N || rpcTempCU->getICFlag(0) ) 2183 { 2184 nARPWMax = 0; 2185 } 2186 2187 for( Int nARPW = 0; nARPW <= nARPWMax; nARPW++ ) 2188 { 2189 if( !bFirstTime && rpcTempCU->getSlice()->getIvResPredFlag() ) 2357 2190 { 2358 if ( dOffsetCost[0] < (0.9*dOffsetCost[1]) && dOffsetCost[0] < (0.9*dOffsetCost[2]) ) 2359 { 2360 continue; 2361 } 2362 if ( dOffsetCost[1] < dOffsetCost[0] && dOffsetCost[0] < dOffsetCost[2] && uiOffest == 5) 2363 { 2364 continue; 2365 } 2366 if ( dOffsetCost[0] < dOffsetCost[1] && dOffsetCost[2] < dOffsetCost[0] && uiOffest == 4) 2367 { 2368 continue; 2369 } 2191 rpcTempCU->initEstData( rpcTempCU->getDepth(0), rpcTempCU->getQP(0),bTransquantBypassFlag ); 2370 2192 } 2371 2372 if( rpcTempCU != rpcTempCUPre ) 2373 { 2374 Int orgQP = rpcBestCU->getQP( 0 ); 2375 rpcTempCU->initEstData( uhDepth, orgQP ,bTransquantBypassFlag ); 2376 rpcTempCU->copyPartFrom( rpcBestCU, 0, uhDepth ); 2377 } 2378 rpcTempCU->setSkipFlagSubParts( false, 0, uhDepth ); 2379 #if SEC_DEPTH_INTRA_SKIP_MODE_K0033 2380 rpcTempCU->setDISFlagSubParts( false, 0, uhDepth ); 2381 #else 2382 #if H_3D_SINGLE_DEPTH 2383 rpcTempCU->setSingleDepthFlagSubParts( false, 0, uhDepth ); 2384 #endif 2385 #endif 2386 rpcTempCU->setTrIdxSubParts( 0, 0, uhDepth ); 2387 rpcTempCU->setCbfSubParts( 1, 1, 1, 0, uhDepth ); 2193 #endif 2388 2194 #if H_3D_VSO // M3 2389 2195 if( m_pcRdCost->getUseRenModel() ) … … 2397 2203 #endif 2398 2204 2399 Int iSdcOffset = 0; 2400 if(uiOffest % 2 == 0) 2205 rpcTempCU->setDepthSubParts( uhDepth, 0 ); 2206 2207 rpcTempCU->setSkipFlagSubParts( false, 0, uhDepth ); 2208 #if H_3D 2209 rpcTempCU->setDISFlagSubParts( false, 0, uhDepth ); 2210 #endif 2211 rpcTempCU->setPartSizeSubParts ( ePartSize, 0, uhDepth ); 2212 rpcTempCU->setPredModeSubParts ( MODE_INTER, 0, uhDepth ); 2213 #if H_3D_ARP 2214 rpcTempCU->setARPWSubParts( (UChar)nARPW , 0 , uhDepth ); 2215 #endif 2216 #if H_3D_ARP 2217 if( bFirstTime == false && nARPWMax ) 2401 2218 { 2402 iSdcOffset = uiOffest >> 1; 2219 rpcTempCU->copyPartFrom( m_ppcWeightedTempCU[uhDepth] , 0 , uhDepth ); 2220 rpcTempCU->setARPWSubParts( (UChar)nARPW , 0 , uhDepth ); 2221 2222 m_pcPredSearch->motionCompensation( rpcTempCU , m_ppcPredYuvTemp[uhDepth] ); 2403 2223 } 2404 2224 else 2405 2225 { 2406 iSdcOffset = -1 * (uiOffest >> 1); 2226 bFirstTime = false; 2227 #endif 2228 #if AMP_MRG 2229 rpcTempCU->setMergeAMP (true); 2230 #if H_3D_FAST_TEXTURE_ENCODING 2231 m_pcPredSearch->predInterSearch ( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcRecoYuvTemp[uhDepth], bFMD, false, bUseMRG ); 2232 #else 2233 m_pcPredSearch->predInterSearch ( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcRecoYuvTemp[uhDepth], false, bUseMRG ); 2234 #endif 2235 #else 2236 m_pcPredSearch->predInterSearch ( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcRecoYuvTemp[uhDepth] ); 2237 #endif 2238 #if H_3D_ARP 2239 if( nARPWMax ) 2240 { 2241 m_ppcWeightedTempCU[uhDepth]->copyPartFrom( rpcTempCU , 0 , uhDepth ); 2242 } 2407 2243 } 2408 m_pcPredSearch->encodeResAndCalcRdInterSDCCU( rpcTempCU, 2409 m_ppcOrigYuv[uhDepth], 2410 ( rpcTempCU != rpcTempCUPre ) ? m_ppcPredYuvBest[uhDepth] : m_ppcPredYuvTemp[uhDepth], 2411 m_ppcResiYuvTemp[uhDepth], 2412 m_ppcRecoYuvTemp[uhDepth], 2413 iSdcOffset, 2414 uhDepth ); 2415 if (uiOffest <= 3 ) 2244 #endif 2245 2246 #if AMP_MRG 2247 if ( !rpcTempCU->getMergeAMP() ) 2416 2248 { 2417 dOffsetCost [uiOffest -1] = rpcTempCU->getTotalCost(); 2249 #if H_3D_ARP 2250 if( nARPWMax ) 2251 { 2252 continue; 2253 } 2254 else 2255 #endif 2256 return; 2418 2257 } 2419 2258 #endif 2259 2260 #if KWU_RC_MADPRED_E0227 2261 if ( m_pcEncCfg->getUseRateCtrl() && m_pcEncCfg->getLCULevelRC() && ePartSize == SIZE_2Nx2N && uhDepth <= m_addSADDepth ) 2262 { 2263 UInt SAD = m_pcRdCost->getSADPart( g_bitDepthY, m_ppcPredYuvTemp[uhDepth]->getLumaAddr(), m_ppcPredYuvTemp[uhDepth]->getStride(), 2264 m_ppcOrigYuv[uhDepth]->getLumaAddr(), m_ppcOrigYuv[uhDepth]->getStride(), 2265 rpcTempCU->getWidth(0), rpcTempCU->getHeight(0) ); 2266 m_temporalSAD = (Int)SAD; 2267 } 2268 #endif 2269 m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcResiYuvBest[uhDepth], m_ppcRecoYuvTemp[uhDepth], false ); 2270 #if H_3D_VSP // possible bug fix 2271 if( rpcTempCU->getQtRootCbf(0)==0 ) 2272 { 2273 rpcTempCU->setTrIdxSubParts(0, 0, uhDepth); 2274 } 2275 #endif 2276 #if H_3D_VSO // M4 2277 if( m_pcRdCost->getUseLambdaScaleVSO() ) 2278 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCostVSO( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 2279 else 2280 #endif 2281 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 2282 #if H_3D_INTER_SDC 2283 TComDataCU *rpcTempCUPre = rpcTempCU; 2284 #endif 2420 2285 xCheckDQP( rpcTempCU ); 2421 2286 xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth); 2422 } 2423 2424 } 2287 #if H_3D_INTER_SDC 2288 if( rpcTempCU->getSlice()->getInterSdcFlag() && ePartSize == SIZE_2Nx2N) 2289 { 2290 Double dOffsetCost[3] = {MAX_DOUBLE,MAX_DOUBLE,MAX_DOUBLE}; 2291 for( Int uiOffest = 1 ; uiOffest <= 5 ; uiOffest++ ) 2292 { 2293 if( uiOffest > 3) 2294 { 2295 if ( dOffsetCost[0] < (0.9*dOffsetCost[1]) && dOffsetCost[0] < (0.9*dOffsetCost[2]) ) 2296 { 2297 continue; 2298 } 2299 if ( dOffsetCost[1] < dOffsetCost[0] && dOffsetCost[0] < dOffsetCost[2] && uiOffest == 5) 2300 { 2301 continue; 2302 } 2303 if ( dOffsetCost[0] < dOffsetCost[1] && dOffsetCost[2] < dOffsetCost[0] && uiOffest == 4) 2304 { 2305 continue; 2306 } 2307 } 2308 2309 if( rpcTempCU != rpcTempCUPre ) 2310 { 2311 Int orgQP = rpcBestCU->getQP( 0 ); 2312 rpcTempCU->initEstData( uhDepth, orgQP ,bTransquantBypassFlag ); 2313 rpcTempCU->copyPartFrom( rpcBestCU, 0, uhDepth ); 2314 } 2315 rpcTempCU->setSkipFlagSubParts( false, 0, uhDepth ); 2316 #if H_3D 2317 rpcTempCU->setDISFlagSubParts( false, 0, uhDepth ); 2318 #endif 2319 rpcTempCU->setTrIdxSubParts( 0, 0, uhDepth ); 2320 rpcTempCU->setCbfSubParts( 1, 1, 1, 0, uhDepth ); 2321 #if H_3D_VSO // M3 2322 if( m_pcRdCost->getUseRenModel() ) 2323 { 2324 UInt uiWidth = m_ppcOrigYuv[uhDepth]->getWidth ( ); 2325 UInt uiHeight = m_ppcOrigYuv[uhDepth]->getHeight( ); 2326 Pel* piSrc = m_ppcOrigYuv[uhDepth]->getLumaAddr( ); 2327 UInt uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride(); 2328 m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight ); 2329 } 2330 #endif 2331 2332 Int iSdcOffset = 0; 2333 if(uiOffest % 2 == 0) 2334 { 2335 iSdcOffset = uiOffest >> 1; 2336 } 2337 else 2338 { 2339 iSdcOffset = -1 * (uiOffest >> 1); 2340 } 2341 m_pcPredSearch->encodeResAndCalcRdInterSDCCU( rpcTempCU, 2342 m_ppcOrigYuv[uhDepth], 2343 ( rpcTempCU != rpcTempCUPre ) ? m_ppcPredYuvBest[uhDepth] : m_ppcPredYuvTemp[uhDepth], 2344 m_ppcResiYuvTemp[uhDepth], 2345 m_ppcRecoYuvTemp[uhDepth], 2346 iSdcOffset, 2347 uhDepth ); 2348 if (uiOffest <= 3 ) 2349 { 2350 dOffsetCost [uiOffest -1] = rpcTempCU->getTotalCost(); 2351 } 2352 2353 xCheckDQP( rpcTempCU ); 2354 xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth); 2355 } 2356 2357 } 2425 2358 #endif 2426 2359 #if H_3D_ARP 2427 }2360 } 2428 2361 #endif 2429 2362 #if H_3D_FAST_TEXTURE_ENCODING … … 2492 2425 } 2493 2426 2494 #if SEC_DEPTH_INTRA_SKIP_MODE_K00332495 2427 Void TEncCu::xCheckRDCostDIS( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize eSize ) 2496 2428 { … … 2564 2496 xCheckBestMode(rpcBestCU, rpcTempCU, uiDepth); 2565 2497 } 2566 #else2567 #if H_3D_SINGLE_DEPTH2568 Void TEncCu::xCheckRDCostSingleDepth( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize eSize )2569 {2570 UInt uiDepth = rpcTempCU->getDepth( 0 );2571 if( !rpcBestCU->getSlice()->getIsDepth() || (eSize != SIZE_2Nx2N))2572 {2573 return;2574 }2575 2576 #if H_3D_VSO // M52577 if( m_pcRdCost->getUseRenModel() )2578 {2579 UInt uiWidth = m_ppcOrigYuv[uiDepth]->getWidth ();2580 UInt uiHeight = m_ppcOrigYuv[uiDepth]->getHeight ();2581 Pel* piSrc = m_ppcOrigYuv[uiDepth]->getLumaAddr();2582 UInt uiSrcStride = m_ppcOrigYuv[uiDepth]->getStride ();2583 m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );2584 }2585 #endif2586 2587 rpcTempCU->setSkipFlagSubParts( false, 0, uiDepth );2588 rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth );2589 rpcTempCU->setPredModeSubParts( MODE_INTRA, 0, uiDepth );2590 rpcTempCU->setCUTransquantBypassSubParts( rpcTempCU->getCUTransquantBypass(0), 0, uiDepth );2591 2592 rpcTempCU->setTrIdxSubParts(0, 0, uiDepth);2593 rpcTempCU->setCbfSubParts(0, 1, 1, 0, uiDepth);2594 rpcTempCU->setSingleDepthFlagSubParts(true, 0, uiDepth);2595 rpcTempCU->setLumaIntraDirSubParts (DC_IDX, 0, uiDepth);2596 #if H_3D_DIM_SDC2597 rpcTempCU->setSDCFlagSubParts( false, 0, uiDepth);2598 #endif2599 2600 UInt uiPreCalcDistC;2601 m_pcPredSearch ->estIntraPredSingleDepth ( rpcTempCU, m_ppcOrigYuv[uiDepth], m_ppcPredYuvTemp[uiDepth], m_ppcResiYuvTemp[uiDepth], m_ppcRecoYuvTemp[uiDepth], uiPreCalcDistC, false );2602 2603 2604 m_ppcRecoYuvTemp[uiDepth]->copyToPicLuma(rpcTempCU->getPic()->getPicYuvRec(), rpcTempCU->getAddr(), rpcTempCU->getZorderIdxInCU() );2605 2606 2607 m_pcEntropyCoder->resetBits();2608 if ( rpcTempCU->getSlice()->getPPS()->getTransquantBypassEnableFlag())2609 {2610 m_pcEntropyCoder->encodeCUTransquantBypassFlag( rpcTempCU, 0, true );2611 }2612 m_pcEntropyCoder->encodeSkipFlag ( rpcTempCU, 0, true );2613 m_pcEntropyCoder->encodeSingleDepthMode( rpcTempCU, 0, true );2614 2615 2616 m_pcRDGoOnSbacCoder->store(m_pppcRDSbacCoder[uiDepth][CI_TEMP_BEST]);2617 2618 rpcTempCU->getTotalBits() = m_pcEntropyCoder->getNumberOfWrittenBits();2619 rpcTempCU->getTotalBins() = ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded();2620 2621 2622 #if H_3D_VSO // M62623 if( m_pcRdCost->getUseLambdaScaleVSO())2624 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCostVSO( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );2625 else2626 #endif2627 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );2628 2629 2630 xCheckDQP( rpcTempCU );2631 xCheckBestMode(rpcBestCU, rpcTempCU, uiDepth);2632 }2633 #endif2634 #endif2635 2498 2636 2499 Void TEncCu::xCheckRDCostInterDBBP( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, Bool bUseMRG ) … … 2675 2538 AOF( uiDepthStride != 0 ); 2676 2539 2677 #if HS_DBBP_CLEAN_K00482678 2540 PartSize eVirtualPartSize = m_pcPredSearch->getPartitionSizeFromDepth(pDepthPels, uiDepthStride, uiWidth, rpcTempCU); 2679 2541 … … 2681 2543 Bool pMask[MAX_CU_SIZE*MAX_CU_SIZE]; 2682 2544 Bool bValidMask = m_pcPredSearch->getSegmentMaskFromDepth(pDepthPels, uiDepthStride, uiWidth, uiHeight, pMask, rpcTempCU); 2683 #else2684 PartSize eVirtualPartSize = m_pcPredSearch->getPartitionSizeFromDepth(pDepthPels, uiDepthStride, uiWidth);2685 2686 // derive segmentation mask from depth2687 Bool pMask[MAX_CU_SIZE*MAX_CU_SIZE];2688 Bool bValidMask = m_pcPredSearch->getSegmentMaskFromDepth(pDepthPels, uiDepthStride, uiWidth, uiHeight, pMask);2689 #endif2690 2545 2691 2546 if( !bValidMask ) … … 2696 2551 // find optimal motion/disparity vector for each segment 2697 2552 DisInfo originalDvInfo = rpcTempCU->getDvInfo(0); 2698 D BBPTmpData* pDBBPTmpData = rpcTempCU->getDBBPTmpData();2553 DbbpTmpData* pDBBPTmpData = rpcTempCU->getDBBPTmpData(); 2699 2554 TComYuv* apPredYuv[2] = { m_ppcRecoYuvTemp[uhDepth], m_ppcPredYuvTemp[uhDepth] }; 2700 2555 … … 2777 2632 } 2778 2633 #endif 2634 2779 2635 #if H_3D_DIM 2780 2636 Void TEncCu::xCheckRDCostIntra( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize eSize, Bool bOnlyIVP ) … … 2796 2652 2797 2653 rpcTempCU->setSkipFlagSubParts( false, 0, uiDepth ); 2798 #if SEC_DEPTH_INTRA_SKIP_MODE_K00332654 #if H_3D 2799 2655 rpcTempCU->setDISFlagSubParts( false, 0, uiDepth ); 2800 #else2801 #if H_3D_SINGLE_DEPTH2802 rpcTempCU->setSingleDepthFlagSubParts( false, 0, uiDepth );2803 #endif2804 2656 #endif 2805 2657 rpcTempCU->setPartSizeSubParts( eSize, 0, uiDepth ); … … 2820 2672 2821 2673 #if H_3D_DIM_SDC 2822 #if 0 // H_3D_DISABLE_CHROMA2823 if( !rpcTempCU->getSDCFlag( 0 ) && !rpcTempCU->getSlice()->getIsDepth() )2824 #else2825 2674 if( !rpcTempCU->getSDCFlag( 0 ) ) 2826 2675 #endif 2827 #endif 2828 m_pcPredSearch ->estIntraPredChromaQT( rpcTempCU, m_ppcOrigYuv[uiDepth], m_ppcPredYuvTemp[uiDepth], m_ppcResiYuvTemp[uiDepth], m_ppcRecoYuvTemp[uiDepth], uiPreCalcDistC ); 2676 m_pcPredSearch ->estIntraPredChromaQT( rpcTempCU, m_ppcOrigYuv[uiDepth], m_ppcPredYuvTemp[uiDepth], m_ppcResiYuvTemp[uiDepth], m_ppcRecoYuvTemp[uiDepth], uiPreCalcDistC ); 2829 2677 2830 2678 m_pcEntropyCoder->resetBits(); … … 2834 2682 } 2835 2683 m_pcEntropyCoder->encodeSkipFlag ( rpcTempCU, 0, true ); 2836 #if SEC_DEPTH_INTRA_SKIP_MODE_K00332684 #if H_3D 2837 2685 m_pcEntropyCoder->encodeDIS( rpcTempCU, 0, true ); 2838 2686 if(!rpcTempCU->getDISFlag(0)) 2839 2687 { 2840 #else 2841 #if H_3D_SINGLE_DEPTH 2842 m_pcEntropyCoder->encodeSingleDepthMode( rpcTempCU, 0, true ); 2843 if(!rpcTempCU->getSingleDepthFlag(0)) 2844 { 2845 #endif 2846 #endif 2847 m_pcEntropyCoder->encodePredMode( rpcTempCU, 0, true ); 2848 m_pcEntropyCoder->encodePartSize( rpcTempCU, 0, uiDepth, true ); 2849 #if !HHI_MOVE_SYN_K0052 2688 #endif 2689 m_pcEntropyCoder->encodePredMode( rpcTempCU, 0, true ); 2690 m_pcEntropyCoder->encodePartSize( rpcTempCU, 0, uiDepth, true ); 2691 m_pcEntropyCoder->encodePredInfo( rpcTempCU, 0, true ); 2692 m_pcEntropyCoder->encodeIPCMInfo(rpcTempCU, 0, true ); 2850 2693 #if H_3D_DIM_SDC 2851 m_pcEntropyCoder->encodeSDCFlag( rpcTempCU, 0, true ); 2852 #endif 2853 #endif 2854 m_pcEntropyCoder->encodePredInfo( rpcTempCU, 0, true ); 2855 m_pcEntropyCoder->encodeIPCMInfo(rpcTempCU, 0, true ); 2856 #if HHI_MOVE_SYN_K0052 2857 #if H_3D_DIM_SDC 2858 m_pcEntropyCoder->encodeSDCFlag( rpcTempCU, 0, true ); 2859 #endif 2860 #endif 2861 2862 // Encode Coefficients 2863 Bool bCodeDQP = getdQPFlag(); 2694 m_pcEntropyCoder->encodeSDCFlag( rpcTempCU, 0, true ); 2695 #endif 2696 2697 // Encode Coefficients 2698 Bool bCodeDQP = getdQPFlag(); 2864 2699 #if H_3D_DISABLE_CHROMA 2865 m_pcEntropyCoder->encodeCoeff( rpcTempCU, 0, uiDepth, rpcTempCU->getWidth (0), rpcTempCU->getHeight(0), bCodeDQP, true ); 2866 #else 2867 m_pcEntropyCoder->encodeCoeff( rpcTempCU, 0, uiDepth, rpcTempCU->getWidth (0), rpcTempCU->getHeight(0), bCodeDQP ); 2868 #endif 2869 2870 2871 setdQPFlag( bCodeDQP ); 2872 #if SEC_DEPTH_INTRA_SKIP_MODE_K0033 2873 } 2874 #else 2875 #if H_3D_SINGLE_DEPTH 2876 } 2877 #endif 2700 m_pcEntropyCoder->encodeCoeff( rpcTempCU, 0, uiDepth, rpcTempCU->getWidth (0), rpcTempCU->getHeight(0), bCodeDQP, true ); 2701 #else 2702 m_pcEntropyCoder->encodeCoeff( rpcTempCU, 0, uiDepth, rpcTempCU->getWidth (0), rpcTempCU->getHeight(0), bCodeDQP ); 2703 #endif 2704 setdQPFlag( bCodeDQP ); 2705 #if H_3D 2706 } 2878 2707 #endif 2879 2708 m_pcRDGoOnSbacCoder->store(m_pppcRDSbacCoder[uiDepth][CI_TEMP_BEST]); 2880 2709 2881 2710 rpcTempCU->getTotalBits() = m_pcEntropyCoder->getNumberOfWrittenBits(); 2882 2711 rpcTempCU->getTotalBins() = ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded(); 2883 2712 #if H_3D_VSO // M6 2884 2713 if( m_pcRdCost->getUseLambdaScaleVSO()) … … 2904 2733 2905 2734 rpcTempCU->setSkipFlagSubParts( false, 0, uiDepth ); 2906 #if SEC_DEPTH_INTRA_SKIP_MODE_K00332735 #if H_3D 2907 2736 rpcTempCU->setDISFlagSubParts( false, 0, uiDepth ); 2908 #else2909 #if H_3D_SINGLE_DEPTH2910 rpcTempCU->setSingleDepthFlagSubParts( false, 0, uiDepth );2911 #endif2912 2737 #endif 2913 2738 rpcTempCU->setIPCMFlag(0, true); … … 2927 2752 } 2928 2753 m_pcEntropyCoder->encodeSkipFlag ( rpcTempCU, 0, true ); 2929 #if SEC_DEPTH_INTRA_SKIP_MODE_K00332754 #if H_3D 2930 2755 m_pcEntropyCoder->encodeDIS( rpcTempCU, 0, true ); 2931 #else2932 #if H_3D_SINGLE_DEPTH2933 m_pcEntropyCoder->encodeSingleDepthMode( rpcTempCU, 0, true );2934 #endif2935 2756 #endif 2936 2757 m_pcEntropyCoder->encodePredMode ( rpcTempCU, 0, true ); 2937 2758 m_pcEntropyCoder->encodePartSize ( rpcTempCU, 0, uiDepth, true ); 2938 #if !HHI_MOVE_SYN_K0052 2759 m_pcEntropyCoder->encodeIPCMInfo ( rpcTempCU, 0, true ); 2939 2760 #if H_3D_DIM_SDC 2940 2761 m_pcEntropyCoder->encodeSDCFlag( rpcTempCU, 0, true ); 2941 #endif2942 #endif2943 m_pcEntropyCoder->encodeIPCMInfo ( rpcTempCU, 0, true );2944 #if HHI_MOVE_SYN_K00522945 #if H_3D_DIM_SDC2946 m_pcEntropyCoder->encodeSDCFlag( rpcTempCU, 0, true );2947 #endif2948 2762 #endif 2949 2763 m_pcRDGoOnSbacCoder->store(m_pppcRDSbacCoder[uiDepth][CI_TEMP_BEST]); -
trunk/source/Lib/TLibEncoder/TEncCu.h
r1179 r1196 159 159 Void xCheckRDCostInterDBBP( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, Bool bUseMRG = false ); 160 160 #endif 161 #if SEC_DEPTH_INTRA_SKIP_MODE_K0033161 #if H_3D 162 162 Void xCheckRDCostDIS ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize ); 163 #else164 #if H_3D_SINGLE_DEPTH165 Void xCheckRDCostSingleDepth ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize );166 #endif167 163 #endif 168 164 #if H_3D_DIM -
trunk/source/Lib/TLibEncoder/TEncEntropy.cpp
r1179 r1196 111 111 m_pcEntropyCoderIf->codeSkipFlag( pcCU, uiAbsPartIdx ); 112 112 } 113 114 #if SEC_DEPTH_INTRA_SKIP_MODE_K0033 113 #if H_3D 115 114 Void TEncEntropy::encodeDIS( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD ) 116 115 { … … 125 124 m_pcEntropyCoderIf->codeDIS( pcCU, uiAbsPartIdx ); 126 125 } 127 #else 128 #if H_3D_SINGLE_DEPTH 129 Void TEncEntropy::encodeSingleDepthMode( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD ) 130 { 131 if(!pcCU->getSlice()->getIntraSingleFlag() ) 132 { 133 return; 134 } 135 if( bRD ) 136 { 137 uiAbsPartIdx = 0; 138 } 139 m_pcEntropyCoderIf->codeSingleDepthMode( pcCU, uiAbsPartIdx ); 140 } 141 #endif 142 #endif 143 126 #endif 144 127 /** encode merge flag 145 128 * \param pcCU … … 271 254 m_pcEntropyCoderIf->codePartSize( pcCU, uiAbsPartIdx, uiDepth ); 272 255 273 #if !HHI_MOVE_SYN_K0052274 #if H_3D_DBBP275 if( pcCU->getSlice()->getDepthBasedBlkPartFlag() && (pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2NxN || pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_Nx2N) && pcCU->getWidth(uiAbsPartIdx) > 8 && pcCU->getSlice()->getDefaultRefViewIdxAvailableFlag() )276 {277 encodeDBBPFlag(pcCU, uiAbsPartIdx, bRD);278 }279 #endif280 #endif281 256 } 282 257 … … 586 561 #endif 587 562 #endif 588 encodeIntraDirModeChroma( pcCU, uiAbsPartIdx, bRD );563 encodeIntraDirModeChroma( pcCU, uiAbsPartIdx, bRD ); 589 564 } 590 565 else // if it is Inter mode, encode motion vector and reference index … … 904 879 Void TEncEntropy::encodeDBBPFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD ) 905 880 { 906 #if HHI_MOVE_SYN_K0052907 881 if( pcCU->getSlice()->getDepthBasedBlkPartFlag() && 908 882 ( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2NxN || … … 911 885 pcCU->getSlice()->getDefaultRefViewIdxAvailableFlag() ) 912 886 { 913 #endif914 887 if( bRD ) 915 888 { … … 917 890 } 918 891 m_pcEntropyCoderIf->codeDBBPFlag( pcCU, uiAbsPartIdx ); 919 #if HHI_MOVE_SYN_K0052 920 } 921 #endif 892 } 922 893 } 923 894 #endif -
trunk/source/Lib/TLibEncoder/TEncEntropy.h
r1179 r1196 82 82 virtual Void codeCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0; 83 83 virtual Void codeSkipFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0; 84 #if SEC_DEPTH_INTRA_SKIP_MODE_K003384 #if H_3D 85 85 virtual Void codeDIS ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0; 86 #else87 #if H_3D_SINGLE_DEPTH88 virtual Void codeSingleDepthMode ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;89 #endif90 86 #endif 91 87 virtual Void codeMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0; … … 179 175 Void encodeCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false ); 180 176 Void encodeSkipFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false ); 181 #if SEC_DEPTH_INTRA_SKIP_MODE_K0033177 #if H_3D 182 178 Void encodeDIS ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD=false ); 183 #else184 #if H_3D_SINGLE_DEPTH185 Void encodeSingleDepthMode( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD=false );186 #endif187 179 #endif 188 180 Void encodePUWise ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false ); -
trunk/source/Lib/TLibEncoder/TEncGOP.cpp
r1179 r1196 395 395 Void TEncGOP::initGOP( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsInGOP) 396 396 { 397 #if H_MV_ALIGN_HM_15398 397 xInitGOP( iPOCLast, iNumPicRcvd, rcListPic, rcListPicYuvRecOut, false ); 399 #else400 xInitGOP( iPOCLast, iNumPicRcvd, rcListPic, rcListPicYuvRecOut );401 #endif402 398 m_iNumPicCoded = 0; 403 399 } … … 885 881 Int numDirectRefLayers = vps ->getNumDirectRefLayers( getLayerId() ); 886 882 #endif 887 #if H HI_INTER_COMP_PRED_K0052883 #if H_3D 888 884 pcSlice->setIvPicLists( m_ivPicLists ); 889 885 … … 893 889 GOPEntry gopEntry = m_pcCfg->getGOPEntry( (pcSlice->getRapPicFlag() && getLayerId() > 0) ? MAX_GOP : iGOPid ); 894 890 #endif 891 892 895 893 896 894 Bool interLayerPredLayerIdcPresentFlag = false; … … 929 927 assert( pcSlice->getNumActiveRefLayerPics() == gopEntry.m_numActiveRefLayerPics ); 930 928 931 #if HHI_INTER_COMP_PRED_K0052932 929 #if H_3D 933 930 if ( m_pcEncTop->decProcAnnexI() ) … … 962 959 pcSlice->setMaxNumMergeCand ( m_pcCfg->getMaxNumMergeCand() + ( ( pcSlice->getMpiFlag( ) || pcSlice->getIvMvPredFlag( ) || pcSlice->getViewSynthesisPredFlag( ) ) ? 1 : 0 )); 963 960 #endif 964 #endif965 961 966 962 pcSlice->createInterLayerReferencePictureSet( m_ivPicLists, m_refPicSetInterLayer0, m_refPicSetInterLayer1 ); … … 1009 1005 } 1010 1006 } 1011 #endif1012 #if !HHI_INTER_COMP_PRED_K00521013 #if H_3D1014 pcSlice->setIvPicLists( m_ivPicLists );1015 #if H_3D_IV_MERGE1016 assert( !m_pcEncTop->getIsDepth() || ( pcSlice->getTexturePic() != 0 ) );1017 #endif1018 #endif1019 1007 #endif 1020 1008 #if H_3D_IC -
trunk/source/Lib/TLibEncoder/TEncSbac.cpp
r1179 r1196 58 58 , m_cCUSplitFlagSCModel ( 1, 1, NUM_SPLIT_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels ) 59 59 , m_cCUSkipFlagSCModel ( 1, 1, NUM_SKIP_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 60 #if SEC_DEPTH_INTRA_SKIP_MODE_K003360 #if H_3D 61 61 , m_cCUDISFlagSCModel ( 1, 1, NUM_DIS_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 62 62 , m_cCUDISTypeSCModel ( 1, 1, NUM_DIS_TYPE_CTX , m_contextModels + m_numContextModels, m_numContextModels) 63 #else64 #if H_3D_SINGLE_DEPTH65 , m_cCUSingleDepthFlagSCModel ( 1, 1, NUM_SINGLEDEPTH_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels)66 , m_cSingleDepthValueSCModel ( 1, 1, NUM_SINGLE_DEPTH_VALUE_DATA_CTX , m_contextModels + m_numContextModels, m_numContextModels)67 #endif68 63 #endif 69 64 , m_cCUMergeFlagExtSCModel ( 1, 1, NUM_MERGE_FLAG_EXT_CTX , m_contextModels + m_numContextModels, m_numContextModels) … … 139 134 140 135 m_cCUSkipFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SKIP_FLAG ); 141 #if SEC_DEPTH_INTRA_SKIP_MODE_K0033136 #if H_3D 142 137 m_cCUDISFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DIS_FLAG ); 143 138 m_cCUDISTypeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DIS_TYPE ); 144 #else145 #if H_3D_SINGLE_DEPTH146 m_cCUSingleDepthFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SINGLEDEPTH_FLAG );147 m_cSingleDepthValueSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SINGLE_DEPTH_VALUE_DATA );148 #endif149 139 #endif 150 140 m_cCUMergeFlagExtSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_MERGE_FLAG_EXT); … … 224 214 curCost = m_cCUSplitFlagSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_SPLIT_FLAG ); 225 215 curCost += m_cCUSkipFlagSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_SKIP_FLAG ); 226 #if SEC_DEPTH_INTRA_SKIP_MODE_K0033216 #if H_3D 227 217 curCost += m_cCUDISFlagSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_DIS_FLAG ); 228 218 curCost += m_cCUDISTypeSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_DIS_TYPE ); 229 #else230 #if H_3D_SINGLE_DEPTH231 curCost += m_cCUSingleDepthFlagSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_SINGLEDEPTH_FLAG );232 curCost += m_cSingleDepthValueSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_SINGLE_DEPTH_VALUE_DATA );233 #endif234 219 #endif 235 220 curCost += m_cCUMergeFlagExtSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_MERGE_FLAG_EXT); … … 270 255 curCost += m_CUTransquantBypassFlagSCModel.calcCost( curSliceType, qp, (UChar*)INIT_CU_TRANSQUANT_BYPASS_FLAG ); 271 256 #if H_3D_DIM 272 if( m_pcSlice->getIntraSdcWedgeFlag() || m_pcSlice->getIntraContourFlag() )273 {274 curCost += m_cDepthIntraModeSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_DEPTH_INTRA_MODE );275 curCost += m_cDdcFlagSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_DDC_FLAG );276 curCost += m_cDdcDataSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_DDC_DATA );277 curCost += m_cAngleFlagSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_ANGLE_FLAG );278 }257 if( m_pcSlice->getIntraSdcWedgeFlag() || m_pcSlice->getIntraContourFlag() ) 258 { 259 curCost += m_cDepthIntraModeSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_DEPTH_INTRA_MODE ); 260 curCost += m_cDdcFlagSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_DDC_FLAG ); 261 curCost += m_cDdcDataSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_DDC_DATA ); 262 curCost += m_cAngleFlagSCModel.calcCost ( curSliceType, qp, (UChar*)INIT_ANGLE_FLAG ); 263 } 279 264 #endif 280 265 if (curCost < bestCost) … … 302 287 303 288 m_cCUSkipFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SKIP_FLAG ); 304 #if SEC_DEPTH_INTRA_SKIP_MODE_K0033289 #if H_3D 305 290 m_cCUDISFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DIS_FLAG ); 306 291 m_cCUDISTypeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DIS_TYPE ); 307 #else308 #if H_3D_SINGLE_DEPTH309 m_cCUSingleDepthFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SINGLEDEPTH_FLAG );310 m_cSingleDepthValueSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SINGLE_DEPTH_VALUE_DATA );311 #endif312 292 #endif 313 293 m_cCUMergeFlagExtSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_MERGE_FLAG_EXT); … … 466 446 m_pcBinIf->encodeBinsEP( bins, numBins ); 467 447 } 468 469 #if SEC_DEPTH_INTRA_SKIP_MODE_K0033 448 #if H_3D 470 449 Void TEncSbac::codeDIS( TComDataCU* pcCU, UInt uiAbsPartIdx ) 471 450 { … … 498 477 } 499 478 } 500 #else 501 #if H_3D_SINGLE_DEPTH 502 Void TEncSbac::codeSingleDepthMode( TComDataCU* pcCU, UInt uiAbsPartIdx ) 503 { 504 UInt uiSymbol = pcCU->getSingleDepthFlag(uiAbsPartIdx ) ? 1 : 0; 505 m_pcBinIf->encodeBin( uiSymbol, m_cCUSingleDepthFlagSCModel.get( 0, 0, 0 ) ); 506 if(uiSymbol) 507 { 508 UInt uiUnaryIdx = (UInt) pcCU->getSingleDepthValue(uiAbsPartIdx); 509 UInt uiNumCand = SINGLE_DEPTH_MODE_CAND_LIST_SIZE; 510 if ( uiNumCand > 1 ) 511 { 512 for( UInt ui = 0; ui < uiNumCand - 1; ++ui ) 513 { 514 const UInt uiSymbol2 = ui == uiUnaryIdx ? 0 : 1; 515 if ( ui==0 ) 516 { 517 m_pcBinIf->encodeBin( uiSymbol2, m_cSingleDepthValueSCModel.get( 0, 0, 0 ) ); 518 } 519 else 520 { 521 m_pcBinIf->encodeBinEP( uiSymbol2 ); 522 } 523 if( uiSymbol2 == 0 ) 524 { 525 break; 526 } 527 } 528 } 529 } 530 } 531 #endif 532 #endif 533 479 #endif 534 480 /** Coding of coeff_abs_level_minus3 535 481 * \param uiSymbol value of coeff_abs_level_minus3 … … 680 626 Bool bDepthMapDetect = (pcTexture != NULL); 681 627 Bool bIntraSliceDetect = (pcCU->getSlice()->getSliceType() == I_SLICE); 682 628 683 629 Bool rapPic = (pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP || pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA); 684 630 … … 718 664 return; 719 665 } 720 666 721 667 #if H_MV_ENC_DEC_TRAC 722 668 DTRACE_CU("part_mode", eSize ) … … 726 672 { 727 673 #endif 728 switch(eSize)729 {730 case SIZE_2Nx2N:731 {732 m_pcBinIf->encodeBin( 1, m_cCUPartSizeSCModel.get( 0, 0, 0) );733 break;734 }735 case SIZE_2NxN:736 case SIZE_2NxnU:737 case SIZE_2NxnD:738 {739 m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 0) );740 m_pcBinIf->encodeBin( 1, m_cCUPartSizeSCModel.get( 0, 0, 1) );741 if ( pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth ) )742 {743 if (eSize == SIZE_2NxN)744 {745 m_pcBinIf->encodeBin(1, m_cCUPartSizeSCModel.get( 0, 0, 3 ));746 }747 else748 {749 m_pcBinIf->encodeBin(0, m_cCUPartSizeSCModel.get( 0, 0, 3 ));750 m_pcBinIf->encodeBinEP((eSize == SIZE_2NxnU? 0: 1));751 }752 }753 break;754 }755 case SIZE_Nx2N:756 case SIZE_nLx2N:757 case SIZE_nRx2N:758 {759 m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 0) );760 m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 1) );761 if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth && !( pcCU->getWidth(uiAbsPartIdx) == 8 && pcCU->getHeight(uiAbsPartIdx) == 8 ) )762 {763 m_pcBinIf->encodeBin( 1, m_cCUPartSizeSCModel.get( 0, 0, 2) );764 }765 if ( pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth ) )766 {767 if (eSize == SIZE_Nx2N)768 {769 m_pcBinIf->encodeBin(1, m_cCUPartSizeSCModel.get( 0, 0, 3 ));770 }771 else772 {773 m_pcBinIf->encodeBin(0, m_cCUPartSizeSCModel.get( 0, 0, 3 ));774 m_pcBinIf->encodeBinEP((eSize == SIZE_nLx2N? 0: 1));775 }776 }777 break;778 }779 case SIZE_NxN:780 {781 if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth && !( pcCU->getWidth(uiAbsPartIdx) == 8 && pcCU->getHeight(uiAbsPartIdx) == 8 ) )782 {783 m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 0) );784 m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 1) );785 m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 2) );786 }787 break;788 }789 default:790 {791 assert(0);792 }793 }674 switch(eSize) 675 { 676 case SIZE_2Nx2N: 677 { 678 m_pcBinIf->encodeBin( 1, m_cCUPartSizeSCModel.get( 0, 0, 0) ); 679 break; 680 } 681 case SIZE_2NxN: 682 case SIZE_2NxnU: 683 case SIZE_2NxnD: 684 { 685 m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 0) ); 686 m_pcBinIf->encodeBin( 1, m_cCUPartSizeSCModel.get( 0, 0, 1) ); 687 if ( pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth ) ) 688 { 689 if (eSize == SIZE_2NxN) 690 { 691 m_pcBinIf->encodeBin(1, m_cCUPartSizeSCModel.get( 0, 0, 3 )); 692 } 693 else 694 { 695 m_pcBinIf->encodeBin(0, m_cCUPartSizeSCModel.get( 0, 0, 3 )); 696 m_pcBinIf->encodeBinEP((eSize == SIZE_2NxnU? 0: 1)); 697 } 698 } 699 break; 700 } 701 case SIZE_Nx2N: 702 case SIZE_nLx2N: 703 case SIZE_nRx2N: 704 { 705 m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 0) ); 706 m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 1) ); 707 if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth && !( pcCU->getWidth(uiAbsPartIdx) == 8 && pcCU->getHeight(uiAbsPartIdx) == 8 ) ) 708 { 709 m_pcBinIf->encodeBin( 1, m_cCUPartSizeSCModel.get( 0, 0, 2) ); 710 } 711 if ( pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth ) ) 712 { 713 if (eSize == SIZE_Nx2N) 714 { 715 m_pcBinIf->encodeBin(1, m_cCUPartSizeSCModel.get( 0, 0, 3 )); 716 } 717 else 718 { 719 m_pcBinIf->encodeBin(0, m_cCUPartSizeSCModel.get( 0, 0, 3 )); 720 m_pcBinIf->encodeBinEP((eSize == SIZE_nLx2N? 0: 1)); 721 } 722 } 723 break; 724 } 725 case SIZE_NxN: 726 { 727 if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth && !( pcCU->getWidth(uiAbsPartIdx) == 8 && pcCU->getHeight(uiAbsPartIdx) == 8 ) ) 728 { 729 m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 0) ); 730 m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 1) ); 731 m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 2) ); 732 } 733 break; 734 } 735 default: 736 { 737 assert(0); 738 } 739 } 794 740 #if H_3D_QTLPC 795 741 } … … 1143 1089 { 1144 1090 #endif 1145 if(predIdx[j] != -1)1146 {1147 m_pcBinIf->encodeBinEP( predIdx[j] ? 1 : 0 );1148 if (predIdx[j])1149 {1150 m_pcBinIf->encodeBinEP( predIdx[j]-1 );1151 }1091 if(predIdx[j] != -1) 1092 { 1093 m_pcBinIf->encodeBinEP( predIdx[j] ? 1 : 0 ); 1094 if (predIdx[j]) 1095 { 1096 m_pcBinIf->encodeBinEP( predIdx[j]-1 ); 1097 } 1152 1098 #if H_MV_ENC_DEC_TRAC 1153 DTRACE_CU("mpm_idx", predIdx[j] );1154 #endif 1155 }1156 else1157 {1158 if (preds[j][0] > preds[j][1])1159 {1160 std::swap(preds[j][0], preds[j][1]);1161 }1162 if (preds[j][0] > preds[j][2])1163 {1164 std::swap(preds[j][0], preds[j][2]);1165 }1166 if (preds[j][1] > preds[j][2])1167 {1168 std::swap(preds[j][1], preds[j][2]);1169 }1170 for(Int i = (predNum[j] - 1); i >= 0; i--)1171 {1172 dir[j] = dir[j] > preds[j][i] ? dir[j] - 1 : dir[j];1173 }1174 m_pcBinIf->encodeBinsEP( dir[j], 5 );1099 DTRACE_CU("mpm_idx", predIdx[j] ); 1100 #endif 1101 } 1102 else 1103 { 1104 if (preds[j][0] > preds[j][1]) 1105 { 1106 std::swap(preds[j][0], preds[j][1]); 1107 } 1108 if (preds[j][0] > preds[j][2]) 1109 { 1110 std::swap(preds[j][0], preds[j][2]); 1111 } 1112 if (preds[j][1] > preds[j][2]) 1113 { 1114 std::swap(preds[j][1], preds[j][2]); 1115 } 1116 for(Int i = (predNum[j] - 1); i >= 0; i--) 1117 { 1118 dir[j] = dir[j] > preds[j][i] ? dir[j] - 1 : dir[j]; 1119 } 1120 m_pcBinIf->encodeBinsEP( dir[j], 5 ); 1175 1121 #if H_MV_ENC_DEC_TRAC 1176 DTRACE_CU("rem_intra_luma_pred_mode", dir[j] );1177 #endif 1178 }1122 DTRACE_CU("rem_intra_luma_pred_mode", dir[j] ); 1123 #endif 1124 } 1179 1125 #if H_3D_DIM 1180 1126 } … … 1521 1467 { 1522 1468 #endif 1523 piPCMSample = pcCU->getPCMSampleCb() + uiChromaOffset;1524 uiWidth = pcCU->getWidth(uiAbsPartIdx)/2;1525 uiHeight = pcCU->getHeight(uiAbsPartIdx)/2;1526 uiSampleBits = pcCU->getSlice()->getSPS()->getPCMBitDepthChroma();1527 1528 for(uiY = 0; uiY < uiHeight; uiY++)1529 {1530 for(uiX = 0; uiX < uiWidth; uiX++)1531 {1532 UInt uiSample = piPCMSample[uiX];1533 1534 m_pcBinIf->xWritePCMCode(uiSample, uiSampleBits);1535 }1536 piPCMSample += uiWidth;1537 }1538 1539 piPCMSample = pcCU->getPCMSampleCr() + uiChromaOffset;1540 uiWidth = pcCU->getWidth(uiAbsPartIdx)/2;1541 uiHeight = pcCU->getHeight(uiAbsPartIdx)/2;1542 uiSampleBits = pcCU->getSlice()->getSPS()->getPCMBitDepthChroma();1543 1544 for(uiY = 0; uiY < uiHeight; uiY++)1545 {1546 for(uiX = 0; uiX < uiWidth; uiX++)1547 {1548 UInt uiSample = piPCMSample[uiX];1549 1550 m_pcBinIf->xWritePCMCode(uiSample, uiSampleBits);1551 }1552 piPCMSample += uiWidth;1553 }1469 piPCMSample = pcCU->getPCMSampleCb() + uiChromaOffset; 1470 uiWidth = pcCU->getWidth(uiAbsPartIdx)/2; 1471 uiHeight = pcCU->getHeight(uiAbsPartIdx)/2; 1472 uiSampleBits = pcCU->getSlice()->getSPS()->getPCMBitDepthChroma(); 1473 1474 for(uiY = 0; uiY < uiHeight; uiY++) 1475 { 1476 for(uiX = 0; uiX < uiWidth; uiX++) 1477 { 1478 UInt uiSample = piPCMSample[uiX]; 1479 1480 m_pcBinIf->xWritePCMCode(uiSample, uiSampleBits); 1481 } 1482 piPCMSample += uiWidth; 1483 } 1484 1485 piPCMSample = pcCU->getPCMSampleCr() + uiChromaOffset; 1486 uiWidth = pcCU->getWidth(uiAbsPartIdx)/2; 1487 uiHeight = pcCU->getHeight(uiAbsPartIdx)/2; 1488 uiSampleBits = pcCU->getSlice()->getSPS()->getPCMBitDepthChroma(); 1489 1490 for(uiY = 0; uiY < uiHeight; uiY++) 1491 { 1492 for(uiX = 0; uiX < uiWidth; uiX++) 1493 { 1494 UInt uiSample = piPCMSample[uiX]; 1495 1496 m_pcBinIf->xWritePCMCode(uiSample, uiSampleBits); 1497 } 1498 piPCMSample += uiWidth; 1499 } 1554 1500 #if H_3D_DISABLE_CHROMA 1555 1501 } -
trunk/source/Lib/TLibEncoder/TEncSbac.h
r1179 r1196 146 146 Void codeCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx ); 147 147 Void codeSkipFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 148 #if SEC_DEPTH_INTRA_SKIP_MODE_K0033148 #if H_3D 149 149 Void codeDIS ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 150 #else151 #if H_3D_SINGLE_DEPTH152 Void codeSingleDepthMode( TComDataCU* pcCU, UInt uiAbsPartIdx );153 #endif154 150 #endif 155 151 Void codeMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ); … … 219 215 ContextModel3DBuffer m_cCUSplitFlagSCModel; 220 216 ContextModel3DBuffer m_cCUSkipFlagSCModel; 221 #if SEC_DEPTH_INTRA_SKIP_MODE_K0033217 #if H_3D 222 218 ContextModel3DBuffer m_cCUDISFlagSCModel; 223 219 ContextModel3DBuffer m_cCUDISTypeSCModel; 224 #else225 #if H_3D_SINGLE_DEPTH226 ContextModel3DBuffer m_cCUSingleDepthFlagSCModel;227 ContextModel3DBuffer m_cSingleDepthValueSCModel;228 #endif229 220 #endif 230 221 ContextModel3DBuffer m_cCUMergeFlagExtSCModel; -
trunk/source/Lib/TLibEncoder/TEncSearch.cpp
r1179 r1196 915 915 } 916 916 m_pcEntropyCoder->encodeSkipFlag( pcCU, 0, true ); 917 #if SEC_DEPTH_INTRA_SKIP_MODE_K0033917 #if H_3D 918 918 m_pcEntropyCoder->encodeDIS(pcCU, 0, true ); 919 919 if(!pcCU->getDISFlag(uiAbsPartIdx)) 920 #else921 #if H_3D_SINGLE_DEPTH922 m_pcEntropyCoder->encodeSingleDepthMode(pcCU, 0, true );923 if(!pcCU->getSingleDepthFlag(uiAbsPartIdx))924 #endif925 920 #endif 926 921 m_pcEntropyCoder->encodePredMode( pcCU, 0, true ); 927 922 } 928 #if SEC_DEPTH_INTRA_SKIP_MODE_K0033923 #if H_3D 929 924 else 930 925 { 931 926 m_pcEntropyCoder->encodeDIS(pcCU, 0, true ); 932 927 } 933 #else 934 #if H_3D_SINGLE_DEPTH 935 else 936 { 937 m_pcEntropyCoder->encodeSingleDepthMode(pcCU, 0, true ); 938 } 939 #endif 940 #endif 941 #if SEC_DEPTH_INTRA_SKIP_MODE_K0033 928 #endif 929 #if H_3D 942 930 if(!pcCU->getDISFlag(uiAbsPartIdx)) 943 931 { 944 #else945 #if H_3D_SINGLE_DEPTH946 if(!pcCU->getSingleDepthFlag(uiAbsPartIdx))947 {948 #endif949 932 #endif 950 933 m_pcEntropyCoder ->encodePartSize( pcCU, 0, pcCU->getDepth(0), true ); 951 934 952 #if !HHI_MOVE_SYN_K0052953 #if H_3D_DIM_SDC954 m_pcEntropyCoder->encodeSDCFlag( pcCU, 0, true );955 #endif956 #endif957 935 if (pcCU->isIntra(0) && pcCU->getPartitionSize(0) == SIZE_2Nx2N ) 958 936 { … … 960 938 if ( pcCU->getIPCMFlag (0)) 961 939 { 962 #if HHI_MOVE_SYN_K0052963 940 #if H_3D_DIM_SDC 964 941 m_pcEntropyCoder->encodeSDCFlag( pcCU, 0, true ); 965 942 #endif 966 #endif967 943 return; 968 944 } 969 945 } 970 #if SEC_DEPTH_INTRA_SKIP_MODE_K0033 971 } 972 #else 973 #if H_3D_SINGLE_DEPTH 974 } 975 #endif 976 #endif 977 } 978 #if SEC_DEPTH_INTRA_SKIP_MODE_K0033 946 #if H_3D 947 } 948 #endif 949 } 950 #if H_3D 979 951 if(!pcCU->getDISFlag(uiAbsPartIdx)) 980 952 { 981 #else982 #if H_3D_SINGLE_DEPTH983 if(!pcCU->getSingleDepthFlag(uiAbsPartIdx))984 {985 #endif986 953 #endif 987 954 // luma prediction mode … … 992 959 m_pcEntropyCoder->encodeIntraDirModeLuma ( pcCU, 0 ); 993 960 #if H_3D_DIM_SDC 994 #if HHI_MOVE_SYN_K0052995 #if H_3D_DIM_SDC996 961 m_pcEntropyCoder->encodeSDCFlag( pcCU, 0, true ); 997 #endif998 #endif999 962 if( pcCU->getSlice()->getIsDepth() && ( !pcCU->getSDCFlag( 0 ) ) && getDimType( pcCU->getLumaIntraDir( 0 ) ) < DIM_NUM_TYPE ) 1000 963 { … … 1013 976 { 1014 977 m_pcEntropyCoder->encodeIntraDirModeLuma ( pcCU, uiPart * uiQNumParts ); 1015 1016 #if HHI_MOVE_SYN_K0052 978 #if H_3D_DIM_SDC 1017 979 } 1018 980 m_pcEntropyCoder->encodeSDCFlag( pcCU, 0, true ); 1019 981 for( UInt uiPart = 0; uiPart < 4; uiPart++ ) 1020 982 { 1021 #endif1022 #if H_3D_DIM_SDC1023 983 if( pcCU->getSlice()->getIsDepth() && ( !pcCU->getSDCFlag( uiPart * uiQNumParts ) ) && getDimType( pcCU->getLumaIntraDir( uiPart * uiQNumParts ) ) < DIM_NUM_TYPE ) 1024 984 { … … 1032 992 m_pcEntropyCoder->encodeIntraDirModeLuma ( pcCU, uiAbsPartIdx ); 1033 993 #if H_3D_DIM_SDC 1034 #if HHI_MOVE_SYN_K00521035 994 if( uiAbsPartIdx == 0 ) 1036 995 { 1037 996 m_pcEntropyCoder->encodeSDCFlag( pcCU, 0, true ); 1038 997 } 1039 #endif1040 998 if( pcCU->getSlice()->getIsDepth() && ( !pcCU->getSDCFlag( uiAbsPartIdx ) ) && getDimType( pcCU->getLumaIntraDir( uiAbsPartIdx ) ) < DIM_NUM_TYPE ) 1041 999 { … … 1044 1002 #endif 1045 1003 } 1046 } 1047 #if SEC_DEPTH_INTRA_SKIP_MODE_K0033 1048 } 1049 #else 1050 #if H_3D_SINGLE_DEPTH 1051 } 1052 #endif 1053 #endif 1004 #if H_3D 1005 } 1006 #endif 1007 } 1054 1008 } 1055 1009 if( bChroma ) … … 1914 1868 } 1915 1869 1916 #if SEC_DEPTH_INTRA_SKIP_MODE_K00331870 #if H_3D 1917 1871 Void TEncSearch::xIntraCodingDIS( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Dist& ruiDist, Double& dRDCost, UInt uiPredMode ) 1918 1872 { … … 2006 1960 dRDCost = m_pcRdCost->calcRdCost( uiBits, ruiDist ); 2007 1961 } 2008 #else 2009 #if H_3D_SINGLE_DEPTH 2010 Void TEncSearch::xIntraCodingSingleDepth( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Dist& ruiDist, Double& dRDCost, Int iTestDepthIdx, Pel *DepthNeighbor ) 2011 { 2012 UInt uiWidth = pcCU ->getWidth ( 0 ); 2013 UInt uiHeight = pcCU ->getHeight ( 0 ); 2014 UInt uiStride = pcOrgYuv ->getStride (); 2015 Pel* piOrg = pcOrgYuv ->getLumaAddr( uiAbsPartIdx ); 2016 Pel* piPred = pcPredYuv->getLumaAddr( uiAbsPartIdx ); 2017 2018 AOF( uiWidth == uiHeight ); 2019 AOF( uiAbsPartIdx == 0 ); 2020 pcCU->setSingleDepthValueSubParts((Pel)iTestDepthIdx,uiAbsPartIdx, 0, pcCU->getDepth(0)); 2021 //===== reconstruction ===== 2022 2023 for( UInt uiY = 0; uiY < uiHeight; uiY++ ) 2024 { 2025 for( UInt uiX = 0; uiX < uiWidth; uiX++ ) 2026 { 2027 piPred[ uiX ] = DepthNeighbor[iTestDepthIdx]; 2028 } 2029 piPred += uiStride; 2030 } 2031 2032 // clear UV 2033 UInt uiStrideC = pcPredYuv->getCStride(); 2034 Pel *pRecCb = pcPredYuv->getCbAddr(); 2035 Pel *pRecCr = pcPredYuv->getCrAddr(); 2036 2037 for (Int y=0; y<uiHeight/2; y++) 2038 { 2039 for (Int x=0; x<uiWidth/2; x++) 2040 { 2041 pRecCb[x] = 1<<(g_bitDepthC-1); 2042 pRecCr[x] = 1<<(g_bitDepthC-1); 2043 } 2044 2045 pRecCb += uiStrideC; 2046 pRecCr += uiStrideC; 2047 } 2048 2049 piPred = pcPredYuv->getLumaAddr( uiAbsPartIdx ); 2050 //===== determine distortion ===== 2051 #if H_3D_VSO 2052 if ( m_pcRdCost->getUseVSO() ) 2053 ruiDist = m_pcRdCost->getDistPartVSO ( pcCU, uiAbsPartIdx, piPred, uiStride, piOrg, uiStride, uiWidth, uiHeight, false ); 2054 else 2055 #endif 2056 ruiDist = m_pcRdCost->getDistPart(g_bitDepthY, piPred, uiStride, piOrg, uiStride, uiWidth, uiHeight ); 2057 2058 //===== determine rate and r-d cost ===== 2059 m_pcEntropyCoder->resetBits(); 2060 m_pcEntropyCoder->encodeSingleDepthMode( pcCU, 0, true ); 2061 UInt uiBits = m_pcEntropyCoder->getNumberOfWrittenBits(); 2062 2063 #if H_3D_VSO 2064 if ( m_pcRdCost->getUseLambdaScaleVSO()) 2065 dRDCost = m_pcRdCost->calcRdCostVSO( uiBits, ruiDist ); 2066 else 2067 #endif 2068 dRDCost = m_pcRdCost->calcRdCost( uiBits, ruiDist ); 2069 } 2070 #endif 2071 #endif 2072 1962 #endif 2073 1963 #if H_3D_DIM_SDC 2074 1964 Void TEncSearch::xIntraCodingSDC( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Dist& ruiDist, Double& dRDCost, Bool bZeroResidual, Int iSDCDeltaResi ) … … 2318 2208 2319 2209 m_pcEntropyCoder->encodePartSize( pcCU, 0, pcCU->getDepth( 0 ), true ); 2320 #if !HHI_MOVE_SYN_K00522321 m_pcEntropyCoder->encodeSDCFlag( pcCU, 0, true );2322 #endif2323 2210 2324 2211 // encode pred direction + DC residual data 2325 2212 m_pcEntropyCoder->encodePredInfo( pcCU, 0, true ); 2326 #if H HI_MOVE_SYN_K00522213 #if H_3D_DIM_SDC 2327 2214 m_pcEntropyCoder->encodeSDCFlag( pcCU, 0, true ); 2328 2215 #endif … … 3021 2908 pcCU->setChromIntraDirSubParts( uiBestMode, 0, pcCU->getDepth( 0 ) ); 3022 2909 } 3023 3024 #if SEC_DEPTH_INTRA_SKIP_MODE_K0033 2910 #if H_3D 3025 2911 Void TEncSearch::estIntraPredDIS( TComDataCU* pcCU, 3026 2912 TComYuv* pcOrgYuv, … … 3081 2967 pcCU->getTotalDistortion() = uiBestDist; 3082 2968 } 3083 #else 3084 #if H_3D_SINGLE_DEPTH 3085 Void 3086 TEncSearch::estIntraPredSingleDepth( TComDataCU* pcCU, 3087 TComYuv* pcOrgYuv, 3088 TComYuv* pcPredYuv, 3089 TComYuv* pcResiYuv, 3090 TComYuv* pcRecoYuv, 3091 UInt& ruiDistC, 3092 Bool bLumaOnly ) 3093 { 3094 UInt uiDepth = pcCU->getDepth(0); 3095 UInt uiWidth = pcCU->getWidth (0); 3096 UInt uiHeight = pcCU->getHeight(0); 3097 3098 3099 Pel* piOrg = pcOrgYuv ->getLumaAddr( 0, uiWidth ); 3100 UInt uiStride = pcPredYuv->getStride(); 3101 3102 Int index=0; 3103 Pel testDepth; 3104 Pel DepthNeighbours[2]; 3105 //construction of depth candidates 3106 for( Int i = 0; (i < 2) && (index<SINGLE_DEPTH_MODE_CAND_LIST_SIZE) ; i++ ) 3107 { 3108 if(!pcCU->getNeighDepth (0, 0, &testDepth, i)) 3109 { 3110 continue; 3111 } 3112 DepthNeighbours[index]=testDepth; 3113 index++; 3114 } 3115 3116 if(index==0) 3117 { 3118 DepthNeighbours[index]=1<<(g_bitDepthY-1); 3119 index++; 3120 } 3121 3122 if(index==1) 3123 { 3124 DepthNeighbours[index]=ClipY(DepthNeighbours[0] + 1 ); 3125 index++; 3126 } 3127 3128 3129 Dist uiDist = 0; 3130 Double dCost = 0.0; 3131 Dist uiBestDist = 0; 3132 Double dBestCost = MAX_DOUBLE; 3133 Pel pBestSingleDepthValue = 0; 3134 3135 for( Int testdepthidx = 0; testdepthidx < index ; testdepthidx++ ) 3136 { 3137 // set context models 3138 m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST] ); 3139 3140 // determine residual for partition 3141 uiDist = 0; 3142 dCost = 0.0; 3143 #if H_3D_VSO // M36 3144 if( m_pcRdCost->getUseRenModel() ) 3145 { 3146 m_pcRdCost->setRenModelData( pcCU, 0, piOrg, uiStride, uiWidth, uiHeight ); 3147 } 3148 #endif 3149 xIntraCodingSingleDepth(pcCU, 0, pcOrgYuv, pcPredYuv, uiDist, dCost, testdepthidx, DepthNeighbours); 3150 // check r-d cost 3151 if( dCost < dBestCost ) 3152 { 3153 uiBestDist = uiDist; 3154 dBestCost = dCost; 3155 pBestSingleDepthValue = pcCU->getSingleDepthValue(0); 3156 // copy reconstruction 3157 pcPredYuv->copyPartToPartYuv(pcRecoYuv, 0, uiWidth, uiHeight); 3158 } 3159 } // depth index loop 3160 3161 3162 pcCU->setSingleDepthValueSubParts((Pel)pBestSingleDepthValue,0, 0, uiDepth); 3163 assert(pBestSingleDepthValue>=0); 3164 3165 //===== reset context models ===== 3166 m_pcRDGoOnSbacCoder->load(m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST]); 3167 3168 //===== set distortion (rate and r-d costs are determined later) ===== 3169 pcCU->getTotalDistortion() = uiBestDist; 3170 } 3171 3172 #endif 3173 #endif 3174 2969 #endif 3175 2970 Void 3176 2971 TEncSearch::estIntraPredQT( TComDataCU* pcCU, … … 3221 3016 pcCU->getPattern()->initPattern ( pcCU, uiInitTrDepth, uiPartOffset ); 3222 3017 pcCU->getPattern()->initAdiPattern( pcCU, uiPartOffset, uiInitTrDepth, m_piYuvExt, m_iYuvExtStride, m_iYuvExtHeight, bAboveAvail, bLeftAvail ); 3223 3018 3224 3019 //===== determine set of modes to be tested (using prediction signal only) ===== 3225 3020 Int numModesAvailable = 35; //total number of Intra modes … … 3229 3024 UInt uiRdModeList[FAST_UDI_MAX_RDMODE_NUM]; 3230 3025 Int numModesForFullRD = g_aucIntraModeNumFast[ uiWidthBit ]; 3231 3026 3232 3027 #if H_3D_DIM 3233 3028 if( bOnlyIVP ) … … 3238 3033 { 3239 3034 #endif 3240 Bool doFastSearch = (numModesForFullRD != numModesAvailable);3241 if (doFastSearch)3242 {3243 assert(numModesForFullRD < numModesAvailable);3244 3245 for( Int i=0; i < numModesForFullRD; i++ )3246 {3247 CandCostList[ i ] = MAX_DOUBLE;3248 }3249 CandNum = 0;3250 3251 for( Int modeIdx = 0; modeIdx < numModesAvailable; modeIdx++ )3252 {3253 UInt uiMode = modeIdx;3254 3255 predIntraLumaAng( pcCU->getPattern(), uiMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail );3035 Bool doFastSearch = (numModesForFullRD != numModesAvailable); 3036 if (doFastSearch) 3037 { 3038 assert(numModesForFullRD < numModesAvailable); 3039 3040 for( Int i=0; i < numModesForFullRD; i++ ) 3041 { 3042 CandCostList[ i ] = MAX_DOUBLE; 3043 } 3044 CandNum = 0; 3045 3046 for( Int modeIdx = 0; modeIdx < numModesAvailable; modeIdx++ ) 3047 { 3048 UInt uiMode = modeIdx; 3049 3050 predIntraLumaAng( pcCU->getPattern(), uiMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail ); 3256 3051 #if H_3D_VSO // M34 3257 Dist uiSad; 3258 if ( m_pcRdCost->getUseVSO() ) 3259 { 3260 if ( m_pcRdCost->getUseEstimatedVSD() ) 3261 { 3262 uiSad = (Dist) ( m_pcRdCost->getDistPartVSD( pcCU, uiPartOffset, piPred, uiStride, piOrg, uiStride, uiWidth, uiHeight, true ) ); 3052 Dist uiSad; 3053 if ( m_pcRdCost->getUseVSO() ) 3054 { 3055 if ( m_pcRdCost->getUseEstimatedVSD() ) 3056 { 3057 uiSad = (Dist) ( m_pcRdCost->getDistPartVSD( pcCU, uiPartOffset, piPred, uiStride, piOrg, uiStride, uiWidth, uiHeight, true ) ); 3058 } 3059 else 3060 { 3061 uiSad = m_pcRdCost->getDistPartVSO(pcCU, uiPartOffset, piPred, uiStride, piOrg, uiStride, uiWidth, uiHeight, true ); 3062 } 3263 3063 } 3264 3064 else 3265 { 3266 uiSad = m_pcRdCost-> getDistPartVSO(pcCU, uiPartOffset, piPred, uiStride, piOrg, uiStride, uiWidth, uiHeight, true);3065 { 3066 uiSad = m_pcRdCost->calcHAD(g_bitDepthY, piOrg, uiStride, piPred, uiStride, uiWidth, uiHeight ); 3267 3067 } 3268 }3269 else3270 {3271 uiSad = m_pcRdCost->calcHAD(g_bitDepthY, piOrg, uiStride, piPred, uiStride, uiWidth, uiHeight );3272 }3273 3068 #else 3274 // use hadamard transform here3275 UInt uiSad = m_pcRdCost->calcHAD(g_bitDepthY, piOrg, uiStride, piPred, uiStride, uiWidth, uiHeight );3276 #endif 3277 3278 UInt iModeBits = xModeBitsIntra( pcCU, uiMode, uiPU, uiPartOffset, uiDepth, uiInitTrDepth );3069 // use hadamard transform here 3070 UInt uiSad = m_pcRdCost->calcHAD(g_bitDepthY, piOrg, uiStride, piPred, uiStride, uiWidth, uiHeight ); 3071 #endif 3072 3073 UInt iModeBits = xModeBitsIntra( pcCU, uiMode, uiPU, uiPartOffset, uiDepth, uiInitTrDepth ); 3279 3074 #if H_3D_VSO // M35 3280 Double dLambda;3281 if ( m_pcRdCost->getUseLambdaScaleVSO() )3282 {3283 dLambda = m_pcRdCost->getUseRenModel() ? m_pcRdCost->getLambdaVSO() : m_pcRdCost->getSqrtLambdaVSO();3284 }3285 else3286 {3287 dLambda = m_pcRdCost->getSqrtLambda();3288 }3289 3290 Double cost = (Double)uiSad + (Double)iModeBits * dLambda;3075 Double dLambda; 3076 if ( m_pcRdCost->getUseLambdaScaleVSO() ) 3077 { 3078 dLambda = m_pcRdCost->getUseRenModel() ? m_pcRdCost->getLambdaVSO() : m_pcRdCost->getSqrtLambdaVSO(); 3079 } 3080 else 3081 { 3082 dLambda = m_pcRdCost->getSqrtLambda(); 3083 } 3084 3085 Double cost = (Double)uiSad + (Double)iModeBits * dLambda; 3291 3086 #else 3292 Double cost = (Double)uiSad + (Double)iModeBits * m_pcRdCost->getSqrtLambda();3293 #endif 3294 3295 CandNum += xUpdateCandList( uiMode, cost, numModesForFullRD, uiRdModeList, CandCostList );3296 }3297 3087 Double cost = (Double)uiSad + (Double)iModeBits * m_pcRdCost->getSqrtLambda(); 3088 #endif 3089 3090 CandNum += xUpdateCandList( uiMode, cost, numModesForFullRD, uiRdModeList, CandCostList ); 3091 } 3092 3298 3093 #if FAST_UDI_USE_MPM 3299 Int uiPreds[3] = {-1, -1, -1}; 3300 Int iMode = -1; 3301 Int numCand = pcCU->getIntraDirLumaPredictor( uiPartOffset, uiPreds, &iMode ); 3302 if( iMode >= 0 ) 3303 { 3304 numCand = iMode; 3305 } 3306 3307 for( Int j=0; j < numCand; j++) 3308 3309 { 3310 Bool mostProbableModeIncluded = false; 3311 Int mostProbableMode = uiPreds[j]; 3312 3094 Int uiPreds[3] = {-1, -1, -1}; 3095 Int iMode = -1; 3096 Int numCand = pcCU->getIntraDirLumaPredictor( uiPartOffset, uiPreds, &iMode ); 3097 if( iMode >= 0 ) 3098 { 3099 numCand = iMode; 3100 } 3101 3102 for( Int j=0; j < numCand; j++) 3103 3104 { 3105 Bool mostProbableModeIncluded = false; 3106 Int mostProbableMode = uiPreds[j]; 3107 3108 for( Int i=0; i < numModesForFullRD; i++) 3109 { 3110 mostProbableModeIncluded |= (mostProbableMode == uiRdModeList[i]); 3111 } 3112 if (!mostProbableModeIncluded) 3113 { 3114 uiRdModeList[numModesForFullRD++] = mostProbableMode; 3115 } 3116 } 3117 #endif // FAST_UDI_USE_MPM 3118 } 3119 else 3120 { 3313 3121 for( Int i=0; i < numModesForFullRD; i++) 3314 3122 { 3315 mostProbableModeIncluded |= (mostProbableMode == uiRdModeList[i]); 3316 } 3317 if (!mostProbableModeIncluded) 3318 { 3319 uiRdModeList[numModesForFullRD++] = mostProbableMode; 3320 } 3321 } 3322 #endif // FAST_UDI_USE_MPM 3323 } 3324 else 3325 { 3326 for( Int i=0; i < numModesForFullRD; i++) 3327 { 3328 uiRdModeList[i] = i; 3329 } 3330 } 3123 uiRdModeList[i] = i; 3124 } 3125 } 3331 3126 #if H_3D_DIM 3332 3127 } 3333 3128 #endif 3334 3129 3335 3130 #if H_3D_DIM 3336 3131 //===== determine set of depth intra modes to be tested ===== 3337 3132 if( m_pcEncCfg->getIsDepth() && uiWidth >= DIM_MIN_SIZE && uiWidth <= DIM_MAX_SIZE && uiWidth == uiHeight ) 3338 3133 { 3339 #if TICKET083_IVPFLAG_FIX3340 3134 if( bOnlyIVP ) 3341 #else3342 if( bOnlyIVP && pcCU->getSlice()->getIntraContourFlag() )3343 #endif3344 3135 { 3345 3136 TComWedgelet* dmm4Segmentation = new TComWedgelet( uiWidth, uiHeight ); … … 3357 3148 { 3358 3149 #if H_3D_FAST_DEPTH_INTRA 3359 Int threshold = max(((pcCU->getQP(0))>>3)-1,3);3360 Int varThreshold = (Int)( threshold * threshold - 8 );3361 UInt varCU = m_pcRdCost->calcVAR(piOrg, uiStride, uiWidth,uiHeight,pcCU->getDepth(0));3150 Int threshold = max(((pcCU->getQP(0))>>3)-1,3); 3151 Int varThreshold = (Int)( threshold * threshold - 8 ); 3152 UInt varCU = m_pcRdCost->calcVAR(piOrg, uiStride, uiWidth,uiHeight,pcCU->getDepth(0)); 3362 3153 #endif 3363 3154 3364 3155 #if H_3D_DIM_DMM 3365 if( ( ( m_pcEncCfg->getUseDMM() && pcCU->getSlice()->getIntraSdcWedgeFlag() ) || pcCU->getSlice()->getIntraContourFlag() )3156 if( ( ( m_pcEncCfg->getUseDMM() && pcCU->getSlice()->getIntraSdcWedgeFlag() ) || pcCU->getSlice()->getIntraContourFlag() ) 3366 3157 #if H_3D_FAST_DEPTH_INTRA 3367 && (uiRdModeList[0] != PLANAR_IDX || varCU >= varThreshold)3368 #endif 3369 )3370 {3371 UInt uiStart, uiEnd;3372 if( ( m_pcEncCfg->getUseDMM() && pcCU->getSlice()->getIntraSdcWedgeFlag() ) && pcCU->getSlice()->getIntraContourFlag() )3373 {3374 uiStart = 0;3375 uiEnd = 2;3376 }3377 else if( ( m_pcEncCfg->getUseDMM() && pcCU->getSlice()->getIntraSdcWedgeFlag() ) )3378 {3379 uiStart = 0;3380 uiEnd = 1;3381 }3382 else if( pcCU->getSlice()->getIntraContourFlag() )3383 {3384 uiStart = 1;3385 uiEnd = 2;3386 }3387 else3388 {3389 uiStart = 0;3390 uiEnd = 0;3391 }3392 for( UInt dmmType = uiStart; dmmType < uiEnd; dmmType++ )3393 {3158 && (uiRdModeList[0] != PLANAR_IDX || varCU >= varThreshold) 3159 #endif 3160 ) 3161 { 3162 UInt uiStart, uiEnd; 3163 if( ( m_pcEncCfg->getUseDMM() && pcCU->getSlice()->getIntraSdcWedgeFlag() ) && pcCU->getSlice()->getIntraContourFlag() ) 3164 { 3165 uiStart = 0; 3166 uiEnd = 2; 3167 } 3168 else if( ( m_pcEncCfg->getUseDMM() && pcCU->getSlice()->getIntraSdcWedgeFlag() ) ) 3169 { 3170 uiStart = 0; 3171 uiEnd = 1; 3172 } 3173 else if( pcCU->getSlice()->getIntraContourFlag() ) 3174 { 3175 uiStart = 1; 3176 uiEnd = 2; 3177 } 3178 else 3179 { 3180 uiStart = 0; 3181 uiEnd = 0; 3182 } 3183 for( UInt dmmType = uiStart; dmmType < uiEnd; dmmType++ ) 3184 { 3394 3185 #if H_3D_FCO 3395 3186 TComPic* picTexture = pcCU->getSlice()->getIvPic(false, pcCU->getSlice()->getViewIndex() ); … … 3400 3191 #endif 3401 3192 { 3402 3193 continue; 3403 3194 } 3404 3195 #endif 3405 UInt uiTabIdx = 0; 3406 TComWedgelet* biSegmentation = NULL; 3407 Pel deltaDC1 = 0; Pel deltaDC2 = 0; 3408 switch( dmmType ) 3409 { 3410 case( DMM1_IDX ): 3196 UInt uiTabIdx = 0; 3197 TComWedgelet* biSegmentation = NULL; 3198 Pel deltaDC1 = 0; Pel deltaDC2 = 0; 3199 switch( dmmType ) 3411 3200 { 3412 xSearchDmm1Wedge( pcCU, uiPartOffset, piOrg, uiStride, uiWidth, uiHeight, uiTabIdx ); 3413 pcCU->setDmmWedgeTabIdxSubParts( uiTabIdx, dmmType, uiPartOffset, uiDepth + uiInitTrDepth ); 3414 biSegmentation = pcCU->isDMM1UpscaleMode( uiWidth ) ? 3201 case( DMM1_IDX ): 3202 { 3203 xSearchDmm1Wedge( pcCU, uiPartOffset, piOrg, uiStride, uiWidth, uiHeight, uiTabIdx ); 3204 pcCU->setDmmWedgeTabIdxSubParts( uiTabIdx, dmmType, uiPartOffset, uiDepth + uiInitTrDepth ); 3205 biSegmentation = pcCU->isDMM1UpscaleMode( uiWidth ) ? 3415 3206 &(g_dmmWedgeLists[(g_aucConvertToBit[pcCU->getDMM1BasePatternWidth(uiWidth)])][uiTabIdx]) : &(g_dmmWedgeLists[(g_aucConvertToBit[uiWidth])][uiTabIdx]); 3416 } break; 3417 3418 case( DMM4_IDX ): 3207 } break; 3208 3209 case( DMM4_IDX ): 3210 { 3211 { 3212 biSegmentation = new TComWedgelet( uiWidth, uiHeight ); 3213 xPredContourFromTex( pcCU, uiPartOffset, uiWidth, uiHeight, biSegmentation ); 3214 } 3215 } break; 3216 default: assert(0); 3217 } 3218 3219 if( biSegmentation ) 3419 3220 { 3221 if( dmmType == DMM1_IDX && pcCU->isDMM1UpscaleMode( uiWidth ) ){ 3222 xSearchDmmDeltaDCs( pcCU, uiPartOffset, piOrg, piPred, uiStride, biSegmentation->getScaledPattern(uiWidth), uiWidth, uiWidth, uiHeight, deltaDC1, deltaDC2 ); 3223 } 3224 else 3420 3225 { 3421 biSegmentation = new TComWedgelet( uiWidth, uiHeight ); 3422 xPredContourFromTex( pcCU, uiPartOffset, uiWidth, uiHeight, biSegmentation ); 3226 xSearchDmmDeltaDCs( pcCU, uiPartOffset, piOrg, piPred, uiStride, biSegmentation->getPattern(), biSegmentation->getStride(), uiWidth, uiHeight, deltaDC1, deltaDC2 ); 3423 3227 } 3424 } break; 3425 default: assert(0); 3228 pcCU->setDimDeltaDC( dmmType, 0, uiPartOffset, deltaDC1 ); 3229 pcCU->setDimDeltaDC( dmmType, 1, uiPartOffset, deltaDC2 ); 3230 3231 uiRdModeList[ numModesForFullRD++ ] = (dmmType +DIM_OFFSET); 3232 if( DMM4_IDX == dmmType ) { biSegmentation->destroy(); delete biSegmentation; } 3233 } 3426 3234 } 3427 3428 if( biSegmentation ) 3429 { 3430 if( dmmType == DMM1_IDX && pcCU->isDMM1UpscaleMode( uiWidth ) ){ 3431 xSearchDmmDeltaDCs( pcCU, uiPartOffset, piOrg, piPred, uiStride, biSegmentation->getScaledPattern(uiWidth), uiWidth, uiWidth, uiHeight, deltaDC1, deltaDC2 ); 3432 } 3433 else 3434 { 3435 xSearchDmmDeltaDCs( pcCU, uiPartOffset, piOrg, piPred, uiStride, biSegmentation->getPattern(), biSegmentation->getStride(), uiWidth, uiHeight, deltaDC1, deltaDC2 ); 3436 } 3437 pcCU->setDimDeltaDC( dmmType, 0, uiPartOffset, deltaDC1 ); 3438 pcCU->setDimDeltaDC( dmmType, 1, uiPartOffset, deltaDC2 ); 3439 3440 uiRdModeList[ numModesForFullRD++ ] = (dmmType +DIM_OFFSET); 3441 if( DMM4_IDX == dmmType ) { biSegmentation->destroy(); delete biSegmentation; } 3442 } 3443 } 3444 } 3235 } 3445 3236 #if H_3D_DIM 3446 3237 } … … 3454 3245 Double dSecondBestPUCost = MAX_DOUBLE; 3455 3246 #endif 3456 3247 3457 3248 UInt uiBestPUMode = 0; 3458 3249 #if H_3D_FAST_INTRA_SDC … … 3488 3279 // set luma prediction mode 3489 3280 #if !H_3D_FAST_INTRA_SDC 3490 UInt uiOrgMode = uiRdModeList[uiMode];3491 #endif 3492 3281 UInt uiOrgMode = uiRdModeList[uiMode]; 3282 #endif 3283 3493 3284 #if H_3D_FAST_INTRA_SDC 3494 3285 UInt uiOrgMode; 3495 3286 if (uiMode < numModesForFullRD) 3496 3287 { 3497 3288 uiOrgMode = uiRdModeList[uiMode]; 3498 3289 } 3499 3290 else 3500 3291 { 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3292 uiOrgMode = uiRdModeList[uiMode - numModesForFullRD]; 3293 3294 if (uiBestPUModeConv <= 1 ) 3295 { 3296 if (uiOrgMode > 1 && varCU < 1) continue; 3297 } 3298 else 3299 { 3300 if (uiOrgMode != uiBestPUModeConv && uiOrgMode != uiSecondBestPUModeConv && uiOrgMode != uiThirdBestPUModeConv 3301 && uiOrgMode > 1 && uiOrgMode < NUM_INTRA_MODE && varCU < 4) 3302 continue; 3303 } 3304 } 3514 3305 #endif 3515 3306 3516 3307 pcCU->setLumaIntraDirSubParts ( uiOrgMode, uiPartOffset, uiDepth + uiInitTrDepth ); 3517 3308 3518 3309 #if H_3D_DIM_SDC 3519 3310 #if H_3D_FAST_INTRA_SDC … … 3522 3313 Bool bTestSDC = ( m_pcEncCfg->getUseSDC() && pcCU->getSDCAvailable(uiPartOffset) ); 3523 3314 #endif 3524 3315 3525 3316 for( UInt uiSDC=0; uiSDC<=(bTestSDC?1:0); uiSDC++ ) 3526 3317 { … … 3561 3352 } 3562 3353 #endif 3563 3354 3564 3355 #if H_3D_DIM_ENC || H_3D_DIM_SDC 3565 Bool bTestZeroResi = false;3356 Bool bTestZeroResi = false; 3566 3357 #if H_3D_DIM_ENC 3567 bTestZeroResi |= pcCU->getSlice()->getIsDepth() && !pcCU->getSlice()->isIRAP();3358 bTestZeroResi |= pcCU->getSlice()->getIsDepth() && !pcCU->getSlice()->isIRAP(); 3568 3359 #endif 3569 3360 #if H_3D_DIM_SDC 3570 bTestZeroResi |= pcCU->getSDCFlag(uiPartOffset);3571 #endif 3572 if( uiSDC != 0 && iSDCDeltaResi != 0 )3573 {3574 bTestZeroResi = false;3575 }3576 #endif 3577 3361 bTestZeroResi |= pcCU->getSDCFlag(uiPartOffset); 3362 #endif 3363 if( uiSDC != 0 && iSDCDeltaResi != 0 ) 3364 { 3365 bTestZeroResi = false; 3366 } 3367 #endif 3368 3578 3369 #if H_3D_DIM_ENC || H_3D_DIM_SDC 3579 for( UInt testZeroResi = 0; testZeroResi <= (bTestZeroResi ? 1 : 0) ; testZeroResi++ )3580 {3581 #endif 3582 // set context models3583 m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST] );3584 3585 // determine residual for partition3370 for( UInt testZeroResi = 0; testZeroResi <= (bTestZeroResi ? 1 : 0) ; testZeroResi++ ) 3371 { 3372 #endif 3373 // set context models 3374 m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST] ); 3375 3376 // determine residual for partition 3586 3377 #if H_3D_VSO 3587 Dist uiPUDistY = 0;3378 Dist uiPUDistY = 0; 3588 3379 #else 3589 UInt uiPUDistY = 0;3590 #endif 3591 UInt uiPUDistC = 0;3592 Double dPUCost = 0.0;3380 UInt uiPUDistY = 0; 3381 #endif 3382 UInt uiPUDistC = 0; 3383 Double dPUCost = 0.0; 3593 3384 #if H_3D_VSO // M36 3594 if( m_pcRdCost->getUseRenModel() )3595 {3596 m_pcRdCost->setRenModelData( pcCU, uiPartOffset, piOrg, uiStride, uiWidth, uiHeight );3597 }3385 if( m_pcRdCost->getUseRenModel() ) 3386 { 3387 m_pcRdCost->setRenModelData( pcCU, uiPartOffset, piOrg, uiStride, uiWidth, uiHeight ); 3388 } 3598 3389 #endif 3599 3390 #if H_3D_DIM_SDC 3600 if( pcCU->getSDCFlag(uiPartOffset) )3601 {3602 pcCU->setTrIdxSubParts(0, uiPartOffset, uiDepth + uiInitTrDepth);3603 pcCU->setCbfSubParts(1, 1, 1, uiPartOffset, uiDepth + uiInitTrDepth);3604 3605 // start encoding with SDC3606 xIntraCodingSDC(pcCU, uiPartOffset, pcOrgYuv, pcPredYuv, uiPUDistY, dPUCost, ( testZeroResi != 0 ), iSDCDeltaResi );3607 if ( testZeroResi == 0 && iOffset <= 3 )3608 {3609 dOffsetCost [iOffset -1] = dPUCost;3610 }3611 }3612 else3613 {3391 if( pcCU->getSDCFlag(uiPartOffset) ) 3392 { 3393 pcCU->setTrIdxSubParts(0, uiPartOffset, uiDepth + uiInitTrDepth); 3394 pcCU->setCbfSubParts(1, 1, 1, uiPartOffset, uiDepth + uiInitTrDepth); 3395 3396 // start encoding with SDC 3397 xIntraCodingSDC(pcCU, uiPartOffset, pcOrgYuv, pcPredYuv, uiPUDistY, dPUCost, ( testZeroResi != 0 ), iSDCDeltaResi ); 3398 if ( testZeroResi == 0 && iOffset <= 3 ) 3399 { 3400 dOffsetCost [iOffset -1] = dPUCost; 3401 } 3402 } 3403 else 3404 { 3614 3405 #endif 3615 3406 #if HHI_RQT_INTRA_SPEEDUP 3616 3407 #if H_3D_DIM_ENC 3617 xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, true, dPUCost, (testZeroResi != 0) );3408 xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, true, dPUCost, (testZeroResi != 0) ); 3618 3409 #if H_3D_FAST_INTRA_SDC 3619 if( dPUCost < dBestPUCostConv )3620 {3621 uiThirdBestPUModeConv = uiSecondBestPUModeConv;3622 uiSecondBestPUModeConv = uiBestPUModeConv;3623 uiBestPUModeConv = uiOrgMode;3624 dBestPUCostConv = dPUCost;3625 }3410 if( dPUCost < dBestPUCostConv ) 3411 { 3412 uiThirdBestPUModeConv = uiSecondBestPUModeConv; 3413 uiSecondBestPUModeConv = uiBestPUModeConv; 3414 uiBestPUModeConv = uiOrgMode; 3415 dBestPUCostConv = dPUCost; 3416 } 3626 3417 #endif 3627 3418 #else 3628 xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, true, dPUCost );3419 xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, true, dPUCost ); 3629 3420 #endif 3630 3421 #else 3631 3422 #if H_3D_DIM_ENC 3632 xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, dPUCost, (testZeroResi != 0) );3423 xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, dPUCost, (testZeroResi != 0) ); 3633 3424 #else 3634 xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, dPUCost );3425 xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, dPUCost ); 3635 3426 #endif 3636 3427 #endif 3637 3428 #if H_3D_DIM_SDC 3638 }3639 #endif 3640 3641 // check r-d cost3642 if( dPUCost < dBestPUCost )3643 {3429 } 3430 #endif 3431 3432 // check r-d cost 3433 if( dPUCost < dBestPUCost ) 3434 { 3644 3435 #if HHI_RQT_INTRA_SPEEDUP_MOD 3645 uiSecondBestMode = uiBestPUMode;3646 dSecondBestPUCost = dBestPUCost;3647 #endif 3648 uiBestPUMode = uiOrgMode;3649 uiBestPUDistY = uiPUDistY;3650 uiBestPUDistC = uiPUDistC;3651 dBestPUCost = dPUCost;3436 uiSecondBestMode = uiBestPUMode; 3437 dSecondBestPUCost = dBestPUCost; 3438 #endif 3439 uiBestPUMode = uiOrgMode; 3440 uiBestPUDistY = uiPUDistY; 3441 uiBestPUDistC = uiPUDistC; 3442 dBestPUCost = dPUCost; 3652 3443 3653 3444 #if H_3D_DIM_SDC 3654 if( pcCU->getSDCFlag(uiPartOffset) ) 3655 { 3656 bBestUseSDC = true; 3657 3658 // copy reconstruction 3659 pcPredYuv->copyPartToPartYuv(pcRecoYuv, uiPartOffset, uiWidth, uiHeight); 3660 3661 // copy DC values 3662 apBestDCOffsets[0] = pcCU->getSDCSegmentDCOffset(0, uiPartOffset); 3663 apBestDCOffsets[1] = pcCU->getSDCSegmentDCOffset(1, uiPartOffset); 3445 if( pcCU->getSDCFlag(uiPartOffset) ) 3446 { 3447 bBestUseSDC = true; 3448 3449 // copy reconstruction 3450 pcPredYuv->copyPartToPartYuv(pcRecoYuv, uiPartOffset, uiWidth, uiHeight); 3451 3452 // copy DC values 3453 apBestDCOffsets[0] = pcCU->getSDCSegmentDCOffset(0, uiPartOffset); 3454 apBestDCOffsets[1] = pcCU->getSDCSegmentDCOffset(1, uiPartOffset); 3455 } 3456 else 3457 { 3458 bBestUseSDC = false; 3459 #endif 3460 xSetIntraResultQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcRecoYuv ); 3461 3462 UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> ( ( pcCU->getDepth(0) + uiInitTrDepth ) << 1 ); 3463 ::memcpy( m_puhQTTempTrIdx, pcCU->getTransformIdx() + uiPartOffset, uiQPartNum * sizeof( UChar ) ); 3464 ::memcpy( m_puhQTTempCbf[0], pcCU->getCbf( TEXT_LUMA ) + uiPartOffset, uiQPartNum * sizeof( UChar ) ); 3465 ::memcpy( m_puhQTTempCbf[1], pcCU->getCbf( TEXT_CHROMA_U ) + uiPartOffset, uiQPartNum * sizeof( UChar ) ); 3466 ::memcpy( m_puhQTTempCbf[2], pcCU->getCbf( TEXT_CHROMA_V ) + uiPartOffset, uiQPartNum * sizeof( UChar ) ); 3467 ::memcpy( m_puhQTTempTransformSkipFlag[0], pcCU->getTransformSkip(TEXT_LUMA) + uiPartOffset, uiQPartNum * sizeof( UChar ) ); 3468 ::memcpy( m_puhQTTempTransformSkipFlag[1], pcCU->getTransformSkip(TEXT_CHROMA_U) + uiPartOffset, uiQPartNum * sizeof( UChar ) ); 3469 ::memcpy( m_puhQTTempTransformSkipFlag[2], pcCU->getTransformSkip(TEXT_CHROMA_V) + uiPartOffset, uiQPartNum * sizeof( UChar ) ); 3470 #if H_3D_DIM_SDC 3471 } 3472 #endif 3473 } 3474 #if HHI_RQT_INTRA_SPEEDUP_MOD 3475 else if( dPUCost < dSecondBestPUCost ) 3476 { 3477 uiSecondBestMode = uiOrgMode; 3478 dSecondBestPUCost = dPUCost; 3479 } 3480 #endif 3481 #if H_3D_DIM_ENC || H_3D_DIM_SDC 3664 3482 } 3665 else3666 {3667 bBestUseSDC = false;3668 #endif3669 xSetIntraResultQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcRecoYuv );3670 3671 UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> ( ( pcCU->getDepth(0) + uiInitTrDepth ) << 1 );3672 ::memcpy( m_puhQTTempTrIdx, pcCU->getTransformIdx() + uiPartOffset, uiQPartNum * sizeof( UChar ) );3673 ::memcpy( m_puhQTTempCbf[0], pcCU->getCbf( TEXT_LUMA ) + uiPartOffset, uiQPartNum * sizeof( UChar ) );3674 ::memcpy( m_puhQTTempCbf[1], pcCU->getCbf( TEXT_CHROMA_U ) + uiPartOffset, uiQPartNum * sizeof( UChar ) );3675 ::memcpy( m_puhQTTempCbf[2], pcCU->getCbf( TEXT_CHROMA_V ) + uiPartOffset, uiQPartNum * sizeof( UChar ) );3676 ::memcpy( m_puhQTTempTransformSkipFlag[0], pcCU->getTransformSkip(TEXT_LUMA) + uiPartOffset, uiQPartNum * sizeof( UChar ) );3677 ::memcpy( m_puhQTTempTransformSkipFlag[1], pcCU->getTransformSkip(TEXT_CHROMA_U) + uiPartOffset, uiQPartNum * sizeof( UChar ) );3678 ::memcpy( m_puhQTTempTransformSkipFlag[2], pcCU->getTransformSkip(TEXT_CHROMA_V) + uiPartOffset, uiQPartNum * sizeof( UChar ) );3679 #if H_3D_DIM_SDC3680 }3681 #endif3682 }3683 #if HHI_RQT_INTRA_SPEEDUP_MOD3684 else if( dPUCost < dSecondBestPUCost )3685 {3686 uiSecondBestMode = uiOrgMode;3687 dSecondBestPUCost = dPUCost;3688 }3689 #endif3690 #if H_3D_DIM_ENC || H_3D_DIM_SDC3691 }3692 3483 } // SDC residual loop 3693 3484 #endif … … 3696 3487 #endif 3697 3488 } // Mode loop 3698 3489 3699 3490 #if HHI_RQT_INTRA_SPEEDUP 3700 3491 #if HHI_RQT_INTRA_SPEEDUP_MOD … … 3711 3502 UInt uiOrgMode = uiBestPUMode; 3712 3503 #endif 3713 3504 3714 3505 pcCU->setLumaIntraDirSubParts ( uiOrgMode, uiPartOffset, uiDepth + uiInitTrDepth ); 3715 3506 #if H_3D_DIM_SDC 3716 3507 pcCU->setSDCFlagSubParts(false, uiPartOffset, uiDepth + uiInitTrDepth); 3717 3508 #endif 3718 3509 3719 3510 // set context models 3720 3721 3511 m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST] ); 3512 3722 3513 // determine residual for partition 3723 3514 #if H_3D_VSO … … 3736 3527 #endif 3737 3528 xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, false, dPUCost ); 3738 3529 3739 3530 // check r-d cost 3740 3531 if( dPUCost < dBestPUCost ) … … 3747 3538 bBestUseSDC = false; 3748 3539 #endif 3749 3540 3750 3541 xSetIntraResultQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcRecoYuv ); 3751 3542 3752 3543 UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> ( ( pcCU->getDepth(0) + uiInitTrDepth ) << 1 ); 3753 3544 ::memcpy( m_puhQTTempTrIdx, pcCU->getTransformIdx() + uiPartOffset, uiQPartNum * sizeof( UChar ) ); … … 3761 3552 } // Mode loop 3762 3553 #endif 3763 3554 3764 3555 //--- update overall distortion --- 3765 3556 uiOverallDistY += uiBestPUDistY; 3766 3557 uiOverallDistC += uiBestPUDistC; 3767 3558 3768 3559 #if H_3D_DIM_SDC 3769 3560 if( bBestUseSDC ) … … 3771 3562 pcCU->setTrIdxSubParts(0, uiPartOffset, uiDepth + uiInitTrDepth); 3772 3563 pcCU->setCbfSubParts(1, 1, 1, uiPartOffset, uiDepth + uiInitTrDepth); 3773 3564 3774 3565 //=== copy best DC segment values back to CU ==== 3775 3566 pcCU->setSDCSegmentDCOffset(apBestDCOffsets[0], 0, uiPartOffset); … … 3779 3570 { 3780 3571 #endif 3781 3782 UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> ( ( pcCU->getDepth(0) + uiInitTrDepth ) << 1 );3783 ::memcpy( pcCU->getTransformIdx() + uiPartOffset, m_puhQTTempTrIdx, uiQPartNum * sizeof( UChar ) );3784 ::memcpy( pcCU->getCbf( TEXT_LUMA ) + uiPartOffset, m_puhQTTempCbf[0], uiQPartNum * sizeof( UChar ) );3785 ::memcpy( pcCU->getCbf( TEXT_CHROMA_U ) + uiPartOffset, m_puhQTTempCbf[1], uiQPartNum * sizeof( UChar ) );3786 ::memcpy( pcCU->getCbf( TEXT_CHROMA_V ) + uiPartOffset, m_puhQTTempCbf[2], uiQPartNum * sizeof( UChar ) );3787 ::memcpy( pcCU->getTransformSkip(TEXT_LUMA) + uiPartOffset, m_puhQTTempTransformSkipFlag[0], uiQPartNum * sizeof( UChar ) );3788 ::memcpy( pcCU->getTransformSkip(TEXT_CHROMA_U) + uiPartOffset, m_puhQTTempTransformSkipFlag[1], uiQPartNum * sizeof( UChar ) );3789 ::memcpy( pcCU->getTransformSkip(TEXT_CHROMA_V) + uiPartOffset, m_puhQTTempTransformSkipFlag[2], uiQPartNum * sizeof( UChar ) );3572 //--- update transform index and cbf --- 3573 UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> ( ( pcCU->getDepth(0) + uiInitTrDepth ) << 1 ); 3574 ::memcpy( pcCU->getTransformIdx() + uiPartOffset, m_puhQTTempTrIdx, uiQPartNum * sizeof( UChar ) ); 3575 ::memcpy( pcCU->getCbf( TEXT_LUMA ) + uiPartOffset, m_puhQTTempCbf[0], uiQPartNum * sizeof( UChar ) ); 3576 ::memcpy( pcCU->getCbf( TEXT_CHROMA_U ) + uiPartOffset, m_puhQTTempCbf[1], uiQPartNum * sizeof( UChar ) ); 3577 ::memcpy( pcCU->getCbf( TEXT_CHROMA_V ) + uiPartOffset, m_puhQTTempCbf[2], uiQPartNum * sizeof( UChar ) ); 3578 ::memcpy( pcCU->getTransformSkip(TEXT_LUMA) + uiPartOffset, m_puhQTTempTransformSkipFlag[0], uiQPartNum * sizeof( UChar ) ); 3579 ::memcpy( pcCU->getTransformSkip(TEXT_CHROMA_U) + uiPartOffset, m_puhQTTempTransformSkipFlag[1], uiQPartNum * sizeof( UChar ) ); 3580 ::memcpy( pcCU->getTransformSkip(TEXT_CHROMA_V) + uiPartOffset, m_puhQTTempTransformSkipFlag[2], uiQPartNum * sizeof( UChar ) ); 3790 3581 #if H_3D_DIM_SDC 3791 3582 } … … 3803 3594 bChromaSame = true; 3804 3595 } 3805 3596 3806 3597 UInt uiCompWidth = pcCU->getWidth ( 0 ) >> uiInitTrDepth; 3807 3598 UInt uiCompHeight = pcCU->getHeight( 0 ) >> uiInitTrDepth; … … 3855 3646 } 3856 3647 } 3857 3648 3858 3649 //=== update PU data ==== 3859 3650 pcCU->setLumaIntraDirSubParts ( uiBestPUMode, uiPartOffset, uiDepth + uiInitTrDepth ); … … 4183 3974 4184 3975 #if H_3D_DBBP 4185 D BBPTmpData* pDBBPTmpData = pcCU->getDBBPTmpData();3976 DbbpTmpData* pDBBPTmpData = pcCU->getDBBPTmpData(); 4186 3977 if( pcCU->getDBBPFlag(0) ) 4187 3978 { … … 5173 4964 { 5174 4965 #if H_3D_DBBP 5175 D BBPTmpData* pDBBPTmpData = pcCU->getDBBPTmpData();4966 DbbpTmpData* pDBBPTmpData = pcCU->getDBBPTmpData(); 5176 4967 if( pcCU->getDBBPFlag(0) ) 5177 4968 { … … 5534 5325 TComMv cMvPred = *pcMvPred; 5535 5326 5536 #if SONY_MV_V_CONST_C00785537 Bool bMv_VRng_Restricted = false;5327 #if H_MV 5328 Bool motVecVertRngRestricted = false; 5538 5329 if( m_pcEncCfg->getUseDisparitySearchRangeRestriction() 5539 5330 && … … 5541 5332 ) 5542 5333 { 5543 bMv_VRng_Restricted = true;5544 } 5545 if ( bBi ) xSetSearchRange ( pcCU, rcMv , iSrchRng, cMvSrchRngLT, cMvSrchRngRB, bMv_VRng_Restricted, m_pcEncCfg->getVerticalDisparitySearchRange() );5546 else xSetSearchRange ( pcCU, cMvPred, iSrchRng, cMvSrchRngLT, cMvSrchRngRB, bMv_VRng_Restricted, m_pcEncCfg->getVerticalDisparitySearchRange() );5334 motVecVertRngRestricted = true; 5335 } 5336 if ( bBi ) xSetSearchRange ( pcCU, rcMv , iSrchRng, cMvSrchRngLT, cMvSrchRngRB, motVecVertRngRestricted, m_pcEncCfg->getVerticalDisparitySearchRange() ); 5337 else xSetSearchRange ( pcCU, cMvPred, iSrchRng, cMvSrchRngLT, cMvSrchRngRB, motVecVertRngRestricted, m_pcEncCfg->getVerticalDisparitySearchRange() ); 5547 5338 #else 5548 5339 if ( bBi ) xSetSearchRange ( pcCU, rcMv , iSrchRng, cMvSrchRngLT, cMvSrchRngRB ); … … 5601 5392 5602 5393 5603 #if SONY_MV_V_CONST_C00785394 #if H_MV 5604 5395 Void TEncSearch::xSetSearchRange ( TComDataCU* pcCU, TComMv& cMvPred, Int iSrchRng, TComMv& rcMvSrchRngLT, TComMv& rcMvSrchRngRB, Bool bMv_VRng_Restricted, Int iVerDispSrchRng ) 5605 5396 #else … … 5621 5412 rcMvSrchRngRB.setVer( cTmpMvPred.getVer() + (iSrchRng << iMvShift) ); 5622 5413 5623 #if SONY_MV_V_CONST_C00785414 #if H_MV 5624 5415 if ( bMv_VRng_Restricted ) { 5625 5416 Int iRestrictMvVrange = ( iVerDispSrchRng - 1 ) << iMvShift ; // -1 to consider subpel search … … 5732 5523 if( ! pcCU->getSlice()->getIsDepth() ) 5733 5524 #endif 5734 rcMv >>= 2;5525 rcMv >>= 2; 5735 5526 // init TZSearchStruct 5736 5527 IntTZSearchStruct cStruct; … … 7369 7160 const UInt uiQTTempAccessLayer = pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() - uiLog2TrSize; 7370 7161 7371 #if 0 //H_3D_DISABLE_CHROMA7372 Bool bCodeChroma = !pcCU->getSlice()->getIsDepth();7373 #else7374 7162 Bool bCodeChroma = true; 7375 #endif7376 7163 UInt uiTrModeC = uiTrMode; 7377 7164 UInt uiLog2TrSizeC = uiLog2TrSize-1; … … 7515 7302 } 7516 7303 m_pcEntropyCoder->encodeSkipFlag ( pcCU, 0, true ); 7517 #if SEC_DEPTH_INTRA_SKIP_MODE_K00337304 #if H_3D 7518 7305 m_pcEntropyCoder->encodeDIS ( pcCU, 0, true ); 7519 #else7520 #if H_3D_SINGLE_DEPTH7521 m_pcEntropyCoder->encodeSingleDepthMode ( pcCU, 0, true );7522 #endif7523 7306 #endif 7524 7307 m_pcEntropyCoder->encodePredMode( pcCU, 0, true ); 7525 7308 m_pcEntropyCoder->encodePartSize( pcCU, 0, pcCU->getDepth(0), true ); 7526 #if !HHI_MOVE_SYN_K0052 7309 m_pcEntropyCoder->encodePredInfo( pcCU, 0, true ); 7527 7310 #if H_3D_DIM_SDC 7528 7311 m_pcEntropyCoder->encodeSDCFlag( pcCU, 0, true ); 7529 7312 #endif 7530 #endif7531 m_pcEntropyCoder->encodePredInfo( pcCU, 0, true );7532 #if HHI_MOVE_SYN_K00527533 #if H_3D_DIM_SDC7534 m_pcEntropyCoder->encodeSDCFlag( pcCU, 0, true );7535 #endif7536 #endif7537 7313 #if H_3D_ARP 7538 7314 m_pcEntropyCoder->encodeARPW( pcCU , 0 ); … … 7541 7317 m_pcEntropyCoder->encodeICFlag( pcCU, 0, true ); 7542 7318 #endif 7543 #if H HI_MOVE_SYN_K00527319 #if H_3D 7544 7320 m_pcEntropyCoder->encodeDBBPFlag( pcCU, 0, true ); 7545 7321 #endif -
trunk/source/Lib/TLibEncoder/TEncSearch.h
r1179 r1196 191 191 TComYuv* pcRecoYuv, 192 192 UInt uiPreCalcDistC ); 193 #if SEC_DEPTH_INTRA_SKIP_MODE_K0033193 #if H_3D 194 194 Void estIntraPredDIS ( TComDataCU* pcCU, 195 195 TComYuv* pcOrgYuv, … … 199 199 UInt& ruiDistC, 200 200 Bool bLumaOnly ); 201 #else 202 #if H_3D_SINGLE_DEPTH 203 Void estIntraPredSingleDepth ( TComDataCU* pcCU, 204 TComYuv* pcOrgYuv, 205 TComYuv* pcPredYuv, 206 TComYuv* pcResiYuv, 207 TComYuv* pcRecoYuv, 208 UInt& ruiDistC, 209 Bool bLumaOnly ); 210 #endif 211 #endif 212 201 #endif 213 202 /// encoder estimation - inter prediction (non-skip) 214 203 Void predInterSearch ( TComDataCU* pcCU, … … 364 353 UInt uiAbsPartIdx, 365 354 UInt stateU0V1Both2 ); 366 #if SEC_DEPTH_INTRA_SKIP_MODE_K0033 355 356 #if H_3D 367 357 Void xIntraCodingDIS ( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Dist& ruiDist, Double& dRDCost, UInt uiPredMode ); 368 #else369 #if H_3D_SINGLE_DEPTH370 Void xIntraCodingSingleDepth( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Dist& ruiDist, Double& dRDCost, Int iTestDepthIdx, Pel * DepthNeighbor );371 #endif372 358 #endif 373 359 #if H_3D_DIM … … 480 466 UInt& ruiSAD ); 481 467 482 #if SONY_MV_V_CONST_C0078468 #if H_MV 483 469 Void xSetSearchRange ( TComDataCU* pcCU, 484 470 TComMv& cMvPred, -
trunk/source/Lib/TLibEncoder/TEncSlice.cpp
r1179 r1196 215 215 rpcSlice->setPicOutputFlag( true ); 216 216 rpcSlice->setPOC( pocCurr ); 217 #if !HHI_INTER_COMP_PRED_K0052218 #if H_3D219 rpcSlice->init3dToolParameters();220 #endif221 #endif222 217 #if H_3D_IC 223 218 rpcSlice->setApplyIC( false ); … … 612 607 rpcSlice->setSliceSegmentMode ( m_pcCfg->getSliceSegmentMode() ); 613 608 rpcSlice->setSliceSegmentArgument ( m_pcCfg->getSliceSegmentArgument() ); 614 #if !HHI_INTER_COMP_PRED_K0052615 #if H_3D_IV_MERGE616 rpcSlice->setMaxNumMergeCand ( m_pcCfg->getMaxNumMergeCand() + ( ( rpcSlice->getMpiFlag( ) || rpcSlice->getIvMvPredFlag( ) || rpcSlice->getViewSynthesisPredFlag( ) ) ? 1 : 0 ));617 #else618 rpcSlice->setMaxNumMergeCand ( m_pcCfg->getMaxNumMergeCand() );619 #endif620 #else621 609 #if !H_3D 622 610 rpcSlice->setMaxNumMergeCand ( m_pcCfg->getMaxNumMergeCand() ); 623 #endif624 611 #endif 625 612 xStoreWPparam( pPPS->getUseWP(), pPPS->getWPBiPred() ); -
trunk/source/Lib/TLibEncoder/TEncTop.cpp
r1179 r1196 91 91 m_aICEnableNum = NULL; 92 92 #endif 93 #if H_3D _ANNEX_SELECTION_FIX93 #if H_3D 94 94 m_cCavlcCoder.setEncTop(this); 95 95 #endif … … 417 417 #endif 418 418 #if H_3D 419 #if HHI_CAM_PARA_K0052420 419 pcPicCurr->setScaleOffset( m_cameraParameters->getCodedScale(), m_cameraParameters->getCodedOffset() ); 421 #else422 pcPicCurr->setScaleOffset( m_aaiCodedScale, m_aaiCodedOffset );423 #endif424 420 #endif 425 421 } … … 768 764 m_cSPS.setSpsInferScalingListFlag ( true ); 769 765 m_cSPS.setSpsScalingListRefLayerId( m_cVPS->getIdRefLayer( getLayerId(), 0 ) ); 770 #if SONY_MV_V_CONST_C0078766 #if H_MV 771 767 if ( m_bUseDisparitySearchRangeRestriction ) 772 768 {
Note: See TracChangeset for help on using the changeset viewer.