Changeset 979 in SHVCSoftware for branches/SHM-upgrade/source/Lib/TLibEncoder
- Timestamp:
- 13 Jan 2015, 17:32:39 (10 years ago)
- Location:
- branches/SHM-upgrade/source/Lib/TLibEncoder
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-upgrade/source/Lib/TLibEncoder/TEncCfg.h
r916 r979 372 372 #if M0040_ADAPTIVE_RESOLUTION_CHANGE 373 373 Int m_adaptiveResolutionChange; 374 #endif 375 #if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS 376 int m_layerSwitchOffBegin; 377 int m_layerSwitchOffEnd; 374 378 #endif 375 379 #if O0153_ALT_OUTPUT_LAYER_FLAG … … 1048 1052 Int getAdaptiveResolutionChange() { return m_adaptiveResolutionChange; } 1049 1053 #endif 1054 #if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS 1055 Void setLayerSwitchOffBegin(Int x) { m_layerSwitchOffBegin = x; } 1056 Int getLayerSwitchOffBegin() { return m_layerSwitchOffBegin; } 1057 Void setLayerSwitchOffEnd(Int x) { m_layerSwitchOffEnd = x; } 1058 Int getLayerSwitchOffEnd() { return m_layerSwitchOffEnd; } 1059 #endif 1050 1060 #if HIGHER_LAYER_IRAP_SKIP_FLAG 1051 1061 Void setSkipPictureAtArcSwitch(Int x) { m_skipPictureAtArcSwitch = x; } -
branches/SHM-upgrade/source/Lib/TLibEncoder/TEncGOP.cpp
r946 r979 122 122 m_lastPocPeriodId = -1; 123 123 #endif 124 #if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS 125 m_noRaslOutputFlag = false; 126 m_prevPicHasEos = false; 127 #endif 124 128 #endif //SVC_EXTENSION 125 129 return; … … 946 950 } 947 951 #endif 952 #if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS 953 if (pocCurr > m_pcEncTop->getLayerSwitchOffBegin() && pocCurr < m_pcEncTop->getLayerSwitchOffEnd()) 954 { 955 continue; 956 } 957 #endif 948 958 949 959 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 ) … … 1100 1110 } 1101 1111 #endif 1112 #if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS 1113 // Set the nal unit type 1114 pcSlice->setNalUnitType(getNalUnitType(pocCurr, m_iLastIDR, isField)); 1115 #endif 1102 1116 #if NO_CLRAS_OUTPUT_FLAG 1103 1117 if (m_layerId == 0 && … … 1113 1127 m_pcEncTop->setNoClrasOutputFlag(true); 1114 1128 } 1129 #if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS 1130 else if (m_prevPicHasEos) 1131 { 1132 m_pcEncTop->setNoClrasOutputFlag(true); 1133 } 1134 #endif 1115 1135 else if (pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 1116 1136 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL … … 1139 1159 } 1140 1160 } 1161 #endif 1162 #if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS 1163 xCheckLayerReset(pcSlice); 1164 xSetNoRaslOutputFlag(pcSlice); 1165 xSetLayerInitializedFlag(pcSlice); 1141 1166 #endif 1142 1167 #if M0040_ADAPTIVE_RESOLUTION_CHANGE … … 1252 1277 } 1253 1278 1279 #if !R0071_IRAP_EOS_CROSS_LAYER_IMPACTS 1254 1280 // Set the nal unit type 1255 1281 pcSlice->setNalUnitType(getNalUnitType(pocCurr, m_iLastIDR, isField)); 1282 #endif 1256 1283 #if SVC_EXTENSION 1257 1284 if (m_layerId > 0) … … 2853 2880 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); 2854 2881 2855 pcSlice->setNoRaslOutputFlag(false); 2882 #if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS 2856 2883 if (pcSlice->isIRAP()) 2857 2884 { 2858 if (pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && pcSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_IDR_N_LP)2859 {2860 pcSlice->setNoRaslOutputFlag(true);2861 }2862 2885 //the inference for NoOutputPriorPicsFlag 2863 2886 // KJS: This cannot happen at the encoder 2864 if (!m_bFirst && pcSlice->isIRAP() && pcSlice->getNoRaslOutputFlag())2887 if (!m_bFirst && pcSlice->isIRAP() && m_noRaslOutputFlag) 2865 2888 { 2866 2889 if (pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA) … … 2870 2893 } 2871 2894 } 2895 #else 2896 pcSlice->setNoRaslOutputFlag(false); 2897 if (pcSlice->isIRAP()) 2898 { 2899 if (pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && pcSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_IDR_N_LP) 2900 { 2901 pcSlice->setNoRaslOutputFlag(true); 2902 } 2903 //the inference for NoOutputPriorPicsFlag 2904 // KJS: This cannot happen at the encoder 2905 if (!m_bFirst && pcSlice->isIRAP() && pcSlice->getNoRaslOutputFlag()) 2906 { 2907 if (pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA) 2908 { 2909 pcSlice->setNoOutputPriorPicsFlag(true); 2910 } 2911 } 2912 } 2913 #endif 2872 2914 2873 2915 tmpBitsBeforeWriting = m_pcEntropyCoder->getNumberOfWrittenBits(); … … 3362 3404 } 3363 3405 } 3406 3407 #if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS 3408 m_prevPicHasEos = false; 3409 if (m_pcCfg->getLayerSwitchOffBegin() < m_pcCfg->getLayerSwitchOffEnd()) 3410 { 3411 Int pocNext; 3412 if (iGOPid == m_iGopSize - 1) 3413 { 3414 pocNext = iPOCLast - iNumPicRcvd + m_iGopSize + m_pcCfg->getGOPEntry(0).m_POC; 3415 } 3416 else 3417 { 3418 pocNext = iPOCLast - iNumPicRcvd + m_pcCfg->getGOPEntry(iGOPid + 1).m_POC; 3419 } 3420 3421 if (pocNext > m_pcCfg->getLayerSwitchOffBegin() && pocCurr < m_pcCfg->getLayerSwitchOffEnd()) 3422 { 3423 OutputNALUnit nalu(NAL_UNIT_EOS, pcSlice->getTLayer(), pcSlice->getLayerId()); 3424 m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice); 3425 accessUnit.push_back(new NALUnitEBSP(nalu)); 3426 m_prevPicHasEos = true; 3427 } 3428 } 3429 #endif 3364 3430 3365 3431 xResetNonNestedSEIPresentFlags(); … … 5205 5271 } 5206 5272 #endif 5273 5274 #if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS 5275 Void TEncGOP::xCheckLayerReset(TComSlice *slice) 5276 { 5277 Bool layerResetFlag; 5278 Int dolLayerId; 5279 5280 if (slice->isIRAP() && slice->getLayerId() > 0) 5281 { 5282 if (m_prevPicHasEos) 5283 { 5284 layerResetFlag = true; 5285 dolLayerId = slice->getLayerId(); 5286 } 5287 else if ((slice->isCRA() && slice->getHandleCraAsBlaFlag()) || (slice->isIDR() && slice->getCrossLayerBLAFlag()) || slice->isBLA()) 5288 { 5289 layerResetFlag = true; 5290 dolLayerId = slice->getLayerId(); 5291 } 5292 else 5293 { 5294 layerResetFlag = false; 5295 } 5296 5297 if (layerResetFlag) 5298 { 5299 for (Int i = 0; i < slice->getVPS()->getNumPredictedLayers(dolLayerId); i++) 5300 { 5301 Int iLayerId = slice->getVPS()->getPredictedLayerId(dolLayerId, i); 5302 m_ppcTEncTop[iLayerId]->setLayerInitializedFlag(false); 5303 m_ppcTEncTop[iLayerId]->setFirstPicInLayerDecodedFlag(false); 5304 } 5305 5306 // Each picture that is in the DPB and has nuh_layer_id equal to dolLayerId is marked as "unused for reference". 5307 for (TComList<TComPic*>::iterator pic = m_ppcTEncTop[dolLayerId]->getListPic()->begin(); pic != m_ppcTEncTop[dolLayerId]->getListPic()->end(); pic++) 5308 { 5309 if ((*pic)->getSlice(0)->getPOC() != slice->getPOC()) 5310 { 5311 (*pic)->getSlice(0)->setReferenced(false); 5312 } 5313 } 5314 5315 // Each picture that is in DPB and has nuh_layer_id equal to any value of IdPredictedLayer[dolLayerId][i] 5316 // for the values of i in range of 0 to NumPredictedLayers[dolLayerId] - 1, inclusive, is marked as "unused for reference" 5317 for (UInt i = 0; i < slice->getVPS()->getNumPredictedLayers(dolLayerId); i++) 5318 { 5319 UInt predLId = slice->getVPS()->getPredictedLayerId(dolLayerId, i); 5320 for (TComList<TComPic*>::iterator pic = m_ppcTEncTop[predLId]->getListPic()->begin(); pic != m_ppcTEncTop[predLId]->getListPic()->end(); pic++) 5321 { 5322 if ((*pic)->getSlice(0)->getPOC() != slice->getPOC()) 5323 { 5324 (*pic)->getSlice(0)->setReferenced(false); 5325 } 5326 } 5327 } 5328 } 5329 } 5330 } 5331 5332 Void TEncGOP::xSetNoRaslOutputFlag(TComSlice *slice) 5333 { 5334 if (slice->isIRAP()) 5335 { 5336 m_noRaslOutputFlag = slice->getHandleCraAsBlaFlag(); // default value 5337 if (slice->isIDR() || slice->isBLA() || m_bFirst || m_prevPicHasEos) 5338 { 5339 m_noRaslOutputFlag = true; 5340 } 5341 else if (!m_ppcTEncTop[m_layerId]->getLayerInitializedFlag()) 5342 { 5343 Bool refLayersInitialized = true; 5344 for (UInt j = 0; j < slice->getVPS()->getNumDirectRefLayers(m_layerId); j++) 5345 { 5346 UInt refLayerId = slice->getVPS()->getRefLayerId(m_layerId, j); 5347 if (!m_ppcTEncTop[refLayerId]->getLayerInitializedFlag()) 5348 { 5349 refLayersInitialized = false; 5350 } 5351 } 5352 if (refLayersInitialized) 5353 { 5354 m_noRaslOutputFlag = true; 5355 } 5356 } 5357 } 5358 } 5359 5360 Void TEncGOP::xSetLayerInitializedFlag(TComSlice *slice) 5361 { 5362 if (slice->isIRAP() && m_noRaslOutputFlag) 5363 { 5364 if (m_layerId == 0) 5365 { 5366 m_ppcTEncTop[m_layerId]->setLayerInitializedFlag(true); 5367 } 5368 else if (!m_ppcTEncTop[m_layerId]->getLayerInitializedFlag() && slice->getVPS()->getNumDirectRefLayers(m_layerId) == 0) 5369 { 5370 m_ppcTEncTop[m_layerId]->setLayerInitializedFlag(true); 5371 } 5372 else if (!m_ppcTEncTop[m_layerId]->getLayerInitializedFlag()) 5373 { 5374 Bool refLayersInitialized = true; 5375 for (UInt j = 0; j < slice->getVPS()->getNumDirectRefLayers(m_layerId); j++) 5376 { 5377 UInt refLayerId = slice->getVPS()->getRefLayerId(m_layerId, j); 5378 if (!m_ppcTEncTop[refLayerId]->getLayerInitializedFlag()) 5379 { 5380 refLayersInitialized = false; 5381 } 5382 } 5383 if (refLayersInitialized) 5384 { 5385 m_ppcTEncTop[m_layerId]->setLayerInitializedFlag(true); 5386 } 5387 } 5388 } 5389 } 5390 #endif // R0071_IRAP_EOS_CROSS_LAYER_IMPACTS 5391 5207 5392 #endif //SVC_EXTENSION 5208 5393 -
branches/SHM-upgrade/source/Lib/TLibEncoder/TEncGOP.h
r916 r979 153 153 Int m_lastPocPeriodId; 154 154 #endif 155 #if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS 156 Bool m_noRaslOutputFlag; 157 Bool m_prevPicHasEos; 158 #endif 155 159 #endif 156 160 … … 280 284 Void free_mem2DintWithPad(Int **array2D, Int iPadY, Int iPadX); 281 285 #endif 286 #if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS 287 Void xCheckLayerReset(TComSlice *slice); 288 Void xSetNoRaslOutputFlag(TComSlice *slice); 289 Void xSetLayerInitializedFlag(TComSlice *slice); 290 #endif 282 291 #endif //SVC_EXTENSION 283 292 };// END CLASS DEFINITION TEncGOP -
branches/SHM-upgrade/source/Lib/TLibEncoder/TEncTop.h
r916 r979 163 163 Int m_currPocMsb; 164 164 #endif 165 #if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS 166 Bool m_prevPicHasEos; 167 #endif 165 168 #endif //SVC_EXTENSION 166 169 protected:
Note: See TracChangeset for help on using the changeset viewer.