Changeset 1578 in SHVCSoftware


Ignore:
Timestamp:
20 Jun 2016, 22:32:09 (9 years ago)
Author:
seregin
Message:

fix memory allocation for reference layer picture and REDUCED_ENCODER_MEMORY

Location:
branches/SHM-dev/source/Lib
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-dev/source/Lib/TLibCommon/TComPic.cpp

    r1574 r1578  
    113113#endif
    114114  m_apcPicYuv[PIC_YUV_REC]  = new TComPicYuv;  m_apcPicYuv[PIC_YUV_REC]->create( iWidth, iHeight, chromaFormatIDC, uiMaxCuWidth, uiMaxCuHeight, uiMaxDepth, true, &conformanceWindow );
    115 #if REDUCED_ENCODER_MEMORY
    116   }
    117 #endif
    118115
    119116  for( Int i = 0; i < MAX_LAYERS; i++ )
     
    123120      m_pcFullPelBaseRec[i] = new TComPicYuv;  m_pcFullPelBaseRec[i]->create( iWidth, iHeight, chromaFormatIDC, uiMaxCuWidth, uiMaxCuHeight, uiMaxDepth, true, &conformanceWindow );
    124121    }
    125   }   
     122  }
     123#if REDUCED_ENCODER_MEMORY
     124  }
     125#endif
    126126
    127127  // there are no SEI messages associated with this picture initially
     
    189189  const UInt         uiMaxDepth      = sps.getMaxTotalCUDepth();
    190190
     191#if SVC_EXTENSION
     192  const Window& conformanceWindow    = sps.getConformanceWindow();
     193
    191194  if (m_apcPicYuv[PIC_YUV_ORG    ]==NULL)
    192195  {
     196    m_apcPicYuv[PIC_YUV_ORG    ]   = new TComPicYuv;  m_apcPicYuv[PIC_YUV_ORG     ]->create( iWidth, iHeight, chromaFormatIDC, uiMaxCuWidth, uiMaxCuHeight, uiMaxDepth, true, &conformanceWindow );
     197  }
     198  if (m_apcPicYuv[PIC_YUV_TRUE_ORG    ]==NULL)
     199  {
     200    m_apcPicYuv[PIC_YUV_TRUE_ORG]  = new TComPicYuv;  m_apcPicYuv[PIC_YUV_TRUE_ORG]->create( iWidth, iHeight, chromaFormatIDC, uiMaxCuWidth, uiMaxCuHeight, uiMaxDepth, true, &conformanceWindow );
     201  }
     202#else
     203  if (m_apcPicYuv[PIC_YUV_ORG    ]==NULL)
     204  {
    193205    m_apcPicYuv[PIC_YUV_ORG    ]   = new TComPicYuv;  m_apcPicYuv[PIC_YUV_ORG     ]->create( iWidth, iHeight, chromaFormatIDC, uiMaxCuWidth, uiMaxCuHeight, uiMaxDepth, true );
    194206  }
     
    197209    m_apcPicYuv[PIC_YUV_TRUE_ORG]  = new TComPicYuv;  m_apcPicYuv[PIC_YUV_TRUE_ORG]->create( iWidth, iHeight, chromaFormatIDC, uiMaxCuWidth, uiMaxCuHeight, uiMaxDepth, true );
    198210  }
     211#endif
    199212}
    200213
     
    211224    const UInt         uiMaxDepth      = sps.getMaxTotalCUDepth();
    212225
     226#if SVC_EXTENSION
     227    const Window& conformanceWindow    = sps.getConformanceWindow();
     228
     229    m_apcPicYuv[PIC_YUV_REC]  = new TComPicYuv;  m_apcPicYuv[PIC_YUV_REC]->create( iWidth, iHeight, chromaFormatIDC, uiMaxCuWidth, uiMaxCuHeight, uiMaxDepth, true, &conformanceWindow );
     230
     231    for( Int i = 0; i < MAX_LAYERS; i++ )
     232    {
     233      if( m_requireResampling[i] )
     234      {
     235        m_pcFullPelBaseRec[i] = new TComPicYuv;  m_pcFullPelBaseRec[i]->create( iWidth, iHeight, chromaFormatIDC, uiMaxCuWidth, uiMaxCuHeight, uiMaxDepth, true, &conformanceWindow );
     236      }
     237    }
     238#else
    213239    m_apcPicYuv[PIC_YUV_REC]  = new TComPicYuv;  m_apcPicYuv[PIC_YUV_REC]->create( iWidth, iHeight, chromaFormatIDC, uiMaxCuWidth, uiMaxCuHeight, uiMaxDepth, true );
     240#endif
    214241  }
    215242
     
    464491  const Int  unitNum       = max( 1, (Int)((16/widthMinPU)*(16/heightMinPU)) );
    465492
    466   for(UInt cuIdx = 0; cuIdx < getPicSym()->getNumberOfCtusInFrame(); cuIdx++)  //each LCU
    467   {
    468     TComDataCU* pcCUDes = getCtu(cuIdx);
     493  for( UInt ctuRsAddr = 0; ctuRsAddr < m_picSym.getNumberOfCtusInFrame(); ctuRsAddr++ )  //each CTU
     494  {
     495    TComDataCU* pcCUDes = getCtu(ctuRsAddr);
     496
     497#if REDUCED_ENCODER_MEMORY
     498    TComPicSym::DPBPerCtuData &dpbForCtu = m_picSym.getDPBPerCtuData(ctuRsAddr);
     499#endif
    469500
    470501    for(UInt absPartIdx = 0; absPartIdx < numPartitions; absPartIdx+=unitNum )  //each 16x16 unit
     
    498529      }
    499530
     531#if REDUCED_ENCODER_MEMORY
     532      dpbForCtu.m_CUMvField[REF_PIC_LIST_0].setMvField(pcCUDes->getCUMvField(REF_PIC_LIST_0)->getMv(absPartIdx), pcCUDes->getCUMvField(REF_PIC_LIST_0)->getRefIdx(absPartIdx), absPartIdx);
     533      dpbForCtu.m_CUMvField[REF_PIC_LIST_1].setMvField(pcCUDes->getCUMvField(REF_PIC_LIST_1)->getMv(absPartIdx), pcCUDes->getCUMvField(REF_PIC_LIST_1)->getRefIdx(absPartIdx), absPartIdx);
     534#endif
     535
    500536      for(UInt i = 1; i < unitNum; i++ ) 
    501537      {
    502538        pcCUDes->getCUMvField(REF_PIC_LIST_0)->setMvField(pcCUDes->getCUMvField(REF_PIC_LIST_0)->getMv(absPartIdx), pcCUDes->getCUMvField(REF_PIC_LIST_0)->getRefIdx(absPartIdx), absPartIdx + i);
    503539        pcCUDes->getCUMvField(REF_PIC_LIST_1)->setMvField(pcCUDes->getCUMvField(REF_PIC_LIST_1)->getMv(absPartIdx), pcCUDes->getCUMvField(REF_PIC_LIST_1)->getRefIdx(absPartIdx), absPartIdx + i);
     540
     541#if REDUCED_ENCODER_MEMORY
     542        dpbForCtu.m_CUMvField[REF_PIC_LIST_0].setMvField(pcCUDes->getCUMvField(REF_PIC_LIST_0)->getMv(absPartIdx), pcCUDes->getCUMvField(REF_PIC_LIST_0)->getRefIdx(absPartIdx), absPartIdx + i);
     543        dpbForCtu.m_CUMvField[REF_PIC_LIST_1].setMvField(pcCUDes->getCUMvField(REF_PIC_LIST_1)->getMv(absPartIdx), pcCUDes->getCUMvField(REF_PIC_LIST_1)->getRefIdx(absPartIdx), absPartIdx + i);
     544#endif
    504545        pcCUDes->setPredictionMode(absPartIdx+i, pcCUDes->getPredictionMode(absPartIdx));
    505546      }
    506547    }
    507     memset( pcCUDes->getPartitionSize(), SIZE_2Nx2N, sizeof(SChar)*numPartitions );
     548    memset( pcCUDes->getPartitionSize(), SIZE_2Nx2N, sizeof(*pcCUDes->getPartitionSize())*numPartitions );
     549
     550#if REDUCED_ENCODER_MEMORY
     551    memcpy( dpbForCtu.m_pePredMode, pcCUDes->getPredictionMode(), sizeof(*pcCUDes->getPredictionMode()) * numPartitions );
     552    memcpy( dpbForCtu.m_pePartSize, pcCUDes->getPartitionSize(), sizeof(*pcCUDes->getPartitionSize()) * numPartitions );
     553    dpbForCtu.m_pSlice = pcCUDes->getSlice();
     554#endif
    508555  }
    509556}
     
    513560  const TComSPS *sps         = getSlice(0)->getSPS();
    514561  const UInt uiMaxDepth      = sps->getMaxTotalCUDepth();
    515   const UInt uiNumPartitions = 1<<(uiMaxDepth<<1);
    516 
    517   for(UInt cuIdx = 0; cuIdx < getPicSym()->getNumberOfCtusInFrame(); cuIdx++)  //each LCU
    518   {
    519     TComDataCU* pcCUDes = getCtu(cuIdx);
     562  const UInt numPartitions = 1<<(uiMaxDepth<<1);
     563
     564  for( UInt ctuRsAddr = 0; ctuRsAddr < m_picSym.getNumberOfCtusInFrame(); ctuRsAddr++ )  //each CTU
     565  {
     566    TComDataCU* pcCUDes = getCtu(ctuRsAddr);
    520567    TComMvField zeroMvField;
    521     for(UInt list = 0; list < 2; list++)  //each reference list
    522     {
    523       for(UInt i = 0; i < uiNumPartitions; i++ ) 
    524       {
    525         pcCUDes->getCUMvField(REF_PIC_LIST_0)->setMvField(zeroMvField, i);
    526         pcCUDes->getCUMvField(REF_PIC_LIST_1)->setMvField(zeroMvField, i);
    527         pcCUDes->setPredictionMode(i, MODE_INTRA);
    528         pcCUDes->setPartitionSize(i, SIZE_2Nx2N);
    529       }
    530     }
    531   }
    532   return;
     568
     569#if REDUCED_ENCODER_MEMORY
     570    TComPicSym::DPBPerCtuData &dpbForCtu = m_picSym.getDPBPerCtuData(ctuRsAddr);
     571#endif
     572
     573    for( UInt i = 0; i < numPartitions; i++ ) 
     574    {
     575      pcCUDes->getCUMvField(REF_PIC_LIST_0)->setMvField(zeroMvField, i);
     576      pcCUDes->getCUMvField(REF_PIC_LIST_1)->setMvField(zeroMvField, i);
     577      pcCUDes->setPredictionMode(i, MODE_INTRA);
     578      pcCUDes->setPartitionSize(i, SIZE_2Nx2N);
     579
     580#if REDUCED_ENCODER_MEMORY
     581      dpbForCtu.m_CUMvField[REF_PIC_LIST_0].setMvField(zeroMvField, i);
     582      dpbForCtu.m_CUMvField[REF_PIC_LIST_1].setMvField(zeroMvField, i);
     583#endif
     584    }
     585
     586#if REDUCED_ENCODER_MEMORY
     587    memcpy( dpbForCtu.m_pePredMode, pcCUDes->getPredictionMode(), sizeof(*pcCUDes->getPredictionMode()) * numPartitions );
     588    memcpy( dpbForCtu.m_pePartSize, pcCUDes->getPartitionSize(), sizeof(*pcCUDes->getPartitionSize()) * numPartitions );
     589    dpbForCtu.m_pSlice = pcCUDes->getSlice();
     590#endif
     591  }
    533592}
    534593
  • branches/SHM-dev/source/Lib/TLibDecoder/TDecTop.cpp

    r1575 r1578  
    360360
    361361#if SVC_EXTENSION
    362   if( this->getLayerDec(pcPic->getLayerId())->m_isOutputLayerFlag == false )
     362  if( m_ppcTDecTop[pcPic->getLayerId()]->m_isOutputLayerFlag == false )
    363363  {
    364364    pcPic->setOutputMark( false );
     
    538538
    539539#if REDUCED_ENCODER_MEMORY
    540         pBLPic->create( pBLPic->getPicSym()->getSPS(), *pps, true, true, refLayerId);
     540        pBLPic->create( pBLPic->getPicSym()->getSPS(), *pps, false, true, refLayerId);
    541541#else
    542542        pBLPic->create( pBLPic->getPicSym()->getSPS(), *pps, true, refLayerId);
     
    22982298
    22992299#if REDUCED_ENCODER_MEMORY
    2300         m_cIlpPic[j]->create(*sps, *pps, true, true, m_layerId);
     2300        m_cIlpPic[j]->create(*sps, *pps, false, true, m_layerId);
    23012301#else
    23022302        m_cIlpPic[j]->create(*sps, *pps, true, m_layerId);
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncTop.cpp

    r1575 r1578  
    757757      }
    758758#if REDUCED_ENCODER_MEMORY
     759      pcEPic->create( m_cVPS, m_cSPS, m_cPPS, m_cPPS.getMaxCuDQPDepth()+1, m_layerId);
    759760#else
    760       pcEPic->create( m_cVPS, m_cSPS, m_cPPS, m_cPPS.getMaxCuDQPDepth()+1, m_layerId);
     761      pcEPic->create( m_cVPS, m_cSPS, m_cPPS, m_cPPS.getMaxCuDQPDepth()+1, false, m_layerId);
    761762#endif
    762763#else  //SVC_EXTENSION
     
    17571758        m_cIlpPic[j] = new TComPic;
    17581759#if REDUCED_ENCODER_MEMORY
    1759         m_cIlpPic[j]->create(m_cSPS, m_cPPS, true, true, m_layerId);
     1760        m_cIlpPic[j]->create(m_cSPS, m_cPPS, false, true, m_layerId);
    17601761#else
    17611762        m_cIlpPic[j]->create(m_cSPS, m_cPPS, true, m_layerId);
Note: See TracChangeset for help on using the changeset viewer.