Changeset 964 in 3DVCSoftware for trunk/source/App/TAppDecoder
- Timestamp:
- 5 Jul 2014, 05:16:45 (11 years ago)
- Location:
- trunk/source/App/TAppDecoder
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/App/TAppDecoder/TAppDecCfg.h
r872 r964 45 45 #include "TLibCommon/CommonDef.h" 46 46 #include <vector> 47 48 47 //! \ingroup TAppDecoder 49 48 //! \{ -
trunk/source/App/TAppDecoder/TAppDecTop.cpp
r884 r964 70 70 m_pScaleOffsetFile = 0; 71 71 #endif 72 73 #if H_MV_HLS_7_VPS_P0300_27 74 m_markedForOutput = false; 75 #endif 76 72 77 } 73 78 … … 152 157 Bool openedReconFile = false; // reconstruction file not yet opened. (must be performed after SPS is seen) 153 158 #else 154 #if H_3D 159 155 160 Int pocCurrPic = -MAX_INT; 156 161 Int pocLastPic = -MAX_INT; 157 #endif 158 162 163 #if H_MV_HLS_7_VPS_P0300_27 164 Int layerIdLastPic = -MAX_INT; 165 #endif 159 166 Int layerIdCurrPic = 0; 160 167 … … 188 195 Bool newSliceDiffPoc = false; 189 196 Bool newSliceDiffLayer = false; 190 Bool sliceSkippedFlag = false; 191 #if H_3D 197 Bool sliceSkippedFlag = false; 192 198 Bool allLayersDecoded = false; 193 #endif194 199 #endif 195 200 if (nalUnit.empty()) … … 210 215 || nalu.m_layerId > MAX_NUM_LAYER_IDS-1 211 216 || (nalu.m_nalUnitType == NAL_UNIT_VPS && nalu.m_layerId > 0) 212 || (nalu.m_nalUnitType == NAL_UNIT_EOB && nalu.m_layerId > 0) 217 || (nalu.m_nalUnitType == NAL_UNIT_EOB && nalu.m_layerId > 0) 218 #if H_MV_HLS_8_MIS_Q0177_47 219 || (nalu.m_nalUnitType == NAL_UNIT_EOS && nalu.m_layerId > 0) 220 #endif 213 221 ) 214 222 { … … 229 237 // - nalu.isSlice() == true 230 238 239 #if H_MV_HLS_7_VPS_P0300_27 240 if ( nalu.m_nalUnitType == NAL_UNIT_VPS ) 241 { 242 m_vps = m_tDecTop[decIdx]->getPrefetchedVPS(); 243 if ( m_targetDecLayerIdSetFileEmpty ) 244 { 245 TComVPS* vps = m_vps; 246 #else 231 247 // Update TargetDecLayerIdList only when not specified by layer id file, specification by file might actually out of conformance. 232 248 if (nalu.m_nalUnitType == NAL_UNIT_VPS && m_targetDecLayerIdSetFileEmpty ) 233 249 { 234 250 TComVPS* vps = m_tDecTop[decIdx]->getPrefetchedVPS(); 251 #endif 235 252 if ( m_targetOptLayerSetIdx == -1 ) 236 253 { … … 238 255 m_targetOptLayerSetIdx = vps->getVpsNumLayerSetsMinus1(); 239 256 } 257 #if H_MV_HLS_8_HRD_Q0102_08 258 for (Int dI = 0; dI < m_numDecoders; dI++ ) 259 { 260 m_tDecTop[decIdx]->setTargetOptLayerSetIdx( m_targetOptLayerSetIdx ); 261 } 262 #endif 240 263 241 264 if ( m_targetOptLayerSetIdx < 0 || m_targetOptLayerSetIdx >= vps->getNumOutputLayerSets() ) … … 246 269 m_targetDecLayerIdSet = vps->getTargetDecLayerIdList( m_targetOptLayerSetIdx ); 247 270 } 248 271 #if H_MV_HLS_7_VPS_P0300_27 272 } 273 #endif 249 274 #if H_3D 250 275 if (nalu.m_nalUnitType == NAL_UNIT_VPS ) … … 257 282 { 258 283 layerIdCurrPic = nalu.m_layerId; 259 #if H_3D260 284 pocCurrPic = m_tDecTop[decIdx]->getCurrPoc(); 261 #endif262 285 decIdxCurrPic = decIdx; 263 286 firstSlice = false; … … 266 289 if ( bNewPicture || !bitstreamFile ) 267 290 { 291 #if H_MV_HLS_7_VPS_P0300_27 292 layerIdLastPic = layerIdCurrPic; 293 #endif 268 294 layerIdCurrPic = nalu.m_layerId; 269 #if H_3D270 295 pocLastPic = pocCurrPic; 271 296 pocCurrPic = m_tDecTop[decIdx]->getCurrPoc(); 272 #endif273 297 decIdxLastPic = decIdxCurrPic; 274 298 decIdxCurrPic = decIdx; 275 #if H_3D276 299 allLayersDecoded = ( pocCurrPic != pocLastPic ); 277 #endif278 300 } 279 301 #else … … 318 340 assert( decIdxLastPic != -1 ); 319 341 m_tDecTop[decIdxLastPic]->endPicDecoding(poc, pcListPic, m_targetDecLayerIdSet ); 342 #if H_MV_HLS_7_VPS_P0300_27 343 xMarkForOutput( allLayersDecoded, poc, layerIdLastPic ); 344 #endif 320 345 #else 321 346 m_cTDecTop.executeLoopFilters(poc, pcListPic); … … 324 349 loopFiltered = (nalu.m_nalUnitType == NAL_UNIT_EOS); 325 350 } 351 #if !FIX_WRITING_OUTPUT 352 #if SETTING_NO_OUT_PIC_PRIOR 353 if (bNewPicture && m_cTDecTop.getIsNoOutputPriorPics()) 354 { 355 m_cTDecTop.checkNoOutputPriorPics( pcListPic ); 356 } 357 #endif 358 #endif 326 359 #if H_3D 327 360 if ( allLayersDecoded || !bitstreamFile ) … … 351 384 m_reconOpen[decIdxLastPic] = true; 352 385 } 386 #if FIX_WRITING_OUTPUT 387 // write reconstruction to file 388 if( bNewPicture ) 389 { 390 // Bumping after picture has been decoded 391 #if ENC_DEC_TRACE 392 g_bJustDoIt = true; 393 writeToTraceFile( "Bumping after decoding \n", g_decTracePicOutput ); 394 g_bJustDoIt = false; 395 #endif 396 xWriteOutput( pcListPic, decIdxLastPic, nalu.m_temporalId ); 397 } 398 #if SETTING_NO_OUT_PIC_PRIOR 399 if ( (bNewPicture || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_CRA) && m_tDecTop[decIdxLastPic]->getNoOutputPriorPicsFlag() ) 400 { 401 m_tDecTop[decIdxLastPic]->checkNoOutputPriorPics( pcListPic ); 402 m_tDecTop[decIdxLastPic]->setNoOutputPriorPicsFlag (false); 403 } 404 #endif 405 #endif 353 406 if ( bNewPicture && newSliceDiffPoc && 354 407 #else … … 356 409 openedReconFile = true; 357 410 } 411 #if FIX_WRITING_OUTPUT 412 // write reconstruction to file 413 if( bNewPicture ) 414 { 415 xWriteOutput( pcListPic, nalu.m_temporalId ); 416 } 417 #if SETTING_NO_OUT_PIC_PRIOR 418 if ( (bNewPicture || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_CRA) && m_cTDecTop.getNoOutputPriorPicsFlag() ) 419 { 420 m_cTDecTop.checkNoOutputPriorPics( pcListPic ); 421 m_cTDecTop.setNoOutputPriorPicsFlag (false); 422 } 423 #endif 424 #endif 358 425 if ( bNewPicture && 359 426 #endif … … 373 440 { 374 441 #if H_MV 442 #if FIX_OUTPUT_EOS 443 xWriteOutput( pcListPic, decIdxLastPic, nalu.m_temporalId ); 444 #else 375 445 xFlushOutput( pcListPic, decIdxLastPic ); 446 #endif 447 #else 448 #if FIX_OUTPUT_EOS 449 xWriteOutput( pcListPic, nalu.m_temporalId ); 376 450 #else 377 451 xFlushOutput( pcListPic ); 378 452 #endif 379 } 380 // write reconstruction to file 453 454 #endif 455 } 456 // write reconstruction to file -- for additional bumping as defined in C.5.2.3 457 #if H_MV 458 // Above comment seems to be wrong 459 #endif 460 #if FIX_WRITING_OUTPUT 461 if(!bNewPicture && nalu.m_nalUnitType >= NAL_UNIT_CODED_SLICE_TRAIL_N && nalu.m_nalUnitType <= NAL_UNIT_RESERVED_VCL31) 462 #else 381 463 if(bNewPicture) 382 { 383 #if H_MV 384 xWriteOutput( pcListPic, decIdxLastPic, nalu.m_temporalId ); 385 } 386 } 387 } 388 464 #endif 465 { 466 #if H_MV 467 // Bumping after reference picture set has been applied (here after first vcl nalu. 468 #if ENC_DEC_TRACE 469 g_bJustDoIt = true; 470 writeToTraceFile( "Bumping after reference picture set has been applied \n", g_decTracePicOutput ); 471 g_bJustDoIt = false; 472 #endif 473 474 xWriteOutput( m_tDecTop[decIdxCurrPic]->getListPic(), decIdxCurrPic, nalu.m_temporalId ); 475 #else 476 xWriteOutput( pcListPic, nalu.m_temporalId ); 477 #endif 478 } 479 } 480 } 481 #if H_MV 389 482 #if H_3D 390 483 if( m_cCamParsCollector.isInitialized() ) … … 397 490 xFlushOutput( m_tDecTop[decIdx]->getListPic(), decIdx ); 398 491 } 399 #else 400 xWriteOutput( pcListPic, nalu.m_temporalId ); 401 } 402 } 403 } 404 492 #else 405 493 xFlushOutput( pcListPic ); 406 494 // delete buffers … … 497 585 TComList<TComPic*>::iterator iterPic = pcListPic->begin(); 498 586 Int numPicsNotYetDisplayed = 0; 587 Int dpbFullness = 0; 588 #if H_MV 589 // preliminary fix 590 TComSPS* activeSPS = m_tDecTop[0]->getActiveSPS(); 591 #else 592 TComSPS* activeSPS = m_cTDecTop.getActiveSPS(); 593 #endif 594 UInt numReorderPicsHighestTid; 595 UInt maxDecPicBufferingHighestTid; 596 UInt maxNrSublayers = activeSPS->getMaxTLayers(); 597 598 if(m_iMaxTemporalLayer == -1 || m_iMaxTemporalLayer >= maxNrSublayers) 599 { 600 numReorderPicsHighestTid = activeSPS->getNumReorderPics(maxNrSublayers-1); 601 maxDecPicBufferingHighestTid = activeSPS->getMaxDecPicBuffering(maxNrSublayers-1); 602 } 603 else 604 { 605 numReorderPicsHighestTid = activeSPS->getNumReorderPics(m_iMaxTemporalLayer); 606 maxDecPicBufferingHighestTid = activeSPS->getMaxDecPicBuffering(m_iMaxTemporalLayer); 607 } 499 608 500 609 while (iterPic != pcListPic->end()) … … 508 617 { 509 618 numPicsNotYetDisplayed++; 619 dpbFullness++; 620 } 621 else if(pcPic->getSlice( 0 )->isReferenced()) 622 { 623 dpbFullness++; 510 624 } 511 625 iterPic++; … … 533 647 && pcPicBottom->getOutputMark() && (numPicsNotYetDisplayed > pcPicBottom->getNumReorderPics(tId) && (pcPicTop->getPOC() == m_pocLastDisplay[decIdx]+1 || m_pocLastDisplay[decIdx]<0))) 534 648 #else 535 if ( pcPicTop->getOutputMark() && (numPicsNotYetDisplayed > pcPicTop->getNumReorderPics(tId) && !(pcPicTop->getPOC()%2) && pcPicBottom->getPOC() == pcPicTop->getPOC()+1) 536 && pcPicBottom->getOutputMark() && (numPicsNotYetDisplayed > pcPicBottom->getNumReorderPics(tId) && (pcPicTop->getPOC() == m_iPOCLastDisplay+1 || m_iPOCLastDisplay<0))) 649 if ( pcPicTop->getOutputMark() && pcPicBottom->getOutputMark() && 650 (numPicsNotYetDisplayed > numReorderPicsHighestTid || dpbFullness > maxDecPicBufferingHighestTid) && 651 (!(pcPicTop->getPOC()%2) && pcPicBottom->getPOC() == pcPicTop->getPOC()+1) && 652 (pcPicTop->getPOC() == m_iPOCLastDisplay+1 || m_iPOCLastDisplay < 0)) 537 653 #endif 538 654 { … … 552 668 assert( conf .getScaledFlag() ); 553 669 assert( defDisp.getScaledFlag() ); 670 #if ENC_DEC_TRACE 671 g_bJustDoIt = true; 672 writeToTraceFile( "OutputPic Poc" , pcPic->getPOC (), g_decTracePicOutput ); 673 writeToTraceFile( "OutputPic LayerId", pcPic->getLayerId(), g_decTracePicOutput ); 674 g_bJustDoIt = false; 675 #endif 554 676 m_tVideoIOYuvReconFile[decIdx]->write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(), 555 677 #else … … 613 735 614 736 #if H_MV 615 if ( pcPic->getOutputMark() && (numPicsNotYetDisplayed > pcPic->getNumReorderPics(tId) && pcPic->getPOC() > m_pocLastDisplay[decIdx])) 737 if(pcPic->getOutputMark() && pcPic->getPOC() > m_pocLastDisplay[decIdx] && 738 (numPicsNotYetDisplayed > numReorderPicsHighestTid || dpbFullness > maxDecPicBufferingHighestTid)) 616 739 #else 617 if ( pcPic->getOutputMark() && (numPicsNotYetDisplayed > pcPic->getNumReorderPics(tId) && pcPic->getPOC() > m_iPOCLastDisplay)) 740 if(pcPic->getOutputMark() && pcPic->getPOC() > m_iPOCLastDisplay && 741 (numPicsNotYetDisplayed > numReorderPicsHighestTid || dpbFullness > maxDecPicBufferingHighestTid)) 618 742 #endif 619 743 { 620 744 // write to file 621 745 numPicsNotYetDisplayed--; 746 if(pcPic->getSlice(0)->isReferenced() == false) 747 { 748 dpbFullness--; 749 } 622 750 #if H_MV 623 751 if ( m_pchReconFiles[decIdx] ) … … 631 759 assert( conf .getScaledFlag() ); 632 760 assert( defDisp.getScaledFlag() ); 761 #if ENC_DEC_TRACE 762 g_bJustDoIt = true; 763 writeToTraceFile( "OutputPic Poc" , pcPic->getPOC (), g_decTracePicOutput ); 764 writeToTraceFile( "OutputPic LayerId", pcPic->getLayerId(), g_decTracePicOutput ); 765 g_bJustDoIt = false; 766 #endif 633 767 m_tVideoIOYuvReconFile[decIdx]->write( pcPic->getPicYuvRec(), 634 768 #else … … 665 799 } 666 800 pcPic->setOutputMark(false); 801 #if H_MV_HLS_7_VPS_P0300_27 802 pcPic->setPicOutputFlag(false); 803 #endif 667 804 } 668 805 … … 715 852 assert( conf .getScaledFlag() ); 716 853 assert( defDisp.getScaledFlag() ); 854 #if ENC_DEC_TRACE 855 g_bJustDoIt = true; 856 writeToTraceFile( "OutputPic Poc" , pcPic->getPOC (), g_decTracePicOutput ); 857 writeToTraceFile( "OutputPic LayerId", pcPic->getLayerId(), g_decTracePicOutput ); 858 g_bJustDoIt = false; 859 #endif 717 860 m_tVideoIOYuvReconFile[decIdx]->write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(), 718 861 #else … … 802 945 assert( conf .getScaledFlag() ); 803 946 assert( defDisp.getScaledFlag() ); 947 #if ENC_DEC_TRACE 948 g_bJustDoIt = true; 949 writeToTraceFile( "OutputPic Poc" , pcPic->getPOC (), g_decTracePicOutput ); 950 writeToTraceFile( "OutputPic LayerId", pcPic->getLayerId(), g_decTracePicOutput ); 951 g_bJustDoIt = false; 952 #endif 804 953 m_tVideoIOYuvReconFile[decIdx]->write( pcPic->getPicYuvRec(), 805 954 #else … … 836 985 } 837 986 pcPic->setOutputMark(false); 987 #if H_MV_HLS_7_VPS_P0300_27 988 pcPic->setPicOutputFlag(false); 989 #endif 838 990 } 839 991 #if !H_MV … … 909 1061 m_tDecTop[ decIdx ]->setIvPicLists( &m_ivPicLists ); 910 1062 m_tDecTop[ decIdx ]->setLayerInitilizedFlags( m_layerInitilizedFlags ); 1063 #if H_MV_HLS_8_HRD_Q0102_08 1064 m_tDecTop[ decIdx ]->setTargetOptLayerSetIdx( m_targetOptLayerSetIdx ); 1065 #endif 911 1066 912 1067 #if H_3D … … 941 1096 }; 942 1097 return decIdx; 1098 943 1099 } 1100 1101 1102 #if H_MV_HLS_7_VPS_P0300_27 1103 Void TAppDecTop::xMarkForOutput( Bool allLayersDecoded, Int pocLastPic, Int layerIdLastPic ) 1104 { 1105 vector<Int> targetOptLayerIdList = m_vps->getTargetOptLayerIdList( m_targetOptLayerSetIdx ); 1106 1107 if (m_vps->getAltOutputLayerFlagVar( m_targetOptLayerSetIdx ) ) 1108 { 1109 assert( targetOptLayerIdList.size() == 1 ); 1110 Int targetLayerId = targetOptLayerIdList[0]; 1111 1112 TComPic* curPic = m_ivPicLists.getPic( layerIdLastPic, pocLastPic ); 1113 assert( curPic != NULL ); 1114 1115 if ( layerIdLastPic == targetLayerId ) 1116 { 1117 if ( curPic->getPicOutputFlag() ) 1118 { 1119 curPic->setOutputMark( true ); 1120 } 1121 else 1122 { 1123 xMarkAltOutPic( targetLayerId, pocLastPic ); 1124 } 1125 m_markedForOutput = true; 1126 } 1127 else if ( ( layerIdLastPic > targetLayerId || allLayersDecoded ) && !m_markedForOutput ) 1128 { 1129 xMarkAltOutPic( targetLayerId, pocLastPic ); 1130 } 1131 1132 if ( allLayersDecoded ) 1133 { 1134 m_markedForOutput = false; 1135 } 1136 } 1137 else 1138 { 1139 for( Int dI = 0; dI < m_numDecoders; dI++ ) 1140 { 1141 Int layerId = m_tDecTop[dI]->getLayerId(); 1142 TComPic* curPic = m_ivPicLists.getPic( layerId, pocLastPic ); 1143 if ( curPic != NULL ) 1144 { 1145 if ( curPic->getReconMark() ) 1146 { 1147 Bool isTargetOptLayer = std::find(targetOptLayerIdList.begin(), targetOptLayerIdList.end(), layerId) != targetOptLayerIdList.end(); 1148 curPic->setOutputMark( isTargetOptLayer ? curPic->getPicOutputFlag() : false ); 1149 } 1150 } 1151 } 1152 } 1153 } 1154 #endif 944 1155 #endif 945 1156 //! \} -
trunk/source/App/TAppDecoder/TAppDecTop.h
r872 r964 68 68 TComPicLists m_ivPicLists; ///< picture buffers of decoder instances 69 69 Bool m_layerInitilizedFlags[ MAX_NUM_LAYER_IDS ]; ///< for layerwise startup 70 70 #if H_MV_HLS_7_VPS_P0300_27 71 TComVPS* m_vps; ///< active VPS 72 #endif 71 73 #else 72 74 TDecTop m_cTDecTop; ///< decoder class … … 80 82 Int m_iPOCLastDisplay; ///< last POC in display order 81 83 #endif 84 #if H_MV_HLS_7_VPS_P0300_27 85 Bool m_markedForOutput; 86 #endif 87 88 82 89 #if H_3D 83 90 FILE* m_pScaleOffsetFile; … … 99 106 #if H_MV 100 107 Void xWriteOutput ( TComList<TComPic*>* pcListPic, Int layerId, Int tId ); ///< write YUV to file 108 109 #if H_MV_HLS_7_VPS_P0300_27 110 Void xMarkForOutput ( Bool allLayersDecoded, Int pocLastPic, Int layerIdLastPic ); 111 Void xMarkAltOutPic ( Int targetOutputLayer, Int pocLastPic ) 112 { 113 Int optLayerIdxInVps = m_vps->getLayerIdInNuh( targetOutputLayer ); 114 Int highestNuhLayerId = -1; 115 TComPic* picWithHighestNuhLayerId = NULL; 116 for (Int dIdx = 0; dIdx < m_numDecoders; dIdx++) 117 { 118 Int curLayerId = m_tDecTop[dIdx]->getLayerId(); 119 Int curLayerIdxInVps = m_vps->getLayerIdInNuh( curLayerId ); 120 if ( m_vps->getInDirectDependencyFlag(optLayerIdxInVps, curLayerIdxInVps ) ) 121 { 122 TComPic* curPic = m_ivPicLists.getPic( curLayerId, pocLastPic ); 123 if (curPic != NULL) 124 { 125 if (curPic->getReconMark() && curPic->getPicOutputFlag() ) 126 { 127 curPic->setOutputMark ( false ); 128 curPic->setPicOutputFlag( false ); 129 if ( curLayerId > highestNuhLayerId) 130 { 131 highestNuhLayerId = curLayerId ; 132 picWithHighestNuhLayerId = curPic; 133 } 134 } 135 } 136 } 137 } 138 if ( picWithHighestNuhLayerId != NULL ) 139 { 140 picWithHighestNuhLayerId->setPicOutputFlag(true); 141 picWithHighestNuhLayerId->setOutputMark (true); 142 } 143 } 144 #endif 145 101 146 Void xFlushOutput ( TComList<TComPic*>* pcListPic, Int layerId ); ///< flush all remaining decoded pictures to file 102 147 Int xGetDecoderIdx ( Int layerId, Bool createFlag = false );
Note: See TracChangeset for help on using the changeset viewer.