Ignore:
Timestamp:
24 Feb 2012, 20:22:58 (13 years ago)
Author:
poznan-univ
Message:

Poznan Tools

  • Encoding only disoccluded CUs in depended views
  • Depth based motion prediction
  • Texture QP adjustment based on depth data
  • Nonlinear depth representation
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/0.3-poznan-univ/source/Lib/TLibEncoder/TEncSearch.cpp

    r5 r28  
    10421042  UInt uiAbsSum = 0;
    10431043  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
    10441047  m_pcTrQuant->setQPforQuant    ( pcCU->getQP( 0 ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA );
     1048#endif
    10451049  m_pcTrQuant->transformNxN     ( pcCU, piResi, uiStride, pcCoeff, uiWidth, uiHeight, uiAbsSum, TEXT_LUMA, uiAbsPartIdx );
    10461050
     
    12081212    //--- transform and quantization ---
    12091213    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
    12101217    m_pcTrQuant->setQPforQuant     ( pcCU->getQP( 0 ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA );
     1218#endif
    12111219    m_pcTrQuant->transformNxN      ( pcCU, piResi, uiStride, pcCoeff, uiWidth, uiHeight, uiAbsSum, eText, uiAbsPartIdx );
    12121220    //--- set coded block flag ---
     
    28142822}
    28152823
     2824#if POZNAN_DBMP
     2825Void 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
    28162870/** estimation of best merge coding
    28172871 * \param pcCU
     
    28752929      PartSize ePartSize = pcCU->getPartitionSize( 0 );
    28762930
     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          {
    28772940      pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand].getMv(), cMvFieldNeighbours[0 + 2*uiMergeCand].getRefIdx(), ePartSize, uiAbsPartIdx, iPUIdx, 0 );
    28782941      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
    28802948      xGetInterPredictionError( pcCU, pcYuvOrg, iPUIdx, uiCostCand, m_pcEncCfg->getUseHADME() );
     2949#else
     2950      xGetInterPredictionError( pcCU, pcYuvOrg, iPUIdx, uiCostCand, m_pcEncCfg->getUseHADME() );
     2951#endif
    28812952
    28822953      if( uiNumCand == 1 )
     
    28862957      else
    28872958      {
    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 )
    28892969        {
    28902970          uiBitsCand = 2;
    28912971        }
    2892         else if( uiMergeCand == 1 || uiNumCand == 3 )
     2972        else if( uiMergeCandIdx == 1 || uiNumCand == 3 )
    28932973        {
    28942974          uiBitsCand = 3;
    28952975        }
    2896         else if( uiMergeCand == 2 || uiNumCand == 4 )
     2976        else if( uiMergeCandIdx == 2 || uiNumCand == 4 )
    28972977        {
    28982978          uiBitsCand = 4;
    28992979        }
     2980                else if( uiMergeCandIdx == 3 || uiNumCand == 5 )
     2981        {
     2982          uiBitsCand = 5;
     2983        }
    29002984        else
    29012985        {
    2902           uiBitsCand = 5;
     2986          uiBitsCand = 6;
    29032987        }
    29042988      }
     
    29102994        pacMvField[0] = cMvFieldNeighbours[0 + 2*uiMergeCand];
    29112995        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
    29123012        uiInterDir = uhInterDirNeighbours[uiMergeCand];
    29133013        uiMergeIndex = uiMergeCand;
     
    36043704        pcCU->setMergeIndexSubParts( uiMRGIndex,    uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
    36053705        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
    36063721        {
    36073722          pcCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMRGMvField[0].getMv(), cMRGMvField[0].getRefIdx(), ePartSize, uiPartAddr, iPartIdx, 0 );
     
    49985113      m_pcEntropyCoder->estimateBit(m_pcTrQuant->m_pcEstBitsSbac, 1<< uiLog2TrSize, TEXT_LUMA );
    49995114    }
     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
    50005118    m_pcTrQuant->setQPforQuant( pcCU->getQP( 0 ), false, pcCU->getSlice()->getSliceType(), TEXT_LUMA );
     5119#endif
    50015120    m_pcTrQuant->transformNxN( pcCU, pcResi->getLumaAddr( uiAbsPartIdx ), pcResi->getStride (), pcCoeffCurrY, 1<< uiLog2TrSize,    1<< uiLog2TrSize,    uiAbsSumY, TEXT_LUMA,     uiAbsPartIdx );
    50025121
     
    50095128        m_pcEntropyCoder->estimateBit(m_pcTrQuant->m_pcEstBitsSbac, 1<<uiLog2TrSizeC, TEXT_CHROMA );
    50105129      }
     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
    50115133      m_pcTrQuant->setQPforQuant( pcCU->getQP( 0 ), false, pcCU->getSlice()->getSliceType(), TEXT_CHROMA );
     5134#endif
    50125135      m_pcTrQuant->transformNxN( pcCU, pcResi->getCbAddr( uiAbsPartIdx ), pcResi->getCStride(), pcCoeffCurrU, 1<<uiLog2TrSizeC, 1<<uiLog2TrSizeC, uiAbsSumU, TEXT_CHROMA_U, uiAbsPartIdx );
    50135136      m_pcTrQuant->transformNxN( pcCU, pcResi->getCrAddr( uiAbsPartIdx ), pcResi->getCStride(), pcCoeffCurrV, 1<<uiLog2TrSizeC, 1<<uiLog2TrSizeC, uiAbsSumV, TEXT_CHROMA_V, uiAbsPartIdx );
     
    50725195    {
    50735196      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
    50745200      m_pcTrQuant->setQPforQuant( pcCU->getQP( 0 ), false, pcCU->getSlice()->getSliceType(), TEXT_LUMA );
     5201#endif
    50755202#if INTRA_DST_TYPE_7 // Inside Inter Encoder Search. So use conventional DCT.
    50765203    m_pcTrQuant->invtransformNxN( TEXT_LUMA,REG_DCT, pcResiCurrY, m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride(),  pcCoeffCurrY, 1<< uiLog2TrSize,    1<< uiLog2TrSize );//this is for inter mode only
     
    51505277      {
    51515278        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
    51525282        m_pcTrQuant->setQPforQuant( pcCU->getQP( 0 ), false, pcCU->getSlice()->getSliceType(), TEXT_CHROMA );
     5283#endif
    51535284#if INTRA_DST_TYPE_7  // Inside Inter Encoder Search. So use conventional DCT.
    51545285        m_pcTrQuant->invtransformNxN( TEXT_CHROMA,REG_DCT, pcResiCurrU, m_pcQTTempTComYuv[uiQTTempAccessLayer].getCStride(), pcCoeffCurrU, 1<<uiLog2TrSizeC, 1<<uiLog2TrSizeC);
     
    51955326        if( !uiAbsSumU )
    51965327        {
     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
    51975331          m_pcTrQuant->setQPforQuant( pcCU->getQP( 0 ), false, pcCU->getSlice()->getSliceType(), TEXT_CHROMA );
     5332#endif
    51985333        }
    51995334#if INTRA_DST_TYPE_7   // Inside Inter Encoder Search. So use conventional DCT.
Note: See TracChangeset for help on using the changeset viewer.