Ignore:
Timestamp:
24 Feb 2012, 20:22:58 (15 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/TLibDecoder/TDecCu.cpp

    r5 r28  
    4949  m_ppcYuvReco    = NULL;
    5050  m_ppcYuvResPred = NULL;
     51#if POZNAN_AVAIL_MAP
     52  m_ppcYuvAvail   = NULL;
     53#endif
     54#if POZNAN_SYNTH_VIEW
     55  m_ppcYuvSynth   = NULL;
     56#endif
    5157  m_ppcCU         = NULL;
    5258}
     
    7581  m_ppcYuvReco    = new TComYuv*    [m_uiMaxDepth-1];
    7682  m_ppcYuvResPred = new TComYuv*    [m_uiMaxDepth-1];
     83#if POZNAN_AVAIL_MAP
     84  m_ppcYuvAvail   = new TComYuv*    [m_uiMaxDepth-1];
     85#endif
     86#if POZNAN_SYNTH_VIEW
     87  m_ppcYuvSynth   = new TComYuv*    [m_uiMaxDepth-1];
     88#endif
    7789  m_ppcCU         = new TComDataCU* [m_uiMaxDepth-1];
    7890 
     
    8799    m_ppcYuvReco   [ui] = new TComYuv;    m_ppcYuvReco   [ui]->create( uiWidth, uiHeight );
    88100    m_ppcYuvResPred[ui] = new TComYuv;    m_ppcYuvResPred[ui]->create( uiWidth, uiHeight );
     101#if POZNAN_AVAIL_MAP
     102    m_ppcYuvAvail  [ui] = new TComYuv;    m_ppcYuvAvail  [ui]->create( uiWidth, uiHeight );
     103#endif
     104#if POZNAN_SYNTH_VIEW
     105    m_ppcYuvSynth  [ui] = new TComYuv;    m_ppcYuvSynth  [ui]->create( uiWidth, uiHeight );
     106#endif
     107
    89108    m_ppcCU        [ui] = new TComDataCU; m_ppcCU        [ui]->create( uiNumPartitions, uiWidth, uiHeight, true );
    90109  }
     
    106125    m_ppcYuvReco   [ui]->destroy(); delete m_ppcYuvReco   [ui]; m_ppcYuvReco   [ui] = NULL;
    107126    m_ppcYuvResPred[ui]->destroy(); delete m_ppcYuvResPred[ui]; m_ppcYuvResPred[ui] = NULL;
     127#if POZNAN_AVAIL_MAP
     128    m_ppcYuvAvail  [ui]->destroy(); delete m_ppcYuvAvail  [ui]; m_ppcYuvAvail  [ui] = NULL;
     129#endif
     130#if POZNAN_SYNTH_VIEW
     131    m_ppcYuvSynth  [ui]->destroy(); delete m_ppcYuvSynth  [ui]; m_ppcYuvSynth  [ui] = NULL;
     132#endif
    108133    m_ppcCU        [ui]->destroy(); delete m_ppcCU        [ui]; m_ppcCU        [ui] = NULL;
    109134  }
     
    112137  delete [] m_ppcYuvReco;    m_ppcYuvReco    = NULL;
    113138  delete [] m_ppcYuvResPred; m_ppcYuvResPred = NULL;
     139#if POZNAN_AVAIL_MAP
     140  delete [] m_ppcYuvAvail;   m_ppcYuvAvail   = NULL;
     141#endif
     142#if POZNAN_SYNTH_VIEW
     143  delete [] m_ppcYuvSynth;   m_ppcYuvSynth   = NULL;
     144#endif
     145
    114146  delete [] m_ppcCU;         m_ppcCU         = NULL;
    115147}
     
    184216{
    185217  TComPic* pcPic = pcCU->getPic();
     218
     219#if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU
     220  Bool bWholeCUCanBeSynthesized = false;
     221  Bool bOneSubCUCanNotBeSynthesied = false;
     222  Bool bSubCUCanBeSynthesized[4];
     223  Bool * pbSubCUCanBeSynthesized = bSubCUCanBeSynthesized;
     224  pcPic->checkSynthesisAvailability(pcCU, pcCU->getAddr(), uiAbsPartIdx, uiDepth, pbSubCUCanBeSynthesized); //KUBA SYNTH
     225  Int  iSubCUCanNotBeSynthesized = 0;
     226  Int  iSubCUCanBeSynthesizedCnt = 0;
     227  for(Int i = 0; i < 4; i++)
     228  {
     229    if (!bSubCUCanBeSynthesized[i])
     230    {
     231      iSubCUCanNotBeSynthesized = i;
     232    }
     233    else
     234    {
     235      iSubCUCanBeSynthesizedCnt ++;
     236    }
     237  }
     238  if(iSubCUCanBeSynthesizedCnt == 4)
     239  {
     240    bWholeCUCanBeSynthesized = true;
     241  }
     242  else if(iSubCUCanBeSynthesizedCnt == 3)
     243  {
     244    bOneSubCUCanNotBeSynthesied = true;
     245  }
     246
     247  if(bWholeCUCanBeSynthesized)
     248  {
     249    pcCU->setPredModeSubParts( MODE_SYNTH, uiAbsPartIdx, uiDepth );
     250    pcCU->setDepthSubParts( uiDepth, uiAbsPartIdx );
     251    pcCU->setPartSizeSubParts( SIZE_2Nx2N, uiAbsPartIdx, uiDepth );
     252    pcCU->setSizeSubParts( g_uiMaxCUWidth>>uiDepth, g_uiMaxCUHeight>>uiDepth, uiAbsPartIdx, uiDepth );
     253    //pcCU->setSizeSubParts( pcCU->getSlice()->getSPS()->getMaxCUWidth()>>uiDepth, pcCU->getSlice()->getSPS()->getMaxCUHeight()>>uiDepth, uiAbsPartIdx, uiDepth );
     254    return;   
     255  }
     256#endif
     257
    186258  UInt uiCurNumParts    = pcPic->getNumPartInCU() >> (uiDepth<<1);
    187259  UInt uiQNumParts      = uiCurNumParts>>2;
     
    195267  if( ( uiRPelX < pcCU->getSlice()->getSPS()->getWidth() ) && ( uiBPelY < pcCU->getSlice()->getSPS()->getHeight() ) )
    196268  {
     269#if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU
     270    if(bOneSubCUCanNotBeSynthesied && (uiDepth < g_uiMaxCUDepth - g_uiAddCUDepth )) // Check if CU has 3 synthesied subCU - no split flag is send in that case and CU split is assumed
     271    {
     272      pcCU->setDepthSubParts( uiDepth + 1, uiAbsPartIdx );
     273    }
     274    else
     275#endif
    197276#if HHI_MPI
    198277    if( pcCU->getTextureModeDepth( uiAbsPartIdx ) == -1 || uiDepth < pcCU->getTextureModeDepth( uiAbsPartIdx ) )
     
    367446{
    368447  TComPic* pcPic = pcCU->getPic();
     448#if POZNAN_SYNTH_VIEW
     449  if(pcPic->getPicYuvSynth())  m_ppcYuvSynth[uiDepth]->copyFromPicYuv( pcPic->getPicYuvSynth(), pcCU->getAddr(), uiAbsPartIdx );
     450#endif
     451#if POZNAN_AVAIL_MAP
     452  if(pcPic->getPicYuvAvail())  m_ppcYuvAvail[uiDepth]->copyFromPicYuv( pcPic->getPicYuvAvail(), pcCU->getAddr(), uiAbsPartIdx );
     453#endif
    369454 
    370455  Bool bBoundary = false;
     
    411496      xReconIntraQT( m_ppcCU[uiDepth], uiAbsPartIdx, uiDepth );
    412497      break;
     498#if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU
     499    case MODE_SYNTH:
     500    //  break;
     501#if POZNAN_FILL_OCCLUDED_CU_WITH_SYNTHESIS
     502      m_ppcYuvReco[uiDepth]->copyFromPicYuv(pcPic->getPicYuvSynth(), pcCU->getAddr(), uiAbsPartIdx);
     503#else
     504      m_ppcYuvReco[uiDepth]->copyFromPicYuv(pcPic->getPicYuvAvail(), pcCU->getAddr(), uiAbsPartIdx); //Poprawiæ
     505#endif
     506      //m_ppcYuvReco[uiDepth]->clear();
     507      break;
     508#endif
    413509    default:
    414510      assert(0);
     
    485581    m_pcPrediction->predIntraLumaAng( pcPattern, pcCU->getLumaIntraDir(uiPartIdx), pPred, uiStride, uiWidth, uiHeight, pcCU, bAboveAvail, bLeftAvail );
    486582   
     583#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     584    m_pcTrQuant->setQPforQuant( pcCU->getQP(uiPartIdx) + pcCU->getQpOffsetForTextCU(uiPartIdx, true), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA );
     585#else
    487586    m_pcTrQuant->setQPforQuant( pcCU->getQP(uiPartIdx), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA );
     587#endif
    488588#if INTRA_DST_TYPE_7
    489589  m_pcTrQuant->invtransformNxN(TEXT_LUMA, pcCU->getLumaIntraDir(uiPartIdx), pResi, uiStride, pCoeff, uiWidth, uiHeight );
     
    682782  }
    683783  //===== inverse transform =====
     784#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     785    m_pcTrQuant->setQPforQuant( pcCU->getQP(0) + pcCU->getQpOffsetForTextCU(uiAbsPartIdx, true), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA );
     786#else
    684787  m_pcTrQuant->setQPforQuant  ( pcCU->getQP(0), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA );
     788#endif
    685789#if INTRA_DST_TYPE_7
    686790  m_pcTrQuant->invtransformNxN( TEXT_LUMA, pcCU->getLumaIntraDir( uiAbsPartIdx ), piResi, uiStride, pcCoeff, uiWidth, uiHeight );
     
    789893
    790894  //===== inverse transform =====
     895#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     896  m_pcTrQuant->setQPforQuant  ( pcCU->getQP(0) + pcCU->getQpOffsetForTextCU(uiAbsPartIdx, true), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), eText );
     897#else
    791898  m_pcTrQuant->setQPforQuant  ( pcCU->getQP(0), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), eText );
     899#endif
    792900#if INTRA_DST_TYPE_7
    793901  m_pcTrQuant->invtransformNxN( eText, REG_DCT, piResi, uiStride, pcCoeff, uiWidth, uiHeight );
     
    9651073  piCoeff = pcCU->getCoeffY();
    9661074  pResi = m_ppcYuvResi[uiDepth]->getLumaAddr();
     1075#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     1076  Int QPoffset = pcCU->getQpOffsetForTextCU(uiAbsPartIdx, false);
     1077  m_pcTrQuant->setQPforQuant  ( pcCU->getQP(uiAbsPartIdx) + QPoffset, !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA );
     1078#else
    9671079  m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA );
     1080#endif
    9681081  m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_LUMA, pResi, 0, m_ppcYuvResi[uiDepth]->getStride(), uiWidth, uiHeight, uiLumaTrMode, 0, piCoeff );
    9691082 
    9701083  // Cb and Cr
     1084#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     1085    m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ) + QPoffset, !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA );
     1086#else
    9711087  m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA );
     1088#endif
    9721089 
    9731090  uiWidth  >>= 1;
Note: See TracChangeset for help on using the changeset viewer.