Changeset 1054 in 3DVCSoftware for branches/HTM-12.0-dev1/source/App/TAppEncoder/TAppEncTop.cpp
- Timestamp:
- 26 Sep 2014, 18:34:05 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-12.0-dev1/source/App/TAppEncoder/TAppEncTop.cpp
r1048 r1054 133 133 xSetLayerIds ( vps ); 134 134 xSetDimensionIdAndLength ( vps ); 135 xSetDependencies( vps ); 135 xSetDependencies ( vps ); 136 xSetRepFormat ( vps ); 136 137 xSetProfileTierLevel ( vps ); 137 xSetRepFormat ( vps );138 138 xSetLayerSets ( vps ); 139 139 xSetDpbSize ( vps ); … … 144 144 xDeriveDltArray ( vps, dlt ); 145 145 #endif 146 146 #if H_MV_HLS10_GEN_FIX 147 Bool wasEmpty = true; 148 if ( m_targetEncLayerIdList.size() == 0 ) 149 { 150 for (Int i = 0; i < m_numberOfLayers; i++ ) 151 { 152 m_targetEncLayerIdList.push_back( m_layerIdInNuh[ i ] ); 153 } 154 } 155 for( Int i = (Int) m_targetEncLayerIdList.size()-1 ; i >= 0 ; i--) 156 { 157 Int iNuhLayerId = m_targetEncLayerIdList[i]; 158 Bool allRefLayersPresent = true; 159 for( Int j = 0; j < vps.getNumRefLayers( iNuhLayerId ); j++) 160 { 161 allRefLayersPresent = allRefLayersPresent && xLayerIdInTargetEncLayerIdList( vps.getIdRefLayer( iNuhLayerId, j) ); 162 } 163 if ( !allRefLayersPresent ) 164 { 165 printf("\nCannot encode layer with nuh_layer_id equal to %d since not all reference layers are in TargetEncLayerIdList\n", iNuhLayerId); 166 m_targetEncLayerIdList.erase( m_targetEncLayerIdList.begin() + i ); 167 } 168 } 169 #endif 170 171 #if H_MV_HLS10_ADD_LAYERSETS 172 if ( m_outputVpsInfo ) 173 { 174 vps.printLayerDependencies(); 175 vps.printLayerSets(); 176 vps.printPTL(); 177 } 178 #endif 147 179 148 180 for(Int layerIdInVps = 0; layerIdInVps < m_numberOfLayers; layerIdInVps++) … … 248 280 #endif 249 281 282 #if H_MV 283 m_cTEncTop.setProfile(m_profile[0]); 284 m_cTEncTop.setLevel (m_levelTier[0], m_level[0]); 285 #else 250 286 m_cTEncTop.setProfile(m_profile); 251 287 m_cTEncTop.setLevel(m_levelTier, m_level); 288 #endif 252 289 m_cTEncTop.setProgressiveSourceFlag(m_progressiveSourceFlag); 253 290 m_cTEncTop.setInterlacedSourceFlag(m_interlacedSourceFlag); … … 801 838 802 839 #if H_MV 840 #if H_MV_HLS10_GEN_FIX 841 while ( (m_targetEncLayerIdList.size() != 0 ) && !allEos ) 842 #else 803 843 while ( !allEos ) 844 #endif 804 845 { 805 846 for(Int layer=0; layer < m_numberOfLayers; layer++ ) 806 847 { 848 #if H_MV_HLS10_GEN_FIX 849 if (!xLayerIdInTargetEncLayerIdList( m_layerIdInNuh[ layer ] )) 850 { 851 continue; 852 } 853 #endif 854 807 855 Int frmCnt = 0; 808 856 while ( !eos[layer] && !(frmCnt == gopSize)) … … 844 892 for(Int layer=0; layer < m_numberOfLayers; layer++ ) 845 893 { 894 #if H_MV_HLS10_GEN_FIX 895 if (!xLayerIdInTargetEncLayerIdList( m_layerIdInNuh[ layer ] )) 896 { 897 continue; 898 } 899 #endif 900 846 901 #if H_3D_VSO 847 902 if( m_bUseVSO && m_bUseEstimatedVSD && iNextPoc < m_framesToBeEncoded ) … … 870 925 for(Int layer=0; layer < m_numberOfLayers; layer++ ) 871 926 { 927 #if H_MV_HLS10_GEN_FIX 928 if (!xLayerIdInTargetEncLayerIdList( m_layerIdInNuh[ layer ] )) 929 { 930 continue; 931 } 932 #endif 872 933 m_acTEncTopList[layer]->printSummary( m_acTEncTopList[layer]->getNumAllPicCoded(), m_isField ); 873 934 } … … 1499 1560 Void TAppEncTop::xSetProfileTierLevel( TComVPS& vps ) 1500 1561 { 1562 #if H_MV_HLS10_PTL 1563 1564 // SET PTL 1565 assert( m_profile.size() == m_level.size() && m_profile.size() == m_levelTier.size() ); 1566 vps.setVpsNumProfileTierLevelMinus1( (Int) m_profile.size() - 1 ); 1567 for ( Int ptlIdx = 0; ptlIdx <= vps.getVpsNumProfileTierLevelMinus1(); ptlIdx++ ) 1568 { 1569 if ( ptlIdx > 1 ) 1570 { 1571 Bool vpsProfilePresentFlag = ( m_profile[ptlIdx] != m_profile[ptlIdx - 1] ) 1572 || ( m_inblFlag[ptlIdx ] != m_inblFlag[ptlIdx - 1] ); 1573 vps.setVpsProfilePresentFlag( ptlIdx, vpsProfilePresentFlag ); 1574 } 1575 1576 xSetProfileTierLevel( vps, ptlIdx, -1, m_profile[ptlIdx], m_level[ptlIdx], 1577 m_levelTier[ ptlIdx ], m_progressiveSourceFlag, m_interlacedSourceFlag, 1578 m_nonPackedConstraintFlag, m_frameOnlyConstraintFlag, m_inblFlag[ptlIdx] ); 1579 } 1580 #else 1501 1581 const Int vpsNumProfileTierLevelMinus1 = 0; //TBD 1502 1582 vps.setVpsNumProfileTierLevelMinus1( vpsNumProfileTierLevelMinus1 ); … … 1506 1586 vps.setVpsProfilePresentFlag( i, true ); 1507 1587 } 1588 #endif 1508 1589 } 1509 1590 … … 1525 1606 //repFormat->setSeparateColourPlaneVpsFlag( ); 1526 1607 1608 #if H_MV_HLS10_GEN_VSP_CONF_WIN 1609 repFormat->setConformanceWindowVpsFlag( true ); 1610 repFormat->setConfWinVpsLeftOffset ( m_confLeft / TComSPS::getWinUnitX( repFormat->getChromaFormatVpsIdc() ) ); 1611 repFormat->setConfWinVpsRightOffset ( m_confRight / TComSPS::getWinUnitX( repFormat->getChromaFormatVpsIdc() ) ); 1612 repFormat->setConfWinVpsTopOffset ( m_confTop / TComSPS::getWinUnitY( repFormat->getChromaFormatVpsIdc() ) ); 1613 repFormat->setConfWinVpsBottomOffset ( m_confBottom / TComSPS::getWinUnitY( repFormat->getChromaFormatVpsIdc() ) ); 1614 #endif 1615 1527 1616 assert( vps.getRepFormat( 0 ) == NULL ); 1528 1617 vps.setRepFormat( 0 , repFormat ); … … 1540 1629 { 1541 1630 Int currLsIdx = vps.olsIdxToLsIdx( i ); 1631 #if !H_MV_HLS10_ADD_LAYERSETS 1542 1632 std::vector<Int> targetDecLayerIdList = vps.getTargetDecLayerIdList( i ); 1633 #endif 1543 1634 Bool subLayerFlagInfoPresentFlag = false; 1544 1635 … … 1546 1637 { 1547 1638 Bool subLayerDpbInfoPresentFlag = false; 1639 #if !H_MV_HLS10_ADD_LAYERSETS 1548 1640 assert( vps.getNumLayersInIdList( currLsIdx ) == targetDecLayerIdList.size() ); 1641 #endif 1549 1642 for( Int k = 0; k < vps.getNumLayersInIdList( currLsIdx ); k++ ) 1550 1643 { 1644 #if H_MV_HLS10_DBP_SIZE 1645 Int layerIdInVps = vps.getLayerIdInVps( vps.getLayerSetLayerIdList( currLsIdx, k ) ); 1646 if ( vps.getNecessaryLayerFlag( i,k ) && ( vps.getVpsBaseLayerInternalFlag() || vps.getLayerSetLayerIdList( currLsIdx, k ) != 0 ) ) 1647 { 1648 dpbSize->setMaxVpsDecPicBufferingMinus1( i, k, j, m_maxDecPicBufferingMvc[ layerIdInVps ][ j ] - 1 ); 1649 if ( j > 0 ) 1650 { 1651 subLayerDpbInfoPresentFlag = subLayerDpbInfoPresentFlag || ( dpbSize->getMaxVpsDecPicBufferingMinus1( i, k, j ) != dpbSize->getMaxVpsDecPicBufferingMinus1( i, k, j - 1 ) ); 1652 } 1653 } 1654 else 1655 { 1656 if (vps.getNecessaryLayerFlag(i,k) && j == 0 && k == 0 ) 1657 { 1658 dpbSize->setMaxVpsDecPicBufferingMinus1(i, k ,j, 0 ); 1659 } 1660 } 1661 #else 1551 1662 Int layerIdInVps = vps.getLayerIdInVps( targetDecLayerIdList[k] ); 1552 1663 dpbSize->setMaxVpsDecPicBufferingMinus1( i, k, j, m_maxDecPicBufferingMvc[ layerIdInVps ][ j ] - 1 ); 1664 1553 1665 if ( j > 0 ) 1554 1666 { 1555 1667 subLayerDpbInfoPresentFlag = subLayerDpbInfoPresentFlag || ( dpbSize->getMaxVpsDecPicBufferingMinus1( i, k, j ) != dpbSize->getMaxVpsDecPicBufferingMinus1( i, k, j - 1 ) ); 1556 1668 } 1669 #endif 1557 1670 } 1558 1671 1559 1672 Int maxNumReorderPics = MIN_INT; 1673 #if H_MV_HLS10_DBP_SIZE 1674 for ( Int idx = 0; idx < vps.getNumLayersInIdList( currLsIdx ); idx++ ) 1675 { 1676 if (vps.getNecessaryLayerFlag(i, idx )) 1677 { 1678 Int layerIdInVps = vps.getLayerIdInVps( vps.getLayerSetLayerIdList(currLsIdx, idx) ); 1679 maxNumReorderPics = std::max( maxNumReorderPics, m_numReorderPicsMvc[ layerIdInVps ][ j ] ); 1680 } 1681 } 1682 #else 1560 1683 for ( Int idx = 0; idx < targetDecLayerIdList.size(); idx++ ) 1561 1684 { … … 1563 1686 maxNumReorderPics = std::max( maxNumReorderPics, m_numReorderPicsMvc[ layerIdInVps ][ j ] ); 1564 1687 } 1688 #endif 1565 1689 assert( maxNumReorderPics != MIN_INT ); 1566 1690 … … 1588 1712 } 1589 1713 1590 1591 1714 Void TAppEncTop::xSetLayerSets( TComVPS& vps ) 1592 1715 { … … 1610 1733 // Additional output layer sets + profileLevelTierIdx 1611 1734 vps.setDefaultOutputLayerIdc ( m_defaultOutputLayerIdc ); 1735 #if H_MV_HLS10_ADD_LAYERSETS 1736 if( vps.getNumIndependentLayers() == 0 && m_numAddLayerSets > 0 ) 1737 { 1738 fprintf( stderr, "\nWarning: Ignoring additional layer sets since NumIndependentLayers is equal to 0.\n"); 1739 } 1740 else 1741 { 1742 vps.setNumAddLayerSets( m_numAddLayerSets ); 1743 if ( m_highestLayerIdxPlus1.size() < vps.getNumAddLayerSets() ) 1744 { 1745 fprintf(stderr, "\nError: Number of highestLayerIdxPlus1 parameters must be greater than or equal to NumAddLayerSets\n"); 1746 exit(EXIT_FAILURE); 1747 } 1748 1749 for (Int i = 0; i < vps.getNumAddLayerSets(); i++) 1750 { 1751 if ( m_highestLayerIdxPlus1[ i ].size() < vps.getNumIndependentLayers() ) 1752 { 1753 fprintf(stderr, "Error: Number of elements in highestLayerIdxPlus1[ %d ] parameters must be greater than or equal to NumIndependentLayers(= %d)\n", i, vps.getNumIndependentLayers()); 1754 exit(EXIT_FAILURE); 1755 } 1756 1757 for (Int j = 1; j < vps.getNumIndependentLayers(); j++) 1758 { 1759 if ( m_highestLayerIdxPlus1[ i ][ j ] < 0 || m_highestLayerIdxPlus1[ i ][ j ] > vps.getNumLayersInTreePartition( j ) ) 1760 { 1761 fprintf(stderr, "Error: highestLayerIdxPlus1[ %d ][ %d ] shall be in the range of 0 to NumLayersInTreePartition[ %d ] (= %d ), inclusive. \n", i, j, j, vps.getNumLayersInTreePartition( j ) ); 1762 exit(EXIT_FAILURE); 1763 } 1764 vps.setHighestLayerIdxPlus1( i, j, m_highestLayerIdxPlus1[ i ][ j ] ); 1765 } 1766 vps.deriveAddLayerSetLayerIdList( i ); 1767 } 1768 } 1769 #else 1612 1770 vps.setNumAddLayerSets ( 0 ); 1771 #endif 1613 1772 vps.setNumAddOlss ( numAddOuputLayerSets ); 1614 1773 vps.initTargetLayerIdLists(); 1615 1774 1775 #if H_MV_HLS10_ADD_LAYERSETS 1776 for (Int olsIdx = 0; olsIdx < vps.getNumLayerSets() + numAddOuputLayerSets; olsIdx++) 1777 { 1778 Int addOutLsIdx = olsIdx - vps.getNumLayerSets(); 1779 #else 1616 1780 for (Int olsIdx = 0; olsIdx < m_vpsNumLayerSets + numAddOuputLayerSets; olsIdx++) 1617 1781 { 1618 1782 Int addOutLsIdx = olsIdx - m_vpsNumLayerSets; 1619 1783 #endif 1620 1784 vps.setLayerSetIdxForOlsMinus1( olsIdx, ( ( addOutLsIdx < 0 ) ? olsIdx : m_outputLayerSetIdx[ addOutLsIdx ] ) - 1 ); 1621 1785 1786 #if H_MV_HLS10_ADD_LAYERSETS 1787 Int lsIdx = vps.olsIdxToLsIdx( olsIdx ); 1788 #else 1622 1789 std::vector<Int>& layerIdList = m_layerIdsInSets[ vps.olsIdxToLsIdx( olsIdx ) ]; 1623 1790 #endif 1624 1791 if (vps.getDefaultOutputLayerIdc() == 2 || addOutLsIdx >= 0 ) 1625 1792 { 1793 #if H_MV_HLS10_ADD_LAYERSETS 1794 for ( Int i = 0; i < vps.getNumLayersInIdList( lsIdx ); i++) 1795 #else 1626 1796 for ( Int i = 0; i < layerIdList.size(); i++) 1797 #endif 1627 1798 { 1628 1799 vps.setOutputLayerFlag( olsIdx, i, ( olsIdx == 0 && i == 0 ) ? vps.inferOutputLayerFlag(olsIdx, i ) : false ); // This is a software only fix for a bug in the spec. In spec outputLayerFlag neither present nor inferred for this case ! … … 1634 1805 for (Int j = 0; j < outLayerIdList.size(); j++) 1635 1806 { 1807 #if H_MV_HLS10_ADD_LAYERSETS 1808 for ( Int i = 0; i < vps.getNumLayersInIdList( lsIdx ); i++) 1809 { 1810 if ( vps.getLayerSetLayerIdList( lsIdx, i ) == outLayerIdList[ j ] ) 1811 #else 1636 1812 for (Int i = 0; i < layerIdList.size(); i++ ) 1637 1813 { 1638 1814 if ( layerIdList[ i ] == outLayerIdList[ j ] ) 1815 #endif 1639 1816 { 1640 1817 vps.setOutputLayerFlag( olsIdx, i, true ); … … 1643 1820 } 1644 1821 } 1645 assert( outputLayerInLayerSetFlag ); // The output layer is not not in the layer set. 1822 #if H_MV_HLS10_ADD_LAYERSETS 1823 if ( !outputLayerInLayerSetFlag ) 1824 { 1825 fprintf(stderr, "Error: Output layer %d in output layer set %d not in corresponding layer set %d \n", outLayerIdList[ j ], olsIdx , lsIdx ); 1826 exit(EXIT_FAILURE); 1827 } 1828 #else 1829 assert( outputLayerInLayerSetFlag ); // The output layer is not in the layer set. 1830 #endif 1646 1831 } 1647 1832 } 1648 1833 else 1649 1834 { 1835 #if H_MV_HLS10_ADD_LAYERSETS 1836 for ( Int i = 0; i < vps.getNumLayersInIdList( lsIdx ); i++) 1837 #else 1650 1838 for ( Int i = 0; i < layerIdList.size(); i++) 1839 #endif 1651 1840 { 1652 1841 vps.setOutputLayerFlag( olsIdx, i, vps.inferOutputLayerFlag( olsIdx, i ) ); … … 1654 1843 } 1655 1844 1845 #if H_MV_HLS10_NESSECARY_LAYER 1846 vps.deriveNecessaryLayerFlags( olsIdx ); 1847 #endif 1656 1848 vps.deriveTargetLayerIdList( olsIdx ); 1657 1849 1850 #if H_MV_HLS10_PTL 1851 // SET profile_tier_level_index. 1852 if ( olsIdx == 0 ) 1853 { 1854 vps.setProfileTierLevelIdx( 0, 0 , vps.getMaxLayersMinus1() > 0 ? 1 : 0 ); 1855 } 1856 else 1857 { 1858 Int lsIdx = vps.olsIdxToLsIdx( olsIdx ); 1859 if( (Int) m_profileTierLevelIdx[ olsIdx ].size() < vps.getNumLayersInIdList( lsIdx ) ) 1860 { 1861 fprintf( stderr, "Warning: Not enough profileTierLevelIdx values given for the %d-th OLS. Inferring default values.\n", olsIdx ); 1862 } 1863 for (Int j = 0; j < vps.getNumLayersInIdList( lsIdx ); j++) 1864 { 1865 if( j < (Int) m_profileTierLevelIdx[ olsIdx ].size() ) 1866 { 1867 vps.setProfileTierLevelIdx(olsIdx, j, m_profileTierLevelIdx[olsIdx][j] ); 1868 } 1869 else 1870 { 1871 // setting default values 1872 if ( j == 0 || vps.getVpsNumProfileTierLevelMinus1() < 1 ) 1873 { 1874 // set base layer as default 1875 vps.setProfileTierLevelIdx(olsIdx, j, 1 ); 1876 } 1877 else 1878 { 1879 // set VpsProfileTierLevel[2] as default 1880 vps.setProfileTierLevelIdx(olsIdx, j, 2 ); 1881 } 1882 } 1883 } 1884 } 1885 #else 1658 1886 if ( olsIdx > 0 ) 1659 1887 { 1660 1888 vps.setProfileLevelTierIdx( olsIdx, m_profileLevelTierIdx[ olsIdx ] ); 1661 1889 } 1890 #endif 1662 1891 1663 1892 if ( vps.getNumOutputLayersInOutputLayerSet( olsIdx ) == 1 && … … 1697 1926 if( pcVPSVUI->getBitRatePresentVpsFlag( ) || pcVPSVUI->getPicRatePresentVpsFlag( ) ) 1698 1927 { 1928 #if H_MV_HLS10_VPS_VUI 1929 for( Int i = 0; i < vps.getNumLayerSets(); i++ ) 1930 #else 1699 1931 for( Int i = 0; i <= vps.getVpsNumLayerSetsMinus1(); i++ ) 1932 #endif 1700 1933 { 1701 1934 for( Int j = 0; j <= vps.getMaxTLayers(); j++ ) … … 1746 1979 for( Int j = 0; j < vps.getNumDirectRefLayers( vps.getLayerIdInNuh( i ) ) ; j++ ) 1747 1980 { 1981 #if H_MV_HLS10_REF_PRED_LAYERS 1982 Int layerIdx = vps.getLayerIdInVps( vps.getIdDirectRefLayer(vps.getLayerIdInNuh( i ) , j )); 1983 #else 1748 1984 Int layerIdx = vps.getLayerIdInVps( vps.getRefLayerId(vps.getLayerIdInNuh( i ) , j )); 1985 #endif 1749 1986 if( pcVPSVUI->getTilesInUseFlag( i ) && pcVPSVUI->getTilesInUseFlag( layerIdx ) ) 1750 1987 { … … 1764 2001 } 1765 2002 } 2003 2004 #if H_MV_HLS10_VPS_VUI 2005 pcVPSVUI->setSingleLayerForNonIrapFlag( m_singleLayerForNonIrapFlag ); 2006 pcVPSVUI->setHigherLayerIrapSkipFlag( m_higherLayerIrapSkipFlag ); 2007 #endif 1766 2008 1767 2009 pcVPSVUI->setIlpRestrictedRefLayersFlag( m_ilpRestrictedRefLayersFlag );
Note: See TracChangeset for help on using the changeset viewer.