diff --git a/source/Lib/CommonLib/CommonDef.h b/source/Lib/CommonLib/CommonDef.h index 40bf83cdf6f154a87dc6a6b4daf46089be9c280e..d822beec11bf69e84b25424f2bb6c88fd034093d 100644 --- a/source/Lib/CommonLib/CommonDef.h +++ b/source/Lib/CommonLib/CommonDef.h @@ -221,8 +221,12 @@ static const int NUM_APS_TYPE_LEN = 3; //Curren static const int MAX_NUM_APS_TYPE = 8; //Currently APS Type has 3 bits so the max type is 8 static const int MAX_TILE_COLS = 20; ///< Maximum number of tile columns +#if JVET_S0156_LEVEL_DEFINITION +static const int MAX_TILES = 440; ///< Maximum number of tiles +#else static const int MAX_TILE_ROWS = 22; ///< Maximum number of tile rows static const int MAX_TILES = MAX_TILE_COLS * MAX_TILE_ROWS; ///< Maximum number of tiles +#endif static const int MAX_SLICES = 600; ///< Maximum number of slices per picture static const int MLS_GRP_NUM = 1024; ///< Max number of coefficient groups, max(16, 256) diff --git a/source/Lib/CommonLib/ProfileLevelTier.cpp b/source/Lib/CommonLib/ProfileLevelTier.cpp index f1e388155050db7383a49dd720abf820f72599c7..a739eeedaac9a53539cf8be132ba777c3235dbfd 100644 --- a/source/Lib/CommonLib/ProfileLevelTier.cpp +++ b/source/Lib/CommonLib/ProfileLevelTier.cpp @@ -63,8 +63,8 @@ static const LevelTierFeatures mainLevelTierInfo[] = { Level::LEVEL2_1, 245760, { 3000, 0 }, 20, 1, 1, 7372800ULL, { 3000, 0 }, { 2, 2} }, { Level::LEVEL3 , 552960, { 6000, 0 }, 30, 4, 2, 16588800ULL, { 6000, 0 }, { 2, 2} }, { Level::LEVEL3_1, 983040, { 10000, 0 }, 40, 9, 3, 33177600ULL, { 10000, 0 }, { 2, 2} }, - { Level::LEVEL4 , 2228224, { 12000, 30000 }, 75, 2, 5, 66846720ULL, { 12000, 30000 }, { 4, 4} }, - { Level::LEVEL4_1, 2228224, { 20000, 50000 }, 75, 2, 5, 133693440ULL, { 20000, 50000 }, { 4, 4} }, + { Level::LEVEL4 , 2228224, { 12000, 30000 }, 75, 25, 5, 66846720ULL, { 12000, 30000 }, { 4, 4} }, + { Level::LEVEL4_1, 2228224, { 20000, 50000 }, 75, 25, 5, 133693440ULL, { 20000, 50000 }, { 4, 4} }, { Level::LEVEL5 , 8912896, { 25000, 100000 }, 200, 110, 10, 267386880ULL, { 25000, 100000 }, { 6, 4} }, { Level::LEVEL5_1, 8912896, { 40000, 160000 }, 200, 110, 10, 534773760ULL, { 40000, 160000 }, { 8, 4} }, { Level::LEVEL5_2, 8912896, { 60000, 240000 }, 200, 110, 10, 1069547520ULL, { 60000, 240000 }, { 8, 4} }, diff --git a/source/Lib/CommonLib/Slice.cpp b/source/Lib/CommonLib/Slice.cpp index ea26893935aa4f0ba3b57543fc31dc57103c985f..abebc1b8b2f4ba8ce2df41bb42fac9e0c2709160 100644 --- a/source/Lib/CommonLib/Slice.cpp +++ b/source/Lib/CommonLib/Slice.cpp @@ -3097,7 +3097,9 @@ void PPS::initTiles() uint32_t uniformTileRowHeight = m_tileRowHeight[rowIdx - 1]; while( remainingHeightInCtu > 0 ) { +#if !JVET_S0156_LEVEL_DEFINITION CHECK(rowIdx >= MAX_TILE_ROWS, "Number of tile rows exceeds valid range"); +#endif uniformTileRowHeight = std::min(remainingHeightInCtu, uniformTileRowHeight); m_tileRowHeight.push_back( uniformTileRowHeight ); remainingHeightInCtu -= uniformTileRowHeight; diff --git a/source/Lib/CommonLib/Slice.h b/source/Lib/CommonLib/Slice.h index a2fc4d66da40eaa755570f16430368a3bc0088aa..580d316849f2b0ea46df608297fc93d7d5ec6445 100644 --- a/source/Lib/CommonLib/Slice.h +++ b/source/Lib/CommonLib/Slice.h @@ -2151,7 +2151,11 @@ public: void setTileColumnWidths( std::vector<uint32_t> widths ) { m_tileColWidth = widths; } void setTileRowHeights( std::vector<uint32_t> heights ) { m_tileRowHeight = heights; } void addTileColumnWidth( uint32_t u ) { CHECK( m_tileColWidth.size() >= MAX_TILE_COLS, "Number of tile columns exceeds valid range" ); m_tileColWidth.push_back(u); } +#if JVET_S0156_LEVEL_DEFINITION + void addTileRowHeight( uint32_t u ) { m_tileRowHeight.push_back(u); } +#else void addTileRowHeight( uint32_t u ) { CHECK( m_tileRowHeight.size() >= MAX_TILE_ROWS, "Number of tile rows exceeds valid range" ); m_tileRowHeight.push_back(u); } +#endif uint32_t getTileColumnWidth( int idx ) const { CHECK( idx >= m_tileColWidth.size(), "Tile column index exceeds valid range" ); return m_tileColWidth[idx]; } uint32_t getTileRowHeight( int idx ) const { CHECK( idx >= m_tileRowHeight.size(), "Tile row index exceeds valid range" ); return m_tileRowHeight[idx]; } uint32_t getTileColumnBd( int idx ) const { CHECK( idx >= m_tileColBd.size(), "Tile column index exceeds valid range" ); return m_tileColBd[idx]; } diff --git a/source/Lib/DecoderLib/DecLib.cpp b/source/Lib/DecoderLib/DecLib.cpp index 1797fb5cfac502bbf64cb5b6ca60bed42eb773e9..f5664bfd099ac8cf5a4c3f14cd3d08db9630e5e1 100644 --- a/source/Lib/DecoderLib/DecLib.cpp +++ b/source/Lib/DecoderLib/DecLib.cpp @@ -42,6 +42,7 @@ #include "CommonLib/dtrace_buffer.h" #include "CommonLib/Buffer.h" #include "CommonLib/UnitTools.h" +#include "CommonLib/ProfileLevelTier.h" #include <fstream> #include <set> @@ -1857,6 +1858,13 @@ void DecLib::xCheckParameterSetConstraints(const int layerId) { CHECK( !sps->getPtlDpbHrdParamsPresentFlag(), "When sps_video_parameter_set_id is greater than 0 and there is an OLS that contains only one layer with nuh_layer_id equal to the nuh_layer_id of the SPS, the value of sps_ptl_dpb_hrd_params_present_flag shall be equal to 1" ); } + +#if JVET_S0156_LEVEL_DEFINITION + ProfileLevelTierFeatures ptlFeature; + ptlFeature.extractPTLInformation(*sps); + CHECK(pps->getNumTileColumns() > ptlFeature.getLevelTierFeatures()->maxTileCols, "Num tile columns signaled in PPS exceed level limits"); + CHECK(pps->getNumTiles() > ptlFeature.getLevelTierFeatures()->maxTilesPerAu, "Num tiles signaled in PPS exceed level limits"); +#endif } diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp index 358541238576343cea618bfe4757115b305a8f83..d53a40127368eead0e7810ec4b3c8e3fa4170137 100644 --- a/source/Lib/DecoderLib/VLCReader.cpp +++ b/source/Lib/DecoderLib/VLCReader.cpp @@ -500,7 +500,9 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS ) READ_UVLC( uiCode, "num_exp_tile_columns_minus1" ); pcPPS->setNumExpTileColumns( uiCode + 1 ); READ_UVLC( uiCode, "num_exp_tile_rows_minus1" ); pcPPS->setNumExpTileRows( uiCode + 1 ); CHECK(pcPPS->getNumExpTileColumns() > MAX_TILE_COLS, "Number of explicit tile columns exceeds valid range"); +#if !JVET_S0156_LEVEL_DEFINITION CHECK(pcPPS->getNumExpTileRows() > MAX_TILE_ROWS, "Number of explicit tile rows exceeds valid range"); +#endif // tile sizes for( colIdx = 0; colIdx < pcPPS->getNumExpTileColumns(); colIdx++ )