Changeset 1199 in SHVCSoftware
- Timestamp:
- 8 Jul 2015, 20:02:01 (9 years ago)
- Location:
- branches/SHM-dev/source
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-dev/source/App/TAppEncoder/TAppEncTop.cpp
r1198 r1199 80 80 TComVPS* vps = m_acTEncTop[0].getVPS(); 81 81 82 #if P0297_VPS_POC_LSB_ALIGNED_FLAG83 82 vps->setVpsPocLsbAlignedFlag(false); 84 #endif 83 85 84 vps->setMaxTLayers ( m_maxTempLayer ); 86 85 if (m_maxTempLayer == 1) -
branches/SHM-dev/source/Lib/TLibCommon/TComSlice.cpp
r1198 r1199 134 134 , m_pocMsbValRequiredFlag ( false ) 135 135 , m_pocMsbValPresentFlag ( false ) 136 #if P0297_VPS_POC_LSB_ALIGNED_FLAG137 136 , m_pocMsbValNeeded ( false ) 138 #endif139 137 #endif 140 138 #if POC_RESET_IDC_DECODER || POC_RESET_IDC_ENCODER … … 235 233 m_picOrderCntLsb = 0; 236 234 #endif 237 #if P0297_VPS_POC_LSB_ALIGNED_FLAG238 235 m_pocMsbValNeeded = false; 239 236 m_pocResetDeltaPoc = 0; 240 #endif241 237 } 242 238 … … 1692 1688 Bool irapIsInRPS = false; 1693 1689 #endif 1694 #if P0297_VPS_POC_LSB_ALIGNED_FLAG1690 #if SVC_POC 1695 1691 Bool pocsAdjusted = false; 1696 1692 #endif … … 1707 1703 rpcPic = *(iterPic++); 1708 1704 1709 #if P0297_VPS_POC_LSB_ALIGNED_FLAG1705 #if SVC_POC 1710 1706 // poc adjustement by poc reset needs to be taken into account here 1711 1707 Int deltaPOC = pReferencePictureSet->getDeltaPOC(i) - rpcPic->getPicSym()->getSlice(0)->getPocResetDeltaPoc(); … … 1722 1718 // This picture exists as a reference picture 1723 1719 // and should be added to the explicit Reference Picture Set 1724 #if P0297_VPS_POC_LSB_ALIGNED_FLAG1720 #if SVC_POC 1725 1721 pcRPS->setDeltaPOC(k, deltaPOC); 1726 1722 #else … … 1729 1725 pcRPS->setUsed(k, pReferencePictureSet->getUsed(i) && (!isRAP)); 1730 1726 #if ALLOW_RECOVERY_POINT_AS_RAP 1731 #if P0297_VPS_POC_LSB_ALIGNED_FLAG1727 #if SVC_POC 1732 1728 pcRPS->setUsed(k, pcRPS->getUsed(k) && !(bUseRecoveryPoint && this->getPOC() > pocRandomAccess && this->getPOC() + deltaPOC < pocRandomAccess) ); 1733 1729 #else … … 1784 1780 || useNewRPS 1785 1781 #endif 1786 #if P0297_VPS_POC_LSB_ALIGNED_FLAG1782 #if SVC_POC 1787 1783 || pocsAdjusted // inter RPS prediction does not work if POCs have been adjusted 1788 1784 #endif … … 1946 1942 , m_viewIdLen (0) 1947 1943 , m_vpsNonVuiExtLength (0) 1948 #if P0297_VPS_POC_LSB_ALIGNED_FLAG1949 1944 , m_vpsPocLsbAlignedFlag(false) 1950 #endif1951 1945 { 1952 1946 for( Int i = 0; i < MAX_TLAYER; i++) -
branches/SHM-dev/source/Lib/TLibCommon/TComSlice.h
r1198 r1199 730 730 UInt m_baseLayerPSCompatibilityFlag[MAX_LAYERS]; 731 731 Int m_vpsNonVuiExtLength; 732 #if P0297_VPS_POC_LSB_ALIGNED_FLAG733 732 Bool m_vpsPocLsbAlignedFlag; 734 #endif735 733 std::vector< std::vector<Bool> > m_necessaryLayerFlag; 736 734 std::vector<Int> m_numNecessaryLayers; … … 942 940 UInt getPocLsbNotPresentFlag(Int i) { return m_pocLsbNotPresentFlag[i]; } 943 941 Void setPocLsbNotPresentFlag(Int i, Bool x) { m_pocLsbNotPresentFlag[i] = x; } 944 #if P0297_VPS_POC_LSB_ALIGNED_FLAG945 942 Bool getVpsPocLsbAlignedFlag() { return m_vpsPocLsbAlignedFlag; } 946 943 Void setVpsPocLsbAlignedFlag(Bool x) { m_vpsPocLsbAlignedFlag = x; } 947 #endif948 944 Bool getCrossLayerPictureTypeAlignFlag() { return m_crossLayerPictureTypeAlignFlag; } 949 945 Void setCrossLayerPictureTypeAlignFlag(Bool x) { m_crossLayerPictureTypeAlignFlag = x; } … … 2022 2018 Bool m_pocMsbValRequiredFlag; 2023 2019 Bool m_pocMsbValPresentFlag; 2024 #if P0297_VPS_POC_LSB_ALIGNED_FLAG2025 2020 Bool m_pocMsbValNeeded; 2026 2021 Int m_pocResetDeltaPoc; 2027 #endif2028 2022 #endif 2029 2023 #if POC_RESET_IDC_ENCODER … … 2375 2369 Int getPocLsbVal () { return m_pocLsbVal; } 2376 2370 Void setPocLsbVal (Int b) { m_pocLsbVal = b; } 2377 #if P0297_VPS_POC_LSB_ALIGNED_FLAG2378 2371 Void setPocMsbNeeded (Bool x) { m_pocMsbValNeeded = x; } 2379 2372 Bool getPocMsbNeeded () { return m_pocMsbValNeeded; } 2380 2373 Int getPocResetDeltaPoc () { return m_pocResetDeltaPoc; } 2381 2374 Void setPocResetDeltaPoc (Int x) { m_pocResetDeltaPoc = x; } 2382 #endif2383 2375 Int getPocMsbVal () { return m_pocMsbVal; } 2384 2376 Void setPocMsbVal (Int b) { m_pocMsbVal = b; } -
branches/SHM-dev/source/Lib/TLibCommon/TypeDef.h
r1198 r1199 85 85 #define REPN_FORMAT_IN_VPS 1 ///< JCTVC-N0092: Signal represenation format (spatial resolution, bit depth, colour format) in the VPS 86 86 #define SCALINGLIST_INFERRING 1 ///< JCTVC-N0371: inter-layer scaling list 87 #define P0297_VPS_POC_LSB_ALIGNED_FLAG 1 ///< JCTVC-P0297: vps_poc_lsb_aligned_flag for cross-layer POC anchor picture derivation88 87 89 88 #define AVC_BASE 1 ///< YUV BL reading for AVC base SVC 89 #define SVC_POC 1 ///< POC signalling and reset 90 90 91 91 #define REF_IDX_MFM 1 ///< JCTVC-L0336: motion vector mapping of inter-layer reference picture -
branches/SHM-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp
r1198 r1199 1969 1969 1970 1970 // Derive the value of PocMsbValRequiredFlag 1971 #if P0297_VPS_POC_LSB_ALIGNED_FLAG1972 1971 pcSlice->setPocMsbValRequiredFlag( (pcSlice->getCraPicFlag() || pcSlice->getBlaPicFlag()) 1973 1972 && (!pcSlice->getVPS()->getVpsPocLsbAlignedFlag() || 1974 1973 (pcSlice->getVPS()->getVpsPocLsbAlignedFlag() && pcSlice->getVPS()->getNumDirectRefLayers(pcSlice->getLayerId()) == 0)) 1975 1974 ); 1976 #else 1977 pcSlice->setPocMsbValRequiredFlag( pcSlice->getCraPicFlag() || pcSlice->getBlaPicFlag() ); 1978 #endif 1979 1980 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 1981 if (!pcSlice->getPocMsbValRequiredFlag() && pcSlice->getVPS()->getVpsPocLsbAlignedFlag()) 1982 #else 1983 if (!pcSlice->getPocMsbValRequiredFlag() /* vps_poc_lsb_aligned_flag */) 1984 #endif 1985 { 1986 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 1975 1976 if( !pcSlice->getPocMsbValRequiredFlag() && pcSlice->getVPS()->getVpsPocLsbAlignedFlag() ) 1977 { 1987 1978 READ_FLAG(uiCode, "poc_msb_cycle_val_present_flag"); pcSlice->setPocMsbValPresentFlag(uiCode ? true : false); 1988 #else1989 READ_FLAG(uiCode, "poc_msb_val_present_flag"); pcSlice->setPocMsbValPresentFlag(uiCode ? true : false);1990 #endif1991 1979 } 1992 1980 else … … 2007 1995 if( pcSlice->getPocMsbValPresentFlag() ) 2008 1996 { 2009 #if P0297_VPS_POC_LSB_ALIGNED_FLAG2010 1997 READ_UVLC( uiCode, "poc_msb_cycle_val"); pcSlice->setPocMsbVal( uiCode ); 2011 #else2012 READ_UVLC( uiCode, "poc_msb_val"); pcSlice->setPocMsbVal( uiCode );2013 #endif2014 1998 2015 1999 #if !POC_RESET_IDC_DECODER … … 3026 3010 READ_FLAG(uiCode, "max_one_active_ref_layer_flag" ); 3027 3011 vps->setMaxOneActiveRefLayerFlag(uiCode); 3028 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 3012 3029 3013 READ_FLAG(uiCode, "vps_poc_lsb_aligned_flag"); 3030 3014 vps->setVpsPocLsbAlignedFlag(uiCode); 3031 #endif 3032 3033 for(i = 1; i< vps->getMaxLayers(); i++) 3015 3016 for( i = 1; i< vps->getMaxLayers(); i++ ) 3034 3017 { 3035 3018 if( vps->getNumDirectRefLayers( vps->getLayerIdInNuh(i) ) == 0 ) … … 3177 3160 } 3178 3161 3179 #if P0297_VPS_POC_LSB_ALIGNED_FLAG3180 3162 vps->setVpsPocLsbAlignedFlag(false); 3181 #endif3182 3163 3183 3164 // When not present, poc_lsb_not_present_flag[ i ] is inferred to be equal to 0. -
branches/SHM-dev/source/Lib/TLibDecoder/TDecTop.cpp
r1191 r1199 124 124 resetPocRestrictionCheckParameters(); 125 125 #endif 126 #if P0297_VPS_POC_LSB_ALIGNED_FLAG127 126 m_pocResettingFlag = false; 128 127 m_pocDecrementedInDPBFlag = false; 129 #endif130 128 #if CONFORMANCE_BITSTREAM_MODE 131 129 m_confModeFlag = false; … … 909 907 #endif 910 908 markAllPicsAsNoCurrAu(m_apcSlicePilot->getVPS()); 911 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 912 for (UInt i = 0; i < MAX_LAYERS; i++)909 910 for( UInt i = 0; i < MAX_LAYERS; i++ ) 913 911 { 914 912 m_ppcTDecTop[m_apcSlicePilot->getVPS()->getLayerIdInNuh(i)]->m_pocDecrementedInDPBFlag = false; 915 913 } 916 #endif 917 } 918 919 920 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 914 } 915 921 916 m_pocResettingFlag = false; 922 917 923 if (m_apcSlicePilot->getPocResetIdc() != 0)924 { 925 if (m_apcSlicePilot->getVPS()->getVpsPocLsbAlignedFlag())918 if( m_apcSlicePilot->getPocResetIdc() != 0 ) 919 { 920 if( m_apcSlicePilot->getVPS()->getVpsPocLsbAlignedFlag() ) 926 921 { 927 922 m_pocResettingFlag = true; … … 936 931 } 937 932 } 938 #endif939 933 940 934 if( m_apcSlicePilot->getPocResetIdc() && m_apcSlicePilot->getSliceIdx() == 0 ) … … 984 978 #if ALIGNED_BUMPING 985 979 #if POC_RESET_IDC_DECODER 986 987 #if P0297_VPS_POC_LSB_ALIGNED_FLAG988 980 UInt affectedLayerList[MAX_LAYERS]; 989 981 Int numAffectedLayers; … … 992 984 numAffectedLayers = 1; 993 985 994 if (m_apcSlicePilot->getVPS()->getVpsPocLsbAlignedFlag())995 { 996 for (UInt j = 0; j < m_apcSlicePilot->getVPS()->getNumPredictedLayers(m_apcSlicePilot->getLayerId()); j++)986 if( m_apcSlicePilot->getVPS()->getVpsPocLsbAlignedFlag() ) 987 { 988 for( UInt j = 0; j < m_apcSlicePilot->getVPS()->getNumPredictedLayers(m_apcSlicePilot->getLayerId()); j++ ) 997 989 { 998 990 affectedLayerList[j + 1] = m_apcSlicePilot->getVPS()->getPredictedLayerId(m_apcSlicePilot->getLayerId(), j); … … 1000 992 numAffectedLayers = m_apcSlicePilot->getVPS()->getNumPredictedLayers(m_apcSlicePilot->getLayerId()) + 1; 1001 993 } 1002 #endif 1003 1004 //if( (bNewPOC || m_layerId != m_uiPrevLayerId) && ( m_parseIdc != 1) ) 1005 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 1006 if (m_parseIdc == 1 && m_pocResettingFlag) 1007 #else 1008 if (m_parseIdc == 1) 1009 #endif 994 995 if( m_parseIdc == 1 && m_pocResettingFlag ) 1010 996 { 1011 997 // Invoke output of pictures if the current picture is a POC reset picture … … 1013 999 /* Include reset of all POCs in the layer */ 1014 1000 1015 // This operation would do the following:1016 // 1. Update the other picture in the DPB. This should be done only for the first slice of the picture.1017 // 2. Update the value of m_pocCRA.1018 // 3. Reset the POC values at the decoder for the current picture to be zero - will be done later1019 // 4. update value of POCLastDisplay1020 1021 //Do the reset stuff here1001 // This operation would do the following: 1002 // 1. Update the other picture in the DPB. This should be done only for the first slice of the picture. 1003 // 2. Update the value of m_pocCRA. 1004 // 3. Reset the POC values at the decoder for the current picture to be zero - will be done later 1005 // 4. update value of POCLastDisplay 1006 1007 //Do the reset stuff here 1022 1008 Int maxPocLsb = 1 << m_apcSlicePilot->getSPS()->getBitsForPOC(); 1023 1009 Int pocLsbVal; … … 1032 1018 1033 1019 Int pocMsbDelta = 0; 1034 if 1020 if( m_apcSlicePilot->getPocMsbValPresentFlag() ) 1035 1021 { 1036 1022 pocMsbDelta = m_apcSlicePilot->getPocMsbVal() * maxPocLsb; … … 1058 1044 Int deltaPocVal = pocMsbDelta + pocLsbDelta; 1059 1045 1060 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 1061 for (UInt layerIdx = 0; layerIdx < numAffectedLayers; layerIdx++) 1046 for( UInt layerIdx = 0; layerIdx < numAffectedLayers; layerIdx++ ) 1062 1047 { 1063 1048 if (!m_ppcTDecTop[affectedLayerList[layerIdx]]->m_pocDecrementedInDPBFlag) … … 1065 1050 m_ppcTDecTop[affectedLayerList[layerIdx]]->m_pocDecrementedInDPBFlag = true; 1066 1051 TComList<TComPic*>::iterator iterPic = m_ppcTDecTop[affectedLayerList[layerIdx]]->getListPic()->begin(); 1052 1067 1053 while (iterPic != m_ppcTDecTop[affectedLayerList[layerIdx]]->getListPic()->end()) 1068 #else 1069 //Reset all POC for DPB -> basically do it for each slice in the picutre 1070 TComList<TComPic*>::iterator iterPic = m_cListPic.begin(); 1071 1072 // Iterate through all picture in DPB 1073 while( iterPic != m_cListPic.end() ) 1074 #endif 1075 { 1076 TComPic *dpbPic = *iterPic; 1077 // Check if the picture pointed to by iterPic is either used for reference or 1078 // needed for output, are in the same layer, and not the current picture. 1079 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 1080 assert(dpbPic->getLayerId() == affectedLayerList[layerIdx]); 1081 if ( (dpbPic->getReconMark()) && (dpbPic->getPicSym()->getSlice(0)->getPicOutputFlag()) ) 1082 #else 1083 if ( /* ( ( dpbPic->getSlice(0)->isReferenced() ) || ( dpbPic->getOutputMark() ) ) 1084 &&*/ ( dpbPic->getLayerId() == m_apcSlicePilot->getLayerId() ) 1085 && ( dpbPic->getReconMark() ) && ( dpbPic->getPicSym()->getSlice(0)->getPicOutputFlag() )) 1086 #endif 1087 { 1088 for(Int i = dpbPic->getNumAllocatedSlice()-1; i >= 0; i--) 1089 { 1090 1091 TComSlice *slice = dpbPic->getSlice(i); 1092 TComReferencePictureSet *rps = slice->getRPS(); 1093 slice->setPOC( slice->getPOC() - deltaPocVal ); 1094 1095 // Also adjust the POC value stored in the RPS of each such slice 1096 for(Int j = rps->getNumberOfPictures(); j >= 0; j--) 1054 { 1055 TComPic *dpbPic = *iterPic; 1056 // Check if the picture pointed to by iterPic is either used for reference or 1057 // needed for output, are in the same layer, and not the current picture. 1058 assert(dpbPic->getLayerId() == affectedLayerList[layerIdx]); 1059 1060 if( (dpbPic->getReconMark()) && (dpbPic->getPicSym()->getSlice(0)->getPicOutputFlag()) ) 1097 1061 { 1098 rps->setPOC( j, rps->getPOC(j) - deltaPocVal ); 1099 } 1100 // Also adjust the value of refPOC 1101 for(Int k = 0; k < 2; k++) // For List 0 and List 1 1102 { 1103 RefPicList list = (k == 1) ? REF_PIC_LIST_1 : REF_PIC_LIST_0; 1104 for(Int j = 0; j < slice->getNumRefIdx(list); j++) 1062 for(Int i = dpbPic->getNumAllocatedSlice()-1; i >= 0; i--) 1105 1063 { 1106 slice->setRefPOC( slice->getRefPOC(list, j) - deltaPocVal, list, j); 1064 1065 TComSlice *slice = dpbPic->getSlice(i); 1066 TComReferencePictureSet *rps = slice->getRPS(); 1067 slice->setPOC( slice->getPOC() - deltaPocVal ); 1068 1069 // Also adjust the POC value stored in the RPS of each such slice 1070 for(Int j = rps->getNumberOfPictures(); j >= 0; j--) 1071 { 1072 rps->setPOC( j, rps->getPOC(j) - deltaPocVal ); 1073 } 1074 // Also adjust the value of refPOC 1075 for(Int k = 0; k < 2; k++) // For List 0 and List 1 1076 { 1077 RefPicList list = (k == 1) ? REF_PIC_LIST_1 : REF_PIC_LIST_0; 1078 for(Int j = 0; j < slice->getNumRefIdx(list); j++) 1079 { 1080 slice->setRefPOC( slice->getRefPOC(list, j) - deltaPocVal, list, j); 1081 } 1082 } 1107 1083 } 1108 1084 } 1109 } 1110 } 1111 iterPic++; 1112 } 1113 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 1085 iterPic++; 1086 } 1114 1087 // Update the value of pocCRA 1115 1088 m_ppcTDecTop[affectedLayerList[layerIdx]]->m_pocCRA -= deltaPocVal; 1116 1089 } 1117 1090 } 1118 #else1119 // Update the value of pocCRA1120 m_pocCRA -= deltaPocVal;1121 #endif1122 1091 1123 1092 // Update value of POCLastDisplay … … 1127 1096 Int slicePicOrderCntLsb = m_apcSlicePilot->getPicOrderCntLsb(); 1128 1097 1129 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 1130 if (m_pocResettingFlag && (m_parseIdc == 1 || m_parseIdc == 2)) 1131 #else 1132 if (m_parseIdc == 1 || m_parseIdc == 2) // TODO This should be replaced by pocResettingFlag. 1133 #endif 1098 if( m_pocResettingFlag && (m_parseIdc == 1 || m_parseIdc == 2) ) 1134 1099 { 1135 1100 // Set poc for current slice … … 1172 1137 // Adjust prevPicOrderCnt 1173 1138 if( !m_apcSlicePilot->getRaslPicFlag() 1174 && !m_apcSlicePilot->getRadlPicFlag() 1175 && (m_apcSlicePilot->getNalUnitType() % 2 == 1) 1176 && ( nalu.m_temporalId == 0 ) 1177 && !m_apcSlicePilot->getDiscardableFlag() ) 1178 { 1179 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 1180 for (UInt i = 0; i < numAffectedLayers; i++) 1139 && !m_apcSlicePilot->getRadlPicFlag() 1140 && (m_apcSlicePilot->getNalUnitType() % 2 == 1) 1141 && ( nalu.m_temporalId == 0 ) 1142 && !m_apcSlicePilot->getDiscardableFlag() ) 1143 { 1144 for( UInt i = 0; i < numAffectedLayers; i++ ) 1181 1145 { 1182 1146 m_ppcTDecTop[affectedLayerList[i]]->setPrevPicOrderCnt(m_apcSlicePilot->getPOC()); 1183 1147 } 1184 #else 1185 this->setPrevPicOrderCnt( m_apcSlicePilot->getPOC() ); 1186 #endif 1187 } 1188 else if ( m_apcSlicePilot->getPocResetIdc() == 3 ) 1189 { 1190 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 1191 if (!m_firstPicInLayerDecodedFlag || (m_firstPicInLayerDecodedFlag && m_pocResettingFlag)) 1192 { 1193 for (UInt i = 0; i < numAffectedLayers; i++) 1194 { 1195 m_ppcTDecTop[affectedLayerList[i]]->setPrevPicOrderCnt( m_apcSlicePilot->getFullPocResetFlag() 1196 ? 0 : m_apcSlicePilot->getPocLsbVal() ); 1197 } 1198 } 1199 #else 1200 this->setPrevPicOrderCnt( m_apcSlicePilot->getFullPocResetFlag() 1201 ? 0 : m_apcSlicePilot->getPocLsbVal() ); 1202 #endif 1148 } 1149 else if( m_apcSlicePilot->getPocResetIdc() == 3 ) 1150 { 1151 if( !m_firstPicInLayerDecodedFlag || (m_firstPicInLayerDecodedFlag && m_pocResettingFlag) ) 1152 { 1153 for( UInt i = 0; i < numAffectedLayers; i++ ) 1154 { 1155 m_ppcTDecTop[affectedLayerList[i]]->setPrevPicOrderCnt( m_apcSlicePilot->getFullPocResetFlag() ? 0 : m_apcSlicePilot->getPocLsbVal() ); 1156 } 1157 } 1203 1158 } 1204 1159 #else … … 1947 1902 m_cGopDecoder.decompressSlice(nalu.m_Bitstream, m_pcPic); 1948 1903 1949 #if P0297_VPS_POC_LSB_ALIGNED_FLAG1904 #if SVC_EXTENSION 1950 1905 setFirstPicInLayerDecodedFlag(true); 1951 #endif1952 #if SVC_EXTENSION1953 1906 m_lastPicHasEos = false; 1954 1907 #endif -
branches/SHM-dev/source/Lib/TLibDecoder/TDecTop.h
r1177 r1199 132 132 TDecTop** m_ppcTDecTop; 133 133 UInt m_smallestLayerId; 134 #if P0297_VPS_POC_LSB_ALIGNED_FLAG135 134 Bool m_pocResettingFlag; 136 135 Bool m_pocDecrementedInDPBFlag; 137 #endif138 136 #if AVC_BASE 139 137 fstream* m_pBLReconFile; -
branches/SHM-dev/source/Lib/TLibEncoder/TEncCavlc.cpp
r1198 r1199 1844 1844 { 1845 1845 // Derive the value of PocMsbValRequiredFlag 1846 #if P0297_VPS_POC_LSB_ALIGNED_FLAG1847 1846 slice->setPocMsbValRequiredFlag( (slice->getCraPicFlag() || slice->getBlaPicFlag()) 1848 1847 && (!slice->getVPS()->getVpsPocLsbAlignedFlag() || 1849 1848 (slice->getVPS()->getVpsPocLsbAlignedFlag() && slice->getVPS()->getNumDirectRefLayers(slice->getLayerId()) == 0)) 1850 1849 ); 1851 #else1852 slice->setPocMsbValRequiredFlag( slice->getCraPicFlag() || slice->getBlaPicFlag() );1853 #endif1854 1850 1855 1851 // Determine value of SH extension length. … … 1868 1864 } 1869 1865 1870 1871 #if P0297_VPS_POC_LSB_ALIGNED_FLAG1872 1866 if (!slice->getPocMsbValRequiredFlag() && slice->getVPS()->getVpsPocLsbAlignedFlag()) 1873 #else1874 if (!slice->getPocMsbValRequiredFlag() /* && vps_poc_lsb_aligned_flag */)1875 #endif1876 1867 { 1877 1868 shExtnLengthInBit++; … … 1889 1880 } 1890 1881 1891 #if P0297_VPS_POC_LSB_ALIGNED_FLAG1892 1882 if (slice->getPocMsbNeeded()) 1893 1883 { 1894 1884 slice->setPocMsbValPresentFlag(true); 1895 1885 } 1896 #endif1897 1886 1898 1887 if (slice->getPocMsbValPresentFlag()) … … 1930 1919 } 1931 1920 1932 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 1933 if (!slice->getPocMsbValRequiredFlag() && slice->getVPS()->getVpsPocLsbAlignedFlag()) 1934 #else 1935 if (!slice->getPocMsbValRequiredFlag() /* && vps_poc_lsb_aligned_flag */) 1936 #endif 1937 { 1938 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 1921 if( !slice->getPocMsbValRequiredFlag() && slice->getVPS()->getVpsPocLsbAlignedFlag() ) 1922 { 1939 1923 WRITE_FLAG( slice->getPocMsbValPresentFlag(), "poc_msb_cycle_val_present_flag" ); 1940 #else 1941 WRITE_FLAG( slice->getPocMsbValPresentFlag(), "poc_msb_val_present_flag" ); 1942 #endif 1943 } 1944 if (slice->getPocMsbValPresentFlag()) 1924 } 1925 1926 if( slice->getPocMsbValPresentFlag() ) 1945 1927 { 1946 1928 assert(slice->getPocMsbVal() % maxPocLsb == 0); 1947 #if P0297_VPS_POC_LSB_ALIGNED_FLAG1948 1929 WRITE_UVLC(slice->getPocMsbVal() / maxPocLsb, "poc_msb_cycle_val"); 1949 #else 1950 WRITE_UVLC(slice->getPocMsbVal() / maxPocLsb, "poc_msb_val"); 1951 #endif 1952 } 1930 } 1931 1953 1932 for (Int i = 0; i < shExtnAdditionalBits; i++) 1954 1933 { … … 1956 1935 } 1957 1936 } 1937 1958 1938 shBitsWrittenTillNow += ( getNumberOfWrittenBits() - tmpBitsBeforeWriting ); 1959 1939 … … 2189 2169 2190 2170 WRITE_FLAG(vps->getMaxOneActiveRefLayerFlag(), "max_one_active_ref_layer_flag"); 2191 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 2171 2192 2172 WRITE_FLAG(vps->getVpsPocLsbAlignedFlag(), "vps_poc_lsb_aligned_flag"); 2193 #endif2194 2173 2195 2174 for( i = 1; i< vps->getMaxLayers(); i++ ) -
branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.cpp
r1185 r1199 49 49 #include <time.h> 50 50 #include <math.h> 51 #if P0297_VPS_POC_LSB_ALIGNED_FLAG51 #if SVC_EXTENSION 52 52 #include <limits.h> 53 53 #endif … … 1146 1146 determinePocResetIdc(pocCurr, pcSlice); 1147 1147 1148 #if P0297_VPS_POC_LSB_ALIGNED_FLAG1149 1148 Bool pocResettingFlag = false; 1150 1149 … … 1164 1163 } 1165 1164 } 1166 #endif1167 1165 1168 1166 // If reset, do the following steps: 1169 #if P0297_VPS_POC_LSB_ALIGNED_FLAG1170 1167 if( pocResettingFlag ) 1171 #else1172 if( pcSlice->getPocResetIdc() )1173 #endif1174 1168 { 1175 1169 updatePocValuesOfPics(pocCurr, pcSlice); … … 3457 3451 #if SVC_EXTENSION 3458 3452 pcPicYuvRecOut->setReconstructed(true); 3459 #endif3460 #if P0297_VPS_POC_LSB_ALIGNED_FLAG3461 3453 m_pcEncTop->setFirstPicInLayerDecodedFlag(true); 3462 3454 #endif 3455 3463 3456 pcPic->setReconMark ( true ); 3464 3457 m_bFirst = false; … … 4643 4636 #endif 4644 4637 4645 4646 4638 #if POC_RESET_IDC_ENCODER 4647 4639 Void TEncGOP::determinePocResetIdc(Int const pocCurr, TComSlice *const slice) … … 4650 4642 // If BL picture in the AU is IDR, and another picture is not IDR, set the poc_reset_idc to 2 4651 4643 // If BL picture is IRAP, and another picture is non-IRAP, then the poc_reset_idc is equal to 1 or 2. 4652 #if P0297_VPS_POC_LSB_ALIGNED_FLAG4653 4644 slice->setPocMsbNeeded(false); 4654 #endif 4645 4655 4646 if( slice->getSliceIdx() == 0 ) // First slice - compute, copy for other slices 4656 4647 { … … 4678 4669 } 4679 4670 } 4680 4671 4681 4672 if( !needReset )// No need reset due to base layer IRAP 4682 4673 { … … 4685 4676 { 4686 4677 Bool idrFlag = ( (m_ppcTEncTop[i]->getGOPEncoder()->getIntraRefreshType() == 2) 4687 4688 4678 && ( pocCurr % m_ppcTEncTop[i]->getGOPEncoder()->getIntraRefreshInterval() == 0 ) 4679 ); 4689 4680 for(Int j = 0; j < slice->getVPS()->getMaxLayers(); j++) 4690 4681 { … … 4695 4686 4696 4687 Bool idrOtherPicFlag = ( (m_ppcTEncTop[j]->getGOPEncoder()->getIntraRefreshType() == 2) 4697 4698 4688 && ( pocCurr % m_ppcTEncTop[j]->getGOPEncoder()->getIntraRefreshInterval() == 0 ) 4689 ); 4699 4690 4700 4691 if( idrFlag != idrOtherPicFlag ) … … 4713 4704 { 4714 4705 slice->setPocResetIdc( 2 ); // Full reset needed 4715 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 4716 if (slice->getVPS()->getVpsPocLsbAlignedFlag() && slice->getVPS()->getNumDirectRefLayers(slice->getLayerId()) == 0)4706 4707 if( slice->getVPS()->getVpsPocLsbAlignedFlag() && slice->getVPS()->getNumDirectRefLayers(slice->getLayerId()) == 0 ) 4717 4708 { 4718 4709 slice->setPocMsbNeeded(true); // Force msb writing 4719 4710 } 4720 #endif4721 4711 } 4722 4712 else … … 4736 4726 m_lastPocPeriodId = (periodId == m_lastPocPeriodId) ? (periodId + 1) % 64 : periodId ; 4737 4727 4738 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 4739 for (UInt i = 0; i < MAX_LAYERS; i++) 4728 for( UInt i = 0; i < MAX_LAYERS; i++ ) 4740 4729 { 4741 4730 m_ppcTEncTop[i]->setPocDecrementedInDPBFlag(false); 4742 4731 } 4743 #endif4744 4732 } 4745 4733 else … … 4758 4746 Void TEncGOP::updatePocValuesOfPics(Int const pocCurr, TComSlice *const slice) 4759 4747 { 4760 #if P0297_VPS_POC_LSB_ALIGNED_FLAG4761 4748 UInt affectedLayerList[MAX_NUM_LAYER_IDS]; 4762 4749 Int numAffectedLayers; … … 4773 4760 numAffectedLayers = m_pcEncTop->getVPS()->getNumPredictedLayers(m_layerId) + 1; 4774 4761 } 4775 #endif4776 4762 4777 4763 Int pocAdjustValue = pocCurr - m_pcEncTop->getPocAdjustmentValue(); … … 4782 4768 maxPocLsb = 1 << slice->getSPS()->getBitsForPOC(); 4783 4769 4784 #if P0297_VPS_POC_LSB_ALIGNED_FLAG4785 4770 Int adjustedPocValue = pocCurr; 4786 4771 4787 4772 if (m_pcEncTop->getFirstPicInLayerDecodedFlag()) 4788 4773 { 4789 #endif 4790 4791 pocLsbVal = (slice->getPocResetIdc() == 3) 4792 ? slice->getPocLsbVal() 4793 : pocAdjustValue % maxPocLsb; 4794 pocMsbDelta = pocAdjustValue - pocLsbVal; 4795 pocLsbDelta = (slice->getPocResetIdc() == 2 || ( slice->getPocResetIdc() == 3 && slice->getFullPocResetFlag() )) 4796 ? pocLsbVal 4797 : 0; 4798 deltaPocVal = pocMsbDelta + pocLsbDelta; 4799 4800 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 4801 Int origDeltaPocVal = deltaPocVal; // original value needed when updating POC adjustment value 4802 4803 if (slice->getPocMsbNeeded()) // IDR picture in base layer, non-IDR picture in other layers, poc_lsb_aligned_flag = 1 4804 { 4805 if (slice->getLayerId() == 0) 4806 { 4807 Int highestPoc = INT_MIN; 4808 // Find greatest POC in DPB for layer 0 4809 for (TComList<TComPic*>::iterator iterPic = m_pcEncTop->getListPic()->begin(); iterPic != m_pcEncTop->getListPic()->end(); ++iterPic) 4810 { 4811 TComPic *dpbPic = *iterPic; 4812 if (dpbPic->getReconMark() && dpbPic->getLayerId() == 0 && dpbPic->getPOC() > highestPoc) 4813 { 4814 highestPoc = dpbPic->getPOC(); 4815 } 4816 } 4817 deltaPocVal = (highestPoc - (highestPoc & (maxPocLsb - 1))) + 1*maxPocLsb; 4818 m_pcEncTop->setCurrPocMsb(deltaPocVal); 4819 } 4820 else 4821 { 4822 deltaPocVal = m_ppcTEncTop[0]->getCurrPocMsb(); // copy from base layer 4823 } 4824 slice->setPocMsbVal(deltaPocVal); 4825 } 4826 4827 for (UInt layerIdx = 0; layerIdx < numAffectedLayers; layerIdx++) 4828 { 4829 UInt lIdx = slice->getVPS()->getLayerIdxInVps(affectedLayerList[layerIdx]); 4830 4831 if (!m_ppcTEncTop[lIdx]->getPocDecrementedInDPBFlag()) 4832 { 4833 m_ppcTEncTop[lIdx]->setPocDecrementedInDPBFlag(true); 4834 4835 // Decrement value of associatedIrapPoc of the TEncGop object 4836 m_ppcTEncTop[lIdx]->getGOPEncoder()->m_associatedIRAPPOC -= deltaPocVal; 4837 4838 // Decrememnt the value of m_pocCRA 4839 m_ppcTEncTop[lIdx]->getGOPEncoder()->m_pocCRA -= deltaPocVal; 4840 4841 TComList<TComPic*>::iterator iterPic = m_ppcTEncTop[lIdx]->getListPic()->begin(); 4842 while (iterPic != m_ppcTEncTop[lIdx]->getListPic()->end()) 4843 #else 4844 // Decrement value of associatedIrapPoc of the TEncGop object 4845 this->m_associatedIRAPPOC -= deltaPocVal; 4846 4847 // Decrememnt the value of m_pocCRA 4848 this->m_pocCRA -= deltaPocVal; 4849 4850 // Iterate through all pictures in the DPB 4851 TComList<TComPic*>::iterator iterPic = getListPic()->begin(); 4852 while( iterPic != getListPic()->end() ) 4853 #endif 4854 { 4855 TComPic *dpbPic = *iterPic; 4856 4857 if( dpbPic->getReconMark() ) 4858 { 4859 for(Int i = dpbPic->getNumAllocatedSlice() - 1; i >= 0; i--) 4860 { 4861 TComSlice *dpbPicSlice = dpbPic->getSlice( i ); 4862 TComReferencePictureSet *dpbPicRps = dpbPicSlice->getRPS(); 4863 4864 // Decrement POC of slice 4865 dpbPicSlice->setPOC( dpbPicSlice->getPOC() - deltaPocVal ); 4866 4867 // Decrement POC value stored in the RPS of each such slice 4868 for( Int j = dpbPicRps->getNumberOfPictures() - 1; j >= 0; j-- ) 4869 { 4870 dpbPicRps->setPOC( j, dpbPicRps->getPOC(j) - deltaPocVal ); 4871 } 4872 4873 // Decrement value of refPOC 4874 dpbPicSlice->decrementRefPocValues( deltaPocVal ); 4875 4876 // Update value of associatedIrapPoc of each slice 4877 dpbPicSlice->setAssociatedIRAPPOC( dpbPicSlice->getAssociatedIRAPPOC() - deltaPocVal ); 4878 4879 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 4880 if (slice->getPocMsbNeeded()) 4881 { 4882 // this delta value is needed when computing delta POCs in reference picture set initialization 4883 dpbPicSlice->setPocResetDeltaPoc(dpbPicSlice->getPocResetDeltaPoc() + (deltaPocVal - pocLsbVal)); 4884 } 4885 #endif 4886 } 4887 } 4888 iterPic++; 4889 } 4890 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 4891 } 4892 } 4893 #endif 4894 4895 // Actual POC value before reset 4896 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 4897 adjustedPocValue = pocCurr - m_pcEncTop->getPocAdjustmentValue(); 4898 #else 4899 Int adjustedPocValue = pocCurr - m_pcEncTop->getPocAdjustmentValue(); 4900 #endif 4901 4902 // Set MSB value before reset 4903 Int tempLsbVal = adjustedPocValue & (maxPocLsb - 1); 4904 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 4905 if (!slice->getPocMsbNeeded()) // set poc msb normally if special msb handling is not needed 4906 { 4907 #endif 4908 slice->setPocMsbVal(adjustedPocValue - tempLsbVal); 4909 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 4910 } 4911 #endif 4912 4913 // Set LSB value before reset - this is needed in the case of resetIdc = 2 4914 slice->setPicOrderCntLsb( tempLsbVal ); 4915 4916 // Cumulative delta 4917 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 4918 deltaPocVal = origDeltaPocVal; // restore deltaPoc for correct adjustment value update 4919 #endif 4920 m_pcEncTop->setPocAdjustmentValue( m_pcEncTop->getPocAdjustmentValue() + deltaPocVal ); 4921 4922 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 4923 } 4924 #endif 4774 pocLsbVal = (slice->getPocResetIdc() == 3) 4775 ? slice->getPocLsbVal() 4776 : pocAdjustValue % maxPocLsb; 4777 pocMsbDelta = pocAdjustValue - pocLsbVal; 4778 pocLsbDelta = (slice->getPocResetIdc() == 2 || ( slice->getPocResetIdc() == 3 && slice->getFullPocResetFlag() )) 4779 ? pocLsbVal 4780 : 0; 4781 deltaPocVal = pocMsbDelta + pocLsbDelta; 4782 4783 Int origDeltaPocVal = deltaPocVal; // original value needed when updating POC adjustment value 4784 4785 // IDR picture in base layer, non-IDR picture in other layers, poc_lsb_aligned_flag = 1 4786 if( slice->getPocMsbNeeded() ) 4787 { 4788 if (slice->getLayerId() == 0) 4789 { 4790 Int highestPoc = INT_MIN; 4791 4792 // Find greatest POC in DPB for layer 0 4793 for (TComList<TComPic*>::iterator iterPic = m_pcEncTop->getListPic()->begin(); iterPic != m_pcEncTop->getListPic()->end(); ++iterPic) 4794 { 4795 TComPic *dpbPic = *iterPic; 4796 if (dpbPic->getReconMark() && dpbPic->getLayerId() == 0 && dpbPic->getPOC() > highestPoc) 4797 { 4798 highestPoc = dpbPic->getPOC(); 4799 } 4800 } 4801 deltaPocVal = (highestPoc - (highestPoc & (maxPocLsb - 1))) + 1*maxPocLsb; 4802 m_pcEncTop->setCurrPocMsb(deltaPocVal); 4803 } 4804 else 4805 { 4806 deltaPocVal = m_ppcTEncTop[0]->getCurrPocMsb(); // copy from base layer 4807 } 4808 slice->setPocMsbVal(deltaPocVal); 4809 } 4810 4811 for( UInt layerIdx = 0; layerIdx < numAffectedLayers; layerIdx++ ) 4812 { 4813 UInt lIdx = slice->getVPS()->getLayerIdxInVps(affectedLayerList[layerIdx]); 4814 4815 if( !m_ppcTEncTop[lIdx]->getPocDecrementedInDPBFlag() ) 4816 { 4817 m_ppcTEncTop[lIdx]->setPocDecrementedInDPBFlag(true); 4818 4819 // Decrement value of associatedIrapPoc of the TEncGop object 4820 m_ppcTEncTop[lIdx]->getGOPEncoder()->m_associatedIRAPPOC -= deltaPocVal; 4821 4822 // Decrememnt the value of m_pocCRA 4823 m_ppcTEncTop[lIdx]->getGOPEncoder()->m_pocCRA -= deltaPocVal; 4824 4825 TComList<TComPic*>::iterator iterPic = m_ppcTEncTop[lIdx]->getListPic()->begin(); 4826 while (iterPic != m_ppcTEncTop[lIdx]->getListPic()->end()) 4827 { 4828 TComPic *dpbPic = *iterPic; 4829 4830 if( dpbPic->getReconMark() ) 4831 { 4832 for( Int i = dpbPic->getNumAllocatedSlice() - 1; i >= 0; i-- ) 4833 { 4834 TComSlice *dpbPicSlice = dpbPic->getSlice( i ); 4835 TComReferencePictureSet *dpbPicRps = dpbPicSlice->getRPS(); 4836 4837 // Decrement POC of slice 4838 dpbPicSlice->setPOC( dpbPicSlice->getPOC() - deltaPocVal ); 4839 4840 // Decrement POC value stored in the RPS of each such slice 4841 for( Int j = dpbPicRps->getNumberOfPictures() - 1; j >= 0; j-- ) 4842 { 4843 dpbPicRps->setPOC( j, dpbPicRps->getPOC(j) - deltaPocVal ); 4844 } 4845 4846 // Decrement value of refPOC 4847 dpbPicSlice->decrementRefPocValues( deltaPocVal ); 4848 4849 // Update value of associatedIrapPoc of each slice 4850 dpbPicSlice->setAssociatedIRAPPOC( dpbPicSlice->getAssociatedIRAPPOC() - deltaPocVal ); 4851 4852 if( slice->getPocMsbNeeded() ) 4853 { 4854 // this delta value is needed when computing delta POCs in reference picture set initialization 4855 dpbPicSlice->setPocResetDeltaPoc(dpbPicSlice->getPocResetDeltaPoc() + (deltaPocVal - pocLsbVal)); 4856 } 4857 } 4858 } 4859 iterPic++; 4860 } 4861 } 4862 } 4863 4864 // Actual POC value before reset 4865 adjustedPocValue = pocCurr - m_pcEncTop->getPocAdjustmentValue(); 4866 4867 // Set MSB value before reset 4868 Int tempLsbVal = adjustedPocValue & (maxPocLsb - 1); 4869 if (!slice->getPocMsbNeeded()) // set poc msb normally if special msb handling is not needed 4870 { 4871 slice->setPocMsbVal(adjustedPocValue - tempLsbVal); 4872 } 4873 4874 // Set LSB value before reset - this is needed in the case of resetIdc = 2 4875 slice->setPicOrderCntLsb( tempLsbVal ); 4876 4877 // Cumulative delta 4878 deltaPocVal = origDeltaPocVal; // restore deltaPoc for correct adjustment value update 4879 4880 m_pcEncTop->setPocAdjustmentValue( m_pcEncTop->getPocAdjustmentValue() + deltaPocVal ); 4881 } 4925 4882 4926 4883 // New LSB value, after reset … … 4940 4897 { 4941 4898 Int picOrderCntMsb = slice->getCurrMsb( newLsbVal, 4942 4943 4944 4899 slice->getFullPocResetFlag() ? 0 : slice->getPocLsbVal(), 4900 0, 4901 maxPocLsb ); 4945 4902 slice->setPOC( picOrderCntMsb + newLsbVal ); 4946 4903 } … … 4951 4908 } 4952 4909 #endif 4953 4954 4910 4955 4911 #if O0164_MULTI_LAYER_HRD -
branches/SHM-dev/source/Lib/TLibEncoder/TEncTop.cpp
r1185 r1199 94 94 m_noOutputOfPriorPicsFlags = false; 95 95 #endif 96 #if P0297_VPS_POC_LSB_ALIGNED_FLAG97 96 m_pocDecrementedInDPBFlag = false; 98 #endif99 97 #endif //SVC_EXTENSION 100 98 } -
branches/SHM-dev/source/Lib/TLibEncoder/TEncTop.h
r1172 r1199 148 148 #endif 149 149 Int m_numAddLayerSets; 150 #if P0297_VPS_POC_LSB_ALIGNED_FLAG151 150 Bool m_pocDecrementedInDPBFlag; 152 151 Int m_currPocMsb; 153 #endif154 152 Bool m_prevPicHasEos; 155 153 #endif //SVC_EXTENSION … … 270 268 Void setNumAddLayerSets(Int x) { m_numAddLayerSets = x; } 271 269 Int getNumAddLayerSets() { return m_numAddLayerSets; } 272 #if P0297_VPS_POC_LSB_ALIGNED_FLAG273 270 Void setPocDecrementedInDPBFlag(Bool x) { m_pocDecrementedInDPBFlag = x; } 274 271 Bool getPocDecrementedInDPBFlag() { return m_pocDecrementedInDPBFlag; } 275 272 Void setCurrPocMsb(Int poc) { m_currPocMsb = poc; } 276 273 Int getCurrPocMsb() { return m_currPocMsb; } 277 #endif278 274 #else //SVC_EXTENSION 279 275 Void encode( Bool bEos,
Note: See TracChangeset for help on using the changeset viewer.