Changeset 798 in SHVCSoftware
- Timestamp:
- 10 Jun 2014, 01:10:15 (11 years ago)
- Location:
- branches/SHM-6-dev/source
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-6-dev/source/App/TAppDecoder/TAppDecTop.cpp
r746 r798 191 191 InputNALUnit nalu; 192 192 byteStreamNALUnit(bytestream, nalUnit, stats); 193 194 193 // call actual decoding function 195 194 Bool bNewPicture = false; … … 215 214 { 216 215 bNewPicture = m_acTDecTop[nalu.m_layerId].decode(nalu, m_iSkipFrame, m_aiPOCLastDisplay[nalu.m_layerId], curLayerId, bNewPOC); 216 #if POC_RESET_IDC_DECODER 217 if ( (bNewPicture && m_acTDecTop[nalu.m_layerId].getParseIdc() == 3) || (m_acTDecTop[nalu.m_layerId].getParseIdc() == 0) ) 218 #else 217 219 if (bNewPicture) 220 #endif 218 221 { 219 222 bitstreamFile.clear(); … … 225 228 bytestream.reset(); 226 229 } 227 } 228 } 229 230 #if POC_RESET_IDC_DECODER 231 else if(m_acTDecTop[nalu.m_layerId].getParseIdc() == 1) 232 { 233 bitstreamFile.clear(); 234 // This is before third parse of the NAL unit, and 235 // location points to correct beginning of the NALU 236 bitstreamFile.seekg(location); 237 bytestream.reset(); 238 } 239 #endif 240 } 241 } 242 243 #if POC_RESET_IDC_DECODER 244 if ((bNewPicture && m_acTDecTop[nalu.m_layerId].getParseIdc() == 3) || (m_acTDecTop[nalu.m_layerId].getParseIdc() == 0) || !bitstreamFile || nalu.m_nalUnitType == NAL_UNIT_EOS) 245 #else 230 246 if (bNewPicture || !bitstreamFile || nalu.m_nalUnitType == NAL_UNIT_EOS) 247 #endif 231 248 { 232 249 #if O0194_DIFFERENT_BITDEPTH_EL_BL … … 245 262 } 246 263 264 #if POC_RESET_IDC_DECODER 265 if( bNewPicture && m_acTDecTop[nalu.m_layerId].getParseIdc() == 0 ) 266 { 267 outputAllPictures( nalu.m_layerId, true ); 268 } 269 #endif 270 247 271 if( pcListPic ) 248 272 { … … 269 293 flushAllPictures( nalu.m_layerId, outputPicturesFlag ); 270 294 } 295 296 #if POC_RESET_IDC_DECODER 297 if( bNewPicture && m_acTDecTop[nalu.m_layerId].getParseIdc() != 0 ) 298 // New picture, slice header parsed but picture not decoded 299 #else 271 300 if( bNewPicture ) // New picture, slice header parsed but picture not decoded 301 #endif 272 302 { 273 303 #if NO_OUTPUT_OF_PRIOR_PICS … … 1504 1534 , std::vector<Int> *listOfPocsPositionInEachLayer 1505 1535 , DpbStatus &dpbStatus 1536 #if POC_RESET_IDC_DECODER 1537 , Bool notOutputCurrAu 1538 #endif 1506 1539 ) 1507 1540 { … … 1528 1561 vps = pic->getSlice(0)->getVPS(); 1529 1562 } 1530 1531 std::vector<Int>::iterator it;1532 if( pic->getOutputMark() ) // && pic->getPOC() > m_aiPOCLastDisplay[i])1533 { 1534 it = find( listOfPocs.begin(), listOfPocs.end(), pic->getPOC() ); // Check if already included1535 if( it == listOfPocs.end() ) // New POC value - i.e. new AU - add to the list1563 #if POC_RESET_IDC_DECODER 1564 if( !(pic->isCurrAu() && notOutputCurrAu ) ) 1565 { 1566 #endif 1567 std::vector<Int>::iterator it; 1568 if( pic->getOutputMark() ) // && pic->getPOC() > m_aiPOCLastDisplay[i]) 1536 1569 { 1537 listOfPocs.push_back( pic->getPOC() ); 1570 it = find( listOfPocs.begin(), listOfPocs.end(), pic->getPOC() ); // Check if already included 1571 if( it == listOfPocs.end() ) // New POC value - i.e. new AU - add to the list 1572 { 1573 listOfPocs.push_back( pic->getPOC() ); 1574 } 1575 listOfPocsInEachLayer [i].push_back( pic->getPOC() ); // POC to be output in each layer 1576 listOfPocsPositionInEachLayer [i].push_back( picPositionInList ); // For ease of access 1538 1577 } 1539 listOfPocsInEachLayer [i].push_back( pic->getPOC() ); // POC to be output in each layer1540 listOfPocsPositionInEachLayer [i].push_back( picPositionInList ); // For ease of access1541 }1542 if( pic->getSlice(0)->isReferenced() || pic->getOutputMark() )1543 { 1544 dpbStatus.m_numPicsInLayer[i]++; // Count pictures that are "used for reference" or "needed for output"1545 } 1578 if( pic->getSlice(0)->isReferenced() || pic->getOutputMark() ) 1579 { 1580 dpbStatus.m_numPicsInLayer[i]++; // Count pictures that are "used for reference" or "needed for output" 1581 } 1582 #if POC_RESET_IDC_DECODER 1583 } 1584 #endif 1546 1585 } 1547 1586 iterPic++; … … 1569 1608 } 1570 1609 assert( dpbStatus.m_numAUsNotDisplayed != -1 ); 1571 1572 1573 1610 } 1611 1612 #if POC_RESET_IDC_DECODER 1613 Void TAppDecTop::outputAllPictures(Int layerId, Bool notOutputCurrPic) 1614 { 1615 { // All pictures in the DPB in that layer are to be output; this means other pictures would also be output 1616 std::vector<Int> listOfPocs; 1617 std::vector<Int> listOfPocsInEachLayer[MAX_LAYERS]; 1618 std::vector<Int> listOfPocsPositionInEachLayer[MAX_LAYERS]; 1619 DpbStatus dpbStatus; 1620 1621 // Find the status of the DPB 1622 xFindDPBStatus(listOfPocs, listOfPocsInEachLayer, listOfPocsPositionInEachLayer, dpbStatus, notOutputCurrPic); 1623 1624 if( listOfPocs.size() ) 1625 { 1626 while( listOfPocsInEachLayer[layerId].size() ) // As long as there picture in the layer to be output 1627 { 1628 bumpingProcess( listOfPocs, listOfPocsInEachLayer, listOfPocsPositionInEachLayer, dpbStatus ); 1629 } 1630 } 1631 } 1632 } 1633 #endif 1574 1634 #endif 1575 1635 //! \} -
branches/SHM-6-dev/source/App/TAppDecoder/TAppDecTop.h
r644 r798 107 107 108 108 Void xOutputAndMarkPic( TComPic *pic, const Char *reconFile, const Int layerID, Int &pocLastDisplay, DpbStatus &dpbStatus); 109 #if POC_RESET_IDC_DECODER 110 Void outputAllPictures(Int layerId, Bool notOutputCurrAu); 111 #endif 109 112 Void xFindDPBStatus( std::vector<Int> &listOfPocs 110 113 , std::vector<Int> *listOfPocsInEachLayer 111 114 , std::vector<Int> *listOfPocsPositionInEachLayer 112 115 , DpbStatus &dpbStatus 116 #if POC_RESET_IDC_DECODER 117 , Bool notOutputCurrAu = true 118 #endif 113 119 ); 114 120 -
branches/SHM-6-dev/source/Lib/TLibCommon/TComPic.h
r754 r798 92 92 Int m_nFrameBit; 93 93 #endif 94 94 #if POC_RESET_IDC_DECODER 95 Bool m_currAuFlag; 96 #endif 95 97 public: 96 98 TComPic(); … … 223 225 Int getFrameBit() { return m_nFrameBit; } 224 226 #endif 227 #if POC_RESET_IDC_DECODER 228 Bool isCurrAu() { return m_currAuFlag; } 229 Void setCurrAuFlag(Bool x) {m_currAuFlag = x; } 230 #endif 225 231 };// END CLASS DEFINITION TComPic 226 232 -
branches/SHM-6-dev/source/Lib/TLibCommon/TComSlice.cpp
r797 r798 125 125 , m_pocMsbValPresentFlag ( false ) 126 126 #endif 127 #if POC_RESET_IDC_DECODER 128 , m_picOrderCntLsb (0) 129 #endif 127 130 #endif //SVC_EXTENSION 128 131 { … … 200 203 m_numEntryPointOffsets = 0; 201 204 m_enableTMVPFlag = true; 205 #if POC_RESET_IDC_SIGNALLING 206 m_pocResetIdc = 0; 207 m_pocResetPeriodId = 0; 208 m_fullPocResetFlag = false; 209 m_pocLsbVal = 0; 210 m_pocMsbVal = 0; 211 m_pocMsbValRequiredFlag = false; 212 m_pocMsbValPresentFlag = false; 213 #endif 214 #if POC_RESET_IDC_DECODER 215 m_picOrderCntLsb = 0; 216 #endif 202 217 } 203 218 … … 223 238 } 224 239 #endif 225 240 #if POC_RESET_IDC_DECODER 241 Bool TComSlice::getRaslPicFlag () 242 { 243 return getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_R 244 || getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N; 245 } 246 Bool TComSlice::getRadlPicFlag () 247 { 248 return getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL_R 249 || getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL_N; 250 } 251 #endif 252 #if POC_RESET_IDC_ENCODER 253 Void TComSlice::decrementRefPocValues(Int const decrementValue) 254 { 255 for(Int listNum = 0; listNum < 2; listNum++) 256 { 257 RefPicList dpbPicSliceList = (listNum == 1) ? REF_PIC_LIST_1 : REF_PIC_LIST_0; 258 for(Int listIdx = 0; listIdx < getNumRefIdx( dpbPicSliceList ); listIdx++) 259 { 260 setRefPOC( getRefPOC(dpbPicSliceList, listIdx) - decrementValue, 261 dpbPicSliceList, 262 listIdx 263 ); 264 } 265 } 266 } 267 Int TComSlice::getCurrMsb( Int currLsb, Int prevLsb, Int prevMsb, Int maxLsbVal ) 268 { 269 if( prevLsb - currLsb >= (maxLsbVal >> 1) ) 270 { 271 return prevMsb + maxLsbVal; 272 } 273 else if( currLsb - prevLsb > (maxLsbVal >> 1) ) 274 { 275 return prevMsb - maxLsbVal; 276 } 277 else 278 { 279 return prevMsb; 280 } 281 } 282 #endif 226 283 /** 227 284 - allocate table to contain substream sizes to be written to the slice header. … … 279 336 while ( iterPic != rcListPic.end() ) 280 337 { 338 #if POC_RESET_IDC_ENCODER 339 if( (pcPic->getPOC() == poc) && (pcPic->getSlice(0)->isReferenced()) ) 340 #else 281 341 if(pcPic->getPOC() == poc) 342 #endif 282 343 { 283 344 break; … … 293 354 pcPic = *(iterPic); 294 355 } 295 #if POC_RESET_FLAG 356 #if POC_RESET_FLAG || POC_RESET_IDC_DECODER 296 357 assert( pcPic->getSlice(0)->isReferenced() ); 297 358 #endif … … 1087 1148 rpcPic->setCurrSliceIdx(0); 1088 1149 #if NO_CLRAS_OUTPUT_FLAG 1150 #if POC_RESET_IDC_ENCODER 1089 1151 if (noClrasOutputFlag) 1090 1152 { 1153 rpcPic->getSlice(0)->setReferenced(false); // all layers // TODO. This does not mark all layers 1154 } 1155 else 1156 { 1157 if (rpcPic->getLayerId() == m_layerId) rpcPic->getSlice(0)->setReferenced(false); // only current layer 1158 } 1159 #else 1160 if (noClrasOutputFlag) 1161 { 1091 1162 if (rpcPic->getPOC() != pocCurr) rpcPic->getSlice(0)->setReferenced(false); // all layers 1092 1163 } … … 1095 1166 if (rpcPic->getPOC() != pocCurr && rpcPic->getLayerId() == m_layerId) rpcPic->getSlice(0)->setReferenced(false); // only current layer 1096 1167 } 1168 #endif 1097 1169 #else 1098 1170 if (rpcPic->getPOC() != pocCurr) rpcPic->getSlice(0)->setReferenced(false); … … 1100 1172 iterPic++; 1101 1173 } 1174 #if POC_RESET_IDC_ENCODER 1175 this->getPic()->getSlice(0)->setReferenced(true); // Mark the current picture back as refererced. 1176 #endif 1102 1177 if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 1103 1178 || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL … … 1328 1403 } 1329 1404 1330 1405 #if POC_RESET_IDC_ENCODER 1406 Void TComSlice::checkLeadingPictureRestrictions(TComList<TComPic*>& rcListPic, Bool usePocBeforeReset) 1407 #else 1331 1408 Void TComSlice::checkLeadingPictureRestrictions(TComList<TComPic*>& rcListPic) 1409 #endif 1332 1410 { 1333 1411 TComPic* rpcPic; … … 1418 1496 nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL) 1419 1497 { 1498 #if POC_RESET_IDC_ENCODER 1499 if( usePocBeforeReset ) 1500 { 1501 assert(rpcPic->getSlice(0)->getPocValueBeforeReset() < this->getPocValueBeforeReset()); 1502 } 1503 else 1504 { 1505 assert(rpcPic->getPOC() < this->getPOC()); 1506 } 1507 #else 1420 1508 assert(rpcPic->getPOC() < this->getPOC()); 1509 #endif 1421 1510 } 1422 1511 } … … 1436 1525 if(this->getAssociatedIRAPPOC() != rpcPic->getPOC()) 1437 1526 { 1527 #if POC_RESET_IDC_ENCODER 1528 if( usePocBeforeReset ) 1529 { 1530 assert(rpcPic->getSlice(0)->getPocValueBeforeReset() < this->getPocValueBeforeReset()); 1531 } 1532 else 1533 { 1534 assert(rpcPic->getPOC() < this->getPOC()); 1535 } 1536 #else 1438 1537 assert(rpcPic->getPOC() < this->getPOC()); 1538 #endif 1439 1539 } 1440 1540 } … … 1453 1553 // rpcPic is a picture that preceded the leading in decoding order since it exist in the DPB 1454 1554 // rpcPic would violate the constraint if it was a trailing picture 1555 #if POC_RESET_IDC_ENCODER 1556 if( usePocBeforeReset ) 1557 { 1558 assert(rpcPic->getPOC() <= this->getAssociatedIrapPocBeforeReset()); 1559 } 1560 else 1561 { 1562 assert(rpcPic->getPOC() <= this->getAssociatedIRAPPOC()); 1563 } 1564 #else 1455 1565 assert(rpcPic->getPOC() <= this->getAssociatedIRAPPOC()); 1566 #endif 1456 1567 } 1457 1568 } … … 1759 1870 if(isAvailable == 0) 1760 1871 { 1872 #if UNAVAILABLE_PIC_BUGFIX 1873 #if 0 1761 1874 if (this->getPOC() + pReferencePictureSet->getDeltaPOC(i) >= pocRandomAccess) 1875 #endif 1876 #endif 1762 1877 { 1763 1878 if(!pReferencePictureSet->getUsed(i) ) … … 1780 1895 } 1781 1896 #if ALLOW_RECOVERY_POINT_AS_RAP 1897 #if UNAVAILABLE_PIC_BUGFIX 1898 if(bUseRecoveryPoint && this->getPOC() > pocRandomAccess) 1899 #else 1782 1900 else if(bUseRecoveryPoint && this->getPOC() > pocRandomAccess) 1901 #endif 1783 1902 { 1784 1903 atLeastOneUnabledByRecoveryPoint = 1; … … 3761 3880 return false; 3762 3881 } 3763 #if POC_RESET_FLAG 3882 #if POC_RESET_FLAG || POC_RESET_IDC_DECODER 3883 #if POC_RESET_IDC_DECODER 3884 TComPic* pic = xGetRefPic( rcListPic, getPOC() ); 3885 #else 3764 3886 TComPic* pic = xGetRefPic( rcListPic, m_bPocResetFlag ? 0 : m_iPOC ); 3887 #endif 3765 3888 3766 3889 if( pic ) -
branches/SHM-6-dev/source/Lib/TLibCommon/TComSlice.h
r796 r798 1968 1968 Int m_iLastIDR; 1969 1969 Int m_iAssociatedIRAP; 1970 #if POC_RESET_IDC_ENCODER 1971 Int m_associatedIrapPocBeforeReset; 1972 #endif 1973 1970 1974 NalUnitType m_iAssociatedIRAPType; 1971 1975 static Int m_prevTid0POC; … … 2094 2098 Bool m_pocMsbValPresentFlag; 2095 2099 #endif 2100 #if POC_RESET_IDC_ENCODER 2101 Int m_pocValueBeforeReset; 2102 #endif 2103 #if POC_RESET_IDC_DECODER 2104 Int m_picOrderCntLsb; 2105 #endif 2096 2106 #if Q0048_CGS_3D_ASYMLUT 2097 2107 Int m_nCGSOverWritePPS; // for optimization, not output to bitstream … … 2139 2149 Void adjustPrevTid0POC (Int adj) { m_prevTid0POC=m_prevTid0POC-adj; } 2140 2150 #endif 2151 #if POC_RESET_IDC_DECODER 2152 Void setPrevTid0POC( Int x ) { m_prevTid0POC = x; } 2153 #endif 2154 2141 2155 TComRefPicListModification* getRefPicListModification() { return &m_RefPicListModification; } 2142 2156 Void setLastIDR(Int iIDRPOC) { m_iLastIDR = iIDRPOC; } … … 2144 2158 Void setAssociatedIRAPPOC(Int iAssociatedIRAPPOC) { m_iAssociatedIRAP = iAssociatedIRAPPOC; } 2145 2159 Int getAssociatedIRAPPOC() { return m_iAssociatedIRAP; } 2160 #if POC_RESET_IDC_ENCODER 2161 Void setAssociatedIrapPocBeforeReset(Int x) { m_associatedIrapPocBeforeReset = x; } 2162 Int getAssociatedIrapPocBeforeReset( ) { return m_associatedIrapPocBeforeReset; } 2163 #endif 2164 2146 2165 Void setAssociatedIRAPType(NalUnitType associatedIRAPType) { m_iAssociatedIRAPType = associatedIRAPType; } 2147 2166 NalUnitType getAssociatedIRAPType() { return m_iAssociatedIRAPType; } … … 2253 2272 Void setTLayerInfo( UInt uiTLayer ); 2254 2273 Void decodingMarking( TComList<TComPic*>& rcListPic, Int iGOPSIze, Int& iMaxRefPicNum ); 2274 #if POC_RESET_IDC_ENCODER 2275 Void checkLeadingPictureRestrictions(TComList<TComPic*>& rcListPic, Bool usePocBeforeReset = false); 2276 #else 2255 2277 Void checkLeadingPictureRestrictions( TComList<TComPic*>& rcListPic ); 2278 #endif 2256 2279 Void applyReferencePictureSet( TComList<TComPic*>& rcListPic, TComReferencePictureSet *RPSList); 2257 2280 Bool isTemporalLayerSwitchingPoint( TComList<TComPic*>& rcListPic ); … … 2451 2474 Bool getCraPicFlag (); 2452 2475 #endif 2476 #if POC_RESET_IDC_DECODER 2477 Bool getRaslPicFlag (); 2478 Bool getRadlPicFlag (); 2479 Int getPicOrderCntLsb() { return m_picOrderCntLsb; } 2480 Void setPicOrderCntLsb(Int x) { m_picOrderCntLsb = x; } 2481 #endif 2482 2483 #if POC_RESET_IDC_ENCODER 2484 Int getPocValueBeforeReset () { return m_pocValueBeforeReset; } 2485 Void setPocValueBeforeReset (Int x) { m_pocValueBeforeReset = x ; } 2486 Void decrementRefPocValues(Int const decrementValue); 2487 Int getCurrMsb( Int currLsb, Int prevLsb, Int prevMsb, Int maxLsbVal ); 2488 #endif 2489 2453 2490 2454 2491 #endif //SVC_EXTENSION -
branches/SHM-6-dev/source/Lib/TLibCommon/TypeDef.h
r797 r798 97 97 #define O0194_WEIGHTED_PREDICTION_CGS 1 ///< JCTVC-O0194: Weighted prediciton for color gamut scalability 98 98 #endif 99 #define POC_RESET_FLAG 1///< JCTVC-N0244: POC reset flag for layer pictures.99 #define POC_RESET_FLAG 0 ///< JCTVC-N0244: POC reset flag for layer pictures. 100 100 #define POC_RESET_IDC 1 ///< JCTVC-P0041: Include poc_reset_idc and related derivation - eventually will replace POC_RESET_FLAG 101 101 #if POC_RESET_IDC 102 102 #define POC_RESET_IDC_SIGNALLING 1 ///< JCTVC-P0041: Include signalling for poc_reset related syntax elements 103 #define POC_RESET_IDC_ENCODER 1 ///< JCTVC-P0041: Include support of enabling POC reset at the encoder 104 #define POC_RESET_IDC_DECODER 1 ///< JCTVC-P0041: Include support of enabling POC reset at the decoder 105 #define ALIGN_IRAP_BUGFIX 1 106 #define UNAVAILABLE_PIC_BUGFIX 1 103 107 #endif 104 108 #define POC_MSB_VAL_PRESENT_FLAG_SEM 1 ///< JCTVC-Q0146: Inference of poc_msb_val_present_flag -
branches/SHM-6-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp
r796 r798 2616 2616 { 2617 2617 READ_CODE(sps->getBitsForPOC(), uiCode, "pic_order_cnt_lsb"); 2618 #if POC_RESET_IDC_DECODER 2619 rpcSlice->setPicOrderCntLsb( uiCode ); 2620 #endif 2618 2621 #if SHM_FIX7 2619 2622 iPOClsb = uiCode; … … 2650 2653 #if SHM_FIX7 2651 2654 } 2655 #endif 2656 #if POC_RESET_IDC_DECODER 2657 else 2658 { 2659 rpcSlice->setPicOrderCntLsb( 0 ); 2660 } 2652 2661 #endif 2653 2662 if( !rpcSlice->getIdrPicFlag() ) … … 3342 3351 } 3343 3352 3353 #if !POC_RESET_IDC_DECODER 3344 3354 Int maxPocLsb = 1 << rpcSlice->getSPS()->getBitsForPOC(); 3355 #endif 3345 3356 if( rpcSlice->getPocMsbValPresentFlag() ) 3346 3357 { 3347 3358 READ_UVLC( uiCode, "poc_msb_val"); rpcSlice->setPocMsbVal( uiCode ); 3359 3360 #if !POC_RESET_IDC_DECODER 3348 3361 // Update POC of the slice based on this MSB val 3349 3362 Int pocLsb = rpcSlice->getPOC() % maxPocLsb; … … 3353 3366 { 3354 3367 rpcSlice->setPocMsbVal( rpcSlice->getPOC() / maxPocLsb ); 3368 #endif 3355 3369 } 3356 3370 -
branches/SHM-6-dev/source/Lib/TLibDecoder/TDecTop.cpp
r797 r798 96 96 m_subDpbIdx = -1; 97 97 #endif 98 #if POC_RESET_IDC_DECODER 99 m_parseIdc = -1; 100 m_lastPocPeriodId = -1; 101 m_prevPicOrderCnt = 0; 102 #endif 98 103 #if Q0048_CGS_3D_ASYMLUT 99 104 m_pColorMappedPic = NULL; … … 1104 1109 } 1105 1110 #endif 1111 #if POC_RESET_IDC_DECODER 1112 if( m_parseIdc != -1 ) // Second pass for a POC resetting picture 1113 { 1114 m_parseIdc++; // Proceed to POC decoding and RPS derivation 1115 } 1116 1117 if( m_parseIdc == 2 ) 1118 { 1119 bNewPOC = false; 1120 } 1121 1122 if( (bNewPOC || m_layerId!=m_uiPrevLayerId) && (m_parseIdc == -1) ) // Will be true at the first pass 1123 { 1124 //if (bNewPOC || m_layerId!=m_uiPrevLayerId) 1125 // Check if new reset period has started - this is needed just so that the SHM decoder which calls slice header decoding twice 1126 // does not invoke the output twice 1127 //if( m_lastPocPeriodId[m_apcSlicePilot->getLayerId()] == m_apcSlicePilot->getPocResetPeriodId() ) 1128 // Update CurrAU marking 1129 if(( m_layerId < m_uiPrevLayerId) ||( ( m_layerId == m_uiPrevLayerId) && bNewPOC)) // Decoding a lower layer than or same layer as previous - mark all earlier pictures as not in current AU 1130 { 1131 markAllPicsAsNoCurrAu(); 1132 } 1133 1134 if( m_apcSlicePilot->getPocResetIdc() && m_apcSlicePilot->getSliceIdx() == 0 ) 1135 { 1136 Int pocResetPeriodId = m_apcSlicePilot->getPocResetPeriodId(); 1137 if ( m_apcSlicePilot->getPocResetIdc() == 1 || m_apcSlicePilot->getPocResetIdc() == 2 || 1138 ( m_apcSlicePilot->getPocResetIdc() == 3 && pocResetPeriodId != getLastPocPeriodId() ) ) 1139 { 1140 setLastPocPeriodId(pocResetPeriodId); 1141 m_parseIdc = 0; 1142 } 1143 } 1144 else 1145 { 1146 m_parseIdc = 3; // Proceed to decoding POC and RPS 1147 } 1148 } 1149 #endif 1106 1150 1107 1151 #if ALIGNED_BUMPING 1152 #if POC_RESET_IDC_DECODER 1153 //if( (bNewPOC || m_layerId != m_uiPrevLayerId) && ( m_parseIdc != 1) ) 1154 if( m_parseIdc == 1 ) 1155 { 1156 1157 // Invoke output of pictures if the current picture is a POC reset picture 1158 bNewPOC = true; 1159 /* Include reset of all POCs in the layer */ 1160 1161 // This operation would do the following: 1162 // 1. Update the other picture in the DPB. This should be done only for the first slice of the picture. 1163 // 2. Update the value of m_pocCRA. 1164 // 3. Reset the POC values at the decoder for the current picture to be zero - will be done later 1165 // 4. update value of POCLastDisplay 1166 1167 //Do the reset stuff here 1168 Int maxPocLsb = 1 << m_apcSlicePilot->getSPS()->getBitsForPOC(); 1169 Int pocLsbVal; 1170 if( m_apcSlicePilot->getPocResetIdc() == 3 ) 1171 { 1172 pocLsbVal = m_apcSlicePilot->getPocLsbVal() ; 1173 } 1174 else 1175 { 1176 pocLsbVal = (m_apcSlicePilot->getPOC() % maxPocLsb); 1177 } 1178 1179 Int pocMsbDelta = 0; 1180 if ( m_apcSlicePilot->getPocMsbValPresentFlag() ) 1181 { 1182 pocMsbDelta = m_apcSlicePilot->getPocMsbVal() * maxPocLsb; 1183 } 1184 else 1185 { 1186 //This MSB derivation can be made into one function. Item to do next. 1187 Int prevPoc = this->getPrevPicOrderCnt(); 1188 Int prevPocLsb = prevPoc & (maxPocLsb - 1); 1189 Int prevPocMsb = prevPoc - prevPocLsb; 1190 1191 pocMsbDelta = m_apcSlicePilot->getCurrMsb( pocLsbVal, prevPocLsb, prevPocMsb, maxPocLsb ); 1192 } 1193 1194 Int pocLsbDelta; 1195 if( m_apcSlicePilot->getPocResetIdc() == 2 || ( m_apcSlicePilot->getPocResetIdc() == 3 && m_apcSlicePilot->getFullPocResetFlag() )) 1196 { 1197 pocLsbDelta = pocLsbVal; 1198 } 1199 else 1200 { 1201 pocLsbDelta = 0; 1202 } 1203 1204 Int deltaPocVal = pocMsbDelta + pocLsbDelta; 1205 1206 //Reset all POC for DPB -> basically do it for each slice in the picutre 1207 TComList<TComPic*>::iterator iterPic = m_cListPic.begin(); 1208 1209 // Iterate through all picture in DPB 1210 while( iterPic != m_cListPic.end() ) 1211 { 1212 TComPic *dpbPic = *iterPic; 1213 // Check if the picture pointed to by iterPic is either used for reference or 1214 // needed for output, are in the same layer, and not the current picture. 1215 if( /* ( ( dpbPic->getSlice(0)->isReferenced() ) || ( dpbPic->getOutputMark() ) ) 1216 &&*/ ( dpbPic->getLayerId() == m_apcSlicePilot->getLayerId() ) 1217 && ( dpbPic->getReconMark() ) && ( dpbPic->getPicSym()->getSlice(0)->getPicOutputFlag() )) 1218 { 1219 for(Int i = dpbPic->getNumAllocatedSlice()-1; i >= 0; i--) 1220 { 1221 1222 TComSlice *slice = dpbPic->getSlice(i); 1223 TComReferencePictureSet *rps = slice->getRPS(); 1224 slice->setPOC( slice->getPOC() - deltaPocVal ); 1225 1226 // Also adjust the POC value stored in the RPS of each such slice 1227 for(Int j = rps->getNumberOfPictures(); j >= 0; j--) 1228 { 1229 rps->setPOC( j, rps->getPOC(j) - deltaPocVal ); 1230 } 1231 // Also adjust the value of refPOC 1232 for(Int k = 0; k < 2; k++) // For List 0 and List 1 1233 { 1234 RefPicList list = (k == 1) ? REF_PIC_LIST_1 : REF_PIC_LIST_0; 1235 for(Int j = 0; j < slice->getNumRefIdx(list); j++) 1236 { 1237 slice->setRefPOC( slice->getRefPOC(list, j) - deltaPocVal, list, j); 1238 } 1239 } 1240 } 1241 } 1242 iterPic++; 1243 } 1244 // Update the value of pocCRA 1245 m_pocCRA -= deltaPocVal; 1246 1247 // Update value of POCLastDisplay 1248 iPOCLastDisplay -= deltaPocVal; 1249 } 1250 Int maxPocLsb = 1 << m_apcSlicePilot->getSPS()->getBitsForPOC(); 1251 Int slicePicOrderCntLsb = m_apcSlicePilot->getPicOrderCntLsb(); 1252 1253 if( m_parseIdc == 1 || m_parseIdc == 2 ) // TODO This should be replaced by pocResettingFlag. 1254 { 1255 // Set poc for current slice 1256 if( m_apcSlicePilot->getPocResetIdc() == 1 ) 1257 { 1258 m_apcSlicePilot->setPOC( slicePicOrderCntLsb ); 1259 } 1260 else if( m_apcSlicePilot->getPocResetIdc() == 2 ) 1261 { 1262 m_apcSlicePilot->setPOC( 0 ); 1263 } 1264 else 1265 { 1266 Int picOrderCntMsb = m_apcSlicePilot->getCurrMsb( slicePicOrderCntLsb, m_apcSlicePilot->getFullPocResetFlag() ? 0 : m_apcSlicePilot->getPocLsbVal(), 0 , maxPocLsb ); 1267 m_apcSlicePilot->setPOC( picOrderCntMsb + slicePicOrderCntLsb ); 1268 } 1269 } 1270 else if (m_parseIdc == 3) 1271 { 1272 Int picOrderCntMsb = 0; 1273 if( m_apcSlicePilot->getPocMsbValPresentFlag() ) 1274 { 1275 picOrderCntMsb = m_apcSlicePilot->getPocMsbVal() * maxPocLsb; 1276 } 1277 else if( m_apcSlicePilot->getIdrPicFlag() ) 1278 { 1279 picOrderCntMsb = 0; 1280 } 1281 else 1282 { 1283 Int prevPicOrderCntLsb = this->getPrevPicOrderCnt() & ( maxPocLsb - 1); 1284 Int prevPicOrderCntMsb = this->getPrevPicOrderCnt() - prevPicOrderCntLsb; 1285 picOrderCntMsb = m_apcSlicePilot->getCurrMsb(slicePicOrderCntLsb, prevPicOrderCntLsb, prevPicOrderCntMsb, maxPocLsb ); 1286 } 1287 m_apcSlicePilot->setPOC( picOrderCntMsb + slicePicOrderCntLsb ); 1288 } 1289 1290 if( m_parseIdc == 1 || m_parseIdc == 3) 1291 { 1292 // Adjust prevPicOrderCnt 1293 if( !m_apcSlicePilot->getRaslPicFlag() 1294 && !m_apcSlicePilot->getRadlPicFlag() 1295 && (m_apcSlicePilot->getNalUnitType() % 2 == 1) 1296 && ( nalu.m_temporalId == 0 ) 1297 && !m_apcSlicePilot->getDiscardableFlag() ) 1298 { 1299 this->setPrevPicOrderCnt( m_apcSlicePilot->getPOC() ); 1300 } 1301 else if ( m_apcSlicePilot->getPocResetIdc() == 3 ) 1302 { 1303 this->setPrevPicOrderCnt( m_apcSlicePilot->getFullPocResetFlag() 1304 ? 0 : m_apcSlicePilot->getPocLsbVal() ); 1305 } 1306 #else 1108 1307 if (bNewPOC || m_layerId!=m_uiPrevLayerId) 1109 1308 { 1309 #endif 1110 1310 m_apcSlicePilot->applyReferencePictureSet(m_cListPic, m_apcSlicePilot->getRPS()); 1111 1311 } 1112 1312 #endif 1313 #if POC_RESET_IDC_DECODER 1314 if (m_apcSlicePilot->isNextSlice() && (bNewPOC || m_layerId!=m_uiPrevLayerId || m_parseIdc == 1) && !m_bFirstSliceInSequence ) 1315 #else 1113 1316 if (m_apcSlicePilot->isNextSlice() && (bNewPOC || m_layerId!=m_uiPrevLayerId) && !m_bFirstSliceInSequence ) 1317 #endif 1114 1318 { 1115 1319 m_prevPOC = m_apcSlicePilot->getPOC(); … … 1119 1323 } 1120 1324 1325 #if POC_RESET_IDC_DECODER 1326 m_parseIdc = -1; 1327 #endif 1328 1121 1329 // actual decoding starts here 1122 xActivateParameterSets();1330 xActivateParameterSets(); 1123 1331 1124 1332 #if REPN_FORMAT_IN_VPS … … 1201 1409 } 1202 1410 #endif 1203 1204 1411 // Alignment of TSA and STSA pictures across AU 1205 1412 if( m_apcSlicePilot->getLayerId() > 0 ) … … 1401 1608 // Get a new picture buffer 1402 1609 xGetNewPicBuffer (m_apcSlicePilot, pcPic); 1610 1611 #if POC_RESET_IDC_DECODER 1612 pcPic->setCurrAuFlag( true ); 1613 #endif 1403 1614 1404 1615 Bool isField = false; … … 2505 2716 } 2506 2717 #endif 2507 2718 #if POC_RESET_IDC_DECODER 2719 Void TDecTop::markAllPicsAsNoCurrAu() 2720 { 2721 for(Int i = 0; i < MAX_LAYERS; i++) 2722 { 2723 TComList<TComPic*>* listPic = this->getLayerDec(i)->getListPic(); 2724 TComList<TComPic*>::iterator iterPic = listPic->begin(); 2725 while ( iterPic != listPic->end() ) 2726 { 2727 TComPic *pcPic = *(iterPic); 2728 pcPic->setCurrAuFlag( false ); 2729 iterPic++; 2730 } 2731 } 2732 } 2733 #endif 2508 2734 #if Q0048_CGS_3D_ASYMLUT 2509 2735 Void TDecTop::initAsymLut(TComSlice *pcSlice) -
branches/SHM-6-dev/source/Lib/TLibDecoder/TDecTop.h
r747 r798 204 204 Bool m_firstPicInLayerDecodedFlag; 205 205 #endif 206 #if POC_RESET_IDC_DECODER 207 Int m_parseIdc; 208 Int m_lastPocPeriodId; 209 Int m_prevPicOrderCnt; 210 #endif 206 211 #if RESOLUTION_BASED_DPB 207 212 Int m_subDpbIdx; // Index to the sub-DPB that the layer belongs to. … … 244 249 #if EARLY_REF_PIC_MARKING 245 250 Void earlyPicMarking(Int maxTemporalLayer, std::vector<Int>& targetDecLayerIdList); 251 #endif 252 #if POC_RESET_IDC_DECODER 253 Int getParseIdc() { return m_parseIdc;} 254 Void setParseIdc(Int x) { m_parseIdc = x;} 255 Void markAllPicsAsNoCurrAu(); 256 257 Int getLastPocPeriodId() { return m_lastPocPeriodId; } 258 Void setLastPocPeriodId(Int x) { m_lastPocPeriodId = x; } 259 260 Int getPrevPicOrderCnt() { return m_prevPicOrderCnt; } 261 Void setPrevPicOrderCnt(Int const x) { m_prevPicOrderCnt = x; } 246 262 #endif 247 263 UInt getLayerId () { return m_layerId; } -
branches/SHM-6-dev/source/Lib/TLibEncoder/TEncCavlc.cpp
r796 r798 998 998 { 999 999 WRITE_UVLC( vps->getNumAddLayerSets(), "num_add_layer_sets" ); 1000 for ( Inti = 0; i < vps->getNumAddLayerSets(); i++)1001 { 1002 for ( Intj = 1; j < vps->getNumIndependentLayers(); j++)1000 for (i = 0; i < vps->getNumAddLayerSets(); i++) 1001 { 1002 for (j = 1; j < vps->getNumIndependentLayers(); j++) 1003 1003 { 1004 1004 int len = 1; … … 1828 1828 } 1829 1829 #else 1830 #if POC_RESET_IDC_ENCODER 1831 Int picOrderCntLSB; 1832 if( pcSlice->getPocResetIdc() == 2 ) // i.e. the LSB is reset 1833 { 1834 picOrderCntLSB = pcSlice->getPicOrderCntLsb(); // This will be the LSB value w.r.t to the previous POC reset period. 1835 } 1836 else 1837 { 1838 picOrderCntLSB = (pcSlice->getPOC() + (1<<pcSlice->getSPS()->getBitsForPOC())) & ((1<<pcSlice->getSPS()->getBitsForPOC())-1); 1839 } 1840 #else 1830 1841 Int picOrderCntLSB = (pcSlice->getPOC()-pcSlice->getLastIDR()+(1<<pcSlice->getSPS()->getBitsForPOC())) & ((1<<pcSlice->getSPS()->getBitsForPOC())-1); 1842 #endif 1831 1843 #endif 1832 1844 WRITE_CODE( picOrderCntLSB, pcSlice->getSPS()->getBitsForPOC(), "pic_order_cnt_lsb"); … … 2300 2312 { 2301 2313 Int tmpBitsBeforeWriting = getNumberOfWrittenBits(); 2314 Int maxPocLsb = 1 << slice->getSPS()->getBitsForPOC(); 2302 2315 if(slice->getPPS()->getSliceHeaderExtensionPresentFlag()) 2303 2316 { … … 2342 2355 { 2343 2356 UInt lengthVal = 1; 2344 UInt tempVal = slice->getPocMsbVal() + 1;2357 UInt tempVal = (slice->getPocMsbVal() / maxPocLsb) + 1; 2345 2358 assert ( tempVal ); 2346 2359 while( 1 != tempVal ) … … 2379 2392 if( slice->getPocMsbValPresentFlag() ) 2380 2393 { 2381 WRITE_UVLC( slice->getPocMsbVal(), "poc_msb_val" ); 2394 assert( slice->getPocMsbVal() % maxPocLsb == 0 ); 2395 WRITE_UVLC( slice->getPocMsbVal() / maxPocLsb, "poc_msb_val" ); 2382 2396 } 2383 2397 for (Int i = 0; i < shExtnAdditionalBits; i++) -
branches/SHM-6-dev/source/Lib/TLibEncoder/TEncGOP.cpp
r780 r798 92 92 m_bRefreshPending = 0; 93 93 m_pocCRA = 0; 94 #if POC_RESET_IDC_ENCODER 95 m_pocCraWithoutReset = 0; 96 m_associatedIrapPocBeforeReset = 0; 97 #endif 94 98 m_numLongTermRefPicSPS = 0; 95 99 ::memset(m_ltRefPicPocLsbSps, 0, sizeof(m_ltRefPicPocLsbSps)); … … 108 112 m_temp = NULL; 109 113 m_pColorMappedPic = NULL; 114 #endif 115 #if POC_RESET_IDC_ENCODER 116 m_lastPocPeriodId = -1; 110 117 #endif 111 118 #endif //SVC_EXTENSION … … 903 910 } 904 911 #endif 912 #if POC_RESET_IDC_ENCODER 913 pcSlice->setPocValueBeforeReset( pocCurr ); 914 // Check if the current picture is to be assigned as a reset picture 915 determinePocResetIdc(pocCurr, pcSlice); 916 917 // If reset, do the following steps: 918 if( pcSlice->getPocResetIdc() ) 919 { 920 updatePocValuesOfPics(pocCurr, pcSlice); 921 } 922 else 923 { 924 // Check the base layer picture is IDR. If so, just set current POC equal to 0 (alignment of POC) 925 if( ( m_ppcTEncTop[0]->getGOPEncoder()->getIntraRefreshType() == 2) && ( pocCurr % m_ppcTEncTop[0]->getGOPEncoder()->getIntraRefreshInterval() == 0 ) ) 926 { 927 m_pcEncTop->setPocAdjustmentValue( pocCurr ); 928 } 929 // else 930 { 931 // Just subtract POC by the current cumulative POC delta 932 pcSlice->setPOC( pocCurr - m_pcEncTop->getPocAdjustmentValue() ); 933 } 934 935 Int maxPocLsb = 1 << pcSlice->getSPS()->getBitsForPOC(); 936 pcSlice->setPocMsbVal( pcSlice->getPOC() - ( pcSlice->getPOC() & (maxPocLsb-1) ) ); 937 } 938 // Update the POC of current picture, pictures in the DPB, including references inside the reference pictures 939 940 #endif 941 905 942 #if O0149_CROSS_LAYER_BLA_FLAG 906 943 if( m_layerId == 0 && (getNalUnitType(pocCurr, m_iLastIDR, isField) == NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType(pocCurr, m_iLastIDR, isField) == NAL_UNIT_CODED_SLICE_IDR_N_LP) ) … … 1225 1262 else 1226 1263 { 1264 #if ALIGN_IRAP_BUGFIX 1265 #if 0 1227 1266 pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_CRA); 1267 #endif 1268 #endif 1228 1269 } 1229 1270 } … … 1272 1313 { 1273 1314 m_associatedIRAPType = pcSlice->getNalUnitType(); 1315 #if POC_RESET_IDC_ENCODER 1316 m_associatedIRAPPOC = pcSlice->getPOC(); 1317 m_associatedIrapPocBeforeReset = pocCurr; 1318 #else 1274 1319 m_associatedIRAPPOC = pocCurr; 1320 #endif 1275 1321 } 1276 1322 pcSlice->setAssociatedIRAPType(m_associatedIRAPType); 1277 1323 pcSlice->setAssociatedIRAPPOC(m_associatedIRAPPOC); 1324 pcSlice->setAssociatedIrapPocBeforeReset(m_associatedIrapPocBeforeReset); 1278 1325 #endif 1279 1326 #endif … … 1283 1330 #else 1284 1331 pcSlice->decodingRefreshMarking(m_pocCRA, m_bRefreshPending, rcListPic); 1332 #endif 1333 #if POC_RESET_IDC_ENCODER 1334 // m_pocCRA may have been update here; update m_pocCraWithoutReset 1335 m_pocCraWithoutReset = m_pocCRA + m_pcEncTop->getPocAdjustmentValue(); 1285 1336 #endif 1286 1337 m_pcEncTop->selectReferencePictureSet(pcSlice, pocCurr, iGOPid); … … 1320 1371 #endif 1321 1372 #if ALIGNED_BUMPING 1373 #if POC_RESET_IDC_ENCODER 1374 pcSlice->checkLeadingPictureRestrictions(rcListPic, true); 1375 #else 1322 1376 pcSlice->checkLeadingPictureRestrictions(rcListPic); 1377 #endif 1323 1378 #endif 1324 1379 pcSlice->applyReferencePictureSet(rcListPic, pcSlice->getRPS()); … … 1513 1568 if( m_layerId > 0 && pcSlice->getActiveNumILRRefIdx() ) 1514 1569 { 1515 #if POC_RESET_FLAG 1570 #if POC_RESET_FLAG || POC_RESET_IDC_ENCODER 1516 1571 if ( pocCurr > 0 && pcSlice->isRADL() && pcPic->getSlice(0)->getBaseColPic(pcPic->getSlice(0)->getInterLayerPredLayerIdc(0))->getSlice(0)->isRASL()) 1517 1572 #else … … 1853 1908 1854 1909 Int sliceQP = m_pcCfg->getInitialQP(); 1855 #if POC_RESET_FLAG 1910 #if POC_RESET_FLAG || POC_RESET_IDC_ENCODER 1856 1911 if ( ( pocCurr == 0 && m_pcCfg->getInitialQP() > 0 ) || ( frameLevel == 0 && m_pcCfg->getForceIntraQP() ) ) // QP is specified 1857 1912 #else … … 2385 2440 } 2386 2441 pictureTimingSEI.m_auCpbRemovalDelay = std::min<Int>(std::max<Int>(1, m_totalCoded - m_lastBPSEI), static_cast<Int>(pow(2, static_cast<double>(pcSlice->getSPS()->getVuiParameters()->getHrdParameters()->getCpbRemovalDelayLengthMinus1()+1)))); // Syntax element signalled as minus, hence the . 2387 #if POC_RESET_FLAG 2442 #if POC_RESET_FLAG || POC_RESET_IDC_ENCODER 2388 2443 pictureTimingSEI.m_picDpbOutputDelay = pcSlice->getSPS()->getNumReorderPics(pcSlice->getSPS()->getMaxTLayers()-1) + pocCurr - m_totalCoded; 2389 2444 #else … … 2513 2568 SEIRecoveryPoint sei_recovery_point; 2514 2569 sei_recovery_point.m_recoveryPocCnt = 0; 2515 #if POC_RESET_FLAG 2570 #if POC_RESET_FLAG || POC_RESET_IDC_ENCODER 2516 2571 sei_recovery_point.m_exactMatchingFlag = ( pocCurr == 0 ) ? (true) : (false); 2517 2572 #else … … 3268 3323 #endif 3269 3324 } 3325 3326 #if POC_RESET_IDC_ENCODER 3327 Void TEncGOP::determinePocResetIdc(Int const pocCurr, TComSlice *const slice) 3328 { 3329 // If one picture in the AU is IDR, and another picture is not IDR, set the poc_reset_idc to 1 or 2 3330 // If BL picture in the AU is IDR, and another picture is not IDR, set the poc_reset_idc to 2 3331 // If BL picture is IRAP, and another picture is non-IRAP, then the poc_reset_idc is equal to 1 or 2. 3332 if( slice->getSliceIdx() == 0 ) // First slice - compute, copy for other slices 3333 { 3334 Int needReset = false; 3335 Int resetDueToBL = false; 3336 if( slice->getVPS()->getMaxLayers() > 1 ) 3337 { 3338 // If IRAP is refreshed in this access unit for base layer 3339 if( (m_ppcTEncTop[0]->getGOPEncoder()->getIntraRefreshType() == 1 || m_ppcTEncTop[0]->getGOPEncoder()->getIntraRefreshType() == 2) 3340 && ( pocCurr % m_ppcTEncTop[0]->getGOPEncoder()->getIntraRefreshInterval() == 0 ) 3341 ) 3342 { 3343 // Check if the IRAP refresh interval of any layer does not match that of the base layer 3344 for(Int i = 1; i < slice->getVPS()->getMaxLayers(); i++) 3345 { 3346 Bool refreshIntervalFlag = ( pocCurr % m_ppcTEncTop[i]->getGOPEncoder()->getIntraRefreshInterval() == 0 ); 3347 Bool refreshTypeFlag = ( m_ppcTEncTop[0]->getGOPEncoder()->getIntraRefreshType() == m_ppcTEncTop[i]->getGOPEncoder()->getIntraRefreshType() ); 3348 if( !(refreshIntervalFlag && refreshTypeFlag) ) 3349 { 3350 needReset = true; 3351 resetDueToBL = true; 3352 break; 3353 } 3354 } 3355 } 3356 } 3357 3358 if( !needReset )// No need reset due to base layer IRAP 3359 { 3360 // Check if EL IDRs results in POC Reset 3361 for(Int i = 1; i < slice->getVPS()->getMaxLayers() && !needReset; i++) 3362 { 3363 Bool idrFlag = ( (m_ppcTEncTop[i]->getGOPEncoder()->getIntraRefreshType() == 2) 3364 && ( pocCurr % m_ppcTEncTop[i]->getGOPEncoder()->getIntraRefreshInterval() == 0 ) 3365 ); 3366 for(Int j = 0; j < slice->getVPS()->getMaxLayers(); j++) 3367 { 3368 if( j == i ) 3369 { 3370 continue; 3371 } 3372 Bool idrOtherPicFlag = ( (m_ppcTEncTop[j]->getGOPEncoder()->getIntraRefreshType() == 2) 3373 && ( pocCurr % m_ppcTEncTop[j]->getGOPEncoder()->getIntraRefreshInterval() == 0 ) 3374 ); 3375 3376 if( idrFlag != idrOtherPicFlag ) 3377 { 3378 needReset = true; 3379 break; 3380 } 3381 } 3382 } 3383 } 3384 if( needReset ) 3385 { 3386 if( m_ppcTEncTop[0]->getGOPEncoder()->getIntraRefreshType() == 2 ) // BL IDR refresh, assuming BL picture present 3387 { 3388 if( resetDueToBL ) 3389 { 3390 slice->setPocResetIdc( 2 ); // Full reset needed 3391 } 3392 else 3393 { 3394 slice->setPocResetIdc( 1 ); // Due to IDR in EL 3395 } 3396 } 3397 else 3398 { 3399 slice->setPocResetIdc( 1 ); // Only MSB reset 3400 } 3401 3402 // Start a new POC reset period 3403 if (m_layerId == 0) // Assuming BL picture is always present at encoder; for other AU structures, need to change this 3404 { 3405 Int periodId = rand() % 64; 3406 m_lastPocPeriodId = (periodId == m_lastPocPeriodId) ? (periodId + 1) % 64 : periodId ; 3407 } 3408 else 3409 { 3410 m_lastPocPeriodId = m_ppcTEncTop[0]->getGOPEncoder()->getLastPocPeriodId(); 3411 } 3412 slice->setPocResetPeriodId(m_lastPocPeriodId); 3413 } 3414 else 3415 { 3416 slice->setPocResetIdc( 0 ); 3417 } 3418 } 3419 } 3420 3421 Void TEncGOP::updatePocValuesOfPics(Int const pocCurr, TComSlice *const slice) 3422 { 3423 3424 Int pocAdjustValue = pocCurr - m_pcEncTop->getPocAdjustmentValue(); 3425 3426 // New POC reset period 3427 Int maxPocLsb, pocLsbVal, pocMsbDelta, pocLsbDelta, deltaPocVal; 3428 3429 maxPocLsb = 1 << slice->getSPS()->getBitsForPOC(); 3430 pocLsbVal = (slice->getPocResetIdc() == 3) 3431 ? slice->getPocLsbVal() 3432 : pocAdjustValue % maxPocLsb; 3433 pocMsbDelta = pocAdjustValue - pocLsbVal; 3434 pocLsbDelta = (slice->getPocResetIdc() == 2 || ( slice->getPocResetIdc() == 3 && slice->getFullPocResetFlag() )) 3435 ? pocLsbVal 3436 : 0; 3437 deltaPocVal = pocMsbDelta + pocLsbDelta; 3438 3439 // Decrement value of associatedIrapPoc of the TEncGop object 3440 this->m_associatedIRAPPOC -= deltaPocVal; 3441 3442 // Decrememnt the value of m_pocCRA 3443 this->m_pocCRA -= deltaPocVal; 3444 3445 // Iterate through all pictures in the DPB 3446 TComList<TComPic*>::iterator iterPic = getListPic()->begin(); 3447 while( iterPic != getListPic()->end() ) 3448 { 3449 TComPic *dpbPic = *iterPic; 3450 3451 if( dpbPic->getReconMark() ) 3452 { 3453 for(Int i = dpbPic->getNumAllocatedSlice() - 1; i >= 0; i--) 3454 { 3455 TComSlice *dpbPicSlice = dpbPic->getSlice( i ); 3456 TComReferencePictureSet *dpbPicRps = dpbPicSlice->getRPS(); 3457 3458 // Decrement POC of slice 3459 dpbPicSlice->setPOC( dpbPicSlice->getPOC() - deltaPocVal ); 3460 3461 // Decrement POC value stored in the RPS of each such slice 3462 for( Int j = dpbPicRps->getNumberOfPictures() - 1; j >= 0; j-- ) 3463 { 3464 dpbPicRps->setPOC( j, dpbPicRps->getPOC(j) - deltaPocVal ); 3465 } 3466 3467 // Decrement value of refPOC 3468 dpbPicSlice->decrementRefPocValues( deltaPocVal ); 3469 3470 // Update value of associatedIrapPoc of each slice 3471 dpbPicSlice->setAssociatedIRAPPOC( dpbPicSlice->getAssociatedIRAPPOC() - deltaPocVal ); 3472 } 3473 } 3474 iterPic++; 3475 } 3476 3477 // Actual POC value before reset 3478 Int adjustedPocValue = pocCurr - m_pcEncTop->getPocAdjustmentValue(); 3479 3480 // Set MSB value before reset 3481 Int tempLsbVal = adjustedPocValue & (maxPocLsb - 1); 3482 slice->setPocMsbVal( adjustedPocValue - tempLsbVal); 3483 3484 // Set LSB value before reset - this is needed in the case of resetIdc = 2 3485 slice->setPicOrderCntLsb( tempLsbVal ); 3486 3487 // Cumulative delta 3488 m_pcEncTop->setPocAdjustmentValue( m_pcEncTop->getPocAdjustmentValue() + deltaPocVal ); 3489 3490 // New LSB value, after reset 3491 adjustedPocValue = pocCurr - m_pcEncTop->getPocAdjustmentValue(); 3492 Int newLsbVal = adjustedPocValue & (maxPocLsb - 1); 3493 3494 // Set value of POC current picture after RESET 3495 if( slice->getPocResetIdc() == 1 ) 3496 { 3497 slice->setPOC( newLsbVal ); 3498 } 3499 else if( slice->getPocResetIdc() == 2 ) 3500 { 3501 slice->setPOC( 0 ); 3502 } 3503 else if( slice->getPocResetIdc() == 3 ) 3504 { 3505 Int picOrderCntMsb = slice->getCurrMsb( newLsbVal, 3506 slice->getFullPocResetFlag() ? 0 : slice->getPocLsbVal(), 3507 0, 3508 maxPocLsb ); 3509 slice->setPOC( picOrderCntMsb + newLsbVal ); 3510 } 3511 else 3512 { 3513 assert(0); 3514 } 3515 } 3516 #endif 3517 3270 3518 3271 3519 #if !SVC_EXTENSION … … 3716 3964 if( pcSlice->getRefPic(RefPicList(iRefList), iRefIndex)->isILR(m_layerId) ) 3717 3965 { 3966 #if POC_RESET_IDC_ENCODER 3967 printf( "%d(%d)", pcSlice->getRefPOC(RefPicList(iRefList), iRefIndex), pcSlice->getRefPic(RefPicList(iRefList), iRefIndex)->getLayerId() ); 3968 #else 3718 3969 printf( "%d(%d)", pcSlice->getRefPOC(RefPicList(iRefList), iRefIndex)-pcSlice->getLastIDR(), pcSlice->getRefPic(RefPicList(iRefList), iRefIndex)->getLayerId() ); 3970 #endif 3719 3971 } 3720 3972 else 3721 3973 { 3974 #if POC_RESET_IDC_ENCODER 3975 printf ("%d", pcSlice->getRefPOC(RefPicList(iRefList), iRefIndex)); 3976 #else 3722 3977 printf ("%d", pcSlice->getRefPOC(RefPicList(iRefList), iRefIndex)-pcSlice->getLastIDR()); 3978 #endif 3723 3979 } 3724 3980 #endif … … 3947 4203 } 3948 4204 } 4205 4206 #if POC_RESET_IDC_ENCODER 4207 if(m_pocCraWithoutReset > 0 && this->m_associatedIRAPType == NAL_UNIT_CODED_SLICE_CRA) 4208 { 4209 if(pocCurr < m_pocCraWithoutReset) 4210 #else 3949 4211 if(m_pocCRA>0) 3950 4212 { 3951 4213 if(pocCurr<m_pocCRA) 4214 #endif 3952 4215 { 3953 4216 // All leading pictures are being marked as TFD pictures here since current encoder uses all -
branches/SHM-6-dev/source/Lib/TLibEncoder/TEncGOP.h
r776 r798 113 113 Bool m_bRefreshPending; 114 114 Int m_pocCRA; 115 #if POC_RESET_IDC_ENCODER 116 Int m_pocCraWithoutReset; 117 Int m_associatedIrapPocBeforeReset; 118 #endif 115 119 std::vector<Int> m_storedStartCUAddrForEncodingSlice; 116 120 std::vector<Int> m_storedStartCUAddrForEncodingSliceSegment; … … 152 156 Int **m_temp; 153 157 #endif 158 #if POC_RESET_IDC_ENCODER 159 Int m_lastPocPeriodId; 160 #endif 154 161 #endif 155 162 … … 170 177 #else 171 178 Void compressGOP ( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRec, std::list<AccessUnit>& accessUnitsInGOP, Bool isField, Bool isTff ); 179 #endif 180 #if POC_RESET_IDC_ENCODER 181 Void determinePocResetIdc( Int const pocCurr, TComSlice *const slice); 182 Int getIntraRefreshInterval() { return m_pcCfg->getIntraPeriod(); } 183 Int getIntraRefreshType() { return m_pcCfg->getDecodingRefreshType(); } 184 // Int getIntraRefreshInterval () { return (m_pcCfg) ? m_pcCfg->getIntraPeriod() : 0; } 185 Int getLastPocPeriodId() { return m_lastPocPeriodId; } 186 Void setLastPocPeriodId(Int x) { m_lastPocPeriodId = x; } 187 Void updatePocValuesOfPics( Int const pocCurr, TComSlice *const slice); 172 188 #endif 173 189 Void xAttachSliceDataToNalUnit (OutputNALUnit& rNalu, TComOutputBitstream*& rpcBitstreamRedirect); -
branches/SHM-6-dev/source/Lib/TLibEncoder/TEncTop.cpp
r797 r798 89 89 #endif 90 90 m_numScaledRefLayerOffsets = 0; 91 #if POC_RESET_FLAG 91 #if POC_RESET_FLAG || POC_RESET_IDC_ENCODER 92 92 m_pocAdjustmentValue = 0; 93 93 #endif … … 1208 1208 m_cPPS.setCGSFlag( m_nCGSFlag ); 1209 1209 #endif 1210 #if POC_RESET_IDC_ENCODER 1211 m_cPPS.setPocResetInfoPresentFlag( true ); 1212 m_cPPS.setExtensionFlag( true ); 1213 m_cPPS.setSliceHeaderExtensionPresentFlag( true ); 1214 #endif 1210 1215 #endif //SVC_EXTENSION 1211 1216 } -
branches/SHM-6-dev/source/Lib/TLibEncoder/TEncTop.h
r778 r798 142 142 Bool m_vertPhasePositionEnableFlag[MAX_LAYERS]; 143 143 #endif 144 #if POC_RESET_FLAG 144 #if POC_RESET_FLAG || POC_RESET_IDC_ENCODER 145 145 Int m_pocAdjustmentValue; 146 146 #endif … … 257 257 TEncTop* getRefLayerEnc(UInt refLayerIdc); 258 258 #endif 259 #if POC_RESET_FLAG 259 #if POC_RESET_FLAG || POC_RESET_IDC_ENCODER 260 260 Int getPocAdjustmentValue() { return m_pocAdjustmentValue;} 261 261 Void setPocAdjustmentValue(Int x) { m_pocAdjustmentValue = x; }
Note: See TracChangeset for help on using the changeset viewer.