Changeset 28 in 3DVCSoftware for branches/0.3-poznan-univ/source/Lib/TLibEncoder/TEncSearch.cpp
- Timestamp:
- 24 Feb 2012, 20:22:58 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/0.3-poznan-univ/source/Lib/TLibEncoder/TEncSearch.cpp
r5 r28 1042 1042 UInt uiAbsSum = 0; 1043 1043 pcCU ->setTrIdxSubParts ( uiTrDepth, uiAbsPartIdx, uiFullDepth ); 1044 #if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH 1045 m_pcTrQuant->setQPforQuant ( pcCU->getQP( 0 ) + pcCU->getQpOffsetForTextCU(uiAbsPartIdx, true), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA ); 1046 #else 1044 1047 m_pcTrQuant->setQPforQuant ( pcCU->getQP( 0 ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA ); 1048 #endif 1045 1049 m_pcTrQuant->transformNxN ( pcCU, piResi, uiStride, pcCoeff, uiWidth, uiHeight, uiAbsSum, TEXT_LUMA, uiAbsPartIdx ); 1046 1050 … … 1208 1212 //--- transform and quantization --- 1209 1213 UInt uiAbsSum = 0; 1214 #if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH 1215 m_pcTrQuant->setQPforQuant ( pcCU->getQP( 0 ) + pcCU->getQpOffsetForTextCU(uiAbsPartIdx, true), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA ); 1216 #else 1210 1217 m_pcTrQuant->setQPforQuant ( pcCU->getQP( 0 ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA ); 1218 #endif 1211 1219 m_pcTrQuant->transformNxN ( pcCU, piResi, uiStride, pcCoeff, uiWidth, uiHeight, uiAbsSum, eText, uiAbsPartIdx ); 1212 1220 //--- set coded block flag --- … … 2814 2822 } 2815 2823 2824 #if POZNAN_DBMP 2825 Void TEncSearch::xGetInterPredictionError_DBMP( TComDataCU* pcCU, TComYuv* pcYuvOrg, Int iPartIdx, UInt& ruiErr, Bool bHadamard ) 2826 { 2827 TComYuv cYuvPred; 2828 cYuvPred.create( pcYuvOrg->getWidth(), pcYuvOrg->getHeight() ); 2829 2830 #ifdef WEIGHT_PRED 2831 UInt uiAbsPartIdx = 0; 2832 Int iWidth = 0; 2833 Int iHeight = 0; 2834 //Int iRefIdx[2]; 2835 pcCU->getPartIndexAndSize( iPartIdx, uiAbsPartIdx, iWidth, iHeight ); 2836 2837 //??????????????????????????????????????????????????????????????????????????????????? 2838 //iRefIdx[0] = pcCU->getCUMvField( REF_PIC_LIST_0 )->getRefIdx( uiAbsPartIdx ); 2839 //iRefIdx[1] = pcCU->getCUMvField( REF_PIC_LIST_1 )->getRefIdx( uiAbsPartIdx ); 2840 //if ( iRefIdx[0]>=0 && iRefIdx[1]<1 ) 2841 // setWpScalingDistParam( pcCU, iRefIdx[0], iRefIdx[1], REF_PIC_LIST_0); 2842 //else 2843 // setWpScalingDistParam( pcCU, iRefIdx[0], iRefIdx[1], REF_PIC_LIST_1); 2844 setWpScalingDistParam( pcCU, -1, -1, REF_PIC_LIST_X);//??? 2845 //??????????????????????????????????????????????????????????????????????????????????? 2846 motionCompensation_DBMP( pcCU, &cYuvPred, REF_PIC_LIST_X, iPartIdx ); 2847 #else 2848 motionCompensation_DBMP( pcCU, &cYuvPred, REF_PIC_LIST_X, iPartIdx ); 2849 2850 UInt uiAbsPartIdx = 0; 2851 Int iWidth = 0; 2852 Int iHeight = 0; 2853 pcCU->getPartIndexAndSize( iPartIdx, uiAbsPartIdx, iWidth, iHeight ); 2854 #endif 2855 2856 DistParam cDistParam; 2857 #ifdef WEIGHT_PRED 2858 cDistParam.applyWeight = false; 2859 #endif 2860 m_pcRdCost->setDistParam( cDistParam, 2861 pcYuvOrg->getLumaAddr( uiAbsPartIdx ), pcYuvOrg->getStride(), 2862 cYuvPred .getLumaAddr( uiAbsPartIdx ), cYuvPred .getStride(), 2863 iWidth, iHeight, m_pcEncCfg->getUseHADME() ); 2864 ruiErr = cDistParam.DistFunc( &cDistParam ); 2865 2866 cYuvPred.destroy(); 2867 } 2868 #endif 2869 2816 2870 /** estimation of best merge coding 2817 2871 * \param pcCU … … 2875 2929 PartSize ePartSize = pcCU->getPartitionSize( 0 ); 2876 2930 2931 #if POZNAN_DBMP_CALC_PRED_DATA 2932 if(uiMergeCand==POZNAN_DBMP_MRG_CAND) 2933 { 2934 pcCU->getCUMvField2nd( REF_PIC_LIST_0 )->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand].getMv(), cMvFieldNeighbours[0 + 2*uiMergeCand].getRefIdx(), ePartSize, uiAbsPartIdx, iPUIdx, 0 ); 2935 pcCU->getCUMvField2nd( REF_PIC_LIST_1 )->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand].getMv(), cMvFieldNeighbours[1 + 2*uiMergeCand].getRefIdx(), ePartSize, uiAbsPartIdx, iPUIdx, 0 ); 2936 } 2937 else 2938 #endif 2939 { 2877 2940 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand].getMv(), cMvFieldNeighbours[0 + 2*uiMergeCand].getRefIdx(), ePartSize, uiAbsPartIdx, iPUIdx, 0 ); 2878 2941 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand].getMv(), cMvFieldNeighbours[1 + 2*uiMergeCand].getRefIdx(), ePartSize, uiAbsPartIdx, iPUIdx, 0 ); 2879 2942 } 2943 2944 #if POZNAN_DBMP 2945 if(uiMergeCand==POZNAN_DBMP_MRG_CAND) 2946 xGetInterPredictionError_DBMP( pcCU, pcYuvOrg, iPUIdx, uiCostCand, m_pcEncCfg->getUseHADME() ); 2947 else 2880 2948 xGetInterPredictionError( pcCU, pcYuvOrg, iPUIdx, uiCostCand, m_pcEncCfg->getUseHADME() ); 2949 #else 2950 xGetInterPredictionError( pcCU, pcYuvOrg, iPUIdx, uiCostCand, m_pcEncCfg->getUseHADME() ); 2951 #endif 2881 2952 2882 2953 if( uiNumCand == 1 ) … … 2886 2957 else 2887 2958 { 2888 if( uiMergeCand == 0 || uiNumCand == 2 ) 2959 UInt uiMergeCandIdx = uiMergeCand; 2960 #if POZNAN_DBMP 2961 if(pcCU->getSlice()->getMP()->isDBMPEnabled()) 2962 { 2963 if(uiMergeCand == POZNAN_DBMP_MRG_CAND) uiMergeCandIdx = POZNAN_DBMP_MERGE_POS; 2964 else if(uiMergeCand >= POZNAN_DBMP_MERGE_POS) uiMergeCandIdx++; 2965 } 2966 #endif 2967 2968 if( uiMergeCandIdx == 0 || uiNumCand == 2 ) 2889 2969 { 2890 2970 uiBitsCand = 2; 2891 2971 } 2892 else if( uiMergeCand == 1 || uiNumCand == 3 )2972 else if( uiMergeCandIdx == 1 || uiNumCand == 3 ) 2893 2973 { 2894 2974 uiBitsCand = 3; 2895 2975 } 2896 else if( uiMergeCand == 2 || uiNumCand == 4 )2976 else if( uiMergeCandIdx == 2 || uiNumCand == 4 ) 2897 2977 { 2898 2978 uiBitsCand = 4; 2899 2979 } 2980 else if( uiMergeCandIdx == 3 || uiNumCand == 5 ) 2981 { 2982 uiBitsCand = 5; 2983 } 2900 2984 else 2901 2985 { 2902 uiBitsCand = 5;2986 uiBitsCand = 6; 2903 2987 } 2904 2988 } … … 2910 2994 pacMvField[0] = cMvFieldNeighbours[0 + 2*uiMergeCand]; 2911 2995 pacMvField[1] = cMvFieldNeighbours[1 + 2*uiMergeCand]; 2996 2997 #if POZNAN_DBMP_CALC_PRED_DATA 2998 if(uiMergeCand==POZNAN_DBMP_MRG_CAND) 2999 { 3000 TComCUMvField* pcDBMPPredMvField; 3001 3002 pcDBMPPredMvField = pcCU->getSlice()->getMP()->getDBMPPredMVField(REF_PIC_LIST_0); 3003 pcDBMPPredMvField->setMv(pcCU->getCUMvField(REF_PIC_LIST_0)->getMv(uiAbsPartIdx),0); 3004 pcDBMPPredMvField->setRefIdx(pcCU->getCUMvField(REF_PIC_LIST_0)->getRefIdx(uiAbsPartIdx),0); 3005 3006 pcDBMPPredMvField = pcCU->getSlice()->getMP()->getDBMPPredMVField(REF_PIC_LIST_1); 3007 pcDBMPPredMvField->setMv(pcCU->getCUMvField(REF_PIC_LIST_1)->getMv(uiAbsPartIdx),0); 3008 pcDBMPPredMvField->setRefIdx(pcCU->getCUMvField(REF_PIC_LIST_1)->getRefIdx(uiAbsPartIdx),0); 3009 } 3010 #endif 3011 2912 3012 uiInterDir = uhInterDirNeighbours[uiMergeCand]; 2913 3013 uiMergeIndex = uiMergeCand; … … 3604 3704 pcCU->setMergeIndexSubParts( uiMRGIndex, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 3605 3705 pcCU->setInterDirSubParts ( uiMRGInterDir, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 3706 3707 #if POZNAN_DBMP_CALC_PRED_DATA 3708 if(uiMRGIndex==POZNAN_DBMP_MRG_CAND) 3709 { 3710 TComCUMvField* pcDBMPPredMvField; 3711 pcDBMPPredMvField = pcCU->getSlice()->getMP()->getDBMPPredMVField(REF_PIC_LIST_0); 3712 pcCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( pcDBMPPredMvField->getMv(0), pcDBMPPredMvField->getRefIdx(0), ePartSize, uiPartAddr, iPartIdx, 0 ); 3713 pcDBMPPredMvField = pcCU->getSlice()->getMP()->getDBMPPredMVField(REF_PIC_LIST_1); 3714 pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( pcDBMPPredMvField->getMv(0), pcDBMPPredMvField->getRefIdx(0), ePartSize, uiPartAddr, iPartIdx, 0 ); 3715 3716 pcCU->getCUMvField2nd( REF_PIC_LIST_0 )->setAllMvField( cMRGMvField[0].getMv(), cMRGMvField[0].getRefIdx(), ePartSize, uiPartAddr, iPartIdx, 0 ); 3717 pcCU->getCUMvField2nd( REF_PIC_LIST_1 )->setAllMvField( cMRGMvField[1].getMv(), cMRGMvField[1].getRefIdx(), ePartSize, uiPartAddr, iPartIdx, 0 ); 3718 } 3719 else 3720 #endif 3606 3721 { 3607 3722 pcCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMRGMvField[0].getMv(), cMRGMvField[0].getRefIdx(), ePartSize, uiPartAddr, iPartIdx, 0 ); … … 4998 5113 m_pcEntropyCoder->estimateBit(m_pcTrQuant->m_pcEstBitsSbac, 1<< uiLog2TrSize, TEXT_LUMA ); 4999 5114 } 5115 #if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH 5116 m_pcTrQuant->setQPforQuant( pcCU->getQP( 0 ) + pcCU->getQpOffsetForTextCU(uiAbsPartIdx, false), false, pcCU->getSlice()->getSliceType(), TEXT_LUMA ); 5117 #else 5000 5118 m_pcTrQuant->setQPforQuant( pcCU->getQP( 0 ), false, pcCU->getSlice()->getSliceType(), TEXT_LUMA ); 5119 #endif 5001 5120 m_pcTrQuant->transformNxN( pcCU, pcResi->getLumaAddr( uiAbsPartIdx ), pcResi->getStride (), pcCoeffCurrY, 1<< uiLog2TrSize, 1<< uiLog2TrSize, uiAbsSumY, TEXT_LUMA, uiAbsPartIdx ); 5002 5121 … … 5009 5128 m_pcEntropyCoder->estimateBit(m_pcTrQuant->m_pcEstBitsSbac, 1<<uiLog2TrSizeC, TEXT_CHROMA ); 5010 5129 } 5130 #if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH 5131 m_pcTrQuant->setQPforQuant( pcCU->getQP( 0 ) + pcCU->getQpOffsetForTextCU(uiAbsPartIdx, false), false, pcCU->getSlice()->getSliceType(), TEXT_CHROMA ); 5132 #else 5011 5133 m_pcTrQuant->setQPforQuant( pcCU->getQP( 0 ), false, pcCU->getSlice()->getSliceType(), TEXT_CHROMA ); 5134 #endif 5012 5135 m_pcTrQuant->transformNxN( pcCU, pcResi->getCbAddr( uiAbsPartIdx ), pcResi->getCStride(), pcCoeffCurrU, 1<<uiLog2TrSizeC, 1<<uiLog2TrSizeC, uiAbsSumU, TEXT_CHROMA_U, uiAbsPartIdx ); 5013 5136 m_pcTrQuant->transformNxN( pcCU, pcResi->getCrAddr( uiAbsPartIdx ), pcResi->getCStride(), pcCoeffCurrV, 1<<uiLog2TrSizeC, 1<<uiLog2TrSizeC, uiAbsSumV, TEXT_CHROMA_V, uiAbsPartIdx ); … … 5072 5195 { 5073 5196 Pel *pcResiCurrY = m_pcQTTempTComYuv[uiQTTempAccessLayer].getLumaAddr( uiAbsPartIdx ); 5197 #if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH 5198 m_pcTrQuant->setQPforQuant( pcCU->getQP( 0 ) + pcCU->getQpOffsetForTextCU(uiAbsPartIdx, false), false, pcCU->getSlice()->getSliceType(), TEXT_LUMA ); 5199 #else 5074 5200 m_pcTrQuant->setQPforQuant( pcCU->getQP( 0 ), false, pcCU->getSlice()->getSliceType(), TEXT_LUMA ); 5201 #endif 5075 5202 #if INTRA_DST_TYPE_7 // Inside Inter Encoder Search. So use conventional DCT. 5076 5203 m_pcTrQuant->invtransformNxN( TEXT_LUMA,REG_DCT, pcResiCurrY, m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride(), pcCoeffCurrY, 1<< uiLog2TrSize, 1<< uiLog2TrSize );//this is for inter mode only … … 5150 5277 { 5151 5278 Pel *pcResiCurrU = m_pcQTTempTComYuv[uiQTTempAccessLayer].getCbAddr( uiAbsPartIdx ); 5279 #if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH 5280 m_pcTrQuant->setQPforQuant( pcCU->getQP( 0 ) + pcCU->getQpOffsetForTextCU(uiAbsPartIdx, false), false, pcCU->getSlice()->getSliceType(), TEXT_CHROMA ); 5281 #else 5152 5282 m_pcTrQuant->setQPforQuant( pcCU->getQP( 0 ), false, pcCU->getSlice()->getSliceType(), TEXT_CHROMA ); 5283 #endif 5153 5284 #if INTRA_DST_TYPE_7 // Inside Inter Encoder Search. So use conventional DCT. 5154 5285 m_pcTrQuant->invtransformNxN( TEXT_CHROMA,REG_DCT, pcResiCurrU, m_pcQTTempTComYuv[uiQTTempAccessLayer].getCStride(), pcCoeffCurrU, 1<<uiLog2TrSizeC, 1<<uiLog2TrSizeC); … … 5195 5326 if( !uiAbsSumU ) 5196 5327 { 5328 #if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH 5329 m_pcTrQuant->setQPforQuant( pcCU->getQP( 0 ) + pcCU->getQpOffsetForTextCU(uiAbsPartIdx, false), false, pcCU->getSlice()->getSliceType(), TEXT_CHROMA ); 5330 #else 5197 5331 m_pcTrQuant->setQPforQuant( pcCU->getQP( 0 ), false, pcCU->getSlice()->getSliceType(), TEXT_CHROMA ); 5332 #endif 5198 5333 } 5199 5334 #if INTRA_DST_TYPE_7 // Inside Inter Encoder Search. So use conventional DCT.
Note: See TracChangeset for help on using the changeset viewer.