Changeset 534 in 3DVCSoftware for branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComSlice.cpp
- Timestamp:
- 13 Jul 2013, 10:26:41 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComSlice.cpp
r532 r534 108 108 , m_enableTMVPFlag ( true ) 109 109 #if H_MV 110 , m_refPicSetInterLayer ( NULL ) 110 111 , m_layerId (0) 111 112 , m_viewId (0) … … 114 115 , m_isDepth (false) 115 116 #endif 117 , m_discardableFlag (false) 118 , m_interLayerPredEnabledFlag (false) 119 , m_numInterLayerRefPicsMinus1 (0) 120 , m_interLayerSamplePredOnlyFlag (false) 121 , m_altCollocatedIndicationFlag (0) 122 , m_collocatedRefLayerIdx (0) 116 123 #if H_3D_IC 117 124 , m_bApplyIC ( false ) … … 162 169 initWpAcDcParam(); 163 170 m_saoEnabledFlag = false; 171 #if H_MV 172 for (Int i = 0; i < MAX_NUM_LAYERS; i++ ) 173 { 174 m_interLayerPredLayerIdc[ i ] = 0; 175 } 176 #endif 164 177 } 165 178 … … 492 505 UInt NumPocStCurr1 = 0; 493 506 UInt NumPocLtCurr = 0; 494 #if H_MV495 Int numDirectRefLayers = getVPS()->getNumDirectRefLayers( getLayerIdInVps() );496 assert( numDirectRefLayers == refPicSetInterLayer.size() );497 #endif498 507 Int i; 499 508 for(i=0; i < m_pcRPS->getNumberOfNegativePictures(); i++) … … 544 553 TComPic* rpsCurrList1[MAX_NUM_REF+1]; 545 554 #if H_MV 546 Int numPocTotalCurr = NumPocStCurr0 + NumPocStCurr1 + NumPocLtCurr + numDirectRefLayers; 555 Int numPocInterCurr = NumPocStCurr0 + NumPocStCurr1 + NumPocLtCurr; 556 assert( numPocInterCurr == 0 || getInterRefEnabledInRPLFlag() ); 557 Int numPocTotalCurr = numPocInterCurr + getNumActiveRefLayerPics( ); 547 558 assert( numPocTotalCurr == getNumRpsCurrTempList() ); 548 559 #else … … 582 593 583 594 Int cIdx = 0; 595 #if H_MV 596 if ( getInterRefEnabledInRPLFlag() ) 597 { 598 #endif 584 599 for ( i=0; i<NumPocStCurr0; i++, cIdx++) 585 600 { … … 595 610 } 596 611 #if H_MV 597 for ( i=0; i<numDirectRefLayers; i++, cIdx++)598 {599 if( cIdx <= MAX_NUM_REF )600 {612 } 613 for ( i=0; i < getNumActiveRefLayerPics( ); i++, cIdx++) 614 { 615 assert( cIdx < MAX_NUM_REF ); 601 616 rpsCurrList0[cIdx] = refPicSetInterLayer[i]; 602 617 } 603 }604 618 #endif 605 619 … … 607 621 { 608 622 cIdx = 0; 623 #if H_MV 624 if ( getInterRefEnabledInRPLFlag() ) 625 { 626 #endif 609 627 for ( i=0; i<NumPocStCurr1; i++, cIdx++) 610 628 { … … 620 638 } 621 639 #if H_MV 622 for ( i=0; i<numDirectRefLayers; i++, cIdx++)623 {624 if( cIdx <= MAX_NUM_REF )625 {640 } 641 for ( i=0; i < getNumActiveRefLayerPics( ); i++, cIdx++) 642 { 643 assert( cIdx < MAX_NUM_REF ); 626 644 rpsCurrList1[cIdx] = refPicSetInterLayer[i]; 627 645 } 628 }629 646 #endif 630 647 } 631 648 632 649 ::memset(m_bIsUsedAsLongTerm, 0, sizeof(m_bIsUsedAsLongTerm)); 650 651 #if H_MV 652 Int numPocSt = NumPocStCurr0 + NumPocStCurr1; 653 assert( getInterRefEnabledInRPLFlag( ) || numPocSt == 0 ); 654 655 for (Int li = 0; li < 2; li++) 656 { 657 if ( m_eSliceType == P_SLICE && li == 1 ) 658 { 659 m_aiNumRefIdx[1] = 0; 660 ::memset( m_apcRefPicList[1], 0, sizeof(m_apcRefPicList[1])); 661 } 662 else 663 { 664 for (Int rIdx = 0; rIdx <= (m_aiNumRefIdx[ li ] - 1 ); rIdx ++) 665 { 666 Bool listModified = m_RefPicListModification.getRefPicListModificationFlagL( li ); 667 Int orgIdx = listModified ? m_RefPicListModification.getRefPicSetIdxL(li, rIdx) : (rIdx % numPocTotalCurr); 668 669 m_apcRefPicList [li][rIdx] = ( li == 0 ) ? rpsCurrList0[ orgIdx ] : rpsCurrList1[ orgIdx ]; 670 m_bIsUsedAsLongTerm[li][rIdx] = ( orgIdx >= numPocSt ) ; 671 } 672 } 673 } 674 #else 633 675 634 676 for (Int rIdx = 0; rIdx <= (m_aiNumRefIdx[0]-1); rIdx ++) … … 652 694 } 653 695 } 696 #endif 654 697 } 655 698 … … 687 730 } 688 731 #if H_MV 689 numRpsCurrTempList = numRpsCurrTempList + getVPS()->getNumDirectRefLayers( getLayerIdInVps() ); 732 assert( ( numRpsCurrTempList == 0 ) || getInterRefEnabledInRPLFlag() ); 733 numRpsCurrTempList = numRpsCurrTempList + getNumActiveRefLayerPics(); 690 734 #endif 691 735 return numRpsCurrTempList; … … 1022 1066 m_enableTMVPFlag = pSrc->m_enableTMVPFlag; 1023 1067 m_maxNumMergeCand = pSrc->m_maxNumMergeCand; 1068 1069 #if H_MV 1070 // Additional slice header syntax elements 1071 m_discardableFlag = pSrc->m_discardableFlag; 1072 m_interLayerPredEnabledFlag = pSrc->m_interLayerPredEnabledFlag; 1073 m_numInterLayerRefPicsMinus1 = pSrc->m_numInterLayerRefPicsMinus1; 1074 1075 for (Int layer = 0; layer < MAX_NUM_LAYERS; layer++ ) 1076 { 1077 m_interLayerPredLayerIdc[ layer ] = pSrc->m_interLayerPredLayerIdc[ layer ]; 1078 } 1079 1080 m_interLayerSamplePredOnlyFlag = pSrc->m_interLayerSamplePredOnlyFlag; 1081 m_altCollocatedIndicationFlag = pSrc->m_altCollocatedIndicationFlag ; 1082 m_collocatedRefLayerIdx = pSrc->m_collocatedRefLayerIdx ; 1083 m_numActiveMotionPredRefLayers = pSrc->m_numActiveMotionPredRefLayers; 1084 1085 for (Int layer = 0; layer < MAX_NUM_LAYER_IDS; layer++) 1086 { 1087 m_interLayerPredLayerIdc[layer] = pSrc->m_interLayerPredLayerIdc[layer]; 1088 } 1089 #endif 1024 1090 #if H_3D_IC 1025 1091 m_bApplyIC = pSrc->m_bApplyIC; … … 1489 1555 , m_numHrdParameters ( 0) 1490 1556 #if H_MV 1491 , m_max NuhLayerId ( 0)1557 , m_maxLayerId ( 0) 1492 1558 #else 1493 1559 , m_maxNuhReservedZeroLayerId ( 0) … … 1508 1574 } 1509 1575 #if H_MV 1576 for (Int lsIdx = 0; lsIdx < MAX_VPS_OP_SETS_PLUS1; lsIdx++ ) 1577 { 1578 for( Int layerId = 0; layerId < MAX_VPS_NUH_LAYER_ID_PLUS1; layerId++ ) 1579 { 1580 m_layerIdIncludedFlag[lsIdx][layerId] = false; 1581 } 1582 } 1583 1584 m_vpsNumberLayerSetsMinus1 = -1; 1585 m_vpsNumProfileTierLevelMinus1 = -1; 1586 1587 for ( Int i = 0; i < MAX_VPS_PROFILE_TIER_LEVEL; i++) 1588 { 1589 m_profileRefMinus1[ i ] = -1; 1590 } 1591 1592 m_moreOutputLayerSetsThanDefaultFlag = false; 1593 m_numAddOutputLayerSetsMinus1 = -1; 1594 m_defaultOneTargetOutputLayerFlag = false; 1595 1596 for ( Int i = 0; i < MAX_VPS_OUTPUTLAYER_SETS; i++) 1597 { 1598 m_outputLayerSetIdxMinus1[i] = -1; 1599 m_profileLevelTierIdx[i] = 0; 1600 for ( Int j = 0; j < MAX_VPS_NUH_LAYER_ID_PLUS1; j++) 1601 { 1602 m_outputLayerFlag[i][j] = false; 1603 } 1604 } 1605 1606 m_maxOneActiveRefLayerFlag = false; 1607 m_directDepTypeLenMinus2 = 0; 1608 1609 1510 1610 m_avcBaseLayerFlag = false; 1511 1611 m_splittingFlag = false; … … 1518 1618 1519 1619 m_vpsNuhLayerIdPresentFlag = false; 1520 m_numOutputLayerSets = 0;1521 1620 1522 1621 for( Int i = 0; i < MAX_VPS_OP_SETS_PLUS1; i++ ) 1523 1622 { 1524 1623 m_vpsProfilePresentFlag [i] = false; 1525 m_profile LayerSetRefMinus1[i] = 0;1526 m_outputLayerSetIdx [i] = 0;1624 m_profileRefMinus1[i] = 0; 1625 m_outputLayerSetIdxMinus1 [i] = 0; 1527 1626 for( Int j = 0; j < MAX_VPS_NUH_LAYER_ID_PLUS1; j++ ) 1528 1627 { … … 1540 1639 m_layerIdInNuh [i] = ( i == 0 ) ? 0 : -1; 1541 1640 m_numDirectRefLayers[i] = 0; 1641 m_maxTidIlRefPicPlus1[i] = -1; 1542 1642 #if H_3D 1543 1643 m_viewIndex [i] = -1; … … 1566 1666 { 1567 1667 m_directDependencyFlag[i][j] = false; 1668 m_directDependencyType[i][j] = -1; 1568 1669 m_refLayerId[i][j] = -1; 1569 1670 } … … 1686 1787 Bool TComVPS::checkVPSExtensionSyntax() 1687 1788 { 1688 // check splitting flag constraint1689 if ( getSplittingFlag() )1690 {1691 // Derive dimBitOffset[j]1692 Int dimBitOffset[MAX_NUM_SCALABILITY_TYPES+1];1693 Int numScalabilityTypes = getNumScalabilityTypes();1694 dimBitOffset[0] = 0;1695 1696 for (Int type = 1; type <= numScalabilityTypes; type++ )1697 {1698 dimBitOffset[ type ] = 0;1699 for (Int dimIdx = 0; dimIdx <= type - 1; dimIdx++)1700 dimBitOffset[ type ] += ( getDimensionIdLen( dimIdx ) );1701 }1702 1703 for (Int type = 0; type < getNumScalabilityTypes(); type++ )1704 {1705 for( Int layer = 1; layer < getMaxLayers(); layer++ )1706 {1707 assert( getDimensionId( layer, type ) == ( ( getLayerIdInNuh( layer ) & ( (1 << dimBitOffset[ type + 1 ] ) - 1) ) >> dimBitOffset[ type ] ) );1708 };1709 };1710 }1711 1712 1789 for( Int layer = 1; layer < getMaxLayers(); layer++ ) 1713 1790 { … … 1737 1814 } 1738 1815 1739 1740 1741 1816 Void TComVPS::setScalabilityMask( UInt val ) 1742 1817 { … … 1745 1820 } 1746 1821 1747 Void TComVPS:: calcIvRefLayers()1748 { 1749 for( Int i = 1; i <= getMaxLayers(); i++ )1822 Void TComVPS::setRefLayers() 1823 { 1824 for( Int i = 0; i < MAX_NUM_LAYERS; i++ ) 1750 1825 { 1826 m_numSamplePredRefLayers[ i ] = 0; 1827 m_numMotionPredRefLayers[ i ] = 0; 1751 1828 m_numDirectRefLayers[ i ] = 0; 1829 for( Int j = 0; j < MAX_NUM_LAYERS; j++ ) { 1830 m_samplePredEnabledFlag[ i ][ j ] = 0; 1831 m_motionPredEnabledFlag[ i ][ j ] = 0; 1832 m_refLayerId[ i ][ j ] = 0; 1833 m_samplePredRefLayerId[ i ][ j ] = 0; 1834 m_motionPredRefLayerId[ i ][ j ] = 0; 1835 } 1836 } 1837 1838 for( Int i = 1; i <= getMaxLayers()- 1; i++ ) 1839 { 1840 for( Int j = 0; j < i; j++ ) 1841 { 1842 if( getDirectDependencyFlag(i,j) ) 1843 { 1844 m_refLayerId[ i ][m_numDirectRefLayers[ i ]++ ] = getLayerIdInNuh( j ); 1845 1846 m_samplePredEnabledFlag [ i ][ j ] = ( ( getDirectDependencyType( i , j ) + 1 ) & 1 ) == 1; 1847 m_numSamplePredRefLayers[ i ] += m_samplePredEnabledFlag [ i ][ j ] ? 1 : 0; 1848 m_motionPredEnabledFlag [ i ][ j ] = ( ( ( getDirectDependencyType( i , j ) + 1 ) & 2 ) >> 1 ) == 1; 1849 m_numMotionPredRefLayers[ i ] += m_motionPredEnabledFlag [ i][ j ] ? 1 : 0; 1850 } 1851 } 1852 } 1853 1854 for( Int i = 1, mIdx = 0, sIdx = 0; i <= getMaxLayers()- 1; i++ ) 1855 { 1752 1856 for( Int j = 0 ; j < i; j++ ) 1753 if( m_directDependencyFlag[ i ][ j ]) 1754 m_refLayerId[ i ][ m_numDirectRefLayers[ i ]++ ] = m_layerIdInNuh[ j ]; 1857 { 1858 if( m_motionPredEnabledFlag[ i ][ j ] ) 1859 { 1860 m_motionPredRefLayerId[ i ][ mIdx++ ] = getLayerIdInNuh( j ); 1861 } 1862 1863 if( m_samplePredEnabledFlag[ i ][ j ] ) 1864 { 1865 m_samplePredRefLayerId[ i ][ sIdx++ ] = getLayerIdInNuh( j ); 1866 } 1867 } 1755 1868 } 1756 1869 } … … 1814 1927 return getLayerIdInNuh( foundlayerId ); 1815 1928 } 1929 1816 1930 #endif // H_3D 1931 1932 Int TComVPS::xCeilLog2( Int val ) 1933 { 1934 assert( val > 0 ); 1935 Int ceilLog2 = 0; 1936 while( val > ( 1 << ceilLog2 ) ) ceilLog2++; 1937 return ceilLog2; 1938 } 1939 1940 1941 Int TComVPS::xGetDimBitOffset( Int j ) 1942 { 1943 Int dimBitOffset = 0; 1944 if ( getSplittingFlag() && j == getNumScalabilityTypes() ) 1945 { 1946 dimBitOffset = 6; 1947 } 1948 else 1949 { 1950 for (Int dimIdx = 0; dimIdx <= j-1; dimIdx++) 1951 { 1952 dimBitOffset += getDimensionIdLen( dimIdx ); 1953 } 1954 } 1955 return dimBitOffset; 1956 } 1957 1958 Int TComVPS::inferDimensionId( Int i, Int j ) 1959 { 1960 return ( ( getLayerIdInNuh( i ) & ( (1 << xGetDimBitOffset( j + 1 ) ) - 1) ) >> xGetDimBitOffset( j ) ); 1961 } 1962 1963 Int TComVPS::inferLastDimsionIdLenMinus1() 1964 { 1965 return ( 5 - xGetDimBitOffset( getNumScalabilityTypes() - 1 ) ); 1966 } 1967 1968 Int TComVPS::getNumLayersInIdList( Int lsIdx ) 1969 { 1970 assert( lsIdx >= 0 ); 1971 assert( lsIdx <= getVpsNumLayerSetsMinus1() ); 1972 Int numLayersInIdList = 0; 1973 for (Int layerId = 0; layerId < getVpsMaxLayerId(); layerId++ ) 1974 { 1975 numLayersInIdList += ( getLayerIdIncludedFlag( lsIdx, layerId ) ); 1976 } 1977 return numLayersInIdList; 1978 } 1817 1979 #endif // H_MV 1818 1980 … … 1865 2027 #if H_MV 1866 2028 , m_interViewMvVertConstraintFlag (false) 2029 , m_numIlpRestrictedRefLayers ( 0 ) 2030 1867 2031 #endif 1868 2032 #if H_3D … … 1883 2047 ::memset(m_ltRefPicPocLsbSps, 0, sizeof(m_ltRefPicPocLsbSps)); 1884 2048 ::memset(m_usedByCurrPicLtSPSFlag, 0, sizeof(m_usedByCurrPicLtSPSFlag)); 2049 #if H_MV 2050 for (Int i = 0; i < MAX_NUM_LAYERS; i++ ) 2051 { 2052 m_minSpatialSegmentOffsetPlus1[ i ] = 0; 2053 m_ctuBasedOffsetEnabledFlag [ i ] = false; 2054 m_minHorizontalCtuOffsetPlus1 [ i ] = 0; 2055 } 2056 #endif 1885 2057 } 1886 2058 … … 2361 2533 refPicSetInterLayer.clear(); 2362 2534 2363 for( Int i = 0; i < get VPS()->getNumDirectRefLayers( getLayerIdInVps()); i++ )2364 { 2365 Int layerIdRef = get VPS()->getRefLayerId( getLayerIdInVps(),i );2535 for( Int i = 0; i < getNumActiveRefLayerPics(); i++ ) 2536 { 2537 Int layerIdRef = getRefPicLayerId( i ); 2366 2538 TComPic* picRef = ivPicLists->getPic( layerIdRef, getPOC() ) ; 2367 2539 assert ( picRef != 0 ); … … 2371 2543 picRef->getSlice(0)->setReferenced( true ); 2372 2544 2545 // Consider to check here: 2546 // "If the current picture is a RADL picture, there shall be no entry in the RefPicSetInterLayer that is a RASL picture. " 2373 2547 refPicSetInterLayer.push_back( picRef ); 2374 2548 } … … 2441 2615 } 2442 2616 } 2617 } 2618 Int TComSlice::xCeilLog2( Int val ) 2619 { 2620 assert( val > 0 ); 2621 Int ceilLog2 = 0; 2622 while( val > ( 1 << ceilLog2 ) ) ceilLog2++; 2623 return ceilLog2; 2624 } 2625 2626 Void TComSlice::markCurrPic( TComPic* currPic ) 2627 { 2628 if ( !currPic->getSlice(0)->getDiscardableFlag() ) 2629 { 2630 currPic->getSlice(0)->setReferenced( true ) ; 2631 currPic->setIsLongTerm( false ); 2632 } 2633 else 2634 { 2635 currPic->getSlice(0)->setReferenced( false ) ; 2636 } 2637 } 2638 2639 Void TComSlice::setRefPicSetInterLayer( std::vector<TComPic*>* refPicSetInterLayer ) 2640 { 2641 m_refPicSetInterLayer = refPicSetInterLayer; 2642 } 2643 2644 TComPic* TComSlice::getPicFromRefPicSetInterLayer( Int layerId ) 2645 { 2646 assert( m_refPicSetInterLayer != 0 ); 2647 assert( (*m_refPicSetInterLayer).size() == getNumActiveRefLayerPics() ); 2648 TComPic* pcPic = NULL; 2649 for ( Int i = 0; i < getNumActiveRefLayerPics(); i++ ) 2650 { 2651 if ((*m_refPicSetInterLayer)[ i ]->getLayerId() == layerId) 2652 { 2653 pcPic = (*m_refPicSetInterLayer)[ i ]; 2654 } 2655 } 2656 assert(pcPic != NULL); 2657 return pcPic; 2658 } 2659 2660 Int TComSlice::getNumActiveRefLayerPics() 2661 { 2662 Int numActiveRefLayerPics; 2663 2664 if( getLayerId() == 0 || getVPS()->getNumDirectRefLayers( getLayerIdInVps() ) == 0 || !getInterLayerPredEnabledFlag() ) 2665 { 2666 numActiveRefLayerPics = 0; 2667 } 2668 else if( getVPS()->getMaxOneActiveRefLayerFlag() || getVPS()->getNumDirectRefLayers( getLayerIdInVps() ) == 1 ) 2669 { 2670 numActiveRefLayerPics = 1; 2671 } 2672 else 2673 { 2674 numActiveRefLayerPics = getNumInterLayerRefPicsMinus1() + 1; 2675 } 2676 return numActiveRefLayerPics; 2677 } 2678 2679 Int TComSlice::getRefPicLayerId( Int i ) 2680 { 2681 return getVPS()->getRefLayerId( getLayerIdInVps(), getInterLayerPredLayerIdc( i ) ); 2682 } 2683 2684 Void TComSlice::setActiveMotionPredRefLayers() 2685 { 2686 Int j = 0; 2687 for( Int i = 0; i < getNumActiveRefLayerPics(); i++) 2688 { 2689 if( getVPS()->getMotionPredEnabledFlag( getLayerIdInVps(), getInterLayerPredLayerIdc( i )) ) 2690 { 2691 m_activeMotionPredRefLayerId[ j++ ] = getVPS()->getRefLayerId( getLayerIdInVps(), i ); 2692 } 2693 } 2694 m_numActiveMotionPredRefLayers = j; 2695 2696 // Consider incorporating bitstream conformance tests on derived variables here. 2697 } 2698 2699 Bool TComSlice::getInterRefEnabledInRPLFlag() 2700 { 2701 Bool interRefEnabledInRPLFlag; 2702 if ( getVPS()->getNumSamplePredRefLayers( getLayerIdInVps() ) > 0 && getNumActiveRefLayerPics() > 0 ) 2703 { 2704 interRefEnabledInRPLFlag = !getInterLayerSamplePredOnlyFlag(); 2705 } 2706 else 2707 { 2708 interRefEnabledInRPLFlag = 1; 2709 } 2710 return interRefEnabledInRPLFlag; 2443 2711 } 2444 2712 #if H_3D_ARP
Note: See TracChangeset for help on using the changeset viewer.