Changeset 433 in 3DVCSoftware for branches/HTM-6.2-dev0/source/Lib/TLibDecoder/TDecSbac.cpp
- Timestamp:
- 22 May 2013, 21:05:43 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-6.2-dev0/source/Lib/TLibDecoder/TDecSbac.cpp
r427 r433 37 37 38 38 #include "TDecSbac.h" 39 40 #if RWTH_SDC_DLT_B003641 #define GetNumDepthValues() (pcCU->getSlice()->getSPS()->getNumDepthValues())42 #define GetBitsPerDepthValue() (pcCU->getSlice()->getSPS()->getBitsPerDepthValue())43 #endif44 39 45 40 //! \ingroup TLibDecoder … … 103 98 #endif 104 99 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 100 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 105 101 , m_cDmmFlagSCModel ( 1, 1, NUM_DMM_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 106 102 , m_cDmmModeSCModel ( 1, 1, NUM_DMM_MODE_CTX , m_contextModels + m_numContextModels, m_numContextModels) 103 #endif 107 104 , m_cDmmDataSCModel ( 1, 1, NUM_DMM_DATA_CTX , m_contextModels + m_numContextModels, m_numContextModels) 108 105 #endif … … 114 111 #endif 115 112 #if RWTH_SDC_DLT_B0036 113 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 116 114 , m_cSDCFlagSCModel ( 1, 1, SDC_NUM_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 115 #else 116 , m_cDepthModeModel ( 1, 1, DEPTH_MODE_NUM_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 117 , m_cDmmDeltaFlagModel ( 1, 1, DMM_DELTA_NUM_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 118 #endif 119 #if RWTH_SDC_CTX_SIMPL_D0032 120 , m_cSDCResidualFlagSCModel ( 1, 1, SDC_NUM_RESIDUAL_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 121 , m_cSDCResidualSCModel ( 1, 1, SDC_NUM_RESIDUAL_CTX , m_contextModels + m_numContextModels, m_numContextModels) 122 , m_cSDCPredModeSCModel ( 1, 3, SDC_NUM_PRED_MODE_CTX , m_contextModels + m_numContextModels, m_numContextModels) 123 #else 117 124 , m_cSDCResidualFlagSCModel ( 1, 2, SDC_NUM_RESIDUAL_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 118 125 , m_cSDCResidualSignFlagSCModel ( 1, 2, SDC_NUM_SIGN_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) 119 126 , m_cSDCResidualSCModel ( 1, 2, SDC_NUM_RESIDUAL_CTX , m_contextModels + m_numContextModels, m_numContextModels) 120 127 , m_cSDCPredModeSCModel ( 1, 3, SDC_NUM_PRED_MODE_CTX , m_contextModels + m_numContextModels, m_numContextModels) 128 #endif 121 129 #endif 122 130 { … … 216 224 m_uiLastDQpNonZero = 0; 217 225 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 226 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 218 227 m_cDmmFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_DMM_FLAG ); 219 228 m_cDmmModeSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_DMM_MODE ); 229 #endif 220 230 m_cDmmDataSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_DMM_DATA ); 221 231 #endif 222 232 #if RWTH_SDC_DLT_B0036 233 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 223 234 m_cSDCFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SDC_FLAG ); 235 #else 236 m_cDepthModeModel.initBuffer ( sliceType, qp, (UChar*)INIT_DEPTHMODE_FLAG ); 237 m_cDmmDeltaFlagModel.initBuffer ( sliceType, qp, (UChar*)INIT_DMMDELTA_FLAG ); 238 #endif 224 239 m_cSDCResidualFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SDC_RESIDUAL_FLAG ); 225 240 m_cSDCResidualSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SDC_RESIDUAL ); 241 #if !RWTH_SDC_CTX_SIMPL_D0032 226 242 m_cSDCResidualSignFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SDC_SIGN_FLAG ); 243 #endif 227 244 m_cSDCPredModeSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SDC_PRED_MODE ); 228 245 #endif … … 303 320 m_cCUTransSubdivFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_TRANS_SUBDIV_FLAG ); 304 321 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 322 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 305 323 m_cDmmFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DMM_FLAG ); 306 324 m_cDmmModeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DMM_MODE ); 325 #endif 307 326 m_cDmmDataSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DMM_DATA ); 308 327 #endif 309 328 #if RWTH_SDC_DLT_B0036 329 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 310 330 m_cSDCFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_FLAG ); 331 #else 332 m_cDepthModeModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DEPTHMODE_FLAG ); 333 m_cDmmDeltaFlagModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DMMDELTA_FLAG ); 334 #endif 311 335 m_cSDCResidualFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL_FLAG ); 312 336 m_cSDCResidualSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL ); 337 #if !RWTH_SDC_CTX_SIMPL_D0032 313 338 m_cSDCResidualSignFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_SIGN_FLAG ); 339 #endif 314 340 m_cSDCPredModeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_PRED_MODE ); 315 341 #endif … … 894 920 } 895 921 922 UInt uiSymbol; 923 if (bDmmFlag) 924 { 925 if (bDmmFlag) 926 { 927 m_pcTDecBinIf->decodeBin( uiSymbol , m_cDmmDeltaFlagModel.get(0, 0, 0) ); 928 uiDir += uiSymbol; 929 } 930 if (uiSymbol) 931 { 932 UInt uiDC; 933 Int iDC = 0,iDC1 = 0,iDC2 = 0; 934 for ( Int i = 0; i <2; i++ ) 935 { 936 xReadExGolombLevel( uiDC, m_cDmmDataSCModel.get(0, 0, 1) ); 937 iDC = uiDC; 938 if ( uiDC ) 939 { 940 UInt uiSign; 941 m_pcTDecBinIf->decodeBinEP( uiSign ); 942 if ( uiSign ) 943 { 944 iDC = -iDC; 945 } 946 } 947 if ( i == 0 ) { iDC1 = iDC; } 948 else { iDC2 = iDC; } 949 } 950 951 if( uiDir == DMM_WEDGE_FULL_D_IDX ) 952 { 953 pcCU->setWedgeFullDeltaDC1SubParts( iDC1, uiAbsPartIdx, uiDepth ); 954 pcCU->setWedgeFullDeltaDC2SubParts( iDC2, uiAbsPartIdx, uiDepth ); 955 } 956 else if( uiDir == DMM_WEDGE_PREDDIR_D_IDX ) 957 { 958 pcCU->setWedgePredDirDeltaDC1SubParts( iDC1, uiAbsPartIdx, uiDepth ); 959 pcCU->setWedgePredDirDeltaDC2SubParts( iDC2, uiAbsPartIdx, uiDepth ); 960 } 961 else if( uiDir == DMM_WEDGE_PREDTEX_D_IDX) 962 { 963 pcCU->setWedgePredTexDeltaDC1SubParts( iDC1, uiAbsPartIdx, uiDepth ); 964 pcCU->setWedgePredTexDeltaDC2SubParts( iDC2, uiAbsPartIdx, uiDepth ); 965 } 966 else if (uiDir== DMM_CONTOUR_PREDTEX_D_IDX ) 967 { 968 pcCU->setContourPredTexDeltaDC1SubParts( iDC1, uiAbsPartIdx, uiDepth ); 969 pcCU->setContourPredTexDeltaDC2SubParts( iDC2, uiAbsPartIdx, uiDepth ); 970 } 971 } 972 } 973 else if (uiDir >= EDGE_INTRA_IDX) 974 { 975 m_pcTDecBinIf->decodeBin( uiSymbol, m_cEdgeIntraDeltaDCSCModel.get(0, 0, 0) ); 976 if( uiSymbol ) 977 { 978 uiDir = EDGE_INTRA_DELTA_IDX; 979 Int iDeltaDC = 0,iDeltaDC0 = 0,iDeltaDC1 = 0; 980 for (Int i = 0; i<2; i++) 981 { 982 xReadExGolombLevel( (UInt &) iDeltaDC, m_cEdgeIntraDeltaDCSCModel.get(0, 0, 1) ); 983 if( iDeltaDC != 0 ) 984 { 985 UInt uiSign; 986 m_pcTDecBinIf->decodeBinEP( uiSign ); 987 if ( uiSign ) 988 { 989 iDeltaDC = -iDeltaDC; 990 } 991 } 992 if ( i == 0 ) { iDeltaDC0 = iDeltaDC; } 993 else { iDeltaDC1 = iDeltaDC; } 994 } 995 996 pcCU->setEdgeDeltaDC0( uiAbsPartIdx, iDeltaDC0 ); 997 pcCU->setEdgeDeltaDC1( uiAbsPartIdx, iDeltaDC1 ); 998 } 999 } 1000 else if(bSdcFlag)//SDC mode 1001 { 1002 assert(pcCU->getPartitionSize(uiAbsPartIdx)!=SIZE_NxN); 1003 pcCU->setTrIdxSubParts(0, uiAbsPartIdx, uiDepth); 1004 pcCU->setCbfSubParts(1, 1, 1, uiAbsPartIdx, uiDepth); 1005 1006 UInt uiNumSegments = ( uiDir == DC_IDX || uiDir == PLANAR_IDX )? 1 : 2; 1007 for (int uiSeg=0; uiSeg<uiNumSegments; uiSeg++) 1008 { 1009 parseSDCResidualData(pcCU, uiAbsPartIdx, uiDepth, uiSeg); 1010 } 1011 } 1012 1013 pcCU->setLumaIntraDirSubParts( (UChar)uiDir, uiAbsPartIdx, uiDepth ); 1014 } 1015 #endif 896 1016 Void TDecSbac::parseIntraDirLumaAng ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 897 1017 { 898 1018 UInt uiSymbol; 899 1019 Int intraPredMode; 900 1020 #if PKU_QC_DEPTH_INTRA_UNI_D0195 1021 if (pcCU->getSlice()->getSPS()->isDepth()) 1022 { 1023 parseDepthModelingTable(pcCU, uiAbsPartIdx, uiDepth); 1024 } 1025 if (pcCU->getLumaIntraDir(uiAbsPartIdx)<NUM_INTRA_MODE && !pcCU->getSDCFlag(uiAbsPartIdx)) 1026 { 1027 #else 901 1028 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 902 1029 UInt uiFlag = 0; … … 952 1079 } 953 1080 #endif 954 955 1081 Int uiPreds[3] = {-1, -1, -1}; 956 1082 Int uiPredNum = pcCU->getIntraDirLumaPredictor(uiAbsPartIdx, uiPreds); 1083 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 957 1084 #if LGE_EDGE_INTRA_A0070 958 1085 UInt uiCheckBit = 0; 959 1086 #endif 1087 #endif 960 1088 961 1089 m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUIntraPredSCModel.get( 0, 0, 0) ); … … 977 1105 978 1106 m_pcTDecBinIf->decodeBinsEP( uiSymbol, 5 ); 1107 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 979 1108 #if LGE_EDGE_INTRA_A0070 980 1109 if (bCodeEdgeIntra) … … 987 1116 } 988 1117 } 1118 #endif 989 1119 #endif 990 1120 intraPredMode = uiSymbol; … … 1003 1133 std::swap(uiPreds[1], uiPreds[2]); 1004 1134 } 1135 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 1005 1136 #if LGE_EDGE_INTRA_A0070 1006 1137 if ( intraPredMode != EDGE_INTRA_IDX) 1007 1138 { 1008 1139 #endif 1140 #endif 1009 1141 for ( Int i = 0; i < uiPredNum; i++ ) 1010 1142 { 1011 1143 intraPredMode += ( intraPredMode >= uiPreds[i] ); 1012 1144 } 1145 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 1013 1146 #if LGE_EDGE_INTRA_A0070 1014 1147 } 1015 1148 #endif 1016 } 1017 1149 #endif 1150 } 1151 1152 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 1018 1153 #if LGE_EDGE_INTRA_A0070 1019 1154 if( intraPredMode == EDGE_INTRA_IDX ) … … 1059 1194 } 1060 1195 #endif 1061 1062 1196 pcCU->setLumaIntraDirSubParts( (UChar)intraPredMode, uiAbsPartIdx, uiDepth ); 1197 #else 1198 pcCU->setLumaIntraDirSubParts( (UChar)intraPredMode, uiAbsPartIdx, uiDepth ); 1199 } 1200 #endif 1063 1201 } 1064 1202 … … 2629 2767 2630 2768 #if RWTH_SDC_DLT_B0036 2769 #if !PKU_QC_DEPTH_INTRA_UNI_D0195 2631 2770 Void TDecSbac::parseSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 2632 2771 { … … 2661 2800 { 2662 2801 UInt uiIsMostProb = 0; 2802 #if INTEL_SDC64_D0193 2803 if( !(pcCU->getWidth(uiAbsPartIdx) == 64 && i == 1)) 2804 #endif 2663 2805 m_pcTDecBinIf->decodeBin( uiIsMostProb, m_cSDCPredModeSCModel.get( 0, i, uiCtx ) ); 2664 2806 … … 2679 2821 pcCU->setLumaIntraDirSubParts((UChar)intraPredMode, uiAbsPartIdx, uiDepth); 2680 2822 } 2823 #endif 2681 2824 2682 2825 Void TDecSbac::parseSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiSegment ) … … 2692 2835 Int iIdx = 0; 2693 2836 2694 UInt uiMaxResidualBits = GetBitsPerDepthValue();2837 UInt uiMaxResidualBits = pcCU->getSlice()->getSPS()->getBitsPerDepthValue(); 2695 2838 assert( uiMaxResidualBits <= g_uiBitDepth ); 2696 2839 2840 #if RWTH_SDC_CTX_SIMPL_D0032 2841 m_pcTDecBinIf->decodeBin(uiResidual, m_cSDCResidualFlagSCModel.get( 0, 0, 0 ) ); 2842 #else 2697 2843 m_pcTDecBinIf->decodeBin(uiResidual, m_cSDCResidualFlagSCModel.get( 0, uiSegment, 0 ) ); 2844 #endif 2698 2845 2699 2846 if (uiResidual) 2700 2847 { 2701 2848 // decode residual sign bit 2849 #if RWTH_SDC_CTX_SIMPL_D0032 2850 m_pcTDecBinIf->decodeBinEP(uiSign); 2851 #else 2702 2852 m_pcTDecBinIf->decodeBin(uiSign, m_cSDCResidualSignFlagSCModel.get( 0, uiSegment, 0 ) ); 2853 #endif 2703 2854 2704 2855 // decode residual magnitude 2856 #if LGE_CONCATENATE_D0141 2857 //prefix part 2858 UInt uiCount = 0; 2859 UInt uiNumDepthValues = pcCU->getSlice()->getSPS()->getNumDepthValues(); 2860 UInt uiPrefixThreshold = ((uiNumDepthValues * 3) >> 2); 2861 for ( UInt ui = 0; ui < uiPrefixThreshold; ui++) 2862 { 2863 m_pcTDecBinIf->decodeBin( uiBit, m_cSDCResidualSCModel.get(0, 0, 0) ); 2864 if ( uiBit == 0 ) 2865 break; 2866 else 2867 uiCount++; 2868 } 2869 //suffix part 2870 if ( uiCount == uiPrefixThreshold ) 2871 { 2872 for ( UInt ui = 0; ui < ( (UInt)ceil( Log2(uiNumDepthValues - uiPrefixThreshold) ) ); ui++ ) 2873 { 2874 m_pcTDecBinIf->decodeBinEP( uiBit ); 2875 uiAbsIdx |= uiBit << ui; 2876 } 2877 uiAbsIdx += uiCount; 2878 } 2879 else 2880 uiAbsIdx = uiCount; 2881 #else 2705 2882 for (Int i=0; i<uiMaxResidualBits; i++) 2706 2883 { 2884 #if RWTH_SDC_CTX_SIMPL_D0032 2885 m_pcTDecBinIf->decodeBin(uiBit, m_cSDCResidualSCModel.get( 0, 0, i ) ); 2886 #else 2707 2887 m_pcTDecBinIf->decodeBin(uiBit, m_cSDCResidualSCModel.get( 0, uiSegment, i ) ); 2888 #endif 2708 2889 uiAbsIdx |= uiBit << i; 2709 2890 } 2891 #endif 2710 2892 2711 2893 uiAbsIdx += 1;
Note: See TracChangeset for help on using the changeset viewer.