Changeset 964 in 3DVCSoftware for trunk/source/Lib/TLibEncoder/TEncGOP.cpp
- Timestamp:
- 5 Jul 2014, 05:16:45 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/Lib/TLibEncoder/TEncGOP.cpp
r884 r964 75 75 m_iNumPicCoded = 0; //Niko 76 76 m_bFirst = true; 77 #if ALLOW_RECOVERY_POINT_AS_RAP 78 m_iLastRecoveryPicPOC = 0; 79 #endif 77 80 78 81 m_pcCfg = NULL; … … 167 170 SEIActiveParameterSets *seiActiveParameterSets = new SEIActiveParameterSets(); 168 171 seiActiveParameterSets->activeVPSId = m_pcCfg->getVPS()->getVPSId(); 169 seiActiveParameterSets->m_ fullRandomAccessFlag = false;170 seiActiveParameterSets->m_noParam SetUpdateFlag = false;172 seiActiveParameterSets->m_selfContainedCvsFlag = false; 173 seiActiveParameterSets->m_noParameterSetUpdateFlag = false; 171 174 seiActiveParameterSets->numSpsIdsMinus1 = 0; 172 seiActiveParameterSets->activeSeqParam SetId.resize(seiActiveParameterSets->numSpsIdsMinus1 + 1);173 seiActiveParameterSets->activeSeqParam SetId[0] = sps->getSPSId();175 seiActiveParameterSets->activeSeqParameterSetId.resize(seiActiveParameterSets->numSpsIdsMinus1 + 1); 176 seiActiveParameterSets->activeSeqParameterSetId[0] = sps->getSPSId(); 174 177 return seiActiveParameterSets; 175 178 } … … 274 277 seiToneMappingInfo->m_cameraIsoSpeedValue = m_pcCfg->getTMISEICameraIsoSpeedValue(); 275 278 assert( seiToneMappingInfo->m_cameraIsoSpeedValue !=0 ); 279 seiToneMappingInfo->m_exposureIndexIdc = m_pcCfg->getTMISEIExposurIndexIdc(); 280 seiToneMappingInfo->m_exposureIndexValue = m_pcCfg->getTMISEIExposurIndexValue(); 281 assert( seiToneMappingInfo->m_exposureIndexValue !=0 ); 276 282 seiToneMappingInfo->m_exposureCompensationValueSignFlag = m_pcCfg->getTMISEIExposureCompensationValueSignFlag(); 277 283 seiToneMappingInfo->m_exposureCompensationValueNumerator = m_pcCfg->getTMISEIExposureCompensationValueNumerator(); … … 428 434 UInt *accumNalsDU = NULL; 429 435 SEIDecodingUnitInfo decodingUnitInfoSEI; 436 #if EFFICIENT_FIELD_IRAP 437 Int IRAPGOPid = -1; 438 Bool IRAPtoReorder = false; 439 Bool swapIRAPForward = false; 440 if(isField) 441 { 442 Int pocCurr; 443 #if !H_MV 444 for ( Int iGOPid=0; iGOPid < m_iGopSize; iGOPid++ ) 445 #endif 446 { 447 // determine actual POC 448 if(iPOCLast == 0) //case first frame or first top field 449 { 450 pocCurr=0; 451 } 452 else if(iPOCLast == 1 && isField) //case first bottom field, just like the first frame, the poc computation is not right anymore, we set the right value 453 { 454 pocCurr = 1; 455 } 456 else 457 { 458 pocCurr = iPOCLast - iNumPicRcvd + m_pcCfg->getGOPEntry(iGOPid).m_POC - isField; 459 } 460 461 // check if POC corresponds to IRAP 462 NalUnitType tmpUnitType = getNalUnitType(pocCurr, m_iLastIDR, isField); 463 if(tmpUnitType >= NAL_UNIT_CODED_SLICE_BLA_W_LP && tmpUnitType <= NAL_UNIT_CODED_SLICE_CRA) // if picture is an IRAP 464 { 465 if(pocCurr%2 == 0 && iGOPid < m_iGopSize-1 && m_pcCfg->getGOPEntry(iGOPid).m_POC == m_pcCfg->getGOPEntry(iGOPid+1).m_POC-1) 466 { // if top field and following picture in enc order is associated bottom field 467 IRAPGOPid = iGOPid; 468 IRAPtoReorder = true; 469 swapIRAPForward = true; 470 break; 471 } 472 if(pocCurr%2 != 0 && iGOPid > 0 && m_pcCfg->getGOPEntry(iGOPid).m_POC == m_pcCfg->getGOPEntry(iGOPid-1).m_POC+1) 473 { 474 // if picture is an IRAP remember to process it first 475 IRAPGOPid = iGOPid; 476 IRAPtoReorder = true; 477 swapIRAPForward = false; 478 break; 479 } 480 } 481 } 482 } 483 #endif 430 484 #if !H_MV 431 485 for ( Int iGOPid=0; iGOPid < m_iGopSize; iGOPid++ ) 432 486 #endif 433 487 { 488 #if EFFICIENT_FIELD_IRAP 489 if(IRAPtoReorder) 490 { 491 if(swapIRAPForward) 492 { 493 if(iGOPid == IRAPGOPid) 494 { 495 iGOPid = IRAPGOPid +1; 496 } 497 else if(iGOPid == IRAPGOPid +1) 498 { 499 iGOPid = IRAPGOPid; 500 } 501 } 502 else 503 { 504 if(iGOPid == IRAPGOPid -1) 505 { 506 iGOPid = IRAPGOPid; 507 } 508 else if(iGOPid == IRAPGOPid) 509 { 510 iGOPid = IRAPGOPid -1; 511 } 512 } 513 } 514 #endif 434 515 UInt uiColDir = 1; 435 516 //-- For time output for each slice … … 500 581 if(pocCurr>=m_pcCfg->getFramesToBeEncoded()) 501 582 { 583 #if EFFICIENT_FIELD_IRAP 584 if(IRAPtoReorder) 585 { 586 if(swapIRAPForward) 587 { 588 if(iGOPid == IRAPGOPid) 589 { 590 iGOPid = IRAPGOPid +1; 591 IRAPtoReorder = false; 592 } 593 else if(iGOPid == IRAPGOPid +1) 594 { 595 iGOPid --; 596 } 597 } 598 else 599 { 600 if(iGOPid == IRAPGOPid) 601 { 602 iGOPid = IRAPGOPid -1; 603 } 604 else if(iGOPid == IRAPGOPid -1) 605 { 606 iGOPid = IRAPGOPid; 607 IRAPtoReorder = false; 608 } 609 } 610 } 611 #endif 502 612 #if H_MV 503 613 delete pcBitstreamRedirect; … … 635 745 } 636 746 637 // Do decoding refresh marking if any 638 pcSlice->decodingRefreshMarking(m_pocCRA, m_bRefreshPending, rcListPic); 639 m_pcEncTop->selectReferencePictureSet(pcSlice, pocCurr, iGOPid); 640 pcSlice->getRPS()->setNumberOfLongtermPictures(0); 747 #if EFFICIENT_FIELD_IRAP 641 748 #if FIX1172 642 749 if ( pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP … … 653 760 pcSlice->setAssociatedIRAPPOC(m_associatedIRAPPOC); 654 761 #endif 655 762 #endif 763 // Do decoding refresh marking if any 764 pcSlice->decodingRefreshMarking(m_pocCRA, m_bRefreshPending, rcListPic); 765 m_pcEncTop->selectReferencePictureSet(pcSlice, pocCurr, iGOPid); 766 pcSlice->getRPS()->setNumberOfLongtermPictures(0); 767 #if EFFICIENT_FIELD_IRAP 768 #else 769 #if FIX1172 770 if ( pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 771 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL 772 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP 773 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL 774 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP 775 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA ) // IRAP picture 776 { 777 m_associatedIRAPType = pcSlice->getNalUnitType(); 778 m_associatedIRAPPOC = pocCurr; 779 } 780 pcSlice->setAssociatedIRAPType(m_associatedIRAPType); 781 pcSlice->setAssociatedIRAPPOC(m_associatedIRAPPOC); 782 #endif 783 #endif 784 785 #if ALLOW_RECOVERY_POINT_AS_RAP 786 if ((pcSlice->checkThatAllRefPicsAreAvailable(rcListPic, pcSlice->getRPS(), false, m_iLastRecoveryPicPOC, m_pcCfg->getDecodingRefreshType() == 3) != 0) || (pcSlice->isIRAP()) 787 #if EFFICIENT_FIELD_IRAP 788 || (isField && pcSlice->getAssociatedIRAPType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && pcSlice->getAssociatedIRAPType() <= NAL_UNIT_CODED_SLICE_CRA && pcSlice->getAssociatedIRAPPOC() == pcSlice->getPOC()+1) 789 #endif 790 ) 791 { 792 pcSlice->createExplicitReferencePictureSetFromReference(rcListPic, pcSlice->getRPS(), pcSlice->isIRAP(), m_iLastRecoveryPicPOC, m_pcCfg->getDecodingRefreshType() == 3); 793 } 794 #else 656 795 if ((pcSlice->checkThatAllRefPicsAreAvailable(rcListPic, pcSlice->getRPS(), false) != 0) || (pcSlice->isIRAP())) 657 796 { 658 797 pcSlice->createExplicitReferencePictureSetFromReference(rcListPic, pcSlice->getRPS(), pcSlice->isIRAP()); 659 798 } 799 #endif 660 800 pcSlice->applyReferencePictureSet(rcListPic, pcSlice->getRPS()); 661 801 … … 1411 1551 } 1412 1552 pictureTimingSEI.m_auCpbRemovalDelay = std::min<Int>(std::max<Int>(1, m_totalCoded - m_lastBPSEI), static_cast<Int>(pow(2, static_cast<double>(pcSlice->getSPS()->getVuiParameters()->getHrdParameters()->getCpbRemovalDelayLengthMinus1()+1)))); // Syntax element signalled as minus, hence the . 1413 pictureTimingSEI.m_picDpbOutputDelay = pcSlice->getSPS()->getNumReorderPics(0) + pcSlice->getPOC() - m_totalCoded; 1553 pictureTimingSEI.m_picDpbOutputDelay = pcSlice->getSPS()->getNumReorderPics(pcSlice->getSPS()->getMaxTLayers()-1) + pcSlice->getPOC() - m_totalCoded; 1554 #if EFFICIENT_FIELD_IRAP 1555 if(IRAPGOPid > 0 && IRAPGOPid < m_iGopSize) 1556 { 1557 // if pictures have been swapped there is likely one more picture delay on their tid. Very rough approximation 1558 pictureTimingSEI.m_picDpbOutputDelay ++; 1559 } 1560 #endif 1414 1561 Int factor = pcSlice->getSPS()->getVuiParameters()->getHrdParameters()->getTickDivisorMinus2() + 2; 1415 1562 pictureTimingSEI.m_picDpbOutputDuDelay = factor * pictureTimingSEI.m_picDpbOutputDelay; … … 1518 1665 sei_recovery_point.m_exactMatchingFlag = ( pcSlice->getPOC() == 0 ) ? (true) : (false); 1519 1666 sei_recovery_point.m_brokenLinkFlag = false; 1667 #if ALLOW_RECOVERY_POINT_AS_RAP 1668 if(m_pcCfg->getDecodingRefreshType() == 3) 1669 { 1670 m_iLastRecoveryPicPOC = pocCurr; 1671 } 1672 #endif 1520 1673 1521 1674 m_seiWriter.writeSEImessage( nalu.m_Bitstream, sei_recovery_point, pcSlice->getSPS() ); … … 1641 1794 } 1642 1795 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); 1796 1797 #if SETTING_NO_OUT_PIC_PRIOR 1798 if (pcSlice->isIRAP()) 1799 { 1800 if (pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && pcSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_IDR_N_LP) 1801 { 1802 pcSlice->setNoRaslOutputFlag(true); 1803 } 1804 //the inference for NoOutputPriorPicsFlag 1805 if (!m_bFirst && pcSlice->isIRAP() && pcSlice->getNoRaslOutputFlag()) 1806 { 1807 if (pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA) 1808 { 1809 pcSlice->setNoOutputPriorPicsFlag(true); 1810 } 1811 } 1812 } 1813 #endif 1814 1643 1815 tmpBitsBeforeWriting = m_pcEntropyCoder->getNumberOfWrittenBits(); 1644 1816 m_pcEntropyCoder->encodeSliceHeader(pcSlice); … … 2153 2325 std::vector<Int> temp; 2154 2326 TComSlice::markCurrPic( pcPic ); 2327 #if !H_MV_HLS_8_DBP_NODOC_42 2155 2328 TComSlice::markIvRefPicsAsUnused ( m_ivPicLists, temp, pcPic->getSlice(0)->getVPS(), m_layerId, pcPic->getPOC() ); 2329 #endif 2156 2330 #endif 2157 2331 m_bFirst = false; … … 2163 2337 2164 2338 delete[] pcSubstreamsOut; 2339 2340 #if EFFICIENT_FIELD_IRAP 2341 if(IRAPtoReorder) 2342 { 2343 if(swapIRAPForward) 2344 { 2345 if(iGOPid == IRAPGOPid) 2346 { 2347 iGOPid = IRAPGOPid +1; 2348 IRAPtoReorder = false; 2349 } 2350 else if(iGOPid == IRAPGOPid +1) 2351 { 2352 iGOPid --; 2353 } 2354 } 2355 else 2356 { 2357 if(iGOPid == IRAPGOPid) 2358 { 2359 iGOPid = IRAPGOPid -1; 2360 } 2361 else if(iGOPid == IRAPGOPid -1) 2362 { 2363 iGOPid = IRAPGOPid; 2364 IRAPtoReorder = false; 2365 } 2366 } 2367 } 2368 #endif 2165 2369 } 2166 2370 delete pcBitstreamRedirect; … … 2435 2639 case NAL_UNIT_CODED_SLICE_CRA: return "CRA"; 2436 2640 case NAL_UNIT_CODED_SLICE_RADL_R: return "RADL_R"; 2641 case NAL_UNIT_CODED_SLICE_RADL_N: return "RADL_N"; 2437 2642 case NAL_UNIT_CODED_SLICE_RASL_R: return "RASL_R"; 2643 case NAL_UNIT_CODED_SLICE_RASL_N: return "RASL_N"; 2438 2644 case NAL_UNIT_VPS: return "VPS"; 2439 2645 case NAL_UNIT_SPS: return "SPS"; … … 2838 3044 return NAL_UNIT_CODED_SLICE_IDR_W_RADL; 2839 3045 } 3046 #if EFFICIENT_FIELD_IRAP 3047 if(isField && pocCurr == 1) 3048 { 3049 // to avoid the picture becoming an IRAP 3050 return NAL_UNIT_CODED_SLICE_TRAIL_R; 3051 } 3052 #endif 3053 3054 #if ALLOW_RECOVERY_POINT_AS_RAP 3055 if(m_pcCfg->getDecodingRefreshType() != 3 && (pocCurr - isField) % m_pcCfg->getIntraPeriod() == 0) 3056 #else 2840 3057 if ((pocCurr - isField) % m_pcCfg->getIntraPeriod() == 0) 3058 #endif 2841 3059 { 2842 3060 if (m_pcCfg->getDecodingRefreshType() == 1)
Note: See TracChangeset for help on using the changeset viewer.