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


Ignore:
Timestamp:
13 Jan 2015, 14:56:46 (11 years ago)
Author:
nokia
Message:

Implementation of JCTVC-R0071 - IRAP and EOS cross-layer impacts

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

Legend:

Unmodified
Added
Removed
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncCfg.h

    r912 r978  
    321321#if M0040_ADAPTIVE_RESOLUTION_CHANGE
    322322  Int       m_adaptiveResolutionChange;
     323#endif
     324#if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS
     325  int       m_layerSwitchOffBegin;
     326  int       m_layerSwitchOffEnd;
    323327#endif
    324328#if O0153_ALT_OUTPUT_LAYER_FLAG
     
    928932  Int       getAdaptiveResolutionChange()      { return m_adaptiveResolutionChange; }
    929933#endif
     934#if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS
     935  Void      setLayerSwitchOffBegin(Int x) { m_layerSwitchOffBegin = x;    }
     936  Int       getLayerSwitchOffBegin()      { return m_layerSwitchOffBegin; }
     937  Void      setLayerSwitchOffEnd(Int x)   { m_layerSwitchOffEnd = x;      }
     938  Int       getLayerSwitchOffEnd()        { return m_layerSwitchOffEnd;   }
     939#endif
    930940#if HIGHER_LAYER_IRAP_SKIP_FLAG
    931941  Void      setSkipPictureAtArcSwitch(Int x) { m_skipPictureAtArcSwitch = x;    }
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.cpp

    r944 r978  
    119119  m_lastPocPeriodId = -1;
    120120#endif
     121#if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS
     122  m_noRaslOutputFlag = false;
     123  m_prevPicHasEos    = false;
     124#endif
    121125#endif //SVC_EXTENSION
    122126  return;
     
    913917    }
    914918#endif
     919#if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS
     920    if (pocCurr > m_pcEncTop->getLayerSwitchOffBegin() && pocCurr < m_pcEncTop->getLayerSwitchOffEnd())
     921    {
     922      continue;
     923    }
     924#endif
    915925
    916926    if( getNalUnitType(pocCurr, m_iLastIDR, isField) == NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType(pocCurr, m_iLastIDR, isField) == NAL_UNIT_CODED_SLICE_IDR_N_LP )
     
    10671077    }
    10681078#endif
     1079#if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS
     1080    // Set the nal unit type
     1081    pcSlice->setNalUnitType(getNalUnitType(pocCurr, m_iLastIDR, isField));
     1082#endif
    10691083#if NO_CLRAS_OUTPUT_FLAG
    10701084    if (m_layerId == 0 &&
     
    10801094        m_pcEncTop->setNoClrasOutputFlag(true);
    10811095      }
     1096#if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS
     1097      else if (m_prevPicHasEos)
     1098      {
     1099        m_pcEncTop->setNoClrasOutputFlag(true);
     1100      }
     1101#endif
    10821102      else if (pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP
    10831103            || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL
     
    11061126      }
    11071127    }
     1128#endif
     1129#if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS
     1130    xCheckLayerReset(pcSlice);
     1131    xSetNoRaslOutputFlag(pcSlice);
     1132    xSetLayerInitializedFlag(pcSlice);
    11081133#endif
    11091134#if M0040_ADAPTIVE_RESOLUTION_CHANGE
     
    12171242    }
    12181243
     1244#if !R0071_IRAP_EOS_CROSS_LAYER_IMPACTS
    12191245    // Set the nal unit type
    12201246    pcSlice->setNalUnitType(getNalUnitType(pocCurr, m_iLastIDR, isField));
     1247#endif
    12211248#if SVC_EXTENSION
    12221249    if (m_layerId > 0)
     
    29402967
    29412968#if SETTING_NO_OUT_PIC_PRIOR
     2969#if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS
     2970          if (pcSlice->isIRAP())
     2971          {
     2972            //the inference for NoOutputPriorPicsFlag
     2973            // KJS: This cannot happen at the encoder
     2974            if (!m_bFirst && pcSlice->isIRAP() && m_noRaslOutputFlag)
     2975            {
     2976              if (pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA)
     2977              {
     2978                pcSlice->setNoOutputPriorPicsFlag(true);
     2979              }
     2980            }
     2981          }
     2982#else
    29422983          pcSlice->setNoRaslOutputFlag(false);
    29432984          if (pcSlice->isIRAP())
     
    29572998            }
    29582999          }
     3000#endif
    29593001#endif
    29603002
     
    35243566        }
    35253567      }
     3568
     3569#if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS
     3570      m_prevPicHasEos = false;
     3571      if (m_pcCfg->getLayerSwitchOffBegin() < m_pcCfg->getLayerSwitchOffEnd())
     3572      {
     3573        Int pocNext;
     3574        if (iGOPid == m_iGopSize - 1)
     3575        {
     3576          pocNext = iPOCLast - iNumPicRcvd + m_iGopSize + m_pcCfg->getGOPEntry(0).m_POC;
     3577        }
     3578        else
     3579        {
     3580          pocNext = iPOCLast - iNumPicRcvd + m_pcCfg->getGOPEntry(iGOPid + 1).m_POC;
     3581        }
     3582
     3583        if (pocNext > m_pcCfg->getLayerSwitchOffBegin() && pocCurr < m_pcCfg->getLayerSwitchOffEnd())
     3584        {
     3585          OutputNALUnit nalu(NAL_UNIT_EOS, pcSlice->getTLayer(), pcSlice->getLayerId());
     3586          m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice);
     3587          accessUnit.push_back(new NALUnitEBSP(nalu));
     3588          m_prevPicHasEos = true;
     3589        }
     3590      }
     3591#endif
     3592
    35263593      xResetNonNestedSEIPresentFlags();
    35273594      xResetNestedSEIPresentFlags();
     
    53785445}
    53795446#endif
     5447
     5448#if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS
     5449Void TEncGOP::xCheckLayerReset(TComSlice *slice)
     5450{
     5451  Bool layerResetFlag;
     5452  Int dolLayerId;
     5453
     5454  if (slice->isIRAP() && slice->getLayerId() > 0)
     5455  {
     5456    if (m_prevPicHasEos)
     5457    {
     5458      layerResetFlag = true;
     5459      dolLayerId = slice->getLayerId();
     5460    }
     5461    else if ((slice->isCRA() && slice->getHandleCraAsBlaFlag()) || (slice->isIDR() && slice->getCrossLayerBLAFlag()) || slice->isBLA())
     5462    {
     5463      layerResetFlag = true;
     5464      dolLayerId = slice->getLayerId();
     5465    }
     5466    else
     5467    {
     5468      layerResetFlag = false;
     5469    }
     5470
     5471    if (layerResetFlag)
     5472    {
     5473      for (Int i = 0; i < slice->getVPS()->getNumPredictedLayers(dolLayerId); i++)
     5474      {
     5475        Int iLayerId = slice->getVPS()->getPredictedLayerId(dolLayerId, i);
     5476        m_ppcTEncTop[iLayerId]->setLayerInitializedFlag(false);
     5477        m_ppcTEncTop[iLayerId]->setFirstPicInLayerDecodedFlag(false);
     5478      }
     5479
     5480      // Each picture that is in the DPB and has nuh_layer_id equal to dolLayerId is marked as "unused for reference".
     5481      for (TComList<TComPic*>::iterator pic = m_ppcTEncTop[dolLayerId]->getListPic()->begin(); pic != m_ppcTEncTop[dolLayerId]->getListPic()->end(); pic++)
     5482      {
     5483        if ((*pic)->getSlice(0)->getPOC() != slice->getPOC())
     5484        {
     5485          (*pic)->getSlice(0)->setReferenced(false);
     5486        }
     5487      }
     5488
     5489      // Each picture that is in DPB and has nuh_layer_id equal to any value of IdPredictedLayer[dolLayerId][i]
     5490      // for the values of i in range of 0 to NumPredictedLayers[dolLayerId] - 1, inclusive, is marked as "unused for reference"
     5491      for (UInt i = 0; i < slice->getVPS()->getNumPredictedLayers(dolLayerId); i++)
     5492      {
     5493        UInt predLId = slice->getVPS()->getPredictedLayerId(dolLayerId, i);
     5494        for (TComList<TComPic*>::iterator pic = m_ppcTEncTop[predLId]->getListPic()->begin(); pic != m_ppcTEncTop[predLId]->getListPic()->end(); pic++)
     5495        {
     5496          if ((*pic)->getSlice(0)->getPOC() != slice->getPOC())
     5497          {
     5498            (*pic)->getSlice(0)->setReferenced(false);
     5499          }
     5500        }
     5501      }
     5502    }
     5503  }
     5504}
     5505
     5506Void TEncGOP::xSetNoRaslOutputFlag(TComSlice *slice)
     5507{
     5508  if (slice->isIRAP())
     5509  {
     5510    m_noRaslOutputFlag = slice->getHandleCraAsBlaFlag();  // default value
     5511    if (slice->isIDR() || slice->isBLA() || m_bFirst || m_prevPicHasEos)
     5512    {
     5513      m_noRaslOutputFlag = true;
     5514    }
     5515    else if (!m_ppcTEncTop[m_layerId]->getLayerInitializedFlag())
     5516    {
     5517      Bool refLayersInitialized = true;
     5518      for (UInt j = 0; j < slice->getVPS()->getNumDirectRefLayers(m_layerId); j++)
     5519      {
     5520        UInt refLayerId = slice->getVPS()->getRefLayerId(m_layerId, j);
     5521        if (!m_ppcTEncTop[refLayerId]->getLayerInitializedFlag())
     5522        {
     5523          refLayersInitialized = false;
     5524        }
     5525      }
     5526      if (refLayersInitialized)
     5527      {
     5528        m_noRaslOutputFlag = true;
     5529      }
     5530    }
     5531  }
     5532}
     5533
     5534Void TEncGOP::xSetLayerInitializedFlag(TComSlice *slice)
     5535{
     5536  if (slice->isIRAP() && m_noRaslOutputFlag)
     5537  {
     5538    if (m_layerId == 0)
     5539    {
     5540      m_ppcTEncTop[m_layerId]->setLayerInitializedFlag(true);
     5541    }
     5542    else if (!m_ppcTEncTop[m_layerId]->getLayerInitializedFlag() && slice->getVPS()->getNumDirectRefLayers(m_layerId) == 0)
     5543    {
     5544      m_ppcTEncTop[m_layerId]->setLayerInitializedFlag(true);
     5545    }
     5546    else if (!m_ppcTEncTop[m_layerId]->getLayerInitializedFlag())
     5547    {
     5548      Bool refLayersInitialized = true;
     5549      for (UInt j = 0; j < slice->getVPS()->getNumDirectRefLayers(m_layerId); j++)
     5550      {
     5551        UInt refLayerId = slice->getVPS()->getRefLayerId(m_layerId, j);
     5552        if (!m_ppcTEncTop[refLayerId]->getLayerInitializedFlag())
     5553        {
     5554          refLayersInitialized = false;
     5555        }
     5556      }
     5557      if (refLayersInitialized)
     5558      {
     5559        m_ppcTEncTop[m_layerId]->setLayerInitializedFlag(true);
     5560      }
     5561    }
     5562  }
     5563}
     5564#endif // R0071_IRAP_EOS_CROSS_LAYER_IMPACTS
     5565
    53805566#endif //SVC_EXTENSION
    53815567
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.h

    r912 r978  
    159159  Int   m_lastPocPeriodId;
    160160#endif
     161#if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS
     162  Bool  m_noRaslOutputFlag;
     163  Bool  m_prevPicHasEos;
     164#endif
    161165#endif
    162166 
     
    281285  Void free_mem2DintWithPad(Int **array2D, Int iPadY, Int iPadX);
    282286#endif
     287#if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS
     288  Void xCheckLayerReset(TComSlice *slice);
     289  Void xSetNoRaslOutputFlag(TComSlice *slice);
     290  Void xSetLayerInitializedFlag(TComSlice *slice);
     291#endif
    283292#endif //SVC_EXTENSION
    284293};// END CLASS DEFINITION TEncGOP
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncTop.h

    r903 r978  
    172172  Int                     m_currPocMsb;
    173173#endif
     174#if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS
     175  Bool                    m_prevPicHasEos;
     176#endif
    174177#endif //SVC_EXTENSION
    175178protected:
Note: See TracChangeset for help on using the changeset viewer.