Changeset 903 in SHVCSoftware
- Timestamp:
- 10 Oct 2014, 18:22:03 (10 years ago)
- Location:
- branches/SHM-dev/source
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-dev/source/App/TAppEncoder/TAppEncTop.cpp
r897 r903 77 77 TComVPS* vps = m_acTEncTop[0].getVPS(); 78 78 79 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 80 vps->setVpsPocLsbAlignedFlag(false); 81 #endif 79 82 vps->setMaxTLayers ( m_maxTempLayer ); 80 83 if (m_maxTempLayer == 1) -
branches/SHM-dev/source/Lib/TLibCommon/TComSlice.cpp
r894 r903 129 129 , m_pocMsbVal ( 0 ) 130 130 , m_pocMsbValRequiredFlag ( false ) 131 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 132 , m_pocMsbValNeeded ( false ) 133 #endif 131 134 , m_pocMsbValPresentFlag ( false ) 132 135 #endif … … 220 223 #if POC_RESET_IDC_DECODER || POC_RESET_IDC_ENCODER 221 224 m_picOrderCntLsb = 0; 225 #endif 226 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 227 m_pocMsbValNeeded = false; 228 m_pocResetDeltaPoc = 0; 222 229 #endif 223 230 } … … 1932 1939 Int nrOfPositivePictures = 0; 1933 1940 TComReferencePictureSet* pcRPS = this->getLocalRPS(); 1941 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 1942 Bool pocsAdjusted = false; 1943 #endif 1934 1944 1935 1945 // loop through all pictures in the Reference Picture Set … … 1944 1954 rpcPic = *(iterPic++); 1945 1955 1956 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 1957 // poc adjustement by poc reset needs to be taken into account here 1958 Int deltaPOC = pReferencePictureSet->getDeltaPOC(i) - rpcPic->getPicSym()->getSlice(0)->getPocResetDeltaPoc(); 1959 if (rpcPic->getPicSym()->getSlice(0)->getPocResetDeltaPoc() != 0) 1960 { 1961 pocsAdjusted = true; 1962 } 1963 1964 if (rpcPic->getPicSym()->getSlice(0)->getPOC() == this->getPOC() + deltaPOC && rpcPic->getSlice(0)->isReferenced()) 1965 #else 1946 1966 if(rpcPic->getPicSym()->getSlice(0)->getPOC() == this->getPOC() + pReferencePictureSet->getDeltaPOC(i) && rpcPic->getSlice(0)->isReferenced()) 1967 #endif 1947 1968 { 1948 1969 // This picture exists as a reference picture 1949 1970 // and should be added to the explicit Reference Picture Set 1971 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 1972 pcRPS->setDeltaPOC(k, deltaPOC); 1973 #else 1950 1974 pcRPS->setDeltaPOC(k, pReferencePictureSet->getDeltaPOC(i)); 1975 #endif 1951 1976 pcRPS->setUsed(k, pReferencePictureSet->getUsed(i) && (!isRAP)); 1952 1977 #if ALLOW_RECOVERY_POINT_AS_RAP 1978 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 1979 pcRPS->setUsed(k, pcRPS->getUsed(k) && !(bUseRecoveryPoint && this->getPOC() > pocRandomAccess && this->getPOC() + deltaPOC < pocRandomAccess) ); 1980 #else 1953 1981 pcRPS->setUsed(k, pcRPS->getUsed(k) && !(bUseRecoveryPoint && this->getPOC() > pocRandomAccess && this->getPOC() + pReferencePictureSet->getDeltaPOC(i) < pocRandomAccess) ); 1982 #endif 1954 1983 #endif 1955 1984 if(pcRPS->getDeltaPOC(k) < 0) … … 1994 2023 #if EFFICIENT_FIELD_IRAP 1995 2024 || useNewRPS 2025 #endif 2026 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 2027 || pocsAdjusted // inter RPS prediction does not work if POCs have been adjusted 1996 2028 #endif 1997 2029 ) … … 2463 2495 #if P0307_VPS_NON_VUI_EXTENSION 2464 2496 , m_vpsNonVuiExtLength (0) 2497 #endif 2498 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 2499 , m_vpsPocLsbAlignedFlag(false) 2465 2500 #endif 2466 2501 { -
branches/SHM-dev/source/Lib/TLibCommon/TComSlice.h
r898 r903 697 697 Bool m_pocLsbNotPresentFlag[MAX_VPS_LAYER_ID_PLUS1]; 698 698 #endif 699 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 700 Bool m_vpsPocLsbAlignedFlag; 701 #endif 699 702 #if O0223_PICTURE_TYPES_ALIGN_FLAG 700 703 Bool m_crossLayerPictureTypeAlignFlag; … … 1135 1138 UInt getPocLsbNotPresentFlag(Int i) { return m_pocLsbNotPresentFlag[i]; } 1136 1139 Void setPocLsbNotPresentFlag(Int i, Bool x) { m_pocLsbNotPresentFlag[i] = x; } 1140 #endif 1141 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 1142 Bool getVpsPocLsbAlignedFlag() { return m_vpsPocLsbAlignedFlag; } 1143 Void setVpsPocLsbAlignedFlag(Bool x) { m_vpsPocLsbAlignedFlag = x; } 1137 1144 #endif 1138 1145 #if O0223_PICTURE_TYPES_ALIGN_FLAG … … 2317 2324 Bool m_fullPocResetFlag; 2318 2325 Int m_pocLsbVal; 2326 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 2327 Bool m_pocMsbValNeeded; 2328 Int m_pocResetDeltaPoc; 2329 #endif 2319 2330 Int m_pocMsbVal; 2320 2331 Bool m_pocMsbValRequiredFlag; … … 2702 2713 Int getPocLsbVal () { return m_pocLsbVal; } 2703 2714 Void setPocLsbVal (Int b) { m_pocLsbVal = b; } 2715 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 2716 Void setPocMsbNeeded (Bool x) { m_pocMsbValNeeded = x; } 2717 Bool getPocMsbNeeded () { return m_pocMsbValNeeded; } 2718 Int getPocResetDeltaPoc () { return m_pocResetDeltaPoc; } 2719 Void setPocResetDeltaPoc (Int x) { m_pocResetDeltaPoc = x; } 2720 #endif 2704 2721 Int getPocMsbVal () { return m_pocMsbVal; } 2705 2722 Void setPocMsbVal (Int b) { m_pocMsbVal = b; } -
branches/SHM-dev/source/Lib/TLibCommon/TypeDef.h
r900 r903 156 156 #define POC_RESET_RPS 1 ///< JCTVC-O0117 Modification to the decoding process for rps 157 157 #endif 158 159 #define P0297_VPS_POC_LSB_ALIGNED_FLAG 1 ///< JCTVC-P0297: vps_poc_lsb_aligned_flag for cross-layer POC anchor picture derivation 158 160 159 161 #define VPS_EXTN_MASK_AND_DIM_INFO 1 ///< Include avc_base_layer_flag, splitting_flag, scalability mask and dimension related info -
branches/SHM-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp
r902 r903 2033 2033 READ_FLAG(uiCode, "max_one_active_ref_layer_flag" ); 2034 2034 vps->setMaxOneActiveRefLayerFlag(uiCode); 2035 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 2036 READ_FLAG(uiCode, "vps_poc_lsb_aligned_flag"); 2037 vps->setVpsPocLsbAlignedFlag(uiCode); 2038 #endif 2035 2039 #if O0062_POC_LSB_NOT_PRESENT_FLAG 2036 2040 for(i = 1; i< vps->getMaxLayers(); i++) … … 2228 2232 } 2229 2233 2230 // vps_poc_lsb_aligned_flag 2231 // When not present, vps_poc_lsb_aligned_flag is inferred to be equal to 0. 2234 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 2235 vps->setVpsPocLsbAlignedFlag(false); 2236 #endif 2232 2237 2233 2238 #if O0062_POC_LSB_NOT_PRESENT_FLAG … … 3892 3897 3893 3898 // Derive the value of PocMsbValRequiredFlag 3894 rpcSlice->setPocMsbValRequiredFlag( rpcSlice->getCraPicFlag() || rpcSlice->getBlaPicFlag() 3895 /* || related to vps_poc_lsb_aligned_flag */ 3896 ); 3897 3898 if( !rpcSlice->getPocMsbValRequiredFlag() /* vps_poc_lsb_aligned_flag */ ) 3899 { 3900 READ_FLAG( uiCode, "poc_msb_val_present_flag"); rpcSlice->setPocMsbValPresentFlag( uiCode ? true : false ); 3899 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 3900 rpcSlice->setPocMsbValRequiredFlag( (rpcSlice->getCraPicFlag() || rpcSlice->getBlaPicFlag()) 3901 && (!rpcSlice->getVPS()->getVpsPocLsbAlignedFlag() || 3902 (rpcSlice->getVPS()->getVpsPocLsbAlignedFlag() && rpcSlice->getVPS()->getNumDirectRefLayers(rpcSlice->getLayerId()) == 0)) 3903 ); 3904 #else 3905 rpcSlice->setPocMsbValRequiredFlag( rpcSlice->getCraPicFlag() || rpcSlice->getBlaPicFlag() ); 3906 #endif 3907 3908 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 3909 if (!rpcSlice->getPocMsbValRequiredFlag() && rpcSlice->getVPS()->getVpsPocLsbAlignedFlag()) 3910 #else 3911 if (!rpcSlice->getPocMsbValRequiredFlag() /* vps_poc_lsb_aligned_flag */) 3912 #endif 3913 { 3914 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 3915 READ_FLAG(uiCode, "poc_msb_cycle_val_present_flag"); rpcSlice->setPocMsbValPresentFlag(uiCode ? true : false); 3916 #else 3917 READ_FLAG(uiCode, "poc_msb_val_present_flag"); rpcSlice->setPocMsbValPresentFlag(uiCode ? true : false); 3918 #endif 3901 3919 } 3902 3920 else … … 3925 3943 if( rpcSlice->getPocMsbValPresentFlag() ) 3926 3944 { 3945 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 3946 READ_UVLC( uiCode, "poc_msb_cycle_val"); rpcSlice->setPocMsbVal( uiCode ); 3947 #else 3927 3948 READ_UVLC( uiCode, "poc_msb_val"); rpcSlice->setPocMsbVal( uiCode ); 3949 #endif 3928 3950 3929 3951 #if !POC_RESET_IDC_DECODER -
branches/SHM-dev/source/Lib/TLibDecoder/TDecTop.cpp
r901 r903 120 120 resetPocRestrictionCheckParameters(); 121 121 #endif 122 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 123 m_pocResettingFlag = false; 124 m_pocDecrementedInDPBFlag = false; 125 #endif 122 126 } 123 127 … … 1176 1180 } 1177 1181 #endif 1182 1178 1183 #if POC_RESET_IDC_DECODER 1179 1184 if( m_parseIdc != -1 ) // Second pass for a POC resetting picture … … 1201 1206 #endif 1202 1207 markAllPicsAsNoCurrAu(); 1203 } 1208 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 1209 for (UInt i = 0; i < MAX_LAYERS; i++) 1210 { 1211 m_ppcTDecTop[i]->m_pocDecrementedInDPBFlag = false; 1212 } 1213 #endif 1214 } 1215 1216 1217 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 1218 m_pocResettingFlag = false; 1219 1220 if (m_apcSlicePilot->getPocResetIdc() != 0) 1221 { 1222 if (m_apcSlicePilot->getVPS()->getVpsPocLsbAlignedFlag()) 1223 { 1224 m_pocResettingFlag = true; 1225 } 1226 else if (m_pocDecrementedInDPBFlag) 1227 { 1228 m_pocResettingFlag = false; 1229 } 1230 else 1231 { 1232 m_pocResettingFlag = true; 1233 } 1234 } 1235 #endif 1204 1236 1205 1237 if( m_apcSlicePilot->getPocResetIdc() && m_apcSlicePilot->getSliceIdx() == 0 ) … … 1249 1281 #if ALIGNED_BUMPING 1250 1282 #if POC_RESET_IDC_DECODER 1283 1284 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 1285 UInt affectedLayerList[MAX_NUM_LAYER_IDS]; 1286 Int numAffectedLayers; 1287 1288 affectedLayerList[0] = m_apcSlicePilot->getLayerId(); 1289 numAffectedLayers = 1; 1290 1291 if (m_apcSlicePilot->getVPS()->getVpsPocLsbAlignedFlag()) 1292 { 1293 for (UInt j = 0; j < m_apcSlicePilot->getVPS()->getNumPredictedLayers(m_apcSlicePilot->getLayerId()); j++) 1294 { 1295 affectedLayerList[j + 1] = m_apcSlicePilot->getVPS()->getPredictedLayerId(m_apcSlicePilot->getLayerId(), j); 1296 } 1297 numAffectedLayers = m_apcSlicePilot->getVPS()->getNumPredictedLayers(m_apcSlicePilot->getLayerId()) + 1; 1298 } 1299 #endif 1300 1251 1301 //if( (bNewPOC || m_layerId != m_uiPrevLayerId) && ( m_parseIdc != 1) ) 1252 if( m_parseIdc == 1 ) 1302 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 1303 if (m_parseIdc == 1 && m_pocResettingFlag) 1304 #else 1305 if (m_parseIdc == 1) 1306 #endif 1253 1307 { 1254 1308 // Invoke output of pictures if the current picture is a POC reset picture … … 1301 1355 Int deltaPocVal = pocMsbDelta + pocLsbDelta; 1302 1356 1357 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 1358 for (UInt layerIdx = 0; layerIdx < numAffectedLayers; layerIdx++) 1359 { 1360 if (!m_ppcTDecTop[affectedLayerList[layerIdx]]->m_pocDecrementedInDPBFlag) 1361 { 1362 m_ppcTDecTop[affectedLayerList[layerIdx]]->m_pocDecrementedInDPBFlag = true; 1363 TComList<TComPic*>::iterator iterPic = m_ppcTDecTop[affectedLayerList[layerIdx]]->getListPic()->begin(); 1364 while (iterPic != m_ppcTDecTop[affectedLayerList[layerIdx]]->getListPic()->end()) 1365 #else 1303 1366 //Reset all POC for DPB -> basically do it for each slice in the picutre 1304 1367 TComList<TComPic*>::iterator iterPic = m_cListPic.begin(); … … 1306 1369 // Iterate through all picture in DPB 1307 1370 while( iterPic != m_cListPic.end() ) 1371 #endif 1308 1372 { 1309 1373 TComPic *dpbPic = *iterPic; 1310 1374 // Check if the picture pointed to by iterPic is either used for reference or 1311 1375 // needed for output, are in the same layer, and not the current picture. 1312 if( /* ( ( dpbPic->getSlice(0)->isReferenced() ) || ( dpbPic->getOutputMark() ) ) 1376 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 1377 assert(dpbPic->getLayerId() == affectedLayerList[layerIdx]); 1378 if ( (dpbPic->getReconMark()) && (dpbPic->getPicSym()->getSlice(0)->getPicOutputFlag()) ) 1379 #else 1380 if ( /* ( ( dpbPic->getSlice(0)->isReferenced() ) || ( dpbPic->getOutputMark() ) ) 1313 1381 &&*/ ( dpbPic->getLayerId() == m_apcSlicePilot->getLayerId() ) 1314 1382 && ( dpbPic->getReconMark() ) && ( dpbPic->getPicSym()->getSlice(0)->getPicOutputFlag() )) 1383 #endif 1315 1384 { 1316 1385 for(Int i = dpbPic->getNumAllocatedSlice()-1; i >= 0; i--) … … 1339 1408 iterPic++; 1340 1409 } 1410 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 1411 // Update the value of pocCRA 1412 m_ppcTDecTop[affectedLayerList[layerIdx]]->m_pocCRA -= deltaPocVal; 1413 } 1414 } 1415 #else 1341 1416 // Update the value of pocCRA 1342 1417 m_pocCRA -= deltaPocVal; 1418 #endif 1343 1419 1344 1420 // Update value of POCLastDisplay … … 1348 1424 Int slicePicOrderCntLsb = m_apcSlicePilot->getPicOrderCntLsb(); 1349 1425 1350 if( m_parseIdc == 1 || m_parseIdc == 2 ) // TODO This should be replaced by pocResettingFlag. 1426 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 1427 if (m_pocResettingFlag && (m_parseIdc == 1 || m_parseIdc == 2)) 1428 #else 1429 if (m_parseIdc == 1 || m_parseIdc == 2) // TODO This should be replaced by pocResettingFlag. 1430 #endif 1351 1431 { 1352 1432 // Set poc for current slice … … 1394 1474 && !m_apcSlicePilot->getDiscardableFlag() ) 1395 1475 { 1476 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 1477 for (UInt i = 0; i < numAffectedLayers; i++) 1478 { 1479 m_ppcTDecTop[affectedLayerList[i]]->setPrevPicOrderCnt(m_apcSlicePilot->getPOC()); 1480 } 1481 #else 1396 1482 this->setPrevPicOrderCnt( m_apcSlicePilot->getPOC() ); 1483 #endif 1397 1484 } 1398 1485 else if ( m_apcSlicePilot->getPocResetIdc() == 3 ) 1399 1486 { 1487 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 1488 if (!m_firstPicInLayerDecodedFlag || (m_firstPicInLayerDecodedFlag && m_pocResettingFlag)) 1489 { 1490 for (UInt i = 0; i < numAffectedLayers; i++) 1491 { 1492 m_ppcTDecTop[affectedLayerList[i]]->setPrevPicOrderCnt( m_apcSlicePilot->getFullPocResetFlag() 1493 ? 0 : m_apcSlicePilot->getPocLsbVal() ); 1494 } 1495 } 1496 #else 1400 1497 this->setPrevPicOrderCnt( m_apcSlicePilot->getFullPocResetFlag() 1401 1498 ? 0 : m_apcSlicePilot->getPocLsbVal() ); 1499 #endif 1402 1500 } 1403 1501 #else … … 2312 2410 // Decode a picture 2313 2411 m_cGopDecoder.decompressSlice(nalu.m_Bitstream, pcPic); 2412 2413 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 2414 setFirstPicInLayerDecodedFlag(true); 2415 #endif 2314 2416 2315 2417 m_bFirstSliceInPicture = false; -
branches/SHM-dev/source/Lib/TLibDecoder/TDecTop.h
r856 r903 127 127 UInt m_numLayer; 128 128 TDecTop** m_ppcTDecTop; 129 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 130 Bool m_pocResettingFlag; 131 Bool m_pocDecrementedInDPBFlag; 132 #endif 129 133 #if AVC_BASE 130 134 fstream* m_pBLReconFile; -
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.