Changeset 1313 in 3DVCSoftware for trunk/source/App/TAppDecoder/TAppDecTop.cpp
- Timestamp:
- 13 Aug 2015, 17:38:13 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/App/TAppDecoder/TAppDecTop.cpp
r1196 r1313 2 2 * License, included below. This software may be subject to other third party 3 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-2015, ITU/ISO/IEC6 * Copyright (c) 2010-2015, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 45 45 #include "TLibDecoder/AnnexBread.h" 46 46 #include "TLibDecoder/NALread.h" 47 #if RExt__DECODER_DEBUG_BIT_STATISTICS 48 #include "TLibCommon/TComCodingStatistics.h" 49 #endif 47 50 48 51 //! \ingroup TAppDecoder … … 54 57 55 58 TAppDecTop::TAppDecTop() 56 #if ! H_MV59 #if !NH_MV 57 60 : m_iPOCLastDisplay(-MAX_INT) 58 61 #else … … 60 63 #endif 61 64 { 62 #if H_MV65 #if NH_MV 63 66 for (Int i = 0; i < MAX_NUM_LAYER_IDS; i++) 64 67 { … … 67 70 } 68 71 #endif 69 #if H_3D72 #if NH_3D 70 73 m_pScaleOffsetFile = 0; 71 74 #endif 72 75 73 #if H_MV76 #if NH_MV 74 77 m_markedForOutput = false; 75 78 #endif … … 83 86 Void TAppDecTop::destroy() 84 87 { 88 #if NH_MV 89 // destroy internal classes 90 xDestroyDecLib(); 91 #endif 92 85 93 if (m_pchBitstreamFile) 86 94 { … … 88 96 m_pchBitstreamFile = NULL; 89 97 } 90 #if H_MV98 #if NH_MV 91 99 for (Int decIdx = 0; decIdx < m_numDecoders; decIdx++) 92 100 { … … 103 111 m_pchReconFile = NULL; 104 112 } 105 #if H_3D113 #if NH_3D 106 114 if (m_pchScaleOffsetFile) 107 115 { … … 127 135 { 128 136 Int poc; 129 #if H_MV137 #if NH_MV 130 138 poc = -1; 131 139 #endif … … 138 146 exit(EXIT_FAILURE); 139 147 } 140 141 #if H_3D 148 #if NH_3D 142 149 if( m_pchScaleOffsetFile ) 143 150 { … … 146 153 } 147 154 #endif 155 148 156 InputByteStream bytestream(bitstreamFile); 157 158 if (!m_outputDecodedSEIMessagesFilename.empty() && m_outputDecodedSEIMessagesFilename!="-") 159 { 160 m_seiMessageFileStream.open(m_outputDecodedSEIMessagesFilename.c_str(), std::ios::out); 161 if (!m_seiMessageFileStream.is_open() || !m_seiMessageFileStream.good()) 162 { 163 fprintf(stderr, "\nUnable to open file `%s' for writing decoded SEI messages\n", m_outputDecodedSEIMessagesFilename.c_str()); 164 exit(EXIT_FAILURE); 165 } 166 } 149 167 150 168 // create & initialize internal classes 151 169 xCreateDecLib(); 152 170 xInitDecLib (); 153 #if ! H_MV171 #if !NH_MV 154 172 m_iPOCLastDisplay += m_iSkipFrame; // set the last displayed POC correctly for skip forward. 155 173 … … 169 187 Bool firstSlice = true; 170 188 #endif 171 Bool loopFiltered 189 Bool loopFiltered = false; 172 190 173 191 while (!!bitstreamFile) … … 177 195 * requires the TDecTop::decode() method to be called again with the same 178 196 * nal unit. */ 197 #if RExt__DECODER_DEBUG_BIT_STATISTICS 198 TComCodingStatistics::TComCodingStatisticsData backupStats(TComCodingStatistics::GetStatistics()); 199 streampos location = bitstreamFile.tellg() - streampos(bytestream.GetNumBufferedBytes()); 200 #else 179 201 streampos location = bitstreamFile.tellg(); 180 #if H_MV 202 #endif 203 #if NH_MV 181 204 #if ENC_DEC_TRACE 182 205 Int64 symCount = g_nSymbolCounter; … … 184 207 #endif 185 208 AnnexBStats stats = AnnexBStats(); 186 vector<uint8_t> nalUnit; 209 187 210 InputNALUnit nalu; 188 byteStreamNALUnit(bytestream, nal Unit, stats);211 byteStreamNALUnit(bytestream, nalu.getBitstream().getFifo(), stats); 189 212 190 213 // call actual decoding function 191 214 Bool bNewPicture = false; 192 #if H_MV215 #if NH_MV 193 216 Bool newSliceDiffPoc = false; 194 217 Bool newSliceDiffLayer = false; … … 196 219 Bool allLayersDecoded = false; 197 220 #endif 198 if (nal Unit.empty())221 if (nalu.getBitstream().getFifo().empty()) 199 222 { 200 223 /* this can happen if the following occur: … … 207 230 else 208 231 { 209 read(nalu , nalUnit);210 #if H_MV232 read(nalu); 233 #if NH_MV 211 234 if( (m_iMaxTemporalLayer >= 0 && nalu.m_temporalId > m_iMaxTemporalLayer) 212 235 || !isNaluWithinTargetDecLayerIdSet(&nalu) 213 || nalu.m_layerId > MAX_NUM_LAYER_IDS-1 214 || (nalu.m_nalUnitType == NAL_UNIT_VPS && nalu.m_layerId > 0) 215 || (nalu.m_nalUnitType == NAL_UNIT_EOB && nalu.m_layerId > 0) 216 || (nalu.m_nalUnitType == NAL_UNIT_EOS && nalu.m_layerId > 0) 236 || nalu.m_nuhLayerId > MAX_NUM_LAYER_IDS-1 237 || (nalu.m_nalUnitType == NAL_UNIT_VPS && nalu.m_nuhLayerId > 0) 238 || (nalu.m_nalUnitType == NAL_UNIT_EOB && nalu.m_nuhLayerId > 0) 217 239 ) 218 240 { … … 225 247 else 226 248 { 227 Int decIdx = xGetDecoderIdx( nalu.m_ layerId , true );228 newSliceDiffLayer = nalu.isSlice() && ( nalu.m_ layerId != layerIdCurrPic ) && !firstSlice;249 Int decIdx = xGetDecoderIdx( nalu.m_nuhLayerId , true ); 250 newSliceDiffLayer = nalu.isSlice() && ( nalu.m_nuhLayerId != layerIdCurrPic ) && !firstSlice; 229 251 newSliceDiffPoc = m_tDecTop[decIdx]->decode(nalu, m_iSkipFrame, m_pocLastDisplay[decIdx], newSliceDiffLayer, sliceSkippedFlag ); 230 252 // decode function only returns true when all of the following conditions are true … … 233 255 // - nalu.isSlice() == true 234 256 235 if ( nalu.m_nalUnitType == NAL_UNIT_VPS ) 236 { 237 m_vps = m_tDecTop[decIdx]->getPrefetchedVPS(); 257 bNewPicture = ( newSliceDiffLayer || newSliceDiffPoc ) && !sliceSkippedFlag; 258 if ( nalu.isSlice() && firstSlice && !sliceSkippedFlag ) 259 { 260 layerIdCurrPic = nalu.m_nuhLayerId; 261 pocCurrPic = m_tDecTop[decIdx]->getCurrPoc(); 262 decIdxCurrPic = decIdx; 263 firstSlice = false; 264 265 /// Use VPS activated by the first slice to determine OLS 266 m_vps = m_tDecTop[decIdx]->getActiveVPS( ); 238 267 if ( m_targetDecLayerIdSetFileEmpty ) 239 { 240 TComVPS* vps = m_vps; 268 { 241 269 if ( m_targetOptLayerSetIdx == -1 ) 242 270 { 243 // Not normative! Corresponds to specification by "External Means". (Should be set equal to 0, when no external means available. ) 244 m_targetOptLayerSetIdx = vps->getVpsNumLayerSetsMinus1(); 271 m_targetOptLayerSetIdx = m_tDecTop[decIdx]->getTargetOlsIdx(); 245 272 } 246 247 for (Int dI = 0; dI < m_numDecoders; dI++ ) 273 else 248 274 { 249 m_tDecTop[decIdx]->setTargetOptLayerSetIdx( m_targetOptLayerSetIdx ); 250 #if H_3D 251 m_tDecTop[decIdx]->setProfileIdc( ); 252 #endif 275 assert( m_tDecTop[decIdx]->getTargetOlsIdx() == m_targetOptLayerSetIdx ); 253 276 } 254 277 255 if ( m_targetOptLayerSetIdx < 0 || m_targetOptLayerSetIdx >= vps->getNumOutputLayerSets() )278 if ( m_targetOptLayerSetIdx < 0 || m_targetOptLayerSetIdx >= m_vps->getNumOutputLayerSets() ) 256 279 { 257 fprintf(stderr, "\ntarget output layer set index must be in the range of 0 to %d, inclusive \n", vps->getNumOutputLayerSets() - 1 );280 fprintf(stderr, "\ntarget output layer set index must be in the range of 0 to %d, inclusive \n", m_vps->getNumOutputLayerSets() - 1 ); 258 281 exit(EXIT_FAILURE); 259 282 } 260 m_targetDecLayerIdSet = vps->getTargetDecLayerIdList( m_targetOptLayerSetIdx );283 m_targetDecLayerIdSet = m_vps->getTargetDecLayerIdList( m_targetOptLayerSetIdx ); 261 284 } 285 262 286 if (m_outputVpsInfo ) 263 287 { … … 267 291 m_vps->printPTL(); 268 292 } 269 } 270 #if H_3D 271 if (nalu.m_nalUnitType == NAL_UNIT_VPS ) 272 { 273 m_cCamParsCollector.init( m_pScaleOffsetFile, m_tDecTop[decIdx]->getPrefetchedVPS() ); 274 } 275 #endif 276 bNewPicture = ( newSliceDiffLayer || newSliceDiffPoc ) && !sliceSkippedFlag; 277 if ( nalu.isSlice() && firstSlice && !sliceSkippedFlag ) 278 { 279 layerIdCurrPic = nalu.m_layerId; 280 pocCurrPic = m_tDecTop[decIdx]->getCurrPoc(); 281 decIdxCurrPic = decIdx; 282 firstSlice = false; 283 } 284 285 if ( bNewPicture || !bitstreamFile ) 293 } 294 295 if ( bNewPicture || !bitstreamFile || nalu.m_nalUnitType == NAL_UNIT_EOS ) 286 296 { 287 297 layerIdLastPic = layerIdCurrPic; 288 layerIdCurrPic = nalu.m_ layerId;298 layerIdCurrPic = nalu.m_nuhLayerId; 289 299 pocLastPic = pocCurrPic; 290 300 pocCurrPic = m_tDecTop[decIdx]->getCurrPoc(); 291 301 decIdxLastPic = decIdxCurrPic; 292 302 decIdxCurrPic = decIdx; 293 allLayersDecoded = ( pocCurrPic != pocLastPic ) ;303 allLayersDecoded = ( pocCurrPic != pocLastPic ) && ( nalu.m_nalUnitType != NAL_UNIT_EOS ); 294 304 } 295 305 #else … … 309 319 * [1] except for the first NAL unit in the file 310 320 * (but bNewPicture doesn't happen then) */ 321 #if RExt__DECODER_DEBUG_BIT_STATISTICS 322 bitstreamFile.seekg(location); 323 bytestream.reset(); 324 TComCodingStatistics::SetStatistics(backupStats); 325 #else 311 326 bitstreamFile.seekg(location-streamoff(3)); 312 327 bytestream.reset(); 328 #endif 313 329 #if H_MV_ENC_DEC_TRAC 314 330 #if ENC_DEC_TRACE … … 327 343 } 328 344 } 329 if (bNewPicture || !bitstreamFile || nalu.m_nalUnitType == NAL_UNIT_EOS ) 345 346 if ( (bNewPicture || !bitstreamFile || nalu.m_nalUnitType == NAL_UNIT_EOS) && 347 #if NH_MV 348 !m_tDecTop[decIdxLastPic]->getFirstSliceInSequence () ) 349 #else 350 !m_cTDecTop.getFirstSliceInSequence () ) 351 #endif 352 330 353 { 331 354 if (!loopFiltered || bitstreamFile) 332 355 { 333 #if H_MV356 #if NH_MV 334 357 assert( decIdxLastPic != -1 ); 335 358 m_tDecTop[decIdxLastPic]->endPicDecoding(poc, pcListPic, m_targetDecLayerIdSet ); … … 340 363 } 341 364 loopFiltered = (nalu.m_nalUnitType == NAL_UNIT_EOS); 342 } 343 #if !FIX_WRITING_OUTPUT 344 #if SETTING_NO_OUT_PIC_PRIOR 345 if (bNewPicture && m_cTDecTop.getIsNoOutputPriorPics()) 346 { 347 m_cTDecTop.checkNoOutputPriorPics( pcListPic ); 348 } 349 #endif 350 #endif 351 #if H_3D 365 if (nalu.m_nalUnitType == NAL_UNIT_EOS) 366 { 367 #if NH_MV 368 m_tDecTop[decIdxLastPic]->setFirstSliceInSequence(true); 369 #else 370 m_cTDecTop.setFirstSliceInSequence(true); 371 #endif 372 } 373 } 374 else if ( (bNewPicture || !bitstreamFile || nalu.m_nalUnitType == NAL_UNIT_EOS ) && 375 #if NH_MV 376 m_tDecTop[decIdxLastPic]->getFirstSliceInSequence () ) 377 #else 378 m_cTDecTop.getFirstSliceInSequence () ) 379 #endif 380 { 381 #if NH_MV 382 m_tDecTop[decIdxLastPic]->setFirstSliceInPicture (true); 383 #else 384 m_cTDecTop.setFirstSliceInPicture (true); 385 #endif 386 } 387 388 #if NH_3D 352 389 if ( allLayersDecoded || !bitstreamFile ) 353 390 { … … 363 400 if( pcListPic ) 364 401 { 365 #if H_MV402 #if NH_MV 366 403 if ( m_pchReconFiles[decIdxLastPic] && !m_reconOpen[decIdxLastPic] ) 367 404 #else 368 if ( m_pchReconFile && !openedReconFile ) 369 #endif 370 { 371 if (!m_outputBitDepthY) { m_outputBitDepthY = g_bitDepthY; } 372 if (!m_outputBitDepthC) { m_outputBitDepthC = g_bitDepthC; } 373 374 #if H_MV 375 m_tVideoIOYuvReconFile[decIdxLastPic]->open( m_pchReconFiles[decIdxLastPic], true, m_outputBitDepthY, m_outputBitDepthC, g_bitDepthY, g_bitDepthC ); // write mode 405 if ( m_pchReconFile && !openedReconFile ) 406 #endif 407 { 408 const BitDepths &bitDepths=pcListPic->front()->getPicSym()->getSPS().getBitDepths(); // use bit depths of first reconstructed picture. 409 for (UInt channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++) 410 { 411 if (m_outputBitDepth[channelType] == 0) 412 { 413 m_outputBitDepth[channelType] = bitDepths.recon[channelType]; 414 } 415 } 416 #if NH_MV 417 m_tVideoIOYuvReconFile[decIdxLastPic]->open( m_pchReconFiles[decIdxLastPic], true, m_outputBitDepth, m_outputBitDepth, bitDepths.recon ); // write mode 376 418 m_reconOpen[decIdxLastPic] = true; 377 419 } 378 #if FIX_WRITING_OUTPUT379 420 // write reconstruction to file 380 421 if( bNewPicture ) … … 388 429 xWriteOutput( pcListPic, decIdxLastPic, nalu.m_temporalId ); 389 430 } 390 #if SETTING_NO_OUT_PIC_PRIOR391 431 if ( (bNewPicture || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_CRA) && m_tDecTop[decIdxLastPic]->getNoOutputPriorPicsFlag() ) 392 432 { … … 394 434 m_tDecTop[decIdxLastPic]->setNoOutputPriorPicsFlag (false); 395 435 } 396 #endif 397 #endif 436 398 437 if ( bNewPicture && newSliceDiffPoc && 399 438 #else 400 m_cTVideoIOYuvReconFile.open( m_pchReconFile, true, m_outputBitDepthY, m_outputBitDepthC, g_bitDepthY, g_bitDepthC ); // write mode 401 openedReconFile = true; 402 } 403 #if FIX_WRITING_OUTPUT 439 m_cTVideoIOYuvReconFile.open( m_pchReconFile, true, m_outputBitDepth, m_outputBitDepth, bitDepths.recon ); // write mode 440 openedReconFile = true; 441 } 404 442 // write reconstruction to file 405 443 if( bNewPicture ) … … 407 445 xWriteOutput( pcListPic, nalu.m_temporalId ); 408 446 } 409 #if SETTING_NO_OUT_PIC_PRIOR410 447 if ( (bNewPicture || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_CRA) && m_cTDecTop.getNoOutputPriorPicsFlag() ) 411 448 { … … 413 450 m_cTDecTop.setNoOutputPriorPicsFlag (false); 414 451 } 415 #endif 416 #endif 417 if ( bNewPicture && 452 453 if ( bNewPicture && 418 454 #endif 419 455 ( nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL … … 423 459 || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_LP ) ) 424 460 { 425 #if H_MV461 #if NH_MV 426 462 xFlushOutput( pcListPic, decIdxLastPic ); 427 463 #else … … 431 467 if (nalu.m_nalUnitType == NAL_UNIT_EOS) 432 468 { 433 #if H_MV 434 #if FIX_OUTPUT_EOS 435 xWriteOutput( pcListPic, decIdxLastPic, nalu.m_temporalId ); 436 #else 437 xFlushOutput( pcListPic, decIdxLastPic ); 438 #endif 439 #else 440 #if FIX_OUTPUT_EOS 469 #if NH_MV 470 xWriteOutput( pcListPic, decIdxCurrPic, nalu.m_temporalId ); 471 #else 441 472 xWriteOutput( pcListPic, nalu.m_temporalId ); 442 #else 443 xFlushOutput( pcListPic ); 444 #endif 445 446 #endif 447 } 448 // write reconstruction to file -- for additional bumping as defined in C.5.2.3 449 #if H_MV 473 #endif 474 #if NH_MV 475 m_tDecTop[decIdxCurrPic]->setFirstSliceInPicture (false); 476 #else 477 m_cTDecTop.setFirstSliceInPicture (false); 478 #endif 479 } 480 // write reconstruction to file -- for additional bumping as defined in C.5.2.3 481 #if NH_MV 450 482 // Above comment seems to be wrong 451 483 #endif 452 #if FIX_WRITING_OUTPUT453 484 if(!bNewPicture && nalu.m_nalUnitType >= NAL_UNIT_CODED_SLICE_TRAIL_N && nalu.m_nalUnitType <= NAL_UNIT_RESERVED_VCL31) 454 #else 455 if(bNewPicture) 456 #endif 457 { 458 #if H_MV 485 { 486 #if NH_MV 459 487 // Bumping after reference picture set has been applied (here after first vcl nalu. 460 488 #if ENC_DEC_TRACE … … 471 499 } 472 500 } 473 #if H_MV474 #if H_3D501 #if NH_MV 502 #if NH_3D 475 503 if( m_cCamParsCollector.isInitialized() ) 476 504 { … … 486 514 // delete buffers 487 515 m_cTDecTop.deletePicBuffer(); 488 #endif489 490 516 // destroy internal classes 491 517 xDestroyDecLib(); 518 #endif 492 519 } 493 520 … … 498 525 Void TAppDecTop::xCreateDecLib() 499 526 { 500 #if H_MV527 #if NH_MV 501 528 // initialize global variables 502 529 initROM(); 503 #if H_3D_DIM_DMM530 #if NH_3D_DMM 504 531 initWedgeLists(); 505 532 #endif … … 512 539 Void TAppDecTop::xDestroyDecLib() 513 540 { 514 #if H_MV541 #if NH_MV 515 542 // destroy ROM 516 543 destroyROM(); … … 538 565 m_cTVideoIOYuvReconFile. close(); 539 566 } 540 567 541 568 // destroy decoder class 542 569 m_cTDecTop.destroy(); 543 570 #endif 544 #if H_3D571 #if NH_3D 545 572 m_cCamParsCollector.uninit(); 546 573 if( m_pScaleOffsetFile ) … … 553 580 Void TAppDecTop::xInitDecLib() 554 581 { 555 #if !H_MV 582 583 #if NH_3D 584 m_cCamParsCollector.setCodeScaleOffsetFile( m_pScaleOffsetFile ); 585 #endif 586 #if !NH_MV 556 587 // initialize decoder class 557 588 m_cTDecTop.init(); 558 589 m_cTDecTop.setDecodedPictureHashSEIEnabled(m_decodedPictureHashSEIEnabled); 590 #if O0043_BEST_EFFORT_DECODING 591 m_cTDecTop.setForceDecodeBitDepth(m_forceDecodeBitDepth); 592 #endif 593 if (!m_outputDecodedSEIMessagesFilename.empty()) 594 { 595 std::ostream &os=m_seiMessageFileStream.is_open() ? m_seiMessageFileStream : std::cout; 596 m_cTDecTop.setDecodedSEIMessageOutputStream(&os); 597 } 559 598 #endif 560 599 } 561 600 562 601 /** \param pcListPic list of pictures to be written to file 563 \ todo DYN_REF_FREE should be revised602 \param tId temporal sub-layer ID 564 603 */ 565 #if H_MV604 #if NH_MV 566 605 Void TAppDecTop::xWriteOutput( TComList<TComPic*>* pcListPic, Int decIdx, Int tId ) 567 606 #else … … 569 608 #endif 570 609 { 571 572 610 if (pcListPic->empty()) 573 611 { … … 578 616 Int numPicsNotYetDisplayed = 0; 579 617 Int dpbFullness = 0; 580 #if H_MV 581 TComSPS* activeSPS = m_tDecTop[ decIdx ]->getActiveSPS(); 582 #else 583 TComSPS* activeSPS = m_cTDecTop.getActiveSPS(); 584 #endif 618 const TComSPS* activeSPS = &(pcListPic->front()->getPicSym()->getSPS()); 619 585 620 UInt numReorderPicsHighestTid; 586 621 UInt maxDecPicBufferingHighestTid; … … 597 632 maxDecPicBufferingHighestTid = activeSPS->getMaxDecPicBuffering(m_iMaxTemporalLayer); 598 633 } 599 634 600 635 while (iterPic != pcListPic->end()) 601 636 { 602 637 TComPic* pcPic = *(iterPic); 603 #if H_MV638 #if NH_MV 604 639 if(pcPic->getOutputMark() && pcPic->getPOC() > m_pocLastDisplay[decIdx]) 605 640 #else … … 607 642 #endif 608 643 { 609 numPicsNotYetDisplayed++;644 numPicsNotYetDisplayed++; 610 645 dpbFullness++; 611 646 } … … 616 651 iterPic++; 617 652 } 618 iterPic = pcListPic->begin(); 653 654 iterPic = pcListPic->begin(); 655 619 656 if (numPicsNotYetDisplayed>2) 620 657 { 621 658 iterPic++; 622 659 } 623 660 624 661 TComPic* pcPic = *(iterPic); 625 662 if (numPicsNotYetDisplayed>2 && pcPic->isField()) //Field Decoding … … 633 670 iterPic++; 634 671 TComPic* pcPicBottom = *(iterPic); 635 636 #if H_MV 637 if ( pcPicTop->getOutputMark() && (numPicsNotYetDisplayed > pcPicTop->getNumReorderPics(tId) && !(pcPicTop->getPOC()%2) && pcPicBottom->getPOC() == pcPicTop->getPOC()+1) 638 && pcPicBottom->getOutputMark() && (numPicsNotYetDisplayed > pcPicBottom->getNumReorderPics(tId) && (pcPicTop->getPOC() == m_pocLastDisplay[decIdx]+1 || m_pocLastDisplay[decIdx]<0))) 672 673 #if NH_MV 674 if ( pcPicTop->getOutputMark() && pcPicBottom->getOutputMark() && 675 (numPicsNotYetDisplayed > numReorderPicsHighestTid || dpbFullness > maxDecPicBufferingHighestTid) && 676 (!(pcPicTop->getPOC()%2) && pcPicBottom->getPOC() == pcPicTop->getPOC()+1) && 677 (pcPicTop->getPOC() == m_pocLastDisplay[decIdx]+1 || m_pocLastDisplay[decIdx] < 0)) 639 678 #else 640 679 if ( pcPicTop->getOutputMark() && pcPicBottom->getOutputMark() && … … 646 685 // write to file 647 686 numPicsNotYetDisplayed = numPicsNotYetDisplayed-2; 648 #if H_MV687 #if NH_MV 649 688 if ( m_pchReconFiles[decIdx] ) 650 689 #else … … 653 692 { 654 693 const Window &conf = pcPicTop->getConformanceWindow(); 655 const Window &defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window(); 656 694 const Window defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window(); 657 695 const Bool isTff = pcPicTop->isTopField(); 658 #if H_MV 696 697 Bool display = true; 698 if( m_decodedNoDisplaySEIEnabled ) 699 { 700 SEIMessages noDisplay = getSeisByType(pcPic->getSEIs(), SEI::NO_DISPLAY ); 701 const SEINoDisplay *nd = ( noDisplay.size() > 0 ) ? (SEINoDisplay*) *(noDisplay.begin()) : NULL; 702 if( (nd != NULL) && nd->m_noDisplay ) 703 { 704 display = false; 705 } 706 } 707 708 if (display) 709 { 710 #if NH_MV 659 711 assert( conf .getScaledFlag() ); 660 712 assert( defDisp.getScaledFlag() ); … … 667 719 m_tVideoIOYuvReconFile[decIdx]->write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(), 668 720 #else 669 m_cTVideoIOYuvReconFile.write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(), 670 #endif 671 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 672 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 673 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 674 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), isTff ); 675 } 676 721 m_cTVideoIOYuvReconFile.write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(), 722 #endif 723 m_outputColourSpaceConvert, 724 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 725 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 726 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 727 #if NH_3D 728 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), m_depth420OutputFlag && pcPicTop->getIsDepth() ? CHROMA_420 : NUM_CHROMA_FORMAT, isTff ); 729 #else 730 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), NUM_CHROMA_FORMAT, isTff ); 731 #endif 732 } 733 } 734 677 735 // update POC of display order 678 #if H_MV736 #if NH_MV 679 737 m_pocLastDisplay[decIdx] = pcPic->getPOC(); 680 738 #else 681 739 m_iPOCLastDisplay = pcPicBottom->getPOC(); 682 740 #endif 683 741 684 742 // erase non-referenced picture in the reference picture list after display 685 743 if ( !pcPicTop->getSlice(0)->isReferenced() && pcPicTop->getReconMark() == true ) 686 744 { 687 #if !DYN_REF_FREE688 745 pcPicTop->setReconMark(false); 689 746 690 747 // mark it should be extended later 691 748 pcPicTop->getPicYuvRec()->setBorderExtension( false ); 692 693 #else694 pcPicTop->destroy();695 pcListPic->erase( iterPic );696 iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!697 continue;698 #endif699 749 } 700 750 if ( !pcPicBottom->getSlice(0)->isReferenced() && pcPicBottom->getReconMark() == true ) 701 751 { 702 #if !DYN_REF_FREE703 752 pcPicBottom->setReconMark(false); 704 753 705 754 // mark it should be extended later 706 755 pcPicBottom->getPicYuvRec()->setBorderExtension( false ); 707 708 #else709 pcPicBottom->destroy();710 pcListPic->erase( iterPic );711 iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!712 continue;713 #endif714 756 } 715 757 pcPicTop->setOutputMark(false); … … 721 763 { 722 764 iterPic = pcListPic->begin(); 765 723 766 while (iterPic != pcListPic->end()) 724 767 { 725 768 pcPic = *(iterPic); 726 769 727 #if H_MV770 #if NH_MV 728 771 if(pcPic->getOutputMark() && pcPic->getPOC() > m_pocLastDisplay[decIdx] && 729 772 (numPicsNotYetDisplayed > numReorderPicsHighestTid || dpbFullness > maxDecPicBufferingHighestTid)) … … 734 777 { 735 778 // write to file 736 numPicsNotYetDisplayed--;779 numPicsNotYetDisplayed--; 737 780 if(pcPic->getSlice(0)->isReferenced() == false) 738 781 { 739 782 dpbFullness--; 740 783 } 741 #if H_MV784 #if NH_MV 742 785 if ( m_pchReconFiles[decIdx] ) 743 786 #else … … 745 788 #endif 746 789 { 747 const Window &conf = pcPic->getConformanceWindow();748 const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();749 #if H_MV790 const Window &conf = pcPic->getConformanceWindow(); 791 const Window defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window(); 792 #if NH_MV 750 793 assert( conf .getScaledFlag() ); 751 794 assert( defDisp.getScaledFlag() ); … … 760 803 m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(), 761 804 #endif 762 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 763 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 764 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 765 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() ); 766 } 767 805 m_outputColourSpaceConvert, 806 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 807 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 808 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 809 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), 810 #if NH_3D 811 m_depth420OutputFlag && pcPic->getIsDepth() ? CHROMA_420 : NUM_CHROMA_FORMAT, 812 #else 813 NUM_CHROMA_FORMAT, 814 #endif 815 m_bClipOutputVideoToRec709Range ); 816 } 817 768 818 // update POC of display order 769 #if H_MV819 #if NH_MV 770 820 m_pocLastDisplay[decIdx] = pcPic->getPOC(); 771 821 #else 772 822 m_iPOCLastDisplay = pcPic->getPOC(); 773 823 #endif 774 824 775 825 // erase non-referenced picture in the reference picture list after display 776 826 if ( !pcPic->getSlice(0)->isReferenced() && pcPic->getReconMark() == true ) 777 827 { 778 #if !DYN_REF_FREE779 828 pcPic->setReconMark(false); 780 829 781 830 // mark it should be extended later 782 831 pcPic->getPicYuvRec()->setBorderExtension( false ); 783 784 #else785 pcPic->destroy();786 pcListPic->erase( iterPic );787 iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!788 continue;789 #endif790 832 } 791 833 pcPic->setOutputMark(false); 792 #if H_MV834 #if NH_MV 793 835 pcPic->setPicOutputFlag(false); 794 836 #endif 795 837 } 796 838 797 839 iterPic++; 798 840 } 799 841 } 800 842 } 843 801 844 /** \param pcListPic list of pictures to be written to file 802 \todo DYN_REF_FREE should be revised803 845 */ 804 #if H_MV846 #if NH_MV 805 847 Void TAppDecTop::xFlushOutput( TComList<TComPic*>* pcListPic, Int decIdx ) 806 848 #else … … 813 855 } 814 856 TComList<TComPic*>::iterator iterPic = pcListPic->begin(); 815 857 816 858 iterPic = pcListPic->begin(); 817 859 TComPic* pcPic = *(iterPic); 818 860 819 861 if (pcPic->isField()) //Field Decoding 820 862 { … … 827 869 iterPic++; 828 870 pcPicBottom = *(iterPic); 829 871 830 872 if ( pcPicTop->getOutputMark() && pcPicBottom->getOutputMark() && !(pcPicTop->getPOC()%2) && (pcPicBottom->getPOC() == pcPicTop->getPOC()+1) ) 831 873 { 832 874 // write to file 833 #if H_MV875 #if NH_MV 834 876 if ( m_pchReconFiles[decIdx] ) 835 877 #else … … 838 880 { 839 881 const Window &conf = pcPicTop->getConformanceWindow(); 840 const Window &defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window();882 const Window defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window(); 841 883 const Bool isTff = pcPicTop->isTopField(); 842 #if H_MV884 #if NH_MV 843 885 assert( conf .getScaledFlag() ); 844 886 assert( defDisp.getScaledFlag() ); … … 853 895 m_cTVideoIOYuvReconFile.write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(), 854 896 #endif 855 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 856 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 857 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 858 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), isTff ); 859 } 860 897 m_outputColourSpaceConvert, 898 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 899 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 900 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 901 #if NH_3D 902 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), m_depth420OutputFlag && pcPicTop->getIsDepth() ? CHROMA_420 : NUM_CHROMA_FORMAT, isTff ); 903 #else 904 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), NUM_CHROMA_FORMAT, isTff ); 905 #endif 906 } 907 861 908 // update POC of display order 862 #if H_MV909 #if NH_MV 863 910 m_pocLastDisplay[decIdx] = pcPic->getPOC(); 864 911 #else 865 m_iPOCLastDisplay = pcPicBottom->getPOC();912 m_iPOCLastDisplay = pcPicBottom->getPOC(); 866 913 #endif 867 914 // erase non-referenced picture in the reference picture list after display 868 915 if ( !pcPicTop->getSlice(0)->isReferenced() && pcPicTop->getReconMark() == true ) 869 916 { 870 #if !DYN_REF_FREE871 917 pcPicTop->setReconMark(false); 872 918 873 919 // mark it should be extended later 874 920 pcPicTop->getPicYuvRec()->setBorderExtension( false ); 875 876 #else877 pcPicTop->destroy();878 pcListPic->erase( iterPic );879 iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!880 continue;881 #endif882 921 } 883 922 if ( !pcPicBottom->getSlice(0)->isReferenced() && pcPicBottom->getReconMark() == true ) 884 923 { 885 #if !DYN_REF_FREE886 924 pcPicBottom->setReconMark(false); 887 925 888 926 // mark it should be extended later 889 927 pcPicBottom->getPicYuvRec()->setBorderExtension( false ); 890 891 #else892 pcPicBottom->destroy();893 pcListPic->erase( iterPic );894 iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!895 continue;896 #endif897 928 } 898 929 pcPicTop->setOutputMark(false); 899 930 pcPicBottom->setOutputMark(false); 900 901 #if !DYN_REF_FREE 931 902 932 if(pcPicTop) 903 933 { … … 906 936 pcPicTop = NULL; 907 937 } 908 #endif909 938 } 910 939 } … … 921 950 { 922 951 pcPic = *(iterPic); 923 952 924 953 if ( pcPic->getOutputMark() ) 925 954 { 926 955 // write to file 927 #if H_MV956 #if NH_MV 928 957 if ( m_pchReconFiles[decIdx] ) 929 958 #else … … 931 960 #endif 932 961 { 933 const Window &conf = pcPic->getConformanceWindow();934 const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();935 #if H_MV962 const Window &conf = pcPic->getConformanceWindow(); 963 const Window defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window(); 964 #if NH_MV 936 965 assert( conf .getScaledFlag() ); 937 966 assert( defDisp.getScaledFlag() ); … … 946 975 m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(), 947 976 #endif 948 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 949 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 950 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 951 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() ); 952 } 953 977 m_outputColourSpaceConvert, 978 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 979 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 980 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 981 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), 982 #if NH_3D 983 m_depth420OutputFlag && pcPic->getIsDepth() ? CHROMA_420 : NUM_CHROMA_FORMAT 984 #else 985 NUM_CHROMA_FORMAT 986 #endif 987 , m_bClipOutputVideoToRec709Range); 988 } 989 954 990 // update POC of display order 955 #if H_MV991 #if NH_MV 956 992 m_pocLastDisplay[decIdx] = pcPic->getPOC(); 957 993 #else 958 994 m_iPOCLastDisplay = pcPic->getPOC(); 959 995 #endif 960 996 961 997 // erase non-referenced picture in the reference picture list after display 962 998 if ( !pcPic->getSlice(0)->isReferenced() && pcPic->getReconMark() == true ) 963 999 { 964 #if !DYN_REF_FREE965 1000 pcPic->setReconMark(false); 966 1001 967 1002 // mark it should be extended later 968 1003 pcPic->getPicYuvRec()->setBorderExtension( false ); 969 970 #else971 pcPic->destroy();972 pcListPic->erase( iterPic );973 iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!974 continue;975 #endif976 1004 } 977 1005 pcPic->setOutputMark(false); 978 #if H_MV1006 #if NH_MV 979 1007 pcPic->setPicOutputFlag(false); 980 1008 #endif 981 1009 } 982 #if !H_MV 983 #if !DYN_REF_FREE 984 if(pcPic) 1010 #if !NH_MV 1011 if(pcPic != NULL) 985 1012 { 986 1013 pcPic->destroy(); … … 988 1015 pcPic = NULL; 989 1016 } 990 #endif991 1017 #endif 992 1018 iterPic++; 993 1019 } 994 1020 } 995 #if H_MV1021 #if NH_MV 996 1022 m_pocLastDisplay[decIdx] = -MAX_INT; 997 1023 #else … … 1011 1037 for (std::vector<Int>::iterator it = m_targetDecLayerIdSet.begin(); it != m_targetDecLayerIdSet.end(); it++) 1012 1038 { 1013 #if H_MV1014 if ( nalu->m_ layerId == (*it) )1015 #else 1016 if ( nalu->m_ reservedZero6Bits== (*it) )1039 #if NH_MV 1040 if ( nalu->m_nuhLayerId == (*it) ) 1041 #else 1042 if ( nalu->m_nuhLayerId == (*it) ) 1017 1043 #endif 1018 1044 { … … 1023 1049 } 1024 1050 1025 #if H_MV1051 #if NH_MV 1026 1052 Int TAppDecTop::xGetDecoderIdx( Int layerId, Bool createFlag /*= false */ ) 1027 1053 { … … 1052 1078 m_tDecTop[ decIdx ]->setIvPicLists( &m_ivPicLists ); 1053 1079 m_tDecTop[ decIdx ]->setLayerInitilizedFlags( m_layerInitilizedFlags ); 1054 m_tDecTop[ decIdx ]->setTargetOptLayerSetIdx( m_targetOptLayerSetIdx ); 1055 #if H_3D 1056 m_tDecTop[ decIdx ]->setProfileIdc ( ); 1057 #endif 1058 1059 #if H_3D 1080 m_tDecTop[ decIdx ]->setTargetOlsIdx( m_targetOptLayerSetIdx ); 1081 #if O0043_BEST_EFFORT_DECODING 1082 m_cTDecTop[ decIdx ]->setForceDecodeBitDepth(m_forceDecodeBitDepth); 1083 #endif 1084 if (!m_outputDecodedSEIMessagesFilename.empty()) 1085 { 1086 std::ostream &os=m_seiMessageFileStream.is_open() ? m_seiMessageFileStream : std::cout; 1087 m_tDecTop[ decIdx ]->setDecodedSEIMessageOutputStream(&os); 1088 } 1089 #if NH_3D 1060 1090 m_tDecTop[ decIdx ]->setCamParsCollector( &m_cCamParsCollector ); 1061 1091 #endif
Note: See TracChangeset for help on using the changeset viewer.