Changeset 903 in SHVCSoftware for branches/SHM-dev/source/Lib/TLibEncoder
- Timestamp:
- 10 Oct 2014, 18:22:03 (11 years ago)
- Location:
- branches/SHM-dev/source/Lib/TLibEncoder
- Files:
-
- 4 edited
-
TEncCavlc.cpp (modified) (5 diffs)
-
TEncGOP.cpp (modified) (11 diffs)
-
TEncTop.cpp (modified) (1 diff)
-
TEncTop.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-dev/source/Lib/TLibEncoder/TEncCavlc.cpp
r902 r903 1489 1489 1490 1490 WRITE_FLAG(vps->getMaxOneActiveRefLayerFlag(), "max_one_active_ref_layer_flag"); 1491 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 1492 WRITE_FLAG(vps->getVpsPocLsbAlignedFlag(), "vps_poc_lsb_aligned_flag"); 1493 #endif 1491 1494 #if O0062_POC_LSB_NOT_PRESENT_FLAG 1492 1495 for(i = 1; i< vps->getMaxLayers(); i++) … … 2701 2704 { 2702 2705 // Derive the value of PocMsbValRequiredFlag 2703 slice->setPocMsbValRequiredFlag( slice->getCraPicFlag() || slice->getBlaPicFlag() 2704 /* || related to vps_poc_lsb_aligned_flag */ 2705 ); 2706 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 2707 slice->setPocMsbValRequiredFlag( (slice->getCraPicFlag() || slice->getBlaPicFlag()) 2708 && (!slice->getVPS()->getVpsPocLsbAlignedFlag() || 2709 (slice->getVPS()->getVpsPocLsbAlignedFlag() && slice->getVPS()->getNumDirectRefLayers(slice->getLayerId()) == 0)) 2710 ); 2711 #else 2712 slice->setPocMsbValRequiredFlag( slice->getCraPicFlag() || slice->getBlaPicFlag() ); 2713 #endif 2706 2714 2707 2715 // Determine value of SH extension length. … … 2721 2729 2722 2730 2723 if( !slice->getPocMsbValRequiredFlag() /* && vps_poc_lsb_aligned_flag */ ) 2731 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 2732 if (!slice->getPocMsbValRequiredFlag() && slice->getVPS()->getVpsPocLsbAlignedFlag()) 2733 #else 2734 if (!slice->getPocMsbValRequiredFlag() /* && vps_poc_lsb_aligned_flag */) 2735 #endif 2724 2736 { 2725 2737 shExtnLengthInBit++; … … 2737 2749 } 2738 2750 2739 if( slice->getPocMsbValPresentFlag() ) 2751 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 2752 if (slice->getPocMsbNeeded()) 2753 { 2754 slice->setPocMsbValPresentFlag(true); 2755 } 2756 #endif 2757 2758 if (slice->getPocMsbValPresentFlag()) 2740 2759 { 2741 2760 UInt lengthVal = 1; … … 2771 2790 } 2772 2791 2773 if( !slice->getPocMsbValRequiredFlag() /* && vps_poc_lsb_aligned_flag */ ) 2774 { 2792 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 2793 if (!slice->getPocMsbValRequiredFlag() && slice->getVPS()->getVpsPocLsbAlignedFlag()) 2794 #else 2795 if (!slice->getPocMsbValRequiredFlag() /* && vps_poc_lsb_aligned_flag */) 2796 #endif 2797 { 2798 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 2799 WRITE_FLAG( slice->getPocMsbValPresentFlag(), "poc_msb_cycle_val_present_flag" ); 2800 #else 2775 2801 WRITE_FLAG( slice->getPocMsbValPresentFlag(), "poc_msb_val_present_flag" ); 2776 } 2777 if( slice->getPocMsbValPresentFlag() ) 2778 { 2779 assert( slice->getPocMsbVal() % maxPocLsb == 0 ); 2780 WRITE_UVLC( slice->getPocMsbVal() / maxPocLsb, "poc_msb_val" ); 2802 #endif 2803 } 2804 if (slice->getPocMsbValPresentFlag()) 2805 { 2806 assert(slice->getPocMsbVal() % maxPocLsb == 0); 2807 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 2808 WRITE_UVLC(slice->getPocMsbVal() / maxPocLsb, "poc_msb_cycle_val"); 2809 #else 2810 WRITE_UVLC(slice->getPocMsbVal() / maxPocLsb, "poc_msb_val"); 2811 #endif 2781 2812 } 2782 2813 for (Int i = 0; i < shExtnAdditionalBits; i++) -
branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.cpp
r899 r903 909 909 determinePocResetIdc(pocCurr, pcSlice); 910 910 911 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 912 Bool pocResettingFlag = false; 913 914 if (pcSlice->getPocResetIdc() != 0) 915 { 916 if (pcSlice->getVPS()->getVpsPocLsbAlignedFlag()) 917 { 918 pocResettingFlag = true; 919 } 920 else if (m_pcEncTop->getPocDecrementedInDPBFlag()) 921 { 922 pocResettingFlag = false; 923 } 924 else 925 { 926 pocResettingFlag = true; 927 } 928 } 929 #endif 930 911 931 // If reset, do the following steps: 932 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 933 if( pocResettingFlag ) 934 #else 912 935 if( pcSlice->getPocResetIdc() ) 936 #endif 913 937 { 914 938 updatePocValuesOfPics(pocCurr, pcSlice); … … 3397 3421 pcPicYuvRecOut->setReconstructed(true); 3398 3422 #endif 3399 3423 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 3424 m_pcEncTop->setFirstPicInLayerDecodedFlag(true); 3425 #endif 3400 3426 pcPic->setReconMark ( true ); 3401 3427 m_bFirst = false; … … 3456 3482 // If BL picture in the AU is IDR, and another picture is not IDR, set the poc_reset_idc to 2 3457 3483 // If BL picture is IRAP, and another picture is non-IRAP, then the poc_reset_idc is equal to 1 or 2. 3484 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 3485 slice->setPocMsbNeeded(false); 3486 #endif 3458 3487 if( slice->getSliceIdx() == 0 ) // First slice - compute, copy for other slices 3459 3488 { … … 3515 3544 { 3516 3545 slice->setPocResetIdc( 2 ); // Full reset needed 3546 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 3547 if (slice->getVPS()->getVpsPocLsbAlignedFlag() && slice->getVPS()->getNumDirectRefLayers(slice->getLayerId()) == 0) 3548 { 3549 slice->setPocMsbNeeded(true); // Force msb writing 3550 } 3551 #endif 3517 3552 } 3518 3553 else … … 3531 3566 Int periodId = rand() % 64; 3532 3567 m_lastPocPeriodId = (periodId == m_lastPocPeriodId) ? (periodId + 1) % 64 : periodId ; 3568 3569 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 3570 for (UInt i = 0; i < MAX_LAYERS; i++) 3571 { 3572 m_ppcTEncTop[i]->setPocDecrementedInDPBFlag(false); 3573 } 3574 #endif 3533 3575 } 3534 3576 else … … 3547 3589 Void TEncGOP::updatePocValuesOfPics(Int const pocCurr, TComSlice *const slice) 3548 3590 { 3591 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 3592 UInt affectedLayerList[MAX_NUM_LAYER_IDS]; 3593 Int numAffectedLayers; 3594 3595 affectedLayerList[0] = m_layerId; 3596 numAffectedLayers = 1; 3597 3598 if (m_pcEncTop->getVPS()->getVpsPocLsbAlignedFlag()) 3599 { 3600 for (UInt j = 0; j < m_pcEncTop->getVPS()->getNumPredictedLayers(m_layerId); j++) 3601 { 3602 affectedLayerList[j + 1] = m_pcEncTop->getVPS()->getPredictedLayerId(m_layerId, j); 3603 } 3604 numAffectedLayers = m_pcEncTop->getVPS()->getNumPredictedLayers(m_layerId) + 1; 3605 } 3606 #endif 3549 3607 3550 3608 Int pocAdjustValue = pocCurr - m_pcEncTop->getPocAdjustmentValue(); … … 3554 3612 3555 3613 maxPocLsb = 1 << slice->getSPS()->getBitsForPOC(); 3614 3615 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 3616 Int adjustedPocValue = pocCurr; 3617 3618 if (m_pcEncTop->getFirstPicInLayerDecodedFlag()) 3619 { 3620 #endif 3621 3556 3622 pocLsbVal = (slice->getPocResetIdc() == 3) 3557 3623 ? slice->getPocLsbVal() … … 3562 3628 : 0; 3563 3629 deltaPocVal = pocMsbDelta + pocLsbDelta; 3564 3630 3631 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 3632 Int origDeltaPocVal = deltaPocVal; // original value needed when updating POC adjustment value 3633 3634 if (slice->getPocMsbNeeded()) // IDR picture in base layer, non-IDR picture in other layers, poc_lsb_aligned_flag = 1 3635 { 3636 if (slice->getLayerId() == 0) 3637 { 3638 int highestPoc = INT_MIN; 3639 // Find greatest POC in DPB for layer 0 3640 for (TComList<TComPic*>::iterator iterPic = m_pcEncTop->getListPic()->begin(); iterPic != m_pcEncTop->getListPic()->end(); ++iterPic) 3641 { 3642 TComPic *dpbPic = *iterPic; 3643 if (dpbPic->getReconMark() && dpbPic->getLayerId() == 0 && dpbPic->getPOC() > highestPoc) 3644 { 3645 highestPoc = dpbPic->getPOC(); 3646 } 3647 } 3648 deltaPocVal = (highestPoc - (highestPoc & (maxPocLsb - 1))) + 1*maxPocLsb; 3649 m_pcEncTop->setCurrPocMsb(deltaPocVal); 3650 } 3651 else 3652 { 3653 deltaPocVal = m_ppcTEncTop[0]->getCurrPocMsb(); // copy from base layer 3654 } 3655 slice->setPocMsbVal(deltaPocVal); 3656 } 3657 #endif 3658 3659 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 3660 for (UInt layerIdx = 0; layerIdx < numAffectedLayers; layerIdx++) 3661 { 3662 if (!m_ppcTEncTop[affectedLayerList[layerIdx]]->getPocDecrementedInDPBFlag()) 3663 { 3664 m_ppcTEncTop[affectedLayerList[layerIdx]]->setPocDecrementedInDPBFlag(true); 3665 3666 // Decrement value of associatedIrapPoc of the TEncGop object 3667 m_ppcTEncTop[affectedLayerList[layerIdx]]->getGOPEncoder()->m_associatedIRAPPOC -= deltaPocVal; 3668 3669 // Decrememnt the value of m_pocCRA 3670 m_ppcTEncTop[affectedLayerList[layerIdx]]->getGOPEncoder()->m_pocCRA -= deltaPocVal; 3671 3672 TComList<TComPic*>::iterator iterPic = m_ppcTEncTop[affectedLayerList[layerIdx]]->getListPic()->begin(); 3673 while (iterPic != m_ppcTEncTop[affectedLayerList[layerIdx]]->getListPic()->end()) 3674 #else 3565 3675 // Decrement value of associatedIrapPoc of the TEncGop object 3566 3676 this->m_associatedIRAPPOC -= deltaPocVal; … … 3572 3682 TComList<TComPic*>::iterator iterPic = getListPic()->begin(); 3573 3683 while( iterPic != getListPic()->end() ) 3684 #endif 3574 3685 { 3575 3686 TComPic *dpbPic = *iterPic; … … 3596 3707 // Update value of associatedIrapPoc of each slice 3597 3708 dpbPicSlice->setAssociatedIRAPPOC( dpbPicSlice->getAssociatedIRAPPOC() - deltaPocVal ); 3709 3710 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 3711 if (slice->getPocMsbNeeded()) 3712 { 3713 // this delta value is needed when computing delta POCs in reference picture set initialization 3714 dpbPicSlice->setPocResetDeltaPoc(dpbPicSlice->getPocResetDeltaPoc() + (deltaPocVal - pocLsbVal)); 3715 } 3716 #endif 3598 3717 } 3599 3718 } 3600 3719 iterPic++; 3601 3720 } 3602 3721 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 3722 } 3723 } 3724 #endif 3725 3603 3726 // Actual POC value before reset 3727 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 3728 adjustedPocValue = pocCurr - m_pcEncTop->getPocAdjustmentValue(); 3729 #else 3604 3730 Int adjustedPocValue = pocCurr - m_pcEncTop->getPocAdjustmentValue(); 3731 #endif 3605 3732 3606 3733 // Set MSB value before reset 3607 3734 Int tempLsbVal = adjustedPocValue & (maxPocLsb - 1); 3608 slice->setPocMsbVal( adjustedPocValue - tempLsbVal); 3735 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 3736 if (!slice->getPocMsbNeeded()) // set poc msb normally if special msb handling is not needed 3737 { 3738 #endif 3739 slice->setPocMsbVal(adjustedPocValue - tempLsbVal); 3740 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 3741 } 3742 #endif 3609 3743 3610 3744 // Set LSB value before reset - this is needed in the case of resetIdc = 2 … … 3612 3746 3613 3747 // Cumulative delta 3748 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 3749 deltaPocVal = origDeltaPocVal; // restore deltaPoc for correct adjustment value update 3750 #endif 3614 3751 m_pcEncTop->setPocAdjustmentValue( m_pcEncTop->getPocAdjustmentValue() + deltaPocVal ); 3752 3753 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 3754 } 3755 #endif 3615 3756 3616 3757 // New LSB value, after reset -
branches/SHM-dev/source/Lib/TLibEncoder/TEncTop.cpp
r901 r903 98 98 m_noOutputOfPriorPicsFlags = false; 99 99 #endif 100 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 101 m_pocDecrementedInDPBFlag = false; 102 #endif 100 103 #endif //SVC_EXTENSION 101 104 } -
branches/SHM-dev/source/Lib/TLibEncoder/TEncTop.h
r849 r903 168 168 int m_numAddLayerSets; 169 169 #endif 170 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 171 Bool m_pocDecrementedInDPBFlag; 172 Int m_currPocMsb; 173 #endif 170 174 #endif //SVC_EXTENSION 171 175 protected: … … 306 310 Int getNumAddLayerSets() { return m_numAddLayerSets; } 307 311 #endif 312 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 313 Void setPocDecrementedInDPBFlag(Bool x) { m_pocDecrementedInDPBFlag = x; } 314 Bool getPocDecrementedInDPBFlag() { return m_pocDecrementedInDPBFlag; } 315 Void setCurrPocMsb(Int poc) { m_currPocMsb = poc; } 316 Int getCurrPocMsb() { return m_currPocMsb; } 317 #endif 308 318 #else //SVC_EXTENSION 309 319 Void encode( Bool bEos, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut,
Note: See TracChangeset for help on using the changeset viewer.