Changeset 1057 in SHVCSoftware for branches/SHM-dev/source/Lib/TLibEncoder


Ignore:
Timestamp:
4 Mar 2015, 09:55:40 (10 years ago)
Author:
seregin
Message:

revert back using layerIdx for m_ppcTEncTop, fix RefLayerId settings and related

Location:
branches/SHM-dev/source/Lib/TLibEncoder
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncCavlc.cpp

    r1048 r1057  
    21702170    if( !vps->getSplittingFlag() )
    21712171    {
    2172     for(j = 0; j < vps->getNumScalabilityTypes(); j++)
    2173     {
    2174       UInt bits = vps->getDimensionIdLen(j);
    2175       WRITE_CODE( vps->getDimensionId(i, j),   bits,   "dimension_id[i][j]" );
    2176     }
    2177   }
     2172      for(j = 0; j < vps->getNumScalabilityTypes(); j++)
     2173      {
     2174        UInt bits = vps->getDimensionIdLen(j);
     2175        WRITE_CODE( vps->getDimensionId(i, j),   bits,   "dimension_id[i][j]" );
     2176      }
     2177    }
    21782178  }
    21792179#endif
     
    22082208
    22092209#if VPS_EXTN_DIRECT_REF_LAYERS
    2210   for( Int layerCtr = 1; layerCtr <= vps->getMaxLayers() - 1; layerCtr++)
     2210  for( Int layerCtr = 1; layerCtr < vps->getMaxLayers(); layerCtr++)
    22112211  {
    22122212    for( Int refLayerCtr = 0; refLayerCtr < layerCtr; refLayerCtr++)
     
    22822282  assert( vps->getNumProfileTierLevel() == vps->getPTLForExtnPtr()->size());
    22832283#endif
    2284   for(Int idx = vps->getBaseLayerInternalFlag() ? 2 : 1; idx <= vps->getNumProfileTierLevel() - 1; idx++)
     2284  for(Int idx = vps->getBaseLayerInternalFlag() ? 2 : 1; idx < vps->getNumProfileTierLevel(); idx++)
    22852285#else
    22862286  for(Int idx = 1; idx <= vps->getNumProfileTierLevel() - 1; idx++)
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncCfg.h

    r1048 r1057  
    391391
    392392  Int       m_numActiveRefLayers;
    393   Int       m_predLayerId[MAX_VPS_LAYER_IDX_PLUS1];
     393  Int       m_predLayerIdx[MAX_VPS_LAYER_IDX_PLUS1];
    394394  Int       m_numSamplePredRefLayers;
    395395  Int       m_samplePredRefLayerId[MAX_VPS_LAYER_IDX_PLUS1];
     
    11191119  Void      setNumActiveRefLayers           (Int num)                       { m_numActiveRefLayers = num;       }
    11201120
    1121   Int       getPredLayerId                  (Int i)                         { return m_predLayerId[i];          }
    1122   Void      setPredLayerId                  (Int i, Int refLayerId)         { m_predLayerId[i] = refLayerId;    }
     1121  Int       getPredLayerIdx                 (Int lyaerIdc)                  { return m_predLayerIdx[lyaerIdc];          }
     1122  Void      setPredLayerIdx                 (Int lyaerIdc, Int refLayerIdx) { m_predLayerIdx[lyaerIdc] = refLayerIdx;   }
    11231123
    11241124  Int       getNumSamplePredRefLayers       ()                              { return m_numSamplePredRefLayers;  }
    11251125  Void      setNumSamplePredRefLayers       (Int num)                       { m_numSamplePredRefLayers = num;   }
    11261126
    1127   Int       getSamplePredRefLayerId         (Int i)                         { return m_samplePredRefLayerId[i];       }
    1128   Void      setSamplePredRefLayerId         (Int i, Int refLayerId)         { m_samplePredRefLayerId[i] = refLayerId; }
     1127  Int       getSamplePredRefLayerId         (Int layerIdc)                  { return m_samplePredRefLayerId[layerIdc];       }
     1128  Void      setSamplePredRefLayerId         (Int layerIdc, Int refLayerId)  { m_samplePredRefLayerId[layerIdc] = refLayerId; }
    11291129
    11301130  Int       getNumMotionPredRefLayers       ()                              { return m_numMotionPredRefLayers;  }
    11311131  Void      setNumMotionPredRefLayers       (Int num)                       { m_numMotionPredRefLayers = num;   }
    11321132
    1133   Int       getMotionPredRefLayerId         (Int i)                         { return m_motionPredRefLayerId[i];       }
    1134   Void      setMotionPredRefLayerId         (Int i, Int refLayerId)         { m_motionPredRefLayerId[i] = refLayerId; }
    1135 
    1136   Bool      getSamplePredEnabledFlag        (Int i)                         { return m_samplePredEnabledFlag[i];  }
    1137   Void      setSamplePredEnabledFlag        (Int i,Bool flag)               { m_samplePredEnabledFlag[i] = flag;  }
    1138 
    1139   Bool      getMotionPredEnabledFlag        (Int i)                         { return m_motionPredEnabledFlag[i];  }
    1140   Void      setMotionPredEnabledFlag        (Int i,Bool flag)               { m_motionPredEnabledFlag[i] = flag;  }
     1133  Int       getMotionPredRefLayerId         (Int layerIdc)                  { return m_motionPredRefLayerId[layerIdc];       }
     1134  Void      setMotionPredRefLayerId         (Int layerIdc, Int refLayerId)  { m_motionPredRefLayerId[layerIdc] = refLayerId; }
     1135
     1136  Bool      getSamplePredEnabledFlag        (Int layerIdx)                  { return m_samplePredEnabledFlag[layerIdx];  }
     1137  Void      setSamplePredEnabledFlag        (Int layerIdx, Bool flag)       { m_samplePredEnabledFlag[layerIdx] = flag;  }
     1138
     1139  Bool      getMotionPredEnabledFlag        (Int layerIdx)                  { return m_motionPredEnabledFlag[layerIdx];  }
     1140  Void      setMotionPredEnabledFlag        (Int layerIdx,Bool flag)        { m_motionPredEnabledFlag[layerIdx] = flag;  }
    11411141#endif
    11421142  Int       getMaxTidIlRefPicsPlus1         ()                              { return m_maxTidIlRefPicsPlus1; }
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncCu.h

    r1054 r1057  
    182182
    183183#if SVC_EXTENSION
    184   TEncTop*   getLayerEnc(UInt LayerId)  {return m_ppcTEncTop[LayerId]; }
     184  TEncTop*   getLayerEnc(UInt layerIdx)  {return m_ppcTEncTop[layerIdx]; }
    185185#if ENCODER_FAST_MODE
    186186  Void  xCheckRDCostILRUni  ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, UInt refLayerId);
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.cpp

    r1055 r1057  
    192192  if( pcTEncTop->getLayerId() )
    193193  {
    194     UInt prevLayerId = pcTEncTop->getLayerId()-1; // it should be changed
     194    UInt prevLayerIdx = pcTEncTop->getPredLayerIdx( pcTEncTop->getNumActiveRefLayers() - 1);
     195    UInt prevLayerId  = pcTEncTop->getRefLayerId(prevLayerIdx);
    195196
    196197    m_Enc3DAsymLUTPicUpdate.create( m_pcCfg->getCGSMaxOctantDepth() , g_bitDepthLayer[CHANNEL_TYPE_LUMA][prevLayerId] , g_bitDepthLayer[CHANNEL_TYPE_CHROMA][prevLayerId] , g_bitDepthLayer[CHANNEL_TYPE_LUMA][pcTEncTop->getLayerId()] , g_bitDepthLayer[CHANNEL_TYPE_CHROMA][pcTEncTop->getLayerId()] , m_pcCfg->getCGSMaxYPartNumLog2() /*, m_pcCfg->getCGSPhaseAlignment()*/ );
     
    11721173        for (UInt i = 0; i < m_pcCfg->getNumLayer(); i++)
    11731174        {
    1174           Int layerId = pcSlice->getVPS()->getLayerIdInNuh(i);
    1175           m_ppcTEncTop[layerId]->setLayerInitializedFlag(false);
    1176           m_ppcTEncTop[layerId]->setFirstPicInLayerDecodedFlag(false);
     1175          m_ppcTEncTop[i]->setLayerInitializedFlag(false);
     1176          m_ppcTEncTop[i]->setFirstPicInLayerDecodedFlag(false);
    11771177        }
    11781178      }
     
    12241224
    12251225        // infer the scaling list from the reference layer
    1226         pcSlice->setScalingList ( m_ppcTEncTop[refLayerId]->getScalingList() );
     1226        pcSlice->setScalingList ( m_ppcTEncTop[pcSlice->getVPS()->getLayerIdxInVps(refLayerId)]->getScalingList() );
    12271227      }
    12281228      else
     
    12581258
    12591259        // infer the scaling list from the reference layer
    1260         pcSlice->setScalingList ( m_ppcTEncTop[refLayerId]->getScalingList() );
     1260        pcSlice->setScalingList ( m_ppcTEncTop[pcSlice->getVPS()->getLayerIdxInVps(refLayerId)]->getScalingList() );
    12611261      }
    12621262      else
     
    13111311        UInt refLayerId = pcSlice->getVPS()->getRefLayerId(m_layerId, refLayerIdc);
    13121312#if VPS_EXTN_DIRECT_REF_LAYERS
    1313         TComList<TComPic*> *cListPic = m_ppcTEncTop[m_layerId]->getRefLayerEnc(refLayerIdc)->getListPic();
     1313        TComList<TComPic*> *cListPic = m_ppcTEncTop[refLayerIdc]->getRefLayerEnc(refLayerIdc)->getListPic();
    13141314#else
    13151315        TComList<TComPic*> *cListPic = m_ppcTEncTop[pcSlice->getVPS()->getLayerIdxInVps(m_layerId)-1]->getListPic();
     
    14151415        {
    14161416          // check for the sample prediction picture type
    1417           if( m_ppcTEncTop[m_layerId]->getSamplePredEnabledFlag(pcSlice->getVPS()->getLayerIdxInVps(refLayerId)))
     1417          if( m_ppcTEncTop[pcSlice->getVPS()->getLayerIdxInVps(m_layerId)]->getSamplePredEnabledFlag(pcSlice->getVPS()->getLayerIdxInVps(refLayerId)))
    14181418          {
    14191419#if P0312_VERT_PHASE_ADJ
     
    14941494        if(pcSlice->getVPS()->getCrossLayerIrapAlignFlag())
    14951495        {
    1496           TComList<TComPic*> *cListPic = m_ppcTEncTop[m_layerId]->getRefLayerEnc(0)->getListPic();
     1496          TComList<TComPic*> *cListPic = m_ppcTEncTop[pcSlice->getVPS()->getLayerIdxInVps(m_layerId)]->getRefLayerEnc(0)->getListPic();
    14971497          TComPic* picLayer0 = pcSlice->getRefPic(*cListPic, pcSlice->getPOC() );
    14981498          if(picLayer0)
     
    15361536      if (pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_TRAIL_R &&
    15371537#if SVC_EXTENSION
    1538         ( m_iGopSize != 1 || m_ppcTEncTop[m_layerId]->getIntraPeriod() > 1 ) )
     1538        ( m_iGopSize != 1 || m_ppcTEncTop[pcSlice->getVPS()->getLayerIdxInVps(m_layerId)]->getIntraPeriod() > 1 ) )
    15391539#else
    15401540          !(m_iGopSize == 1 && pcSlice->getSliceType() == I_SLICE))
     
    18411841        for( Int i = 0; i < pcSlice->getActiveNumILRRefIdx(); i++ )
    18421842        {
    1843           if( m_ppcTEncTop[m_layerId]->getSamplePredEnabledFlag( pcSlice->getVPS()->getRefLayerId( m_layerId, pcSlice->getInterLayerPredLayerIdc(i) ) ) )
     1843          if( m_ppcTEncTop[pcSlice->getVPS()->getLayerIdxInVps(m_layerId)]->getSamplePredEnabledFlag( pcSlice->getInterLayerPredLayerIdc(i) ) )
    18441844          {
    18451845            foundSamplePredPicture = true;
     
    18751875        for( Int i = 0; i < pcSlice->getLayerId(); i++)
    18761876        {
    1877           TComList<TComPic *> *cListPic = m_ppcTEncTop[i]->getListPic();
     1877          TComList<TComPic *> *cListPic = m_ppcTEncTop[pcSlice->getVPS()->getLayerIdxInVps(i)]->getListPic();
    18781878          TComPic *lowerLayerPic = pcSlice->getRefPic(*cListPic, pcSlice->getPOC());
    18791879          if( lowerLayerPic && pcSlice->getVPS()->getDirectDependencyFlag(pcSlice->getLayerIdx(), i) )
     
    19691969          // It is a requirement of bitstream conformance when the collocated picture, used for temporal motion vector prediction, is an inter-layer reference picture,
    19701970          // VpsInterLayerMotionPredictionEnabled[ LayerIdxInVps[ currLayerId ] ][ LayerIdxInVps[ rLId ] ] shall be equal to 1, where rLId is set equal to nuh_layer_id of the inter-layer picture.
    1971           if( refPic->isILR(m_layerId) && m_ppcTEncTop[m_layerId]->getMotionPredEnabledFlag( pcSlice->getVPS()->getLayerIdxInVps(refPic->getLayerId()) )
     1971          if( refPic->isILR(m_layerId) && m_ppcTEncTop[pcSlice->getVPS()->getLayerIdxInVps(m_layerId)]->getMotionPredEnabledFlag( refPic->getLayerIdx() )
    19721972#if MFM_ENCCONSTRAINT
    1973             && pcSlice->getBaseColPic( *m_ppcTEncTop[refPic->getLayerId()]->getListPic() )->checkSameRefInfo() == true
     1973            && pcSlice->getBaseColPic( *m_ppcTEncTop[refPic->getLayerIdx()]->getListPic() )->checkSameRefInfo() == true
    19741974#endif
    19751975            )
     
    19911991            // It is a requirement of bitstream conformance when the collocated picture, used for temporal motion vector prediction, is an inter-layer reference picture,
    19921992            // VpsInterLayerMotionPredictionEnabled[ LayerIdxInVps[ currLayerId ] ][ LayerIdxInVps[ rLId ] ] shall be equal to 1, where rLId is set equal to nuh_layer_id of the inter-layer picture.
    1993             if( refPic->isILR(m_layerId) && m_ppcTEncTop[m_layerId]->getMotionPredEnabledFlag(pcSlice->getVPS()->getLayerIdxInVps( refPic->getLayerId()))
     1993            if( refPic->isILR(m_layerId) && m_ppcTEncTop[pcSlice->getVPS()->getLayerIdxInVps(m_layerId)]->getMotionPredEnabledFlag( refPic->getLayerIdx() )
    19941994#if MFM_ENCCONSTRAINT
    1995               && pcSlice->getBaseColPic( *m_ppcTEncTop[refPic->getLayerId()]->getListPic() )->checkSameRefInfo() == true
     1995              && pcSlice->getBaseColPic( *m_ppcTEncTop[refPic->getLayerIdx()]->getListPic() )->checkSameRefInfo() == true
    19961996#endif
    19971997              )
     
    21102110        // It is a requirement of bitstream conformance when the collocated picture, used for temporal motion vector prediction, is an inter-layer reference picture,
    21112111        // VpsInterLayerMotionPredictionEnabled[ LayerIdxInVps[ currLayerId ] ][ LayerIdxInVps[ rLId ] ] shall be equal to 1, where rLId is set equal to nuh_layer_id of the inter-layer picture.
    2112         if( refPic->isILR(m_layerId) && !m_ppcTEncTop[m_layerId]->getMotionPredEnabledFlag(pcSlice->getVPS()->getLayerIdxInVps(refPic->getLayerId())))
     2112        if( refPic->isILR(m_layerId) && !m_ppcTEncTop[pcSlice->getVPS()->getLayerIdxInVps(m_layerId)]->getMotionPredEnabledFlag(refPic->getLayerIdx()) )
    21132113        {
    21142114          pcSlice->setEnableTMVPFlag(false);
     
    21282128          TComPic* refPic = pcSlice->getRefPic(refList, refIdx);
    21292129
    2130           if( !refPic->isILR(m_layerId) || ( refPic->isILR(m_layerId) && m_ppcTEncTop[m_layerId]->getSamplePredEnabledFlag( pcSlice->getVPS()->getLayerIdxInVps(refPic->getLayerId())) ) )
     2130          if( !refPic->isILR(m_layerId) || ( refPic->isILR(m_layerId) && m_ppcTEncTop[pcSlice->getVPS()->getLayerIdxInVps(m_layerId)]->getSamplePredEnabledFlag( refPic->getLayerIdx() ) ) )
    21312131          {
    21322132            break;
     
    21522152          TComPic* refPic = pcSlice->getRefPic(refList, refIdx);
    21532153
    2154           if( !refPic->isILR(m_layerId) || ( refPic->isILR(m_layerId) && m_ppcTEncTop[m_layerId]->getSamplePredEnabledFlag( pcSlice->getVPS()->getLayerIdxInVps((refPic->getLayerId())))) )
     2154          if( !refPic->isILR(m_layerId) || ( refPic->isILR(m_layerId) && m_ppcTEncTop[pcSlice->getVPS()->getLayerIdxInVps(m_layerId)]->getSamplePredEnabledFlag( refPic->getLayerIdx() ) ) )
    21552155          {
    21562156            break;
     
    46644664        for(Int i = 1; i < slice->getVPS()->getMaxLayers(); i++)
    46654665        {
    4666           UInt layerId = slice->getVPS()->getLayerIdInNuh(i);
    4667           Bool refreshIntervalFlag = ( pocCurr % m_ppcTEncTop[layerId]->getGOPEncoder()->getIntraRefreshInterval() == 0 );
    4668           Bool refreshTypeFlag     = ( m_ppcTEncTop[0]->getGOPEncoder()->getIntraRefreshType() == m_ppcTEncTop[layerId]->getGOPEncoder()->getIntraRefreshType() );
     4666          Bool refreshIntervalFlag = ( pocCurr % m_ppcTEncTop[i]->getGOPEncoder()->getIntraRefreshInterval() == 0 );
     4667          Bool refreshTypeFlag     = ( m_ppcTEncTop[0]->getGOPEncoder()->getIntraRefreshType() == m_ppcTEncTop[i]->getGOPEncoder()->getIntraRefreshType() );
    46694668          if( !(refreshIntervalFlag && refreshTypeFlag) )
    46704669          {
     
    46824681      for(Int i = 1; i < slice->getVPS()->getMaxLayers() && !needReset; i++)
    46834682      {
    4684         UInt layerId = slice->getVPS()->getLayerIdInNuh(i);
    4685         Bool idrFlag = ( (m_ppcTEncTop[layerId]->getGOPEncoder()->getIntraRefreshType() == 2)
    4686                         && ( pocCurr % m_ppcTEncTop[layerId]->getGOPEncoder()->getIntraRefreshInterval() == 0 )
     4683        Bool idrFlag = ( (m_ppcTEncTop[i]->getGOPEncoder()->getIntraRefreshType() == 2)
     4684                        && ( pocCurr % m_ppcTEncTop[i]->getGOPEncoder()->getIntraRefreshInterval() == 0 )
    46874685                        );
    46884686        for(Int j = 0; j < slice->getVPS()->getMaxLayers(); j++)
     
    46934691          }
    46944692
    4695           layerId = slice->getVPS()->getLayerIdInNuh(j);
    4696           Bool idrOtherPicFlag = ( (m_ppcTEncTop[layerId]->getGOPEncoder()->getIntraRefreshType() == 2)
    4697                                   && ( pocCurr % m_ppcTEncTop[layerId]->getGOPEncoder()->getIntraRefreshInterval() == 0 )
     4693          Bool idrOtherPicFlag = ( (m_ppcTEncTop[j]->getGOPEncoder()->getIntraRefreshType() == 2)
     4694                                  && ( pocCurr % m_ppcTEncTop[j]->getGOPEncoder()->getIntraRefreshInterval() == 0 )
    46984695                                  );
    46994696
     
    47394736        for (UInt i = 0; i < MAX_LAYERS; i++)
    47404737        {
    4741           UInt layerId = slice->getVPS()->getLayerIdInNuh(i);
    4742           m_ppcTEncTop[layerId]->setPocDecrementedInDPBFlag(false);
     4738          m_ppcTEncTop[i]->setPocDecrementedInDPBFlag(false);
    47434739        }
    47444740#endif
     
    48284824  for (UInt layerIdx = 0; layerIdx < numAffectedLayers; layerIdx++)
    48294825  {
    4830     if (!m_ppcTEncTop[affectedLayerList[layerIdx]]->getPocDecrementedInDPBFlag())
    4831     {
    4832       m_ppcTEncTop[affectedLayerList[layerIdx]]->setPocDecrementedInDPBFlag(true);
     4826    UInt lIdx = slice->getVPS()->getLayerIdxInVps(affectedLayerList[layerIdx]);
     4827
     4828    if (!m_ppcTEncTop[lIdx]->getPocDecrementedInDPBFlag())
     4829    {
     4830      m_ppcTEncTop[lIdx]->setPocDecrementedInDPBFlag(true);
    48334831
    48344832      // Decrement value of associatedIrapPoc of the TEncGop object
    4835       m_ppcTEncTop[affectedLayerList[layerIdx]]->getGOPEncoder()->m_associatedIRAPPOC -= deltaPocVal;
     4833      m_ppcTEncTop[lIdx]->getGOPEncoder()->m_associatedIRAPPOC -= deltaPocVal;
    48364834
    48374835      // Decrememnt the value of m_pocCRA
    4838       m_ppcTEncTop[affectedLayerList[layerIdx]]->getGOPEncoder()->m_pocCRA -= deltaPocVal;
    4839 
    4840       TComList<TComPic*>::iterator  iterPic = m_ppcTEncTop[affectedLayerList[layerIdx]]->getListPic()->begin();
    4841       while (iterPic != m_ppcTEncTop[affectedLayerList[layerIdx]]->getListPic()->end())
     4836      m_ppcTEncTop[lIdx]->getGOPEncoder()->m_pocCRA -= deltaPocVal;
     4837
     4838      TComList<TComPic*>::iterator  iterPic = m_ppcTEncTop[lIdx]->getListPic()->begin();
     4839      while (iterPic != m_ppcTEncTop[lIdx]->getListPic()->end())
    48424840#else
    48434841  // Decrement value of associatedIrapPoc of the TEncGop object
     
    53425340      {
    53435341        Int iLayerId = slice->getVPS()->getPredictedLayerId(dolLayerId, i);
    5344         m_ppcTEncTop[iLayerId]->setLayerInitializedFlag(false);
    5345         m_ppcTEncTop[iLayerId]->setFirstPicInLayerDecodedFlag(false);
     5342        m_ppcTEncTop[slice->getVPS()->getLayerIdxInVps(iLayerId)]->setLayerInitializedFlag(false);
     5343        m_ppcTEncTop[slice->getVPS()->getLayerIdxInVps(iLayerId)]->setFirstPicInLayerDecodedFlag(false);
    53465344      }
    53475345
    53485346      // Each picture that is in the DPB and has nuh_layer_id equal to dolLayerId is marked as "unused for reference".
    5349       for (TComList<TComPic*>::iterator pic = m_ppcTEncTop[dolLayerId]->getListPic()->begin(); pic != m_ppcTEncTop[dolLayerId]->getListPic()->end(); pic++)
     5347      for (TComList<TComPic*>::iterator pic = m_ppcTEncTop[slice->getVPS()->getLayerIdxInVps(dolLayerId)]->getListPic()->begin(); pic != m_ppcTEncTop[slice->getVPS()->getLayerIdxInVps(dolLayerId)]->getListPic()->end(); pic++)
    53505348      {
    53515349        if ((*pic)->getSlice(0)->getPOC() != slice->getPOC())
     
    53605358      {
    53615359        UInt predLId = slice->getVPS()->getPredictedLayerId(dolLayerId, i);
    5362         for (TComList<TComPic*>::iterator pic = m_ppcTEncTop[predLId]->getListPic()->begin(); pic != m_ppcTEncTop[predLId]->getListPic()->end(); pic++)
     5360        for (TComList<TComPic*>::iterator pic = m_ppcTEncTop[slice->getVPS()->getLayerIdxInVps(predLId)]->getListPic()->begin(); pic != m_ppcTEncTop[slice->getVPS()->getLayerIdxInVps(predLId)]->getListPic()->end(); pic++)
    53635361        {
    53645362          if ((*pic)->getSlice(0)->getPOC() != slice->getPOC())
     
    53815379      m_noRaslOutputFlag = true;
    53825380    }
    5383     else if (!m_ppcTEncTop[m_layerId]->getLayerInitializedFlag())
     5381    else if (!m_ppcTEncTop[slice->getVPS()->getLayerIdxInVps(m_layerId)]->getLayerInitializedFlag())
    53845382    {
    53855383      Bool refLayersInitialized = true;
     
    53875385      {
    53885386        UInt refLayerId = slice->getVPS()->getRefLayerId(m_layerId, j);
    5389         if (!m_ppcTEncTop[refLayerId]->getLayerInitializedFlag())
     5387        if (!m_ppcTEncTop[slice->getVPS()->getLayerIdxInVps(refLayerId)]->getLayerInitializedFlag())
    53905388        {
    53915389          refLayersInitialized = false;
     
    54065404    if (m_layerId == 0)
    54075405    {
    5408       m_ppcTEncTop[m_layerId]->setLayerInitializedFlag(true);
    5409     }
    5410     else if (!m_ppcTEncTop[m_layerId]->getLayerInitializedFlag() && slice->getVPS()->getNumDirectRefLayers(m_layerId) == 0)
    5411     {
    5412       m_ppcTEncTop[m_layerId]->setLayerInitializedFlag(true);
    5413     }
    5414     else if (!m_ppcTEncTop[m_layerId]->getLayerInitializedFlag())
     5406      m_ppcTEncTop[slice->getVPS()->getLayerIdxInVps(m_layerId)]->setLayerInitializedFlag(true);
     5407    }
     5408    else if (!m_ppcTEncTop[slice->getVPS()->getLayerIdxInVps(m_layerId)]->getLayerInitializedFlag() && slice->getVPS()->getNumDirectRefLayers(m_layerId) == 0)
     5409    {
     5410      m_ppcTEncTop[slice->getVPS()->getLayerIdxInVps(m_layerId)]->setLayerInitializedFlag(true);
     5411    }
     5412    else if (!m_ppcTEncTop[slice->getVPS()->getLayerIdxInVps(m_layerId)]->getLayerInitializedFlag())
    54155413    {
    54165414      Bool refLayersInitialized = true;
     
    54185416      {
    54195417        UInt refLayerId = slice->getVPS()->getRefLayerId(m_layerId, j);
    5420         if (!m_ppcTEncTop[refLayerId]->getLayerInitializedFlag())
     5418        if (!m_ppcTEncTop[slice->getVPS()->getLayerIdxInVps(refLayerId)]->getLayerInitializedFlag())
    54215419        {
    54225420          refLayersInitialized = false;
     
    54255423      if (refLayersInitialized)
    54265424      {
    5427         m_ppcTEncTop[m_layerId]->setLayerInitializedFlag(true);
     5425        m_ppcTEncTop[slice->getVPS()->getLayerIdxInVps(m_layerId)]->setLayerInitializedFlag(true);
    54285426      }
    54295427    }
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncSearch.cpp

    r1029 r1057  
    32433243       
    32443244        // motion search only for the ILRP with sample prediction type
    3245         if( pcPic->isILR( pcCU->getLayerId() ) && !pcCU->getSlice()->getVPS()->isSamplePredictionType( pcCU->getLayerId(), pcPic->getLayerId() ) )
     3245        if( pcPic->isILR( pcCU->getLayerId() ) && !pcCU->getSlice()->getVPS()->isSamplePredictionType( pcCU->getLayerIdx(), pcPic->getLayerIdx() ) )
    32463246        {
    32473247          continue;
     
    34813481
    34823482          // motion search only for the ILRP with sample prediction type
    3483           if( pcPic->isILR( pcCU->getLayerId() ) && !pcCU->getSlice()->getVPS()->isSamplePredictionType( pcCU->getLayerId(), pcPic->getLayerId() ) )
     3483          if( pcPic->isILR( pcCU->getLayerId() ) && !pcCU->getSlice()->getVPS()->isSamplePredictionType( pcCU->getLayerIdx(), pcPic->getLayerIdx() ) )
    34843484          {
    34853485            continue;
     
    60746074
    60756075      // ILRP has to be for the sample prediction type
    6076       if( refPic->isILR(pcCU->getLayerId()) && refPic->getLayerId() == refLayerId && pcCU->getSlice()->getVPS()->isSamplePredictionType( pcCU->getLayerId(), refLayerId ) )
     6076      if( refPic->isILR(pcCU->getLayerId()) && refPic->getLayerId() == refLayerId && pcCU->getSlice()->getVPS()->isSamplePredictionType( pcCU->getLayerIdx(), pcCU->getSlice()->getVPS()->getLayerIdxInVps(refLayerId) ) )
    60776077      {
    60786078        iRefIdxTemp = refIdx;
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncSlice.cpp

    r1051 r1057  
    139139{
    140140#if JCTVC_M0259_LAMBDAREFINEMENT
    141   if( slice->getLayerId() > 0 && m_ppcTEncTop[slice->getLayerId()]->getNumActiveRefLayers() && depth >= 3 && m_pcCfg->getGOPSize() == ( 1 << depth ) )
    142   {
    143     Int nCurLayerId = slice->getLayerId();
    144     UInt prevLayerId = slice->getVPS()->getLayerIdInNuh(slice->getVPS()->getLayerIdxInVps(nCurLayerId)-1);
    145 
    146     Double gamma = xCalEnhLambdaFactor( m_ppcTEncTop[prevLayerId]->getQP() - m_ppcTEncTop[nCurLayerId]->getQP() ,
    147       1.0 * m_ppcTEncTop[nCurLayerId]->getSourceWidth() * m_ppcTEncTop[nCurLayerId]->getSourceHeight()
    148       / m_ppcTEncTop[prevLayerId]->getSourceWidth() / m_ppcTEncTop[prevLayerId]->getSourceHeight() );
     141  if( slice->getLayerId() > 0 && m_ppcTEncTop[slice->getLayerIdx()]->getNumActiveRefLayers() && depth >= 3 && m_pcCfg->getGOPSize() == ( 1 << depth ) )
     142  {
     143    Int layerIdx = slice->getLayerId();
     144    UInt prevLayerIdx = m_ppcTEncTop[layerIdx]->getPredLayerIdx( m_ppcTEncTop[layerIdx]->getNumActiveRefLayers() - 1);
     145
     146    Double gamma = xCalEnhLambdaFactor( m_ppcTEncTop[prevLayerIdx]->getQP() - m_ppcTEncTop[layerIdx]->getQP() ,
     147      1.0 * m_ppcTEncTop[layerIdx]->getSourceWidth() * m_ppcTEncTop[layerIdx]->getSourceHeight()
     148      / m_ppcTEncTop[prevLayerIdx]->getSourceWidth() / m_ppcTEncTop[prevLayerIdx]->getSourceHeight() );
    149149    dLambda *= gamma;
    150150  }
     
    165165
    166166#if JCTVC_M0259_LAMBDAREFINEMENT
    167     if( slice->getLayerId() > 0 && m_ppcTEncTop[slice->getLayerId()]->getNumActiveRefLayers() && m_pcCfg->getGOPSize() >= 8 && slice->isIntra() == false && depth == 0 )
     167    if( slice->getLayerId() > 0 && m_ppcTEncTop[slice->getLayerIdx()]->getNumActiveRefLayers() && m_pcCfg->getGOPSize() >= 8 && slice->isIntra() == false && depth == 0 )
    168168    {
    169169      dLambdas[0] = dLambda * 1.1;
     
    557557    if( rpcSlice->getNumILRRefIdx() > 0 )
    558558    {
    559       rpcSlice->setActiveNumILRRefIdx( m_ppcTEncTop[layerId]->getNumActiveRefLayers() );
     559      rpcSlice->setActiveNumILRRefIdx( m_ppcTEncTop[rpcSlice->getVPS()->getLayerIdxInVps(layerId)]->getNumActiveRefLayers() );
    560560      for( Int i = 0; i < rpcSlice->getActiveNumILRRefIdx(); i++ )
    561561      {
    562         rpcSlice->setInterLayerPredLayerIdc( m_ppcTEncTop[layerId]->getPredLayerId(i), i );
     562        rpcSlice->setInterLayerPredLayerIdc( m_ppcTEncTop[rpcSlice->getVPS()->getLayerIdxInVps(layerId)]->getPredLayerIdx(i), i );
    563563      }
    564564      rpcSlice->setInterLayerPredEnabledFlag(1);
    565565    }
    566     rpcSlice->setMFMEnabledFlag(m_ppcTEncTop[layerId]->getMFMEnabledFlag());
     566    rpcSlice->setMFMEnabledFlag(m_ppcTEncTop[rpcSlice->getVPS()->getLayerIdxInVps(layerId)]->getMFMEnabledFlag());
    567567  }
    568568
     
    764764  }
    765765#if O0194_WEIGHTED_PREDICTION_CGS
    766   else if( m_ppcTEncTop[pcSlice->getLayerId()]->getInterLayerWeightedPredFlag() )
     766  else if( m_ppcTEncTop[pcSlice->getLayerIdx()]->getInterLayerWeightedPredFlag() )
    767767  {
    768768    // Calculate for the base layer to be used in EL as Inter layer reference
     
    11371137
    11381138#if SVC_EXTENSION
    1139         m_pcEntropyCoder->encodeSAOBlkParam(saoblkParam, m_ppcTEncTop[pcSlice->getLayerId()]->getSAO()->getSaoMaxOffsetQVal(), sliceEnabled, leftMergeAvail, aboveMergeAvail);
     1139        m_pcEntropyCoder->encodeSAOBlkParam(saoblkParam, m_ppcTEncTop[pcSlice->getLayerIdx()]->getSAO()->getSaoMaxOffsetQVal(), sliceEnabled, leftMergeAvail, aboveMergeAvail);
    11401140#else
    11411141        m_pcEntropyCoder->encodeSAOBlkParam(saoblkParam, sliceEnabled, leftMergeAvail, aboveMergeAvail);
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncTop.cpp

    r1051 r1057  
    15331533TEncTop* TEncTop::getRefLayerEnc( UInt refLayerIdx )
    15341534{
    1535   if( m_ppcTEncTop[m_layerId]->getNumDirectRefLayers() <= 0 )
     1535  if( m_ppcTEncTop[m_cVPS.getLayerIdxInVps(m_layerId)]->getNumDirectRefLayers() <= 0 )
    15361536  {
    15371537    return (TEncTop *)getLayerEnc( 0 );
    15381538  }
    15391539
    1540   return (TEncTop *)getLayerEnc( m_cVPS.getRefLayerId( m_layerId, refLayerIdx ) );
     1540  return (TEncTop *)getLayerEnc( m_cVPS.getLayerIdxInVps(m_cVPS.getRefLayerId( m_layerId, refLayerIdx )) );
    15411541}
    15421542#endif
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncTop.h

    r1051 r1057  
    117117  static Int              m_iPPSIdCnt;                    ///< next Id number for PPS   
    118118  TEncTop**               m_ppcTEncTop;
    119   TEncTop*                getLayerEnc(UInt layerId)       { return m_ppcTEncTop[layerId]; }
     119  TEncTop*                getLayerEnc(UInt layerIdx)       { return m_ppcTEncTop[layerIdx]; }
    120120  TComPic*                m_cIlpPic[MAX_NUM_REF];                    ///<  Inter layer Prediction picture =  upsampled picture
    121121#if REF_IDX_MFM
     
    235235  Void      setNumRefLayerOffsets(Int x) { m_numRefLayerOffsets = x; }
    236236  UInt      getNumRefLayerOffsets() { return m_numRefLayerOffsets; }
    237   Void      setRefLayerId(Int x, UInt id) { m_refLayerId[x] = id;   }
    238   UInt      getRefLayerId(Int x)          { return m_refLayerId[x]; }
     237  Void      setRefLayerId(Int layerIdx, UInt layerId)     { m_refLayerId[layerIdx] = layerId;  }
     238  UInt      getRefLayerId(Int layerIdx)                   { return m_refLayerId[layerIdx];    }
    239239  Window&   getRefLayerWindowForLayer(Int layerId);
    240240  Window&   getRefLayerWindow(Int x)            { return m_refLayerWindow[x]; }
Note: See TracChangeset for help on using the changeset viewer.