Changeset 582 in SHVCSoftware for branches/SHM-5.0-dev/source
- Timestamp:
- 31 Jan 2014, 20:35:21 (11 years ago)
- Location:
- branches/SHM-5.0-dev/source
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-5.0-dev/source/App/TAppEncoder/TAppEncTop.cpp
r580 r582 1177 1177 vps->deriveLayerIdListVariables(); 1178 1178 #endif 1179 #if RESOLUTION_BASED_DPB 1180 vps->assignSubDpbIndices(); 1181 #else 1179 1182 vps->deriveNumberOfSubDpbs(); 1183 #endif 1180 1184 // Initialize dpb_size_table() for all ouput layer sets in the VPS extension 1181 1185 for(i = 1; i < vps->getNumOutputLayerSets(); i++) … … 1191 1195 Int maxNumReorderPics = -1; 1192 1196 #if CHANGE_NUMSUBDPB_IDX 1197 #if RESOLUTION_BASED_DPB 1198 for(Int k = 0; k < vps->getNumLayersInIdList(layerSetIdxForOutputLayerSet); k++) 1199 #else 1193 1200 for(Int k = 0; k < vps->getNumSubDpbs(layerSetIdxForOutputLayerSet); k++) 1201 #endif 1194 1202 #else 1195 1203 for(Int k = 0; k < vps->getNumSubDpbs(i); k++) … … 1197 1205 { 1198 1206 Int layerId = vps->getLayerSetLayerIdList(layerSetId, k); // k-th layer in the output layer set 1207 #if RESOLUTION_BASED_DPB 1208 vps->setMaxVpsLayerDecPicBuffMinus1( i, k, j, m_acTEncTop[layerId].getMaxDecPicBuffering(j) - 1 ); 1209 // Add sub-DPB sizes of layers belonging to a sub-DPB. If a different sub-DPB size is calculated 1210 // at the encoder, modify below 1211 Int oldValue = vps->getMaxVpsDecPicBufferingMinus1( i, vps->getSubDpbAssigned( layerSetIdxForOutputLayerSet, k ), j ); 1212 oldValue += vps->getMaxVpsLayerDecPicBuffMinus1( i, k, j ); 1213 vps->setMaxVpsDecPicBufferingMinus1( i, vps->getSubDpbAssigned( layerSetIdxForOutputLayerSet, k ), j, oldValue ); 1214 #else 1199 1215 vps->setMaxVpsDecPicBufferingMinus1( i, k, j, m_acTEncTop[layerId].getMaxDecPicBuffering(j) - 1 ); 1216 #endif 1200 1217 maxNumReorderPics = std::max( maxNumReorderPics, m_acTEncTop[layerId].getNumReorderPics(j)); 1201 1218 } -
branches/SHM-5.0-dev/source/Lib/TLibCommon/TComSlice.cpp
r580 r582 1937 1937 , m_bitDepthVpsChroma (0) 1938 1938 {} 1939 #if RESOLUTION_BASED_DPB 1940 Void RepFormat::init() 1941 { 1942 m_chromaFormatVpsIdc = CHROMA_420; 1943 m_separateColourPlaneVpsFlag = false; 1944 m_picWidthVpsInLumaSamples = 0; 1945 m_picHeightVpsInLumaSamples = 0; 1946 m_bitDepthVpsLuma = 0; 1947 m_bitDepthVpsChroma = 0; 1948 } 1949 #endif 1939 1950 #endif 1940 1951 … … 2126 2137 ::memset( m_subLayerDpbInfoPresentFlag, 0, sizeof(m_subLayerDpbInfoPresentFlag ) ); 2127 2138 ::memset( m_maxVpsDecPicBufferingMinus1, 0, sizeof(m_maxVpsDecPicBufferingMinus1 ) ); 2139 #if RESOLUTION_BASED_DPB 2140 ::memset( m_maxVpsLayerDecPicBuffMinus1, 0, sizeof(m_maxVpsLayerDecPicBuffMinus1 ) ); 2141 #endif 2128 2142 ::memset( m_maxVpsNumReorderPics, 0, sizeof(m_maxVpsNumReorderPics ) ); 2129 2143 ::memset( m_maxVpsLatencyIncreasePlus1, 0, sizeof(m_maxVpsLatencyIncreasePlus1 ) ); … … 2182 2196 } 2183 2197 #endif 2198 #if !RESOLUTION_BASED_DPB 2184 2199 #if VPS_DPB_SIZE_TABLE 2185 2200 Void TComVPS::deriveNumberOfSubDpbs() … … 2205 2220 } 2206 2221 #endif 2222 #endif 2207 2223 #if VPS_VUI_TILES_NOT_IN_USE__FLAG 2208 2224 Void TComVPS::setTilesNotInUseFlag(Bool x) … … 2329 2345 checkFlagInner[j] |= ( getMaxVpsNumReorderPics(i, j) != getMaxVpsNumReorderPics(i, j - 1) ); 2330 2346 #if CHANGE_NUMSUBDPB_IDX 2331 for(Int k = 0; k < getNumSubDpbs(layerSetIdxForOutputLayerSet) && !checkFlagInner[j]; k++) // If checkFlagInner[j] is true, break and signal the values2347 for(Int subDpbIdx = 0; subDpbIdx < getNumSubDpbs(layerSetIdxForOutputLayerSet) && !checkFlagInner[j]; subDpbIdx++) // If checkFlagInner[j] is true, break and signal the values 2332 2348 #else 2333 2349 for(Int k = 0; k < getNumSubDpbs(i) && !checkFlagInner[j]; k++) // If checkFlagInner[j] is true, break and signal the values 2334 2350 #endif 2335 2351 { 2336 checkFlagInner[j] |= ( getMaxVpsDecPicBufferingMinus1(i, k, j - 1) != getMaxVpsDecPicBufferingMinus1(i, k, j) );2352 checkFlagInner[j] |= ( getMaxVpsDecPicBufferingMinus1(i, subDpbIdx, j - 1) != getMaxVpsDecPicBufferingMinus1(i, subDpbIdx, j) ); 2337 2353 } 2354 #if RESOLUTION_BASED_DPB 2355 for(Int layerIdx = 0; layerIdx < this->getNumLayersInIdList(layerSetIdxForOutputLayerSet) && !checkFlagInner[j]; layerIdx++) // If checkFlagInner[j] is true, break and signal the values 2356 { 2357 checkFlagInner[j] |= ( getMaxVpsLayerDecPicBuffMinus1(i, layerIdx, j - 1) != getMaxVpsLayerDecPicBuffMinus1(i, layerIdx, j) ); 2358 } 2359 #endif 2338 2360 } 2339 2361 // If checkFlagInner[j] = true, then some value needs to be signalled for the j-th sub-layer … … 2355 2377 setSubLayerFlagInfoPresentFlag( i, checkFlagOuter ); 2356 2378 } 2379 } 2380 #endif 2381 #if RESOLUTION_BASED_DPB 2382 Void TComVPS::assignSubDpbIndices() 2383 { 2384 RepFormat layerRepFormat [MAX_LAYERS]; 2385 RepFormat subDpbRepFormat [MAX_LAYERS]; 2386 2387 for(Int lsIdx = 0; lsIdx < this->getNumLayerSets(); lsIdx++) 2388 { 2389 for(Int j = 0; j < MAX_LAYERS; j++) 2390 { 2391 layerRepFormat [j].init(); 2392 subDpbRepFormat[j].init(); 2393 } 2394 2395 // Assign resolution, bit-depth, colour format for each layer in the layer set 2396 for(Int i = 0; i < this->getNumLayersInIdList( lsIdx ); i++) 2397 { 2398 Int layerIdxInVps = this->getLayerIdInVps( this->getLayerSetLayerIdList(lsIdx, i) ); 2399 Int repFormatIdx = this->getVpsRepFormatIdx( layerIdxInVps ); 2400 RepFormat* repFormat = this->getVpsRepFormat( repFormatIdx ); 2401 2402 // Assign the rep_format() to the layer 2403 layerRepFormat[i] = *repFormat; 2404 } 2405 2406 // ---------------------------------------- 2407 // Sub-DPB assignment 2408 // ---------------------------------------- 2409 // For the base layer 2410 m_subDpbAssigned[lsIdx][0] = 0; 2411 subDpbRepFormat[0] = layerRepFormat[0]; 2412 2413 // Sub-DPB counter 2414 Int subDpbCtr = 1; 2415 2416 for(Int i = 1; i < this->getNumLayersInIdList( lsIdx ); i++) 2417 { 2418 Bool newSubDpbFlag = true; 2419 for(Int j = 0; (j < subDpbCtr) && (newSubDpbFlag); j++) 2420 { 2421 if( RepFormat::checkSameSubDpb( layerRepFormat[i], subDpbRepFormat[j] ) ) 2422 { 2423 // Belong to i-th sub-DPB 2424 m_subDpbAssigned[lsIdx][i] = j; 2425 newSubDpbFlag = false; 2426 } 2427 } 2428 if( newSubDpbFlag ) 2429 { 2430 // New sub-DPB 2431 subDpbRepFormat[subDpbCtr] = layerRepFormat[i]; 2432 m_subDpbAssigned[lsIdx][i] = subDpbCtr; 2433 subDpbCtr++; // Increment # subDpbs 2434 } 2435 } 2436 m_numSubDpbs[lsIdx] = subDpbCtr; 2437 } 2438 } 2439 Int TComVPS::findLayerIdxInLayerSet ( Int lsIdx, Int nuhLayerId ) 2440 { 2441 for(Int i = 0; i < this->getNumLayersInIdList(lsIdx); i++) 2442 { 2443 if( this->getLayerSetLayerIdList( lsIdx, i) == nuhLayerId ) 2444 { 2445 return i; 2446 } 2447 } 2448 return -1; // Layer not found 2449 } 2450 // RepFormat Assignment operator 2451 RepFormat& RepFormat::operator= (const RepFormat &other) 2452 { 2453 if( this != &other) 2454 { 2455 m_chromaAndBitDepthVpsPresentFlag = other.m_chromaAndBitDepthVpsPresentFlag; 2456 m_chromaFormatVpsIdc = other.m_chromaFormatVpsIdc; 2457 m_separateColourPlaneVpsFlag = other.m_separateColourPlaneVpsFlag; 2458 m_picWidthVpsInLumaSamples = other.m_picWidthVpsInLumaSamples; 2459 m_picHeightVpsInLumaSamples = other.m_picHeightVpsInLumaSamples; 2460 m_bitDepthVpsLuma = other.m_bitDepthVpsLuma; 2461 m_bitDepthVpsChroma = other.m_bitDepthVpsChroma; 2462 } 2463 return *this; 2464 } 2465 2466 // Check whether x and y share the same resolution, chroma format and bit-depth. 2467 Bool RepFormat::checkSameSubDpb(const RepFormat &x, const RepFormat &y) 2468 { 2469 return ( (x.m_chromaFormatVpsIdc == y.m_chromaFormatVpsIdc) 2470 && (x.m_picWidthVpsInLumaSamples == y.m_picWidthVpsInLumaSamples) 2471 && (x.m_picHeightVpsInLumaSamples == y.m_picHeightVpsInLumaSamples) 2472 && (x.m_bitDepthVpsLuma == y.m_bitDepthVpsLuma) 2473 && (x.m_bitDepthVpsChroma == y.m_bitDepthVpsChroma) 2474 ); 2357 2475 } 2358 2476 #endif -
branches/SHM-5.0-dev/source/Lib/TLibCommon/TComSlice.h
r580 r582 422 422 public: 423 423 RepFormat(); 424 424 #if RESOLUTION_BASED_DPB 425 Void init(); 426 RepFormat& operator= (const RepFormat &); 427 static Bool checkSameSubDpb(const RepFormat &x, const RepFormat &y); 428 #endif 425 429 #if REPN_FORMAT_CONTROL_FLAG 426 430 Bool getChromaAndBitDepthVpsPresentFlag() { return m_chromaAndBitDepthVpsPresentFlag; } … … 650 654 Bool m_subLayerDpbInfoPresentFlag [MAX_VPS_OP_LAYER_SETS_PLUS1][MAX_LAYERS]; 651 655 Int m_maxVpsDecPicBufferingMinus1 [MAX_VPS_OP_LAYER_SETS_PLUS1][MAX_LAYERS][MAX_TLAYER]; 656 #if RESOLUTION_BASED_DPB 657 Int m_maxVpsLayerDecPicBuffMinus1 [MAX_VPS_OP_LAYER_SETS_PLUS1][MAX_LAYERS][MAX_TLAYER]; 658 #endif 652 659 Int m_maxVpsNumReorderPics [MAX_VPS_OP_LAYER_SETS_PLUS1][MAX_LAYERS]; 653 660 Int m_maxVpsLatencyIncreasePlus1 [MAX_VPS_OP_LAYER_SETS_PLUS1][MAX_LAYERS]; … … 670 677 #if P0307_VPS_NON_VUI_EXTENSION 671 678 Int m_vpsNonVuiExtLength; 679 #endif 680 #if RESOLUTION_BASED_DPB 681 Int m_subDpbAssigned [MAX_VPS_LAYER_SETS_PLUS1][MAX_LAYERS]; 672 682 #endif 673 683 #endif //SVC_EXTENSION … … 1020 1030 Void setMaxVpsDecPicBufferingMinus1(Int i, Int k, Int j, Int x) { m_maxVpsDecPicBufferingMinus1[i][k][j] = x; } 1021 1031 1032 #if RESOLUTION_BASED_DPB 1033 Int getMaxVpsLayerDecPicBuffMinus1(Int i, Int k, Int j) { assert(i != 0); return m_maxVpsLayerDecPicBuffMinus1[i][k][j]; } 1034 Void setMaxVpsLayerDecPicBuffMinus1(Int i, Int k, Int j, Int x) { m_maxVpsLayerDecPicBuffMinus1[i][k][j] = x; } 1035 #endif 1036 1022 1037 Int getMaxVpsNumReorderPics(Int i, Int j) { assert(i != 0); return m_maxVpsNumReorderPics[i][j]; } 1023 1038 Void setMaxVpsNumReorderPics(Int i, Int j, Int x) { m_maxVpsNumReorderPics[i][j] = x; } … … 1045 1060 Int getVpsNonVuiExtLength() { return m_vpsNonVuiExtLength; } 1046 1061 Void setVpsNonVuiExtLength(Int x) { m_vpsNonVuiExtLength = x; } 1062 #endif 1063 #if RESOLUTION_BASED_DPB 1064 Void assignSubDpbIndices(); 1065 Int getSubDpbAssigned (Int lsIdx, Int layerIdx) { return m_subDpbAssigned[lsIdx][layerIdx]; } 1066 Int findLayerIdxInLayerSet ( Int lsIdx, Int nuhLayerId ); 1047 1067 #endif 1048 1068 #endif //SVC_EXTENSION -
branches/SHM-5.0-dev/source/Lib/TLibCommon/TypeDef.h
r579 r582 57 57 #define VPS_EXTN_UEV_CODING 1 ///< JCTVC-P0306: Code some syntax elements as ue(v), and remove some syntax elements that duplicate behaviour 58 58 #define CHANGE_NUMSUBDPB_IDX 1 ///< Change index of NumSubDpb from output layer set to layer set, to be more aligned with the Spec 59 #define RESOLUTION_BASED_DPB 1 ///< JCTVC-P0192: Assign layers to sub-DPBs based on the rep_format() signaled in the VPS 59 60 #define O0109_O0199_FLAGS_TO_VUI 1 ///< JCTVC-O0109, O0199: move single_layer_for_non_irap_flag and higher_layer_flag to vps_vui 60 61 #define O0109_VIEW_ID_LEN 1 ///< JCTVC-O0109: view_id_len_minus1 to view_id_len, and add constraint (1<<view_id_len) is greater than or equal to NumViews -
branches/SHM-5.0-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp
r579 r582 1425 1425 } 1426 1426 #endif 1427 #if RESOLUTION_BASED_DPB 1428 vps->assignSubDpbIndices(); 1429 #endif 1427 1430 READ_FLAG(uiCode, "max_one_active_ref_layer_flag" ); 1428 1431 vps->setMaxOneActiveRefLayerFlag(uiCode); … … 1587 1590 { 1588 1591 UInt uiCode; 1592 #if !RESOLUTION_BASED_DPB 1589 1593 vps->deriveNumberOfSubDpbs(); 1594 #endif 1590 1595 for(Int i = 1; i < vps->getNumOutputLayerSets(); i++) 1591 1596 { … … 1622 1627 } 1623 1628 READ_UVLC( uiCode, "max_vps_num_reorder_pics[i][j]" ); vps->setMaxVpsNumReorderPics( i, j, uiCode); 1629 #if RESOLUTION_BASED_DPB 1630 if( vps->getNumSubDpbs(layerSetIdxForOutputLayerSet) != vps->getNumLayersInIdList( layerSetIdxForOutputLayerSet ) ) 1631 { 1632 for(Int k = 0; k < vps->getNumLayersInIdList( layerSetIdxForOutputLayerSet ); k++) 1633 { 1634 READ_UVLC( uiCode, "max_vps_layer_dec_pic_buff_minus1[i][k][j]" ); vps->setMaxVpsLayerDecPicBuffMinus1( i, k, j, uiCode); 1635 } 1636 } 1637 else // vps->getNumSubDpbs(layerSetIdxForOutputLayerSet) == vps->getNumLayersInIdList( layerSetIdxForOutputLayerSet ) 1638 { 1639 for(Int k = 0; k < vps->getNumLayersInIdList( layerSetIdxForOutputLayerSet ); k++) 1640 { 1641 vps->setMaxVpsLayerDecPicBuffMinus1( i, k, j, vps->getMaxVpsDecPicBufferingMinus1( i, k, j)); 1642 } 1643 } 1644 #endif 1624 1645 READ_UVLC( uiCode, "max_vps_latency_increase_plus1[i][j]" ); vps->setMaxVpsLatencyIncreasePlus1( i, j, uiCode); 1625 1646 } -
branches/SHM-5.0-dev/source/Lib/TLibDecoder/TDecTop.cpp
r567 r582 86 86 m_bRefreshPending = false; 87 87 #endif 88 #if RESOLUTION_BASED_DPB 89 m_subDpbIdx = -1; 90 #endif 88 91 } 89 92 … … 306 309 else 307 310 { 311 #if RESOLUTION_BASED_DPB 312 Int layerSetIdxForOutputLayerSet = pcSlice->getVPS()->getOutputLayerSetIdx( getCommonDecoderParams()->getOutputLayerSetIdx() ); 313 Int layerIdx = pcSlice->getVPS()->findLayerIdxInLayerSet( layerSetIdxForOutputLayerSet, pcSlice->getLayerId() ); assert( layerIdx != -1 ); 314 m_iMaxRefPicNum = pcSlice->getVPS()->getMaxVpsLayerDecPicBuffMinus1( getCommonDecoderParams()->getOutputLayerSetIdx(), layerIdx, pcSlice->getTLayer() ) + 1; // m_uiMaxDecPicBuffering has the space for the picture currently being decoded 315 #else 308 316 m_iMaxRefPicNum = pcSlice->getVPS()->getMaxVpsDecPicBufferingMinus1( getCommonDecoderParams()->getOutputLayerSetIdx(), pcSlice->getLayerId(), pcSlice->getTLayer() ) + 1; // m_uiMaxDecPicBuffering has the space for the picture currently being decoded 317 #endif 309 318 } 310 319 #else … … 816 825 // Following check should go wherever the VPS is activated 817 826 checkValueOfOutputLayerSetIdx( m_apcSlicePilot->getVPS()); 827 #endif 828 #if RESOLUTION_BASED_DPB 829 // Following assignment should go wherever a new VPS is activated 830 assignSubDpbs(m_apcSlicePilot->getVPS()); 818 831 #endif 819 832 m_apcSlicePilot->initSlice( nalu.m_layerId ); … … 2108 2121 } 2109 2122 #endif 2123 #if RESOLUTION_BASED_DPB 2124 Void TDecTop::assignSubDpbs(TComVPS *vps) 2125 { 2126 if( m_subDpbIdx == -1 ) // Sub-DPB index is not already assigned 2127 { 2128 Int lsIdx = vps->getOutputLayerSetIdx( getCommonDecoderParams()->getOutputLayerSetIdx() ); 2129 2130 Int layerIdx = vps->findLayerIdxInLayerSet( lsIdx, getLayerId() ); 2131 assert( layerIdx != -1 ); // Current layer should be found in the layer set. 2132 2133 // Copy from the active VPS based on the layer ID. 2134 m_subDpbIdx = vps->getSubDpbAssigned( lsIdx, layerIdx ); 2135 } 2136 } 2137 #endif 2110 2138 //! \} -
branches/SHM-5.0-dev/source/Lib/TLibDecoder/TDecTop.h
r562 r582 144 144 Bool m_bRefreshPending; 145 145 #endif 146 146 #if RESOLUTION_BASED_DPB 147 Int m_subDpbIdx; // Index to the sub-DPB that the layer belongs to. 148 // When new VPS is activated, this should be re-initialized to -1 149 #endif 147 150 public: 148 151 TDecTop(); … … 262 265 ParameterSetManagerDecoder* getParameterSetManager() { return &m_parameterSetManagerDecoder; } 263 266 #endif 267 #if RESOLUTION_BASED_DPB 268 Void setSubDpbIdx(Int idx) { m_subDpbIdx = idx; } 269 Int getSubDpbIdx() { return m_subDpbIdx; } 270 Void assignSubDpbs(TComVPS *vps); 271 #endif 264 272 };// END CLASS DEFINITION TDecTop 265 273 -
branches/SHM-5.0-dev/source/Lib/TLibEncoder/TEncCavlc.cpp
r581 r582 1239 1239 } 1240 1240 WRITE_UVLC( vps->getMaxVpsNumReorderPics( i, j), "max_vps_num_reorder_pics[i][j]" ); 1241 #if RESOLUTION_BASED_DPB 1242 if( vps->getNumSubDpbs(layerSetIdxForOutputLayerSet) != vps->getNumLayersInIdList( layerSetIdxForOutputLayerSet ) ) // NumSubDpbs 1243 { 1244 for(Int k = 0; k < vps->getNumLayersInIdList( layerSetIdxForOutputLayerSet ); k++) 1245 { 1246 WRITE_UVLC( vps->getMaxVpsLayerDecPicBuffMinus1( i, k, j), "max_vps_layer_dec_pic_buff_minus1[i][k][j]" ); 1247 } 1248 } 1249 #endif 1241 1250 WRITE_UVLC( vps->getMaxVpsLatencyIncreasePlus1( i, j), "max_vps_latency_increase_plus1[i][j]" ); 1242 1251 }
Note: See TracChangeset for help on using the changeset viewer.