- Timestamp:
- 4 Sep 2015, 21:28:58 (9 years ago)
- Location:
- branches/HTM-15.0-dev0/source
- Files:
-
- 47 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-15.0-dev0/source/App/TAppDecoder/TAppDecCfg.cpp
r1313 r1317 102 102 ("RespectDefDispWindow,w", m_respectDefDispWindow, 0, "Only output content inside the default display window\n") 103 103 #if NH_MV 104 ("OutputVpsInfo,v", m_outputVpsInfo, false, "Output information about the layer dependencies and layer sets") 104 ("OutputVpsInfo,v", m_printVpsInfo, false, "Output information about the layer dependencies and layer sets") 105 ("PrintPicOutput,c" , m_printPicOutput, false, "Print information on picture output") 106 ("PrintNalus,n", m_printReceivedNalus, false, "Print information on received NAL units") 105 107 #endif 106 108 #if O0043_BEST_EFFORT_DECODING -
branches/HTM-15.0-dev0/source/App/TAppDecoder/TAppDecCfg.h
r1313 r1317 45 45 #include "TLibCommon/CommonDef.h" 46 46 #include <vector> 47 #if NH_MV 48 #include <fstream> 49 #endif 47 50 48 51 //! \ingroup TAppDecoder … … 58 61 protected: 59 62 Char* m_pchBitstreamFile; ///< input bitstream file name 60 #if NH_MV61 Int m_targetOptLayerSetIdx; ///< target output layer set index62 Int m_maxLayerId; ///< maximum nuh_layer_id decoded63 std::vector<Char*> m_pchReconFiles; ///< array of output reconstruction file name create from output reconstruction file name64 #endif65 63 Char* m_pchReconFile; ///< output reconstruction file name 66 #if NH_3D67 Char* m_pchScaleOffsetFile; ///< output coded scale and offset parameters68 Bool m_depth420OutputFlag; ///< output depth layers in 4:2:069 #endif70 64 Int m_iSkipFrame; ///< counter for frames prior to the random access point to skip 71 65 Int m_outputBitDepth[MAX_NUM_CHANNEL_TYPE]; ///< bit depth used for writing output … … 76 70 Bool m_decodedNoDisplaySEIEnabled; ///< Enable(true)/disable(false) writing only pictures that get displayed based on the no display SEI message 77 71 std::vector<Int> m_targetDecLayerIdSet; ///< set of LayerIds to be included in the sub-bitstream extraction process. 78 #if NH_MV79 Bool m_targetDecLayerIdSetFileEmpty; ///< indication if target layers are given by file80 #endif81 72 82 73 Int m_respectDefDispWindow; ///< Only output content inside the default display window … … 87 78 Bool m_bClipOutputVideoToRec709Range; ///< If true, clip the output video to the Rec 709 range on saving. 88 79 #if NH_MV 89 Bool m_outputVpsInfo; ///< Output VPS information 80 std::vector<Char*> m_pchReconFiles; ///< array of output reconstruction file name create from output reconstruction file name 81 82 Int m_targetOptLayerSetIdx; ///< target output layer set index 83 Int m_targetDecLayerSetIdx; 84 Int m_baseLayerOutputFlag; 85 Int m_baseLayerPicOutputFlag; 86 Int m_auOutputFlag; 87 Int m_maxLayerId; ///< maximum nuh_layer_id decoded 88 std::ifstream m_bitstreamFile; 89 Bool m_targetDecLayerIdSetFileEmpty; ///< indication if target layers are given by file 90 Int m_highestTid; 91 92 Bool m_printVpsInfo; ///< Output VPS information 93 Bool m_printPicOutput; ///< Print information on picture output 94 Bool m_printReceivedNalus; ///< Print information on received NAL units 95 #if NH_3D 96 Char* m_pchScaleOffsetFile; ///< output coded scale and offset parameters 97 Bool m_depth420OutputFlag; ///< output depth layers in 4:2:0 98 #endif 99 90 100 Void xAppendToFileNameEnd( Char* pchInputFileName, const Char* pchStringToAppend, Char*& rpchOutputFileName); ///< create filenames 91 101 #endif … … 100 110 , m_decodedPictureHashSEIEnabled(0) 101 111 , m_decodedNoDisplaySEIEnabled(false) 102 #if NH_MV103 , m_targetDecLayerIdSetFileEmpty(true)104 #endif105 112 , m_respectDefDispWindow(0) 106 113 #if O0043_BEST_EFFORT_DECODING 107 114 , m_forceDecodeBitDepth(0) 108 115 #endif 116 #if NH_MV 117 , m_highestTid(-1) 118 , m_targetDecLayerIdSetFileEmpty(true) 119 #endif 120 109 121 { 110 122 for (UInt channelTypeIndex = 0; channelTypeIndex < MAX_NUM_CHANNEL_TYPE; channelTypeIndex++) -
branches/HTM-15.0-dev0/source/App/TAppDecoder/TAppDecTop.cpp
r1313 r1317 64 64 { 65 65 #if NH_MV 66 for (Int i = 0; i < MAX_NUM_LAYER_IDS; i++) 67 { 68 m_layerIdToDecIdx[i] = -1; 69 m_layerInitilizedFlags[i] = false; 70 } 66 for (Int i = 0; i < MAX_NUM_LAYER_IDS; i++) 67 { 68 m_layerIdToDecIdx [i] = -1; 69 m_layerInitilizedFlag [i] = false; 70 m_eosInLayer [i] = false; 71 m_firstPicInLayerDecodedFlag [i] = false; 72 m_pocDecrementedInDpbFlag [i] = false; 73 m_decodingOrder [i] = 0; 74 m_lastPresentPocResetIdc [i] = MIN_INT; 75 m_firstPicInPocResettingPeriodReceived[i] = true; 76 m_noRaslOutputFlagAssocIrap [i] = false; 77 } 78 79 m_curPic = NULL; 80 m_vps = NULL; 81 m_sps = NULL; 82 m_pps = NULL; 83 m_initilizedFromVPS = false; 84 m_firstSliceInBitstream = true; 85 m_newVpsActivatedbyCurAu = false; 86 m_newVpsActivatedbyCurPic = false; 87 m_handleCraAsBlaFlag = false; 88 m_handleCraAsBlaFlagSetByExtMeans = false; 89 m_noClrasOutputFlag = false; 90 m_noClrasOutputFlagSetByExtMeans = false; 91 m_layerResetFlag = false; 92 m_totalNumofPicsReceived = 0; 93 m_cvsStartFound = false; 71 94 #endif 72 95 #if NH_3D 73 m_pScaleOffsetFile = 0;96 m_pScaleOffsetFile = 0; 74 97 #endif 75 98 } 99 100 Void TAppDecTop::create() 101 { 76 102 #if NH_MV 77 m_markedForOutput = false; 103 #if ENC_DEC_TRACE 104 if ( g_hTrace == NULL ) 105 { 106 g_hTrace = fopen( "TraceDec.txt", "wb" ); 107 g_bJustDoIt = g_bEncDecTraceDisable; 108 g_nSymbolCounter = 0; 109 } 78 110 #endif 79 80 } 81 82 Void TAppDecTop::create() 83 { 111 #endif 84 112 } 85 113 … … 115 143 { 116 144 free (m_pchScaleOffsetFile); 117 m_pchScaleOffsetFile = NULL; 145 m_pchScaleOffsetFile = NULL; 118 146 } 119 147 #endif … … 132 160 . 133 161 */ 162 163 #if NH_MV 134 164 Void TAppDecTop::decode() 135 165 { 166 // create & initialize internal classes 167 xInitFileIO (); 168 xCreateDecLib(); 169 xInitDecLib (); 170 171 InputByteStream bytestream(m_bitstreamFile); 172 173 while ( m_bitstreamFile ) 174 { 175 AnnexBStats stats = AnnexBStats(); 176 InputNALUnit nalu; 177 178 byteStreamNALUnit(bytestream, nalu.getBitstream().getFifo(), stats); 179 180 if (nalu.getBitstream().getFifo().empty()) 181 { 182 /* this can happen if the following occur: 183 * - empty input file 184 * - two back-to-back start_code_prefixes 185 * - start_code_prefix immediately followed by EOF 186 */ 187 fprintf(stderr, "Warning: Attempt to decode an empty NAL unit\n"); 188 } 189 else 190 { 191 read(nalu); 192 193 if ( m_printReceivedNalus ) 194 { 195 std::cout << "Received NAL unit: "; 196 nalu.print(); 197 std::cout << std::endl; 198 } 199 200 if ( xExtractAndRewrite( &nalu ) 201 && nalu.m_nuhLayerId <= MAX_NUM_LAYER_IDS-1 202 && !(nalu.m_nalUnitType == NAL_UNIT_VPS && nalu.m_nuhLayerId > 0) 203 && !(nalu.m_nalUnitType == NAL_UNIT_EOB && nalu.m_nuhLayerId > 0) 204 ) 205 { 206 xGetDecoderIdx( nalu.m_nuhLayerId , true ); 207 if( nalu.isSlice() ) 208 { 209 xProcessVclNalu ( nalu ); 210 } 211 else 212 { 213 xProcessNonVclNalu( nalu ); 214 } 215 } 216 } 217 } 218 xTerminateDecoding(); 219 } 220 #endif 221 222 #if !NH_MV 223 Void TAppDecTop::decode() 224 { 136 225 Int poc; 137 #if NH_MV138 poc = -1;139 #endif140 226 TComList<TComPic*>* pcListPic = NULL; 141 227 … … 146 232 exit(EXIT_FAILURE); 147 233 } 148 #if NH_3D149 if( m_pchScaleOffsetFile )150 {151 m_pScaleOffsetFile = ::fopen( m_pchScaleOffsetFile, "wt" );152 AOF( m_pScaleOffsetFile );153 }154 #endif155 234 156 235 InputByteStream bytestream(bitstreamFile); … … 169 248 xCreateDecLib(); 170 249 xInitDecLib (); 171 #if !NH_MV 250 172 251 m_iPOCLastDisplay += m_iSkipFrame; // set the last displayed POC correctly for skip forward. 173 252 174 253 // main decoder loop 175 254 Bool openedReconFile = false; // reconstruction file not yet opened. (must be performed after SPS is seen) 176 #else177 178 Int pocCurrPic = -MAX_INT;179 Int pocLastPic = -MAX_INT;180 181 Int layerIdLastPic = -MAX_INT;182 Int layerIdCurrPic = 0;183 184 Int decIdxLastPic = 0;185 Int decIdxCurrPic = 0;186 187 Bool firstSlice = true;188 #endif189 255 Bool loopFiltered = false; 190 256 … … 201 267 streampos location = bitstreamFile.tellg(); 202 268 #endif 203 #if NH_MV204 #if ENC_DEC_TRACE205 Int64 symCount = g_nSymbolCounter;206 #endif207 #endif208 269 AnnexBStats stats = AnnexBStats(); 209 270 … … 213 274 // call actual decoding function 214 275 Bool bNewPicture = false; 215 #if NH_MV216 Bool newSliceDiffPoc = false;217 Bool newSliceDiffLayer = false;218 Bool sliceSkippedFlag = false;219 Bool allLayersDecoded = false;220 #endif221 276 if (nalu.getBitstream().getFifo().empty()) 222 277 { … … 231 286 { 232 287 read(nalu); 233 #if NH_MV 234 if( (m_iMaxTemporalLayer >= 0 && nalu.m_temporalId > m_iMaxTemporalLayer) 235 || !isNaluWithinTargetDecLayerIdSet(&nalu) 236 || nalu.m_nuhLayerId > MAX_NUM_LAYER_IDS-1 237 || (nalu.m_nalUnitType == NAL_UNIT_VPS && nalu.m_nuhLayerId > 0) 238 || (nalu.m_nalUnitType == NAL_UNIT_EOB && nalu.m_nuhLayerId > 0) 239 ) 288 289 if( (m_iMaxTemporalLayer >= 0 && nalu.m_temporalId > m_iMaxTemporalLayer) || !isNaluWithinTargetDecLayerIdSet(&nalu) ) 240 290 { 241 291 bNewPicture = false; 242 if ( !bitstreamFile )243 {244 decIdxLastPic = decIdxCurrPic;245 }246 292 } 247 293 else 248 {249 Int decIdx = xGetDecoderIdx( nalu.m_nuhLayerId , true );250 newSliceDiffLayer = nalu.isSlice() && ( nalu.m_nuhLayerId != layerIdCurrPic ) && !firstSlice;251 newSliceDiffPoc = m_tDecTop[decIdx]->decode(nalu, m_iSkipFrame, m_pocLastDisplay[decIdx], newSliceDiffLayer, sliceSkippedFlag );252 // decode function only returns true when all of the following conditions are true253 // - poc in particular layer changes254 // - nalu does not belong to first slice in layer255 // - nalu.isSlice() == true256 257 bNewPicture = ( newSliceDiffLayer || newSliceDiffPoc ) && !sliceSkippedFlag;258 if ( nalu.isSlice() && firstSlice && !sliceSkippedFlag )259 {260 layerIdCurrPic = nalu.m_nuhLayerId;261 pocCurrPic = m_tDecTop[decIdx]->getCurrPoc();262 decIdxCurrPic = decIdx;263 firstSlice = false;264 265 /// Use VPS activated by the first slice to determine OLS266 m_vps = m_tDecTop[decIdx]->getActiveVPS( );267 if ( m_targetDecLayerIdSetFileEmpty )268 {269 if ( m_targetOptLayerSetIdx == -1 )270 {271 m_targetOptLayerSetIdx = m_tDecTop[decIdx]->getTargetOlsIdx();272 }273 else274 {275 assert( m_tDecTop[decIdx]->getTargetOlsIdx() == m_targetOptLayerSetIdx );276 }277 278 if ( m_targetOptLayerSetIdx < 0 || m_targetOptLayerSetIdx >= m_vps->getNumOutputLayerSets() )279 {280 fprintf(stderr, "\ntarget output layer set index must be in the range of 0 to %d, inclusive \n", m_vps->getNumOutputLayerSets() - 1 );281 exit(EXIT_FAILURE);282 }283 m_targetDecLayerIdSet = m_vps->getTargetDecLayerIdList( m_targetOptLayerSetIdx );284 }285 286 if (m_outputVpsInfo )287 {288 m_vps->printScalabilityId();289 m_vps->printLayerDependencies();290 m_vps->printLayerSets();291 m_vps->printPTL();292 }293 }294 295 if ( bNewPicture || !bitstreamFile || nalu.m_nalUnitType == NAL_UNIT_EOS )296 {297 layerIdLastPic = layerIdCurrPic;298 layerIdCurrPic = nalu.m_nuhLayerId;299 pocLastPic = pocCurrPic;300 pocCurrPic = m_tDecTop[decIdx]->getCurrPoc();301 decIdxLastPic = decIdxCurrPic;302 decIdxCurrPic = decIdx;303 allLayersDecoded = ( pocCurrPic != pocLastPic ) && ( nalu.m_nalUnitType != NAL_UNIT_EOS );304 }305 #else306 if( (m_iMaxTemporalLayer >= 0 && nalu.m_temporalId > m_iMaxTemporalLayer) || !isNaluWithinTargetDecLayerIdSet(&nalu) )307 {308 bNewPicture = false;309 }310 else311 294 { 312 295 bNewPicture = m_cTDecTop.decode(nalu, m_iSkipFrame, m_iPOCLastDisplay); 313 #endif314 296 if (bNewPicture) 315 297 { … … 327 309 bytestream.reset(); 328 310 #endif 329 #if H_MV_ENC_DEC_TRAC330 #if ENC_DEC_TRACE331 const Bool resetCounter = false;332 if ( resetCounter )333 {334 g_nSymbolCounter = symCount; // Only reset counter SH becomes traced twice335 }336 else337 {338 g_disableHLSTrace = true; // Tracing of second parsing of SH is not carried out339 }340 #endif341 #endif342 311 } 343 312 } … … 345 314 346 315 if ( (bNewPicture || !bitstreamFile || nalu.m_nalUnitType == NAL_UNIT_EOS) && 347 #if NH_MV 348 !m_tDecTop[decIdxLastPic]->getFirstSliceInSequence () ) 349 #else 316 350 317 !m_cTDecTop.getFirstSliceInSequence () ) 351 #endif352 318 353 319 { 354 320 if (!loopFiltered || bitstreamFile) 355 321 { 356 #if NH_MV357 assert( decIdxLastPic != -1 );358 m_tDecTop[decIdxLastPic]->endPicDecoding(poc, pcListPic, m_targetDecLayerIdSet );359 xMarkForOutput( allLayersDecoded, poc, layerIdLastPic );360 #else361 322 m_cTDecTop.executeLoopFilters(poc, pcListPic); 362 #endif363 323 } 364 324 loopFiltered = (nalu.m_nalUnitType == NAL_UNIT_EOS); 365 325 if (nalu.m_nalUnitType == NAL_UNIT_EOS) 366 326 { 367 #if NH_MV368 m_tDecTop[decIdxLastPic]->setFirstSliceInSequence(true);369 #else370 327 m_cTDecTop.setFirstSliceInSequence(true); 371 #endif372 328 } 373 329 } 374 330 else if ( (bNewPicture || !bitstreamFile || nalu.m_nalUnitType == NAL_UNIT_EOS ) && 375 #if NH_MV 376 m_tDecTop[decIdxLastPic]->getFirstSliceInSequence () ) 377 #else 378 m_cTDecTop.getFirstSliceInSequence () ) 379 #endif 380 { 381 #if NH_MV 382 m_tDecTop[decIdxLastPic]->setFirstSliceInPicture (true); 383 #else 331 m_cTDecTop.getFirstSliceInSequence () ) 332 { 384 333 m_cTDecTop.setFirstSliceInPicture (true); 385 #endif 386 } 387 388 #if NH_3D 389 if ( allLayersDecoded || !bitstreamFile ) 390 { 391 for( Int dI = 0; dI < m_numDecoders; dI++ ) 392 { 393 TComPic* picLastCoded = m_ivPicLists.getPic( m_tDecTop[dI]->getLayerId(), pocLastPic ); 394 assert( picLastCoded != NULL ); 395 picLastCoded->compressMotion(1); 396 } 397 } 398 #endif 334 } 399 335 400 336 if( pcListPic ) 401 337 { 402 #if NH_MV403 if ( m_pchReconFiles[decIdxLastPic] && !m_reconOpen[decIdxLastPic] )404 #else405 338 if ( m_pchReconFile && !openedReconFile ) 406 #endif407 339 { 408 340 const BitDepths &bitDepths=pcListPic->front()->getPicSym()->getSPS().getBitDepths(); // use bit depths of first reconstructed picture. … … 414 346 } 415 347 } 416 #if NH_MV 417 m_tVideoIOYuvReconFile[decIdxLastPic]->open( m_pchReconFiles[decIdxLastPic], true, m_outputBitDepth, m_outputBitDepth, bitDepths.recon ); // write mode 418 m_reconOpen[decIdxLastPic] = true; 348 m_cTVideoIOYuvReconFile.open( m_pchReconFile, true, m_outputBitDepth, m_outputBitDepth, bitDepths.recon ); // write mode 349 openedReconFile = true; 419 350 } 420 351 // write reconstruction to file 421 352 if( bNewPicture ) 422 353 { 423 // Bumping after picture has been decoded424 #if ENC_DEC_TRACE425 g_bJustDoIt = true;426 writeToTraceFile( "Bumping after decoding \n", g_decTracePicOutput );427 g_bJustDoIt = false;428 #endif429 xWriteOutput( pcListPic, decIdxLastPic, nalu.m_temporalId );430 }431 if ( (bNewPicture || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_CRA) && m_tDecTop[decIdxLastPic]->getNoOutputPriorPicsFlag() )432 {433 m_tDecTop[decIdxLastPic]->checkNoOutputPriorPics( pcListPic );434 m_tDecTop[decIdxLastPic]->setNoOutputPriorPicsFlag (false);435 }436 437 if ( bNewPicture && newSliceDiffPoc &&438 #else439 m_cTVideoIOYuvReconFile.open( m_pchReconFile, true, m_outputBitDepth, m_outputBitDepth, bitDepths.recon ); // write mode440 openedReconFile = true;441 }442 // write reconstruction to file443 if( bNewPicture )444 {445 354 xWriteOutput( pcListPic, nalu.m_temporalId ); 446 355 } … … 452 361 453 362 if ( bNewPicture && 454 #endif455 363 ( nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL 456 364 || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP … … 459 367 || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_LP ) ) 460 368 { 461 #if NH_MV 462 xFlushOutput( pcListPic, decIdxLastPic ); 463 #else 369 464 370 xFlushOutput( pcListPic ); 465 #endif466 371 } 467 372 if (nalu.m_nalUnitType == NAL_UNIT_EOS) 468 373 { 469 #if NH_MV 470 xWriteOutput( pcListPic, decIdxCurrPic, nalu.m_temporalId ); 471 #else 374 472 375 xWriteOutput( pcListPic, nalu.m_temporalId ); 473 #endif474 #if NH_MV475 m_tDecTop[decIdxCurrPic]->setFirstSliceInPicture (false);476 #else477 376 m_cTDecTop.setFirstSliceInPicture (false); 478 #endif479 377 } 480 378 // write reconstruction to file -- for additional bumping as defined in C.5.2.3 481 #if NH_MV482 // Above comment seems to be wrong483 #endif484 379 if(!bNewPicture && nalu.m_nalUnitType >= NAL_UNIT_CODED_SLICE_TRAIL_N && nalu.m_nalUnitType <= NAL_UNIT_RESERVED_VCL31) 485 380 { 486 #if NH_MV487 // Bumping after reference picture set has been applied (here after first vcl nalu.488 #if ENC_DEC_TRACE489 g_bJustDoIt = true;490 writeToTraceFile( "Bumping after reference picture set has been applied \n", g_decTracePicOutput );491 g_bJustDoIt = false;492 #endif493 494 xWriteOutput( m_tDecTop[decIdxCurrPic]->getListPic(), decIdxCurrPic, nalu.m_temporalId );495 #else496 381 xWriteOutput( pcListPic, nalu.m_temporalId ); 497 #endif 498 } 499 } 500 } 501 #if NH_MV 502 #if NH_3D 503 if( m_cCamParsCollector.isInitialized() ) 504 { 505 m_cCamParsCollector.setSlice( 0 ); 506 } 507 #endif 508 for(UInt decIdx = 0; decIdx < m_numDecoders; decIdx++) 509 { 510 xFlushOutput( m_tDecTop[decIdx]->getListPic(), decIdx ); 511 } 512 #else 382 } 383 } 384 } 385 513 386 xFlushOutput( pcListPic ); 514 387 // delete buffers … … 516 389 // destroy internal classes 517 390 xDestroyDecLib(); 391 } 518 392 #endif 519 }520 393 521 394 // ==================================================================================================================== … … 527 400 #if NH_MV 528 401 // initialize global variables 529 initROM(); 402 initROM(); 530 403 #if NH_3D_DMM 531 404 initWedgeLists(); … … 548 421 { 549 422 m_tVideoIOYuvReconFile[decIdx]->close(); 550 delete m_tVideoIOYuvReconFile[decIdx]; 423 delete m_tVideoIOYuvReconFile[decIdx]; 551 424 m_tVideoIOYuvReconFile[decIdx] = NULL ; 552 425 } … … 554 427 if( m_tDecTop[decIdx] ) 555 428 { 429 #if !NH_MV 556 430 m_tDecTop[decIdx]->deletePicBuffer(); 431 #endif 557 432 m_tDecTop[decIdx]->destroy() ; 558 433 } 559 delete m_tDecTop[decIdx] ; 434 delete m_tDecTop[decIdx] ; 560 435 m_tDecTop[decIdx] = NULL ; 561 436 } … … 571 446 #if NH_3D 572 447 m_cCamParsCollector.uninit(); 573 if( m_pScaleOffsetFile ) 574 { 575 ::fclose( m_pScaleOffsetFile ); 448 if( m_pScaleOffsetFile ) 449 { 450 ::fclose( m_pScaleOffsetFile ); 576 451 } 577 452 #endif … … 584 459 m_cCamParsCollector.setCodeScaleOffsetFile( m_pScaleOffsetFile ); 585 460 #endif 586 #if !NH_MV 461 #if NH_MV 462 m_dpb.setPrintPicOutput(m_printPicOutput); 463 #else 587 464 // initialize decoder class 588 465 m_cTDecTop.init(); … … 599 476 } 600 477 478 479 #if !NH_MV 601 480 /** \param pcListPic list of pictures to be written to file 602 481 \param tId temporal sub-layer ID 603 482 */ 604 #if NH_MV605 Void TAppDecTop::xWriteOutput( TComList<TComPic*>* pcListPic, Int decIdx, Int tId )606 #else607 483 Void TAppDecTop::xWriteOutput( TComList<TComPic*>* pcListPic, UInt tId ) 608 #endif609 484 { 610 485 if (pcListPic->empty()) … … 625 500 { 626 501 numReorderPicsHighestTid = activeSPS->getNumReorderPics(maxNrSublayers-1); 627 maxDecPicBufferingHighestTid = activeSPS->getMaxDecPicBuffering(maxNrSublayers-1); 502 maxDecPicBufferingHighestTid = activeSPS->getMaxDecPicBuffering(maxNrSublayers-1); 628 503 } 629 504 else 630 505 { 631 506 numReorderPicsHighestTid = activeSPS->getNumReorderPics(m_iMaxTemporalLayer); 632 maxDecPicBufferingHighestTid = activeSPS->getMaxDecPicBuffering(m_iMaxTemporalLayer); 507 maxDecPicBufferingHighestTid = activeSPS->getMaxDecPicBuffering(m_iMaxTemporalLayer); 633 508 } 634 509 … … 636 511 { 637 512 TComPic* pcPic = *(iterPic); 638 #if NH_MV639 if(pcPic->getOutputMark() && pcPic->getPOC() > m_pocLastDisplay[decIdx])640 #else641 513 if(pcPic->getOutputMark() && pcPic->getPOC() > m_iPOCLastDisplay) 642 #endif643 514 { 644 515 numPicsNotYetDisplayed++; … … 671 542 TComPic* pcPicBottom = *(iterPic); 672 543 673 #if NH_MV674 if ( pcPicTop->getOutputMark() && pcPicBottom->getOutputMark() &&675 (numPicsNotYetDisplayed > numReorderPicsHighestTid || dpbFullness > maxDecPicBufferingHighestTid) &&676 (!(pcPicTop->getPOC()%2) && pcPicBottom->getPOC() == pcPicTop->getPOC()+1) &&677 (pcPicTop->getPOC() == m_pocLastDisplay[decIdx]+1 || m_pocLastDisplay[decIdx] < 0))678 #else679 544 if ( pcPicTop->getOutputMark() && pcPicBottom->getOutputMark() && 680 545 (numPicsNotYetDisplayed > numReorderPicsHighestTid || dpbFullness > maxDecPicBufferingHighestTid) && 681 546 (!(pcPicTop->getPOC()%2) && pcPicBottom->getPOC() == pcPicTop->getPOC()+1) && 682 547 (pcPicTop->getPOC() == m_iPOCLastDisplay+1 || m_iPOCLastDisplay < 0)) 683 #endif684 548 { 685 549 // write to file 686 550 numPicsNotYetDisplayed = numPicsNotYetDisplayed-2; 687 #if NH_MV688 if ( m_pchReconFiles[decIdx] )689 #else690 551 if ( m_pchReconFile ) 691 #endif692 552 { 693 553 const Window &conf = pcPicTop->getConformanceWindow(); … … 708 568 if (display) 709 569 { 710 #if NH_MV711 assert( conf .getScaledFlag() );712 assert( defDisp.getScaledFlag() );713 #if ENC_DEC_TRACE714 g_bJustDoIt = true;715 writeToTraceFile( "OutputPic Poc" , pcPic->getPOC (), g_decTracePicOutput );716 writeToTraceFile( "OutputPic LayerId", pcPic->getLayerId(), g_decTracePicOutput );717 g_bJustDoIt = false;718 #endif719 m_tVideoIOYuvReconFile[decIdx]->write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),720 #else721 570 m_cTVideoIOYuvReconFile.write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(), 722 #endif723 571 m_outputColourSpaceConvert, 724 572 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 725 573 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 726 574 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 727 #if NH_3D728 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), m_depth420OutputFlag && pcPicTop->getIsDepth() ? CHROMA_420 : NUM_CHROMA_FORMAT, isTff );729 #else730 575 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), NUM_CHROMA_FORMAT, isTff ); 731 #endif732 576 } 733 577 } 734 578 735 579 // update POC of display order 736 #if NH_MV737 m_pocLastDisplay[decIdx] = pcPic->getPOC();738 #else739 580 m_iPOCLastDisplay = pcPicBottom->getPOC(); 740 #endif741 581 742 582 // erase non-referenced picture in the reference picture list after display … … 768 608 pcPic = *(iterPic); 769 609 770 #if NH_MV771 if(pcPic->getOutputMark() && pcPic->getPOC() > m_pocLastDisplay[decIdx] &&772 (numPicsNotYetDisplayed > numReorderPicsHighestTid || dpbFullness > maxDecPicBufferingHighestTid))773 #else774 610 if(pcPic->getOutputMark() && pcPic->getPOC() > m_iPOCLastDisplay && 775 611 (numPicsNotYetDisplayed > numReorderPicsHighestTid || dpbFullness > maxDecPicBufferingHighestTid)) 776 #endif777 612 { 778 613 // write to file … … 782 617 dpbFullness--; 783 618 } 784 #if NH_MV785 if ( m_pchReconFiles[decIdx] )786 #else787 619 if ( m_pchReconFile ) 788 #endif789 620 { 790 621 const Window &conf = pcPic->getConformanceWindow(); 791 622 const Window defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window(); 792 #if NH_MV 793 assert( conf .getScaledFlag() ); 794 assert( defDisp.getScaledFlag() ); 795 #if ENC_DEC_TRACE 796 g_bJustDoIt = true; 797 writeToTraceFile( "OutputPic Poc" , pcPic->getPOC (), g_decTracePicOutput ); 798 writeToTraceFile( "OutputPic LayerId", pcPic->getLayerId(), g_decTracePicOutput ); 799 g_bJustDoIt = false; 800 #endif 801 m_tVideoIOYuvReconFile[decIdx]->write( pcPic->getPicYuvRec(), 802 #else 623 803 624 m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(), 804 #endif805 625 m_outputColourSpaceConvert, 806 626 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 807 627 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 808 628 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 809 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), 810 #if NH_3D 811 m_depth420OutputFlag && pcPic->getIsDepth() ? CHROMA_420 : NUM_CHROMA_FORMAT, 812 #else 813 NUM_CHROMA_FORMAT, 814 #endif 815 m_bClipOutputVideoToRec709Range ); 629 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), 630 NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range ); 816 631 } 817 632 818 633 // update POC of display order 819 #if NH_MV820 m_pocLastDisplay[decIdx] = pcPic->getPOC();821 #else822 634 m_iPOCLastDisplay = pcPic->getPOC(); 823 #endif824 635 825 636 // erase non-referenced picture in the reference picture list after display … … 832 643 } 833 644 pcPic->setOutputMark(false); 834 #if NH_MV835 pcPic->setPicOutputFlag(false);836 #endif837 645 } 838 646 … … 844 652 /** \param pcListPic list of pictures to be written to file 845 653 */ 846 #if NH_MV847 Void TAppDecTop::xFlushOutput( TComList<TComPic*>* pcListPic, Int decIdx )848 #else849 654 Void TAppDecTop::xFlushOutput( TComList<TComPic*>* pcListPic ) 850 #endif851 655 { 852 656 if(!pcListPic || pcListPic->empty()) … … 873 677 { 874 678 // write to file 875 #if NH_MV 876 if ( m_pchReconFiles[decIdx] ) 877 #else 679 878 680 if ( m_pchReconFile ) 879 #endif880 681 { 881 682 const Window &conf = pcPicTop->getConformanceWindow(); 882 683 const Window defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window(); 883 684 const Bool isTff = pcPicTop->isTopField(); 884 #if NH_MV885 assert( conf .getScaledFlag() );886 assert( defDisp.getScaledFlag() );887 #if ENC_DEC_TRACE888 g_bJustDoIt = true;889 writeToTraceFile( "OutputPic Poc" , pcPic->getPOC (), g_decTracePicOutput );890 writeToTraceFile( "OutputPic LayerId", pcPic->getLayerId(), g_decTracePicOutput );891 g_bJustDoIt = false;892 #endif893 m_tVideoIOYuvReconFile[decIdx]->write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),894 #else895 685 m_cTVideoIOYuvReconFile.write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(), 896 #endif897 686 m_outputColourSpaceConvert, 898 687 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 899 688 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 900 689 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 901 #if NH_3D902 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), m_depth420OutputFlag && pcPicTop->getIsDepth() ? CHROMA_420 : NUM_CHROMA_FORMAT, isTff );903 #else904 690 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), NUM_CHROMA_FORMAT, isTff ); 905 #endif906 691 } 907 692 908 693 // update POC of display order 909 #if NH_MV910 m_pocLastDisplay[decIdx] = pcPic->getPOC();911 #else912 694 m_iPOCLastDisplay = pcPicBottom->getPOC(); 913 #endif 695 914 696 // erase non-referenced picture in the reference picture list after display 915 697 if ( !pcPicTop->getSlice(0)->isReferenced() && pcPicTop->getReconMark() == true ) … … 954 736 { 955 737 // write to file 956 #if NH_MV957 if ( m_pchReconFiles[decIdx] )958 #else959 738 if ( m_pchReconFile ) 960 #endif961 739 { 962 740 const Window &conf = pcPic->getConformanceWindow(); 963 741 const Window defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window(); 964 #if NH_MV965 assert( conf .getScaledFlag() );966 assert( defDisp.getScaledFlag() );967 #if ENC_DEC_TRACE968 g_bJustDoIt = true;969 writeToTraceFile( "OutputPic Poc" , pcPic->getPOC (), g_decTracePicOutput );970 writeToTraceFile( "OutputPic LayerId", pcPic->getLayerId(), g_decTracePicOutput );971 g_bJustDoIt = false;972 #endif973 m_tVideoIOYuvReconFile[decIdx]->write( pcPic->getPicYuvRec(),974 #else975 742 m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(), 976 #endif977 743 m_outputColourSpaceConvert, 978 744 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 979 745 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 980 746 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 981 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), 982 #if NH_3D 983 m_depth420OutputFlag && pcPic->getIsDepth() ? CHROMA_420 : NUM_CHROMA_FORMAT 984 #else 985 NUM_CHROMA_FORMAT 986 #endif 987 , m_bClipOutputVideoToRec709Range); 747 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), 748 NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range ); 988 749 } 989 750 990 751 // update POC of display order 991 #if NH_MV992 m_pocLastDisplay[decIdx] = pcPic->getPOC();993 #else994 752 m_iPOCLastDisplay = pcPic->getPOC(); 995 #endif996 997 753 // erase non-referenced picture in the reference picture list after display 998 754 if ( !pcPic->getSlice(0)->isReferenced() && pcPic->getReconMark() == true ) … … 1004 760 } 1005 761 pcPic->setOutputMark(false); 1006 #if NH_MV 1007 pcPic->setPicOutputFlag(false); 1008 #endif 1009 } 1010 #if !NH_MV 762 } 1011 763 if(pcPic != NULL) 1012 764 { … … 1015 767 pcPic = NULL; 1016 768 } 1017 #endif1018 769 iterPic++; 1019 770 } 1020 771 } 1021 #if NH_MV1022 m_pocLastDisplay[decIdx] = -MAX_INT;1023 #else1024 772 pcListPic->clear(); 1025 773 m_iPOCLastDisplay = -MAX_INT; 774 } 1026 775 #endif 1027 }1028 1029 776 /** \param nalu Input nalu to check whether its LayerId is within targetDecLayerIdSet 1030 777 */ 778 #if NH_MV 779 Bool TAppDecTop::xIsNaluInTargetDecLayerIdSet( InputNALUnit* nalu ) 780 #else 1031 781 Bool TAppDecTop::isNaluWithinTargetDecLayerIdSet( InputNALUnit* nalu ) 782 #endif 1032 783 { 1033 784 if ( m_targetDecLayerIdSet.size() == 0 ) // By default, the set is empty, meaning all LayerIds are allowed … … 1037 788 for (std::vector<Int>::iterator it = m_targetDecLayerIdSet.begin(); it != m_targetDecLayerIdSet.end(); it++) 1038 789 { 790 if ( nalu->m_nuhLayerId == (*it) ) 791 { 792 return true; 793 } 794 } 795 return false; 796 } 797 1039 798 #if NH_MV 1040 if ( nalu->m_nuhLayerId == (*it) ) 1041 #else 1042 if ( nalu->m_nuhLayerId == (*it) ) 799 800 Bool TAppDecTop::xExtractAndRewrite( InputNALUnit* nalu ) 801 { 802 Bool naluInSubStream; 803 if ( !m_initilizedFromVPS ) 804 { 805 naluInSubStream = true; // No active VPS yet. Wait for slice activating one. 806 } 807 else 808 { 809 if ( m_decProcCvsg == CLAUSE_8 ) 810 { 811 // 8.1.2->clause 10 812 813 // sub-bitstream extraction process as specified in clause 10 814 naluInSubStream = true; 815 if ( nalu->m_temporalId > m_highestTid || !xIsNaluInTargetDecLayerIdSet(nalu) ) 816 { 817 naluInSubStream = false; 818 } 819 } 820 else 821 { 822 // F.8.1.2 823 Int targetDecLayerSetIdx = m_vps->olsIdxToLsIdx( m_targetOptLayerSetIdx ); 824 if ( targetDecLayerSetIdx <= m_vps->getVpsNumLayerSetsMinus1() && m_vps->getVpsBaseLayerInternalFlag() ) 825 { 826 // - If TargetDecLayerSetIdx is less than or equal to vps_num_layer_sets_minus1 and 827 // vps_base_layer_internal_flag is equal to 1, the following applies: 828 // - The sub-bitstream extraction process as specified in clause 10 is applied with the CVSG, HighestTid and 829 // TargetDecLayerIdList as inputs, and the output is assigned to a bitstream referred to as BitstreamToDecode. 830 831 naluInSubStream = true; 832 if ( nalu->m_temporalId > m_highestTid || !xIsNaluInTargetDecLayerIdSet(nalu) ) 833 { 834 naluInSubStream = false; 835 } 836 837 } 838 else if ( targetDecLayerSetIdx <= m_vps->getVpsNumLayerSetsMinus1() && !m_vps->getVpsBaseLayerInternalFlag() ) 839 { 840 // - Otherwise, if TargetDecLayerSetIdx is less than or equal to vps_num_layer_sets_minus1 and vps_base_layer_internal_flag 841 // is equal to 0, the following applies: 842 // - The sub-bitstream extraction process as specified in clause F.10.1 is applied with the CVSG, HighestTid and 843 // TargetDecLayerIdList as inputs, and the output is assigned to a bitstream referred to as BitstreamToDecode. 844 845 naluInSubStream = true; 846 if ( nalu->m_temporalId > m_highestTid || !xIsNaluInTargetDecLayerIdSet(nalu) ) 847 { 848 naluInSubStream = false; 849 } 850 } 851 else if ( targetDecLayerSetIdx > m_vps->getVpsNumLayerSetsMinus1() && m_vps->getNumLayersInIdList( targetDecLayerSetIdx ) == 1 ) 852 { 853 // - Otherwise, if TargetDecLayerSetIdx is greater than vps_num_layer_sets_minus1 and 854 // NumLayersInIdList[ TargetDecLayerSetIdx ] is equal to 1, the following applies: 855 // - The independent non-base layer rewriting process of clause F.10.2 is applied with the CVSG, HighestTid and 856 // TargetDecLayerIdList[ 0 ] as inputs, and the output is assigned to a bitstream referred to as BitstreamToDecode. 857 858 Int assingedBaseLayerId = m_targetDecLayerIdSet[0]; 859 naluInSubStream = true; 860 861 if ( nalu->m_nalUnitType != NAL_UNIT_SPS && 862 nalu->m_nalUnitType != NAL_UNIT_PPS && 863 nalu->m_nalUnitType != NAL_UNIT_EOB && 864 nalu->m_nuhLayerId != assingedBaseLayerId ) 865 { 866 naluInSubStream = false; 867 } 868 869 if ( ( nalu->m_nalUnitType == NAL_UNIT_SPS || nalu->m_nalUnitType != NAL_UNIT_PPS ) && 870 !( nalu->m_nuhLayerId == 0 || nalu->m_nuhLayerId == assingedBaseLayerId ) ) 871 { 872 naluInSubStream = false; 873 } 874 875 if ( nalu->m_nalUnitType == NAL_UNIT_VPS ) 876 { 877 naluInSubStream = false; 878 } 879 880 if ( nalu->m_temporalId > m_highestTid ) 881 { 882 naluInSubStream = false; 883 } 884 885 // For now, don't do the layer id change here, but change smallest layer id. 886 // To be verified. 887 //if ( naluInSubStream ) 888 //{ 889 // nalu->m_nuhLayerId = 0; 890 //} 891 } 892 else 893 { 894 // - Otherwise, the following applies: 895 // - The sub-bitstream extraction process as specified in clause F.10.3 is applied with the CVSG, HighestTid and 896 // TargetDecLayerIdList as inputs, and the output is assigned to a bitstream referred to as BitstreamToDecode. 897 898 naluInSubStream = true; 899 900 if ( nalu->m_nalUnitType != NAL_UNIT_VPS && 901 nalu->m_nalUnitType != NAL_UNIT_SPS && 902 nalu->m_nalUnitType != NAL_UNIT_PPS && 903 nalu->m_nalUnitType != NAL_UNIT_EOS && 904 nalu->m_nalUnitType != NAL_UNIT_EOB && 905 !xIsNaluInTargetDecLayerIdSet(nalu) ) 906 { 907 naluInSubStream = false; 908 } 909 910 if ( ( nalu->m_nalUnitType == NAL_UNIT_VPS || 911 nalu->m_nalUnitType == NAL_UNIT_SPS || 912 nalu->m_nalUnitType == NAL_UNIT_PPS || 913 nalu->m_nalUnitType == NAL_UNIT_EOS ) && 914 !( nalu->m_nuhLayerId == 0 || xIsNaluInTargetDecLayerIdSet(nalu) ) 915 ) 916 { 917 naluInSubStream = false; 918 } 919 920 if ( nalu->m_temporalId > m_highestTid ) 921 { 922 naluInSubStream = false; 923 } 924 // TBD: vps_base_layer_available_flag in each VPS is set equal to 0. 925 } 926 } 927 } 928 929 return naluInSubStream; 930 } 931 932 Void TAppDecTop::xProcessVclNalu( InputNALUnit nalu ) 933 { 934 TDecTop* dec = xGetDecoder( nalu ); 935 936 // Decode slice header of slice of current or new picture. 937 dec->decodeSliceHeader( nalu ); 938 939 // Check if slice belongs to current or new picture 940 Bool sliceIsFirstOfNewPicture = dec->getFirstSliceSegementInPicFlag(); 941 942 if ( !xIsSkipVclNalu( nalu, sliceIsFirstOfNewPicture ) ) 943 { 944 if ( sliceIsFirstOfNewPicture ) 945 { 946 xDetectNewPocResettingPeriod( nalu ); 947 Bool sliceIsFirstOfNewAU = xDetectNewAu( nalu ); 948 xFinalizePreviousPictures ( sliceIsFirstOfNewAU ); 949 xDecodeFirstSliceOfPicture( nalu, sliceIsFirstOfNewAU ); 950 } 951 else 952 { 953 xDecodeFollowSliceOfPicture( nalu ); 954 } 955 } 956 } 957 958 Bool TAppDecTop::xIsSkipVclNalu( InputNALUnit& nalu, Bool isFirstSliceOfPic ) 959 { 960 961 TDecTop* dec = xGetDecoder( nalu ); 962 963 m_handleCraAsBlaFlagSetByExtMeans = false; 964 Bool skipNalu = false; 965 966 if ( isFirstSliceOfPic ) 967 { 968 m_totalNumofPicsReceived++; 969 } 970 971 if (!m_cvsStartFound ) 972 { 973 // Skip as specified by decoder option. (Not normative!) 974 if ( m_totalNumofPicsReceived <= m_iSkipFrame ) 975 { 976 skipNalu = true; 977 if ( isFirstSliceOfPic ) 978 { 979 std::cout << "Layer " << std::setfill(' ') << std::setw(2) << nalu.m_nuhLayerId 980 << " POC ? Skipping picture." << std::setw(5) << m_totalNumofPicsReceived - 1 << std::endl; 981 } 982 } 983 else 984 { 985 if ( dec->getIsInOwnTargetDecLayerIdList() ) 986 { 987 // Search for initial IRAP access unit 988 Bool canBeSliceOfInitialIrapAu = nalu.isIrap() && ( dec->decProcClause8() || nalu.m_nuhLayerId == dec->getSmallestLayerId() ); 989 990 if ( !canBeSliceOfInitialIrapAu ) 991 { 992 skipNalu = true; 993 if ( isFirstSliceOfPic ) 994 { 995 std::cout << "Layer " << std::setfill(' ') << std::setw(2) << nalu.m_nuhLayerId 996 << " POC ? Not an initial IRAP AU. Skipping picture." << std::setw(5) << m_totalNumofPicsReceived - 1 << std::endl; 997 } 998 } 999 else 1000 { 1001 m_cvsStartFound = true; 1002 if( nalu.isCra() ) 1003 { 1004 // Ensure that NoRaslOutputFlag of picture is equal to 1. 1005 m_handleCraAsBlaFlagSetByExtMeans = true; 1006 m_handleCraAsBlaFlag = true; 1007 } 1008 } 1009 } 1010 else 1011 { 1012 skipNalu = true; 1013 } 1014 } 1015 } 1016 else 1017 { 1018 assert( dec->getIsInOwnTargetDecLayerIdList() ); 1019 } 1020 return skipNalu; 1021 } 1022 1023 Void TAppDecTop::xProcessNonVclNalu( InputNALUnit nalu ) 1024 { 1025 xGetDecoder(nalu)->decodeNonVclNalu( nalu ); 1026 1027 if ( nalu.m_nalUnitType == NAL_UNIT_EOS ) 1028 { 1029 m_eosInLayer[ nalu.m_nuhLayerId ] = true; 1030 } 1031 } 1032 Void TAppDecTop::xTerminateDecoding() 1033 { 1034 xFinalizePic( true ); 1035 xFinalizeAU ( ); 1036 1037 #if NH_3D 1038 if( m_cCamParsCollector.isInitialized() ) 1039 { 1040 m_cCamParsCollector.setSlice( 0 ); 1041 } 1043 1042 #endif 1044 { 1045 return true; 1046 } 1047 } 1048 return false; 1049 } 1050 1051 #if NH_MV 1043 xFlushOutput(); 1044 m_dpb.emptyAllSubDpbs(); 1045 } 1046 1047 1048 ////////////////////////////// 1049 /// Process slices 1050 ////////////////////////////// 1051 1052 Void TAppDecTop::xDecodeFirstSliceOfPicture( InputNALUnit nalu, Bool sliceIsFirstOfNewAu ) 1053 { 1054 TDecTop* dec = xGetDecoder(nalu); 1055 // Initialize from VPS of first slice 1056 1057 // Get current SPS and PPS 1058 TComSlice* slicePilot = dec->getSlicePilot(); 1059 m_vps = slicePilot->getVPS(); 1060 m_sps = slicePilot->getSPS(); 1061 m_pps = slicePilot->getPPS(); 1062 1063 /// Use VPS activated by the first slice to initialized decoding 1064 if( !m_initilizedFromVPS ) 1065 { 1066 xF811GeneralDecProc( nalu ); 1067 m_initilizedFromVPS = true; 1068 m_newVpsActivatedbyCurAu = true; //TBD 1069 m_newVpsActivatedbyCurPic = true; 1070 #if NH_3D 1071 m_dpb.setVPS( m_vps ); 1072 #endif 1073 } 1074 1075 // Create new sub-DBP if not existing 1076 m_dpb.getSubDpb( nalu.m_nuhLayerId, true ); 1077 1078 // Create a new picture initialize and make it the current picture 1079 assert( m_curPic == NULL ); 1080 m_curPic = new TComPic; 1081 1082 m_curPic->create(*m_sps, *m_pps, true); 1083 1084 m_curPic->setLayerId ( nalu.m_nuhLayerId ); 1085 m_curPic->setDecodingOrder ( m_decodingOrder[ nalu.m_nuhLayerId ]); 1086 m_curPic->setIsFstPicOfAllLayOfPocResetPer( m_newPicIsFstPicOfAllLayOfPocResetPer ); 1087 m_curPic->setIsPocResettingPic ( m_newPicIsPocResettingPic ); 1088 m_curPic->setActivatesNewVps ( m_newVpsActivatedbyCurPic ); 1089 1090 dec ->activatePSsAndInitPicOrSlice( m_curPic ); 1091 1092 m_decodingOrder[ nalu.m_nuhLayerId ]++; 1093 1094 // Insert pic to current AU 1095 // ( There is also a "current AU in the DBP", however the DBP AU will include the current 1096 // picture only after it is inserted to the DBP ) 1097 m_curAu.addPic( m_curPic, true ); 1098 1099 // Invoke Claus 8 and Annex F decoding process for a picture (only parts before POC derivation ). 1100 xPicDecoding( START_PIC, sliceIsFirstOfNewAu ); 1101 1102 if (m_decProcCvsg == ANNEX_F ) 1103 { 1104 // Do output before POC derivation 1105 xF13522OutputAndRemOfPicsFromDpb( true ); 1106 } 1107 1108 // Decode POC and apply reference picture set 1109 dec->setDecProcPocAndRps( m_decProcPocAndRps ); 1110 dec->decodePocAndRps( ); 1111 1112 // Do output after POC and RPS derivation 1113 if (m_decProcCvsg == CLAUSE_8 ) 1114 { 1115 xC522OutputAndRemOfPicsFromDpb( ); 1116 } 1117 else if (m_decProcCvsg == ANNEX_F ) 1118 { 1119 xF13522OutputAndRemOfPicsFromDpb( false ); 1120 } 1121 else 1122 { 1123 assert(false); 1124 } 1125 1126 // Generate unavailable reference pictures 1127 dec->genUnavailableRefPics( ); 1128 1129 // decode first slice segment 1130 dec->decodeSliceSegment( nalu ); 1131 1132 m_firstSliceInBitstream = false; 1133 } 1134 1135 Void TAppDecTop::xDecodeFollowSliceOfPicture( InputNALUnit nalu ) 1136 { 1137 // decode following segment 1138 TDecTop* dec = xGetDecoder( nalu ); 1139 dec->activatePSsAndInitPicOrSlice( NULL ); 1140 dec->decodeSliceSegment ( nalu ); 1141 } 1142 1143 Void TAppDecTop::xFinalizePreviousPictures( Bool sliceIsFirstOfNewAU ) 1144 { 1145 Bool curPicIsLastInAu = sliceIsFirstOfNewAU && (m_curPic != NULL); 1146 // When slice belongs to new picture, finalize current picture. 1147 if( m_curPic != NULL ) 1148 { 1149 xFinalizePic( curPicIsLastInAu ); 1150 1151 if (m_curPic->isIrap() ) 1152 { 1153 m_noRaslOutputFlagAssocIrap[ m_curPic->getLayerId() ] = m_curPic->getNoRaslOutputFlag(); 1154 } 1155 1156 m_tDecTop[ xGetDecoderIdx( m_curPic->getLayerId() )]->finalizePic(); 1157 m_curPic->getPicYuvRec()->extendPicBorder(); 1158 m_newVpsActivatedbyCurPic = false; 1159 } 1160 1161 // When slice belongs to new AU, finalize current AU. 1162 if ( curPicIsLastInAu && !m_curAu.empty() ) 1163 { 1164 xFinalizeAU( ); 1165 m_newVpsActivatedbyCurAu = false; 1166 m_curAu.clear(); 1167 } 1168 m_curPic = NULL; 1169 } 1170 1171 1172 Void TAppDecTop::xFinalizePic(Bool curPicIsLastInAu ) 1173 { 1174 if ( m_curPic != NULL ) 1175 { 1176 m_tDecTop[ xGetDecoderIdx(m_curPic->getLayerId() ) ]->executeLoopFilters( ); // 8.7 1177 1178 // Invoke Claus 8 and F.8 decoding process for a picture (only parts after POC derivation ) 1179 xPicDecoding(FINALIZE_PIC, curPicIsLastInAu ); 1180 1181 if( m_decProcCvsg == CLAUSE_8 ) 1182 { 1183 xC523PicDecMarkAddBumpAndStor ( ); 1184 } 1185 else if ( m_decProcCvsg == ANNEX_F ) 1186 { 1187 xF13523PicDecMarkAddBumpAndStor ( curPicIsLastInAu ); 1188 } 1189 } 1190 } 1191 1192 Void TAppDecTop::xFinalizeAU() 1193 { 1194 #if NH_3D 1195 if ( !m_curAu.empty()) 1196 { 1197 for (TComList<TComPic*>::iterator it = m_curAu.begin(); it != m_curAu.end(); it++) 1198 { 1199 TComPic* pic = (*it); 1200 if ( !pic->getHasGeneratedRefPics() ) 1201 { 1202 pic->compressMotion(1); 1203 } 1204 } 1205 } 1206 #endif 1207 } 1208 1209 1210 Void TAppDecTop::xF811GeneralDecProc( InputNALUnit nalu ) 1211 { 1212 //////////////////////////////////////////////////////////////////////////////// 1213 // F.8.1 General decoding process 1214 //////////////////////////////////////////////////////////////////////////////// 1215 1216 // The following applies at the beginning of decoding a CVSG, after activating the VPS RBSP that is active for 1217 // the entire CVSG and before decoding any VCL NAL units of the CVSG: 1218 1219 if ( !m_vps->getVpsExtensionFlag() ) 1220 { 1221 //- If vps_extension( ) is not present in the active VPS or a decoding process specified in this annex is not in use, 1222 // clause 8.1.2 is invoked with the CVSG as input. 1223 x812CvsgDecodingProcess( xGetDecoderIdx( nalu.m_nuhLayerId ) ); 1224 m_decProcCvsg = CLAUSE_8; 1225 } 1226 else 1227 { 1228 // - Otherwise (vps_extension( ) is present in the active VPS and a decoding process specified in this annex is in use), 1229 xF812CvsgDecodingProcess( xGetDecoderIdx( nalu.m_nuhLayerId ) ); 1230 xF13521InitDpb(); 1231 m_decProcCvsg = ANNEX_F; 1232 } 1233 1234 if ( m_printVpsInfo && ( m_decProcCvsg == ANNEX_F ) ) 1235 { 1236 m_vps->printScalabilityId(); 1237 m_vps->printLayerDependencies(); 1238 m_vps->printLayerSets(); 1239 m_vps->printPTL(); 1240 } 1241 } 1242 1243 Void TAppDecTop::xPicDecoding( DecProcPart curPart, Bool picPosInAuIndication ) 1244 { 1245 if ( m_decProcCvsg == CLAUSE_8 ) 1246 { 1247 // F.8.1.1 -> 8.1.2 -> 8.1.3 1248 x813decProcForCodPicWithLIdZero ( curPart ); 1249 } 1250 else if ( m_decProcCvsg == ANNEX_F ) 1251 { 1252 if ( m_targetOptLayerSetIdx == 0 ) 1253 { 1254 // F.8.1.1 -> F.8.1.2 -> 8.1.3 1255 x813decProcForCodPicWithLIdZero ( curPart ); 1256 } 1257 else 1258 { 1259 // F.8.1.1 -> F.8.1.2 -> F.8.1.3 1260 xF813ComDecProcForACodedPic( curPart, picPosInAuIndication ); 1261 } 1262 } 1263 else 1264 { 1265 assert( false ); 1266 } 1267 } 1268 1269 Void TAppDecTop::x812CvsgDecodingProcess( Int decIdx ) 1270 { 1271 /////////////////////////////////////////////////////////////////////////////////////// 1272 // 8.1.2 CVSG decoding process 1273 /////////////////////////////////////////////////////////////////////////////////////// 1274 1275 // The layer identifier list TargetDecLayerIdList, which specifies the list of nuh_layer_id values, 1276 // in increasing order of nuh_layer_id values, of the NAL units to be decoded, is specified as follows: 1277 1278 Bool externalMeansToSetTargetDecLayerIdList = !m_targetDecLayerIdSetFileEmpty; 1279 1280 if ( externalMeansToSetTargetDecLayerIdList ) 1281 { 1282 // - If some external means, not specified in this Specification, is available to set TargetDecLayerIdList, 1283 // TargetDecLayerIdList is set by the external means. 1284 assert( !m_targetDecLayerIdSet.empty() ); // Already done when parsing cfg ile 1285 } 1286 else 1287 { 1288 //- Otherwise, TargetDecLayerIdList contains only one nuh_layer_id value that is equal to 0. 1289 m_targetDecLayerIdSet.clear(); 1290 m_targetDecLayerIdSet.push_back( 0 ); 1291 } 1292 1293 // The variable HighestTid, which identifies the highest temporal sub-layer to be decoded, is specified as follows: 1294 Bool externalMeansSetHighestTid = ( m_iMaxTemporalLayer != -1 ); 1295 if ( externalMeansSetHighestTid ) 1296 { 1297 //- If some external means, not specified in this Specification, is available to set HighestTid, 1298 // HighestTid is set by the external means. 1299 m_highestTid = m_iMaxTemporalLayer; 1300 } 1301 else 1302 { 1303 //- Otherwise, HighestTid is set equal to sps_max_sub_layers_minus1. 1304 m_highestTid = m_sps->getSpsMaxSubLayersMinus1(); 1305 } 1306 1307 //The variable SubPicHrdFlag is specified as follows: 1308 //- If the decoding process is invoked in a bitstream conformance test as specified in clause C.1, SubPicHrdFlag is set as specified in clause C.1. 1309 //- Otherwise, SubPicHrdFlag is set equal to ( SubPicHrdPreferredFlag && sub_pic_hrd_params_present_flag ). 1310 1311 // The sub-bitstream extraction process as specified in clause 10 is applied with the CVSG, HighestTid and TargetDecLayerIdList as inputs, and the output is assigned to a bitstream referred to as BitstreamToDecode. 1312 } 1313 1314 Void TAppDecTop::x813decProcForCodPicWithLIdZero( DecProcPart curPart ) 1315 { 1316 //////////////////////////////////////////////////////////////////////////////// 1317 // 8.1.3 Decoding process for a coded picture with nuh_layer_id equal to 0. 1318 //////////////////////////////////////////////////////////////////////////////// 1319 1320 if ( curPart == START_PIC ) 1321 { 1322 Int nuhLayerId = m_curPic->getLayerId(); 1323 1324 if ( ( m_curPic->isBla() && m_curPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP ) || m_curPic->isCra() ) 1325 { 1326 // Not needed. 1327 // When the current picture is a BLA picture that has nal_unit_type equal to BLA_W_LP or is a CRA picture, the following applies: 1328 // - If some external means not specified in this Specification is available to set the variable UseAltCpbParamsFlag to a value, UseAltCpbParamsFlag is set equal to the value provided by the external means. 1329 // - Otherwise, the value of UseAltCpbParamsFlag is set equal to 0. 1330 } 1331 1332 if ( m_curPic->isIrap() ) 1333 { 1334 // When the current picture is an IRAP picture, the following applies: 1335 if ( m_curPic->isIdr() || m_curPic->isBla() || m_curPic->getDecodingOrder() == 0 || m_eosInLayer[ nuhLayerId ] ) 1336 { 1337 // - If the current picture is an IDR picture, a BLA picture, the first picture in the bitstream in decoding order, 1338 // or the first picture that follows an end of sequence NAL unit in decoding order, the variable NoRaslOutputFlag 1339 // is set equal to 1. 1340 1341 m_curPic->setNoRaslOutputFlag( true ); 1342 } 1343 else if ( m_handleCraAsBlaFlagSetByExtMeans ) 1344 { 1345 // - Otherwise, if some external means not specified in this Specification is available to set the variable HandleCraAsBlaFlag 1346 // to a value for the current picture, the variable HandleCraAsBlaFlag is set equal to the value provided by 1347 // the external means and the variable NoRaslOutputFlag is set equal to HandleCraAsBlaFlag. 1348 1349 m_curPic->setNoRaslOutputFlag( m_handleCraAsBlaFlag ); 1350 } 1351 else 1352 { 1353 // - Otherwise, the variable HandleCraAsBlaFlag is set equal to 0 and the variable NoRaslOutputFlag is set equal to 0. 1354 m_handleCraAsBlaFlag = false; 1355 m_curPic->setNoRaslOutputFlag( false ); 1356 } 1357 } 1358 1359 m_decProcPocAndRps = CLAUSE_8; 1360 } 1361 else if ( curPart == FINALIZE_PIC ) 1362 { 1363 // - PicOutputFlag is set as follows: 1364 if (m_curPic->isRasl() && m_noRaslOutputFlagAssocIrap[ m_curPic->getLayerId() ] ) 1365 { 1366 // - If the current picture is a RASL picture and NoRaslOutputFlag of the associated IRAP picture is equal to 1, 1367 // PicOutputFlag is set equal to 0. 1368 m_curPic->setPicOutputFlag( false ); 1369 } 1370 else 1371 { 1372 // - Otherwise, PicOutputFlag is set equal to pic_output_flag. 1373 m_curPic->setPicOutputFlag( m_curPic->getSlice(0)->getPicOutputFlag() ); 1374 } 1375 1376 // 4. After all slices of the current picture have been decoded, the decoded picture is marked as "used for short-term reference". 1377 m_curPic->markAsUsedForShortTermReference(); 1378 } 1379 } 1380 1381 // F.8.1.2 1382 Void TAppDecTop::xF812CvsgDecodingProcess( Int decIdx ) 1383 { 1384 /////////////////////////////////////////////////////////////////////////////////////// 1385 // F.8.1.2 CVSG decoding process 1386 /////////////////////////////////////////////////////////////////////////////////////// 1387 1388 // The variable TargetOlsIdx, which specifies the index to the list of the OLSs 1389 // specified by the VPS, of the target OLS, is specified as follows: 1390 1391 1392 // If some external means, not specified in this Specification, is available to set 1393 // TargetOlsIdx, TargetOlsIdx is set by the external means. 1394 1395 // For this decoder the TargetOlsIdx is always set by external means: 1396 // When m_targetOptLayerSetIdx is equal to -1, TargetOlsIdx is set to getVpsNumLayerSetsMinus1 (which has already been done in TDecTop, since needed there for parsing) 1397 // Otherwise m_targetOptLayerSetIdx is used directly. 1398 1399 if ( m_targetOptLayerSetIdx == -1 ) 1400 { 1401 m_targetOptLayerSetIdx = m_tDecTop[decIdx]->getTargetOlsIdx(); 1402 } 1403 else 1404 { 1405 assert( m_tDecTop[decIdx]->getTargetOlsIdx() == m_targetOptLayerSetIdx ); 1406 } 1407 1408 m_targetDecLayerSetIdx = m_vps->olsIdxToLsIdx( m_targetOptLayerSetIdx ); 1409 m_targetDecLayerIdSet = m_vps->getTargetDecLayerIdList( m_targetOptLayerSetIdx ); 1410 1411 1412 if ( m_targetOptLayerSetIdx < 0 || m_targetOptLayerSetIdx >= m_vps->getNumOutputLayerSets() ) 1413 { 1414 fprintf(stderr, "\ntarget output layer set index must be in the range of 0 to %d, inclusive \n", m_vps->getNumOutputLayerSets() - 1 ); 1415 exit(EXIT_FAILURE); 1416 } 1417 1418 if ( !m_vps->getVpsBaseLayerAvailableFlag() ) 1419 { 1420 if( m_targetDecLayerSetIdx < m_vps->getFirstAddLayerSetIdx() || m_targetDecLayerSetIdx > m_vps->getLastAddLayerSetIdx() ) 1421 { 1422 // When vps_base_layer_available_flag is equal to 0, OlsIdxToLsIdx[ TargetOlsIdx ] shall be in the range of FirstAddLayerSetIdx to LastAddLayerSetIdx, inclusive. 1423 fprintf(stderr, "\nvps_base_layer_available_flag is equal to 0, OlsIdxToLsIdx[ TargetOlsIdx ] shall be in the range of %d to %d, inclusive \n", m_vps->getFirstAddLayerSetIdx(), m_vps->getLastAddLayerSetIdx() ); 1424 exit(EXIT_FAILURE); 1425 } 1426 } 1427 1428 if ( !m_vps->getVpsBaseLayerInternalFlag() && m_targetOptLayerSetIdx <= 0 ) 1429 { 1430 // When vps_base_layer_internal_flag is equal to 0, TargetOlsIdx shall be greater than 0. 1431 fprintf(stderr, "\nvps_base_layer_internal_flag is equal to 0, TargetOlsIdx shall be greater than 0.\n" ); 1432 exit(EXIT_FAILURE); 1433 } 1434 1435 // The variable HighestTid, which identifies the highest temporal sub-layer to be decoded, 1436 // is specified as follows: 1437 1438 Bool externalMeansSetHighestTid = ( m_iMaxTemporalLayer != -1 ); 1439 if ( externalMeansSetHighestTid ) 1440 { 1441 m_highestTid = m_iMaxTemporalLayer; 1442 } 1443 else 1444 { 1445 m_highestTid = m_sps->getSpsMaxSubLayersMinus1(); 1446 } 1447 1448 // The variable SubPicHrdPreferredFlag is either specified by external means, or when not specified by external means, set equal to 0. 1449 // The variable SubPicHrdFlag is specified as follows: 1450 // - If the decoding process is invoked in a bitstream conformance test as specified in clause F.13.1, SubPicHrdFlag is set as specified in clause F.13.1. 1451 // - Otherwise, SubPicHrdFlag is set equal to ( SubPicHrdPreferredFlag && sub_pic_hrd_params_present_flag ), where sub_pic_hrd_params_present_flag is found in any hrd_parameters( ) syntax structure that applies to at least one bitstream partition of the output layer set idenified by TargetOlsIdx. 1452 // - TBD in case that needed some when. 1453 1454 // A bitstream to be decoded, BitstreamToDecode, is specified as follows: 1455 // - Extraction is done in xExtractAndRewrite(); 1456 1457 // - SmallestLayerId is already derived in TDecTop:: initFromActiveVps, since required for SH parsing. 1458 m_smallestLayerId = m_tDecTop[decIdx]->getSmallestLayerId(); 1459 1460 // When vps_base_layer_internal_flag is equal to 0, vps_base_layer_available_flag is equal to 1, 1461 // and TargetDecLayerSetIdx is in the range of 0 to vps_num_layer_sets_minus1, inclusive, 1462 // the following applies: 1463 if ( !m_vps->getVpsBaseLayerInternalFlag() && m_vps->getVpsBaseLayerAvailableFlag() && 1464 ( m_targetDecLayerSetIdx >= 0 && m_targetDecLayerSetIdx <= m_vps->getVpsNumLayerSetsMinus1() ) ) 1465 { 1466 1467 // TBD: The size of the sub-DPB for the layer with nuh_layer_id equal to 0 is set equal to 1. 1468 1469 // TBD: The values of pic_width_in_luma_samples, pic_height_in_luma_samples, chroma_format_idc, 1470 // separate_colour_plane_flag, bit_depth_luma_minus8, bit_depth_chroma_minus8, conf_win_left_offset, 1471 // conf_win_right_offset, conf_win_top_offset, and conf_win_bottom_offset for decoded pictures 1472 // with nuh_layer_id equal to 0 are set equal to the values of pic_width_vps_in_luma_samples, 1473 // pic_height_vps_in_luma_samples, chroma_format_vps_idc, separate_colour_plane_vps_flag, 1474 // bit_depth_vps_luma_minus8, bit_depth_vps_chroma_minus8, conf_win_vps_left_offset, 1475 // conf_win_vps_right_offset, conf_win_vps_top_offset, and conf_win_vps_bottom_offset respectively, 1476 // of the vps_rep_format_idx[ 0 ]-th rep_format( ) syntax structure in the active VPS. 1477 1478 // The variable BaseLayerOutputFlag is set equal to ( TargetOptLayerIdList[ 0 ] = = 0 ). 1479 1480 m_baseLayerOutputFlag = ( m_vps->getTargetOptLayerIdList( m_targetOptLayerSetIdx )[ 0 ] == 0 ); 1481 1482 // NOTE - The BaseLayerOutputFlag for each access unit is to be sent by an external means to 1483 // the base layer decoder for controlling the output of base layer decoded pictures. 1484 // BaseLayerOutputFlag equal to 1 indicates that the base layer is an output layer. 1485 // BaseLayerOutputFlag equal to 0 indicates that the base layer is not an output layer. 1486 1487 // The variable LayerInitializedFlag[ i ] is set equal to 0 for all values of i from 0 1488 // to vps_max_layer_id, inclusive, and the variable FirstPicInLayerDecodedFlag[ i ] is set 1489 // equal to 0 for all values of i from 0 to vps_max_layer_id, inclusive. 1490 1491 for (Int i = 0; i <= m_vps->getVpsMaxLayerId(); i++ ) 1492 { 1493 m_layerInitilizedFlag [ i ] = false; 1494 m_firstPicInLayerDecodedFlag[ i ] = false; 1495 } 1496 } 1497 } 1498 1499 Void TAppDecTop::xC522OutputAndRemOfPicsFromDpb( ) 1500 { 1501 //////////////////////////////////////////////////////////////////////////////// 1502 // C.5.2.2 Output and removal of pictures from the DPB 1503 //////////////////////////////////////////////////////////////////////////////// 1504 1505 // The output and removal of pictures from the DPB before the decoding of the current picture 1506 // (but after parsing the slice header of the first slice of the current picture) happens instantaneously 1507 // when the first decoding unit of the access unit containing the current picture is removed from the CPB and proceeds as follows: 1508 // - The decoding process for RPS as specified in clause 8.3.2 is invoked. 1509 1510 Int nuhLayerId = m_curPic->getLayerId(); 1511 const TComSPS* sps = m_curPic->getSlice(0)->getSPS(); 1512 assert( nuhLayerId == 0 ); 1513 1514 if( ( m_curPic->isIrap() && m_curPic->getNoRaslOutputFlag() == 1) && m_curPic->getDecodingOrder() != 0 ) 1515 { 1516 // - If the current picture is an IRAP picture with NoRaslOutputFlag equal to 1 that is not picture 0, 1517 // the following ordered steps are applied: 1518 1519 // 1. The variable NoOutputOfPriorPicsFlag is derived for the decoder under test as follows: 1520 Int noOutputOfPriorPicsFlag; 1521 if( m_curPic->isCra() ) 1522 { 1523 //- If the current picture is a CRA picture, NoOutputOfPriorPicsFlag is set equal to 1 1524 // (regardless of the value of no_output_of_prior_pics_flag). 1525 noOutputOfPriorPicsFlag = true; 1526 } 1527 else if ( 0 ) 1528 { 1529 // TBD 1530 //- Otherwise, if the value of pic_width_in_luma_samples, pic_height_in_luma_samples, chroma_format_idc, 1531 // separate_colour_plane_flag, bit_depth_luma_minus8, bit_depth_chroma_minus8 or sps_max_dec_pic_buffering_minus1[ HighestTid ] 1532 // derived from the active SPS is different from the value of pic_width_in_luma_samples, pic_height_in_luma_samples, 1533 // chroma_format_idc, separate_colour_plane_flag, bit_depth_luma_minus8, bit_depth_chroma_minus8 or 1534 // sps_max_dec_pic_buffering_minus1[ HighestTid ], respectively, derived from the SPS active for the preceding picture, 1535 // NoOutputOfPriorPicsFlag may (but should not) be set to 1 by the decoder under test, 1536 // regardless of the value of no_output_of_prior_pics_flag. 1537 // NOTE - Although setting NoOutputOfPriorPicsFlag equal to no_output_of_prior_pics_flag is preferred under these conditions, 1538 // the decoder under test is allowed to set NoOutputOfPriorPicsFlag to 1 in this case. 1539 } 1540 else 1541 { 1542 noOutputOfPriorPicsFlag = m_curPic->getSlice(0)->getNoOutputPriorPicsFlag(); 1543 } 1544 // 2. The value of NoOutputOfPriorPicsFlag derived for the decoder under test is applied for the HRD as follows: 1545 if (noOutputOfPriorPicsFlag) 1546 { 1547 //- If NoOutputOfPriorPicsFlag is equal to 1, all picture storage buffers in the DPB are emptied 1548 // without output of the pictures they contain and the DPB fullness is set equal to 0. 1549 m_dpb.emptySubDpb( nuhLayerId ); 1550 } 1551 else if (!noOutputOfPriorPicsFlag) 1552 { 1553 // - Otherwise (NoOutputOfPriorPicsFlag is equal to 0), all picture storage buffers containing a picture that 1554 // is marked as "not needed for output" and "unused for reference" are emptied (without output) and all non-empty 1555 // picture storage buffers in the DPB are emptied by repeatedly invoking the "bumping" process specified in clause C.5.2.4 1556 // and the DPB fullness is set equal to 0. 1557 1558 m_dpb.emptySubDpbNotNeedForOutputAndUnusedForRef( nuhLayerId ); 1559 while( m_dpb.getSubDpb( nuhLayerId, false )->size() != 0 ) 1560 { 1561 xC524Bumping(); 1562 } 1563 } 1564 } 1565 else if ( !( m_curPic->isIrap() && m_curPic->getNoRaslOutputFlag() == 0 ) ) 1566 { 1567 // - Otherwise (the current picture is not an IRAP picture with NoRaslOutputFlag equal to 1), 1568 // all picture storage buffers containing a picture which are marked as "not needed for output" and "unused for reference" 1569 // are emptied (without output). For each picture storage buffer that is emptied, the DPB fullness is decremented by one. 1570 1571 m_dpb.emptySubDpbNotNeedForOutputAndUnusedForRef( nuhLayerId ); 1572 1573 Bool repeat = true; 1574 1575 while( repeat ) 1576 { 1577 TComSubDpb* dpb = m_dpb.getSubDpb( nuhLayerId, false ); 1578 TComList<TComPic*> picsMarkedForOutput = dpb->getPicsMarkedNeedForOutput(); 1579 // When one or more of the following conditions are true, the "bumping" process specified in clause C.5.2.4 1580 // is invoked repeatedly while further decrementing the DPB fullness by one for each additional picture storage buffer that 1581 // is emptied, until none of the following conditions are true: 1582 1583 // - The number of pictures in the DPB that are marked as "needed for output" is greater 1584 // than sps_max_num_reorder_pics[ HighestTid ]. 1585 Bool cond1 = ( picsMarkedForOutput.size() > sps->getSpsMaxNumReorderPics( m_highestTid ) ); 1586 1587 // - sps_max_latency_increase_plus1[ HighestTid ] is not equal to 0 and there is at least one picture in the DPB 1588 // that is marked as "needed for output" for which the associated variable PicLatencyCount is greater than or equal 1589 // to SpsMaxLatencyPictures[ HighestTid ]. 1590 Bool anyPicWithGtOrEqLatencyCnt = false; 1591 for (TComList<TComPic*>::iterator itP = picsMarkedForOutput.begin(); itP != picsMarkedForOutput.end() && !anyPicWithGtOrEqLatencyCnt; itP++ ) 1592 { 1593 anyPicWithGtOrEqLatencyCnt = anyPicWithGtOrEqLatencyCnt || ( (*itP)->getPicLatencyCount() >= sps->getSpsMaxLatencyPictures( m_highestTid )); 1594 } 1595 Bool cond2 = ( sps->getSpsMaxLatencyIncreasePlus1( m_highestTid ) != 0 ) && anyPicWithGtOrEqLatencyCnt; 1596 1597 // - The number of pictures in the DPB is greater than or equal to sps_max_dec_pic_buffering_minus1[ HighestTid ] + 1. 1598 Bool cond3 = ( dpb->size() >= ( sps->getSpsMaxDecPicBufferingMinus1( m_highestTid ) + 1 )); 1599 1600 if ( cond1 || cond2 || cond3 ) 1601 { 1602 xC524Bumping(); 1603 } 1604 else 1605 { 1606 repeat = false; 1607 } 1608 } 1609 } 1610 } 1611 1612 Void TAppDecTop::xC523PicDecMarkAddBumpAndStor() 1613 { 1614 /////////////////////////////////////////////////////////////////////////////////////// 1615 // C.5.2.3 Picture decoding, marking, additional bumping and storage 1616 /////////////////////////////////////////////////////////////////////////////////////// 1617 1618 Int nuhLayerId = m_curPic->getLayerId(); 1619 const TComSPS* sps = m_curPic->getSlice(0)->getSPS(); 1620 // The processes specified in this clause happen instantaneously when the last decoding unit of access unit n containing the 1621 // current picture is removed from the CPB. 1622 if (m_curPic->getPicOutputFlag() ) 1623 { 1624 // When the current picture has PicOutputFlag equal to 1, for each picture in the DPB that is marked as "needed for output" 1625 // and follows the current picture in output order, the associated variable PicLatencyCount is set equal to PicLatencyCount + 1. 1626 TComSubDpb* dpb = m_dpb.getSubDpb( nuhLayerId, false); 1627 1628 for (TComSubDpb::iterator itP = dpb->begin(); itP != dpb->end(); itP++) 1629 { 1630 TComPic* pic = (*itP); 1631 if ( pic->getOutputMark() && pic->getPOC() > m_curPic->getPOC() ) 1632 { 1633 pic->setPicLatencyCount( pic->getPicLatencyCount() + 1 ); 1634 } 1635 } 1636 } 1637 1638 // The current picture is considered as decoded after the last decoding unit of the picture is decoded. 1639 // The current decoded picture is stored in an empty picture storage buffer in the DPB and the following applies: 1640 m_dpb.addNewPic( m_curPic ); 1641 1642 1643 if (m_curPic->getPicOutputFlag()) 1644 { 1645 // - If the current decoded picture has PicOutputFlag equal to 1, it is marked as "needed for output" and its associated 1646 // variable PicLatencyCount is set equal to 0. 1647 m_curPic->setOutputMark( true ); 1648 m_curPic->setPicLatencyCount( 0 ); 1649 } 1650 else if (!m_curPic->getPicOutputFlag() ) 1651 { 1652 // - Otherwise (the current decoded picture has PicOutputFlag equal to 0), it is marked as "not needed for output". 1653 m_curPic->setOutputMark( false ); 1654 } 1655 1656 // The current decoded picture is marked as "used for short-term reference". 1657 m_curPic->markAsUsedForShortTermReference(); 1658 1659 Bool repeat = true; 1660 1661 while( repeat ) 1662 { 1663 TComSubDpb* dpb = m_dpb.getSubDpb( nuhLayerId, false ); 1664 TComList<TComPic*> picsMarkedForOutput = dpb->getPicsMarkedNeedForOutput(); 1665 1666 // When one or more of the following conditions are true, the "bumping" process specified in clause C.5.2.4 1667 // is invoked repeatedly until none of the following conditions are true: 1668 1669 // - The number of pictures in the DPB that are marked as "needed for output" is greater than sps_max_num_reorder_pics[ HighestTid ]. 1670 Bool cond1 = ( picsMarkedForOutput.size() > sps->getSpsMaxNumReorderPics( m_highestTid ) ); 1671 1672 // - sps_max_latency_increase_plus1[ HighestTid ] is not equal to 0 and there is at least one picture in the DPB that is marked 1673 // as "needed for output" for which the associated variable PicLatencyCount that is greater than or equal to 1674 // SpsMaxLatencyPictures[ HighestTid ]. 1675 Bool anyPicWithGtOrEqLatencyCnt = false; 1676 for (TComList<TComPic*>::iterator itP = picsMarkedForOutput.begin(); itP != picsMarkedForOutput.end() && !anyPicWithGtOrEqLatencyCnt; itP++ ) 1677 { 1678 anyPicWithGtOrEqLatencyCnt = anyPicWithGtOrEqLatencyCnt || ( (*itP)->getPicLatencyCount() >= sps->getSpsMaxLatencyPictures( m_highestTid )); 1679 } 1680 Bool cond2 = ( sps->getSpsMaxLatencyIncreasePlus1( m_highestTid ) != 0 ) && anyPicWithGtOrEqLatencyCnt; 1681 1682 if ( cond1 || cond2 ) 1683 { 1684 xC524Bumping(); 1685 } 1686 else 1687 { 1688 repeat = false; 1689 } 1690 } 1691 } 1692 1693 Void TAppDecTop::xC524Bumping( ) 1694 { 1695 //////////////////////////////////////////////////////////////////////////////// 1696 // C.5.2.4 "Bumping" process 1697 //////////////////////////////////////////////////////////////////////////////// 1698 1699 // The "bumping" process consists of the following ordered steps: 1700 1701 // 1. The picture that is first for output is selected as the one having the smallest value of PicOrderCntVal of all pictures 1702 // in the DPB marked as "needed for output". 1703 TComPic* pic = *(m_dpb.getSubDpb( 0, false)->getPicsMarkedNeedForOutput().begin()); // pics are sorted, so take first 1704 1705 // 2. The picture is cropped, using the conformance cropping window specified in the active SPS for the picture, 1706 // the cropped picture is output, and the picture is marked as "not needed for output". 1707 xCropAndOutput( pic ); 1708 pic->setOutputMark( false ); 1709 1710 //3. When the picture storage buffer that included the picture that was cropped and output contains a picture marked 1711 // as "unused for reference", the picture storage buffer is emptied. 1712 if (pic->getMarkedUnUsedForReference() ) 1713 { 1714 m_dpb.removePic( pic ); 1715 } 1716 1717 // NOTE - For any two pictures picA and picB that belong to the same CVS and are output by the "bumping process", when picA 1718 // is output earlier than picB, the value of PicOrderCntVal of picA is less than the value of PicOrderCntVal of picB. 1719 } 1720 1721 1722 Void TAppDecTop::xF813ComDecProcForACodedPic( DecProcPart curPart, Bool picPosInAuIndication ) 1723 { 1724 //////////////////////////////////////////////////////////////////////////////// 1725 // F.8.1.3 Common decoding process for a coded picture 1726 //////////////////////////////////////////////////////////////////////////////// 1727 1728 // PicPosInAuIndication is interpreted based on curPart. 1729 // - If curPart is equal to START_PIC , it indicates whether the current pic is the first in the current AU. 1730 // - Otherwise (if curPart is equal to FINALIZE_PIC), it indicates whether the current pic is the last in the current AU. 1731 1732 if (curPart == START_PIC ) 1733 { 1734 Bool curPicIsFirstInAu = picPosInAuIndication; 1735 1736 Int nuhLayerId = m_curPic->getLayerId(); 1737 1738 if ( !m_vps->getVpsBaseLayerInternalFlag() && m_vps->getVpsBaseLayerAvailableFlag() && 1739 ( m_targetDecLayerSetIdx >= 0 && m_targetDecLayerSetIdx <= m_vps->getVpsNumLayerSetsMinus1() ) && 1740 m_curPic->getSlice(0)->getTemporalId() <= m_vps->getSubLayersVpsMaxMinus1( 0 ) && curPicIsFirstInAu ) 1741 { 1742 // When vps_base_layer_internal_flag is equal to 0, vps_base_layer_available_flag is equal to 1, 1743 // TargetDecLayerSetIdx is in the range of 0 to vps_num_layer_sets_minus1, inclusive, 1744 // TemporalId is less than or equal to sub_layers_vps_max_minus1[ 0 ], and the current picture 1745 // is the first coded picture of an access unit, clause F.8.1.8 is invoked prior to decoding the current picture. 1746 1747 assert( false ); //TBD 1748 } 1749 1750 // When the current picture is an IRAP picture, the variable HandleCraAsBlaFlag is derived as specified in the following: 1751 if ( m_curPic->isIrap() ) 1752 { 1753 if ( m_handleCraAsBlaFlagSetByExtMeans ) 1754 { 1755 // If some external means not specified in this Specification is available to set the variable HandleCraAsBlaFlag to 1756 // a value for the current picture, the variable HandleCraAsBlaFlag is set equal to the value provided by the external means. 1757 } 1758 else 1759 { 1760 // - Otherwise, the variable HandleCraAsBlaFlag is set equal to 0. 1761 m_handleCraAsBlaFlag = false; 1762 } 1763 } 1764 1765 if ( m_curPic->isIrap() && nuhLayerId == m_smallestLayerId ) 1766 { 1767 // When the current picture is an IRAP picture and has nuh_layer_id equal to SmallestLayerId, the following applies: 1768 // The variable NoClrasOutputFlag is specified as follows: 1769 1770 if( m_firstSliceInBitstream ) 1771 { 1772 // - If the current picture is the first picture in the bitstream, NoClrasOutputFlag is set equal to 1. 1773 m_curPic->setNoClrasOutputFlag(true ); 1774 } 1775 else if( m_eosInLayer[ 0 ] || m_eosInLayer[ nuhLayerId ] ) 1776 { 1777 // - Otherwise, if the current picture is included in the first access unit that follows an access unit 1778 // including an end of sequence NAL unit with nuh_layer_id equal to SmallestLayerId or 0 in decoding order, 1779 // NoClrasOutputFlag is set equal to 1. 1780 1781 m_curPic->setNoClrasOutputFlag(true ); 1782 } 1783 else if ( m_curPic->isBla() || (m_curPic->isCra() && m_handleCraAsBlaFlag )) 1784 { 1785 // - Otherwise, if the current picture is a BLA picture or a CRA picture with HandleCraAsBlaFlag equal to 1, 1786 // NoClrasOutputFlag is set equal to 1. 1787 m_curPic->setNoClrasOutputFlag(true ); 1788 } 1789 else if ( m_curPic->isIdr() && m_curPic->getSlice(0)->getCrossLayerBlaFlag() ) 1790 { 1791 // - Otherwise, if the current picture is an IDR picture with cross_layer_bla_flag is equal to 1, 1792 // NoClrasOutputFlag is set equal to 1. 1793 m_curPic->setNoClrasOutputFlag(true ); 1794 } 1795 else if ( m_noClrasOutputFlagSetByExtMeans ) 1796 { 1797 m_curPic->setNoClrasOutputFlag( m_noClrasOutputFlag ); 1798 // - Otherwise, if some external means, not specified in this Specification, is available to set NoClrasOutputFlag, 1799 // NoClrasOutputFlag is set by the external means. 1800 } 1801 else 1802 { 1803 // - Otherwise, NoClrasOutputFlag is set equal to 0. 1804 m_curPic->setNoClrasOutputFlag(false ); 1805 } 1806 1807 //- When NoClrasOutputFlag is equal to 1, the variable LayerInitializedFlag[ i ] is set equal to 0 for all values 1808 // of i from 0 to vps_max_layer_id, inclusive, and the variable FirstPicInLayerDecodedFlag[ i ] is set equal to 0 1809 // for all values of i from 0 to vps_max_layer_id, inclusive. 1810 if ( m_curPic->getNoClrasOutputFlag( ) ) 1811 { 1812 for (Int i = 0; i <= m_vps->getVpsMaxLayerId(); i++) 1813 { 1814 m_layerInitilizedFlag [i] = false; 1815 m_firstPicInLayerDecodedFlag[i] = false; 1816 } 1817 } 1818 } 1819 1820 // The variables LayerResetFlag and dolLayerId are derived as follows: 1821 Int dolLayerId = -1; 1822 if ( m_curPic->isIrap() && nuhLayerId > m_smallestLayerId ) 1823 { 1824 // - If the current picture is an IRAP picture and has nuh_layer_id nuhLayerId greater than SmallestLayerId, 1825 // the following applies: 1826 1827 if( m_eosInLayer[ nuhLayerId ] ) 1828 { 1829 // - If the current picture is the first picture, in decoding order, that follows an end of sequence NAL unit with 1830 // nuh_layer_id equal to nuhLayerId, LayerResetFlag is set equal to 1 and dolLayerId is set equal to the nuh_layer_id 1831 // value of the current NAL unit. 1832 1833 m_layerResetFlag = true; 1834 dolLayerId = nuhLayerId; 1835 } 1836 else if( ( m_curPic->isCra() && m_handleCraAsBlaFlag ) || 1837 (m_curPic->isIdr() && m_curPic->getSlice(0)->getCrossLayerBlaFlag() ) || m_curPic->isBla() ) 1838 { 1839 // - Otherwise, if the current picture is a CRA picture with HandleCraAsBlaFlag equal to 1, an IDR picture with 1840 // cross_layer_bla_flag is equal to 1 or a BLA picture, LayerResetFlag is set equal to 1 and dolLayerId is set 1841 // equal to the nuh_layer_id value of the current NAL unit. 1842 m_layerResetFlag = true; 1843 dolLayerId = nuhLayerId; 1844 } 1845 else 1846 { 1847 // - Otherwise, LayerResetFlag is set equal to 0. 1848 m_layerResetFlag = false; 1849 } 1850 1851 // NOTE 1 - An end of sequence NAL unit, a CRA picture with HandleCraAsBlaFlag equal to 1, an IDR picture with 1852 // cross_layer_bla_flag equal to 1, or a BLA picture, each with nuh_layer_id nuhLayerId greater than SmallestLayerId, 1853 // may be present to indicate a discontinuity of the layer with nuh_layer_id equal to nuhLayerId and its predicted layers. 1854 1855 if (m_layerResetFlag ) 1856 { 1857 //When LayerResetFlag is equal to 1, the following applies: 1858 // - The values of LayerInitializedFlag and FirstPicInLayerDecodedFlag are updated as follows: 1859 1860 for( Int i = 0; i < m_vps->getNumPredictedLayers( dolLayerId ); i++ ) 1861 { 1862 Int iLayerId = m_vps->getIdPredictedLayer( dolLayerId , i ); 1863 m_layerInitilizedFlag [ iLayerId ] = false; 1864 m_firstPicInLayerDecodedFlag[ iLayerId ] = false; 1865 } 1866 1867 // - Each picture that is in the DPB and has nuh_layer_id equal to dolLayerId is marked as "unused for reference". 1868 m_dpb.markSubDpbAsUnusedForReference( dolLayerId ); 1869 1870 // - When NumPredictedLayers[ dolLayerId ] is greater than 0, each picture that is in the DPB and has nuh_layer_id 1871 // equal to any value of IdPredictedLayer[ dolLayerId ][ i ] for the values of i in the range of 0 to 1872 // NumPredictedLayers[ dolLayerId ] - 1, inclusive, is marked as "unused for reference". 1873 1874 for( Int i = 0; i <= m_vps->getNumPredictedLayers( dolLayerId )- 1; i++ ) 1875 { 1876 m_dpb.markSubDpbAsUnusedForReference( m_vps->getIdPredictedLayer( dolLayerId, i ) ); 1877 } 1878 } 1879 } 1880 else 1881 { 1882 // - Otherwise, LayerResetFlag is set equal to 0. 1883 m_layerResetFlag = false; 1884 } 1885 1886 if ( m_curPic->isIrap() ) 1887 { 1888 // When the current picture is an IRAP picture, the following applies: 1889 1890 if ( m_curPic->isIdr() || m_curPic->isBla() || m_curPic->getDecodingOrder() == 0 || m_eosInLayer[nuhLayerId] ) 1891 { 1892 // - If the current picture with a particular value of nuh_layer_id is an IDR picture, a BLA picture, the first picture 1893 // with that particular value of nuh_layer_id in the bitstream in decoding order or the first picture with that 1894 // particular value of nuh_layer_id that follows an end of sequence NAL unit with that particular value of nuh_layer_id 1895 // in decoding order, the variable NoRaslOutputFlag is set equal to 1. 1896 1897 m_curPic->setNoRaslOutputFlag( true ); 1898 } 1899 else if ( m_layerInitilizedFlag[ nuhLayerId ] == 0 && xAllRefLayersInitilized( nuhLayerId ) ) 1900 { 1901 // Otherwise, if LayerInitializedFlag[ nuh_layer_id ] is equal to 0 and LayerInitializedFlag[ refLayerId ] is equal to 1 1902 // for all values of refLayerId equal to IdDirectRefLayer[ nuh_layer_id ][ j ], where j is in the range of 0 to 1903 // NumDirectRefLayers[ nuh_layer_id ] - 1, inclusive, the variable NoRaslOutputFlag is set equal to 1. 1904 1905 m_curPic->setNoRaslOutputFlag( true ); 1906 } 1907 else 1908 { 1909 // - Otherwise, the variable NoRaslOutputFlag is set equal to HandleCraAsBlaFlag. 1910 m_curPic->setNoRaslOutputFlag( m_handleCraAsBlaFlag ); 1911 } 1912 } 1913 1914 // The following applies for the decoding of the current picture: 1915 if ( m_curPic->isIrap() && m_curPic->getNoRaslOutputFlag() && ( 1916 ( nuhLayerId == 0 ) || 1917 ( m_layerInitilizedFlag[ nuhLayerId ] == 0 && m_vps->getNumDirectRefLayers( nuhLayerId ) == 0 ) || 1918 ( m_layerInitilizedFlag[ nuhLayerId ] == 0 && xAllRefLayersInitilized( nuhLayerId ) ) 1919 ) ) 1920 { 1921 // When the current picture is an IRAP picture with NoRaslOutputFlag equal to 1 and one of the following conditions is true, 1922 // LayerInitializedFlag[ nuh_layer_id ] is set equal to 1: 1923 // - nuh_layer_id is equal to 0. 1924 // - LayerInitializedFlag[ nuh_layer_id ] is equal to 0 and NumDirectRefLayers[ nuh_layer_id ] is equal to 0. 1925 // - LayerInitializedFlag[ nuh_layer_id ] is equal to 0 and LayerInitializedFlag[ refLayerId ] is equal to 1 for all values of 1926 // refLayerId equal to IdDirectRefLayer[ nuh_layer_id ][ j ], where j is in the range of 0 to NumDirectRefLayers[ nuh_layer_id ] - 1, inclusive. 1927 1928 m_layerInitilizedFlag[ nuhLayerId ] = true; 1929 } 1930 1931 // The following applies for the decoding of the current picture: 1932 1933 if ( nuhLayerId == 0 ) 1934 { 1935 // If the current picture has nuh_layer_id equal to 0, the decoding process for the current picture takes as inputs the syntax elements 1936 // and upper-case variables from clause F.7 and the decoding process for a coded picture with nuh_layer_id equal to 0 as specified in clause F.8.1.4 1937 // is invoked. 1938 1939 xF814decProcForCodPicWithLIdZero( curPart ); 1940 } 1941 else 1942 { 1943 Bool decodedPicWithLayerIdZeroProvided = false; 1944 if ( !m_vps->getVpsBaseLayerInternalFlag() && m_vps->getVpsBaseLayerAvailableFlag() && 1945 ( m_targetDecLayerSetIdx >= 0 && m_targetDecLayerSetIdx <= m_vps->getVpsNumLayerSetsMinus1() ) && 1946 m_curPic->getSlice(0)->getTemporalId() <= m_vps->getSubLayersVpsMaxMinus1( 0 ) && curPicIsFirstInAu 1947 && decodedPicWithLayerIdZeroProvided ) 1948 { 1949 assert( false ); //TBD 1950 //TBD: Hybrid scalability 1951 // When vps_base_layer_internal_flag is equal to 0, vps_base_layer_available_flag is equal to 1, 1952 // TargetDecLayerSetIdx is in the range of 0 to vps_num_layer_sets_minus1, inclusive, 1953 // TemporalId is less than or equal to sub_layers_vps_max_minus1[ 0 ], the current picture 1954 // is the first coded picture of an access unit, and a decoded picture with nuh_layer_id equal 1955 // to 0 is provided by external means for the current access unit, clause F.8.1.9 is invoked 1956 // after the decoding of the slice segment header of the first slice segment, in decoding order, 1957 // of the current picture, but prior to decoding any slice segment of the first 1958 // coded picture of the access unit. 1959 } 1960 1961 m_decProcPocAndRps = ANNEX_F; 1962 // For the decoding of the slice segment header of the first slice segment, in decoding order, of the current picture, 1963 // the decoding process for starting the decoding of a coded picture with nuh_layer_id greater than 0 specified in 1964 // clause F.8.1.5 is invoked. --> This is done in the loop when receiving slices. 1965 1966 // The decoding process is already selected before. 1967 } 1968 } 1969 else if( curPart == FINALIZE_PIC ) 1970 { 1971 Bool curPicIsLastInAu = picPosInAuIndication; 1972 1973 if (m_curPic->getLayerId() == 0 ) 1974 { 1975 xF814decProcForCodPicWithLIdZero( curPart ); 1976 } 1977 else 1978 { 1979 // - After all slices of the current picture have been decoded, the decoding process for ending the decoding of a 1980 // coded picture with nuh_layer_id greater than 0 specified in clause F.8.1.6 is invoked. 1981 xF816decProcEndDecOfCodPicLIdGrtZero( ); 1982 } 1983 1984 TComSlice* slice = m_curPic->getSlice(0); 1985 const TComVPS* vps = slice->getVPS(); 1986 1987 if ( curPicIsLastInAu ) 1988 { 1989 //When the current picture is the last coded picture in an access unit in BitstreamToDecode, the following steps apply after 1990 // the decoding of the current picture, prior to the decoding of the next picture: 1991 1992 //- PicOutputFlag is updated as follows: 1993 TComPic* picAtOutputLayer = NULL; 1994 Int outputLayerId = -1; 1995 1996 // Try to find pic at output layer. 1997 if( vps->getAltOutputLayerFlag( m_targetOptLayerSetIdx ) ) 1998 { 1999 // When alt_output_layer_flag is equal to 1, the target output layer set can only contain one output layer. 2000 assert( vps->getNumOutputLayersInOutputLayerSet( m_targetOptLayerSetIdx ) == 1 ); 2001 outputLayerId = vps->getTargetOptLayerIdList(m_targetOptLayerSetIdx)[0]; 2002 picAtOutputLayer = m_curAu.getPic( outputLayerId ); 2003 } 2004 2005 if ( vps->getAltOutputLayerFlag( m_targetOptLayerSetIdx ) && 2006 ( picAtOutputLayer == NULL || (picAtOutputLayer != NULL && !picAtOutputLayer->getPicOutputFlag() ) ) ) 2007 { 2008 // If alt_output_layer_flag[ TargetOlsIdx ] is equal to 1 and the current access unit either does 2009 // not contain a picture at the output layer or contains a picture at the output layer that has PicOutputFlag equal to 0: 2010 2011 // - The list nonOutputLayerPictures is set to be the list of the pictures of the access unit with PicOutputFlag equal to 1 and 2012 // with nuh_layer_id values among the nuh_layer_id values of the reference layers of the output layer. 2013 TComList<TComPic*> nonOutputLayerPictures; 2014 for( TComList<TComPic*>::iterator itP= m_curAu.begin(); itP != m_curAu.end() ; itP++ ) 2015 { 2016 TComPic* pic = (*itP); 2017 Bool isRefernceLayerOfOutputLayer = false; 2018 for ( Int i = 0; i < vps->getNumRefLayers( outputLayerId ) && !isRefernceLayerOfOutputLayer; i++ ) 2019 { 2020 if ( pic->getLayerId() == vps->getIdRefLayer(outputLayerId, i) ) 2021 { 2022 isRefernceLayerOfOutputLayer = true; 2023 } 2024 } 2025 2026 if ( pic->getPicOutputFlag() && isRefernceLayerOfOutputLayer ) 2027 { 2028 nonOutputLayerPictures.pushBack( pic ); 2029 } 2030 } 2031 2032 2033 if (nonOutputLayerPictures.size() != 0 ) 2034 { 2035 // - When the list nonOutputLayerPictures is not empty, 2036 // The picture with the highest nuh_layer_id value among the list nonOutputLayerPictures is removed from the list nonOutputLayerPictures. 2037 // As in AU the picture with the highest layer id is the last 2038 nonOutputLayerPictures.pop_back(); 2039 } 2040 2041 // - PicOutputFlag for each picture that is included in the list nonOutputLayerPictures is set equal to 0. 2042 for( TComList<TComPic*>::iterator itP= nonOutputLayerPictures.begin(); itP != nonOutputLayerPictures.end() ; itP++ ) 2043 { 2044 (*itP)->setPicOutputFlag( false ); 2045 } 2046 } 2047 else 2048 { 2049 //Otherwise, PicOutputFlag for pictures that are not included in an output layer is set equal to 0. 2050 for( TComList<TComPic*>::iterator itP= m_curAu.begin(); itP != m_curAu.end() ; itP++ ) 2051 { 2052 TComPic* pic = (*itP); 2053 2054 Bool includedInOutputLayer = false; 2055 for (Int i = 0 ; i < vps->getNumOutputLayersInOutputLayerSet( m_targetOptLayerSetIdx ) && !includedInOutputLayer; i++) 2056 { 2057 includedInOutputLayer = ( pic->getLayerId() == vps->getTargetOptLayerIdList(m_targetOptLayerSetIdx)[i]); 2058 } 2059 2060 if ( !includedInOutputLayer ) 2061 { 2062 pic->setPicOutputFlag( false ); 2063 } 2064 } 2065 } 2066 2067 // When vps_base_layer_internal_flag is equal to 0, vps_base_layer_available_flag is equal to 1 and 2068 // TargetDecLayerSetIdx is in the range of 0 to vps_num_layer_sets_minus1, inclusive 2069 2070 if( !vps->getVpsBaseLayerInternalFlag() && vps->getVpsBaseLayerAvailableFlag() && ( m_targetDecLayerSetIdx >= 0 && m_targetDecLayerSetIdx <= vps->getVpsNumLayerSetsMinus1() ) ) 2071 { 2072 if( !m_baseLayerOutputFlag ) 2073 { 2074 // Check if base layer is a reference layer of the output layer 2075 // and if the access unit does not contain a picture at any other reference layer of the output layer 2076 Bool baseLayerIsRefOfOutputLayer = false; 2077 Bool auDoesNotContainPicAtAnyOtherRefLayerOfOptLayer = true; 2078 if ( vps->getAltOutputLayerFlag( m_targetOptLayerSetIdx )) 2079 { 2080 assert( outputLayerId >= 0 ); 2081 2082 for (Int i = 0; i < vps->getNumRefLayers( outputLayerId ); i++ ) 2083 { 2084 Int refLayerId = vps->getIdRefLayer(outputLayerId, i); 2085 if( refLayerId == 0 ) 2086 { 2087 baseLayerIsRefOfOutputLayer = true; 2088 } 2089 else 2090 { 2091 if ( m_curAu.getPic( refLayerId ) != NULL ) 2092 { 2093 auDoesNotContainPicAtAnyOtherRefLayerOfOptLayer = false; 2094 } 2095 } 2096 } 2097 } 2098 2099 // If alt_output_layer_flag[ TargetOlsIdx ] is equal to 1, the base layer is a reference layer of the output layer, 2100 // the access unit does not contain a picture at the output layer or contains a picture at the output layer that has 2101 // PicOutputFlag equal to 0, and the access unit does not contain a picture at any other reference layer of the output layer, 2102 // BaseLayerPicOutputFlag is set equal to 1 2103 2104 if ( vps->getAltOutputLayerFlag( m_targetOptLayerSetIdx ) && baseLayerIsRefOfOutputLayer 2105 && ( ( picAtOutputLayer == NULL ) || ( picAtOutputLayer != NULL && !picAtOutputLayer->getPicOutputFlag() ) ) 2106 && auDoesNotContainPicAtAnyOtherRefLayerOfOptLayer ) 2107 { 2108 m_baseLayerPicOutputFlag = true; 2109 } 2110 else 2111 { 2112 m_baseLayerPicOutputFlag = false; 2113 } 2114 } 2115 else 2116 { 2117 m_baseLayerPicOutputFlag = true; 2118 } 2119 2120 // NOTE 3 - The BaseLayerPicOutputFlag for each access unit is to be sent by an external means 2121 // to the base layer decoder for controlling the output of base layer decoded pictures. 2122 // BaseLayerPicOutputFlag equal to 1 for an access unit specifies that the base layer picture of the access unit is to be output. 2123 // BaseLayerPicOutputFlag equal to 0 for an access unit specifies that the base layer picture of the access unit is not to be output. 2124 2125 // The sub-DPB for the layer with nuh_layer_id equal to 0 is set to be empty. 2126 m_dpb.emptySubDpb( 0 ); 2127 } 2128 2129 // The variable AuOutputFlag that is associated with the current access unit is derived as follows: 2130 2131 // Derive if at least one picture in the current access unit has PicOutputFlag equal to 1 2132 Bool atLeastOnePicInAuWithPicOptFlagOne = false; 2133 for( TComList<TComPic*>::iterator itP= m_curAu.begin(); itP != m_curAu.end() ; itP++ ) 2134 { 2135 if ( (*itP)->getPicOutputFlag() ) 2136 { 2137 atLeastOnePicInAuWithPicOptFlagOne = true; 2138 } 2139 } 2140 2141 //If at least one picture in the current access unit has PicOutputFlag equal to 1 2142 if ( atLeastOnePicInAuWithPicOptFlagOne ) 2143 { 2144 m_auOutputFlag = true; 2145 } 2146 else 2147 { 2148 m_auOutputFlag = false; 2149 } 2150 2151 // The variable PicLatencyCount that is associated with the current access unit is set equal to 0. 2152 m_curAu.setPicLatencyCount( 0 ); 2153 2154 2155 if ( m_auOutputFlag ) 2156 { 2157 // for each access unit in the DPB 2158 // that has at least one picture marked as "needed for output" and 2159 // follows the current access unit in output order, the associated 2160 // variable PicLatencyCount is set equal to PicLatencyCount + 1. 2161 2162 TComList<TComAu*> aus = m_dpb.getAusHavingPicsMarkedForOutput(); // <-- current AU is actually not yet in DPB, but this does not matter here. 2163 2164 for(TComList<TComAu*>::iterator itA= aus.begin(); ( itA!=aus.end()); itA++) 2165 { 2166 if( m_curAu.getPoc() < (*itA)->getPoc()) 2167 { 2168 (*itA)->setPicLatencyCount( (*itA)->getPicLatencyCount() + 1 ); 2169 } 2170 } 2171 } 2172 } 2173 } 2174 } 2175 2176 Void TAppDecTop::xF814decProcForCodPicWithLIdZero( DecProcPart curPart ) 2177 { 2178 //////////////////////////////////////////////////////////////////////////////// 2179 // F.8.1.4 Decoding process for a coded picture with nuh_layer_id equal to 0 2180 //////////////////////////////////////////////////////////////////////////////// 2181 2182 x813decProcForCodPicWithLIdZero( curPart ); 2183 2184 if (curPart == START_PIC ) 2185 { 2186 m_decProcPocAndRps = ANNEX_F; 2187 } 2188 else if (curPart == FINALIZE_PIC ) 2189 { 2190 if ( !m_firstPicInLayerDecodedFlag[0] ) 2191 { 2192 m_firstPicInLayerDecodedFlag[0] = true; 2193 } 2194 } 2195 } 2196 2197 Void TAppDecTop::xF13521InitDpb() 2198 { 2199 //////////////////////////////////////////////////////////////////////////////// 2200 // F.13.5.2.1 General 2201 //////////////////////////////////////////////////////////////////////////////// 2202 2203 const TComDpbSize* dpbSize = m_vps->getDpbSize(); 2204 m_maxNumReorderPics = dpbSize->getMaxVpsNumReorderPics ( m_targetOptLayerSetIdx, m_highestTid ); 2205 m_maxLatencyIncreasePlus1 = dpbSize->getMaxVpsLatencyIncreasePlus1( m_targetOptLayerSetIdx, m_highestTid ); 2206 m_maxLatencyValue = dpbSize->getVpsMaxLatencyPictures ( m_targetOptLayerSetIdx, m_highestTid ); 2207 2208 for(Int i = 0; i < MAX_NUM_LAYER_IDS; i++) 2209 { 2210 m_maxDecPicBufferingMinus1[ i ] = MIN_INT; 2211 } 2212 for( Int i = 0; i <= m_vps->getMaxLayersMinus1(); i++ ) 2213 { 2214 Int currLayerId = m_vps->getLayerIdInNuh( i ); 2215 for(Int layerIdx = 0 ; layerIdx < m_vps->getNumLayersInIdList( m_targetDecLayerSetIdx); layerIdx++ ) 2216 { 2217 if( m_vps->getLayerSetLayerIdList( m_targetDecLayerSetIdx, layerIdx ) == currLayerId ) 2218 { 2219 m_maxDecPicBufferingMinus1[currLayerId] = dpbSize->getMaxVpsDecPicBufferingMinus1( m_targetDecLayerSetIdx, layerIdx, m_highestTid ); 2220 } 2221 } 2222 } 2223 } 2224 2225 Void TAppDecTop::xF13522OutputAndRemOfPicsFromDpb( Bool beforePocDerivation ) 2226 { 2227 //////////////////////////////////////////////////////////////////////////////// 2228 // F.13.5.2.2 Output and removal of pictures from the DPB 2229 //////////////////////////////////////////////////////////////////////////////// 2230 2231 if( beforePocDerivation ) 2232 { 2233 // F.13.5.2.2 2234 // Part before POC and RPS derivation. 2235 2236 if( m_curPic->getDecodingOrder() != 0 ) 2237 { 2238 // When the current picture is not picture 0 in the current layer, 2239 // the output and removal of pictures in the current layer, with nuh_layer_id equal to currLayerId, 2240 // from the DPB before the decoding of the current picture, i.e., picture n, but after parsing the 2241 // slice header of the first slice of the current picture and before the invocation of the decoding 2242 // process for picture order count, happens instantaneously when the first decoding unit of the current 2243 // picture is removed from the CPB and proceeds as follows: 2244 2245 if( m_curPic->getIsPocResettingPic() ) 2246 { 2247 // When the current picture is a POC resetting picture, all pictures in the DPB that do 2248 // not belong to the current access unit and that are marked as "needed for output" are 2249 // output, starting with pictures with the smallest value of PicOrderCntVal of all pictures 2250 // excluding those in the current access unit in the DPB, in ascending order of the PicOrderCntVal 2251 // values, and pictures with the same value of PicOrderCntVal are output in ascending order 2252 // of the nuh_layer_id values. When a picture is output, it is cropped using the conformance cropping 2253 // window specified in the active SPS for the picture, the cropped picture is output, and 2254 // the picture is marked as "not needed for output" 2255 2256 TComList<TComAu*>* aus = m_dpb.getAus(); // Theses are sorted by POC. 2257 for (TComList<TComAu*>::iterator itA = aus->begin(); itA != aus->end(); itA++ ) 2258 { 2259 //Pictures in AUs are sorted by nuh_layer_id; 2260 for (TComAu::iterator itP = (*itA)->begin(); itP != (*itA)->end(); itP++ ) 2261 { 2262 TComPic* pic = (*itP); 2263 if ( !m_curAu.containsPic( pic ) ) 2264 { 2265 xCropAndOutput( pic ); 2266 pic->setOutputMark( false ); 2267 } 2268 } 2269 } 2270 } 2271 } 2272 } 2273 else if ( !beforePocDerivation ) 2274 { 2275 // The variable listOfSubDpbsToEmpty is derived as follows: 2276 2277 Int nuhLayerId = m_curPic->getLayerId(); 2278 TComList<TComSubDpb*> listOfSubDpbsToEmpty; 2279 2280 if ( m_newVpsActivatedbyCurAu && ( m_curPic->isIrap()&& nuhLayerId == m_smallestLayerId 2281 && m_curPic->getNoRaslOutputFlag() && m_curPic->getNoClrasOutputFlag() ) ) 2282 { 2283 // If a new VPS is activated by the current access unit or the current picture is IRAP picture 2284 // with nuh_layer_id equal to SmallestLayerId, NoRaslOutputFlag equal to 1, and NoClrasOutputFlag equal to 1, 2285 // listOfSubDpbsToEmpty is set equal to all the sub-DPBs. 2286 listOfSubDpbsToEmpty = (*m_dpb.getSubDpbs()); 2287 } 2288 else if (m_curPic->isIrap() && m_vps->getNumDirectRefLayers( nuhLayerId ) == 0 && 2289 nuhLayerId > m_smallestLayerId && m_curPic->getNoRaslOutputFlag() && m_layerResetFlag ) 2290 { 2291 // Otherwise, if the current picture is an IRAP picture with any nuh_layer_id value indepLayerId 2292 // such that NumDirectRefLayers[ indepLayerId ] is equal to 0 and indepLayerId is greater than 2293 // SmallestLayerId, and with NoRaslOutputFlag equal to 1, and LayerResetFlag is equal to 1, 2294 2295 // listOfSubDpbsToEmpty is set equal to the sub-DPBs containing the current layer and the sub-DPBs 2296 // containing the predicted layers of the current layer. 2297 2298 listOfSubDpbsToEmpty.pushBack( m_dpb.getSubDpb( nuhLayerId, false ) ); 2299 for( Int i = 0; i < m_vps->getNumPredictedLayers( nuhLayerId ); i++ ) 2300 { 2301 listOfSubDpbsToEmpty.pushBack( m_dpb.getSubDpb( m_vps->getIdPredictedLayer( nuhLayerId, i), false ) ); 2302 } 2303 } 2304 else 2305 { 2306 // Otherwise, crossLayerBufferEmptyFlag is set equal to 0. 2307 2308 // The SPEC seems to have an issue here. Use current subDpb as in form F.13.3.2 2309 listOfSubDpbsToEmpty.pushBack( m_dpb.getSubDpb( nuhLayerId, false ) ); 2310 } 2311 2312 // If the current picture is an IRAP picture with NoRaslOutputFlag equal to 1 and any of 2313 // the following conditions is true: 2314 // - nuh_layer_id equal to SmallestLayerId, 2315 // - nuh_layer_id of the current layer is greater than SmallestLayerId, and NumDirectRefLayers[ nuh_layer_id ] 2316 // is equal to 0, 2317 2318 if ( m_curPic->isIrap() && m_curPic->getNoRaslOutputFlag() && ( 2319 ( nuhLayerId == m_smallestLayerId ) || 2320 ( ( nuhLayerId > m_smallestLayerId ) && m_vps->getNumDirectRefLayers( nuhLayerId ) == 0 ) ) 2321 ) 2322 { 2323 // 1. The variable NoOutputOfPriorPicsFlag is derived for the decoder under test as follows: 2324 Bool noOutputOfPriorPicsFlag; 2325 if( m_curPic->isCra() ) 2326 { 2327 noOutputOfPriorPicsFlag = true; 2328 // - If the current picture is a CRA picture, NoOutputOfPriorPicsFlag is set equal to 1 2329 // (regardless of the value of no_output_of_prior_pics_flag). 2330 } 2331 else if ( false ) 2332 { 2333 // TBD 2334 // - Otherwise, if the value of pic_width_in_luma_samples, pic_height_in_luma_samples, 2335 // chroma_format_idc, bit_depth_luma_minus8, bit_depth_chroma_minus8, separate_colour_plane_flag, 2336 // or sps_max_dec_pic_buffering_minus1[ HighestTid ] derived from the active SPS for the current 2337 // layer is different from the value of pic_width_in_luma_samples, pic_height_in_luma_samples, 2338 // chroma_format_idc, bit_depth_luma_minus8, bit_depth_chroma_minus8, separate_colour_plane_flag, 2339 // or sps_max_dec_pic_buffering_minus1[ HighestTid ], respectively, derived from the SPS that 2340 // was active for the current layer when decoding the preceding picture in the current layer, 2341 // NoOutputOfPriorPicsFlag may (but should not) be set equal to 1 by the decoder under test, 2342 // regardless of the value of no_output_of_prior_pics_flag. 2343 // NOTE - Although setting NoOutputOfPriorPicsFlag equal to no_output_of_prior_pics_flag is preferred 2344 // under these conditions, the decoder under test is allowed to set NoOutputOfPriorPicsFlag to 1 in this case. 2345 // - Otherwise, NoOutputOfPriorPicsFlag is set equal to no_output_of_prior_pics_flag. 2346 2347 // assert( 1 ); 2348 } 2349 else 2350 { 2351 // - Otherwise, NoOutputOfPriorPicsFlag is set equal to no_output_of_prior_pics_flag. 2352 noOutputOfPriorPicsFlag = m_curPic->getSlice(0)->getNoOutputPriorPicsFlag(); 2353 } 2354 2355 // 2. The value of NoOutputOfPriorPicsFlag derived for the decoder under test is applied for the HRD as follows: 2356 if ( !noOutputOfPriorPicsFlag ) 2357 { 2358 // - If NoOutputOfPriorPicsFlag is equal to 0, all non-empty picture storage buffers in all the sub-DPBs included 2359 // in listOfSubDpbsToEmpty are output by repeatedly invoking the "bumping" process specified in clause 2360 // F.13.5.2.4 until all these pictures are marked as "not needed for output". 2361 2362 Bool repeat = true; 2363 while (repeat ) 2364 { 2365 Bool allPicsMarkedNotNeedForOutput = true; 2366 for (TComList<TComSubDpb*>::iterator itS = listOfSubDpbsToEmpty.begin(); itS != listOfSubDpbsToEmpty.end() && allPicsMarkedNotNeedForOutput; itS++ ) 2367 { 2368 allPicsMarkedNotNeedForOutput = allPicsMarkedNotNeedForOutput && ( (*itS)->areAllPicsMarkedNotNeedForOutput() ); 2369 } 2370 2371 if ( !allPicsMarkedNotNeedForOutput ) 2372 { 2373 xF13524Bumping( m_dpb.getAusHavingPicsMarkedForOutput() ); 2374 } 2375 else 2376 { 2377 repeat = false; 2378 } 2379 } 2380 } 2381 else 2382 { 2383 // - Otherwise (NoOutputOfPriorPicsFlag is equal to 1), all picture storage buffers containing a picture 2384 // that is marked as "not needed for output" and "unused for reference" are emptied (without output), 2385 // all pictures that are contained in a sub-DPB included in listOfSubDpbsToEmpty are emptied, and the sub-DPB 2386 // fullness of each sub-DPB is decremented by the number of picture storage buffers emptied in that sub-DPB. 2387 m_dpb.emptyNotNeedForOutputAndUnusedForRef(); 2388 2389 for( TComList<TComSubDpb*>::iterator iS = listOfSubDpbsToEmpty.begin(); iS != listOfSubDpbsToEmpty.end(); iS++) 2390 { 2391 m_dpb.emptySubDpbs( &listOfSubDpbsToEmpty ); 2392 } 2393 } 2394 } 2395 else 2396 { 2397 // - Otherwise, all picture storage buffers that contain a picture in the current layer and that are marked as 2398 // "not needed for output" and "unused for reference" are emptied (without output). For each picture storage buffer that is emptied, 2399 // the sub-DPB fullness is decremented by one. 2400 2401 m_dpb.emptySubDpbNotNeedForOutputAndUnusedForRef( nuhLayerId ); 2402 2403 // When one or more of the following conditions are true, the "bumping" process specified in clause F.13.5.2.4 2404 // is invoked repeatedly until none of the following conditions are true: 2405 2406 Bool repeat = true; 2407 while ( repeat ) 2408 { 2409 TComList<TComAu*> aus = m_dpb.getAusHavingPicsMarkedForOutput(); 2410 2411 // The number of access units that contain at least one decoded picture in the DPB marked 2412 // as "needed for output" is greater than MaxNumReorderPics. 2413 Bool cond1 = ( aus.size() > m_maxNumReorderPics ); 2414 2415 // MaxLatencyIncreasePlus1 is not equal to 0 and there is at least one access unit 2416 // that contains at least one decoded picture in the DPB marked as "needed for output" 2417 // for which the associated variable PicLatencyCount is greater than or equal to MaxLatencyValue. 2418 Bool auWithGreaterLatencyCount = false; 2419 for(TComList<TComAu*>::iterator itA= aus.begin(); ( itA!=aus.end()) && !auWithGreaterLatencyCount ; itA++) 2420 { 2421 if ( (*itA)->getPicLatencyCount() > m_maxLatencyValue ) 2422 { 2423 auWithGreaterLatencyCount = true; 2424 } 2425 } 2426 2427 Bool cond2 = (m_maxLatencyIncreasePlus1 != 0 ) && auWithGreaterLatencyCount; 2428 2429 // The number of pictures in the sub-DPB is greater than or equal to MaxDecPicBufferingMinus1 + 1. 2430 Bool cond3 = ( m_dpb.getSubDpb( nuhLayerId, false )->size() >= m_maxDecPicBufferingMinus1[ nuhLayerId ] + 1 ); 2431 2432 if ( cond1 || cond2 || cond3 ) 2433 { 2434 xF13524Bumping( aus ); 2435 } 2436 else 2437 { 2438 repeat = false; 2439 } 2440 } 2441 } 2442 } 2443 } 2444 2445 Void TAppDecTop::xF13523PicDecMarkAddBumpAndStor( Bool curPicIsLastInAu ) 2446 { 2447 //////////////////////////////////////////////////////////////////////////////// 2448 // F.13.5.2.3 Picture decoding, marking, additional bumping and storage 2449 //////////////////////////////////////////////////////////////////////////////// 2450 2451 const TComVPS* vps = m_curPic->getSlice(0)->getVPS(); 2452 2453 // The current picture is considered as decoded after the last decoding unit of 2454 // the picture is decoded. The current decoded picture is stored in an empty picture 2455 // storage buffer in the sub-DPB. 2456 2457 m_dpb.addNewPic( m_curPic ); 2458 2459 if ( curPicIsLastInAu ) 2460 { 2461 // When the current picture is the last picture in an access unit, the following applies 2462 // for each decoded picture with nuh_layer_id greater than or 2463 // equal to ( vps_base_layer_internal_flag ? 0 : 1 ) of the access unit: 2464 2465 for( TComList<TComPic*>::iterator itP = m_curAu.begin(); itP != m_curAu.end(); itP++ ) 2466 { 2467 TComPic* pic = (*itP); 2468 if( pic->getLayerId() >= ( vps->getVpsBaseLayerInternalFlag() ? 0 : 1 ) ) 2469 { 2470 if ( pic->getPicOutputFlag() ) 2471 { 2472 //If the decoded picture has PicOutputFlag equal to 1, it is marked as "needed for output". 2473 pic->setOutputMark( true ); 2474 } 2475 else 2476 { 2477 // Otherwise it is marked as "not needed for output". 2478 pic->setOutputMark( false ); 2479 } 2480 // NOTE - Prior to investigating the conditions above, PicOutputFlag 2481 // of each picture of the access unit is updated as specified in clause F.8.1.2. 2482 } 2483 } 2484 } 2485 2486 // The current decoded picture is marked as "used for short-term reference". 2487 m_curPic->markAsUsedForShortTermReference(); 2488 2489 2490 Bool repeat = true; 2491 while ( repeat ) 2492 { 2493 TComList<TComAu*> aus = m_dpb.getAusHavingPicsMarkedForOutput(); 2494 2495 // When one or more of the following conditions are true, 2496 // the "bumping" process specified in clause F.13.5.2.4 is invoked 2497 // repeatedly until none of the following conditions are true: 2498 2499 // - The number of access units that contain at least one decoded picture in the DPB marked 2500 // as "needed for output" is greater than MaxNumReorderPics. 2501 Bool cond1 = ( aus.size() > m_maxNumReorderPics ); 2502 2503 // - MaxLatencyIncreasePlus1 is not equal to 0 and there is at least one access unit 2504 // that contains at least one decoded picture in the DPB marked as "needed for output" 2505 // for which the associated variable PicLatencyCount is greater than or equal to MaxLatencyValue. 2506 Bool auWithGreaterLatencyCount = false; 2507 for(TComList<TComAu*>::iterator itA= aus.begin(); ( itA!=aus.end()) && !auWithGreaterLatencyCount ; itA++) 2508 { 2509 if ( (*itA)->getPicLatencyCount() > m_maxLatencyValue ) 2510 { 2511 auWithGreaterLatencyCount = true; 2512 } 2513 } 2514 2515 Bool cond2 = (m_maxLatencyIncreasePlus1 != 0 ) && auWithGreaterLatencyCount; 2516 2517 if ( cond1 || cond2 ) 2518 { 2519 xF13524Bumping( aus ); 2520 } 2521 else 2522 { 2523 repeat = false; 2524 } 2525 } 2526 } 2527 2528 Void TAppDecTop::xF13524Bumping( TComList<TComAu*> aus ) 2529 { 2530 //////////////////////////////////////////////////////////////////////////////// 2531 // F.13.5.2.4 "Bumping" process 2532 //////////////////////////////////////////////////////////////////////////////// 2533 2534 // The picture or pictures that are first for output are selected as the ones having the 2535 // smallest value of PicOrderCntVal of all pictures in the DPB marked as "needed for output". 2536 2537 assert( !aus.empty() ); 2538 2539 // Create copy, since original AU from DBP is modified when removing pic. 2540 TComAu auWithSmallestPoc = *((*aus.begin())); // List is sorted, hence the AU with smallest POC is the first. 2541 2542 for(TComAu::iterator itP= auWithSmallestPoc.begin(); ( itP!=auWithSmallestPoc.end() ); itP++) 2543 { 2544 TComPic* pic = (*itP); 2545 2546 if (pic->getOutputMark() ) 2547 { 2548 // Each of these pictures is, in ascending nuh_layer_id order, cropped, 2549 // using the conformance cropping window specified in the active SPS for the picture, 2550 // the cropped picture is output, and the picture is marked as "not needed for output". 2551 2552 // pictures are sorted in the AU in ascending nuh_layer_id order. 2553 2554 2555 xCropAndOutput( pic ); 2556 pic->setOutputMark( false ); 2557 2558 // Each picture storage buffer that contains a picture marked as "unused for reference" 2559 // and that was one of the pictures cropped and output is emptied and the fullness of 2560 // the associated sub-DPB is decremented by one. 2561 2562 if (pic->getMarkedUnUsedForReference() ) 2563 { 2564 m_dpb.removePic( pic ); 2565 } 2566 } 2567 } 2568 } 2569 2570 Void TAppDecTop::xF816decProcEndDecOfCodPicLIdGrtZero() 2571 { 2572 //////////////////////////////////////////////////////////////////////////////// 2573 // F.8.1.6 Decoding process for ending the decoding of a coded picture with nuh_layer_id greater than 0 2574 //////////////////////////////////////////////////////////////////////////////// 2575 2576 const TComSlice* slice = m_curPic->getSlice( 0 ); 2577 const Int nuhLayerId = m_curPic->getLayerId(); 2578 2579 assert( nuhLayerId != 0 ); 2580 2581 //The marking of decoded pictures is modified as specified in the following: 2582 for (Int i = 0; i < m_curPic->getDecodedRps()->m_numActiveRefLayerPics0;i++ ) 2583 { 2584 m_curPic->getDecodedRps()->m_refPicSetInterLayer0[i]->markAsUsedForShortTermReference(); 2585 } 2586 2587 for (Int i = 0; i < m_curPic->getDecodedRps()->m_numActiveRefLayerPics1;i++ ) 2588 { 2589 m_curPic->getDecodedRps()->m_refPicSetInterLayer1[i]->markAsUsedForShortTermReference(); 2590 } 2591 2592 // PicOutputFlag is set as follows: 2593 if ( !m_layerInitilizedFlag[ nuhLayerId ] ) 2594 { 2595 // - If LayerInitializedFlag[ nuh_layer_id ] is equal to 0, PicOutputFlag is set equal to 0. 2596 m_curPic->setPicOutputFlag( false ); 2597 } 2598 else if (m_curPic->isRasl( ) && m_noRaslOutputFlagAssocIrap[ nuhLayerId] ) 2599 { 2600 // - Otherwise, if the current picture is a RASL picture and NoRaslOutputFlag of the associated IRAP picture is equal to 1, 2601 // PicOutputFlag is set equal to 0. 2602 2603 m_curPic->setPicOutputFlag( false ); 2604 } 2605 else 2606 { 2607 // - Otherwise, PicOutputFlag is set equal to pic_output_flag. 2608 m_curPic->setPicOutputFlag( slice->getPicOutputFlag() ); 2609 } 2610 2611 // The decoded picture is marked as "used for short-term reference". 2612 m_curPic->markAsUsedForShortTermReference(); 2613 2614 if ( !m_firstPicInLayerDecodedFlag[ nuhLayerId ] ) 2615 { 2616 // When FirstPicInLayerDecodedFlag[ nuh_layer_id ] is equal to 0, FirstPicInLayerDecodedFlag[ nuh_layer_id ] is set equal to 1. 2617 m_firstPicInLayerDecodedFlag[ nuhLayerId ] = true; 2618 } 2619 } 2620 2621 TDecTop* TAppDecTop::xGetDecoder( InputNALUnit& nalu ) 2622 { 2623 return m_tDecTop[ xGetDecoderIdx( nalu.m_nuhLayerId )]; 2624 } 2625 2626 1052 2627 Int TAppDecTop::xGetDecoderIdx( Int layerId, Bool createFlag /*= false */ ) 1053 2628 { 1054 Int decIdx = -1; 1055 1056 if ( layerId > MAX_NUM_LAYER_IDS-1 ) 1057 { 1058 return decIdx; 1059 } 1060 1061 if ( m_layerIdToDecIdx[ layerId ] != -1 ) 1062 { 1063 decIdx = m_layerIdToDecIdx[ layerId ]; 2629 Int decIdx = -1; 2630 2631 if ( layerId > MAX_NUM_LAYER_IDS-1 ) 2632 { 2633 return decIdx; 2634 } 2635 2636 if ( m_layerIdToDecIdx[ layerId ] != -1 ) 2637 { 2638 decIdx = m_layerIdToDecIdx[ layerId ]; 1064 2639 } 1065 2640 else 1066 { 1067 assert ( createFlag ); 1068 assert( m_numDecoders < MAX_NUM_LAYERS ); 1069 1070 decIdx = m_numDecoders; 2641 { 2642 assert ( createFlag ); 2643 assert( m_numDecoders < MAX_NUM_LAYERS ); 2644 2645 decIdx = m_numDecoders; 1071 2646 1072 2647 // Init decoder … … 1076 2651 m_tDecTop[ decIdx ]->setLayerId( layerId ); 1077 2652 m_tDecTop[ decIdx ]->setDecodedPictureHashSEIEnabled(m_decodedPictureHashSEIEnabled); 1078 m_tDecTop[ decIdx ]->setIvPicLists( &m_ivPicLists ); 1079 m_tDecTop[ decIdx ]->setLayerInitilizedFlags( m_layerInitilizedFlags ); 1080 m_tDecTop[ decIdx ]->setTargetOlsIdx( m_targetOptLayerSetIdx ); 2653 m_tDecTop[ decIdx ]->setDpb( &m_dpb ); 2654 m_tDecTop[ decIdx ]->setTargetOlsIdx( m_targetOptLayerSetIdx ); 2655 m_tDecTop[ decIdx ]->setFirstPicInLayerDecodedFlag( m_firstPicInLayerDecodedFlag ); 2656 m_tDecTop[ decIdx ]->setPocDecrementedInDPBFlag ( m_pocDecrementedInDpbFlag ); 2657 m_tDecTop[ decIdx ]->setLastPresentPocResetIdc ( m_lastPresentPocResetIdc ); 2658 2659 1081 2660 #if O0043_BEST_EFFORT_DECODING 1082 2661 m_cTDecTop[ decIdx ]->setForceDecodeBitDepth(m_forceDecodeBitDepth); … … 1091 2670 #endif 1092 2671 1093 // append pic list of new decoder to PicLists 1094 assert( m_ivPicLists.size() == m_numDecoders ); 1095 m_ivPicLists.push_back( m_tDecTop[ decIdx ]->getListPic() ); 1096 1097 // create recon file related stuff 2672 // append pic list of new decoder to PicLists 2673 2674 // create recon file related stuff 1098 2675 Char* pchTempFilename = NULL; 1099 2676 if ( m_pchReconFile ) 1100 { 1101 Char buffer[4]; 2677 { 2678 Char buffer[4]; 1102 2679 sprintf(buffer,"_%i", layerId ); 1103 assert ( m_pchReconFile ); 2680 assert ( m_pchReconFile ); 1104 2681 xAppendToFileNameEnd( m_pchReconFile , buffer, pchTempFilename ); 1105 2682 assert( m_pchReconFiles.size() == m_numDecoders ); 1106 2683 } 1107 2684 1108 m_pchReconFiles.push_back( pchTempFilename ); 2685 m_pchReconFiles.push_back( pchTempFilename ); 1109 2686 1110 2687 m_tVideoIOYuvReconFile[ decIdx ] = new TVideoIOYuv; 1111 2688 m_reconOpen [ decIdx ] = false; 1112 2689 1113 // set others 1114 m_pocLastDisplay [ decIdx ] = -MAX_INT; 1115 m_layerIdToDecIdx [ layerId ] = decIdx; 1116 1117 m_numDecoders++; 2690 // set others 2691 m_layerIdToDecIdx [ layerId ] = decIdx; 2692 2693 m_numDecoders++; 1118 2694 }; 1119 2695 return decIdx; … … 1121 2697 } 1122 2698 1123 Void TAppDecTop::xMarkForOutput( Bool allLayersDecoded, Int pocLastPic, Int layerIdLastPic)2699 Int TAppDecTop::xPreDecodePoc( InputNALUnit& nalu ) 1124 2700 { 1125 vector<Int> targetOptLayerIdList = m_vps->getTargetOptLayerIdList( m_targetOptLayerSetIdx ); 1126 1127 if (m_vps->getAltOutputLayerFlagVar( m_targetOptLayerSetIdx ) ) 1128 { 1129 assert( targetOptLayerIdList.size() == 1 ); 1130 Int targetLayerId = targetOptLayerIdList[0]; 1131 1132 TComPic* curPic = m_ivPicLists.getPic( layerIdLastPic, pocLastPic ); 1133 assert( curPic != NULL ); 1134 1135 if ( layerIdLastPic == targetLayerId ) 1136 { 1137 if ( curPic->getPicOutputFlag() ) 1138 { 1139 curPic->setOutputMark( true ); 2701 // - According to F.7.4.2.4.4, the POC of the current picture is required to detect whether it is the first in a new AU 2702 // - F.8.1.3 needs to know if the current picture is the first of an AU 2703 // actually before its POC has been decoded. 2704 2705 // Thus, in the software implementation the processes can not be invoked in the same order as in the Spec. 2706 // For this, this function decodes the POC before invoking F.8.1.3. However, this is done without 2707 // altering member variables 2708 2709 // Do some stuff from F.8.1.3 required for POC derivation, which is not depending on AU detection. 2710 TDecTop* dec = xGetDecoder( nalu ); 2711 TComSlice* slicePilot = dec->getSlicePilot(); 2712 Int nuhLayerId = nalu.m_nuhLayerId; 2713 Int smallestLayerId = dec->getSmallestLayerId(); 2714 2715 Int handleCraAsBlaFlag; 2716 if ( nalu.isIrap() ) 2717 { 2718 if ( !m_handleCraAsBlaFlagSetByExtMeans ) 2719 { 2720 handleCraAsBlaFlag = false; 2721 } 2722 } 2723 2724 Bool firstPicInLayerDecodedFlag = m_firstPicInLayerDecodedFlag[ nalu.m_nuhLayerId ]; 2725 2726 if ( nalu.isIrap() && nuhLayerId == smallestLayerId ) 2727 { 2728 Int noClrasOutputFlag; 2729 if( m_firstSliceInBitstream ) 2730 { 2731 noClrasOutputFlag = true; 2732 } 2733 else if( m_eosInLayer[ 0 ] || m_eosInLayer[ nuhLayerId ] ) 2734 { 2735 noClrasOutputFlag = true; 2736 } 2737 else if ( nalu.isBla() || (nalu.isCra() && handleCraAsBlaFlag )) 2738 { 2739 noClrasOutputFlag = true; 2740 } 2741 else if ( nalu.isIdr() && slicePilot->getCrossLayerBlaFlag() ) 2742 { 2743 noClrasOutputFlag = true; 2744 } 2745 else if ( m_noClrasOutputFlagSetByExtMeans ) 2746 { 2747 noClrasOutputFlag = m_noClrasOutputFlag; 2748 } 2749 else 2750 { 2751 noClrasOutputFlag = false; 2752 } 2753 2754 if( noClrasOutputFlag ) 2755 { 2756 firstPicInLayerDecodedFlag = false; 2757 } 2758 } 2759 2760 // Derive POC 2761 return dec->preDecodePoc(firstPicInLayerDecodedFlag, m_newPicIsFstPicOfAllLayOfPocResetPer, m_newPicIsPocResettingPic ); 2762 } 2763 2764 Bool TAppDecTop::xDetectNewAu( InputNALUnit& nalu ) 2765 { 2766 TDecTop* dec = xGetDecoder( nalu ); 2767 TComSlice* slicePilot = dec->getSlicePilot(); 2768 const TComVPS* vps = slicePilot->getVPS(); 2769 2770 Bool firstVclNaluOfAu; 2771 2772 if (m_curPic == NULL ) 2773 { 2774 // No picture decoded yet, so we have a new AU. 2775 firstVclNaluOfAu = true; 2776 } 2777 else 2778 { 2779 if ( !vps->getVpsExtensionFlag() ) 2780 { 2781 // Decoding according to clause 8, hence one pic per AU. 2782 firstVclNaluOfAu = slicePilot->getFirstSliceSegementInPicFlag(); 2783 } 2784 else 2785 { 2786 if ( dec->getTargetOlsIdx() == 0 ) 2787 { 2788 // Only the base layer is decoded, hence one pic per AU. 2789 firstVclNaluOfAu = slicePilot->getFirstSliceSegementInPicFlag(); 1140 2790 } 1141 2791 else 1142 { 1143 xMarkAltOutPic( targetLayerId, pocLastPic ); 1144 } 1145 m_markedForOutput = true; 1146 } 1147 else if ( ( layerIdLastPic > targetLayerId || allLayersDecoded ) && !m_markedForOutput ) 1148 { 1149 xMarkAltOutPic( targetLayerId, pocLastPic ); 1150 } 1151 1152 if ( allLayersDecoded ) 1153 { 1154 m_markedForOutput = false; 1155 } 2792 { 2793 // F.7.4.2.4.4 Order of NAL units and coded pictures and association to access units 2794 // An access unit consists of one or more coded pictures, each with a distinct value of 2795 // nuh_layer_id, and zero or more non-VCL NAL units. 2796 2797 // A VCL NAL unit is the first VCL NAL unit of an access unit, when all of the following conditions are true: 2798 // - first_slice_segment_in_pic_flag is equal to 1. 2799 // - At least one of the following conditions is true: 2800 // - The previous picture in decoding order belongs to a different POC resetting period 2801 // than the picture containing the VCL NAL unit. 2802 Bool prevPicDiffPocResetPeriod = m_newPicIsFstPicOfAllLayOfPocResetPer; 2803 2804 // - PicOrderCntVal derived for the VCL NAL unit differs from the PicOrderCntVal of the 2805 // previous picture in decoding order. 2806 Bool prevPicDiffPoc = ( xPreDecodePoc( nalu ) != m_curPic->getPOC() ); 2807 2808 if( slicePilot->getFirstSliceSegementInPicFlag() && ( prevPicDiffPocResetPeriod || prevPicDiffPoc ) ) 2809 { 2810 firstVclNaluOfAu = true; 2811 } 2812 else 2813 { 2814 firstVclNaluOfAu = false; 2815 } 2816 } 2817 } 2818 } 2819 return firstVclNaluOfAu; 2820 } 2821 2822 Void TAppDecTop::xDetectNewPocResettingPeriod( InputNALUnit& nalu ) 2823 { 2824 TDecTop* dec = xGetDecoder( nalu ); 2825 dec->inferPocResetPeriodId(); 2826 2827 2828 Int pocResetIdc = dec->getSlicePilot()->getPocResetIdc(); 2829 Int newPocResetPeriodId = dec->getSlicePilot()->getPocResetPeriodId(); 2830 2831 Int curPocResetPeriodId = ( m_curPic != NULL) ? m_curPic->getPocResetPeriodId() : MIN_INT; 2832 2833 // Check if new picture starts a new poc resetting period. 2834 if( ( pocResetIdc == 1 || pocResetIdc == 2 ) && ( curPocResetPeriodId != newPocResetPeriodId ) ) 2835 { 2836 for (Int i = 0; i < MAX_NUM_LAYER_IDS; i++ ) 2837 { 2838 m_firstPicInPocResettingPeriodReceived[ i ] = false; 2839 } 2840 m_newPicIsFstPicOfAllLayOfPocResetPer = true; 1156 2841 } 1157 2842 else 1158 { 1159 for( Int dI = 0; dI < m_numDecoders; dI++ ) 1160 { 1161 Int layerId = m_tDecTop[dI]->getLayerId(); 1162 TComPic* curPic = m_ivPicLists.getPic( layerId, pocLastPic ); 1163 if ( curPic != NULL ) 1164 { 1165 if ( curPic->getReconMark() ) 1166 { 1167 Bool isTargetOptLayer = std::find(targetOptLayerIdList.begin(), targetOptLayerIdList.end(), layerId) != targetOptLayerIdList.end(); 1168 curPic->setOutputMark( isTargetOptLayer ? curPic->getPicOutputFlag() : false ); 1169 } 1170 } 1171 } 1172 } 1173 } 1174 1175 Void TAppDecTop::xMarkAltOutPic( Int targetOutputLayer, Int pocLastPic ) 1176 { 1177 Int optLayerIdxInVps = m_vps->getLayerIdInNuh( targetOutputLayer ); 1178 Int highestNuhLayerId = -1; 1179 TComPic* picWithHighestNuhLayerId = NULL; 1180 for (Int dIdx = 0; dIdx < m_numDecoders; dIdx++) 1181 { 1182 Int curLayerId = m_tDecTop[dIdx]->getLayerId(); 1183 Int curLayerIdxInVps = m_vps->getLayerIdInNuh( curLayerId ); 1184 if ( m_vps->getDependencyFlag(optLayerIdxInVps, curLayerIdxInVps ) ) 1185 { 1186 TComPic* curPic = m_ivPicLists.getPic( curLayerId, pocLastPic ); 1187 if (curPic != NULL) 1188 { 1189 if (curPic->getReconMark() && curPic->getPicOutputFlag() ) 1190 { 1191 curPic->setOutputMark ( false ); 1192 curPic->setPicOutputFlag( false ); 1193 if ( curLayerId > highestNuhLayerId) 1194 { 1195 highestNuhLayerId = curLayerId ; 1196 picWithHighestNuhLayerId = curPic; 1197 } 1198 } 1199 } 1200 } 1201 } 1202 if ( picWithHighestNuhLayerId != NULL ) 1203 { 1204 picWithHighestNuhLayerId->setPicOutputFlag(true); 1205 picWithHighestNuhLayerId->setOutputMark (true); 1206 } 2843 { 2844 m_newPicIsFstPicOfAllLayOfPocResetPer = false; 2845 } 2846 2847 // Check if current picture is a poc resetting picture (thus the first picture of this layer within the POC resetting period. 2848 if ( !m_firstPicInPocResettingPeriodReceived[ nalu.m_nuhLayerId ] ) 2849 { 2850 m_newPicIsPocResettingPic = true; 2851 m_firstPicInPocResettingPeriodReceived[ nalu.m_nuhLayerId ] = true; 2852 } 2853 else 2854 { 2855 m_newPicIsPocResettingPic = false; 2856 } 2857 2858 } 2859 2860 Bool TAppDecTop::xAllRefLayersInitilized( Int curLayerId ) 2861 { 2862 Bool allRefLayersInitilizedFlag = true; 2863 for (Int i = 0; i < m_vps->getNumDirectRefLayers( curLayerId ); i++ ) 2864 { 2865 Int refLayerId = m_vps->getIdDirectRefLayer( curLayerId, i ); 2866 allRefLayersInitilizedFlag = allRefLayersInitilizedFlag && m_layerInitilizedFlag[ refLayerId ]; 2867 } 2868 2869 return allRefLayersInitilizedFlag; 2870 } 2871 2872 Void TAppDecTop::xInitFileIO() 2873 { 2874 m_bitstreamFile.open(m_pchBitstreamFile, ifstream::in | ifstream::binary); 2875 2876 if ( !m_bitstreamFile) 2877 { 2878 fprintf(stderr, "\nUnable to open bitstream file `%s' for reading\n", m_pchBitstreamFile); 2879 exit(EXIT_FAILURE); 2880 } 2881 2882 if (!m_outputDecodedSEIMessagesFilename.empty() && m_outputDecodedSEIMessagesFilename!="-") 2883 { 2884 m_seiMessageFileStream.open(m_outputDecodedSEIMessagesFilename.c_str(), std::ios::out); 2885 if (!m_seiMessageFileStream.is_open() || !m_seiMessageFileStream.good()) 2886 { 2887 fprintf(stderr, "\nUnable to open file `%s' for writing decoded SEI messages\n", m_outputDecodedSEIMessagesFilename.c_str()); 2888 exit(EXIT_FAILURE); 2889 } 2890 } 2891 2892 #if NH_3D 2893 if( m_pchScaleOffsetFile ) 2894 { 2895 m_pScaleOffsetFile = ::fopen( m_pchScaleOffsetFile, "wt" ); 2896 if (!m_pScaleOffsetFile) 2897 { 2898 fprintf(stderr, "\nUnable to open file `%s' for writing decoded Camera Parameters messages\n", m_pchScaleOffsetFile); 2899 exit(EXIT_FAILURE); 2900 } 2901 } 2902 #endif 2903 } 2904 2905 Void TAppDecTop::xOpenReconFile( TComPic* curPic ) 2906 { 2907 Int decIdx = xGetDecoderIdx( curPic->getLayerId() ); 2908 2909 if ( m_pchReconFile && !m_reconOpen[decIdx] ) 2910 { 2911 const BitDepths &bitDepths= curPic->getPicSym()->getSPS().getBitDepths(); // use bit depths of first reconstructed picture. 2912 for (UInt channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++) 2913 { 2914 if (m_outputBitDepth[channelType] == 0) 2915 { 2916 m_outputBitDepth[channelType] = bitDepths.recon[channelType]; 2917 } 2918 } 2919 2920 m_tVideoIOYuvReconFile[decIdx]->open( m_pchReconFiles[decIdx], true, m_outputBitDepth, m_outputBitDepth, bitDepths.recon ); // write mode 2921 m_reconOpen[decIdx] = true; 2922 } 2923 } 2924 2925 Void TAppDecTop::xFlushOutput() 2926 { 2927 Bool repeat = true; 2928 while ( repeat ) 2929 { 2930 if( m_decProcCvsg == ANNEX_F ) 2931 { 2932 TComList<TComAu*> aus = m_dpb.getAusHavingPicsMarkedForOutput(); 2933 if ( !aus.empty() ) 2934 { 2935 xF13524Bumping( aus ); 2936 } 2937 else 2938 { 2939 repeat = false; 2940 } 2941 } 2942 else if( m_decProcCvsg == CLAUSE_8 ) 2943 { 2944 TComList<TComPic*> picsMarkedForOutput = m_dpb.getSubDpb( 0, false )->getPicsMarkedNeedForOutput(); 2945 if (!picsMarkedForOutput.empty()) 2946 { 2947 xC524Bumping(); 2948 } 2949 else 2950 { 2951 repeat = false; 2952 } 2953 } 2954 } 2955 } 2956 2957 Void TAppDecTop::xCropAndOutput( TComPic* curPic ) 2958 { 2959 2960 if ( m_printPicOutput ) 2961 { 2962 std::cout << " Output picture: "; 2963 curPic->print( 2 ); 2964 std::cout << std::endl; 2965 } 2966 2967 assert( !curPic->getHasGeneratedRefPics() ); 2968 assert( !curPic->getIsGenerated() ); 2969 2970 Int decIdx = xGetDecoderIdx( curPic->getLayerId() ); 2971 2972 if (!m_reconOpen[ decIdx ]) 2973 { 2974 xOpenReconFile( curPic ); 2975 } 2976 2977 if ( m_pchReconFiles[ decIdx ] ) 2978 { 2979 const Window &conf = curPic->getConformanceWindow(); 2980 const Window defDisp = m_respectDefDispWindow ? curPic->getDefDisplayWindow() : Window(); 2981 2982 assert( conf .getScaledFlag() ); 2983 assert( defDisp.getScaledFlag() ); 2984 2985 m_tVideoIOYuvReconFile[decIdx]->write( curPic->getPicYuvRec(), 2986 m_outputColourSpaceConvert, 2987 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 2988 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 2989 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 2990 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), 2991 #if NH_3D 2992 m_depth420OutputFlag && curPic->getIsDepth() ? CHROMA_420 : NUM_CHROMA_FORMAT 2993 #else 2994 NUM_CHROMA_FORMAT 2995 #endif 2996 , m_bClipOutputVideoToRec709Range); 2997 } 2998 } 2999 3000 UInt TAppDecTop::getNumberOfChecksumErrorsDetected() const 3001 { 3002 UInt numOfChecksumErrors = 0; 3003 for (Int i = 0; i < m_numDecoders; i++ ) 3004 { 3005 numOfChecksumErrors += getNumberOfChecksumErrorsDetected( i ); 3006 } 3007 return numOfChecksumErrors; 1207 3008 } 1208 3009 -
branches/HTM-15.0-dev0/source/App/TAppDecoder/TAppDecTop.h
r1313 r1317 60 60 { 61 61 private: 62 // class interface 62 // class interface 63 63 #if NH_MV 64 64 TDecTop* m_tDecTop [ MAX_NUM_LAYERS ]; ///< decoder classes 65 65 TVideoIOYuv* m_tVideoIOYuvReconFile[ MAX_NUM_LAYERS ]; ///< reconstruction YUV class 66 Int m_layerIdToDecIdx [ MAX_NUM_LAYER_IDS ]; ///< map ing from layer id to decoder index66 Int m_layerIdToDecIdx [ MAX_NUM_LAYER_IDS ]; ///< mapping from layer id to decoder index 67 67 Int m_numDecoders; ///< number of decoder instances 68 TComPicLists m_ivPicLists; ///< picture buffers of decoder instances 69 Bool m_layerInitilizedFlags[ MAX_NUM_LAYER_IDS ]; ///< for layerwise startup 68 TComPicLists m_dpb; ///< picture buffers of decoder instances 69 70 TComPic* m_curPic; ///< currently decoded picture 71 TComAu m_curAu; ///< currently decoded Au 72 73 // Random access related 74 Bool m_handleCraAsBlaFlag; 75 Bool m_handleCraAsBlaFlagSetByExtMeans; 76 Bool m_noClrasOutputFlag; 77 Bool m_noClrasOutputFlagSetByExtMeans; 78 Bool m_noRaslOutputFlagAssocIrap [ MAX_NUM_LAYER_IDS ]; 79 80 // Layer wise startup 81 Bool m_firstPicInLayerDecodedFlag [ MAX_NUM_LAYER_IDS ]; 82 Bool m_layerInitilizedFlag [ MAX_NUM_LAYER_IDS ]; 83 Bool m_layerResetFlag; 84 85 // DPB related variables 86 Int m_maxNumReorderPics; 87 Int m_maxLatencyIncreasePlus1; 88 Int m_maxLatencyValue; 89 Int m_maxDecPicBufferingMinus1 [ MAX_NUM_LAYER_IDS ]; 90 91 // Poc resetting 92 Int m_lastPresentPocResetIdc [ MAX_NUM_LAYER_IDS ]; 93 Bool m_firstPicInPocResettingPeriodReceived[ MAX_NUM_LAYER_IDS ]; 94 Bool m_pocDecrementedInDpbFlag [ MAX_NUM_LAYER_IDS ]; 95 Bool m_newPicIsFstPicOfAllLayOfPocResetPer; 96 Bool m_newPicIsPocResettingPic; 97 98 // General decoding state 99 Bool m_newVpsActivatedbyCurAu; 100 Bool m_newVpsActivatedbyCurPic; 101 Bool m_eosInLayer [ MAX_NUM_LAYER_IDS ]; 102 Bool m_initilizedFromVPS; 103 Bool m_firstSliceInBitstream; 104 UInt64 m_decodingOrder [ MAX_NUM_LAYER_IDS ]; 105 UInt64 m_totalNumofPicsReceived; 106 Bool m_cvsStartFound; 107 Int m_smallestLayerId; 108 109 // Decoding processes for current picture 110 DecodingProcess m_decProcPocAndRps; 111 DecodingProcess m_decProcCvsg; 112 113 // Active parameter sets 114 const TComPPS* m_pps; ///< active PPS 115 const TComSPS* m_sps; ///< active SPS 70 116 const TComVPS* m_vps; ///< active VPS 117 118 Bool m_reconOpen [ MAX_NUM_LAYERS ]; ///< reconstruction file opened 119 #if NH_3D 120 FILE* m_pScaleOffsetFile; 121 CamParsCollector m_cCamParsCollector; 122 #endif 71 123 #else 72 124 TDecTop m_cTDecTop; ///< decoder class 73 125 TVideoIOYuv m_cTVideoIOYuvReconFile; ///< reconstruction YUV class 74 #endif75 126 // for output control 76 #if NH_MV77 Int m_pocLastDisplay [ MAX_NUM_LAYERS ]; ///< last POC in display order78 Bool m_reconOpen [ MAX_NUM_LAYERS ]; ///< reconstruction file opened79 Bool m_markedForOutput;80 #else81 127 Int m_iPOCLastDisplay; ///< last POC in display order 82 128 #endif 83 std::ofstream m_seiMessageFileStream; ///< Used for outputing SEI messages. 84 85 #if NH_3D 86 FILE* m_pScaleOffsetFile; 87 CamParsCollector m_cCamParsCollector; 88 #endif 129 std::ofstream m_seiMessageFileStream; ///< Used for outputing SEI messages. 89 130 public: 90 131 TAppDecTop(); … … 95 136 Void decode (); ///< main decoding function 96 137 #if NH_MV 97 UInt getNumberOfChecksumErrorsDetected( ) const 98 { 99 UInt numOfChecksumErrors = 0; 100 for (Int i = 0; i < m_numDecoders; i++ ) 101 { 102 numOfChecksumErrors += getNumberOfChecksumErrorsDetected( i ); 103 } 104 return numOfChecksumErrors; 105 } 106 138 UInt getNumberOfChecksumErrorsDetected( ) const; 107 139 UInt getNumberOfChecksumErrorsDetected( Int decIdx ) const { return m_tDecTop[decIdx]->getNumberOfChecksumErrorsDetected(); } 108 109 140 #else 110 141 UInt getNumberOfChecksumErrorsDetected() const { return m_cTDecTop.getNumberOfChecksumErrorsDetected(); } … … 112 143 113 144 protected: 145 114 146 Void xCreateDecLib (); ///< create internal classes 115 147 Void xDestroyDecLib (); ///< destroy internal classes 116 148 Void xInitDecLib (); ///< initialize decoder class 117 149 118 #if NH_MV 119 Void xWriteOutput ( TComList<TComPic*>* pcListPic, Int layerId, Int tId ); ///< write YUV to file 120 121 Void xMarkForOutput ( Bool allLayersDecoded, Int pocLastPic, Int layerIdLastPic ); 122 Void xMarkAltOutPic ( Int targetOutputLayer, Int pocLastPic ); 123 124 Void xFlushOutput ( TComList<TComPic*>* pcListPic, Int layerId ); ///< flush all remaining decoded pictures to file 125 Int xGetDecoderIdx ( Int layerId, Bool createFlag = false ); 126 #else 150 #if !NH_MV 127 151 Void xWriteOutput ( TComList<TComPic*>* pcListPic , UInt tId); ///< write YUV to file 128 152 Void xFlushOutput ( TComList<TComPic*>* pcListPic ); ///< flush all remaining decoded pictures to file 129 #endif 130 Bool isNaluWithinTargetDecLayerIdSet ( InputNALUnit* nalu ); ///< check whether given Nalu is within targetDecLayerIdSet 153 Bool isNaluWithinTargetDecLayerIdSet ( InputNALUnit* nalu ); ///< check whether given Nalu is within targetDecLayerIdSet 154 155 #else 156 // Process NAL units 157 Bool xExtractAndRewrite ( InputNALUnit* nalu ); 158 Void xProcessVclNalu ( InputNALUnit nalu ); 159 Bool xIsSkipVclNalu ( InputNALUnit& nalu, Bool isFirstSliceOfPic ); 160 Void xProcessNonVclNalu ( InputNALUnit nalu ); 161 Void xTerminateDecoding ( ); 162 163 // Process slice 164 Void xDecodeFirstSliceOfPicture ( InputNALUnit nalu, Bool sliceIsFirstOfNewAu ); 165 Void xDecodeFollowSliceOfPicture ( InputNALUnit nalu ); 166 167 // Process picture 168 Void xFinalizePreviousPictures ( Bool sliceIsFirstOfNewAU ); 169 Void xFinalizePic ( Bool curPicIsLastInAu ); 170 Void xFinalizeAU ( ); 171 Void xPicDecoding ( DecProcPart curPart, Bool picPosInAuIndication ); 172 173 // Clause 8 174 Void x812CvsgDecodingProcess ( Int decIdx ); 175 Void x813decProcForCodPicWithLIdZero ( DecProcPart curPart ); 176 177 // Annex C (DPB) 178 Void xC522OutputAndRemOfPicsFromDpb ( ); 179 Void xC523PicDecMarkAddBumpAndStor ( ); 180 Void xC524Bumping ( ); 181 182 // Annex F.8 183 Void xF811GeneralDecProc ( InputNALUnit nalu ); 184 Void xF812CvsgDecodingProcess ( Int decIdx ); 185 Void xF813ComDecProcForACodedPic ( DecProcPart curPart, Bool picPosInAuIndication ); 186 Void xF814decProcForCodPicWithLIdZero ( DecProcPart curPart ); 187 Void xF816decProcEndDecOfCodPicLIdGrtZero( ); 188 189 // Annex F.13 (DPB) 190 Void xF13521InitDpb ( ); 191 Void xF13522OutputAndRemOfPicsFromDpb ( Bool beforePocDerivation ); 192 Void xF13523PicDecMarkAddBumpAndStor ( Bool curPicIsLastInAu ); 193 Void xF13524Bumping ( TComList<TComAu*> aus ); 194 195 // Helpers 196 TDecTop* xGetDecoder ( InputNALUnit& nalu ); 197 Int xGetDecoderIdx ( Int layerId, Bool createFlag = false ); 198 Int xPreDecodePoc ( InputNALUnit& nalu ); 199 Bool xDetectNewAu ( InputNALUnit& nalu ); 200 Void xDetectNewPocResettingPeriod ( InputNALUnit& nalu ); 201 Bool xIsNaluInTargetDecLayerIdSet ( InputNALUnit* nalu ); ///< check whether given Nalu is within targetDecLayerIdSet 202 Bool xAllRefLayersInitilized ( Int curLayerId ); 203 Void xInitFileIO ( ); 204 Void xOpenReconFile ( TComPic* curPic ); 205 Void xFlushOutput ( ); 206 Void xCropAndOutput ( TComPic* curPic ); 207 #endif 131 208 }; 132 209 … … 134 211 135 212 #endif 136 -
branches/HTM-15.0-dev0/source/App/TAppEncoder/TAppEncTop.cpp
r1313 r1317 260 260 { 261 261 m_cListPicYuvRec .push_back(new TComList<TComPicYuv*>) ; 262 263 #if !NH_MV 262 264 m_ivPicLists.push_back( m_acTEncTopList[ layerIdInVps ]->getListPic() ); 265 #endif 266 263 267 TEncTop& m_cTEncTop = *m_acTEncTopList[ layerIdInVps ]; // It is not a member, but this name helps avoiding code duplication !!! 264 268 265 Int layerId = vps.getLayerIdInNuh( layerIdInVps ); 269 Int layerId = vps.getLayerIdInNuh ( layerIdInVps ); 270 #if NH_MV 271 m_ivPicLists.getSubDpb( layerId, true ); 272 #endif 273 266 274 m_cTEncTop.setLayerIdInVps ( layerIdInVps ); 267 275 m_cTEncTop.setLayerId ( layerId ); … … 1216 1224 } 1217 1225 #if NH_MV 1218 1226 } 1219 1227 } 1220 1228 #endif … … 1766 1774 // check if all inter layer reference pictures specified in the gop entry are valid reference layer pictures when allRefLayerActiveFlag is equal to 1 1767 1775 // (Should actually always be true) 1768 Bool maxTidIlRefAndSubLayerMaxVa ildFlag = true;1776 Bool maxTidIlRefAndSubLayerMaxValidFlag = true; 1769 1777 for( Int l = 0; l < ge.m_numActiveRefLayerPics; l++ ) 1770 1778 { … … 1784 1792 } 1785 1793 } 1786 maxTidIlRefAndSubLayerMaxVa ildFlag = maxTidIlRefAndSubLayerMaxVaildFlag && referenceLayerFoundFlag;1787 } 1788 assert ( maxTidIlRefAndSubLayerMaxVa ildFlag ); // Something wrong with MaxTidIlRefPicsPlus1 or SubLayersVpsMaxMinus11794 maxTidIlRefAndSubLayerMaxValidFlag = maxTidIlRefAndSubLayerMaxValidFlag && referenceLayerFoundFlag; 1795 } 1796 assert ( maxTidIlRefAndSubLayerMaxValidFlag ); // Something wrong with MaxTidIlRefPicsPlus1 or SubLayersVpsMaxMinus1 1789 1797 } 1790 1798 } -
branches/HTM-15.0-dev0/source/Lib/TLibCommon/CommonDef.h
r1314 r1317 278 278 static const Int MAX_NUM_VIDEO_SIGNAL_INFO = 16 ; 279 279 static const Int MAX_NUM_SCALED_REF_LAYERS = MAX_NUM_LAYERS - 1 ; 280 static const Int MAX_NUM_PICS_RPS = 16 ; 281 static const Int MAX_NUM_REF_LAYERS = 63 ; 280 282 #endif 281 283 … … 367 369 #endif 368 370 371 #if NH_MV 372 static const std::string NALU_TYPE_STR[] = { 373 "CODED_SLICE_TRAIL_N ", // 0 374 "CODED_SLICE_TRAIL_R ", // 1 375 "CODED_SLICE_TSA_N ", // 2 376 "CODED_SLICE_TSA_R ", // 3 377 "CODED_SLICE_STSA_N ", // 4 378 "CODED_SLICE_STSA_R ", // 5 379 "CODED_SLICE_RADL_N ", // 6 380 "CODED_SLICE_RADL_R ", // 7 381 "CODED_SLICE_RASL_N ", // 8 382 "CODED_SLICE_RASL_R ", // 9 383 "RESERVED_VCL_N10 ", 384 "RESERVED_VCL_R11 ", 385 "RESERVED_VCL_N12 ", 386 "RESERVED_VCL_R13 ", 387 "RESERVED_VCL_N14 ", 388 "RESERVED_VCL_R15 ", 389 "CODED_SLICE_BLA_W_LP ", // 16 390 "CODED_SLICE_BLA_W_RADL", // 17 391 "CODED_SLICE_BLA_N_LP ", // 18 392 "CODED_SLICE_IDR_W_RADL", // 19 393 "CODED_SLICE_IDR_N_LP ", // 20 394 "CODED_SLICE_CRA ", // 21 395 "RESERVED_IRAP_VCL22 ", 396 "RESERVED_IRAP_VCL23 ", 397 "RESERVED_VCL24 ", 398 "RESERVED_VCL25 ", 399 "RESERVED_VCL26 ", 400 "RESERVED_VCL27 ", 401 "RESERVED_VCL28 ", 402 "RESERVED_VCL29 ", 403 "RESERVED_VCL30 ", 404 "RESERVED_VCL31 ", 405 "VPS ", // 32 406 "SPS ", // 33 407 "PPS ", // 34 408 "ACCESS_UNIT_DELIMITER ", // 35 409 "EOS ", // 36 410 "EOB ", // 37 411 "FILLER_DATA ", // 38 412 "PREFIX_SEI ", // 39 413 "SUFFIX_SEI ", // 40 414 "RESERVED_NVCL41 ", 415 "RESERVED_NVCL42 ", 416 "RESERVED_NVCL43 ", 417 "RESERVED_NVCL44 ", 418 "RESERVED_NVCL45 ", 419 "RESERVED_NVCL46 ", 420 "RESERVED_NVCL47 ", 421 "UNSPECIFIED_48 ", 422 "UNSPECIFIED_49 ", 423 "UNSPECIFIED_50 ", 424 "UNSPECIFIED_51 ", 425 "UNSPECIFIED_52 ", 426 "UNSPECIFIED_53 ", 427 "UNSPECIFIED_54 ", 428 "UNSPECIFIED_55 ", 429 "UNSPECIFIED_56 ", 430 "UNSPECIFIED_57 ", 431 "UNSPECIFIED_58 ", 432 "UNSPECIFIED_59 ", 433 "UNSPECIFIED_60 ", 434 "UNSPECIFIED_61 ", 435 "UNSPECIFIED_62 ", 436 "UNSPECIFIED_63 ", 437 "INVALID " 438 }; 439 #endif 369 440 370 441 #if NH_3D -
branches/HTM-15.0-dev0/source/Lib/TLibCommon/Debug.cpp
r1313 r1317 152 152 EnvVar DebugOptionList::ForceLumaMode ("FORCE_LUMA_MODE", "0", "Force a particular intra direction for Luma (0-34)" ); 153 153 EnvVar DebugOptionList::ForceChromaMode ("FORCE_CHROMA_MODE", "0", "Force a particular intra direction for chroma (0-5)" ); 154 155 #if DEBUG_STRING 156 EnvVar DebugOptionList::DebugString_Structure ("DEBUG_STRUCTURE", " 3", "Produce output on chosen structure bit0=intra, bit1=inter");157 EnvVar DebugOptionList::DebugString_Pred ("DEBUG_PRED", " 3", "Produce output on prediction data. bit0=intra, bit1=inter");158 EnvVar DebugOptionList::DebugString_Resi ("DEBUG_RESI", " 3", "Produce output on residual data. bit0=intra, bit1=inter");159 EnvVar DebugOptionList::DebugString_Reco ("DEBUG_RECO", " 3", "Produce output on reconstructed data. bit0=intra, bit1=inter");154 155 #if DEBUG_STRING 156 EnvVar DebugOptionList::DebugString_Structure ("DEBUG_STRUCTURE", "0", "Produce output on chosen structure bit0=intra, bit1=inter"); 157 EnvVar DebugOptionList::DebugString_Pred ("DEBUG_PRED", "0", "Produce output on prediction data. bit0=intra, bit1=inter"); 158 EnvVar DebugOptionList::DebugString_Resi ("DEBUG_RESI", "0", "Produce output on residual data. bit0=intra, bit1=inter"); 159 EnvVar DebugOptionList::DebugString_Reco ("DEBUG_RECO", "0", "Produce output on reconstructed data. bit0=intra, bit1=inter"); 160 160 EnvVar DebugOptionList::DebugString_InvTran ("DEBUG_INV_QT", "0", "Produce output on inverse-quantiser and transform stages. bit0=intra, bit1=inter"); 161 161 #endif -
branches/HTM-15.0-dev0/source/Lib/TLibCommon/NAL.h
r1313 r1317 98 98 || m_nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R; 99 99 } 100 #if NH_MV 101 Bool isIrap() 102 { 103 return m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_LP 104 || m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_RADL 105 || m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_N_LP 106 || m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL 107 || m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP 108 || m_nalUnitType == NAL_UNIT_CODED_SLICE_CRA; 109 } 110 111 Bool isIdr() 112 { 113 return m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL 114 || m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP; 115 } 116 117 Bool isBla() 118 { 119 return m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_LP 120 || m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_RADL 121 || m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_N_LP; 122 } 123 124 Bool isCra() 125 { 126 return m_nalUnitType == NAL_UNIT_CODED_SLICE_CRA; 127 } 128 129 130 #endif 100 131 Bool isSei() 101 132 { … … 108 139 return ( (UInt)m_nalUnitType < 32 ); 109 140 } 141 #if NH_MV 142 Void print( ) 143 { 144 std::cout << "Type: " << NALU_TYPE_STR[m_nalUnitType] << " LayerId: " << m_nuhLayerId << " TemporalId: " << m_temporalId; 145 } 146 #endif 110 147 }; 111 148 -
branches/HTM-15.0-dev0/source/Lib/TLibCommon/TComBitStream.cpp
r1313 r1317 41 41 #include <string.h> 42 42 #include <memory.h> 43 43 #if NH_MV 44 #include "TComRom.h" // This is only here, since ENC_DEC_TRACE is currently there. Consider removing when this has changed. 45 #endif 44 46 using namespace std; 45 47 … … 258 260 m_numBitsRead += uiNumberOfBits; 259 261 262 #if ENC_DEC_TRACE && H_MV_ENC_DEC_TRAC 263 if ( g_traceBitsRead ) 264 { 265 Bool oldJustDoIt = g_bJustDoIt; 266 g_bJustDoIt = true; 267 writeToTraceFile( "Bits: ", m_numBitsRead, true ); 268 g_bJustDoIt = oldJustDoIt; 269 } 270 #endif 271 260 272 /* NB, bits are extracted from the MSB of each byte. */ 261 273 UInt retval = 0; -
branches/HTM-15.0-dev0/source/Lib/TLibCommon/TComCodingStatistics.h
r1313 r1317 102 102 STATS__CABAC_BITS__3D_IC, 103 103 #endif 104 #if NH_3D_DMM || NH_3D_SDC_INTRA || H_3D_INTER_SDC104 #if NH_3D_DMM || NH_3D_SDC_INTRA || NH_3D_SDC_INTER 105 105 STATS__CABAC_BITS__DELTADC_SIGN_EP, 106 106 STATS__CABAC_BITS__DELTADC_PREFIX, … … 174 174 "CABAC_BITS__3D_IC" 175 175 #endif 176 #if NH_3D_DMM || NH_3D_SDC_INTRA || H_3D_INTER_SDC176 #if NH_3D_DMM || NH_3D_SDC_INTRA || NH_3D_SDC_INTER 177 177 ,"STATS__CABAC_BITS__DELTADC_SIGN_EP" 178 178 ,"STATS__CABAC_BITS__DELTADC_PREFIX" -
branches/HTM-15.0-dev0/source/Lib/TLibCommon/TComDataCU.cpp
r1313 r1317 2934 2934 } 2935 2935 2936 #if NH_3D _FIX_PRUNING2936 #if NH_3D 2937 2937 Bool TComDataCU::hasEqualMotion( Int dirA, const TComMvField* mvFieldA, Int dirB, const TComMvField* mvFieldB ) 2938 2938 { … … 3046 3046 if( !iLoop && ivCandDir[0] > 0) 3047 3047 { 3048 #if NH_3D_FIX_PRUNING3049 3048 if( hasEqualMotion(tmpDir, tmpMV, m_mergCands[MRG_IVMC].m_uDir, m_mergCands[MRG_IVMC].m_cMvField )) 3050 #else3051 if(tmpDir == m_mergCands[MRG_IVMC].m_uDir && m_mergCands[MRG_IVMC].m_cMvField[0]==tmpMV[0] && m_mergCands[MRG_IVMC].m_cMvField[1]==tmpMV[1])3052 #endif3053 3049 { 3054 3050 bRemove = true; … … 3101 3097 } 3102 3098 3099 3100 #if ENC_DEC_TRACE && H_MV_ENC_DEC_TRAC 3101 if ( g_traceMergeCandListConst ) 3102 { 3103 for (Int i = 0; i<MRG_IVSHIFT+1; i++) 3104 { 3105 m_mergCands[i].print( i ); 3106 } 3107 } 3108 #endif 3109 3110 3103 3111 Int iCount = 0; 3104 3112 TComMv cZeroMv; … … 3156 3164 pcMvFieldNeighbours[(ui<<1)+1].setMvField(cZeroMv, NOT_VALID); 3157 3165 } 3166 3158 3167 // copy extMergeCandList to output 3159 3168 for( UInt ui = 0; ui < getSlice()->getMaxNumMergeCand(); ui++ ) … … 3161 3170 puhInterDirNeighbours[ui] = uhInterDirNeighboursExt[ui]; 3162 3171 pcMvFieldNeighbours[ui<<1].setMvField(extMergeCandList[ui<<1].getMv(), extMergeCandList[ui<<1].getRefIdx()); 3172 3163 3173 if ( getSlice()->isInterB() ) 3174 { 3164 3175 pcMvFieldNeighbours[(ui<<1)+1].setMvField(extMergeCandList[(ui<<1)+1].getMv(), extMergeCandList[(ui<<1)+1].getRefIdx()); 3165 } 3176 } 3177 } 3178 3179 #if ENC_DEC_TRACE && H_MV_ENC_DEC_TRAC 3180 if ( g_traceMergeCandListConst ) 3181 { 3182 std::cout << std::setfill(' ') << std::setw( 15 ) 3183 << "Num" << std::setw( 15 ) 3184 << "Dir " << std::setw( 15 ) 3185 << "L0 RefIdx" << std::setw( 15 ) 3186 << "L0 Hor" << std::setw( 15 ) 3187 << "L0 Ver" << std::setw( 15 ) 3188 << "L1 RefIdx" << std::setw( 15 ) 3189 << "L1 Hor" << std::setw( 15 ) 3190 << "L1 Ver" << std::setw( 15 ) 3191 << std::endl; 3192 3193 // copy extMergeCandList to output 3194 for( UInt ui = 0; ui < getSlice()->getMaxNumMergeCand(); ui++ ) 3195 { 3196 UChar curDir = puhInterDirNeighbours[ui]; 3197 TComMvField& curf = pcMvFieldNeighbours[ui<<1]; 3198 TComMvField& curf2 = pcMvFieldNeighbours[(ui<<1)+1]; 3199 3200 std::cout << std::setfill(' ') << std::setw( 15 ) 3201 << ui << std::setw( 15 ) 3202 << (UInt) curDir << std::setw( 15 ) 3203 << ((curDir & 1) ? curf.getRefIdx() : MIN_INT) << std::setw( 15 ) 3204 << ((curDir & 1) ? curf.getMv().getHor() : MIN_INT) << std::setw( 15 ) 3205 << ((curDir & 1) ? curf.getMv().getVer() : MIN_INT) << std::setw( 15 ); 3206 3207 if ( getSlice()->isInterB() ) 3208 { 3209 std::cout << ((curDir & 2) ? curf2.getRefIdx() : MIN_INT) << std::setw( 15 ) 3210 << ((curDir & 1) ? curf2.getMv().getHor() : MIN_INT) << std::setw( 15 ) 3211 << ((curDir & 1) ? curf2.getMv().getVer() : MIN_INT) << std::setw( 15 ); 3212 } 3213 std::cout << std::endl; 3214 } 3215 } 3216 #endif 3166 3217 numValidMergeCand = iCount; 3167 3218 assert(iCount == getSlice()->getMaxNumMergeCand()); … … 3503 3554 continue; 3504 3555 } 3505 #if NH_3D_FIX_PRUNING3506 3556 if (hasEqualMotion( tmpDir, tmpMV, m_mergCands[MRG_A1+iCnloop].m_uDir, m_mergCands[MRG_A1+iCnloop].m_cMvField ) ) 3507 #else3508 if (tmpDir == m_mergCands[MRG_A1+iCnloop].m_uDir && tmpMV[0]==m_mergCands[MRG_A1+iCnloop].m_cMvField[0] && tmpMV[1]==m_mergCands[MRG_A1+iCnloop].m_cMvField[1])3509 #endif3510 3557 { 3511 3558 m_mergCands[MRG_A1+iCnloop].m_bAvailable = false; … … 3581 3628 continue; 3582 3629 } 3583 #if NH_3D_FIX_PRUNING3584 3630 if (hasEqualMotion(ivCandDir[0], tmpMV, m_mergCands[MRG_A1+i].m_uDir, m_mergCands[MRG_A1+i].m_cMvField) ) 3585 #else3586 if (ivCandDir[0] == m_mergCands[MRG_A1+i].m_uDir && tmpMV[0]==m_mergCands[MRG_A1+i].m_cMvField[0] && tmpMV[1]==m_mergCands[MRG_A1+i].m_cMvField[1])3587 #endif3588 3631 { 3589 3632 m_mergCands[MRG_A1+i].m_bAvailable = false; … … 3594 3637 else 3595 3638 { 3596 #if NH_3D_FIX_PRUNING3597 3639 if( hasEqualMotion( ivCandDir[0], tmpMV, m_mergCands[MRG_T].m_uDir, m_mergCands[MRG_T].m_cMvField ) ) 3598 #else3599 if (m_mergCands[MRG_T].m_bAvailable && ivCandDir[0] == m_mergCands[MRG_T].m_uDir && tmpMV[0]==m_mergCands[MRG_T].m_cMvField[0] && tmpMV[1]==m_mergCands[MRG_T].m_cMvField[1])3600 #endif3601 3640 { 3602 3641 bRemoveSpa = true; … … 3647 3686 !bARPFlag && 3648 3687 #endif 3649 #if H_3D || NH_3D_FIX_VSP3688 #if NH_3D 3650 3689 (nPSW + nPSH > 12) && 3651 3690 #endif … … 3694 3733 continue; 3695 3734 } 3696 #if NH_3D_FIX_PRUNING3697 3735 if ( hasEqualMotion(ivCandDir[1], tmpMV, m_mergCands[MRG_A1+i].m_uDir, m_mergCands[MRG_A1+i].m_cMvField) ) 3698 #else3699 if (ivCandDir[1] == m_mergCands[MRG_A1+i].m_uDir && tmpMV[0]==m_mergCands[MRG_A1+i].m_cMvField[0] && tmpMV[1]==m_mergCands[MRG_A1+i].m_cMvField[1])3700 #endif3701 3736 { 3702 3737 bRemoveSpa = true; … … 4852 4887 } 4853 4888 } 4889 #if NH_3D 4890 Void TComDataCU::printMV( ) 4891 { 4892 4893 for(UInt i=0; i<NUM_REF_PIC_LIST_01; i++) 4894 { 4895 std::cout << "L" << i; 4896 m_acCUMvField[i].print(m_pePredMode); 4897 } 4898 4899 } 4900 #endif 4854 4901 4855 4902 UInt TComDataCU::getCoefScanIdx(const UInt uiAbsPartIdx, const UInt uiWidth, const UInt uiHeight, const ComponentID compID) const … … 5284 5331 #if NH_3D_NBDV_REF 5285 5332 TComPic* picDepth = NULL; 5286 assert(getSlice()->getRefPic(eRefPicList, refId)->getPOC() == getSlice()->getPOC()); 5333 assert(getSlice()->getRefPic(eRefPicList, refId)->getPOC() == getSlice()->getPOC()); 5287 5334 #if H_3D_FCO_VSP_DONBDV_E0163 5288 5335 picDepth = getSlice()->getIvPic(true, getSlice()->getViewIndex() ); … … 5627 5674 if(!m_pcSlice->getIsDepth()) 5628 5675 { 5629 #if H_3D_DBBP || NH_3D_ALIGN_SPIVMP_DBBP5676 #if NH_3D_DBBP 5630 5677 if (!getDBBPFlag(0)) 5631 5678 #else … … 5803 5850 iCurrPosY += ( iHeight >> 1 ); 5804 5851 } 5805 #if H_3D_DBBP || NH_3D_ALIGN_SPIVMP_DBBP5852 #if NH_3D_DBBP 5806 5853 for(Int iLoopCan = ( (m_pcSlice->getIsDepth() || getDBBPFlag(0)) ? 0 : 1 ); iLoopCan < ( 2 - m_pcSlice->getIsDepth() ); iLoopCan ++) 5807 5854 #else … … 5878 5925 } 5879 5926 #if NH_3D_SPIVMP 5880 #if H_3D_DBBP || NH_3D_ALIGN_SPIVMP_DBBP5927 #if NH_3D_DBBP 5881 5928 for(Int iLoopCan = ( (m_pcSlice->getIsDepth() || getDBBPFlag(0)) ? 0 : 1 ); iLoopCan < ( 2 - m_pcSlice->getIsDepth() ); iLoopCan ++) 5882 5929 #else -
branches/HTM-15.0-dev0/source/Lib/TLibCommon/TComDataCU.h
r1313 r1317 601 601 #if NH_3D 602 602 Void compressMV ( Int scale ); 603 Void printMV ( ); 603 604 #else 604 605 Void compressMV (); … … 644 645 645 646 Bool hasEqualMotion ( UInt uiAbsPartIdx, TComDataCU* pcCandCU, UInt uiCandAbsPartIdx ); 646 #if NH_3D _FIX_PRUNING647 #if NH_3D 647 648 Bool hasEqualMotion ( Int dirA, const TComMvField* mvFieldA, Int dirB, const TComMvField* mvFieldB ); 648 649 #endif -
branches/HTM-15.0-dev0/source/Lib/TLibCommon/TComMotionInfo.cpp
r1313 r1317 44 44 #include "TComPic.h" 45 45 #endif 46 46 #if NH_MV 47 #include <iomanip> 48 #endif 47 49 //! \ingroup TLibCommon 48 50 //! \{ … … 377 379 } 378 380 } 381 382 #if NH_MV 383 Void TComCUMvField::print(Char* pePredMode) 384 { 385 for ( Int uiPartIdx = 0; uiPartIdx < m_uiNumPartition; uiPartIdx += 1 ) 386 { 387 PredMode predMode = static_cast<PredMode>( pePredMode[ uiPartIdx ] ); 388 389 if ( predMode == MODE_INTRA) 390 { 391 std::cout << std::setfill(' ') << "(" 392 << std::setw(3) << " " << "," 393 << std::setw(3) << " " << "," 394 << std::setw(3) << " " << ")"; 395 } 396 else 397 { 398 ; 399 std::cout << std::setfill(' ') << "(" 400 << std::setw(3) << (Int) m_piRefIdx[ uiPartIdx ] << "," 401 << std::setw(3) << m_pcMv[ uiPartIdx ].getHor() << "," 402 << std::setw(3) << m_pcMv[ uiPartIdx ].getVer() << ")"; 403 } 404 } 405 } 406 407 #if NH_3D_MLC 408 Void TComMotionCand::print( Int i ) 409 { 410 if (i == 0 ) 411 { 412 413 std::cout << std::setfill(' ') << std::setw( 15 ) 414 << "Num" << std::setw( 15 ) 415 << "Avai" << std::setw( 15 ) 416 << "Dir " << std::setw( 15 ) 417 << "L0 RefIdx" << std::setw( 15 ) 418 << "L0 Hor" << std::setw( 15 ) 419 << "L0 Ver" << std::setw( 15 ) 420 << "L1 RefIdx" << std::setw( 15 ) 421 << "L1 Hor" << std::setw( 15 ) 422 << "L1 Ver" << std::setw( 15 ) 423 << "VspFlag" << std::setw( 15 ) 424 << "SPIVMPFlag" 425 << std::endl; 426 } 427 428 std::cout << std::setfill(' ') << std::setw( 15 ) 429 << i << std::setw( 15 ) 430 << m_bAvailable << std::setw( 15 ) 431 << (UInt) m_uDir << std::setw( 15 ) 432 << ((m_uDir & 1) ? m_cMvField[0].getRefIdx() : MIN_INT) << std::setw( 15 ) 433 << ((m_uDir & 1) ? m_cMvField[0].getMv().getHor() : MIN_INT) << std::setw( 15 ) 434 << ((m_uDir & 1) ? m_cMvField[0].getMv().getVer() : MIN_INT) << std::setw( 15 ) 435 << ((m_uDir & 2) ? m_cMvField[1].getRefIdx() : MIN_INT) << std::setw( 15 ) 436 << ((m_uDir & 2) ? m_cMvField[1].getMv().getHor() : MIN_INT) << std::setw( 15 ) 437 << ((m_uDir & 2) ? m_cMvField[1].getMv().getVer() : MIN_INT) << std::setw( 15 ) 438 << m_iVspFlag << std::setw( 15 ) 439 << m_bSPIVMPFlag << std::setw( 15 ) 440 << std::endl; 441 } 442 #endif 443 #endif 379 444 //! \} -
branches/HTM-15.0-dev0/source/Lib/TLibCommon/TComMotionInfo.h
r1313 r1317 43 43 #include "CommonDef.h" 44 44 #include "TComMv.h" 45 45 46 //! \ingroup TLibCommon 46 47 //! \{ … … 188 189 189 190 Void compress(Char* pePredMode, Int scale); 191 #if NH_MV 192 Void print (Char* pePredMode); 193 #endif 190 194 }; 191 195 … … 281 285 #endif 282 286 } 287 288 289 Void print( Int i ); 290 283 291 }; 292 293 284 294 #endif 285 295 -
branches/HTM-15.0-dev0/source/Lib/TLibCommon/TComPic.cpp
r1313 r1317 54 54 , m_bReconstructed (false) 55 55 , m_bNeededForOutput (false) 56 #if NH_MV57 , m_bPicOutputFlag (false)58 #endif59 56 , m_uiCurrSliceIdx (0) 60 57 , m_bCheckLTMSB (false) … … 62 59 , m_layerId (0) 63 60 , m_viewId (0) 61 , m_bPicOutputFlag (false) 64 62 #if NH_3D 65 63 , m_viewIndex (0) … … 82 80 m_eRapRefList = REF_PIC_LIST_0; 83 81 m_uiRapRefIdx = 0; 82 #endif 83 #if NH_MV 84 m_isPocResettingPic = false; 85 m_hasGeneratedRefPics = false; 86 m_isFstPicOfAllLayOfPocResetPer = false; 87 m_decodingOrder = 0; 88 m_noRaslOutputFlag = false; 89 m_noClrasOutputFlag = false; 90 m_picLatencyCount = 0; 91 m_isGenerated = false; 92 m_isGeneratedCl833 = false; 93 m_activatesNewVps = false; 84 94 #endif 85 95 } … … 185 195 } 186 196 } 197 187 198 188 199 Bool TComPic::getSAOMergeAvailability(Int currAddr, Int mergeAddr) … … 231 242 232 243 #if NH_MV 233 Void TComPic::print( Bool legend ) 234 { 235 if ( legend ) 236 std::cout << std::endl << "LId" << "\t" << "POC" << "\t" << "Rec" << "\t" << "Ref" << "\t" << "LT" << "\t" << "OutMark" << "\t" << "OutFlag" << std::endl; 237 else 238 std::cout << getLayerId() << "\t" << getPOC()<< "\t" << getReconMark() << "\t" << getSlice(0)->isReferenced() << "\t" << getIsLongTerm() << "\t" << getOutputMark() << "\t" << getSlice(0)->getPicOutputFlag() <<std::endl; 239 } 240 241 TComPic* TComPicLists::getPic( Int layerIdInNuh, Int poc ) 242 { 243 TComPic* pcPic = NULL; 244 for(TComList<TComList<TComPic*>*>::iterator itL = m_lists.begin(); ( itL != m_lists.end() && pcPic == NULL ); itL++) 245 { 246 for(TComList<TComPic*>::iterator itP=(*itL)->begin(); ( itP!=(*itL)->end() && pcPic == NULL ); itP++) 247 { 248 TComPic* currPic = (*itP); 249 if ( ( currPic->getPOC() == poc ) && ( currPic->getLayerId() == layerIdInNuh ) ) 250 { 251 pcPic = currPic ; 252 } 253 } 254 } 255 return pcPic; 244 Bool TComPic::getPocResetPeriodId() 245 { 246 return getSlice(0)->getPocResetIdc(); 247 } 248 249 Void TComPic::markAsUsedForShortTermReference() 250 { 251 getSlice(0)->setReferenced( true ); 252 setIsLongTerm( false ); 253 } 254 255 Void TComPic::markAsUsedForLongTermReference() 256 { 257 getSlice(0)->setReferenced( true ); 258 setIsLongTerm( true ); 259 } 260 261 262 Void TComPic::markAsUnusedForReference() 263 { 264 getSlice(0)->setReferenced( false ); 265 setIsLongTerm( false ); 266 } 267 268 269 Bool TComPic::getMarkedUnUsedForReference() 270 { 271 return !getSlice(0)->isReferenced( ); 272 } 273 274 275 Bool TComPic::getMarkedAsShortTerm() 276 { 277 return ( getSlice(0)->isReferenced( ) && !getIsLongTerm() ); 278 } 279 280 Void TComPic::print( Int outputLevel ) 281 { 282 if ( outputLevel== 0 ) 283 { 284 std::cout << std::endl 285 << "LId" 286 << "\t" << "POC" 287 << "\t" << "Rec" 288 << "\t" << "Ref" 289 << "\t" << "LT" 290 << "\t" << "OutMark" 291 << "\t" << "OutFlag" 292 << "\t" << "Type" 293 << "\t" << "PReFlag" 294 << std::endl; 295 } 296 else if( outputLevel == 1 ) 297 { 298 std::cout << getLayerId() 299 << "\t" << getPOC() 300 << "\t" << getReconMark() 301 << "\t" << getSlice(0)->isReferenced() 302 << "\t" << getIsLongTerm() 303 << "\t" << getOutputMark() 304 << "\t" << getSlice(0)->getPicOutputFlag() 305 << "\t" << getSlice(0)->getNalUnitTypeString() 306 << "\t" << getSlice(0)->getPocResetFlag() 307 << std::endl; 308 } 309 else if ( outputLevel == 2 ) 310 { 311 std::cout << std:: setfill(' ') 312 << " LayerId: " << std::setw(2) << getLayerId() 313 << "\t" << " POC: " << std::setw(5) << getPOC() 314 << "\t" << " Dec. Order: " << std::setw(5) << getDecodingOrder() 315 << "\t" << " Referenced: " << std::setw(1) << getSlice(0)->isReferenced() 316 << "\t" << " Pic type: " << getSlice(0)->getNalUnitTypeString() 317 << "\t" << " Generated: " << std::setw(1) << getIsGenerated() 318 << "\t" << " Gen. Ref. Pics: " << std::setw(1) << getHasGeneratedRefPics(); 319 } 320 else if ( outputLevel == 4 ) 321 { 322 std::cout << std:: setfill(' ') 323 << " LayerId: " << std::setw(2) << getLayerId() 324 << "\t" << " POC: " << std::setw(5) << getPOC() 325 << "\t" << " Referenced: " << std::setw(1) << getSlice(0)->isReferenced() << std::endl; 326 } 256 327 } 257 328 258 329 #if NH_3D 259 TComPic* TComPicLists::getPic( Int viewIndex, Bool depthFlag, Int poc ) 260 { 261 return getPic ( m_vps->getLayerIdInNuh( viewIndex, depthFlag ), poc ); 262 } 263 #endif 264 Void TComPicLists::print() 265 { 266 Bool first = true; 267 for(TComList<TComList<TComPic*>*>::iterator itL = m_lists.begin(); ( itL != m_lists.end() ); itL++) 268 { 269 for(TComList<TComPic*>::iterator itP=(*itL)->begin(); ( itP!=(*itL)->end() ); itP++) 270 { 271 if ( first ) 272 { 273 (*itP)->print( true ); 274 first = false; 275 } 276 (*itP)->print( false ); 277 } 278 } 279 } 280 281 TComPicYuv* TComPicLists::getPicYuv( Int layerIdInNuh, Int poc, Bool reconFlag ) 282 { 283 TComPic* pcPic = getPic( layerIdInNuh, poc ); 284 TComPicYuv* pcPicYuv = NULL; 285 286 if (pcPic != NULL) 287 { 288 if( reconFlag ) 289 { 290 if ( pcPic->getReconMark() ) 291 { 292 pcPicYuv = pcPic->getPicYuvRec(); 293 } 294 } 295 else 296 { 297 pcPicYuv = pcPic->getPicYuvOrg(); 298 } 299 }; 300 301 return pcPicYuv; 302 } 303 304 #if NH_3D 305 TComPicYuv* TComPicLists::getPicYuv( Int viewIndex, Bool depthFlag, Int poc, Bool recon ) 306 { 307 Int layerIdInNuh = m_vps->getLayerIdInNuh( viewIndex, depthFlag ); 308 return getPicYuv( layerIdInNuh, poc, recon ); 309 } 310 #if NH_3D_ARP 311 TComList<TComPic*>* TComPicLists::getPicList( Int layerIdInNuh ) 312 { 313 TComList<TComList<TComPic*>*>::iterator itL = m_lists.begin(); 314 Int iLayer = 0; 315 316 assert( layerIdInNuh < m_lists.size() ); 317 318 while( iLayer != layerIdInNuh ) 319 { 320 itL++; 321 iLayer++; 322 } 323 324 return *itL; 325 } 326 #endif 327 #endif 328 #endif // NH_MV 330 Void TComPic::printMotion() 331 { 332 TComPicSym* pPicSym = getPicSym(); 333 for ( UInt uiCUAddr = 0; uiCUAddr < pPicSym->getNumberOfCtusInFrame(); uiCUAddr++ ) 334 { 335 TComDataCU* pCtu = pPicSym->getCtu(uiCUAddr); 336 std::cout << "CUAddr " << uiCUAddr << std::endl; 337 pCtu->printMV(); 338 std::cout << std::endl; 339 } 340 } 329 341 330 342 #if NH_3D_NBDV … … 437 449 m_abTIVRINCurrRL[curCandPic][iColRefDir][iColRefIdx] = false; 438 450 Int iColViewIdx = pcCandColSlice->getViewIndex(); 451 #if H_3D_FIX_ARP_CHECK_NOT_IN_DPB 452 // The picture pcCandColSlice->getRefPic((RefPicList)iColRefDir, iColRefIdx) might not be in DPB anymore 453 // So don't access it directly. 454 Int iColRefViewIdx = pcCandColSlice->getVPS()->getViewOrderIdx( pcCandColSlice->getRefLayerId( (RefPicList)iColRefDir, iColRefIdx ) ); 455 #else 439 456 Int iColRefViewIdx = pcCandColSlice->getRefPic((RefPicList)iColRefDir, iColRefIdx)->getViewIndex(); 457 #endif 440 458 if(iColViewIdx == iColRefViewIdx) 441 459 { … … 487 505 { 488 506 if(pcCurrSlice->getRefPOC((RefPicList)iCurrRefDir, iCurrRefIdx ) == iTextRefPOC && 489 507 pcCurrSlice->getRefPic((RefPicList)iCurrRefDir, iCurrRefIdx)->getViewIndex() == iTextRefViewId) 490 508 { 491 m_aiTexToDepRef[iTextRefDir][iTextRefIdx] = iCurrRefIdx; 509 m_aiTexToDepRef[iTextRefDir][iTextRefIdx] = iCurrRefIdx; 492 510 } 493 511 } … … 504 522 } 505 523 #endif 524 #endif 525 526 Void TComAu::setPicLatencyCount( Int picLatenyCount ) 527 { 528 for(TComList<TComPic*>::iterator itP= begin(); itP!= end(); itP++) 529 { 530 (*itP)->setPicLatencyCount( picLatenyCount ); 531 } 532 } 533 534 TComPic* TComAu::getPic( Int nuhLayerId ) 535 { 536 TComPic* pic = NULL; 537 for(TComList<TComPic*>::iterator itP= begin(); ( itP!= end() && (pic == NULL) ); itP++) 538 { 539 if ( (*itP)->getLayerId() == nuhLayerId ) 540 { 541 pic = (*itP); 542 } 543 } 544 return pic; 545 } 546 547 Void TComAu::addPic( TComPic* pic, Bool pocUnkown ) 548 { 549 if ( !empty() ) 550 { 551 if (!pocUnkown) 552 { 553 assert( pic->getPOC() == ( getPoc() )); 554 } 555 pic->setPicLatencyCount( getPicLatencyCount() ); 556 557 assert( getPic( pic->getLayerId() ) == NULL ); 558 559 // Add sorted 560 TComAu::iterator itP = begin(); 561 Bool inserted = false; 562 while( !inserted ) 563 { 564 if ( ( itP == end()) || pic->getLayerId() < (*itP)->getLayerId() ) 565 { 566 insert(itP, pic ); 567 inserted = true; 568 } 569 else 570 { 571 ++itP; 572 } 573 } 574 } 575 else 576 { 577 pushBack( pic ); 578 } 579 } 580 581 Bool TComAu::containsPic( TComPic* pic ) 582 { 583 Bool isInList = false; 584 for(TComList<TComPic*>::iterator itP= begin(); ( itP!= end() && (!isInList) ); itP++) 585 { 586 isInList = isInList || ( pic == (*itP)); 587 } 588 return isInList; 589 } 590 591 TComSubDpb::TComSubDpb( Int nuhLayerid ) 592 { 593 m_nuhLayerId = nuhLayerid; 594 } 595 596 TComPic* TComSubDpb::getPic( Int poc ) 597 { 598 TComPic* pic = NULL; 599 for(TComList<TComPic*>::iterator itP= begin(); ( itP!= end() && (pic == NULL) ); itP++) 600 { 601 if ( (*itP)->getPOC() == poc ) 602 { 603 pic = (*itP); 604 } 605 } 606 return pic; 607 } 608 609 TComPic* TComSubDpb::getPicFromLsb( Int pocLsb, Int maxPicOrderCntLsb ) 610 { 611 TComPic* pic = NULL; 612 for(TComList<TComPic*>::iterator itP= begin(); ( itP!= end() && (pic == NULL) ); itP++) 613 { 614 if ( ( (*itP)->getPOC() & ( maxPicOrderCntLsb - 1 ) ) == pocLsb ) 615 { 616 pic = (*itP); 617 } 618 } 619 return pic; 620 } 621 622 TComPic* TComSubDpb::getShortTermRefPic( Int poc ) 623 { 624 TComPic* pic = NULL; 625 for(TComList<TComPic*>::iterator itP= begin(); ( itP!= end() && (pic == NULL) ); itP++) 626 { 627 if ( (*itP)->getPOC() == poc && (*itP)->getMarkedAsShortTerm() ) 628 { 629 pic = (*itP); 630 } 631 } 632 return pic; 633 } 634 635 TComList<TComPic*> TComSubDpb::getPicsMarkedNeedForOutput() 636 { 637 TComList<TComPic*> picsMarkedNeedForOutput; 638 639 for(TComList<TComPic*>::iterator itP= begin(); itP!= end() ; itP++ ) 640 { 641 if ( (*itP)->getOutputMark() ) 642 { 643 picsMarkedNeedForOutput.push_back( (*itP) ); 644 } 645 } 646 return picsMarkedNeedForOutput; 647 } 648 649 Void TComSubDpb::markAllAsUnusedForReference() 650 { 651 for(TComList<TComPic*>::iterator itP= begin(); itP!= end() ; itP++ ) 652 { 653 (*itP)->markAsUnusedForReference(); 654 } 655 } 656 657 Void TComSubDpb::addPic( TComPic* pic ) 658 { 659 assert( pic != NULL ); 660 assert( m_nuhLayerId == pic->getLayerId() || m_nuhLayerId == -1); 661 if ( !empty() ) 662 { 663 assert( getPic( pic->getPOC() ) == NULL ); // Don't add twice; assert( pic->getLayerId() == m_nuhLayerId ); 664 665 // Add sorted 666 TComSubDpb::iterator itP = begin(); 667 Bool inserted = false; 668 while( !inserted ) 669 { 670 if ( ( itP == end()) || pic->getPOC() < (*itP)->getPOC() ) 671 { 672 insert(itP, pic ); 673 inserted = true; 674 } 675 else 676 { 677 ++itP; 678 } 679 } 680 } 681 else 682 { 683 pushBack( pic ); 684 } 685 } 686 687 Void TComSubDpb::removePics( std::vector<TComPic*> picToRemove ) 688 { 689 for (Int i = 0; i < picToRemove.size(); i++ ) 690 { 691 if( picToRemove[i] != NULL) 692 { 693 remove( picToRemove[i] ); 694 } 695 } 696 } 697 698 Bool TComSubDpb::areAllPicsMarkedNotNeedForOutput() 699 { 700 return ( getPicsMarkedNeedForOutput().size() == 0 ); 701 } 702 703 704 TComPicLists::~TComPicLists() 705 { 706 emptyAllSubDpbs(); 707 for(TComList<TComSubDpb*>::iterator itL = m_subDpbs.begin(); ( itL != m_subDpbs.end()); itL++) 708 { 709 if ( (*itL) != NULL ) 710 { 711 delete (*itL); 712 (*itL) = NULL; 713 } 714 } 715 } 716 717 Void TComPicLists::addNewPic( TComPic* pic ) 718 { 719 getSubDpb ( pic->getLayerId() , true )->addPic( pic ); 720 getAu ( pic->getPOC() , true )->addPic( pic , false ); 721 if ( m_printPicOutput ) 722 { 723 std::cout << " Add picture: "; 724 pic->print( 2 ); 725 std::cout << std::endl; 726 } 727 } 728 729 Void TComPicLists::removePic( TComPic* pic ) 730 { 731 if (pic != NULL) 732 { 733 734 TComSubDpb* curSubDpb = getSubDpb( pic->getLayerId(), false ); 735 curSubDpb->remove( pic ); 736 737 TComAu* curAu = getAu ( pic->getPOC(), false ); 738 739 if (curAu != NULL) 740 { 741 curAu->remove( pic ); 742 // Remove AU when empty. 743 if (curAu->empty() ) 744 { 745 m_aus.remove( curAu ); 746 delete curAu; 747 } 748 } 749 750 if ( m_printPicOutput ) 751 { 752 std::cout << " Remove picture: "; 753 pic->print( 2 ); 754 std::cout << std::endl; 755 } 756 757 pic->destroy(); 758 delete pic; 759 } 760 } 761 762 TComPic* TComPicLists::getPic( Int layerIdInNuh, Int poc ) 763 { 764 TComPic* pcPic = NULL; 765 TComSubDpb* subDpb = getSubDpb( layerIdInNuh, false ); 766 if ( subDpb != NULL ) 767 { 768 pcPic = subDpb->getPic( poc ); 769 } 770 return pcPic; 771 } 772 773 TComPicYuv* TComPicLists::getPicYuv( Int layerIdInNuh, Int poc, Bool reconFlag ) 774 { 775 TComPic* pcPic = getPic( layerIdInNuh, poc ); 776 TComPicYuv* pcPicYuv = NULL; 777 778 if (pcPic != NULL) 779 { 780 if( reconFlag ) 781 { 782 if ( pcPic->getReconMark() ) 783 { 784 pcPicYuv = pcPic->getPicYuvRec(); 785 } 786 } 787 else 788 { 789 pcPicYuv = pcPic->getPicYuvOrg(); 790 } 791 }; 792 793 return pcPicYuv; 794 } 795 796 TComSubDpb* TComPicLists::getSubDpb( Int nuhLayerId, Bool create ) 797 { 798 TComSubDpb* subDpb = NULL; 799 for(TComList<TComSubDpb*>::iterator itL = m_subDpbs.begin(); ( itL != m_subDpbs.end() && subDpb == NULL ); itL++) 800 { 801 if ( (*itL)->getLayerId() == nuhLayerId ) 802 { 803 subDpb = (*itL); 804 } 805 } 806 if ( subDpb == NULL && create ) 807 { 808 m_subDpbs.push_back( new TComSubDpb(nuhLayerId) ); 809 } 810 return subDpb; 811 } 812 813 TComList<TComSubDpb*>* TComPicLists::getSubDpbs() 814 { 815 return (&m_subDpbs); 816 } 817 818 TComAu* TComPicLists::addAu( Int poc ) 819 { 820 TComList<TComAu*>::iterator itA = m_aus.begin(); 821 822 assert( getAu(poc, false) == NULL ); 823 Bool inserted = false; 824 while( !inserted) 825 { 826 if ( ( itA == m_aus.end()) || poc < (*itA)->getPoc() ) 827 { 828 m_aus.insert(itA, new TComAu ); 829 inserted = true; 830 --itA; 831 } 832 else 833 { 834 ++itA; 835 } 836 } 837 return (*itA); 838 } 839 840 TComAu* TComPicLists::getAu( Int poc, Bool create ) 841 { 842 TComAu* au = NULL; 843 844 for( TComList<TComAu*>::iterator itA = m_aus.begin(); ( itA != m_aus.end() && au == NULL ); itA++) 845 { 846 if ( (*itA)->getPoc() == poc ) 847 { 848 au = (*itA); 849 } 850 } 851 852 if ( au == NULL && create ) 853 { 854 au = addAu( poc ); 855 } 856 return au; 857 } 858 859 TComList<TComAu*>* TComPicLists::getAus() 860 { 861 return (&m_aus); 862 } 863 864 TComList<TComAu*> TComPicLists::getAusHavingPicsMarkedForOutput() 865 { 866 TComList<TComAu*> ausHavingPicsForOutput; 867 for(TComList<TComAu*>::iterator itA= m_aus.begin(); ( itA!=m_aus.end()); itA++) 868 { 869 Bool hasPicMarkedAsNeedForOutput = false; 870 for( TComAu::iterator itP= (*itA)->begin(); (itP!=(*itA)->end() && !hasPicMarkedAsNeedForOutput); itP++ ) 871 { 872 if( (*itP)->getOutputMark() ) 873 { 874 hasPicMarkedAsNeedForOutput = true; 875 } 876 } 877 if (hasPicMarkedAsNeedForOutput) 878 { 879 ausHavingPicsForOutput.pushBack( (*itA) ); 880 } 881 } 882 return ausHavingPicsForOutput; 883 } 884 885 Void TComPicLists::markSubDpbAsUnusedForReference( Int layerIdInNuh ) 886 { 887 TComSubDpb* subDpb = getSubDpb( layerIdInNuh, false ); 888 markSubDpbAsUnusedForReference( *subDpb ); 889 } 890 891 Void TComPicLists::markSubDpbAsUnusedForReference( TComSubDpb& subDpb ) 892 { 893 for(TComList<TComPic*>::iterator itP=subDpb.begin(); ( itP!=subDpb.end()); itP++) 894 { 895 (*itP)->markAsUnusedForReference(); 896 } 897 } 898 899 Void TComPicLists::markAllSubDpbAsUnusedForReference() 900 { 901 for(TComList<TComSubDpb*>::iterator itS= m_subDpbs.begin(); ( itS!=m_subDpbs.end()); itS++) 902 { 903 markSubDpbAsUnusedForReference( *(*itS) ); 904 } 905 } 906 907 Void TComPicLists::decrementPocsInSubDpb( Int nuhLayerId, Int deltaPocVal ) 908 { 909 TComSubDpb* subDpb = getSubDpb( nuhLayerId, false ); 910 911 for(TComSubDpb::iterator itP = subDpb->begin(); itP!=subDpb->end(); itP++) 912 { 913 TComPic* pic = (*itP); 914 for (Int i = 0; i < pic->getNumAllocatedSlice(); i++) 915 { 916 TComSlice* slice = pic->getSlice(i); 917 slice->setPOC( slice->getPOC() - deltaPocVal ); 918 } 919 } 920 } 921 Void TComPicLists::emptyAllSubDpbs() 922 { 923 emptySubDpbs( &m_subDpbs ); 924 } 925 926 Void TComPicLists::emptySubDpbs( TComList<TComSubDpb*>* subDpbs ) 927 { 928 assert( subDpbs != NULL ); 929 for( TComList<TComSubDpb*>::iterator itS = subDpbs->begin(); itS != subDpbs->end(); itS++ ) 930 { 931 emptySubDpb( (*itS) ); 932 } 933 } 934 935 Void TComPicLists::emptySubDpb( TComSubDpb* subDpb ) 936 { 937 if(subDpb != NULL) 938 { 939 while( !subDpb->empty() ) 940 { 941 TComPic* curPic = *(subDpb->begin()); 942 removePic( curPic ); 943 } 944 } 945 } 946 947 Void TComPicLists::emptySubDpb( Int nuhLayerId ) 948 { 949 emptySubDpb( getSubDpb( nuhLayerId , false) ); 950 } 951 952 Void TComPicLists::emptyNotNeedForOutputAndUnusedForRef() 953 { 954 for(TComList<TComSubDpb*>::iterator itS= m_subDpbs.begin(); ( itS!=m_subDpbs.end()); itS++) 955 { 956 emptySubDpbNotNeedForOutputAndUnusedForRef( *(*itS) ); 957 } 958 } 959 960 Void TComPicLists::emptySubDpbNotNeedForOutputAndUnusedForRef( Int layerId ) 961 { 962 TComSubDpb* subDpb = getSubDpb( layerId, false ); 963 emptySubDpbNotNeedForOutputAndUnusedForRef( *subDpb ); 964 } 965 966 Void TComPicLists::emptySubDpbNotNeedForOutputAndUnusedForRef( TComSubDpb subDpb ) 967 { 968 for(TComSubDpb::iterator itP= subDpb.begin(); ( itP!=subDpb.end()); itP++) 969 { 970 TComPic* pic = (*itP); 971 if ( !pic->getOutputMark() && pic->getMarkedUnUsedForReference() ) 972 { 973 removePic( pic ); 974 } 975 } 976 } 977 978 Void TComPicLists::print() 979 { 980 Bool first = true; 981 for(TComList<TComSubDpb*>::iterator itL = m_subDpbs.begin(); ( itL != m_subDpbs.end() ); itL++) 982 { 983 for(TComList<TComPic*>::iterator itP=(*itL)->begin(); ( itP!=(*itL)->end() ); itP++) 984 { 985 if ( first ) 986 { 987 (*itP)->print( true ); 988 first = false; 989 } 990 (*itP)->print( false ); 991 } 992 } 993 } 994 995 #if NH_3D 996 TComPicYuv* TComPicLists::getPicYuv( Int viewIndex, Bool depthFlag, Int poc, Bool recon ) 997 { 998 Int layerIdInNuh = m_vps->getLayerIdInNuh( viewIndex, depthFlag ); 999 return getPicYuv( layerIdInNuh, poc, recon ); 1000 } 1001 1002 TComPic* TComPicLists::getPic( Int viewIndex, Bool depthFlag, Int poc ) 1003 { 1004 return getPic ( m_vps->getLayerIdInNuh( viewIndex, depthFlag ), poc ); 1005 } 1006 1007 #endif 1008 1009 #endif 1010 1011 506 1012 507 1013 508 1014 //! \} 1015 -
branches/HTM-15.0-dev0/source/Lib/TLibCommon/TComPic.h
r1313 r1317 54 54 /// picture class (symbol + YUV buffers) 55 55 56 57 58 #if NH_MV 59 class TComPic; 60 61 class TComDecodedRps 62 { 63 public: 64 65 TComDecodedRps() 66 { 67 m_refPicSetsCurr[0] = &m_refPicSetStCurrBefore; 68 m_refPicSetsCurr[1] = &m_refPicSetStCurrAfter ; 69 m_refPicSetsCurr[2] = &m_refPicSetLtCurr ; 70 71 m_refPicSetsLt [0] = &m_refPicSetLtCurr ; 72 m_refPicSetsLt [1] = &m_refPicSetLtFoll ; 73 74 m_refPicSetsAll [0] = &m_refPicSetStCurrBefore; 75 m_refPicSetsAll [1] = &m_refPicSetStCurrAfter ; 76 m_refPicSetsAll [2] = &m_refPicSetStFoll ; 77 m_refPicSetsAll [3] = &m_refPicSetLtCurr ; 78 m_refPicSetsAll [4] = &m_refPicSetLtFoll ; 79 }; 80 81 std::vector<Int> m_pocStCurrBefore; 82 std::vector<Int> m_pocStCurrAfter; 83 std::vector<Int> m_pocStFoll; 84 std::vector<Int> m_pocLtCurr; 85 std::vector<Int> m_pocLtFoll; 86 87 Int m_numPocStCurrBefore; 88 Int m_numPocStCurrAfter; 89 Int m_numPocStFoll; 90 Int m_numPocLtCurr; 91 Int m_numPocLtFoll; 92 93 std::vector<TComPic*> m_refPicSetStCurrBefore; 94 std::vector<TComPic*> m_refPicSetStCurrAfter; 95 std::vector<TComPic*> m_refPicSetStFoll; 96 std::vector<TComPic*> m_refPicSetLtCurr; 97 std::vector<TComPic*> m_refPicSetLtFoll; 98 99 std::vector<TComPic*>* m_refPicSetsCurr[3]; 100 std::vector<TComPic*>* m_refPicSetsLt [2]; 101 std::vector<TComPic*>* m_refPicSetsAll [5]; 102 103 // Annex F 104 Int m_numActiveRefLayerPics0; 105 Int m_numActiveRefLayerPics1; 106 107 std::vector<TComPic*> m_refPicSetInterLayer0; 108 std::vector<TComPic*> m_refPicSetInterLayer1; 109 }; 110 #endif 111 56 112 class TComPic 57 113 { … … 72 128 Bool m_bReconstructed; 73 129 Bool m_bNeededForOutput; 74 #if NH_MV 75 Bool m_bPicOutputFlag; // Semantics variable 76 #endif 130 77 131 UInt m_uiCurrSliceIdx; // Index of current slice 78 132 Bool m_bCheckLTMSB; … … 87 141 Int m_layerId; 88 142 Int m_viewId; 143 Bool m_bPicOutputFlag; // Semantics variable 144 Bool m_hasGeneratedRefPics; 145 Bool m_isPocResettingPic; 146 Bool m_isFstPicOfAllLayOfPocResetPer; 147 Int64 m_decodingOrder; 148 Bool m_noRaslOutputFlag; 149 Bool m_noClrasOutputFlag; 150 Int m_picLatencyCount; 151 Bool m_isGenerated; 152 Bool m_isGeneratedCl833; 153 Bool m_activatesNewVps; 154 TComDecodedRps m_decodedRps; 155 #endif 89 156 #if NH_3D 90 157 Int m_viewIndex; … … 92 159 Int** m_aaiCodedScale; 93 160 Int** m_aaiCodedOffset; 94 #endif95 #endif96 161 #if NH_3D_QTLPC 97 162 Bool m_bReduceBitsQTL; 98 163 #endif 99 164 #if NH_3D_NBDV 100 UInt m_uiRapRefIdx;101 RefPicList m_eRapRefList;102 Int m_iNumDdvCandPics;103 Bool m_abTIVRINCurrRL [2][2][MAX_NUM_REF]; //whether an inter-view reference picture with the same view index of the inter-view reference picture of temporal reference picture of current picture exists in current reference picture lists104 Int m_aiTexToDepRef [2][MAX_NUM_REF];105 #endif 106 165 UInt m_uiRapRefIdx; 166 RefPicList m_eRapRefList; 167 Int m_iNumDdvCandPics; 168 Bool m_abTIVRINCurrRL [2][2][MAX_NUM_REF]; //whether an inter-view reference picture with the same view index of the inter-view reference picture of temporal reference picture of current picture exists in current reference picture lists 169 Int m_aiTexToDepRef [2][MAX_NUM_REF]; 170 #endif 171 #endif 107 172 public: 108 173 TComPic(); … … 115 180 UInt getTLayer() const { return m_uiTLayer; } 116 181 Void setTLayer( UInt uiTLayer ) { m_uiTLayer = uiTLayer; } 117 #if NH_MV118 Void setLayerId ( Int layerId ) { m_layerId = layerId; }119 Int getLayerId () { return m_layerId; }120 Void setViewId ( Int viewId ) { m_viewId = viewId; }121 Int getViewId () { return m_viewId; }122 #if NH_3D123 Void setViewIndex ( Int viewIndex ) { m_viewIndex = viewIndex; }124 Int getViewIndex () { return m_viewIndex; }125 126 Void setIsDepth ( Bool isDepth ) { m_isDepth = isDepth; }127 Bool getIsDepth () { return m_isDepth; }128 129 Void setScaleOffset( Int** pS, Int** pO ) { m_aaiCodedScale = pS; m_aaiCodedOffset = pO; }130 Int** getCodedScale () { return m_aaiCodedScale; }131 Int** getCodedOffset() { return m_aaiCodedOffset; }132 #endif133 #endif134 #if NH_3D_QTLPC135 Bool getReduceBitsFlag () { return m_bReduceBitsQTL; }136 Void setReduceBitsFlag ( Bool bFlag ) { m_bReduceBitsQTL = bFlag; }137 #endif138 182 139 183 Bool getUsedByCurr() const { return m_bUsedByCurr; } … … 177 221 Void setOutputMark (Bool b) { m_bNeededForOutput = b; } 178 222 Bool getOutputMark () const { return m_bNeededForOutput; } 179 #if NH_MV 180 Void setPicOutputFlag(Bool b) { m_bPicOutputFlag = b; } 181 Bool getPicOutputFlag() { return m_bPicOutputFlag ; } 182 #endif 183 #if NH_3D 184 #if NH_3D_ARP 185 Void getCUAddrAndPartIdx( Int iX, Int iY, Int& riCuAddr, Int& riAbsZorderIdx ); 186 #endif 187 Void compressMotion(Int scale); 188 #else 223 224 #if !NH_3D 189 225 Void compressMotion(); 190 226 #endif … … 210 246 211 247 #if NH_MV 212 Void print( Bool legend ); 248 Void setLayerId ( Int layerId ) { m_layerId = layerId; } 249 Int getLayerId () { return m_layerId; } 250 251 Void setViewId ( Int viewId ) { m_viewId = viewId; } 252 Int getViewId () { return m_viewId; } 253 254 Void setPicOutputFlag(Bool b) { m_bPicOutputFlag = b; } 255 Bool getPicOutputFlag() { return m_bPicOutputFlag ; } 256 257 Bool getPocResetPeriodId(); 258 259 Void markAsUsedForShortTermReference(); 260 Void markAsUsedForLongTermReference(); 261 Void markAsUnusedForReference(); 262 263 Bool getMarkedUnUsedForReference(); 264 Bool getMarkedAsShortTerm(); 265 266 Void setHasGeneratedRefPics(Bool val) { m_hasGeneratedRefPics = val; } 267 Bool getHasGeneratedRefPics( ) { return m_hasGeneratedRefPics; } 268 269 Void setIsPocResettingPic(Bool val) { m_isPocResettingPic = val; } 270 Bool getIsPocResettingPic( ) { return m_isPocResettingPic; } 271 272 Void setIsFstPicOfAllLayOfPocResetPer(Bool val) { m_isFstPicOfAllLayOfPocResetPer = val; } 273 Bool getIsFstPicOfAllLayOfPocResetPer( ) { return m_isFstPicOfAllLayOfPocResetPer; } 274 275 Int64 getDecodingOrder( ) { return m_decodingOrder; } 276 Void setDecodingOrder( UInt64 val ) { m_decodingOrder = val; } 277 278 Bool getNoRaslOutputFlag() { return m_noRaslOutputFlag; } 279 Void setNoRaslOutputFlag( Bool b ) { m_noRaslOutputFlag = b; } 280 281 Bool getNoClrasOutputFlag() { return m_noClrasOutputFlag; } 282 Void setNoClrasOutputFlag( Bool b ) { m_noClrasOutputFlag = b; } 283 284 Int getPicLatencyCount() { return m_picLatencyCount; } 285 Void setPicLatencyCount( Int val ) { m_picLatencyCount = val; } 286 287 Bool getIsGenerated() const { return m_isGenerated; } 288 Void setIsGenerated( Bool b ) { m_isGenerated = b; } 289 290 Bool getIsGeneratedCl833() const { return m_isGeneratedCl833; } 291 Void setIsGeneratedCl833( Bool b ) { m_isGeneratedCl833 = b; } 292 293 Int getTemporalId( ) { return getSlice(0)->getTemporalId(); } 294 295 Bool getActivatesNewVps() { return m_activatesNewVps; } 296 Void setActivatesNewVps( Bool b ) { m_activatesNewVps = b; } 297 298 TComDecodedRps* getDecodedRps() { return &m_decodedRps; } 299 300 Bool isIrap() { return getSlice(0)->isIRAP(); } 301 Bool isBla () { return getSlice(0)->isBla (); } 302 Bool isIdr () { return getSlice(0)->isIdr (); } 303 Bool isCra () { return getSlice(0)->isCra (); } 304 Bool isSlnr () { return getSlice(0)->isSlnr (); } 305 Bool isRasl () { return getSlice(0)->isRasl (); } 306 Bool isRadl () { return getSlice(0)->isRadl (); } 307 Bool isStsa () { return getSlice(0)->isStsa (); } 308 Bool isTsa () { return getSlice(0)->isTsa (); } 309 310 Void print( Int outputLevel ); 311 312 #if NH_3D 313 Void setViewIndex ( Int viewIndex ) { m_viewIndex = viewIndex; } 314 Int getViewIndex () { return m_viewIndex; } 315 316 Void setIsDepth ( Bool isDepth ) { m_isDepth = isDepth; } 317 Bool getIsDepth () { return m_isDepth; } 318 319 Void setScaleOffset( Int** pS, Int** pO ) { m_aaiCodedScale = pS; m_aaiCodedOffset = pO; } 320 Int** getCodedScale () { return m_aaiCodedScale; } 321 Int** getCodedOffset() { return m_aaiCodedOffset; } 322 323 Void compressMotion(Int scale); 324 Void printMotion( ); 325 #if NH_3D_ARP 326 Void getCUAddrAndPartIdx( Int iX, Int iY, Int& riCuAddr, Int& riAbsZorderIdx ); 327 #endif 328 #if NH_3D_QTLPC 329 Bool getReduceBitsFlag () { return m_bReduceBitsQTL; } 330 Void setReduceBitsFlag ( Bool bFlag ) { m_bReduceBitsQTL = bFlag; } 213 331 #endif 214 332 #if NH_3D_NBDV 215 Int getNumDdvCandPics() {return m_iNumDdvCandPics; } 216 Int getDisCandRefPictures(Int iColPOC); 217 Void setRapRefIdx(UInt uiRapRefIdx) {m_uiRapRefIdx = uiRapRefIdx;} 218 Void setRapRefList(RefPicList eRefPicList) {m_eRapRefList = eRefPicList;} 219 Void setNumDdvCandPics (Int i) {m_iNumDdvCandPics = i; } 220 UInt getRapRefIdx() {return m_uiRapRefIdx; } 221 RefPicList getRapRefList() {return m_eRapRefList; } 222 Void checkTemporalIVRef(); 223 Bool isTempIVRefValid(Int currCandPic, Int iTempRefDir, Int iTempRefIdx); 224 Void checkTextureRef( ); 225 Int isTextRefValid(Int iTextRefDir, Int iTextRefIdx); 333 Int getNumDdvCandPics() { return m_iNumDdvCandPics; } 334 Int getDisCandRefPictures(Int iColPOC); 335 Void setRapRefIdx(UInt uiRapRefIdx) { m_uiRapRefIdx = uiRapRefIdx; } 336 Void setRapRefList(RefPicList eRefPicList) { m_eRapRefList = eRefPicList; } 337 Void setNumDdvCandPics (Int i) { m_iNumDdvCandPics = i; } 338 UInt getRapRefIdx() { return m_uiRapRefIdx; } 339 RefPicList getRapRefList() { return m_eRapRefList; } 340 Void checkTemporalIVRef(); 341 Bool isTempIVRefValid(Int currCandPic, Int iTempRefDir, Int iTempRefIdx); 342 Void checkTextureRef( ); 343 Int isTextRefValid(Int iTextRefDir, Int iTextRefIdx); 344 #endif 345 #endif 226 346 #endif 227 347 … … 241 361 242 362 #if NH_MV 363 364 class TComAu : public TComList<TComPic*> 365 { 366 367 public: 368 369 Int getPoc ( ) { assert(!empty()); return back()->getPOC (); } 370 Void setPicLatencyCount( Int picLatenyCount ); 371 Int getPicLatencyCount( ) { assert(!empty()); return back()->getPicLatencyCount(); } 372 TComPic* getPic ( Int nuhLayerId ); 373 Void addPic ( TComPic* pic, Bool pocUnkown ); 374 Bool containsPic ( TComPic* pic ); 375 }; 376 377 378 class TComSubDpb : public TComList<TComPic*> 379 { 380 private: 381 Int m_nuhLayerId; 382 public: 383 TComSubDpb( Int nuhLayerid ); 384 385 Int getLayerId ( ) { return m_nuhLayerId; } 386 387 TComPic* getPic ( Int poc ); 388 TComPic* getPicFromLsb ( Int pocLsb, Int maxPicOrderCntLsb ); 389 TComPic* getShortTermRefPic ( Int poc ); 390 TComList<TComPic*> getPicsMarkedNeedForOutput ( ); 391 392 Void markAllAsUnusedForReference ( ); 393 394 Void addPic ( TComPic* pic ); 395 Void removePics ( std::vector<TComPic*> picToRemove ); 396 Bool areAllPicsMarkedNotNeedForOutput( ); 397 }; 398 243 399 class TComPicLists 244 400 { 245 401 private: 246 TComList<TComList<TComPic*>*> m_lists; 247 #if NH_3D 248 const TComVPS* m_vps; 402 TComList<TComAu* > m_aus; 403 TComList<TComSubDpb*> m_subDpbs; 404 Bool m_printPicOutput; 405 #if NH_3D 406 const TComVPS* m_vps; 249 407 #endif 250 408 public: 251 Void push_back( TComList<TComPic*>* list ) { m_lists.push_back( list ); } 252 Int size () { return (Int) m_lists.size(); } 253 #if NH_3D_ARP 254 TComList<TComPic*>* getPicList ( Int layerIdInNuh ); 255 #endif 256 TComPic* getPic ( Int layerIdInNuh, Int poc ); 257 TComPicYuv* getPicYuv( Int layerIdInNuh, Int poc, Bool recon ); 258 #if NH_3D 259 Void setVPS ( const TComVPS* vps ) { m_vps = vps; }; 260 TComPic* getPic ( Int viewIndex, Bool depthFlag, Int poc ); 261 TComPicYuv* getPicYuv( Int viewIndex, Bool depthFlag, Int poc, Bool recon ); 409 ~TComPicLists(); 410 411 // Add and remove single pictures 412 Void addNewPic( TComPic* pic ); 413 Void removePic( TComPic* pic ); 414 415 // Get Pics 416 TComPic* getPic ( Int layerIdInNuh, Int poc ); 417 TComPicYuv* getPicYuv ( Int layerIdInNuh, Int poc, Bool recon ); 418 419 // Get and AUs and SubDPBs 420 TComSubDpb* getSubDpb ( Int nuhLayerId, Bool create ); 421 TComList<TComSubDpb*>* getSubDpbs ( ); 422 423 TComAu* addAu ( Int poc ); 424 TComAu* getAu ( Int poc, Bool create ); 425 TComList<TComAu*>* getAus ( ); 426 TComList<TComAu*> getAusHavingPicsMarkedForOutput( ); 427 428 // Mark pictures and set POCs 429 Void markSubDpbAsUnusedForReference ( Int layerIdInNuh ); 430 Void markSubDpbAsUnusedForReference ( TComSubDpb& subDpb ); 431 Void markAllSubDpbAsUnusedForReference( ); 432 Void decrementPocsInSubDpb ( Int nuhLayerId, Int deltaPocVal ); 433 434 // Empty Sub DPBs 435 Void emptyAllSubDpbs ( ); 436 Void emptySubDpbs ( TComList<TComSubDpb*>* subDpbs); 437 Void emptySubDpb ( TComSubDpb* subDpb); 438 Void emptySubDpb ( Int nuhLayerId ); 439 440 Void emptyNotNeedForOutputAndUnusedForRef ( ); 441 Void emptySubDpbNotNeedForOutputAndUnusedForRef( Int layerId ); 442 Void emptySubDpbNotNeedForOutputAndUnusedForRef( TComSubDpb subDpb ); 443 444 // For printing to std::out 445 Void setPrintPicOutput ( Bool printPicOutput ) { m_printPicOutput = printPicOutput; }; 446 Void print(); 447 448 #if NH_3D 449 Void setVPS ( const TComVPS* vps ) { m_vps = vps; }; 450 TComPic* getPic ( Int viewIndex, Bool depthFlag, Int poc ); 451 TComPicYuv* getPicYuv ( Int viewIndex, Bool depthFlag, Int poc, Bool recon ); 262 452 #endif 263 453 264 Void print( ); 265 266 }; // END CLASS DEFINITION TComPicLists 267 268 #endif 454 }; 455 456 // END CLASS DEFINITION TComPicLists 457 458 #endif 459 269 460 270 461 //! \} -
branches/HTM-15.0-dev0/source/Lib/TLibCommon/TComPicYuv.h
r1313 r1317 166 166 // Set border extension flag 167 167 Void setBorderExtension(Bool b) { m_bIsBorderExtended = b; } 168 #if NH_MV 169 Bool getBorderExtension( ) { return m_bIsBorderExtended; } 170 #endif 168 171 #if NH_3D 169 172 // Set Function -
branches/HTM-15.0-dev0/source/Lib/TLibCommon/TComPrediction.cpp
r1313 r1317 584 584 pcCU->getSPAbsPartIdx(uiPartAddr, iSPWidth, iSPHeight, i, iNumSPInOneLine, uiSPAddr[i]); 585 585 } 586 #if H_3D_ARP || NH_3D_ALIGN_SPIVMP_RP // check this!586 #if NH_3D_ARP 587 587 if( pcCU->getARPW( uiPartAddr ) != 0 ) 588 588 { … … 1302 1302 TComMv cMv = pcCU->getCUMvField( eRefPicList )->getMv( uiPartAddr ); 1303 1303 pcCU->clipMv(cMv); 1304 1305 #if ENC_DEC_TRACE && H_MV_ENC_DEC_TRAC 1306 if ( g_traceMotionInfoBeforUniPred ) 1307 { 1308 std::cout << "RefPic POC : " << pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPOC() << std::endl; 1309 std::cout << "RefPic Layer Id: " << pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getLayerId() << std::endl; 1310 std::cout << "RefIdx : " << iRefIdx << std::endl; 1311 std::cout << "RefPIcList : " << eRefPicList << std::endl; 1312 } 1313 #endif 1314 1304 1315 #if NH_MV 1305 1316 pcCU->checkMvVertRest(cMv, eRefPicList, iRefIdx ); … … 1309 1320 { 1310 1321 if( pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPOC()== pcCU->getSlice()->getPOC() ) 1311 {1322 { 1312 1323 xPredInterUniARPviewRef( pcCU , uiPartAddr , iWidth , iHeight , eRefPicList , pcYuvPred , bi ); 1313 }1314 else1315 {1324 } 1325 else 1326 { 1316 1327 xPredInterUniARP( pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, bi ); 1317 1328 } 1318 } 1319 else 1320 { 1321 #endif 1322 for (UInt comp=COMPONENT_Y; comp<pcYuvPred->getNumberValidComponents(); comp++) 1323 { 1324 const ComponentID compID=ComponentID(comp); 1329 } 1330 else 1331 { 1332 #endif 1333 1334 for (UInt comp=COMPONENT_Y; comp<pcYuvPred->getNumberValidComponents(); comp++) 1335 { 1336 const ComponentID compID=ComponentID(comp); 1325 1337 #if NH_3D_IC 1326 Bool bICFlag = pcCU->getICFlag( uiPartAddr ) && ( pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getViewIndex() != pcCU->getSlice()->getViewIndex() ) && ( isLuma(compID) || (iWidth > 8) );1338 Bool bICFlag = pcCU->getICFlag( uiPartAddr ) && ( pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getViewIndex() != pcCU->getSlice()->getViewIndex() ) && ( isLuma(compID) || (iWidth > 8) ); 1327 1339 xPredInterBlk(compID, pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, pcYuvPred, bi, pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID)) 1328 1340 #if NH_3D_ARP … … 1331 1343 , bICFlag ); 1332 1344 #else 1333 xPredInterBlk (compID, pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, pcYuvPred, bi, pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID)) );1334 #endif 1335 }1345 xPredInterBlk (compID, pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, pcYuvPred, bi, pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID)) ); 1346 #endif 1347 } 1336 1348 #if NH_3D_ARP 1337 1349 } … … 1813 1825 ) 1814 1826 { 1827 #if NH_MV 1828 assert( refPic->getBorderExtension() ); 1829 #endif 1815 1830 Int refStride = refPic->getStride(compID); 1816 1831 Int dstStride = dstPic->getStride(compID); -
branches/HTM-15.0-dev0/source/Lib/TLibCommon/TComPrediction.h
r1313 r1317 176 176 Void combineSegmentsWithMask( TComYuv* pInYuv[2], TComYuv* pOutYuv, Bool* pMask, UInt uiWidth, UInt uiHeight, UInt uiPartAddr, UInt partSize, Int bitDepthY ); 177 177 #endif 178 178 #if NH_3D 179 179 Pel predIntraGetPredValDC ( const Pel* pSrc, Int iSrcStride, UInt iWidth, UInt iHeight, Bool bAbove, Bool bLeft ); 180 180 #endif 181 181 Pel* getPredictorPtr ( const ComponentID compID, const Bool bUseFilteredPredictions ) 182 182 { -
branches/HTM-15.0-dev0/source/Lib/TLibCommon/TComRdCost.cpp
r1313 r1317 133 133 } 134 134 135 #if NH_MV 135 136 D_PRINT_INDENT( g_traceRDCost, "Dist: " + n2s(uiDistortion) + " Bits: " + n2s(uiBits) + " RD Cost: " + n2s(dRdCost)); 137 #endif 136 138 return dRdCost; 137 139 } … … 603 605 cDtParam.bitDepth = bitDepth; 604 606 605 #if NH_3D_IC_FIX606 607 cDtParam.bUseIC = false; 607 #endif608 608 #if NH_3D_SDC_INTER 609 609 cDtParam.bUseSDCMRSAD = false; … … 3685 3685 } 3686 3686 3687 #if NH_MV 3687 3688 D_PRINT_INDENT( g_traceRDCost, "VSO Dist: " + n2s(uiDistortion) + " Bits: " + n2s(uiBits) + " RD Cost: " + n2s(dRdCost)); 3689 #endif 3688 3690 3689 3691 return dRdCost; -
branches/HTM-15.0-dev0/source/Lib/TLibCommon/TComRom.cpp
r1313 r1317 222 222 #if NH_MV 223 223 #if H_MV_HLS_PTL_LIMITS 224 g_generalTierAndLevelLimits[ Level::LEVEL1 ] = TComGeneralTierAndLevelLimits( 36864, 350, INT_MIN, 16, 1, 1 );225 g_generalTierAndLevelLimits[ Level::LEVEL2 ] = TComGeneralTierAndLevelLimits( 122880, 1500, INT_MIN, 16, 1, 1 );226 g_generalTierAndLevelLimits[ Level::LEVEL2_1 ] = TComGeneralTierAndLevelLimits( 245760, 3000, INT_MIN, 20, 1, 1 );227 g_generalTierAndLevelLimits[ Level::LEVEL3 ] = TComGeneralTierAndLevelLimits( 552960, 6000, INT_MIN, 30, 2, 2 );228 g_generalTierAndLevelLimits[ Level::LEVEL3_1 ] = TComGeneralTierAndLevelLimits( 983040, 10000, INT_MIN, 40, 3, 3 );224 g_generalTierAndLevelLimits[ Level::LEVEL1 ] = TComGeneralTierAndLevelLimits( 36864, 350, MIN_INT, 16, 1, 1 ); 225 g_generalTierAndLevelLimits[ Level::LEVEL2 ] = TComGeneralTierAndLevelLimits( 122880, 1500, MIN_INT, 16, 1, 1 ); 226 g_generalTierAndLevelLimits[ Level::LEVEL2_1 ] = TComGeneralTierAndLevelLimits( 245760, 3000, MIN_INT, 20, 1, 1 ); 227 g_generalTierAndLevelLimits[ Level::LEVEL3 ] = TComGeneralTierAndLevelLimits( 552960, 6000, MIN_INT, 30, 2, 2 ); 228 g_generalTierAndLevelLimits[ Level::LEVEL3_1 ] = TComGeneralTierAndLevelLimits( 983040, 10000, MIN_INT, 40, 3, 3 ); 229 229 g_generalTierAndLevelLimits[ Level::LEVEL4 ] = TComGeneralTierAndLevelLimits( 2228224, 12000, 30000, 75, 5, 5 ); 230 230 g_generalTierAndLevelLimits[ Level::LEVEL4_1 ] = TComGeneralTierAndLevelLimits( 2228224, 20000, 50000, 75, 5, 5 ); … … 546 546 Bool g_disableNumbering = false; 547 547 Bool g_disableHLSTrace = false; 548 UInt64 g_stopAtCounter 549 Bool g_traceCopyBack 550 Bool g_decTraceDispDer 551 Bool g_decTraceMvFromMerge 552 Bool g_decTracePicOutput 548 UInt64 g_stopAtCounter = 4660; 549 Bool g_traceCopyBack = false; 550 Bool g_decTraceDispDer = false; 551 Bool g_decTraceMvFromMerge = false; 552 Bool g_decTracePicOutput = false; 553 553 Bool g_startStopTrace = false; 554 Bool g_outputPos = false;555 Bool g_traceCameraParameters 556 Bool g_encNumberOfWrittenBits = false;554 Bool g_outputPos = false; 555 Bool g_traceCameraParameters = false; 556 Bool g_encNumberOfWrittenBits = false; 557 557 Bool g_traceEncFracBits = false; 558 558 Bool g_traceIntraSearchCost = false; … … 561 561 Bool g_traceModeCheck = false; 562 562 UInt g_indent = false; 563 Bool g_decNumBitsRead = false; 564 Bool g_traceMotionInfoBeforUniPred = false; 565 Bool g_traceMergeCandListConst = false; 566 Bool g_traceSubPBMotion = false; 563 567 #endif 564 568 #endif … … 693 697 Bool startTrace = false; 694 698 if ( g_startStopTrace && poc == 0 && layerId == 0 ) 695 { 699 { 696 700 startTrace = ( cuPelX == 0 ) && ( cuPelY == 0 ) && ( cuWidth == 64 ) && ( cuHeight == 64 ); 697 }701 } 698 702 if ( startTrace ) 699 703 { … … 705 709 g_traceModeCheck = true; 706 710 g_traceCopyBack = false; 707 }711 } 708 712 Bool stopTrace = false; 709 713 if ( g_startStopTrace && poc == 0 && layerId == 0 ) … … 752 756 fflush ( g_hTrace ); 753 757 } 754 }755 Void printStr( std::string str )756 {757 std::cout << str << std::endl;758 }759 Void printStrIndent( Bool b, std::string strStr )760 {761 if ( b )762 {763 std::cout << std::string(g_indent, ' ');764 printStr( strStr );765 }766 }767 Void prinStrIncIndent( Bool b, std::string strStr )768 {769 if ( b )770 {771 printStrIndent( true, strStr );772 if (g_indent < 50)773 {774 g_indent++;775 }776 }777 }778 Void decIndent( Bool b )779 {780 if (b && g_indent > 0)781 {782 g_indent--;783 }784 758 } 785 759 #endif -
branches/HTM-15.0-dev0/source/Lib/TLibCommon/TComRom.h
r1313 r1317 91 91 extern const UChar g_aucIntraModeNumFast_NotUseMPM[MAX_CU_DEPTH]; 92 92 extern const UChar g_chroma422IntraAngleMappingTable[NUM_INTRA_MODE]; 93 #if NH_3D_DMM 93 94 // ==================================================================================================================== 94 95 // Depth coding modes 95 96 // ==================================================================================================================== 96 #if NH_3D_DMM 97 97 98 extern const WedgeResolution g_dmmWedgeResolution [6]; 98 99 extern const UChar g_dmm1TabIdxBits [6]; … … 193 194 extern Bool g_traceSAOCost; 194 195 extern UInt g_indent; 196 extern Bool g_traceMotionInfoBeforUniPred; 197 extern Bool g_traceMergeCandListConst; 198 extern Bool g_traceSubPBMotion; 195 199 #define DTRACE_CU(x,y) writeToTraceFile( x,y, g_traceCU ); 196 200 #define DTRACE_PU(x,y) writeToTraceFile( x,y, g_tracePU ); … … 232 236 #define DTRACE_CABAC_R( x,y ) 233 237 #define DTRACE_CABAC_N 238 #if NH_MV 234 239 #define DTRACE_CU(x,y) ; 235 240 #define DTRACE_PU(x,y) ; … … 242 247 #define D_PRINT_INC_INDENT( b, str ); 243 248 #define D_PRINT_INDENT( b, str ); 244 249 #endif 245 250 #endif 246 251 const Char* nalUnitTypeToString(NalUnitType type); -
branches/HTM-15.0-dev0/source/Lib/TLibCommon/TComSlice.cpp
r1313 r1317 6 6 * Copyright (c) 2010-2015, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 9 * 9 10 * Redistribution and use in source and binary forms, with or without … … 112 113 , m_encCABACTableIdx (I_SLICE) 113 114 #if NH_MV 114 , m_availableForTMVPRefFlag ( true )115 115 , m_refPicSetInterLayer0 ( NULL ) 116 116 , m_refPicSetInterLayer1 ( NULL ) … … 121 121 , m_isDepth (false) 122 122 #endif 123 #if !H_MV_HLS7_GEN123 #if NH_MV 124 124 , m_pocResetFlag (false) 125 #endif126 #if NH_MV127 125 , m_crossLayerBlaFlag (false) 128 126 #endif … … 134 132 , m_pocResetIdc (0) 135 133 , m_pocResetPeriodId (0) 134 , m_hasPocResetPeriodIdPresent (false) 136 135 , m_fullPocResetFlag (false) 137 136 , m_pocLsbVal (0) 138 , m_pocMsb ValPresentFlag(false)139 , m_pocMsb Val(0)137 , m_pocMsbCycleValPresentFlag (false) 138 , m_pocMsbCycleVal (0) 140 139 , m_pocMsbValRequiredFlag (false) 141 140 #endif … … 155 154 #endif 156 155 { 156 157 #if NH_MV 158 m_shortTermRefPicSetIdx = 0; 159 m_numLongTermSps = 0; 160 m_numLongTermPics = 0; 161 for (Int i = 0; i < MAX_NUM_PICS_RPS; i++) 162 { 163 m_ltIdxSps [i] = 0; 164 m_deltaPocMsbCycleLt[i] = 0; 165 } 166 setSliceTemporalMvpEnabledFlag( false ); 167 #endif 157 168 for(UInt i=0; i<NUM_REF_PIC_LIST_01; i++) 158 169 { … … 790 801 #endif 791 802 803 792 804 Int TComSlice::getNumRpsCurrTempList() const 793 805 { … … 806 818 } 807 819 #if NH_MV 808 numRpsCurrTempList = numRpsCurrTempList + getNumActiveRefLayerPics();820 numRpsCurrTempList = numRpsCurrTempList + getNumActiveRefLayerPics(); 809 821 #endif 810 822 return numRpsCurrTempList; … … 1097 1109 m_pcVPS = pSrc->m_pcVPS; 1098 1110 #endif 1099 m_pRPS = pSrc->m_pRPS; m_iLastIDR = pSrc->m_iLastIDR; 1111 m_pRPS = pSrc->m_pRPS; 1112 m_iLastIDR = pSrc->m_iLastIDR; 1100 1113 1101 1114 m_pcPic = pSrc->m_pcPic; … … 1155 1168 #if NH_MV 1156 1169 // Additional slice header syntax elements 1157 #if !H_MV_HLS7_GEN1158 1170 m_pocResetFlag = pSrc->m_pocResetFlag; 1159 #endif1160 1171 m_discardableFlag = pSrc->m_discardableFlag; 1161 1172 m_interLayerPredEnabledFlag = pSrc->m_interLayerPredEnabledFlag; … … 2670 2681 } 2671 2682 } 2672 #endif 2673 2683 2684 #endif 2674 2685 #endif // NH_MV 2675 2686 … … 2719 2730 , m_uiBitsForPOC ( 8) 2720 2731 , m_numLongTermRefPicSPS ( 0) 2732 #if NH_MV 2733 , m_numShortTermRefPicSets ( 0) 2734 #endif 2721 2735 , m_uiMaxTrSize ( 32) 2722 2736 , m_bUseSAO (false) … … 2750 2764 for ( Int i = 0; i < MAX_TLAYER; i++ ) 2751 2765 { 2766 #if NH_MV 2767 m_uiSpsMaxLatencyIncreasePlus1[i] = 0; 2768 #else 2752 2769 m_uiMaxLatencyIncrease[i] = 0; 2770 #endif 2753 2771 m_uiMaxDecPicBuffering[i] = 1; 2754 2772 m_numReorderPics[i] = 0; … … 3081 3099 Void TComSPS::inferSpsMaxDecPicBufferingMinus1( TComVPS* vps, Int targetOptLayerSetIdx, Int currLayerId, Bool encoder ) 3082 3100 { 3083 const std::vector<Int>& targetDecLayerIdList = vps->getTargetDecLayerIdList( vps->olsIdxToLsIdx( targetOptLayerSetIdx ));3084 3085 3101 if ( getMultiLayerExtSpsFlag() ) 3086 3102 { 3103 const std::vector<Int>& targetDecLayerIdList = vps->getTargetDecLayerIdList( vps->olsIdxToLsIdx( targetOptLayerSetIdx )); 3087 3104 Int layerIdx = 0; 3088 3105 while (layerIdx < (Int) targetDecLayerIdList.size() ) … … 3109 3126 // This preliminary fix needs to be checked. 3110 3127 assert( getNumReorderPics( i ) == maxNumReorderPics ); 3111 assert( get MaxLatencyIncrease( i ) == maxLatencyIncreasePlus1 );3128 assert( getSpsMaxLatencyIncreasePlus1( i ) == maxLatencyIncreasePlus1 ); 3112 3129 3113 3130 } … … 3117 3134 setMaxDecPicBuffering( maxDecPicBufferingMinus1 + 1 , i); 3118 3135 setNumReorderPics ( maxNumReorderPics, i ); 3119 set MaxLatencyIncrease( maxLatencyIncreasePlus1 -1 , i);3136 setSpsMaxLatencyIncreasePlus1( maxLatencyIncreasePlus1 , i); 3120 3137 } 3121 3138 } … … 3412 3429 } 3413 3430 } 3414 3415 3431 Void TComSlice::markIvRefPicsAsShortTerm( std::vector<TComPic*> refPicSetInterLayer0, std::vector<TComPic*> refPicSetInterLayer1 ) 3416 3432 { … … 3435 3451 for (Int rIdx = 0; rIdx <= (m_aiNumRefIdx[li]-1); rIdx ++) 3436 3452 { 3437 if (rIdx == 0 && li == 0) m_apcRefPicList[li][rIdx]->print( true ); 3453 if (rIdx == 0 && li == 0) m_apcRefPicList[li][rIdx]->print( 1 ); 3454 m_apcRefPicList[li][rIdx]->print( 0 ); 3438 3455 3439 m_apcRefPicList[li][rIdx]->print( false );3440 3456 } 3441 3457 } … … 3456 3472 m_refPicSetInterLayer1 = refPicSetInterLayer1; 3457 3473 } 3474 3475 TComPic* TComSlice::getRefPicSetInterLayer( Int setIdc, Int i ) const 3476 { 3477 TComPic* pic = NULL; 3478 if (setIdc == 0 ) 3479 { 3480 pic = (*m_refPicSetInterLayer0)[ i ]; 3481 } 3482 else if (setIdc == 1 ) 3483 { 3484 pic = (*m_refPicSetInterLayer1)[ i ]; 3485 } 3486 3487 assert( pic != NULL ); 3488 3489 return pic; 3490 } 3491 3458 3492 3459 3493 TComPic* TComSlice::getPicFromRefPicSetInterLayer(Int setIdc, Int layerId ) const … … 3572 3606 #endif 3573 3607 } 3608 #endif 3574 3609 #if NH_3D_NBDV 3575 3610 Void TComSlice::setDefaultRefView() … … 3687 3722 if( iViewIdx<getViewIndex() && !bIsDepth ) 3688 3723 { 3689 setBaseViewRefPicList( ivPicLists->get PicList( iLayerId), iViewIdx );3724 setBaseViewRefPicList( ivPicLists->getSubDpb( iLayerId, false ), iViewIdx ); 3690 3725 } 3691 3726 } … … 3710 3745 if ( pcCurrPic->getViewIndex() != pcRefPic->getViewIndex() ) 3711 3746 { 3712 existInterViewRef = true; 3747 existInterViewRef = true; 3713 3748 } 3714 3749 } … … 3833 3868 #if NH_3D 3834 3869 Void TComSlice::setIvPicLists( TComPicLists* m_ivPicLists ) 3835 { 3870 { 3836 3871 for (Int i = 0; i < MAX_NUM_LAYERS; i++ ) 3837 { 3872 { 3838 3873 for ( Int depthId = 0; depthId < 2; depthId++ ) 3839 3874 { … … 3920 3955 } 3921 3956 #endif 3922 #endif 3957 3923 3958 3924 3959 … … 3933 3968 } 3934 3969 3935 Bool TComSlice::inferPocMsb ValPresentFlag()3970 Bool TComSlice::inferPocMsbCycleValPresentFlag() 3936 3971 { 3937 3972 Bool pocMsbValPresentFlag; … … 3952 3987 } 3953 3988 3989 3990 Void TComSlice::f834decProcForRefPicListConst() 3991 { 3992 // This process is invoked at the beginning of the decoding process for each P or B slice. 3993 assert( getSliceType() == B_SLICE || getSliceType() == P_SLICE ); 3994 3995 // Reference pictures are addressed through reference indices as specified in clause 8.5.3.3.2. A reference index is an index into 3996 // a reference picture list. When decoding a P slice, there is a single reference picture list RefPicList0. When decoding a B 3997 // slice, there is a second independent reference picture list RefPicList1 in addition to RefPicList0. 3998 3999 // At the beginning of the decoding process for each slice, the reference picture lists RefPicList0 and, for B slices, RefPicList1 4000 // are derived as follows: 4001 4002 // The variable NumRpsCurrTempList0 is set equal to Max( num_ref_idx_l0_active_minus1 + 1, NumPicTotalCurr ) 4003 Int numRpsCurrTempList0 = std::max( getNumRefIdxL0ActiveMinus1() + 1, getNumPicTotalCurr() ); 4004 4005 // and the list RefPicListTemp0 is constructed as follows: 4006 std::vector<TComPic*> refPicListTemp0; 4007 refPicListTemp0.resize((MAX_NUM_REF+1),NULL); 4008 4009 const TComDecodedRps* decRps = getPic()->getDecodedRps(); 4010 4011 const std::vector<TComPic*>& refPicSetStCurrBefore = decRps->m_refPicSetStCurrBefore; 4012 const std::vector<TComPic*>& refPicSetStCurrAfter = decRps->m_refPicSetStCurrAfter; 4013 const std::vector<TComPic*>& refPicSetLtCurr = decRps->m_refPicSetLtCurr; 4014 4015 const Int numPocStCurrBefore = decRps->m_numPocStCurrBefore; 4016 const Int numPocStCurrAfter = decRps->m_numPocStCurrAfter; 4017 const Int numPocLtCurr = decRps->m_numPocLtCurr; 4018 4019 const Int numActiveRefLayerPics0 = decRps->m_numActiveRefLayerPics0; 4020 const Int numActiveRefLayerPics1 = decRps->m_numActiveRefLayerPics1; 4021 4022 const std::vector<TComPic*>& refPicSetInterLayer0 = decRps->m_refPicSetInterLayer0; 4023 const std::vector<TComPic*>& refPicSetInterLayer1 = decRps->m_refPicSetInterLayer1; 4024 4025 Int rIdx = 0; 4026 while( rIdx < numRpsCurrTempList0 ) 4027 { 4028 for(Int i = 0; i < numPocStCurrBefore && rIdx < numRpsCurrTempList0; rIdx++, i++ ) 4029 { 4030 refPicListTemp0[ rIdx ] = refPicSetStCurrBefore[ i ]; 4031 } 4032 4033 for(Int i = 0; i < numActiveRefLayerPics0; rIdx++, i++ ) 4034 { 4035 refPicListTemp0[ rIdx ] = refPicSetInterLayer0[ i ]; 4036 } 4037 4038 for(Int i = 0; i < numPocStCurrAfter && rIdx < numRpsCurrTempList0; rIdx++, i++ ) // (F 65) 4039 { 4040 refPicListTemp0[ rIdx ] = refPicSetStCurrAfter[ i ]; 4041 } 4042 4043 for(Int i = 0; i < numPocLtCurr && rIdx < numRpsCurrTempList0; rIdx++, i++ ) 4044 { 4045 refPicListTemp0[ rIdx ] = refPicSetLtCurr[ i ]; 4046 } 4047 4048 for(Int i = 0; i < numActiveRefLayerPics1; rIdx++, i++ ) 4049 { 4050 refPicListTemp0[ rIdx ] = refPicSetInterLayer1[ i ]; 4051 } 4052 } 4053 4054 // The list RefPicList0 is constructed as follows: 4055 TComRefPicListModification* rplm = getRefPicListModification(); 4056 for( rIdx = 0; rIdx <= getNumRefIdxL0ActiveMinus1(); rIdx++ ) // (F 66) 4057 { 4058 m_apcRefPicList[ 0 ][ rIdx ] = rplm->getRefPicListModificationFlagL0( ) ? refPicListTemp0[ rplm->getListEntryL0( rIdx )] : refPicListTemp0[ rIdx ]; 4059 // The decoding process below slice level requires the status 4060 // of the reference pictures, when decoding the RPS. So store it here. 4061 m_bIsUsedAsLongTerm[ 0 ][ rIdx ] = m_apcRefPicList[ 0 ][ rIdx ]->getIsLongTerm(); 4062 m_aiRefPOCList [ 0 ][ rIdx ] = m_apcRefPicList[ 0 ][ rIdx ]->getPOC(); 4063 m_aiRefLayerIdList [ 0 ][ rIdx ] = m_apcRefPicList[ 0 ][ rIdx ]->getLayerId(); 4064 } 4065 4066 std::vector<TComPic*> refPicListTemp1; 4067 refPicListTemp1.resize((MAX_NUM_REF+1),NULL); 4068 4069 if (getSliceType() == B_SLICE ) 4070 { 4071 // When the slice is a B slice, the variable NumRpsCurrTempList1 is set equal to 4072 // Max( num_ref_idx_l1_active_minus1 + 1, NumPicTotalCurr ) and the list RefPicListTemp1 is constructed as follows: 4073 Int numRpsCurrTempList1 = std::max( getNumRefIdxL1ActiveMinus1() + 1, getNumPicTotalCurr() ); 4074 4075 rIdx = 0; 4076 while( rIdx < numRpsCurrTempList1 ) 4077 { 4078 for( Int i = 0; i < numPocStCurrAfter && rIdx < numRpsCurrTempList1; rIdx++, i++ ) 4079 { 4080 refPicListTemp1[ rIdx ] = refPicSetStCurrAfter[ i ]; 4081 } 4082 for( Int i = 0; i< numActiveRefLayerPics1; rIdx++, i++ ) 4083 { 4084 refPicListTemp1[ rIdx ] = refPicSetInterLayer1[ i ]; 4085 } 4086 for( Int i = 0; i < numPocStCurrBefore && rIdx < numRpsCurrTempList1; rIdx++, i++ ) // (F 67) 4087 { 4088 refPicListTemp1[ rIdx ] = refPicSetStCurrBefore[ i ]; 4089 } 4090 for( Int i = 0; i < numPocLtCurr && rIdx < numRpsCurrTempList1; rIdx++, i++ ) 4091 { 4092 refPicListTemp1[ rIdx ] = refPicSetLtCurr[ i ]; 4093 } 4094 for( Int i = 0; i< numActiveRefLayerPics0; rIdx++, i++ ) 4095 { 4096 refPicListTemp1[ rIdx ] = refPicSetInterLayer0[ i ]; 4097 } 4098 } 4099 } 4100 4101 if (getSliceType() == B_SLICE ) 4102 { 4103 // When the slice is a B slice, the list RefPicList1 is constructed as follows: 4104 for( rIdx = 0; rIdx <= getNumRefIdxL1ActiveMinus1(); rIdx++ ) // (F 68) 4105 { 4106 m_apcRefPicList[ 1 ][ rIdx ] = rplm->getRefPicListModificationFlagL1() ? refPicListTemp1[ rplm->getListEntryL1( rIdx ) ] : refPicListTemp1[ rIdx ]; 4107 4108 // The decoding process below slice level requires the marking status 4109 // of the reference pictures, when decoding the RPS. So store it here. 4110 m_bIsUsedAsLongTerm[ 1 ][ rIdx ] = m_apcRefPicList[ 1 ][ rIdx ]->getIsLongTerm(); 4111 m_aiRefPOCList [ 1 ][ rIdx ] = m_apcRefPicList[ 1 ][ rIdx ]->getPOC(); 4112 m_aiRefLayerIdList [ 1 ][ rIdx ] = m_apcRefPicList[ 1 ][ rIdx ]->getLayerId(); 4113 } 4114 } 4115 } 4116 4117 4118 Void TComSlice::cl834DecProcForRefPicListConst() 4119 { 4120 // This process is invoked at the beginning of the decoding process for each P or B slice. 4121 assert( getSliceType() == B_SLICE || getSliceType() == P_SLICE ); 4122 4123 // Reference pictures are addressed through reference indices as specified in clause 8.5.3.3.2. A reference index is an index into 4124 // a reference picture list. When decoding a P slice, there is a single reference picture list RefPicList0. When decoding a B 4125 // slice, there is a second independent reference picture list RefPicList1 in addition to RefPicList0. 4126 4127 // At the beginning of the decoding process for each slice, the reference picture lists RefPicList0 and, for B slices, RefPicList1 4128 // are derived as follows: 4129 4130 // The variable NumRpsCurrTempList0 is set equal to Max( num_ref_idx_l0_active_minus1 + 1, NumPicTotalCurr ) 4131 Int numRpsCurrTempList0 = std::max( getNumRefIdxL0ActiveMinus1() + 1, getNumPicTotalCurr() ); 4132 4133 // and the list RefPicListTemp0 is constructed as follows: 4134 std::vector<TComPic*> refPicListTemp0; 4135 refPicListTemp0.resize((MAX_NUM_REF+1),NULL); 4136 4137 const TComDecodedRps* decRps = getPic()->getDecodedRps(); 4138 4139 const std::vector<TComPic*>& refPicSetStCurrBefore = decRps->m_refPicSetStCurrBefore; 4140 const std::vector<TComPic*>& refPicSetStCurrAfter = decRps->m_refPicSetStCurrAfter; 4141 const std::vector<TComPic*>& refPicSetLtCurr = decRps->m_refPicSetLtCurr; 4142 4143 const Int numPocStCurrBefore = decRps->m_numPocStCurrBefore; 4144 const Int numPocStCurrAfter = decRps->m_numPocStCurrAfter; 4145 const Int numPocLtCurr = decRps->m_numPocLtCurr; 4146 4147 Int rIdx = 0; 4148 while( rIdx < numRpsCurrTempList0 ) 4149 { 4150 for(Int i = 0; i < numPocStCurrBefore && rIdx < numRpsCurrTempList0; rIdx++, i++ ) 4151 { 4152 refPicListTemp0[ rIdx ] = refPicSetStCurrBefore[ i ]; 4153 } 4154 4155 for(Int i = 0; i < numPocStCurrAfter && rIdx < numRpsCurrTempList0; rIdx++, i++ ) // (8 8) 4156 { 4157 refPicListTemp0[ rIdx ] = refPicSetStCurrAfter[ i ]; 4158 } 4159 4160 for(Int i = 0; i < numPocLtCurr && rIdx < numRpsCurrTempList0; rIdx++, i++ ) 4161 { 4162 refPicListTemp0[ rIdx ] = refPicSetLtCurr[ i ]; 4163 } 4164 } 4165 4166 // The list RefPicList0 is constructed as follows: 4167 4168 TComRefPicListModification* rplm = getRefPicListModification(); 4169 for( rIdx = 0; rIdx <= getNumRefIdxL0ActiveMinus1(); rIdx++ ) // (8-9) 4170 { 4171 m_apcRefPicList[0][ rIdx ] = rplm->getRefPicListModificationFlagL0( ) ? refPicListTemp0[ rplm->getListEntryL0( rIdx )] : refPicListTemp0[ rIdx ]; 4172 4173 // The decoding process below slice level requires the marking status 4174 // of the reference pictures, when decoding the RPS. So store it here. 4175 m_bIsUsedAsLongTerm[ 0 ][ rIdx ] = m_apcRefPicList[ 0 ][ rIdx ]->getIsLongTerm(); 4176 m_aiRefPOCList [ 0 ][ rIdx ] = m_apcRefPicList[ 0 ][ rIdx ]->getPOC(); 4177 m_aiRefLayerIdList [ 0 ][ rIdx ] = m_apcRefPicList[ 0 ][ rIdx ]->getLayerId(); 4178 } 4179 4180 std::vector<TComPic*> refPicListTemp1; 4181 refPicListTemp1.resize((MAX_NUM_REF+1),NULL); 4182 4183 if (getSliceType() == B_SLICE ) 4184 { 4185 // When the slice is a B slice, the variable NumRpsCurrTempList1 is set equal to 4186 // Max( num_ref_idx_l1_active_minus1 + 1, NumPicTotalCurr ) and the list RefPicListTemp1 is constructed as follows: 4187 Int numRpsCurrTempList1 = std::max( getNumRefIdxL1ActiveMinus1() + 1, getNumPicTotalCurr() ); 4188 4189 rIdx = 0; 4190 while( rIdx < numRpsCurrTempList1 ) 4191 { 4192 for( Int i = 0; i < numPocStCurrAfter && rIdx < numRpsCurrTempList1; rIdx++, i++ ) 4193 { 4194 refPicListTemp1[ rIdx ] = refPicSetStCurrAfter[ i ]; 4195 } 4196 for( Int i = 0; i < numPocStCurrBefore && rIdx < numRpsCurrTempList1; rIdx++, i++ ) // (8-10) 4197 { 4198 refPicListTemp1[ rIdx ] = refPicSetStCurrBefore[ i ]; 4199 } 4200 for( Int i = 0; i < numPocLtCurr && rIdx < numRpsCurrTempList1; rIdx++, i++ ) 4201 { 4202 refPicListTemp1[ rIdx ] = refPicSetLtCurr[ i ]; 4203 } 4204 } 4205 } 4206 4207 if (getSliceType() == B_SLICE ) 4208 { 4209 // When the slice is a B slice, the list RefPicList1 is constructed as follows: 4210 for( rIdx = 0; rIdx <= getNumRefIdxL1ActiveMinus1(); rIdx++ ) // (F 68) 4211 { 4212 m_apcRefPicList[ 1 ][ rIdx ] = rplm->getRefPicListModificationFlagL1() ? refPicListTemp1[ rplm->getListEntryL1( rIdx ) ] : refPicListTemp1[ rIdx ]; 4213 4214 // The decoding process below slice level requires the marking status 4215 // of the reference pictures, when decoding the RPS. So store it here. 4216 m_bIsUsedAsLongTerm[ 1 ][ rIdx ] = m_apcRefPicList[ 1 ][ rIdx ]->getIsLongTerm(); 4217 m_aiRefPOCList [ 1 ][ rIdx ] = m_apcRefPicList[ 1 ][ rIdx ]->getPOC(); 4218 m_aiRefLayerIdList [ 1 ][ rIdx ] = m_apcRefPicList[ 1 ][ rIdx ]->getLayerId(); 4219 } 4220 } 4221 } 4222 4223 Int TComSlice::getNumPicTotalCurr() const 4224 { 4225 Int numPicTotalCurr = 0; 4226 #if NH_MV_FIX_NUM_POC_TOTAL_CUR 4227 if ( !isIdr() ) 4228 { 4229 const TComStRefPicSet* stRps = getStRps( getCurrRpsIdx() ); 4230 #endif 4231 for( Int i = 0; i < stRps->getNumNegativePicsVar(); i++ ) 4232 { 4233 if( stRps->getUsedByCurrPicS0Var( i ) ) 4234 { 4235 numPicTotalCurr++; 4236 } 4237 } 4238 for( Int i = 0; i < stRps->getNumPositivePicsVar(); i++) //(7 55) 4239 { 4240 if( stRps->getUsedByCurrPicS1Var(i) ) 4241 { 4242 numPicTotalCurr++; 4243 } 4244 } 4245 for( Int i = 0; i < getNumLongTermSps() + getNumLongTermPics(); i++ ) 4246 { 4247 if( getUsedByCurrPicLtVar( i ) ) 4248 { 4249 numPicTotalCurr++; 4250 } 4251 } 4252 #if NH_MV_FIX_NUM_POC_TOTAL_CUR 4253 } 4254 #endif 4255 4256 if ( decProcAnnexF() ) 4257 { 4258 numPicTotalCurr += getNumActiveRefLayerPics(); 4259 } 4260 return numPicTotalCurr; 4261 } 4262 4263 4264 4265 Int TComSlice::getPocLsbLtVar( Int i ) 4266 { 4267 Int pocLsbLtVar; 4268 if (i < getNumLongTermSps() ) 4269 { 4270 4271 pocLsbLtVar = getSPS()->getLtRefPicPocLsbSps( getLtIdxSps( i ) ); 4272 } 4273 else 4274 { 4275 pocLsbLtVar = getPocLsbLt( i ); 4276 } 4277 return pocLsbLtVar; 4278 } 4279 4280 4281 Bool TComSlice::getUsedByCurrPicLtVar( Int i ) const 4282 { 4283 Bool usedByCurrPicLtVar; 4284 if (i < getNumLongTermSps() ) 4285 { 4286 usedByCurrPicLtVar = getSPS()->getUsedByCurrPicLtSPSFlag( getLtIdxSps( i ) ); 4287 } 4288 else 4289 { 4290 usedByCurrPicLtVar = getUsedByCurrPicLtFlag( i ); 4291 } 4292 return usedByCurrPicLtVar; 4293 } 4294 4295 4296 Int TComSlice::getDeltaPocMsbCycleLtVar( Int i ) const 4297 { 4298 Int deltaPocMsbCycleVar; 4299 if (i == 0 || i == getNumLongTermSps() ) 4300 { 4301 deltaPocMsbCycleVar = getDeltaPocMsbCycleLt( i ); 4302 } 4303 else 4304 { 4305 deltaPocMsbCycleVar = getDeltaPocMsbCycleLt( i ) + getDeltaPocMsbCycleLtVar( i - 1 ); 4306 } 4307 return deltaPocMsbCycleVar; 4308 } 3954 4309 3955 4310 #endif … … 4074 4429 4075 4430 Void TComSlice::checkInCompPredRefLayers() 4076 { 4431 { 4077 4432 if ( getInCompPredFlag() ) 4078 4433 { 4079 4434 for (Int i = 0; i < getNumCurCmpLIds(); i++ ) 4080 { 4435 { 4081 4436 assert( getIvPic(!getIsDepth(), getInCmpRefViewIdcs( i ) ) != NULL ); 4082 4437 // It is a requirement of bitstream conformance that there 4083 4438 // is a picture in the DPB with PicOrderCntVal equal to the PicOrderCntVal of the current picture, 4084 4439 // and a nuh_layer_id value equal to ViewCompLayerId[ inCmpRefViewIdcs[ i ] ][ !DepthFlag ]. 4440 } 4441 } 4442 } 4443 4444 Void TComSlice::setPocsInCurrRPSs() 4445 { 4446 // Currently only needed at decoder side; 4447 m_pocsInCurrRPSs.clear(); 4448 std::vector<TComPic*>** rpsCurr = getPic()->getDecodedRps()->m_refPicSetsCurr; 4449 for (Int i = 0 ; i < 3; i++ ) 4450 { 4451 for( Int j = 0; j < rpsCurr[i]->size(); j++ ) 4452 { 4453 m_pocsInCurrRPSs.push_back( (*rpsCurr[i])[j]->getPOC() ); 4085 4454 } 4086 4455 } … … 4613 4982 4614 4983 ProfileTierLevel* curProfileTierLevel = getGeneralPTL( ); 4984 assert( curProfileTierLevel != NULL ); 4615 4985 4616 4986 if( !profilePresentFlag ) … … 4644 5014 Void TComPTL::inferSubLayerValues(Int maxNumSubLayersMinus1, Int k, TComPTL* refPTL) 4645 5015 { 4646 assert( k == 0 || refPTL != NULL ); 4647 5016 assert( k == 0 || refPTL != NULL ); 4648 5017 for (Int i = maxNumSubLayersMinus1; i >= 0; i--) 4649 5018 { … … 4665 5034 } 4666 5035 5036 assert( refProfileTierLevel != NULL ); 4667 5037 ProfileTierLevel* curProfileTierLevel = getSubLayerPTL( i ); 5038 assert( curProfileTierLevel != NULL ); 4668 5039 if( !getSubLayerLevelPresentFlag( i ) ) 4669 5040 { … … 4883 5254 } 4884 5255 5256 5257 Int TComDpbSize::getVpsMaxLatencyPictures( Int i, Int j ) const 5258 { 5259 return getMaxVpsNumReorderPics( i, j ) + getMaxVpsLatencyIncreasePlus1(i, j) - 1; 5260 } 5261 4885 5262 Void Window::scaleOffsets( Int scal ) 4886 5263 { … … 4894 5271 } 4895 5272 } 4896 #endif 5273 5274 Void TComStRefPicSet::inferRps( Int stRpsIdx, TComSPS* sps, Bool encoder ) 5275 { 5276 if ( getInterRefPicSetPredictionFlag() ) 5277 { 5278 // When inter_ref_pic_set_prediction_flag is equal to 1, the variables DeltaPocS0[ stRpsIdx ][ i ], UsedByCurrPicS0[ stRpsIdx ][ i ], 5279 // NumNegativePics[ stRpsIdx ], DeltaPocS1[ stRpsIdx ][ i ], UsedByCurrPicS1[ stRpsIdx ][ i ] and NumPositivePics[ stRpsIdx ] are 5280 // derived as follows: 5281 5282 Int i = 0; 5283 Int refRpsIdx = getRefRpsIdx( stRpsIdx ); 5284 TComStRefPicSet* refRps = sps->getStRefPicSet( refRpsIdx ); 5285 5286 for( Int j = refRps->getNumPositivePicsVar( ) - 1; j >= 0; j-- ) 5287 { 5288 Int dPoc = refRps->getDeltaPocS1Var( j ) + getDeltaRps(); 5289 if( dPoc < 0 && getUseDeltaFlag( refRps->getNumNegativePicsVar( ) + j ) ) 5290 { 5291 setDeltaPocS0Var ( i, dPoc ); 5292 setUsedByCurrPicS0Var( i++ , getUsedByCurrPicFlag( refRps->getNumNegativePicsVar( ) + j ) ); 5293 } 5294 } 5295 if( getDeltaRps() < 0 && getUseDeltaFlag( refRps->getNumDeltaPocs() ) ) // (7 59) 5296 { 5297 setDeltaPocS0Var( i, getDeltaRps() ); 5298 setUsedByCurrPicS0Var( i++ , getUsedByCurrPicFlag( refRps->getNumDeltaPocs() ) ); 5299 } 5300 for( Int j = 0; j < refRps->getNumNegativePicsVar(); j++ ) 5301 { 5302 Int dPoc = refRps->getDeltaPocS0Var( j ) + getDeltaRps(); 5303 if( dPoc < 0 && getUseDeltaFlag( j ) ) 5304 { 5305 setDeltaPocS0Var( i , dPoc); 5306 setUsedByCurrPicS0Var( i++ , getUsedByCurrPicFlag( j )) ; 5307 } 5308 } 5309 5310 setNumNegativePicsVar( i ); 5311 5312 i = 0; 5313 for( Int j = refRps->getNumNegativePicsVar() - 1; j >= 0; j-- ) 5314 { 5315 Int dPoc = refRps->getDeltaPocS0Var( j ) + getDeltaRps(); 5316 if( dPoc > 0 && getUseDeltaFlag( j ) ) 5317 { 5318 setDeltaPocS1Var( i, dPoc ); 5319 setUsedByCurrPicS1Var( i++, getUsedByCurrPicFlag( j ) ) ; 5320 } 5321 } 5322 5323 if( getDeltaRps() > 0 && getUseDeltaFlag( refRps->getNumDeltaPocs() ) ) // (7 60) 5324 { 5325 setDeltaPocS1Var( i , getDeltaRps() ); 5326 setUsedByCurrPicS1Var( i++ , getUsedByCurrPicFlag( refRps->getNumDeltaPocs() )); 5327 } 5328 5329 for( Int j = 0; j < refRps->getNumPositivePicsVar( ); j++) 5330 { 5331 Int dPoc = refRps->getDeltaPocS1Var( j ) + getDeltaRps(); 5332 if( dPoc > 0 && getUseDeltaFlag( refRps->getNumNegativePicsVar() + j ) ) 5333 { 5334 setDeltaPocS1Var( i, dPoc); 5335 setUsedByCurrPicS1Var( i++, getUsedByCurrPicFlag( refRps->getNumNegativePicsVar() + j )); 5336 } 5337 } 5338 setNumPositivePicsVar( i ); 5339 } 5340 else 5341 { 5342 // When inter_ref_pic_set_prediction_flag is equal to 0, the variables NumNegativePics[ stRpsIdx ], NumPositivePics[ stRpsIdx ], 5343 // UsedByCurrPicS0[ stRpsIdx ][ i ], UsedByCurrPicS1[ stRpsIdx ][ i ], DeltaPocS0[ stRpsIdx ][ i ] and DeltaPocS1[ stRpsIdx ][ i ] 5344 // are derived as follows: 5345 5346 setNumNegativePicsVar( getNumNegativePics( ) ); // (7 61) 5347 setNumPositivePicsVar( getNumPositivePics( ) ); // (7 62) 5348 5349 for (Int i = 0 ; i < getNumNegativePics(); i++ ) 5350 { 5351 setUsedByCurrPicS0Var( i, getUsedByCurrPicS0Flag( i ) ); // (7 63) 5352 if (i == 0 ) 5353 { 5354 setDeltaPocS0Var( i , -( getDeltaPocS0Minus1( i ) + 1 )); // (7 65) 5355 } 5356 else 5357 { 5358 setDeltaPocS0Var( i , getDeltaPocS0Var( i - 1 ) - ( getDeltaPocS0Minus1( i ) + 1 )); // (7 67) 5359 } 5360 } 5361 5362 for (Int i = 0 ; i < getNumPositivePics(); i++ ) 5363 { 5364 setUsedByCurrPicS1Var( i, getUsedByCurrPicS1Flag( i ) ); // (7 64) 5365 5366 if (i == 0 ) 5367 { 5368 setDeltaPocS1Var( i , getDeltaPocS1Minus1( i ) + 1 ); // (7 66) 5369 } 5370 else 5371 { 5372 setDeltaPocS1Var( i , getDeltaPocS1Var( i - 1 ) + ( getDeltaPocS1Minus1( i ) + 1 )); // (7 68) 5373 } 5374 } 5375 } 5376 } 5377 5378 #endif -
branches/HTM-15.0-dev0/source/Lib/TLibCommon/TComSlice.h
r1313 r1317 53 53 class TComTrQuant; 54 54 #if NH_MV 55 class TComDecodedRps; 55 56 class TComPicLists; 56 57 class TComVPS; … … 68 69 69 70 /// Reference Picture Set class 71 72 #if NH_MV 73 class TComStRefPicSet 74 { 75 // This class is currently only used by the decoder. 76 // TBD: Modify encoder to use also it. 77 78 private: 79 80 // Syntax elements: 81 82 Bool m_interRefPicSetPredictionFlag; 83 Int m_deltaIdxMinus1; 84 Bool m_deltaRpsSign; 85 Int m_absDeltaRpsMinus1; 86 Bool m_usedByCurrPicFlag [ MAX_NUM_PICS_RPS ]; 87 Bool m_useDeltaFlag [ MAX_NUM_PICS_RPS ]; 88 Int m_numNegativePics; 89 Int m_numPositivePics; 90 Int m_deltaPocS0Minus1 [ MAX_NUM_PICS_RPS ]; 91 Bool m_usedByCurrPicS0Flag[ MAX_NUM_PICS_RPS ]; 92 Int m_deltaPocS1Minus1 [ MAX_NUM_PICS_RPS ]; 93 Bool m_usedByCurrPicS1Flag[ MAX_NUM_PICS_RPS ]; 94 95 // Semantic variables: 96 Int m_deltaPocS0Var [ MAX_NUM_PICS_RPS ]; 97 Int m_deltaPocS1Var [ MAX_NUM_PICS_RPS ]; 98 Int m_usedByCurrPicS0Var [ MAX_NUM_PICS_RPS ]; 99 Int m_usedByCurrPicS1Var [ MAX_NUM_PICS_RPS ]; 100 Int m_numNegativePicsVar ; 101 Int m_numPositivePicsVar ; 102 103 public: 104 105 TComStRefPicSet( ) 106 { 107 // Set default inheritance values: 108 setInterRefPicSetPredictionFlag( false ); 109 setDeltaIdxMinus1( 0 ); 110 for (Int j = 0; j < MAX_NUM_PICS_RPS; j++) 111 { 112 setUseDeltaFlag( j, true ); 113 } 114 } 115 116 // Syntax elements: 117 Void setInterRefPicSetPredictionFlag( Bool flag ) { m_interRefPicSetPredictionFlag = flag; } 118 Bool getInterRefPicSetPredictionFlag( ) const { return m_interRefPicSetPredictionFlag; } 119 120 Void setDeltaIdxMinus1( Int val ) { m_deltaIdxMinus1 = val; } 121 Int getDeltaIdxMinus1( ) const { return m_deltaIdxMinus1; } 122 123 Void setDeltaRpsSign( Bool flag ) { m_deltaRpsSign = flag; } 124 Bool getDeltaRpsSign( ) const { return m_deltaRpsSign; } 125 126 Void setAbsDeltaRpsMinus1( Int val ) { m_absDeltaRpsMinus1 = val; } 127 Int getAbsDeltaRpsMinus1( ) const { return m_absDeltaRpsMinus1; } 128 129 Void setUsedByCurrPicFlag( Int j, Bool flag ) { m_usedByCurrPicFlag[j] = flag; } 130 Bool getUsedByCurrPicFlag( Int j ) const { return m_usedByCurrPicFlag[j]; } 131 132 Void setUseDeltaFlag( Int j, Bool flag ) { m_useDeltaFlag[j] = flag; } 133 Bool getUseDeltaFlag( Int j ) const { return m_useDeltaFlag[j]; } 134 135 Void setNumNegativePics( Int val ) { m_numNegativePics = val; } 136 Int getNumNegativePics( ) const { return m_numNegativePics; } 137 138 Void setNumPositivePics( Int val ) { m_numPositivePics = val; } 139 Int getNumPositivePics( ) const { return m_numPositivePics; } 140 141 Void setDeltaPocS0Minus1( Int i, Int val ) { m_deltaPocS0Minus1[i] = val; } 142 Int getDeltaPocS0Minus1( Int i ) const { return m_deltaPocS0Minus1[i]; } 143 144 Void setUsedByCurrPicS0Flag( Int i, Bool flag ) { m_usedByCurrPicS0Flag[i] = flag; } 145 Bool getUsedByCurrPicS0Flag( Int i ) const { return m_usedByCurrPicS0Flag[i]; } 146 147 Void setDeltaPocS1Minus1( Int i, Int val ) { m_deltaPocS1Minus1[i] = val; } 148 Int getDeltaPocS1Minus1( Int i ) const { return m_deltaPocS1Minus1[i]; } 149 150 Void setUsedByCurrPicS1Flag( Int i, Bool flag ) { m_usedByCurrPicS1Flag[i] = flag; } 151 Bool getUsedByCurrPicS1Flag( Int i ) const { return m_usedByCurrPicS1Flag[i]; } 152 153 // Semantics variables: 154 Int getRefRpsIdx(Int stRpsIdx ) const { return ( stRpsIdx - (getDeltaIdxMinus1() + 1) ); } 155 Int getDeltaRps() const { return ( ( 1 - 2 * getDeltaRpsSign() ) * ( getAbsDeltaRpsMinus1() + 1 ) ); } 156 Int getNumDeltaPocs() const { return ( getNumNegativePicsVar() + getNumPositivePicsVar()); } 157 158 Void setNumNegativePicsVar( Int val ) { m_numNegativePicsVar = val; } 159 Int getNumNegativePicsVar( ) const { return m_numNegativePicsVar; } 160 161 Void setNumPositivePicsVar( Int val ) { m_numPositivePicsVar = val; } 162 Int getNumPositivePicsVar( ) const { return m_numPositivePicsVar; } 163 164 Void setDeltaPocS0Var( Int i, Int val ) { m_deltaPocS0Var[i] = val; } 165 Int getDeltaPocS0Var( Int i ) const { return m_deltaPocS0Var[i]; } 166 167 Void setUsedByCurrPicS0Var( Int i, Bool flag ) { m_usedByCurrPicS0Var[i] = flag; } 168 Bool getUsedByCurrPicS0Var( Int i ) const { return m_usedByCurrPicS0Var[i]; } 169 170 Void setDeltaPocS1Var( Int i, Int val ) { m_deltaPocS1Var[i] = val; } 171 Int getDeltaPocS1Var( Int i ) const { return m_deltaPocS1Var[i]; } 172 173 Void setUsedByCurrPicS1Var( Int i, Bool flag ) { m_usedByCurrPicS1Var[i] = flag; } 174 Bool getUsedByCurrPicS1Var( Int i ) const { return m_usedByCurrPicS1Var[i]; } 175 176 Void inferRps( Int stRpsIdx, TComSPS* sps, Bool encoder ); 177 }; 178 179 #endif 180 70 181 class TComReferencePictureSet 71 182 { … … 302 413 { 303 414 ProfileTierLevel m_generalPTL; 415 #if !NH_MV 304 416 ProfileTierLevel m_subLayerPTL [MAX_TLAYER-1]; // max. value of max_sub_layers_minus1 is MAX_TLAYER-1 (= 6) 305 417 Bool m_subLayerProfilePresentFlag [MAX_TLAYER-1]; 306 418 Bool m_subLayerLevelPresentFlag [MAX_TLAYER-1]; 419 #else 420 ProfileTierLevel m_subLayerPTL [MAX_TLAYER]; // However, highest index is 6, so we need one more. 421 Bool m_subLayerProfilePresentFlag [MAX_TLAYER]; 422 Bool m_subLayerLevelPresentFlag [MAX_TLAYER]; 423 #endif 307 424 308 425 public: … … 804 921 805 922 Void setMaxVpsLatencyIncreasePlus1( Int i, Int j, Int val ) { m_maxVpsLatencyIncreasePlus1[i][j] = val; } 806 Int getMaxVpsLatencyIncreasePlus1( Int i, Int j ) const { return m_maxVpsLatencyIncreasePlus1[i][j]; } 923 Int getMaxVpsLatencyIncreasePlus1( Int i, Int j ) const { return m_maxVpsLatencyIncreasePlus1[i][j]; } 924 Int getVpsMaxLatencyPictures ( Int i, Int j ) const; 807 925 }; 808 926 #endif … … 901 1019 Int m_defaultDirectDependencyType; 902 1020 903 #if H_MV_HLS7_GEN904 Int m_directDependencyType [MAX_NUM_LAYERS] [MAX_NUM_LAYERS];905 #endif906 1021 Bool m_vpsVuiPresentFlag; 907 1022 TComVPSVUI m_vpsVUI; 908 #if !H_MV_HLS7_GEN909 1023 Int m_directDependencyType [MAX_NUM_LAYERS] [MAX_NUM_LAYERS]; 910 #endif911 1024 912 1025 // VPS EXTENSION SEMANTICS VARIABLES … … 1119 1232 Void setLayerSetIdxForOlsMinus1( Int outLayerSetIdx, Int val ) { m_layerSetIdxForOlsMinus1[ outLayerSetIdx ] = val; } 1120 1233 Int getLayerSetIdxForOlsMinus1( Int outLayerSetIdx ) const { return m_layerSetIdxForOlsMinus1[ outLayerSetIdx ]; } 1121 #if NH_MV_FIX_TICKET_1051122 1234 Int getLayerSetIdxForOlsMinus1Len( Int outLayerSetIdx ) const { return gCeilLog2( getNumLayerSets() - 1 ); } 1123 #else1124 Int getLayerSetIdxForOlsMinus1Len( Int outLayerSetIdx ) const { return gCeilLog2( getNumLayerSets() ); }1125 #endif1126 1235 1127 1236 Void setOutputLayerFlag( Int outLayerSetIdx, Int i, Bool flag ) { m_outputLayerFlag[ outLayerSetIdx ][ i ] = flag; } … … 1803 1912 1804 1913 TComRPSList m_RPSList; 1914 #if NH_MV 1915 std::vector<TComStRefPicSet> m_stRefPicSets; 1916 #endif 1805 1917 Bool m_bLongTermRefsPresent; 1806 1918 Bool m_TMVPFlagsPresent; … … 1825 1937 UInt m_uiBitsForPOC; 1826 1938 UInt m_numLongTermRefPicSPS; 1939 #if NH_MV 1940 Int m_numShortTermRefPicSets; 1941 #endif 1827 1942 UInt m_ltRefPicPocLsbSps[MAX_NUM_LONG_TERM_REF_PICS]; 1828 1943 Bool m_usedByCurrPicLtSPSFlag[MAX_NUM_LONG_TERM_REF_PICS]; … … 1838 1953 TComScalingList m_scalingList; 1839 1954 UInt m_uiMaxDecPicBuffering[MAX_TLAYER]; 1955 #if NH_MV 1956 UInt m_uiSpsMaxLatencyIncreasePlus1[MAX_TLAYER]; 1957 // Calling a member m_uiMaxLatencyIncrease although it is m_uiMaxLatencyIncreasePlus1 is really bad style. 1958 #else 1840 1959 UInt m_uiMaxLatencyIncrease[MAX_TLAYER]; // Really max latency increase plus 1 (value 0 expresses no limit) 1960 #endif 1841 1961 1842 1962 Bool m_useStrongIntraSmoothing; … … 1911 2031 Void setConformanceWindow(Window& conformanceWindow ) { m_conformanceWindow = conformanceWindow; } 1912 2032 2033 #if NH_MV 2034 UInt getNumLongTermRefPicsSps() const { return m_numLongTermRefPicSPS; } 2035 #endif 2036 1913 2037 UInt getNumLongTermRefPicSPS() const { return m_numLongTermRefPicSPS; } 1914 2038 Void setNumLongTermRefPicSPS(UInt val) { m_numLongTermRefPicSPS = val; } … … 1939 2063 Void setBitsForPOC( UInt u ) { m_uiBitsForPOC = u; } 1940 2064 UInt getBitsForPOC() const { return m_uiBitsForPOC; } 2065 #if NH_MV 2066 UInt getMaxPicOrderCntLsb() const { return (1 << ( getLog2MaxPicOrderCntLsbMinus4() + 4) ); } 2067 Int getLog2MaxPicOrderCntLsbMinus4() const { return (getBitsForPOC() - 4); } 2068 #endif 1941 2069 Bool getUseAMP() const { return m_useAMP; } 1942 2070 Void setUseAMP( Bool b ) { m_useAMP = b; } … … 1954 2082 const TComRPSList* getRPSList() const { return &m_RPSList; } 1955 2083 TComRPSList* getRPSList() { return &m_RPSList; } 2084 #if NH_MV 2085 Void initStRefPicSets( ) { m_stRefPicSets.resize( getNumShortTermRefPicSets() ); } 2086 TComStRefPicSet* getStRefPicSet( Int i ) { return &(m_stRefPicSets[i]); } 2087 const TComStRefPicSet* getStRefPicSet( Int i ) const { return &(m_stRefPicSets[i]); } 2088 Bool getLongTermRefPicsPresentFlag() const { return m_bLongTermRefsPresent; } 2089 Void setLongTermRefPicsPresentFlag(Bool b) { m_bLongTermRefsPresent=b; } 2090 #else 1956 2091 Bool getLongTermRefsPresent() const { return m_bLongTermRefsPresent; } 1957 2092 Void setLongTermRefsPresent(Bool b) { m_bLongTermRefsPresent=b; } 2093 #endif 1958 2094 Bool getTMVPFlagsPresent() const { return m_TMVPFlagsPresent; } 1959 2095 Void setTMVPFlagsPresent(Bool b) { m_TMVPFlagsPresent=b; } 2096 #if NH_MV 2097 Bool getSpsTemporalMvpEnabledFlag() const { return m_TMVPFlagsPresent; } 2098 #endif 1960 2099 // physical transform 1961 2100 Void setMaxTrSize( UInt u ) { m_uiMaxTrSize = u; } … … 1988 2127 Void setPCMFilterDisableFlag( Bool bValue ) { m_bPCMFilterDisableFlag = bValue; } 1989 2128 Bool getPCMFilterDisableFlag() const { return m_bPCMFilterDisableFlag; } 1990 2129 #if NH_MV 2130 Void setNumShortTermRefPicSets( Int val ) { m_numShortTermRefPicSets = val; } 2131 Int getNumShortTermRefPicSets( )const { return m_numShortTermRefPicSets; } 2132 #endif 1991 2133 Bool getScalingListFlag() const { return m_scalingListEnabledFlag; } 1992 2134 Void setScalingListFlag( Bool b ) { m_scalingListEnabledFlag = b; } … … 1998 2140 UInt getMaxDecPicBuffering(UInt tlayer) const { return m_uiMaxDecPicBuffering[tlayer]; } 1999 2141 Void setMaxDecPicBuffering( UInt ui, UInt tlayer ) { assert(tlayer < MAX_TLAYER); m_uiMaxDecPicBuffering[tlayer] = ui; } 2142 #if NH_MV 2143 UInt getSpsMaxDecPicBufferingMinus1(UInt tlayer) const { return m_uiMaxDecPicBuffering[tlayer] -1 ; } 2144 UInt getSpsMaxLatencyIncreasePlus1(UInt tlayer) const { return m_uiSpsMaxLatencyIncreasePlus1[tlayer]; } 2145 Void setSpsMaxLatencyIncreasePlus1( UInt ui , UInt tlayer) { m_uiSpsMaxLatencyIncreasePlus1[tlayer] = ui; } 2146 Int getSpsMaxLatencyPictures( Int i ) const { return ( getSpsMaxNumReorderPics(i) + getSpsMaxLatencyIncreasePlus1(i)-1); } 2147 #else 2000 2148 UInt getMaxLatencyIncrease(UInt tlayer) const { return m_uiMaxLatencyIncrease[tlayer]; } 2001 2149 Void setMaxLatencyIncrease( UInt ui , UInt tlayer) { m_uiMaxLatencyIncrease[tlayer] = ui; } 2150 #endif 2151 2152 #if NH_MV 2153 Int getSpsMaxNumReorderPics(Int i ) const { return getNumReorderPics( i ); } 2154 #endif 2002 2155 2003 2156 Void setUseStrongIntraSmoothing(Bool bVal) { m_useStrongIntraSmoothing = bVal; } … … 2133 2286 Void setRefPicSetIdxL1(UInt idx, UInt refPicSetIdx) { assert(idx<REF_PIC_LIST_NUM_IDX); m_RefPicSetIdxL1[idx] = refPicSetIdx; } 2134 2287 #if NH_MV 2135 // Why not a listIdx for all members, would avoid code duplication??2288 2136 2289 Void setRefPicSetIdxL(UInt li, UInt idx, UInt refPicSetIdx) {( li==0 ? m_RefPicSetIdxL0[idx] : m_RefPicSetIdxL1[idx] ) = refPicSetIdx; } 2137 2290 UInt getRefPicSetIdxL(UInt li, UInt idx ) { return ( li == 0 ) ? m_RefPicSetIdxL0[idx] : m_RefPicSetIdxL1[idx] ; } 2138 2291 Void setRefPicListModificationFlagL(UInt li, Bool flag) { ( li==0 ? m_refPicListModificationFlagL0 : m_refPicListModificationFlagL1 ) = flag; } 2139 2292 Bool getRefPicListModificationFlagL(UInt li ) { return ( li== 0) ? m_refPicListModificationFlagL0 : m_refPicListModificationFlagL1; } 2293 2294 Int getListEntryL0( Int i) const { assert(i<REF_PIC_LIST_NUM_IDX); return m_RefPicSetIdxL0[i]; } 2295 Int getListEntryL1( Int i) const { assert(i<REF_PIC_LIST_NUM_IDX); return m_RefPicSetIdxL1[i]; } 2296 2297 Int getListEntryLXLen( Int numPicTotalCur ) const { return gCeilLog2( numPicTotalCur ); } 2298 2299 Void setListEntryL0( Int i, Int val ) { m_RefPicSetIdxL0[i] = val; } 2300 Void setListEntryL1( Int i, Int val ) { m_RefPicSetIdxL1[i] = val; } 2301 2302 2140 2303 #endif 2141 2304 }; … … 2470 2633 private: 2471 2634 // Bitstream writing 2635 #if NH_MV 2636 Bool m_firstSliceSegmentInPicFlag; 2637 #endif 2472 2638 Bool m_saoEnabledFlag[MAX_NUM_CHANNEL_TYPE]; 2473 2639 Int m_iPPSId; ///< picture parameter set ID … … 2475 2641 #if NH_MV 2476 2642 Int m_slicePicOrderCntLsb; 2643 Bool m_shortTermRefPicSetSpsFlag; 2644 Int m_shortTermRefPicSetIdx; 2645 Int m_numLongTermSps; 2646 Int m_numLongTermPics; 2647 Int m_ltIdxSps [MAX_NUM_PICS_RPS]; 2648 Int m_pocLsbLt [MAX_NUM_PICS_RPS]; 2649 Bool m_usedByCurrPicLtFlag [MAX_NUM_PICS_RPS]; 2650 Bool m_deltaPocMsbPresentFlag [MAX_NUM_PICS_RPS]; 2651 Int m_deltaPocMsbCycleLt [MAX_NUM_PICS_RPS]; 2652 Bool m_sliceTemporalMvpEnabledFlag; 2653 TComStRefPicSet m_stRefPicSet; 2477 2654 #endif 2478 2655 Int m_iPOC; … … 2510 2687 Int m_aiRefPOCList [NUM_REF_PIC_LIST_01][MAX_NUM_REF+1]; 2511 2688 #if NH_MV 2512 Int m_aiRefLayerIdList[2][MAX_NUM_REF+1];2689 Int m_aiRefLayerIdList[2][MAX_NUM_REF+1]; 2513 2690 #endif 2514 2691 Bool m_bIsUsedAsLongTerm[NUM_REF_PIC_LIST_01][MAX_NUM_REF+1]; … … 2570 2747 SliceType m_encCABACTableIdx; // Used to transmit table selection across slices. 2571 2748 #if NH_MV 2572 Bool m_availableForTMVPRefFlag; 2573 #endif 2574 2575 #if NH_MV 2749 2576 2750 std::vector<TComPic*>* m_refPicSetInterLayer0; 2577 2751 std::vector<TComPic*>* m_refPicSetInterLayer1; … … 2584 2758 2585 2759 // Additional slice header syntax elements 2586 #if !H_MV_HLS7_GEN2587 2760 Bool m_pocResetFlag; 2588 #endif 2761 2589 2762 Bool m_crossLayerBlaFlag; 2590 2763 Bool m_discardableFlag; … … 2596 2769 Int m_pocResetIdc; 2597 2770 Int m_pocResetPeriodId; 2771 2772 Bool m_hasPocResetPeriodIdPresent; 2773 DecodingProcess m_decodingProcess; 2774 DecodingProcess m_decProcPocAndRps; 2598 2775 Bool m_fullPocResetFlag; 2599 2776 Int m_pocLsbVal; 2600 Bool m_pocMsb ValPresentFlag;2601 Int m_pocMsb Val;2777 Bool m_pocMsbCycleValPresentFlag; 2778 Int m_pocMsbCycleVal; 2602 2779 Bool m_pocMsbValRequiredFlag; 2603 2780 … … 2676 2853 Void setSlicePicOrderCntLsb( Int i ) { m_slicePicOrderCntLsb = i; } 2677 2854 Int getSlicePicOrderCntLsb( ) const { return m_slicePicOrderCntLsb; } 2855 2856 Bool getFirstSliceSegementInPicFlag() const { return m_firstSliceSegmentInPicFlag; } 2857 Void setFirstSliceSegementInPicFlag(Bool val) { m_firstSliceSegmentInPicFlag = val; } 2678 2858 #endif 2679 2859 Bool getPicOutputFlag() const { return m_PicOutputFlag; } … … 2734 2914 Void setBaseViewRefPicList( TComList<TComPic*> *pListPic, Int iViewIdx ) { m_pBaseViewRefPicList[iViewIdx] = pListPic; } 2735 2915 Void setARPStepNum( TComPicLists*ivPicLists ); 2916 Void setPocsInCurrRPSs( ); 2917 2736 2918 TComPic* getBaseViewRefPic ( UInt uiPOC , Int iViewIdx ) { return xGetRefPic( *m_pBaseViewRefPicList[iViewIdx], uiPOC ); } 2737 2919 UInt getARPStepNum( ) { return m_nARPStepNum; } … … 2746 2928 Bool getMvdL1ZeroFlag() const { return m_bLMvdL1Zero; } 2747 2929 Int getNumRpsCurrTempList() const; 2930 #if NH_MV 2931 Int getNumPicTotalCurr() const; 2932 #endif 2748 2933 Int getList1IdxToList0Idx( Int list1Idx ) const { return m_list1IdxToList0Idx[list1Idx]; } 2749 2934 Void setReferenced(Bool b) { m_bRefenced = b; } … … 2753 2938 Void setNalUnitType( NalUnitType e ) { m_eNalUnitType = e; } 2754 2939 NalUnitType getNalUnitType() const { return m_eNalUnitType; } 2940 #if NH_MV 2941 std::string getNalUnitTypeString( ) { return NALU_TYPE_STR[ getNalUnitType() ]; }; 2942 #endif 2755 2943 Bool getRapPicFlag() const; 2756 2944 Bool getIdrPicFlag() const { return getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP; } 2757 2945 Bool isIRAP() const { return (getNalUnitType() >= 16) && (getNalUnitType() <= 23); } 2946 #if NH_MV 2947 Bool isBla() const { return ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP ) || ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) || ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL ); } 2948 Bool isIdr() const { return ( getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL ) || ( getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP ); } 2949 Bool isCra() const { return ( getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA ); } 2950 2951 Bool isSlnr() const { return ( getNalUnitType() == NAL_UNIT_CODED_SLICE_TRAIL_N || 2952 getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N || 2953 getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_N || 2954 getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL_N || 2955 getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N || 2956 getNalUnitType() == NAL_UNIT_RESERVED_VCL_N10 || 2957 getNalUnitType() == NAL_UNIT_RESERVED_VCL_N12 || 2958 getNalUnitType() == NAL_UNIT_RESERVED_VCL_N14 ); } 2959 2960 Bool isRasl() const { return ( getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_R ) || ( getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N ); } 2961 Bool isRadl() const { return ( getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL_R ) || ( getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL_N ); } 2962 Bool isStsa() const { return ( getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_R ) || ( getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_N ); } 2963 Bool isTsa() const { return ( getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_R ) || ( getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N ); } 2964 2965 Bool decProcClause8() const { return ( m_decodingProcess == CLAUSE_8 ); } 2966 Bool decProcAnnexF() const { return ( decProcAnnexG() || decProcAnnexH() || decProcAnnexI() ) ; } 2967 Bool decProcAnnexG() const { return ( m_decodingProcess == ANNEX_G || decProcAnnexI() ); } 2968 Bool decProcAnnexH() const { return ( m_decodingProcess == ANNEX_H ); } 2969 Bool decProcAnnexI() const { return ( m_decodingProcess == ANNEX_I ); } 2970 Int getCurrRpsIdx() const { return ( getShortTermRefPicSetSpsFlag() ? getShortTermRefPicSetIdx() : getSPS()->getNumShortTermRefPicSets() ) ;} 2971 2972 #endif 2973 2974 2758 2975 Void checkCRA(const TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, NalUnitType& associatedIRAPType, TComList<TComPic *>& rcListPic); 2759 2976 Void decodingRefreshMarking(Int& pocCRA, Bool& bRefreshPending, TComList<TComPic*>& rcListPic, const bool bEfficientFieldIRAPEnabled); … … 2774 2991 Void setRefPOC( Int i, RefPicList e, Int iRefIdx ) { m_aiRefPOCList[e][iRefIdx] = i; } 2775 2992 Void setNumRefIdx( RefPicList e, Int i ) { m_aiNumRefIdx[e] = i; } 2993 #if NH_MV 2994 Int getNumRefIdxL0ActiveMinus1() const { return ( getNumRefIdx(REF_PIC_LIST_0) -1); } 2995 Int getNumRefIdxL1ActiveMinus1() const { return ( getNumRefIdx(REF_PIC_LIST_1) -1); } 2996 #endif 2776 2997 Void setPic( TComPic* p ) { m_pcPic = p; } 2777 2998 Void setDepth( Int iDepth ) { m_iDepth = iDepth; } … … 2827 3048 Void setTLayer( UInt uiTLayer ) { m_uiTLayer = uiTLayer; } 2828 3049 #if NH_MV 2829 Int getTemporalId ( ){ return (Int) m_uiTLayer; }3050 Int getTemporalId( ) const { return (Int) m_uiTLayer; } 2830 3051 #endif 2831 3052 … … 2836 3057 #if NH_MV 2837 3058 Void createInterLayerReferencePictureSet( TComPicLists* ivPicLists, std::vector<TComPic*>& refPicSetInterLayer0, std::vector<TComPic*>& refPicSetInterLayer1 ); 3059 Void f834decProcForRefPicListConst(); 3060 Void cl834DecProcForRefPicListConst(); 3061 2838 3062 static Void markIvRefPicsAsShortTerm ( std::vector<TComPic*> refPicSetInterLayer0, std::vector<TComPic*> refPicSetInterLayer1 ); 2839 3063 static Void markCurrPic ( TComPic* currPic ); … … 2852 3076 Void setNoRaslOutputFlag( Bool val ) { m_noRaslOutputFlag = val; } 2853 3077 Bool getNoRaslOutputFlag() const { return m_noRaslOutputFlag; } 3078 2854 3079 2855 3080 Void setHandleCraAsBlaFlag( Bool val ) { m_handleCraAsBlaFlag = val; } … … 2915 3140 Bool getLFCrossSliceBoundaryFlag() { return m_LFCrossSliceBoundaryFlag; } 2916 3141 3142 #if NH_MV 3143 Void setShortTermRefPicSetSpsFlag( Bool flag ) { m_shortTermRefPicSetSpsFlag = flag; } 3144 Bool getShortTermRefPicSetSpsFlag( ) const { return m_shortTermRefPicSetSpsFlag; } 3145 3146 Int getShortTermRefPicSetIdxLen() const { return gCeilLog2( getSPS()->getNumShortTermRefPicSets() ); } 3147 Void setShortTermRefPicSetIdx( Int val ) { m_shortTermRefPicSetIdx = val; } 3148 Int getShortTermRefPicSetIdx( ) const { return m_shortTermRefPicSetIdx; } 3149 3150 Void setNumLongTermSps( Int val ) { m_numLongTermSps = val; } 3151 Int getNumLongTermSps( ) const { return m_numLongTermSps; } 3152 3153 Void setNumLongTermPics( Int val ) { m_numLongTermPics = val; } 3154 Int getNumLongTermPics( ) const { return m_numLongTermPics; } 3155 3156 Int getLtIdxSpsLen() const { return gCeilLog2( getSPS()->getNumLongTermRefPicsSps() ); } 3157 Void setLtIdxSps( Int i, Int val ) { m_ltIdxSps[i] = val; } 3158 Int getLtIdxSps( Int i ) const { return m_ltIdxSps[i]; } 3159 3160 Int getPocLsbLtLen() const { return (getSPS()->getLog2MaxPicOrderCntLsbMinus4()+ 4); } 3161 Void setPocLsbLt( Int i, Int val ) { m_pocLsbLt[i] = val; } 3162 Int getPocLsbLt( Int i ) const { return m_pocLsbLt[i]; } 3163 3164 Void setUsedByCurrPicLtFlag( Int i, Bool flag ) { m_usedByCurrPicLtFlag[i] = flag; } 3165 Bool getUsedByCurrPicLtFlag( Int i ) const { return m_usedByCurrPicLtFlag[i]; } 3166 3167 Void setDeltaPocMsbPresentFlag( Int i, Bool flag ) { m_deltaPocMsbPresentFlag[i] = flag; } 3168 Bool getDeltaPocMsbPresentFlag( Int i ) const { return m_deltaPocMsbPresentFlag[i]; } 3169 3170 Void setDeltaPocMsbCycleLt( Int i, Int val ) { m_deltaPocMsbCycleLt[i] = val; } 3171 Int getDeltaPocMsbCycleLt( Int i ) const { return m_deltaPocMsbCycleLt[i]; } 3172 3173 Void setSliceTemporalMvpEnabledFlag( Bool flag ) { m_enableTMVPFlag = flag; } 3174 Bool getSliceTemporalMvpEnabledFlag( ) const { return m_enableTMVPFlag; } 3175 3176 TComStRefPicSet* getLocalStRps( ) { return &m_stRefPicSet; }; 3177 const TComStRefPicSet* getStRps( Int stRpsIdx ) const { return ( (stRpsIdx == getSPS()->getNumShortTermRefPicSets()) ? &m_stRefPicSet : getSPS()->getStRefPicSet( stRpsIdx ) ); }; 3178 3179 #endif 3180 2917 3181 Void setEnableTMVPFlag( Bool b ) { m_enableTMVPFlag = b; } 2918 3182 Bool getEnableTMVPFlag() { return m_enableTMVPFlag; } … … 2922 3186 2923 3187 #if NH_MV 2924 Void setAvailableForTMVPRefFlag( Bool b ) { m_availableForTMVPRefFlag = b; }2925 Bool getAvailableForTMVPRefFlag() { return m_availableForTMVPRefFlag; }2926 2927 3188 Void setLayerId ( Int layerId ) { m_layerId = layerId; } 2928 3189 Int getLayerId () const { return m_layerId; } … … 2932 3193 Void setViewIndex ( Int viewIndex ) { m_viewIndex = viewIndex; } 2933 3194 Int getViewIndex () const { return m_viewIndex; } 3195 3196 Void setDecodingProcess ( DecodingProcess decProc ) { m_decodingProcess = decProc; } 3197 3198 2934 3199 #if NH_3D 2935 3200 #if NH_3D_TMVP … … 2986 3251 Void checkCrossLayerBlaFlag ( ) const ; 2987 3252 2988 #if !H_MV_HLS7_GEN3253 #if NH_MV 2989 3254 Void setPocResetFlag( Bool flag ) { m_pocResetFlag = flag; } 2990 3255 Bool getPocResetFlag( ) const { return m_pocResetFlag; } … … 3010 3275 Void checkPocResetIdc( ) const { assert( !(getVPS()->getPocLsbNotPresentFlag( getLayerIdInVps() ) ) || !(getSlicePicOrderCntLsb() > 0 ) || !( getPocResetIdc() == 2) ); } 3011 3276 3277 3012 3278 Void setPocResetPeriodId( Int val ) { m_pocResetPeriodId = val; } 3013 3279 Int getPocResetPeriodId( ) const { return m_pocResetPeriodId; } … … 3020 3286 Void checkPocLsbVal( ) const { assert( !(getVPS()->getPocLsbNotPresentFlag( getLayerIdInVps() ) ) || !getFullPocResetFlag() || ( getPocLsbVal() == 0 ) ); } 3021 3287 3288 #if NH_MV 3289 Void setHasPocResetPeriodIdPresent( Bool val ) { m_hasPocResetPeriodIdPresent = val; } 3290 Bool getHasPocResetPeriodIdPresent( ) const { return m_hasPocResetPeriodIdPresent; } 3291 3292 Void setPocMsbCycleValPresentFlag( Bool flag ) { m_pocMsbCycleValPresentFlag = flag; } 3293 Bool getPocMsbCycleValPresentFlag( ) const { return m_pocMsbCycleValPresentFlag; } 3294 3295 Void setPocMsbCycleVal( Int val ) { m_pocMsbCycleVal = val; } 3296 Int getPocMsbCycleVal( ) const { return m_pocMsbCycleVal; } 3297 3298 Int getPocLsbLtVar(Int i); 3299 Bool getUsedByCurrPicLtVar(Int i) const; 3300 Int getDeltaPocMsbCycleLtVar( Int i ) const; 3301 3302 #else 3022 3303 Void setPocMsbValPresentFlag( Bool flag ) { m_pocMsbValPresentFlag = flag; } 3023 3304 Bool getPocMsbValPresentFlag( ) const { return m_pocMsbValPresentFlag; } … … 3025 3306 Void setPocMsbVal( Int val ) { m_pocMsbVal = val; } 3026 3307 Int getPocMsbVal( ) const { return m_pocMsbVal; } 3308 #endif 3309 3027 3310 3028 3311 Bool getCraOrBlaPicFlag() const { return ( getCraPicFlag() || getBlaPicFlag() ); } 3029 3312 Bool getPocMsbValRequiredFlag() const { return ( getCraOrBlaPicFlag() && ( getVPS()->getVpsPocLsbAlignedFlag() || getVPS()->getNumDirectRefLayers( getLayerIdInVps() ) == 0 ) ); } 3030 3313 3031 UInt getPocLsbValLen() const { return getSPS()->getBitsForPOC(); }; //log2_max_pic_order_cnt_lsb_minus4 + 4 3314 UInt getPocLsbValLen() const { return getSPS()->getBitsForPOC(); }; //log2_max_pic_order_cnt_lsb_minus4 + 4 3032 3315 3033 3316 Bool getBlaPicFlag() const … … 3069 3352 Void deriveInCmpPredAndCpAvailFlag( ); 3070 3353 Void init3dToolParameters(); 3071 Void checkInCompPredRefLayers(); ;3354 Void checkInCompPredRefLayers(); 3072 3355 3073 3356 Bool getIvMvPredFlag ( ) { return m_ivMvPredFlag ; }; … … 3095 3378 #endif 3096 3379 #endif 3380 #if NH_MV 3381 TComPic* getRefPicSetInterLayer( Int setIdc, Int i ) const; 3382 #endif 3383 3097 3384 // Inference 3385 #if NH_MV 3386 Bool inferPocMsbCycleValPresentFlag(); 3387 #else 3098 3388 Bool inferPocMsbValPresentFlag(); 3389 #endif 3099 3390 #endif 3100 3391 protected: -
branches/HTM-15.0-dev0/source/Lib/TLibCommon/TypeDef.h
r1313 r1317 61 61 #define NH_3D ( HEVC_EXT == 2) 62 62 ///////////////////////////////////////////////////////////////////////////////////////// 63 /////////////////////////////////// FIXES /////////////////////////////////// 64 ///////////////////////////////////////////////////////////////////////////////////////// 65 #if NH_MV 66 #define NH_MV_FIX_NO_REF_PICS_CHECK 1 // !!SPEC!! 67 #define NH_MV_FIX_INIT_NUM_ACTIVE_REF_LAYER_PICS 1 // Derivation of NumActiveRefLayerPIcs. !!SPEC!! 68 #define NH_MV_FIX_NUM_POC_TOTAL_CUR 1 // Derivation of NumPocTotalCur for IDR pictures. !!SPEC!! 69 #endif 70 #if NH_3D 71 #define H_3D_FIX_ARP_CHECK_NOT_IN_DPB 1 72 #endif 73 ///////////////////////////////////////////////////////////////////////////////////////// 63 74 /////////////////////////////////// MAJOR DEFINES /////////////////////////////////// 64 75 ///////////////////////////////////////////////////////////////////////////////////////// 65 76 #if NH_MV 66 #define NH_MV_FIX_TICKET_105 1 // layer_set_idx_for_ols_minus1 length67 #define NH_MV_FIX_TICKET_100 1 // Extra slice header bits68 77 #define H_MV_ENC_DEC_TRAC 1 //< CU/PU level tracking 69 #define H_MV_ENC_DEC_TRAC_FIX 1 // by SHARP70 78 #if NH_3D 71 // FIXES72 #define NH_3D_FIX_TICKET_98 1 // Writing of depth intra skip flag73 #define NH_3D_FIX_TICKET_101 ( 1 && NH_3D_VER141_DEC_COMP_FLAG ) // Camera parameters for depth74 #define NH_3D_DIS_FIX 175 #define NH_3D_ENC_DEPTH_FIX 1 // Fix Intra TU coding.76 #define NH_3D_INTRA_SDC_RD_FIX 1 // Fix in RD- decision of intra SDC.77 #define NH_3D_DLT_FIX 1 // Fixes numbers of parsed DLTs78 #define NH_3D_VER141_DEC_COMP_FLAG 0 // Makes decoding of this version compatible to HTM-14.1 by re-introducing HTM-14.1 bugs.79 #define NH_3D_ALIGN_SPIVMP_DBBP 1 // Further alignment of DBBP and SBP motion80 #define NH_3D_ALIGN_SPIVMP_RP 1 // Alignment of DBBP and RP81 #define NH_3D_FIX_VSP 182 #define NH_3D_VSO 183 #define NH_3D_NBDV 184 #define NH_3D_TMVP 1 // QC_TMVP_C004785 // Sony_M2363986 // H_3D_TMVP_SCALING_FIX_K0053 1 // QC/CY for K005387 #define NH_3D_IC 1 // Illumination Compensation, JCT3V-B0045, JCT3V-C0046, JCT3V-D006088 // Unifying rounding offset, for IC part, JCT3V-D013589 // SHARP_ILLUCOMP_REFINE_E004690 // MTK_CLIPPING_ALIGN_IC_E0168 // To support simplify bi-prediction PU with identical motion checking, JCT3V-E016891 // LGE_IC_CTX_F0160 //JCT3V-F016092 // SEC_ONLY_TEXTURE_IC_F015193 // MTK_IC_FLAG_CABAC_SIMP_G006194 // SEC_IC_ARP_SIG_G0072, Disabling IC when ARP is enabled, option 1 in JCT3V-G0072, part 2 in JCT3V-G012195 // MTK_LOW_LATENCY_IC_ENCODING_H0086 Low-latency IC encoding in JCT3V-H008696 // MTK_LOW_LATENCY_IC_ENCODING_H0086_FIX 1 // Remove the global variables used in JCT3V-H008697 // SEC_IC_NEIGHBOR_CLIP_I0080 // Clipping of neighboring sample position, JCT3V-I008098 // LGE_CHROMA_IC_J0050_J003499 #define NH_3D_IC_FIX 1 // Fix uninitialized value in cDtParam.bUseIC (it happened on intra block)100 #define NH_3D_FULL_PEL_DEPTH_MAP_MV_ACC 1 // Full Pel Interpolation for Depth, HHI_FULL_PEL_DEPTH_MAP_MV_ACC101 #define NH_3D_QTLPC 1 // OL_QTLIMIT_PREDCODING_B0068 //JCT3V-B0068102 // HHI_QTLPC_RAU_OFF_C0160 JCT3V-C0160 change 2: quadtree limitation and predictive coding switched off in random access units103 // MTK_TEX_DEP_PAR_G0055 Texture-partition-dependent depth partition. JCT3V-G0055104 #define NH_3D_NBDV_REF 1105 #define NH_3D_MLC 1106 #define NH_3D_FIX_PRUNING 1107 #define NH_3D_VSP 1108 #define NH_3D_IV_MERGE 1109 #define NH_3D_SPIVMP 1110 79 #define NH_3D_INTEGER_MV_DEPTH 1 111 #define NH_3D_TEXT_MERGE 1112 #define NH_3D_DBBP 1113 #define BUF_FIX 1114 #define NH_3D_ARP 1 // Advanced residual prediction (ARP), JCT3V-D0177115 // QC_MTK_INTERVIEW_ARP_F0123_F0108 JCT3V-F0123; JCT3V-F0108116 // SHARP_ARP_REF_CHECK_F0105 ARP reference picture selection and DPB check117 // LGE_ARP_CTX_F0161 JCT3V-F0161118 // MTK_ARP_FLAG_CABAC_SIMP_G0061 Use 2 context for ARP flag referring to only left neighbor block in JCT3V-G0061119 // MTK_ARP_REF_SELECTION_G0053 ARP Reference picture selection in JCT3V-G0053120 // MTK_ALIGN_SW_WD_BI_PRED_ARP_H0085 Align the SW and WD for the bi-prediction ARP PUs by disallowing non-normative fast bi-prediction for ARP PUs, JCT3V-H0085121 // QC_I0051_ARP_SIMP122 // SHARP_ARP_CHROMA_I0104123 // MTK_I0072_IVARP_SCALING_FIX124 // SEC_ARP_VIEW_REF_CHECK_J0037 Signaling iv_res_pred_weight_idx when the current slice has both view and temporal reference picture(s), JCT3V-J0037 item1125 // SEC_ARP_REM_ENC_RESTRICT_K0035 Removal of encoder restriction of ARP, JCT3V-K0035126 #define NH_3D_DMM 1 // Depth modeling modes127 #define NH_3D_DLT 1 // Depth Lookup Table128 #define NH_3D_SDC_INTRA 1 // Segment-wise DC Coding method for INTRA129 #define NH_3D_SDC_INTER 1 // Segment-wise DC Coding method for INTER130 80 #define NH_3D_ENC_DEPTH 1 // Encoder optimizations for depth, incl. 131 81 // HHI_DEPTH_INTRA_SEARCH_RAU_C0160 … … 133 83 // HHI_DMM4_ENC_I0066 134 84 // H_3D_FAST_DEPTH_INTRA 135 #define NH_3D_DIS 1136 85 #define NH_3D_FAST_TEXTURE_ENCODING 1 // Fast merge mode decision and early CU determination for texture component of dependent view, JCT3V-E0173 137 #endif 138 #if H_3D 139 #define H_3D_QTLPC 1 // OL_QTLIMIT_PREDCODING_B0068 //JCT3V-B0068 86 #define NH_3D_ARP 1 // Advanced residual prediction (ARP), JCT3V-D0177 87 // QC_MTK_INTERVIEW_ARP_F0123_F0108 JCT3V-F0123; JCT3V-F0108 88 // SHARP_ARP_REF_CHECK_F0105 ARP reference picture selection and DPB check 89 // LGE_ARP_CTX_F0161 JCT3V-F0161 90 // MTK_ARP_FLAG_CABAC_SIMP_G0061 Use 2 context for ARP flag referring to only left neighbor block in JCT3V-G0061 91 // MTK_ARP_REF_SELECTION_G0053 ARP Reference picture selection in JCT3V-G0053 92 // MTK_ALIGN_SW_WD_BI_PRED_ARP_H0085 Align the SW and WD for the bi-prediction ARP PUs by disallowing non-normative fast bi-prediction for ARP PUs, JCT3V-H0085 93 // QC_I0051_ARP_SIMP 94 // SHARP_ARP_CHROMA_I0104 95 // MTK_I0072_IVARP_SCALING_FIX 96 // SEC_ARP_VIEW_REF_CHECK_J0037 Signaling iv_res_pred_weight_idx when the current slice has both view and temporal reference picture(s), JCT3V-J0037 item1 97 // SEC_ARP_REM_ENC_RESTRICT_K0035 Removal of encoder restriction of ARP, JCT3V-K0035 98 #define NH_3D_QTLPC 1 // OL_QTLIMIT_PREDCODING_B0068 //JCT3V-B0068 140 99 // HHI_QTLPC_RAU_OFF_C0160 JCT3V-C0160 change 2: quadtree limitation and predictive coding switched off in random access units 141 100 // MTK_TEX_DEP_PAR_G0055 Texture-partition-dependent depth partition. JCT3V-G0055 142 #define H_3D_VSO 1 // VSO, View synthesis optimization, includes:101 #define NH_3D_VSO 1 // VSO, View synthesis optimization, includes: 143 102 // HHI_VSO 144 103 // HHI_VSO_LS_TABLE_M23714 enable table base Lagrange multiplier optimization … … 146 105 // LGE_WVSO_A0119 147 106 // SCU_HS_VSD_BUGFIX_IMPROV_G0163 148 #define H_3D_NBDV 1 // Neighboring block disparity derivation107 #define NH_3D_NBDV 1 // Neighboring block disparity derivation 149 108 // QC_JCT3V-A0097 150 109 // LGE_DVMCP_A0126 … … 162 121 // MTK_TEXTURE_MRGCAND_BUGFIX_E0182 Bug fix for TEXTURE MERGING CANDIDATE , JCT3V-E0182 163 122 // LGE_SIMP_DISP_AVAIL_J0041 // Use 2 status for disparity availability - DISP_AVAILABLE and DISP_NONE 164 #define H_3D_IC1 // Illumination Compensation, JCT3V-B0045, JCT3V-C0046, JCT3V-D0060123 #define NH_3D_IC 1 // Illumination Compensation, JCT3V-B0045, JCT3V-C0046, JCT3V-D0060 165 124 // Unifying rounding offset, for IC part, JCT3V-D0135 166 125 // Full Pel Interpolation for Depth, HHI_FULL_PEL_DEPTH_MAP_MV_ACC … … 176 135 // LGE_CHROMA_IC_J0050_J0034 177 136 #if NH_3D_NBDV 178 #define H_3D_NBDV_REF 1 // Depth oriented neighboring block disparity derivation137 #define NH_3D_NBDV_REF 1 // Depth oriented neighboring block disparity derivation 179 138 // MTK_D0156 180 139 // MERL_D0166: Reference view selection in NBDV & Bi-VSP … … 184 143 // SEC_VER_DONBDV_H0103 Vertical DV Restriction for DoNBDV 185 144 #endif 186 #define H_3D_VSP 1 // View synthesis prediction145 #define NH_3D_VSP 1 // View synthesis prediction 187 146 // MERL_C0152: Basic VSP 188 147 // MERL_D0166: Reference view selection in NBDV & Bi-VSP … … 202 161 // MTK_MRG_LIST_SIZE_CLEANUP_J0059 1 // Include VSP for deriving merge candidate list size, JCT3V-J0059 203 162 // SEC_A1_BASED_VSP_J0039 1 // Removal of redundant VSP in Merge list 204 #define H_3D_IV_MERGE 1 // Inter-view motion merge candidate 163 #define NH_3D_MLC 1 164 #define NH_3D_IV_MERGE 1 // Inter-view motion merge candidate 205 165 // HHI_INTER_VIEW_MOTION_PRED 206 166 // SAIT_IMPROV_MOTION_PRED_M24829, improved inter-view motion vector prediction … … 209 169 // MTK_INTERVIEW_MERGE_A0049 , second part 210 170 // QC_AMVP_MRG_UNIFY_IVCAN_C0051 211 // TEXTURE MERGING CANDIDATE , JCT3V-C0137212 171 // QC_INRIA_MTK_MRG_E0126 213 172 // ETRIKHU_MERGE_REUSE_F0093 QC_DEPTH_IV_MRG_F0125, JCT3V-F0125: Depth oriented Inter-view MV candidate 214 // EC_MPI_ENABLING_MERGE_F0150, MPI flag in VPS and enabling in Merge mode215 173 // MTK_NBDV_IVREF_FIX_G0067 , Disable IvMC, VSP when IVREF is not available, JCT3V-G0067 216 174 // SEC_DEPTH_DV_DERIVAITON_G0074, Simplification of DV derivation for depth, JCT3V-G0074 … … 225 183 // SEC_SIMP_SHIFTED_DV_I0086 Simplification of Shifted DV candidate, JCT3V-I0086 226 184 // SEC_SHIFTED_IVMC_POS_K0036 Position Derivation for Shifted-IVMC, JCT3V-K0036 227 #define H_3D_TMVP 1 // QC_TMVP_C0047 185 #define NH_3D_TEXT_MERGE 1 186 // TEXTURE MERGING CANDIDATE , JCT3V-C0137 187 // EC_MPI_ENABLING_MERGE_F0150, MPI flag in VPS and enabling in Merge mode 188 #define NH_3D_TMVP 1 // QC_TMVP_C0047 228 189 // Sony_M23639 229 190 // H_3D_TMVP_SCALING_FIX_K0053 1 // QC/CY for K0053 230 #define H_3D_DIM 1 // DIM, Depth intra modes, includes: 191 #define NH_3D_DMM 1 // Depth modeling modes 192 // HHI_DMM_PRED_TEX 231 193 // HHI_DMM_WEDGE_INTRA 232 // HHI_DMM_PRED_TEX233 194 // FIX_WEDGE_NOFLOAT_D0036 234 195 // LGE_EDGE_INTRA_A0070 235 196 // LGE_DMM3_SIMP_C0044 236 197 // QC_DC_PREDICTOR_D0183 198 // LGE_CONCATENATE_D0141 199 // PKU_QC_DEPTH_INTRA_UNI_D0195 200 // SEC_DMM2_E0146_HHIFIX Removal of DMM2 from DMMs 201 // ZJU_DEPTH_INTRA_MODE_E0204 Simplified Binarization for depth_intra_mode 202 // SCU_HS_DMM4_REMOVE_DIV_E0242 DMM4 Division Removal 203 // LGE_PKU_DMM3_OVERLAP_E0159_HHIFIX 1 Removal of overlap between DMM3 and DMM1 204 // SEC_DMM3_RBC_F0147 Removal of DMM3 and RBC from DMMs 205 // HHI_DIM_PREDSAMP_FIX_F0171 206 // QC_DIM_DELTADC_UNIFY_F0132 Unify delta DC coding in depth intra modes 207 // LGE_SIMP_DIM_NOT_PRESENT_FLAG_CODING_H0119_H0135 Use only one context for CABAC of dim_not_present_flag 208 // QC_SIMP_DELTADC_CODING_H0131 Simplify detaDC entropy coding 209 // MTK_DMM_SIMP_CODE_H0092 Remove CABAC context for DMM1 mode coding 210 // MTK_DELTA_DC_FLAG_ONE_CONTEXT_H0084_H0100_H0113 Use only one context for CABAC of delta_dc_flag as in JCTVC-H0084, JCTVC-H0100 and JCTVC-H0113 211 // HS_DMM_SIGNALLING_I0120 212 // SHARP_DMM1_I0110 LUT size reduction for DMM1 proposed in JCT3V-I0110 213 // MTK_DMM_SIM_J0035 214 // SHARP_DMM_CLEAN_K0042 1 // Generate DMM pattern with rotation 215 #define NH_3D_DLT 1 // Depth Lookup Table 237 216 // HHI_DELTADC_DLT_D0035 238 // PKU_QC_DEPTH_INTRA_UNI_D0195 217 // LGE_PRED_RES_CODING_DLT_DOMAIN_F0159 JCT3V-F0159 218 // SEC_NO_RESI_DLT_H0105 219 // MTK_DLT_CODING_FIX_H0091 220 // H_3D_DELTA_DLT 221 // RWTH_DLT_CLIP_I0057 222 // SHARP_DLT_SIMP_J0029 DLT(DepthValue2Idx[]) table derivation cleanup 223 #define NH_3D_SDC_INTRA 1 // Segment-wise DC Coding method for INTRA 224 #define NH_3D_SDC_INTER 1 // Segment-wise DC Coding method for INTER 239 225 // RWTH_SDC_DLT_B0036 240 226 // INTEL_SDC64_D0193 241 227 // RWTH_SDC_CTX_SIMPL_D0032 242 // LGE_CONCATENATE_D0141243 228 // FIX_SDC_ENC_RD_WVSO_D0163 244 229 // MTK_SAMPLE_BASED_SDC_D0110 245 // SEC_DMM2_E0146_HHIFIX Removal of DMM2 from DMMs246 // ZJU_DEPTH_INTRA_MODE_E0204 Simplified Binarization for depth_intra_mode247 230 // KWU_SDC_SIMPLE_DC_E0117 Simplified DC calculation for SDC 248 // SCU_HS_DMM4_REMOVE_DIV_E0242 DMM4 Division Removal249 231 // LGE_SDC_REMOVE_DC_E0158 Removal of DC mode from SDC 250 // LGE_PKU_DMM3_OVERLAP_E0159_HHIFIX 1 Removal of overlap between DMM3 and DMM1251 // LGE_PRED_RES_CODING_DLT_DOMAIN_F0159 JCT3V-F0159252 // HHI_DIM_PREDSAMP_FIX_F0171253 // SEC_DMM3_RBC_F0147 Removal of DMM3 and RBC from DMMs254 // QC_DIM_DELTADC_UNIFY_F0132 Unify delta DC coding in depth intra modes255 232 // Unify intra SDC and inter SDC 256 233 // QC_GENERIC_SDC_G0122 Generalize SDC to all depth intra modes … … 259 236 // QC_PKU_SDC_SPLIT_G0123 Intra SDC Split 260 237 // HS_DMM_SDC_PREDICTOR_UNIFY_H0108 Unification of DMM and SDC predictor derivation 261 // LGE_SIMP_DIM_NOT_PRESENT_FLAG_CODING_H0119_H0135 Use only one context for CABAC of dim_not_present_flag262 // QC_SIMP_DELTADC_CODING_H0131 Simplify detaDC entropy coding263 // MTK_DMM_SIMP_CODE_H0092 Remove CABAC context for DMM1 mode coding264 // MTK_DELTA_DC_FLAG_ONE_CONTEXT_H0084_H0100_H0113 Use only one context for CABAC of delta_dc_flag as in JCTVC-H0084, JCTVC-H0100 and JCTVC-H0113265 238 // MTK_SDC_FLAG_FIX_H0095 Remove conditional check of PCM flag based on SDC flag, JCTVC-H0095 266 // SEC_NO_RESI_DLT_H0105267 // MTK_DLT_CODING_FIX_H0091268 // HS_DMM_SIGNALLING_I0120269 // SHARP_DMM1_I0110 LUT size reduction for DMM1 proposed in JCT3V-I0110270 239 // FAST_SDC_OFFSET_DECISION_I0084 271 240 // SEPARATE_FLAG_I0085 272 // H_3D_DELTA_DLT273 // RWTH_DLT_CLIP_I0057274 // MTK_DMM_SIM_J0035275 241 // MTK_J0033 276 // SHARP_DLT_SIMP_J0029 DLT(DepthValue2Idx[]) table derivation cleanup277 // SHARP_DMM_CLEAN_K0042 1 // Generate DMM pattern with rotation278 #define H_3D_INTER_SDC 1 // INTER SDC, Inter simplified depth coding279 242 // LGE_INTER_SDC_E0156 Enable inter SDC for depth coding 280 243 // SEC_INTER_SDC_G0101 Improved inter SDC with multiple DC candidates 281 #define H_3D_INTER_SDC_FIX 1 282 #define H_3D_SPIVMP 1 // H_3D_SPIVMP JCT3V-F0110: Sub-PU level inter-view motion prediction 244 #define NH_3D_SPIVMP 1 // H_3D_SPIVMP JCT3V-F0110: Sub-PU level inter-view motion prediction 283 245 // SEC_SPIVMP_MCP_SIZE_G0077, Apply SPIVMP only to 2Nx2N partition, JCT3V-G0077 284 246 // QC_SPIVMP_MPI_G0119 Sub-PU level MPI merge candidate 285 247 // Simplification on Sub-PU level temporal interview motion prediction 286 248 // MPI_SUBPU_DEFAULT_MV_H0077_H0099_H0111_H0133 287 #define H_3D_DBBP 1 // DBBP: Depth-based Block Partitioning and Merging249 #define NH_3D_DBBP 1 // DBBP: Depth-based Block Partitioning and Merging 288 250 // MTK_DBBP_AMP_REM_H0072 289 251 // RWTH_DBBP_NO_SPU_H0057 … … 298 260 // RWTH_DBBP_NO_SATD_K0028 299 261 // HS_DBBP_CLEAN_K0048 300 #define H_3D_DDD 1 // Disparity derived depth coding 301 // LGE_DDD_REMOVAL_J0042_J0030 DDD removal 302 #define H_3D_DIS 1 // Depth intra skip 262 #define NH_3D_DIS 1 // Depth intra skip 303 263 // SEC_DEPTH_INTRA_SKIP_MODE_K0033 Depth intra skip mode 304 264 #define H_3D_FCO 0 // Flexible coding order for 3D 305 #define H_3D_FAST_INTRA_SDC 1 // I0123306 265 // OTHERS 307 266 // MTK_SONY_PROGRESSIVE_MV_COMPRESSION_E0170 // Progressive MV Compression, JCT3V-E0170 308 #define H_3D_FAST_TEXTURE_ENCODING 1 // Fast merge mode decision and early CU determination for texture component of dependent view, JCT3V-E0173309 267 // MTK_FAST_TEXTURE_ENCODING_E0173 310 #if H_3D_DIM311 #define H_3D_FAST_DEPTH_INTRA 1 // Fast DMM Selection312 // SCU_HS_FAST_DEPTH_INTRA_E0238_HHIFIX313 #endif314 268 //HLS 315 269 // HHI_DEPENDENCY_SIGNALLING_I1_J0107 … … 321 275 // H_3D_DIRECT_DEP_TYPE 322 276 // Rate Control 323 #define KWU_FIX_URQ 1277 #define KWU_FIX_URQ 0 324 278 #define KWU_RC_VIEWRC_E0227 0 ///< JCT3V-E0227, view-wise target bitrate allocation 325 279 #define KWU_RC_MADPRED_E0227 0 ///< JCT3V-E0227, inter-view MAD prediction 326 #endif // H_3D280 #endif // NH_3D 327 281 ///////////////////////////////////////////////////////////////////////////////////////// 328 282 /////////////////////////////////// DERIVED DEFINES /////////////////////////////////// … … 349 303 #if NH_3D_ARP 350 304 #define H_3D_ARP_WFNR 3 351 #endif352 ///// ***** DEPTH INTRA MODES *********353 #if H_3D_DIM354 // HHI_DMM4_ENC_I0066355 #define H_3D_DIM_DMM 1 // Depth Modeling Modes356 #define H_3D_DIM_SDC 1 // Simplified Depth Coding method357 #define H_3D_DIM_DLT 1 // Depth Lookup Table358 #define H_3D_DIM_ENC 1 // Depth Intra encoder optimizations, includes:359 // HHI_DEPTH_INTRA_SEARCH_RAU_C0160360 // LG_ZEROINTRADEPTHRESI_A0087361 305 #endif 362 306 ///////////////////////////////////////////////////////////////////////////////////// … … 389 333 // TBD: Check if integration is necessary. 390 334 #define H_MV_HLS_PTL_LIMITS 0 391 #define H_MV_HLS7_GEN 0 // General changes (not tested)392 // POC393 // #define H_MV_HLS_7_POC_P0041_3 0 // (POC/P0041/POC reset) #3 It was remarked that we should require each non-IRAP picture that has discardable_flag equal to 1 to have NUT value indicating that it is a sub-layer non-reference picture. This was agreed. Decision: Adopt (with constraint for discardable_flag as described above)394 // #define H_MV_HLS_7_POC_P0041_FIXES 0 // (POC/P0041/Fixes) For each non-IRAP picture that has discardable_flag equal to 1 to have NUT value indicating that it is a sub-layer non-reference picture.395 // #define H_MV_HLS_7_POC_P0056_4 0 // (POC/P0056/layer tree poc) #4 Proposal 1: If the POC reset approach is adopted as the basis for multi-layer POC derivation, it is proposed to derive the POC anchor picture from the previous TID0 picture (that is not a RASL picture, a RADL picture or a sub-layer non-reference picture and not with discardable_flag equal to 1) of the current layer or any of its reference layer. This is asserted to improve loss resilience and reduce bit rate overhead. Decision: Adopt Proposal 1 (with the suggested modifications Ewith text provided as P0297).396 // SEI related397 //#define H_MV_HLS_8_SEI_NODOC_53 0 // #53 (SEI /NODOC/Added Multiview view position SEI message) Plain copy from AVC.398 //#define H_MV_HLS_8_SEI_NODOC_52 0 // #52 (SEI /NODOC/Added Multiview acquisition information SEI) Plain copy from AVC.399 //#define H_MV_HLS_8_SEI_NODOC_51 0 // #51 (SEI /NODOC/Added Multiview scene information SEI message)400 //#define H_MV_HLS_8_SEI_Q0189_35 0 // #35 (SEI /Q0189/SEI message for indicating constraints on TMVP) Proposal 2.3, SEI message for indicating constraints on TMVP401 //#define H_MV_HLS_8_EDF_Q0116_29 0 // #29 (ED.FIX /Q0116/Recovery point SEI) , consider adding a note regarding how random accessibility is affected by the recovery point SEI message402 //#define H_MV_HLS_8_GEN_Q0183_23 0 // #23 (GEN /Q0183/SEI clean-ups) numerous small clean-ups on SEI messages.403 //#define H_MV_HLS_8_MIS_Q0247_49 0 // #49 (MISC /Q0247/frame-field information SEI message)404 //#define H_MV_HLS_8_MIS_Q0189_34 0 // #34 (MISC /Q0189/slice temporal mvp enabled flag) Proposal 2.2, clarification of semantics of slice temporal mvp enabled flag405 //#define H_MV_HLS_8_EDF_Q0081_01 0 // #1 (ED.FIX /Q0081/alpha channel persist) On reuse of alpha planes in auxiliary pictures. It was asked why there would not be a presumption that the alpha channel content would simply persist, without needing the flag to indicate it. Decision (Ed.): Delegated to editors to clarify, as necessary, that the alpha channel content persists until cancelled or updated in output order.406 //#define H_MV_HLS_8_SEI_Q0253_37 0 // #37 (SEI /Q0253/layer not present), modified semantics of layers not present SEI message to correct bug introduced during editing407 //#define H_MV_HLS_8_SEI_Q0045_11 0 // #11 (SEI /Q0045/Overlay) Proposal for an SEI message on selectable overlays. Decision: Adopt (modified for variable-length strings).408 //#define H_MV_HLS_7_SEI_P0133_28 0 // (SEI/P0133/Recovery point SEI) #28 Decision: Adopt change to recover point semantics only (-v3)409 //#define H_MV_HLS_7_SEI_P0123_25 0 // (SEI/P0123/Alpha channel info) #25 Add alpha channel information SEI message Decision: Adopt. Constrain the bit depth indicated to be equal to the coded bit depth of the aux picture.410 // DPB411 //#define H_MV_HLS_8_HRD_Q0102_09 0 // #9 (HRD /Q0102/NoOutputOfPriorPicsFlag) It was suggested that also the separate_colour_plane_flag should affect inference of NoOutputOfPriorPicsFlag. Decision (Ed.): Agreed (affects RExt text).412 //#define H_MV_HLS_8_DBP_Q0154_38 0 // #38 (DBP /Q0154/VPS DPB) Proposal in C.5.2.1: Add in the decoding process that when a new VPS is activated, all pictures in the DPB are marked as unused for reference413 //#define H_MV_HLS_8_HRD_Q0154_10 0 // #10 (HRD /Q0154/DPB Flushing and parameters) On picture flushing and DPB parameters Decision: Adopted (some details to be discussed further in BoG).414 //#define H_MV_HLS_7_OTHER_P0187_1 0 // (OTHER/P0187/NoOutputOfPriorPicsFlag) #1 Inference of NoOutputOfPriorPicsFlag and proposes to take into account colour format and bit depth for the inference in addition to spatial resolution415 // OTHERS416 //#define H_MV_HLS_8_HSB_Q0041_03 0 // #3 (HS /Q0041/hybrid scalability) The proposed text was endorsed, with non-editorial open issues considered as follows ?// #define H_MV_HLS_7_OTHER_P0187_1 0 // (OTHER/P0187/NoOutputOfPriorPicsFlag) #1 Inference of NoOutputOfPriorPicsFlag and proposes to take into account colour format and bit depth for the inference in addition to spatial resolution417 //#define H_MV_HLS_8_MIS_Q0078_24 0 // #24 (MISC /Q0078/scan and pic type) , Items 3 b,c and 4, clarifying which pictures in an output layer sets are applied the values of general_progressive_source_flag, general_interlaced_source_flag, general_non_packed_constraint_flag and general_frame_only_constraint_flag.418 //#define H_MV_HLS_7_HRD_P0138_6 0 // (HRD/P0138/HRD parameters for bitstreams excluding) #6 Decision: Adopt (as revised in updated contribution, with the specification of a flag in the BP SEI (HRD/P0192/sub-DPB) #12 Establish sub-DPBs based on the representation format indicated at the VPS level. It was suggested that the expressed shared capacity limit would need to be less than or equal to the sum of the individual capacity limits. Decision: Adopt as modified. Further study is encouraged on profile/level constraint selections.419 335 ///////////////////////////////////////////////////////////////////////////////////////// 420 336 /////////////////////////////////// HM RELATED DEFINES //////////////////////////////// … … 871 787 #define NUM_SAO_BO_CLASSES_LOG2 5 872 788 #define NUM_SAO_BO_CLASSES (1<<NUM_SAO_BO_CLASSES_LOG2) 789 #if NH_MV 790 enum DecodingProcess 791 { 792 INVALID, 793 CLAUSE_8, 794 ANNEX_C, 795 ANNEX_F, 796 ANNEX_G, 797 ANNEX_H, 798 ANNEX_I 799 }; 800 #endif 873 801 namespace Profile 874 802 { … … 1017 945 AUX_ID = 3, 1018 946 }; 947 enum DecProcPart 948 { 949 START_PIC, 950 FINALIZE_PIC 951 }; 1019 952 #endif 1020 953 #if NH_3D -
branches/HTM-15.0-dev0/source/Lib/TLibDecoder/TDecCAVLC.cpp
r1313 r1317 66 66 fprintf( g_hTrace, "=========== Picture Parameter Set ===========\n"); 67 67 } 68 69 Void xTraceSliceHeader () 70 { 71 fprintf( g_hTrace, "=========== Slice ===========\n"); 72 } 73 68 74 #endif 69 75 #endif … … 85 91 // ==================================================================================================================== 86 92 93 #if NH_MV 94 Void TDecCavlc::parseShortTermRefPicSet( TComSPS* sps, TComStRefPicSet* stRps, Int stRpsIdx ) 95 { 96 UInt uiCode; 97 if( stRpsIdx != 0 ) 98 { 99 READ_FLAG( uiCode, "inter_ref_pic_set_prediction_flag" ); stRps->setInterRefPicSetPredictionFlag( uiCode == 1 ); 100 } 101 if( stRps->getInterRefPicSetPredictionFlag() ) 102 { 103 if( stRpsIdx == sps->getNumShortTermRefPicSets() ) 104 { 105 READ_UVLC( uiCode, "delta_idx_minus1" ); stRps->setDeltaIdxMinus1( uiCode ); 106 } 107 READ_FLAG( uiCode, "delta_rps_sign" ); stRps->setDeltaRpsSign( uiCode == 1 ); 108 READ_UVLC( uiCode, "abs_delta_rps_minus1" ); stRps->setAbsDeltaRpsMinus1( uiCode ); 109 for( Int j = 0; j <= sps->getStRefPicSet( stRps->getRefRpsIdx( stRpsIdx ) )->getNumDeltaPocs() ; j++ ) 110 { 111 READ_FLAG( uiCode, "used_by_curr_pic_flag" ); stRps->setUsedByCurrPicFlag( j, uiCode == 1 ); 112 if( !stRps->getUsedByCurrPicFlag( j ) ) 113 { 114 READ_FLAG( uiCode, "use_delta_flag" ); stRps->setUseDeltaFlag( j, uiCode == 1 ); 115 } 116 } 117 } 118 else 119 { 120 READ_UVLC( uiCode, "num_negative_pics" ); stRps->setNumNegativePics( uiCode ); 121 READ_UVLC( uiCode, "num_positive_pics" ); stRps->setNumPositivePics( uiCode ); 122 for( Int i = 0; i < stRps->getNumNegativePics( ); i++ ) 123 { 124 READ_UVLC( uiCode, "delta_poc_s0_minus1" ); stRps->setDeltaPocS0Minus1( i, uiCode ); 125 READ_FLAG( uiCode, "used_by_curr_pic_s0_flag" ); stRps->setUsedByCurrPicS0Flag( i, uiCode == 1 ); 126 } 127 for( Int i = 0; i < stRps->getNumPositivePics( ); i++ ) 128 { 129 READ_UVLC( uiCode, "delta_poc_s1_minus1" ); stRps->setDeltaPocS1Minus1( i, uiCode ); 130 READ_FLAG( uiCode, "used_by_curr_pic_s1_flag" ); stRps->setUsedByCurrPicS1Flag( i, uiCode == 1 ); 131 } 132 } 133 stRps->inferRps( stRpsIdx, sps, false ); 134 } 135 #else 87 136 Void TDecCavlc::parseShortTermRefPicSet( TComSPS* sps, TComReferencePictureSet* rps, Int idx ) 88 137 { … … 180 229 #endif 181 230 } 231 #endif 182 232 183 233 Void TDecCavlc::parsePPS(TComPPS* pcPPS) … … 507 557 { 508 558 READ_CODE(6, uiCode, "pps_depth_layers_minus1"); 509 #if NH_3D_VER141_DEC_COMP_FLAG510 pcDLT->setNumDepthViews( uiCode );511 #else512 559 pcDLT->setNumDepthViews( uiCode+1 ); 513 #endif514 560 515 561 READ_CODE(4, uiCode, "pps_bit_depth_for_depth_layers_minus8"); 516 562 pcDLT->setDepthViewBitDepth( (uiCode+8) ); 517 563 518 #if NH_3D_DLT_FIX519 564 for( Int i = 0; i <= pcDLT->getNumDepthViews()-1; i++ ) 520 #else521 for( Int i = 0; i <= pcDLT->getNumDepthViews(); i++ )522 #endif523 565 { 524 566 Int layerId = pcDLT->getDepthIdxToLayerId(i); … … 866 908 #if NH_MV 867 909 pcSPS->getPTL()->inferGeneralValues ( true, 0, NULL ); 868 pcSPS->getPTL()->inferSubLayerValues( pcSPS->get MaxTLayers() - 1, 0, NULL );910 pcSPS->getPTL()->inferSubLayerValues( pcSPS->getSpsMaxSubLayersMinus1(), 0, NULL ); 869 911 } 870 912 #endif … … 972 1014 pcSPS->setNumReorderPics(uiCode, i); 973 1015 READ_UVLC ( uiCode, "sps_max_latency_increase_plus1[i]"); 1016 #if NH_MV 1017 pcSPS->setSpsMaxLatencyIncreasePlus1( uiCode, i ); 1018 #else 974 1019 pcSPS->setMaxLatencyIncrease( uiCode, i ); 1020 #endif 975 1021 976 1022 if (!subLayerOrderingInfoPresentFlag) … … 980 1026 pcSPS->setMaxDecPicBuffering(pcSPS->getMaxDecPicBuffering(0), i); 981 1027 pcSPS->setNumReorderPics(pcSPS->getNumReorderPics(0), i); 1028 #if NH_MV 1029 pcSPS->setSpsMaxLatencyIncreasePlus1(pcSPS->getSpsMaxLatencyIncreasePlus1(0), i); 1030 #else 982 1031 pcSPS->setMaxLatencyIncrease(pcSPS->getMaxLatencyIncrease(0), i); 1032 #endif 983 1033 } 984 1034 break; … … 1053 1103 1054 1104 READ_UVLC( uiCode, "num_short_term_ref_pic_sets" ); 1105 1055 1106 assert(uiCode <= 64); 1107 #if NH_MV 1108 pcSPS->setNumShortTermRefPicSets( uiCode ); 1109 pcSPS->initStRefPicSets(); 1110 1111 for(Int i=0; i< pcSPS->getNumShortTermRefPicSets(); i++ ) 1112 { 1113 parseShortTermRefPicSet(pcSPS,pcSPS->getStRefPicSet(i),i); 1114 } 1115 1116 READ_FLAG( uiCode, "long_term_ref_pics_present_flag" ); pcSPS->setLongTermRefPicsPresentFlag(uiCode); 1117 if (pcSPS->getLongTermRefPicsPresentFlag() ) 1118 #else 1056 1119 pcSPS->createRPSList(uiCode); 1057 1120 … … 1064 1127 parseShortTermRefPicSet(pcSPS,rps,i); 1065 1128 } 1129 1066 1130 READ_FLAG( uiCode, "long_term_ref_pics_present_flag" ); pcSPS->setLongTermRefsPresent(uiCode); 1067 1131 if (pcSPS->getLongTermRefsPresent()) 1132 #endif 1068 1133 { 1069 1134 READ_UVLC( uiCode, "num_long_term_ref_pics_sps" ); … … 2149 2214 #endif 2150 2215 2216 #if NH_MV 2217 Void TDecCavlc::parseFirstSliceSegmentInPicFlag(TComSlice* pcSlice ) 2218 { 2219 #if ENC_DEC_TRACE 2220 #if NH_MV 2221 tracePSHeader( "Slice", pcSlice->getLayerId() ); 2222 #else 2223 xTraceSliceHeader(); 2224 #endif 2225 #endif 2226 2227 UInt uiCode; 2228 READ_FLAG( uiCode, "first_slice_segment_in_pic_flag" ); 2229 pcSlice->setFirstSliceSegementInPicFlag( uiCode ); 2230 } 2231 2232 Void TDecCavlc::parseSliceHeader (TComSlice* pcSlice, ParameterSetManager *parameterSetManager ) 2233 #else 2151 2234 Void TDecCavlc::parseSliceHeader (TComSlice* pcSlice, ParameterSetManager *parameterSetManager, const Int prevTid0POC) 2235 #endif 2152 2236 { 2153 2237 UInt uiCode; 2154 2238 Int iCode; 2155 2239 2240 #if !NH_MV 2156 2241 #if ENC_DEC_TRACE 2157 #if NH_MV2158 tracePSHeader( "Slice", pcSlice->getLayerId() );2159 #else2160 2242 xTraceSliceHeader(); 2161 2243 #endif … … 2167 2249 #endif 2168 2250 2251 #if NH_MV 2252 // This has been parsed before in parseFirstSliceSegmentFlag(TComSlice* pcSlice ) 2253 UInt firstSliceSegmentInPic = pcSlice->getFirstSliceSegementInPicFlag(); 2254 #else 2169 2255 UInt firstSliceSegmentInPic; 2170 2256 READ_FLAG( firstSliceSegmentInPic, "first_slice_segment_in_pic_flag" ); 2257 #endif 2171 2258 if( pcSlice->getRapPicFlag()) 2172 2259 { … … 2184 2271 vps = parameterSetManager->getVPS(sps->getVPSId()); 2185 2272 assert( vps != NULL ); 2273 2186 2274 m_decTop->initFromActiveVps( vps ); 2275 2276 if ( !m_decTop->getIsInOwnTargetDecLayerIdList() ) 2277 { 2278 return; 2279 } 2280 2281 pcSlice->setDecodingProcess( m_decTop->getDecodingProcess() ); 2187 2282 Int targetOlsIdx = m_decTop->getTargetOlsIdx(); 2188 2283 … … 2241 2336 pcSlice->setSliceSegmentCurStartCtuTsAddr( sliceSegmentAddress );// this is actually a Raster-Scan (RS) address, but we do not have the RS->TS conversion table defined yet. 2242 2337 pcSlice->setSliceSegmentCurEndCtuTsAddr(numCTUs); // Set end as the last CTU of the picture. 2243 2244 #if NH_MV2245 UInt slicePicOrderCntLsb = 0;2246 #endif2247 2338 2248 2339 … … 2303 2394 2304 2395 #if NH_MV 2305 Int iPOClsb = slicePicOrderCntLsb; // Needed later2306 2396 if ( (pcSlice->getLayerId() > 0 && !vps->getPocLsbNotPresentFlag( pcSlice->getLayerIdInVps())) || !pcSlice->getIdrPicFlag() ) 2307 2397 { 2308 READ_CODE(sps->getBitsForPOC(), slicePicOrderCntLsb, "slice_pic_order_cnt_lsb"); 2309 } 2310 pcSlice->setSlicePicOrderCntLsb( slicePicOrderCntLsb ); 2311 2312 Bool picOrderCntMSBZeroFlag = false; 2313 2314 // as in HM code. However are all cases for IRAP picture with NoRaslOutputFlag equal to 1 covered?? 2315 picOrderCntMSBZeroFlag = picOrderCntMSBZeroFlag || ( pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP ); 2316 picOrderCntMSBZeroFlag = picOrderCntMSBZeroFlag || ( pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL ); 2317 picOrderCntMSBZeroFlag = picOrderCntMSBZeroFlag || ( pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ); 2318 picOrderCntMSBZeroFlag = picOrderCntMSBZeroFlag || pcSlice->getIdrPicFlag(); 2319 2320 // TBD picOrderCntMSBZeroFlag = picOrderCntMSBZeroFlag || ( rpcSlice->getLayerId() > 0 && !rpcSlice->getFirstPicInLayerDecodedFlag() ); 2321 2322 Int picOrderCntMSB = 0; 2323 2324 if ( !picOrderCntMSBZeroFlag ) 2325 { 2326 Int prevPicOrderCnt = prevTid0POC; 2327 Int maxPicOrderCntLsb = 1 << sps->getBitsForPOC(); 2328 Int prevPicOrderCntLsb = prevPicOrderCnt & (maxPicOrderCntLsb - 1); 2329 Int prevPicOrderCntMsb = prevPicOrderCnt - prevPicOrderCntLsb; 2330 2331 if( ( slicePicOrderCntLsb < prevPicOrderCntLsb ) && ( ( prevPicOrderCntLsb - slicePicOrderCntLsb ) >= ( maxPicOrderCntLsb / 2 ) ) ) 2332 { 2333 picOrderCntMSB = prevPicOrderCntMsb + maxPicOrderCntLsb; 2334 } 2335 else if( (slicePicOrderCntLsb > prevPicOrderCntLsb ) && ( (slicePicOrderCntLsb - prevPicOrderCntLsb ) > ( maxPicOrderCntLsb / 2 ) ) ) 2336 { 2337 picOrderCntMSB = prevPicOrderCntMsb - maxPicOrderCntLsb; 2338 } 2339 else 2340 { 2341 picOrderCntMSB = prevPicOrderCntMsb; 2342 } 2343 } 2344 2345 pcSlice->setPOC( picOrderCntMSB + slicePicOrderCntLsb ); 2346 if ( pcSlice->getPocResetFlag() ) 2347 { 2348 pcSlice->setPocBeforeReset ( pcSlice->getPOC() ); 2349 pcSlice->setPOC ( 0 ); 2350 } 2351 #endif 2352 2353 if( pcSlice->getIdrPicFlag() ) 2354 { 2355 #if !NH_MV 2356 pcSlice->setPOC(0); 2357 #endif 2358 TComReferencePictureSet* rps = pcSlice->getLocalRPS(); 2359 (*rps)=TComReferencePictureSet(); 2360 pcSlice->setRPS(rps); 2361 #if NH_MV 2362 pcSlice->setEnableTMVPFlag(false); 2363 #endif 2364 } 2398 READ_CODE(sps->getBitsForPOC(), uiCode, "slice_pic_order_cnt_lsb"); pcSlice->setSlicePicOrderCntLsb( uiCode ); 2399 } 2365 2400 else 2366 2401 { 2367 #if !NH_MV 2368 READ_CODE(sps->getBitsForPOC(), uiCode, "slice_pic_order_cnt_lsb"); 2369 Int iPOClsb = uiCode; 2370 Int iPrevPOC = prevTid0POC; 2371 Int iMaxPOClsb = 1<< sps->getBitsForPOC(); 2372 Int iPrevPOClsb = iPrevPOC & (iMaxPOClsb - 1); 2373 Int iPrevPOCmsb = iPrevPOC-iPrevPOClsb; 2374 Int iPOCmsb; 2375 if( ( iPOClsb < iPrevPOClsb ) && ( ( iPrevPOClsb - iPOClsb ) >= ( iMaxPOClsb / 2 ) ) ) 2376 { 2377 iPOCmsb = iPrevPOCmsb + iMaxPOClsb; 2378 } 2379 else if( (iPOClsb > iPrevPOClsb ) && ( (iPOClsb - iPrevPOClsb ) > ( iMaxPOClsb / 2 ) ) ) 2380 { 2381 iPOCmsb = iPrevPOCmsb - iMaxPOClsb; 2382 } 2383 else 2384 { 2385 iPOCmsb = iPrevPOCmsb; 2386 } 2387 if ( pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 2388 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL 2389 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) 2390 { 2391 // For BLA picture types, POCmsb is set to 0. 2392 iPOCmsb = 0; 2393 } 2394 pcSlice->setPOC (iPOCmsb+iPOClsb); 2395 #endif 2396 TComReferencePictureSet* rps; 2397 rps = pcSlice->getLocalRPS(); 2398 (*rps)=TComReferencePictureSet(); 2399 2400 pcSlice->setRPS(rps); 2401 READ_FLAG( uiCode, "short_term_ref_pic_set_sps_flag" ); 2402 if(uiCode == 0) // use short-term reference picture set explicitly signalled in slice header 2403 { 2404 parseShortTermRefPicSet(sps,rps, sps->getRPSList()->getNumberOfReferencePictureSets()); 2405 #if NH_MV 2406 if ( !rps->getInterRPSPrediction( ) ) 2407 { // check sum of num_positive_pics and num_negative_pics 2408 rps->checkMaxNumPics( 2409 vps->getVpsExtensionFlag(), 2410 MAX_INT, // To be replaced by MaxDbpSize 2411 pcSlice->getLayerId(), 2412 sps->getMaxDecPicBuffering( sps->getSpsMaxSubLayersMinus1() ) - 1 ); 2413 } 2414 #endif 2415 2416 } 2417 else // use reference to short-term reference picture set in PPS 2418 { 2419 Int numBits = 0; 2420 while ((1 << numBits) < sps->getRPSList()->getNumberOfReferencePictureSets()) 2421 { 2422 numBits++; 2423 } 2424 if (numBits > 0) 2425 { 2426 READ_CODE( numBits, uiCode, "short_term_ref_pic_set_idx"); 2427 } 2428 else 2429 { 2430 uiCode = 0; 2431 2432 } 2433 *rps = *(sps->getRPSList()->getReferencePictureSet(uiCode)); 2434 } 2435 if(sps->getLongTermRefsPresent()) 2436 { 2437 Int offset = rps->getNumberOfNegativePictures()+rps->getNumberOfPositivePictures(); 2438 UInt numOfLtrp = 0; 2439 UInt numLtrpInSPS = 0; 2440 if (sps->getNumLongTermRefPicSPS() > 0) 2441 { 2442 READ_UVLC( uiCode, "num_long_term_sps"); 2443 numLtrpInSPS = uiCode; 2444 numOfLtrp += numLtrpInSPS; 2445 rps->setNumberOfLongtermPictures(numOfLtrp); 2446 } 2447 Int bitsForLtrpInSPS = 0; 2448 while (sps->getNumLongTermRefPicSPS() > (1 << bitsForLtrpInSPS)) 2449 { 2450 bitsForLtrpInSPS++; 2451 } 2452 READ_UVLC( uiCode, "num_long_term_pics"); rps->setNumberOfLongtermPictures(uiCode); 2453 numOfLtrp += uiCode; 2454 rps->setNumberOfLongtermPictures(numOfLtrp); 2455 Int maxPicOrderCntLSB = 1 << sps->getBitsForPOC(); 2456 Int prevDeltaMSB = 0, deltaPocMSBCycleLT = 0; 2457 for(Int j=offset+rps->getNumberOfLongtermPictures()-1, k = 0; k < numOfLtrp; j--, k++) 2458 { 2459 Int pocLsbLt; 2460 if (k < numLtrpInSPS) 2402 pcSlice->setSlicePicOrderCntLsb( 0 ); 2403 } 2404 2405 if( pcSlice->getNalUnitType() != NAL_UNIT_CODED_SLICE_IDR_W_RADL && pcSlice->getNalUnitType() != NAL_UNIT_CODED_SLICE_IDR_N_LP ) 2406 { 2407 READ_FLAG( uiCode, "short_term_ref_pic_set_sps_flag" ); pcSlice->setShortTermRefPicSetSpsFlag( uiCode == 1 ); 2408 if( !pcSlice->getShortTermRefPicSetSpsFlag() ) 2409 { 2410 parseShortTermRefPicSet( sps, pcSlice->getLocalStRps( ), sps->getNumShortTermRefPicSets() ); 2411 } 2412 else if( sps->getNumShortTermRefPicSets() > 1 ) 2413 { 2414 READ_CODE( pcSlice->getShortTermRefPicSetIdxLen() , uiCode, "short_term_ref_pic_set_idx" ); pcSlice->setShortTermRefPicSetIdx( uiCode ); 2415 } 2416 if( sps->getLongTermRefPicsPresentFlag() ) 2417 { 2418 if( sps->getNumLongTermRefPicsSps() > 0 ) 2419 { 2420 READ_UVLC( uiCode, "num_long_term_sps" ); pcSlice->setNumLongTermSps( uiCode ); 2421 } 2422 READ_UVLC( uiCode, "num_long_term_pics" ); pcSlice->setNumLongTermPics( uiCode ); 2423 for( Int i = 0; i < pcSlice->getNumLongTermSps() + pcSlice->getNumLongTermPics( ); i++ ) 2424 { 2425 if( i < pcSlice->getNumLongTermSps() ) 2461 2426 { 2462 uiCode = 0; 2463 if (bitsForLtrpInSPS > 0) 2427 if( sps->getNumLongTermRefPicsSps() > 1 ) 2464 2428 { 2465 READ_CODE( bitsForLtrpInSPS, uiCode, "lt_idx_sps[i]");2429 READ_CODE( pcSlice->getLtIdxSpsLen() , uiCode, "lt_idx_sps" ); pcSlice->setLtIdxSps( i, uiCode ); 2466 2430 } 2467 Bool usedByCurrFromSPS=sps->getUsedByCurrPicLtSPSFlag(uiCode);2468 2469 pocLsbLt = sps->getLtRefPicPocLsbSps(uiCode);2470 rps->setUsed(j,usedByCurrFromSPS);2471 2431 } 2472 2432 else 2473 2433 { 2474 READ_CODE( sps->getBitsForPOC(), uiCode, "poc_lsb_lt"); pocLsbLt= uiCode;2475 READ_FLAG( uiCode, "used_by_curr_pic_lt_flag" ); rps->setUsed(j,uiCode);2434 READ_CODE( pcSlice->getPocLsbLtLen() , uiCode, "poc_lsb_lt" ); pcSlice->setPocLsbLt( i, uiCode ); 2435 READ_FLAG( uiCode, "used_by_curr_pic_lt_flag" ); pcSlice->setUsedByCurrPicLtFlag( i, uiCode == 1 ); 2476 2436 } 2477 READ_FLAG(uiCode,"delta_poc_msb_present_flag"); 2478 Bool mSBPresentFlag = uiCode ? true : false; 2479 if(mSBPresentFlag) 2437 READ_FLAG( uiCode, "delta_poc_msb_present_flag" ); pcSlice->setDeltaPocMsbPresentFlag( i, uiCode == 1 ); 2438 if( pcSlice->getDeltaPocMsbPresentFlag( i ) ) 2480 2439 { 2481 READ_UVLC( uiCode, "delta_poc_msb_cycle_lt[i]" ); 2482 Bool deltaFlag = false; 2483 // First LTRP || First LTRP from SH 2484 if( (j == offset+rps->getNumberOfLongtermPictures()-1) || (j == offset+(numOfLtrp-numLtrpInSPS)-1) ) 2485 { 2486 deltaFlag = true; 2487 } 2488 if(deltaFlag) 2489 { 2490 deltaPocMSBCycleLT = uiCode; 2491 } 2492 else 2493 { 2494 deltaPocMSBCycleLT = uiCode + prevDeltaMSB; 2495 } 2496 2497 Int pocLTCurr = pcSlice->getPOC() - deltaPocMSBCycleLT * maxPicOrderCntLSB 2498 - iPOClsb + pocLsbLt; 2499 rps->setPOC (j, pocLTCurr); 2500 rps->setDeltaPOC(j, - pcSlice->getPOC() + pocLTCurr); 2501 rps->setCheckLTMSBPresent(j,true); 2440 READ_UVLC( uiCode, "delta_poc_msb_cycle_lt" ); pcSlice->setDeltaPocMsbCycleLt( i, uiCode ); 2502 2441 } 2503 else 2504 { 2442 } 2443 } 2444 if( sps->getSpsTemporalMvpEnabledFlag() ) 2445 { 2446 READ_FLAG( uiCode, "slice_temporal_mvp_enabled_flag" ); pcSlice->setSliceTemporalMvpEnabledFlag( uiCode == 1 ); 2447 } 2448 } 2449 #else 2450 if( pcSlice->getIdrPicFlag() ) 2451 { 2452 pcSlice->setPOC(0); 2453 TComReferencePictureSet* rps = pcSlice->getLocalRPS(); 2454 (*rps)=TComReferencePictureSet(); 2455 pcSlice->setRPS(rps); 2456 } 2457 else 2458 { 2459 READ_CODE(sps->getBitsForPOC(), uiCode, "slice_pic_order_cnt_lsb"); 2460 Int iPOClsb = uiCode; 2461 Int iPrevPOC = prevTid0POC; 2462 Int iMaxPOClsb = 1<< sps->getBitsForPOC(); 2463 Int iPrevPOClsb = iPrevPOC & (iMaxPOClsb - 1); 2464 Int iPrevPOCmsb = iPrevPOC-iPrevPOClsb; 2465 Int iPOCmsb; 2466 if( ( iPOClsb < iPrevPOClsb ) && ( ( iPrevPOClsb - iPOClsb ) >= ( iMaxPOClsb / 2 ) ) ) 2467 { 2468 iPOCmsb = iPrevPOCmsb + iMaxPOClsb; 2469 } 2470 else if( (iPOClsb > iPrevPOClsb ) && ( (iPOClsb - iPrevPOClsb ) > ( iMaxPOClsb / 2 ) ) ) 2471 { 2472 iPOCmsb = iPrevPOCmsb - iMaxPOClsb; 2473 } 2474 else 2475 { 2476 iPOCmsb = iPrevPOCmsb; 2477 } 2478 if ( pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 2479 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL 2480 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) 2481 { 2482 // For BLA picture types, POCmsb is set to 0. 2483 iPOCmsb = 0; 2484 } 2485 pcSlice->setPOC (iPOCmsb+iPOClsb); 2486 2487 TComReferencePictureSet* rps; 2488 rps = pcSlice->getLocalRPS(); 2489 (*rps)=TComReferencePictureSet(); 2490 2491 pcSlice->setRPS(rps); 2492 READ_FLAG( uiCode, "short_term_ref_pic_set_sps_flag" ); 2493 if(uiCode == 0) // use short-term reference picture set explicitly signalled in slice header 2494 { 2495 parseShortTermRefPicSet(sps,rps, sps->getRPSList()->getNumberOfReferencePictureSets()); 2496 } 2497 else // use reference to short-term reference picture set in PPS 2498 { 2499 Int numBits = 0; 2500 while ((1 << numBits) < sps->getRPSList()->getNumberOfReferencePictureSets()) 2501 { 2502 numBits++; 2503 } 2504 if (numBits > 0) 2505 { 2506 READ_CODE( numBits, uiCode, "short_term_ref_pic_set_idx"); 2507 } 2508 else 2509 { 2510 uiCode = 0; 2511 } 2512 *rps = *(sps->getRPSList()->getReferencePictureSet(uiCode)); 2513 } 2514 if(sps->getLongTermRefsPresent()) 2515 { 2516 Int offset = rps->getNumberOfNegativePictures()+rps->getNumberOfPositivePictures(); 2517 UInt numOfLtrp = 0; 2518 UInt numLtrpInSPS = 0; 2519 if (sps->getNumLongTermRefPicSPS() > 0) 2520 { 2521 READ_UVLC( uiCode, "num_long_term_sps"); 2522 numLtrpInSPS = uiCode; 2523 numOfLtrp += numLtrpInSPS; 2524 rps->setNumberOfLongtermPictures(numOfLtrp); 2525 } 2526 Int bitsForLtrpInSPS = 0; 2527 while (sps->getNumLongTermRefPicSPS() > (1 << bitsForLtrpInSPS)) 2528 { 2529 bitsForLtrpInSPS++; 2530 } 2531 READ_UVLC( uiCode, "num_long_term_pics"); rps->setNumberOfLongtermPictures(uiCode); 2532 numOfLtrp += uiCode; 2533 rps->setNumberOfLongtermPictures(numOfLtrp); 2534 Int maxPicOrderCntLSB = 1 << sps->getBitsForPOC(); 2535 Int prevDeltaMSB = 0, deltaPocMSBCycleLT = 0; 2536 for(Int j=offset+rps->getNumberOfLongtermPictures()-1, k = 0; k < numOfLtrp; j--, k++) 2537 { 2538 Int pocLsbLt; 2539 if (k < numLtrpInSPS) 2540 { 2541 uiCode = 0; 2542 if (bitsForLtrpInSPS > 0) 2543 { 2544 READ_CODE(bitsForLtrpInSPS, uiCode, "lt_idx_sps[i]"); 2545 } 2546 Bool usedByCurrFromSPS=sps->getUsedByCurrPicLtSPSFlag(uiCode); 2547 2548 pocLsbLt = sps->getLtRefPicPocLsbSps(uiCode); 2549 rps->setUsed(j,usedByCurrFromSPS); 2550 } 2551 else 2552 { 2553 READ_CODE(sps->getBitsForPOC(), uiCode, "poc_lsb_lt"); pocLsbLt= uiCode; 2554 READ_FLAG( uiCode, "used_by_curr_pic_lt_flag"); rps->setUsed(j,uiCode); 2555 } 2556 READ_FLAG(uiCode,"delta_poc_msb_present_flag"); 2557 Bool mSBPresentFlag = uiCode ? true : false; 2558 if(mSBPresentFlag) 2559 { 2560 READ_UVLC( uiCode, "delta_poc_msb_cycle_lt[i]" ); 2561 Bool deltaFlag = false; 2562 // First LTRP || First LTRP from SH 2563 if( (j == offset+rps->getNumberOfLongtermPictures()-1) || (j == offset+(numOfLtrp-numLtrpInSPS)-1) ) 2564 { 2565 deltaFlag = true; 2566 } 2567 if(deltaFlag) 2568 { 2569 deltaPocMSBCycleLT = uiCode; 2570 } 2571 else 2572 { 2573 deltaPocMSBCycleLT = uiCode + prevDeltaMSB; 2574 } 2575 2576 Int pocLTCurr = pcSlice->getPOC() - deltaPocMSBCycleLT * maxPicOrderCntLSB 2577 - iPOClsb + pocLsbLt; 2578 rps->setPOC (j, pocLTCurr); 2579 rps->setDeltaPOC(j, - pcSlice->getPOC() + pocLTCurr); 2580 rps->setCheckLTMSBPresent(j,true); 2581 } 2582 else 2583 { 2505 2584 rps->setPOC (j, pocLsbLt); 2506 2585 rps->setDeltaPOC(j, - pcSlice->getPOC() + pocLsbLt); 2507 rps->setCheckLTMSBPresent(j,false); 2508 2509 // reset deltaPocMSBCycleLT for first LTRP from slice header if MSB not present 2510 if( j == offset+(numOfLtrp-numLtrpInSPS)-1 ) 2511 { 2512 deltaPocMSBCycleLT = 0; 2513 } 2514 } 2515 prevDeltaMSB = deltaPocMSBCycleLT; 2516 } 2517 offset += rps->getNumberOfLongtermPictures(); 2518 rps->setNumberOfPictures(offset); 2519 } 2520 #if NH_MV 2521 if ( !rps->getInterRPSPrediction( ) ) 2522 { // check sum of NumPositivePics, NumNegativePics, num_long_term_sps and num_long_term_pics 2523 rps->checkMaxNumPics( 2524 vps->getVpsExtensionFlag(), 2525 MAX_INT, // To be replaced by MaxDbpsize 2526 pcSlice->getLayerId(), 2527 sps->getMaxDecPicBuffering( sps->getSpsMaxSubLayersMinus1() ) - 1 ); 2528 } 2529 #endif 2530 2531 if ( pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 2532 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL 2533 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) 2534 { 2535 // In the case of BLA picture types, rps data is read from slice header but ignored 2536 rps = pcSlice->getLocalRPS(); 2537 (*rps)=TComReferencePictureSet(); 2538 pcSlice->setRPS(rps); 2539 } 2540 if (sps->getTMVPFlagsPresent()) 2541 { 2542 #if NH_MV 2543 READ_FLAG( uiCode, "slice_temporal_mvp_enabled_flag" ); 2544 #else 2545 READ_FLAG( uiCode, "slice_temporal_mvp_enabled_flag" ); 2546 #endif 2547 pcSlice->setEnableTMVPFlag( uiCode == 1 ? true : false ); 2548 } 2549 else 2550 { 2551 pcSlice->setEnableTMVPFlag(false); 2552 } 2553 } 2586 rps->setCheckLTMSBPresent(j,false); 2587 2588 // reset deltaPocMSBCycleLT for first LTRP from slice header if MSB not present 2589 if( j == offset+(numOfLtrp-numLtrpInSPS)-1 ) 2590 { 2591 deltaPocMSBCycleLT = 0; 2592 } 2593 } 2594 prevDeltaMSB = deltaPocMSBCycleLT; 2595 } 2596 offset += rps->getNumberOfLongtermPictures(); 2597 rps->setNumberOfPictures(offset); 2598 } 2599 2600 if ( pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 2601 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL 2602 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) 2603 { 2604 // In the case of BLA picture types, rps data is read from slice header but ignored 2605 rps = pcSlice->getLocalRPS(); 2606 (*rps)=TComReferencePictureSet(); 2607 pcSlice->setRPS(rps); 2608 } 2609 if (sps->getTMVPFlagsPresent()) 2610 { 2611 READ_FLAG( uiCode, "slice_temporal_mvp_enabled_flag" ); 2612 pcSlice->setEnableTMVPFlag( uiCode == 1 ? true : false ); 2613 } 2614 else 2615 { 2616 pcSlice->setEnableTMVPFlag(false); 2617 } 2618 } 2619 #endif 2620 2554 2621 #if NH_MV 2555 2622 Bool interLayerPredLayerIdcPresentFlag = false; … … 2649 2716 } 2650 2717 // } 2718 #if NH_MV 2719 2720 const Int numPicTotalCurr = pcSlice->getNumPicTotalCurr(); 2721 if( pcSlice->getSliceType() == P_SLICE || pcSlice->getSliceType() == B_SLICE ) 2722 { 2723 if( pps->getListsModificationPresentFlag() && numPicTotalCurr > 1 ) 2724 { 2725 TComRefPicListModification* rplMod = pcSlice->getRefPicListModification(); 2726 READ_FLAG( uiCode, "ref_pic_list_modification_flag_l0" ); rplMod->setRefPicListModificationFlagL0( uiCode == 1 ); 2727 if( rplMod->getRefPicListModificationFlagL0() ) 2728 { 2729 for( Int i = 0; i <= pcSlice->getNumRefIdxL0ActiveMinus1( ); i++ ) 2730 { 2731 READ_CODE( rplMod->getListEntryLXLen( numPicTotalCurr ) , uiCode, "list_entry_l0" ); rplMod->setListEntryL0( i, uiCode ); 2732 } 2733 } 2734 2735 if( pcSlice->getSliceType() == B_SLICE ) 2736 { 2737 READ_FLAG( uiCode, "ref_pic_list_modification_flag_l1" ); rplMod->setRefPicListModificationFlagL1( uiCode == 1 ); 2738 if( rplMod->getRefPicListModificationFlagL1() ) 2739 { 2740 for( Int i = 0; i <= pcSlice->getNumRefIdxL1ActiveMinus1( ); i++ ) 2741 { 2742 READ_CODE( rplMod->getListEntryLXLen( numPicTotalCurr ), uiCode, "list_entry_l1" ); rplMod->setListEntryL1( i, uiCode ); 2743 } 2744 } 2745 } 2746 } 2747 } 2748 #else 2651 2749 TComRefPicListModification* refPicListModification = pcSlice->getRefPicListModification(); 2652 2750 if(!pcSlice->isIntra()) … … 2735 2833 refPicListModification->setRefPicListModificationFlagL1(0); 2736 2834 } 2835 #endif 2836 2737 2837 if (pcSlice->isInterB()) 2738 2838 { … … 2898 2998 { 2899 2999 Int voiInVps = vps->getVoiInVps( pcSlice->getViewIndex() ); 2900 #if NH_3D_FIX_TICKET_1012901 3000 if( vps->getCpInSliceSegmentHeaderFlag( voiInVps ) ) 2902 #else2903 if( vps->getCpInSliceSegmentHeaderFlag( voiInVps ) && !pcSlice->getIsDepth() )2904 #endif2905 3001 { 2906 3002 for( Int m = 0; m < vps->getNumCp( voiInVps ); m++ ) … … 2952 3048 pcSlice->checkPocResetIdc(); 2953 3049 3050 #if NH_MV 3051 if ( pcSlice->getVPS()->getPocLsbNotPresentFlag(pcSlice->getLayerId()) && pcSlice->getSlicePicOrderCntLsb() > 0 ) 3052 #else 2954 3053 if ( pcSlice->getVPS()->getPocLsbNotPresentFlag(pcSlice->getLayerId()) && slicePicOrderCntLsb > 0 ) 3054 #endif 2955 3055 { 2956 3056 assert( pcSlice->getPocResetIdc() != 2 ); … … 2959 3059 if( pcSlice->getPocResetIdc() != 0 ) 2960 3060 { 2961 READ_CODE( 6, uiCode, "poc_reset_period_id" ); pcSlice->setPocResetPeriodId( uiCode ); 3061 READ_CODE( 6, uiCode, "poc_reset_period_id" ); pcSlice->setPocResetPeriodId( uiCode ); 3062 pcSlice->setHasPocResetPeriodIdPresent( true ); 2962 3063 } 2963 3064 else 2964 3065 { 2965 3066 // TODO Copy poc_reset_period from earlier picture 3067 #if NH_MV 3068 pcSlice->setHasPocResetPeriodIdPresent( false); 3069 #else 2966 3070 pcSlice->setPocResetPeriodId( 0 ); 3071 #endif 2967 3072 } 2968 3073 … … 2972 3077 READ_CODE( pcSlice->getPocLsbValLen() , uiCode, "poc_lsb_val" ); pcSlice->setPocLsbVal( uiCode ); 2973 3078 } 2974 pcSlice->checkPocLsbVal(); 2975 2976 // Derive the value of PocMs8bValRequiredFlag 3079 pcSlice->checkPocLsbVal(); 2977 3080 2978 3081 if( !pcSlice->getPocMsbValRequiredFlag() && pcSlice->getVPS()->getVpsPocLsbAlignedFlag() ) 2979 3082 { 3083 #if NH_MV 3084 READ_FLAG( uiCode, "poc_msb_cycle_val_present_flag" ); pcSlice->setPocMsbCycleValPresentFlag( uiCode == 1 ); 3085 #else 2980 3086 READ_FLAG( uiCode, "poc_msb_val_present_flag" ); pcSlice->setPocMsbValPresentFlag( uiCode == 1 ); 3087 #endif 2981 3088 } 2982 3089 else 2983 3090 { 3091 #if NH_MV 3092 pcSlice->setPocMsbCycleValPresentFlag( pcSlice->inferPocMsbCycleValPresentFlag( ) ); 3093 #else 2984 3094 pcSlice->setPocMsbValPresentFlag( pcSlice->inferPocMsbValPresentFlag( ) ); 3095 #endif 2985 3096 } 2986 3097 2987 3098 3099 #if NH_MV 3100 if( pcSlice->getPocMsbCycleValPresentFlag() ) 3101 #else 2988 3102 if( pcSlice->getPocMsbValPresentFlag() ) 2989 { 3103 #endif 3104 { 3105 #if NH_MV 3106 READ_UVLC( uiCode, "poc_msb_val" ); pcSlice->setPocMsbCycleVal( uiCode ); 3107 #else 2990 3108 READ_UVLC( uiCode, "poc_msb_val" ); pcSlice->setPocMsbVal( uiCode ); 3109 #endif 2991 3110 } 2992 3111 -
branches/HTM-15.0-dev0/source/Lib/TLibDecoder/TDecCAVLC.h
r1313 r1317 64 64 protected: 65 65 66 #if NH_MV 67 Void parseShortTermRefPicSet (TComSPS* pcSPS, TComStRefPicSet* pcRPS, Int stRpsIdx ); 68 #else 66 69 Void parseShortTermRefPicSet (TComSPS* pcSPS, TComReferencePictureSet* pcRPS, Int idx); 70 #endif 67 71 68 72 #if NH_MV … … 104 108 Void parseProfileTier (ProfileTierLevel *ptl, const Bool bIsSubLayer); 105 109 Void parseHrdParameters (TComHRD *hrd, Bool cprms_present_flag, UInt tempLevelHigh); 110 #if NH_MV 111 Void parseFirstSliceSegmentInPicFlag( TComSlice* pcSlice ); 112 Void parseSliceHeader ( TComSlice* pcSlice, ParameterSetManager *parameterSetManager ); 113 #else 106 114 Void parseSliceHeader ( TComSlice* pcSlice, ParameterSetManager *parameterSetManager, const Int prevTid0POC); 115 #endif 116 107 117 Void parseTerminatingBit ( UInt& ruiBit ); 108 118 Void parseRemainingBytes ( Bool noTrailingBytesExpected ); -
branches/HTM-15.0-dev0/source/Lib/TLibDecoder/TDecCu.cpp
r1313 r1317 531 531 pcCU->getCUMvField( REF_PIC_LIST_1 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx + 1], iSPWidth, iSPHeight); 532 532 } 533 #if ENC_DEC_TRACE && H_MV_ENC_DEC_TRAC 534 if ( g_traceSubPBMotion ) 535 { 536 std::cout << std::setfill(' ') << std::setw( 15 ) 537 << "Num" << std::setw( 15 ) 538 << "Dir " << std::setw( 15 ) 539 << "L0 RefIdx" << std::setw( 15 ) 540 << "L0 Hor" << std::setw( 15 ) 541 << "L0 Ver" << std::setw( 15 ) 542 << "L1 RefIdx" << std::setw( 15 ) 543 << "L1 Hor" << std::setw( 15 ) 544 << "L1 Ver" << std::setw( 15 ) 545 << std::endl; 546 547 for (Int iPartitionIdx = 0; iPartitionIdx < iNumSP; iPartitionIdx++) 548 { 549 UChar dir = puhInterDirSP[iPartitionIdx]; 550 TComMvField& mv0 = pcMvFieldSP [2*iPartitionIdx]; 551 TComMvField& mv1 = pcMvFieldSP [2*iPartitionIdx+1]; 552 553 std::cout << std::setfill(' ') << std::setw( 15 ) 554 << iPartitionIdx << std::setw( 15 ) 555 << (UInt) dir << std::setw( 15 ) 556 << ((dir & 1) ? mv0.getRefIdx() : MIN_INT) << std::setw( 15 ) 557 << ((dir & 1) ? mv0.getMv().getHor() : MIN_INT) << std::setw( 15 ) 558 << ((dir & 1) ? mv0.getMv().getVer() : MIN_INT) << std::setw( 15 ) 559 << ((dir & 2) ? mv1.getRefIdx() : MIN_INT) << std::setw( 15 ) 560 << ((dir & 2) ? mv1.getMv().getHor() : MIN_INT) << std::setw( 15 ) 561 << ((dir & 2) ? mv1.getMv().getVer() : MIN_INT) << std::setw( 15 ) 562 << std::endl; 563 } 564 } 565 #endif 533 566 } 534 567 delete[] pcMvFieldSP; … … 779 812 const ChromaFormat chFmt = rTu.GetChromaFormat(); 780 813 814 DEBUG_STRING_NEW(sTemp) 781 815 if ( pcCU->getDISType(uiAbsPartIdx) == 0 ) 782 816 { … … 1271 1305 TComTURecurse tuRecurseWithPU(tuRecurseCU, false, TComTU::DONT_SPLIT); 1272 1306 1307 DEBUG_STRING_NEW(sTemp) 1273 1308 m_pcPrediction->initIntraPatternChType( tuRecurseWithPU, COMPONENT_Y, false DEBUG_STRING_PASS_INTO(sTemp) ); 1274 1309 … … 1321 1356 1322 1357 //===== init pattern for luma prediction ===== 1323 1358 DEBUG_STRING_NEW(sTemp) 1324 1359 m_pcPrediction->initIntraPatternChType( tuRecurseWithPU, COMPONENT_Y, bUseFilter DEBUG_STRING_PASS_INTO(sTemp) ); 1325 1360 -
branches/HTM-15.0-dev0/source/Lib/TLibDecoder/TDecEntropy.cpp
r1313 r1317 238 238 UInt uiNumPU = ( ePartSize == SIZE_2Nx2N ? 1 : ( ePartSize == SIZE_NxN ? 4 : 2 ) ); 239 239 UInt uiPUOffset = ( g_auiPUOffset[UInt( ePartSize )] << ( ( pcCU->getSlice()->getSPS()->getMaxTotalCUDepth() - uiDepth ) << 1 ) ) >> 4; 240 241 #if NH_3D_MLC 240 242 //#if H_3D_IV_MERGE 241 #if NH_3D_MLC242 243 TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS_MEM << 1]; // double length for mv of both lists 243 244 UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM]; … … 651 652 #endif 652 653 } 653 } 654 } 654 655 #if NH_3D_IC 655 656 decodeICFlag( pcCU, uiAbsPartIdx, uiDepth ); -
branches/HTM-15.0-dev0/source/Lib/TLibDecoder/TDecEntropy.h
r1313 r1317 67 67 virtual Void parseSPS ( TComSPS* pcSPS ) = 0; 68 68 virtual Void parsePPS ( TComPPS* pcPPS ) = 0; 69 virtual Void parseSliceHeader ( TComSlice* pcSlice, ParameterSetManager *parameterSetManager, const Int prevTid0POC) = 0; 69 #if NH_MV 70 virtual Void parseFirstSliceSegmentInPicFlag( TComSlice* pcSlice ) = 0; 71 virtual Void parseSliceHeader ( TComSlice* pcSlice, ParameterSetManager *parameterSetManager ) = 0; 72 #else 73 virtual Void parseSliceHeader ( TComSlice* pcSlice, ParameterSetManager *parameterSetManager, const Int prevTid0POC) = 0; 74 #endif 70 75 71 76 virtual Void parseTerminatingBit ( UInt& ruilsLast ) = 0; … … 156 161 Void decodeSPS ( TComSPS* pcSPS ) { m_pcEntropyDecoderIf->parseSPS(pcSPS); } 157 162 Void decodePPS ( TComPPS* pcPPS ) { m_pcEntropyDecoderIf->parsePPS(pcPPS); } 163 #if NH_MV 164 Void decodeFirstSliceSegmentInPicFlag ( TComSlice* pcSlice ) { m_pcEntropyDecoderIf->parseFirstSliceSegmentInPicFlag( pcSlice ); } 165 #endif 166 #if NH_MV 167 Void decodeSliceHeader ( TComSlice* pcSlice, ParameterSetManager *parameterSetManager ) { m_pcEntropyDecoderIf->parseSliceHeader(pcSlice, parameterSetManager); } 168 #else 158 169 Void decodeSliceHeader ( TComSlice* pcSlice, ParameterSetManager *parameterSetManager, const Int prevTid0POC) { m_pcEntropyDecoderIf->parseSliceHeader(pcSlice, parameterSetManager, prevTid0POC); } 170 #endif 159 171 Void decodeTerminatingBit ( UInt& ruiIsLast ) { m_pcEntropyDecoderIf->parseTerminatingBit(ruiIsLast); } 160 172 Void decodeRemainingBytes( Bool noTrailingBytesExpected ) { m_pcEntropyDecoderIf->parseRemainingBytes(noTrailingBytesExpected); } -
branches/HTM-15.0-dev0/source/Lib/TLibDecoder/TDecSbac.h
r1313 r1317 80 80 Void parseSPS ( TComSPS* /*pcSPS*/ ) {} 81 81 Void parsePPS ( TComPPS* /*pcPPS*/ ) {} 82 #if NH_MV 83 Void parseFirstSliceSegmentInPicFlag( TComSlice* /*pcSlice*/ ) {} 84 Void parseSliceHeader ( TComSlice* /*pcSlice*/, ParameterSetManager* /*parameterSetManager*/ ) {} 85 #else 82 86 Void parseSliceHeader ( TComSlice* /*pcSlice*/, ParameterSetManager* /*parameterSetManager*/, const Int /*prevTid0POC*/) {} 87 #endif 83 88 Void parseTerminatingBit ( UInt& ruiBit ); 84 89 Void parseRemainingBytes ( Bool noTrailingBytesExpected); -
branches/HTM-15.0-dev0/source/Lib/TLibDecoder/TDecTop.cpp
r1313 r1317 35 35 \brief decoder class 36 36 */ 37 38 37 #include "NALread.h" 39 38 #include "TDecTop.h" … … 127 126 } 128 127 } 129 130 131 132 128 133 129 Void … … 290 286 } 291 287 292 293 #if !NH_3D_FIX_TICKET_101294 #if NH_3D_IV_MERGE295 Void296 CamParsCollector::copyCamParamForSlice( TComSlice* pcSlice )297 {298 if( m_bCamParsVaryOverTime )299 {300 pcSlice->setCamparaSlice( m_aaiCodedScale, m_aaiCodedOffset );301 }302 }303 #endif304 #endif305 306 307 288 Void 308 289 CamParsCollector::xOutput( Int iPOC ) … … 351 332 TDecTop::TDecTop() 352 333 : m_iMaxRefPicNum(0) 334 #if !NH_MV 353 335 , m_associatedIRAPType(NAL_UNIT_INVALID) 354 , m_pocCRA(0) 336 , m_pocCRA(0) 355 337 , m_pocRandomAccess(MAX_INT) 356 338 , m_cListPic() 357 #if !NH_MV358 339 , m_parameterSetManager() 359 340 #endif … … 373 354 , m_cSAO() 374 355 , m_pcPic(NULL) 356 #if !NH_MV 375 357 , m_prevPOC(MAX_INT) 376 358 , m_prevTid0POC(0) … … 383 365 , m_isNoOutputPriorPics(false) 384 366 , m_craNoRaslOutputFlag(false) 367 #endif 385 368 #if O0043_BEST_EFFORT_DECODING 386 369 , m_forceDecodeBitDepth(8) 387 370 #endif 388 371 , m_pDecodedSEIOutputStream(NULL) 372 #if !NH_MV 389 373 , m_warningMessageSkipPicture(false) 374 #endif 390 375 , m_prefixSEINALUs() 376 { 377 #if !NH_MV 378 #if ENC_DEC_TRACE 379 if (g_hTrace == NULL) 380 { 381 g_hTrace = fopen( "TraceDec.txt", "wb" ); 382 } 383 g_bJustDoIt = g_bEncDecTraceDisable; 384 g_nSymbolCounter = 0; 385 #endif 386 #endif 387 388 #if NH_MV 389 m_layerId = 0; 390 m_viewId = 0; 391 392 #if NH_3D 393 m_viewIndex = 0; 394 m_isDepth = false; 395 m_pcCamParsCollector = 0; 396 #endif 397 398 m_decodingProcess = CLAUSE_8; 399 m_targetOlsIdx = -1; 400 m_smallestLayerId = -1; 401 m_isInOwnTargetDecLayerIdList = 0; 402 m_prevPicOrderCnt = 0; 403 m_pocDecrementedInDpbFlag = NULL; 404 m_firstPicInLayerDecodedFlag = NULL; 405 m_lastPresentPocResetIdc = NULL; 406 407 m_prevIrapPoc = MIN_INT; 408 m_prevIrapDecodingOrder = MIN_INT; 409 m_prevStsaDecOrder = MIN_INT; 410 m_prevStsaTemporalId = MIN_INT; 411 #endif 412 } 413 414 TDecTop::~TDecTop() 391 415 { 392 416 #if ENC_DEC_TRACE 393 417 #if NH_MV 394 if ( g_hTrace == NULL )395 {396 #endif397 if (g_hTrace == NULL)398 {399 g_hTrace = fopen( "TraceDec.txt", "wb" );400 }401 g_bJustDoIt = g_bEncDecTraceDisable;402 g_nSymbolCounter = 0;403 #if NH_MV404 }405 #endif406 #endif407 #if NH_MV408 m_isLastNALWasEos = false;409 m_layerId = 0;410 m_viewId = 0;411 #if NH_3D412 m_viewIndex = 0;413 m_isDepth = false;414 m_pcCamParsCollector = 0;415 #endif416 #if NH_MV417 m_targetOlsIdx = -1;418 #endif419 #endif420 421 }422 423 TDecTop::~TDecTop()424 {425 #if ENC_DEC_TRACE426 #if H_MV_ENC_DEC_TRAC_FIX427 418 if (g_hTrace != stdout && g_hTrace != NULL) 419 { 420 fclose( g_hTrace ); 421 g_hTrace = NULL; 422 } 428 423 #else 429 424 if (g_hTrace != stdout) 430 #endif431 425 { 432 426 fclose( g_hTrace ); 433 #if H_MV_ENC_DEC_TRAC_FIX 434 g_hTrace = NULL; 435 #endif 436 } 427 } 428 #endif 437 429 #endif 438 430 while (!m_prefixSEINALUs.empty()) … … 452 444 Void TDecTop::destroy() 453 445 { 446 447 #if NH_MV 448 m_cSAO.destroy(); 449 m_cLoopFilter. destroy(); 450 #endif 451 454 452 m_cGopDecoder.destroy(); 455 453 … … 474 472 } 475 473 474 #if !NH_MV 476 475 Void TDecTop::deletePicBuffer ( ) 477 476 { 477 478 478 TComList<TComPic*>::iterator iterPic = m_cListPic.begin(); 479 479 Int iSize = Int( m_cListPic.size() ); … … 482 482 { 483 483 TComPic* pcPic = *(iterPic++); 484 #if NH_MV485 if( pcPic )486 {487 #endif488 484 pcPic->destroy(); 489 485 490 486 delete pcPic; 491 487 pcPic = NULL; 492 #if NH_MV493 }494 #endif495 488 } 496 489 … … 499 492 m_cLoopFilter. destroy(); 500 493 501 #if !NH_MV502 494 // destroy ROM 503 495 destroyROM(); 504 #endif505 496 } 506 497 507 498 Void TDecTop::xGetNewPicBuffer ( const TComSPS &sps, const TComPPS &pps, TComPic*& rpcPic, const UInt temporalLayer ) 508 499 { 509 #if NH_MV510 if ( getLayerId() == 0 )511 {512 m_iMaxRefPicNum = sps.getMaxDecPicBuffering(temporalLayer); // m_uiMaxDecPicBuffering has the space for the picture currently being decoded513 }514 else515 {516 //GTCIC517 //m_iMaxRefPicNum = pcSlice->getVPS()->getMaxDecPicBuffering(pcSlice->getTLayer());518 #if H_MV_HLS7_GEN519 TComVPS* vps = pcSlice->getVPS();520 TComDpbSize* dpbSize = vps->getDpbSize();521 Int lsIdx = vps->olsIdxToLsIdx( getTargetOutputLayerSetIdx()); // Is this correct, seems to be missing in spec?522 Int layerIdx = vps->getIdxInLayerSet ( lsIdx, getLayerId() );523 Int subDpbIdx = dpbSize->getSubDpbAssigned( lsIdx, layerIdx );524 m_iMaxRefPicNum = dpbSize->getMaxVpsDecPicBufferingMinus1(getTargetOutputLayerSetIdx(), subDpbIdx , vps->getSubLayersVpsMaxMinus1( vps->getLayerIdInVps( getLayerId() ) ) + 1 ) + 1 ;525 #endif526 }527 #else528 500 m_iMaxRefPicNum = sps.getMaxDecPicBuffering(temporalLayer); // m_uiMaxDecPicBuffering has the space for the picture currently being decoded 529 #endif530 501 if (m_cListPic.size() < (UInt)m_iMaxRefPicNum) 531 502 { … … 547 518 { 548 519 rpcPic->setOutputMark(false); 549 #if NH_MV550 rpcPic->setPicOutputFlag(false);551 #endif552 520 bBufferIsAvailable = true; 553 521 break; … … 557 525 { 558 526 rpcPic->setOutputMark(false); 559 #if NH_MV560 rpcPic->setPicOutputFlag(false);561 #endif562 527 rpcPic->setReconMark( false ); 563 528 rpcPic->getPicYuvRec()->setBorderExtension( false ); … … 577 542 rpcPic->create ( sps, pps, true); 578 543 } 579 #if NH_MV 580 Void TDecTop::endPicDecoding(Int& poc, TComList<TComPic*>*& rpcListPic, std::vector<Int>& targetDecLayerIdSet ) 581 #else 544 582 545 Void TDecTop::executeLoopFilters(Int& poc, TComList<TComPic*>*& rpcListPic) 583 #endif584 546 { 585 547 if (!m_pcPic) … … 599 561 rpcListPic = &m_cListPic; 600 562 m_cCuDecoder.destroy(); 601 #if NH_MV602 TComSlice::markIvRefPicsAsShortTerm( m_refPicSetInterLayer0, m_refPicSetInterLayer1 );603 TComSlice::markCurrPic( pcPic );604 #endif605 563 m_bFirstSliceInPicture = true; 606 607 564 return; 608 565 } … … 623 580 { 624 581 pcPicTmp->setOutputMark(false); 625 #if NH_MV626 pcPicTmp->setPicOutputFlag(false);627 #endif628 582 } 629 583 } … … 673 627 } 674 628 } 675 676 629 #endif 630 631 632 #if NH_MV 633 Void TDecTop::activatePSsAndInitPicOrSlice( TComPic* newPic ) 634 { 635 if ( m_apcSlicePilot->getFirstSliceSegementInPicFlag() ) 636 { 637 assert( newPic != NULL ); 638 639 #else 677 640 Void TDecTop::xActivateParameterSets() 678 641 { 679 642 if (m_bFirstSliceInPicture) 680 643 { 644 #endif 681 645 const TComPPS *pps = m_parameterSetManager.getPPS(m_apcSlicePilot->getPPSId()); // this is a temporary PPS object. Do not store this value 682 646 assert (pps != 0); … … 690 654 const TComVPS* vps = m_parameterSetManager.getVPS(sps->getVPSId()); 691 655 assert (vps != 0); 692 if (!m_parameterSetManager.activatePPS(m_apcSlicePilot->getPPSId(),m_apcSlicePilot->isIRAP(), m_layerId ) ) 656 // TBD: check the condition on m_firstPicInLayerDecodedFlag 657 if (!m_parameterSetManager.activatePPS(m_apcSlicePilot->getPPSId(),m_apcSlicePilot->isIRAP() || !m_firstPicInLayerDecodedFlag[m_layerId] , m_layerId ) ) 693 658 #else 694 659 if (false == m_parameterSetManager.activatePPS(m_apcSlicePilot->getPPSId(),m_apcSlicePilot->isIRAP())) … … 700 665 701 666 #if NH_MV 702 // When the value of vps_num_rep_formats_minus1 in the active VPS is equal to 0 703 if ( vps->getVpsNumRepFormatsMinus1() == 0 ) 704 { 705 //, it is a requirement of bitstream conformance that the value of update_rep_format_flag shall be equal to 0. 706 assert( sps->getUpdateRepFormatFlag() == false ); 707 } 708 sps->checkRpsMaxNumPics( vps, getLayerId() ); 709 710 // It is a requirement of bitstream conformance that, when the SPS is referred to by 711 // any current picture that belongs to an independent non-base layer, the value of 712 // MultiLayerExtSpsFlag derived from the SPS shall be equal to 0. 713 714 if ( m_layerId > 0 && vps->getNumRefLayers( m_layerId ) == 0 ) 715 { 716 assert( sps->getMultiLayerExtSpsFlag() == 0 ); 717 } 667 if ( decProcAnnexG() ) 668 { 669 // When the value of vps_num_rep_formats_minus1 in the active VPS is equal to 0 670 if ( vps->getVpsNumRepFormatsMinus1() == 0 ) 671 { 672 //, it is a requirement of bitstream conformance that the value of update_rep_format_flag shall be equal to 0. 673 assert( sps->getUpdateRepFormatFlag() == false ); 674 } 675 sps->checkRpsMaxNumPics( vps, getLayerId() ); 676 677 // It is a requirement of bitstream conformance that, when the SPS is referred to by 678 // any current picture that belongs to an independent non-base layer, the value of 679 // MultiLayerExtSpsFlag derived from the SPS shall be equal to 0. 680 681 if ( m_layerId > 0 && vps->getNumRefLayers( m_layerId ) == 0 ) 682 { 683 assert( sps->getMultiLayerExtSpsFlag() == 0 ); 684 } 685 } 718 686 #endif 719 687 … … 734 702 735 703 // Get a new picture buffer. This will also set up m_pcPic, and therefore give us a SPS and PPS pointer that we can use. 704 #if !NH_MV 736 705 xGetNewPicBuffer (*(sps), *(pps), m_pcPic, m_apcSlicePilot->getTLayer()); 706 737 707 m_apcSlicePilot->applyReferencePictureSet(m_cListPic, m_apcSlicePilot->getRPS()); 738 # if NH_MV739 m_ apcSlicePilot->createInterLayerReferencePictureSet( m_ivPicLists, m_refPicSetInterLayer0, m_refPicSetInterLayer1 );708 #else 709 m_pcPic = newPic; 740 710 #endif 741 711 … … 752 722 753 723 #if NH_MV 724 pSlice->setPic( m_pcPic ); 754 725 vps=pSlice->getVPS(); 755 726 // The nuh_layer_id value of the NAL unit containing the PPS that is activated for a layer layerA with nuh_layer_id equal to nuhLayerIdA shall be equal to 0, or nuhLayerIdA, or the nuh_layer_id of a direct or indirect reference layer of layerA. … … 803 774 else 804 775 { 776 #if NH_MV 777 assert( m_pcPic != NULL ); 778 assert( newPic == NULL ); 779 #endif 805 780 // make the slice-pilot a real slice, and set up the slice-pilot for the next slice 806 781 m_pcPic->allocateNewSlice(); … … 828 803 829 804 // Check if any new SEI has arrived 830 if(!m_SEIs.empty()) 831 { 832 // Currently only decoding Unit SEI message occurring between VCL NALUs copied 833 SEIMessages &picSEI = m_pcPic->getSEIs(); 834 SEIMessages decodingUnitInfos = extractSeisByType (m_SEIs, SEI::DECODING_UNIT_INFO); 835 picSEI.insert(picSEI.end(), decodingUnitInfos.begin(), decodingUnitInfos.end()); 836 deleteSEIs(m_SEIs); 837 } 838 } 839 } 805 if(!m_SEIs.empty()) 806 { 807 // Currently only decoding Unit SEI message occurring between VCL NALUs copied 808 SEIMessages &picSEI = m_pcPic->getSEIs(); 809 SEIMessages decodingUnitInfos = extractSeisByType (m_SEIs, SEI::DECODING_UNIT_INFO); 810 picSEI.insert(picSEI.end(), decodingUnitInfos.begin(), decodingUnitInfos.end()); 811 deleteSEIs(m_SEIs); 812 } 813 } 814 } 815 840 816 Void TDecTop::xParsePrefixSEIsForUnknownVCLNal() 841 817 { … … 865 841 } 866 842 867 868 #if NH_MV 869 Bool TDecTop::xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay, Bool newLayerFlag, Bool& sliceSkippedFlag ) 870 { 871 assert( nalu.m_nuhLayerId == m_layerId ); 843 #if !NH_MV 844 Bool TDecTop::xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay ) 845 { 846 m_apcSlicePilot->initSlice(); // the slice pilot is an object to prepare for a new slice 847 // it is not associated with picture, sps or pps structures. 848 if (m_bFirstSliceInPicture) 849 { 872 850 #else 873 Bool TDecTop::xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay ) 874 { 875 #endif 851 Void TDecTop::decodeSliceHeader(InputNALUnit &nalu ) 852 { 853 // Initialize entropy decoder 854 m_cEntropyDecoder.setEntropyDecoder (&m_cCavlcDecoder); 855 m_cEntropyDecoder.setBitstream (&(nalu.getBitstream())); 856 857 assert( nalu.m_nuhLayerId == m_layerId ); 876 858 m_apcSlicePilot->initSlice(); // the slice pilot is an object to prepare for a new slice 877 // it is not associated with picture, sps or pps structures. 878 879 if (m_bFirstSliceInPicture) 880 { 859 // it is not associated with picture, sps or pps structures. 860 m_apcSlicePilot->setLayerId( nalu.m_nuhLayerId ); 861 m_cEntropyDecoder.decodeFirstSliceSegmentInPicFlag( m_apcSlicePilot ); 862 if ( m_apcSlicePilot->getFirstSliceSegementInPicFlag() ) 863 { 864 #endif 881 865 m_uiSliceIdx = 0; 882 866 } … … 889 873 m_apcSlicePilot->setNalUnitType(nalu.m_nalUnitType); 890 874 Bool nonReferenceFlag = (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TRAIL_N || 891 892 893 894 875 m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N || 876 m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_N || 877 m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL_N || 878 m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N); 895 879 m_apcSlicePilot->setTemporalLayerNonReferenceFlag(nonReferenceFlag); 880 #if !NH_MV 896 881 m_apcSlicePilot->setReferenced(true); // Putting this as true ensures that picture is referenced the first time it is in an RPS 882 #endif 897 883 m_apcSlicePilot->setTLayerInfo(nalu.m_temporalId); 898 884 #if NH_MV 885 m_cEntropyDecoder.decodeSliceHeader (m_apcSlicePilot, &m_parameterSetManager ); 886 #else 899 887 #if ENC_DEC_TRACE 900 888 const UInt64 originalSymbolCount = g_nSymbolCounter; 901 889 #endif 890 m_cEntropyDecoder.decodeSliceHeader (m_apcSlicePilot, &m_parameterSetManager, m_prevTid0POC); 891 #endif 902 892 903 893 #if NH_MV 904 m_apcSlicePilot->setRefPicSetInterLayer( & m_refPicSetInterLayer0, &m_refPicSetInterLayer1 ); 905 m_apcSlicePilot->setLayerId( nalu.m_nuhLayerId ); 906 #endif 907 908 m_cEntropyDecoder.decodeSliceHeader (m_apcSlicePilot, &m_parameterSetManager, m_prevTid0POC); 909 894 } 895 #else 910 896 // set POC for dependent slices in skipped pictures 911 897 if(m_apcSlicePilot->getDependentSliceSegmentFlag() && m_prevSliceSkipped) … … 915 901 916 902 xUpdatePreviousTid0POC(m_apcSlicePilot); 917 918 903 m_apcSlicePilot->setAssociatedIRAPPOC(m_pocCRA); 919 904 m_apcSlicePilot->setAssociatedIRAPType(m_associatedIRAPType); 920 #if NH_MV 921 const TComVPS* vps = m_apcSlicePilot->getVPS(); 922 Int layerId = nalu.m_nuhLayerId; 923 setViewId ( vps->getViewId ( layerId ) ); 924 #if NH_3D 925 setViewIndex( vps->getViewIndex( layerId ) ); 926 setIsDepth ( vps->getDepthId ( layerId ) == 1 ); 927 m_ivPicLists->setVPS( vps ); 928 #endif 929 #endif 905 930 906 931 907 //For inference of NoOutputOfPriorPicsFlag 932 908 if (m_apcSlicePilot->getRapPicFlag()) 933 909 { 934 if ((m_apcSlicePilot->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && m_apcSlicePilot->getNalUnitType() <= NAL_UNIT_CODED_SLICE_IDR_N_LP) ||910 if ((m_apcSlicePilot->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && m_apcSlicePilot->getNalUnitType() <= NAL_UNIT_CODED_SLICE_IDR_N_LP) || 935 911 (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA && m_bFirstSliceInSequence) || 936 912 (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA && m_apcSlicePilot->getHandleCraAsBlaFlag())) 937 {938 m_apcSlicePilot->setNoRaslOutputFlag(true);939 }913 { 914 m_apcSlicePilot->setNoRaslOutputFlag(true); 915 } 940 916 //the inference for NoOutputPriorPicsFlag 941 917 if (!m_bFirstSliceInBitstream && m_apcSlicePilot->getRapPicFlag() && m_apcSlicePilot->getNoRaslOutputFlag()) … … 948 924 else 949 925 { 950 m_apcSlicePilot->setNoOutputPriorPicsFlag(false); 926 m_apcSlicePilot->setNoOutputPriorPicsFlag(false); 951 927 } 952 928 … … 974 950 } 975 951 } 976 952 977 953 if (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA && m_craNoRaslOutputFlag) //Reset POC MSB when CRA has NoRaslOutputFlag equal to 1 978 954 { … … 985 961 xUpdatePreviousTid0POC(m_apcSlicePilot); 986 962 } 987 #if NH_MV988 xCeckNoClrasOutput();989 #endif990 963 991 964 // Skip pictures due to random access 992 993 #if NH_MV994 if (isRandomAccessSkipPicture(iSkipFrame, iPOCLastDisplay, vps))995 #else996 965 if (isRandomAccessSkipPicture(iSkipFrame, iPOCLastDisplay)) 997 #endif998 966 { 999 967 m_prevSliceSkipped = true; 1000 968 m_skippedPOC = m_apcSlicePilot->getPOC(); 1001 #if NH_MV1002 sliceSkippedFlag = true;1003 #endif1004 969 return false; 1005 970 } … … 1009 974 m_prevSliceSkipped = true; 1010 975 m_skippedPOC = m_apcSlicePilot->getPOC(); 1011 #if NH_MV1012 sliceSkippedFlag = true;1013 #endif1014 976 return false; 1015 977 } … … 1030 992 { 1031 993 m_prevPOC = m_apcSlicePilot->getPOC(); 994 1032 995 #if ENC_DEC_TRACE 1033 996 //rewind the trace counter since we didn't actually decode the slice … … 1038 1001 m_prevPOC = m_apcSlicePilot->getPOC(); 1039 1002 } 1040 #if NH_MV1041 if ( newLayerFlag )1042 {1043 return false;1044 }1045 #if ENC_DEC_TRACE1046 #if H_MV_ENC_DEC_TRAC1047 // parse remainder of SH1048 g_disableHLSTrace = false;1049 #endif1050 #endif1051 #endif1052 1053 #if NH_MV1054 // This part needs further testing !1055 if ( m_apcSlicePilot->getPocResetFlag() )1056 {1057 xResetPocInPicBuffer();1058 }1059 1060 if ( m_apcSlicePilot->getTLayer() == 0 && m_apcSlicePilot->getEnableTMVPFlag() == 0 )1061 {1062 //update all pics in the DPB such that they cannot be used for TMPV ref1063 TComList<TComPic*>::iterator iterRefPic = m_cListPic.begin();1064 while( iterRefPic != m_cListPic.end() )1065 {1066 TComPic *refPic = *iterRefPic;1067 if( ( refPic->getLayerId() == m_apcSlicePilot->getLayerId() ) && refPic->getReconMark() )1068 {1069 for(Int i = refPic->getNumAllocatedSlice()-1; i >= 0; i--)1070 {1071 1072 TComSlice *refSlice = refPic->getSlice(i);1073 refSlice->setAvailableForTMVPRefFlag( false );1074 }1075 }1076 iterRefPic++;1077 }1078 }1079 m_apcSlicePilot->setAvailableForTMVPRefFlag( true );1080 #endif1081 1003 1082 1004 //detect lost reference picture and insert copy of earlier frame. … … 1093 1015 m_prevPOC = m_apcSlicePilot->getPOC(); 1094 1016 } 1095 1096 1017 // actual decoding starts here 1097 1018 xActivateParameterSets(); … … 1103 1024 TComSlice* pcSlice = m_pcPic->getPicSym()->getSlice(m_uiSliceIdx); 1104 1025 1105 // When decoding the slice header, the stored start and end addresses were actually RS addresses, not TS addresses. 1106 // Now, having set up the maps, convert them to the correct form. 1107 pcSlice->setSliceSegmentCurStartCtuTsAddr( m_pcPic->getPicSym()->getCtuRsToTsAddrMap(pcSlice->getSliceSegmentCurStartCtuTsAddr()) ); 1108 pcSlice->setSliceSegmentCurEndCtuTsAddr( m_pcPic->getPicSym()->getCtuRsToTsAddrMap(pcSlice->getSliceSegmentCurEndCtuTsAddr()) ); 1109 if(!pcSlice->getDependentSliceSegmentFlag()) 1110 { 1111 pcSlice->setSliceCurStartCtuTsAddr(m_pcPic->getPicSym()->getCtuRsToTsAddrMap(pcSlice->getSliceCurStartCtuTsAddr())); 1112 pcSlice->setSliceCurEndCtuTsAddr(m_pcPic->getPicSym()->getCtuRsToTsAddrMap(pcSlice->getSliceCurEndCtuTsAddr())); 1113 } 1114 1115 m_pcPic->setTLayer(nalu.m_temporalId); 1026 #endif 1116 1027 1117 1028 #if NH_MV 1118 //Check Multiview Main profile constraint in G.11.1.1 1119 // When ViewOrderIdx[ i ] derived according to any active VPS is equal to 1 1120 // for the layer with nuh_layer_id equal to i in subBitstream, 1121 // inter_view_mv_vert_constraint_flag shall be equal to 1 1122 // in the sps_multilayer_extension( ) syntax structure in each active SPS for that layer. 1123 if( pcSlice->getSPS()->getPTL()->getGeneralPTL()->getProfileIdc()==Profile::MULTIVIEWMAIN 1029 Void TDecTop::decodeSliceSegment(InputNALUnit &nalu ) 1030 { 1031 TComSlice* pcSlice = m_pcPic->getPicSym()->getSlice(m_uiSliceIdx); 1032 1033 if ( m_pcPic->getHasGeneratedRefPics() ) 1034 { 1035 if ( pcSlice->getFirstSliceSegementInPicFlag() ) 1036 { 1037 std::cout << std:: setfill(' ') 1038 << "Layer " << std::setw(2) << m_pcPic->getLayerId() 1039 << " POC " << std::setw(4) << m_pcPic->getPOC() 1040 << " Reference pictures missing. Skipping picture." << std::endl; 1041 } 1042 } 1043 else 1044 { 1045 //Check Multiview Main profile constraint in G.11.1.1 1046 // When ViewOrderIdx[ i ] derived according to any active VPS is equal to 1 1047 // for the layer with nuh_layer_id equal to i in subBitstream, 1048 // inter_view_mv_vert_constraint_flag shall be equal to 1 1049 // in the sps_multilayer_extension( ) syntax structure in each active SPS for that layer. 1050 if( pcSlice->getSPS()->getPTL()->getGeneralPTL()->getProfileIdc()==Profile::MULTIVIEWMAIN 1124 1051 && 1125 1052 pcSlice->getVPS()->getViewOrderIdx(pcSlice->getVPS()->getLayerIdInNuh(getLayerId()))==1 1126 ) 1127 { 1128 assert( pcSlice->getSPS()->getInterViewMvVertConstraintFlag()==1 ); 1129 } 1130 #endif 1131 #if NH_MV 1132 m_pcPic->setLayerId( nalu.m_nuhLayerId ); 1133 m_pcPic->setViewId ( getViewId() ); 1053 ) 1054 { 1055 assert( pcSlice->getSPS()->getInterViewMvVertConstraintFlag()==1 ); 1056 } 1057 1058 m_pcPic->setLayerId( nalu.m_nuhLayerId ); 1059 m_pcPic->setViewId ( getViewId() ); 1134 1060 #if NH_3D 1135 m_pcPic->setViewIndex( getViewIndex() ); 1136 m_pcPic->setIsDepth ( getIsDepth () ); 1137 pcSlice->setIvPicLists( m_ivPicLists ); 1138 #endif 1139 #endif 1140 1141 if (!pcSlice->getDependentSliceSegmentFlag()) 1142 { 1143 pcSlice->checkCRA(pcSlice->getRPS(), m_pocCRA, m_associatedIRAPType, m_cListPic ); 1144 // Set reference list 1145 #if NH_MV 1146 std::vector< TComPic* > tempRefPicLists[2]; 1147 std::vector< Bool > usedAsLongTerm [2]; 1148 Int numPocTotalCurr; 1149 1150 pcSlice->getTempRefPicLists( m_cListPic, m_refPicSetInterLayer0, m_refPicSetInterLayer1, tempRefPicLists, usedAsLongTerm, numPocTotalCurr); 1151 pcSlice->setRefPicList ( tempRefPicLists, usedAsLongTerm, numPocTotalCurr, true ); 1061 m_pcPic->setViewIndex( getViewIndex() ); 1062 m_pcPic->setIsDepth ( getIsDepth () ); 1063 pcSlice->setIvPicLists( m_dpb ); 1064 #endif 1065 #endif 1066 1067 // When decoding the slice header, the stored start and end addresses were actually RS addresses, not TS addresses. 1068 // Now, having set up the maps, convert them to the correct form. 1069 pcSlice->setSliceSegmentCurStartCtuTsAddr( m_pcPic->getPicSym()->getCtuRsToTsAddrMap(pcSlice->getSliceSegmentCurStartCtuTsAddr()) ); 1070 pcSlice->setSliceSegmentCurEndCtuTsAddr( m_pcPic->getPicSym()->getCtuRsToTsAddrMap(pcSlice->getSliceSegmentCurEndCtuTsAddr()) ); 1071 if(!pcSlice->getDependentSliceSegmentFlag()) 1072 { 1073 pcSlice->setSliceCurStartCtuTsAddr(m_pcPic->getPicSym()->getCtuRsToTsAddrMap(pcSlice->getSliceCurStartCtuTsAddr())); 1074 pcSlice->setSliceCurEndCtuTsAddr(m_pcPic->getPicSym()->getCtuRsToTsAddrMap(pcSlice->getSliceCurEndCtuTsAddr())); 1075 } 1076 1077 m_pcPic->setTLayer(nalu.m_temporalId); 1078 1079 1080 if (!pcSlice->getDependentSliceSegmentFlag()) 1081 { 1082 #if !NH_MV 1083 pcSlice->checkCRA(pcSlice->getRPS(), m_pocCRA, m_associatedIRAPType, m_cListPic ); 1084 // Set reference list 1085 pcSlice->setRefPicList( m_cListPic, true ); 1086 #else 1087 if (pcSlice->getSliceType() != I_SLICE ) 1088 { 1089 if( m_decProcPocAndRps == ANNEX_F ) 1090 { 1091 pcSlice->f834decProcForRefPicListConst(); 1092 } 1093 else if ( m_decProcPocAndRps == CLAUSE_8 ) 1094 { 1095 pcSlice->cl834DecProcForRefPicListConst(); 1096 } 1097 else 1098 { 1099 assert( false ); 1100 } 1101 } 1152 1102 #if NH_3D_NBDV 1153 pcSlice->setDefaultRefView();1103 pcSlice->setDefaultRefView(); 1154 1104 #endif 1155 1105 #if NH_3D_ARP 1156 pcSlice->setARPStepNum(m_ivPicLists); 1157 #endif 1158 #else 1159 pcSlice->setRefPicList( m_cListPic, true ); 1160 #endif 1161 1162 #if NH_3D 1163 pcSlice->checkInCompPredRefLayers(); 1164 #if NH_3D_IV_MERGE 1165 #if H_3D_FCO 1166 //assert( !getIsDepth() ); 1167 #else 1168 assert( !getIsDepth() || ( pcSlice->getTexturePic() != 0 ) ); 1169 #endif 1170 #endif 1171 #endif 1172 #if NH_MV 1173 if( m_layerId > 0 && !pcSlice->isIntra() && pcSlice->getEnableTMVPFlag() ) 1174 { 1175 TComPic* refPic = pcSlice->getRefPic(RefPicList(1 - pcSlice->getColFromL0Flag()), pcSlice->getColRefIdx()); 1176 1177 assert ( refPic ); 1178 assert ( refPic->getPicSym()->getSlice(0)->getAvailableForTMVPRefFlag() == true ); 1179 } 1180 #endif 1181 1182 // For generalized B 1183 // note: maybe not existed case (always L0 is copied to L1 if L1 is empty) 1184 if (pcSlice->isInterB() && pcSlice->getNumRefIdx(REF_PIC_LIST_1) == 0) 1185 { 1186 Int iNumRefIdx = pcSlice->getNumRefIdx(REF_PIC_LIST_0); 1187 pcSlice->setNumRefIdx ( REF_PIC_LIST_1, iNumRefIdx ); 1188 1189 for (Int iRefIdx = 0; iRefIdx < iNumRefIdx; iRefIdx++) 1190 { 1191 pcSlice->setRefPic(pcSlice->getRefPic(REF_PIC_LIST_0, iRefIdx), REF_PIC_LIST_1, iRefIdx); 1192 } 1193 } 1194 if (!pcSlice->isIntra()) 1195 { 1196 Bool bLowDelay = true; 1197 Int iCurrPOC = pcSlice->getPOC(); 1198 Int iRefIdx = 0; 1199 1200 for (iRefIdx = 0; iRefIdx < pcSlice->getNumRefIdx(REF_PIC_LIST_0) && bLowDelay; iRefIdx++) 1201 { 1202 if ( pcSlice->getRefPic(REF_PIC_LIST_0, iRefIdx)->getPOC() > iCurrPOC ) 1106 pcSlice->setPocsInCurrRPSs(); 1107 pcSlice->setARPStepNum(m_dpb); 1108 #endif 1109 #endif 1110 1111 // For generalized B 1112 // note: maybe not existed case (always L0 is copied to L1 if L1 is empty) 1113 if (pcSlice->isInterB() && pcSlice->getNumRefIdx(REF_PIC_LIST_1) == 0) 1114 { 1115 Int iNumRefIdx = pcSlice->getNumRefIdx(REF_PIC_LIST_0); 1116 pcSlice->setNumRefIdx ( REF_PIC_LIST_1, iNumRefIdx ); 1117 1118 for (Int iRefIdx = 0; iRefIdx < iNumRefIdx; iRefIdx++) 1203 1119 { 1204 bLowDelay = false;1120 pcSlice->setRefPic(pcSlice->getRefPic(REF_PIC_LIST_0, iRefIdx), REF_PIC_LIST_1, iRefIdx); 1205 1121 } 1206 1122 } 1207 if (pcSlice->isInterB()) 1208 { 1209 for (iRefIdx = 0; iRefIdx < pcSlice->getNumRefIdx(REF_PIC_LIST_1) && bLowDelay; iRefIdx++) 1123 if (!pcSlice->isIntra()) 1124 { 1125 Bool bLowDelay = true; 1126 Int iCurrPOC = pcSlice->getPOC(); 1127 Int iRefIdx = 0; 1128 1129 for (iRefIdx = 0; iRefIdx < pcSlice->getNumRefIdx(REF_PIC_LIST_0) && bLowDelay; iRefIdx++) 1210 1130 { 1211 if ( pcSlice->getRefPic(REF_PIC_LIST_ 1, iRefIdx)->getPOC() > iCurrPOC )1131 if ( pcSlice->getRefPic(REF_PIC_LIST_0, iRefIdx)->getPOC() > iCurrPOC ) 1212 1132 { 1213 1133 bLowDelay = false; 1214 1134 } 1215 1135 } 1216 } 1217 1218 pcSlice->setCheckLDC(bLowDelay); 1219 } 1220 1221 //--------------- 1222 pcSlice->setRefPOCList(); 1136 if (pcSlice->isInterB()) 1137 { 1138 for (iRefIdx = 0; iRefIdx < pcSlice->getNumRefIdx(REF_PIC_LIST_1) && bLowDelay; iRefIdx++) 1139 { 1140 if ( pcSlice->getRefPic(REF_PIC_LIST_1, iRefIdx)->getPOC() > iCurrPOC ) 1141 { 1142 bLowDelay = false; 1143 } 1144 } 1145 } 1146 1147 pcSlice->setCheckLDC(bLowDelay); 1148 } 1149 1150 //--------------- 1151 pcSlice->setRefPOCList(); 1223 1152 #if NH_3D_TMVP 1224 if(pcSlice->getLayerId()) 1225 { 1226 pcSlice->generateAlterRefforTMVP(); 1227 } 1228 #endif 1229 } 1230 1231 m_pcPic->setCurrSliceIdx(m_uiSliceIdx); 1232 if(pcSlice->getSPS()->getScalingListFlag()) 1233 { 1234 TComScalingList scalingList; 1235 if(pcSlice->getPPS()->getScalingListPresentFlag()) 1236 { 1237 scalingList = pcSlice->getPPS()->getScalingList(); 1238 } 1239 else if (pcSlice->getSPS()->getScalingListPresentFlag()) 1240 { 1241 scalingList = pcSlice->getSPS()->getScalingList(); 1153 if(pcSlice->getLayerId()) 1154 { 1155 pcSlice->generateAlterRefforTMVP(); 1156 } 1157 #endif 1158 } 1159 1160 m_pcPic->setCurrSliceIdx(m_uiSliceIdx); 1161 if(pcSlice->getSPS()->getScalingListFlag()) 1162 { 1163 TComScalingList scalingList; 1164 if(pcSlice->getPPS()->getScalingListPresentFlag()) 1165 { 1166 scalingList = pcSlice->getPPS()->getScalingList(); 1167 } 1168 else if (pcSlice->getSPS()->getScalingListPresentFlag()) 1169 { 1170 scalingList = pcSlice->getSPS()->getScalingList(); 1171 } 1172 else 1173 { 1174 scalingList.setDefaultScalingList(); 1175 } 1176 m_cTrQuant.setScalingListDec(scalingList); 1177 m_cTrQuant.setUseScalingList(true); 1242 1178 } 1243 1179 else 1244 1180 { 1245 scalingList.setDefaultScalingList(); 1246 } 1247 m_cTrQuant.setScalingListDec(scalingList); 1248 m_cTrQuant.setUseScalingList(true); 1249 } 1250 else 1251 { 1252 const Int maxLog2TrDynamicRange[MAX_NUM_CHANNEL_TYPE] = 1253 { 1181 const Int maxLog2TrDynamicRange[MAX_NUM_CHANNEL_TYPE] = 1182 { 1254 1183 pcSlice->getSPS()->getMaxLog2TrDynamicRange(CHANNEL_TYPE_LUMA), 1255 1184 pcSlice->getSPS()->getMaxLog2TrDynamicRange(CHANNEL_TYPE_CHROMA) 1256 }; 1257 m_cTrQuant.setFlatScalingList(maxLog2TrDynamicRange, pcSlice->getSPS()->getBitDepths()); 1258 m_cTrQuant.setUseScalingList(false); 1259 } 1260 1261 #if !NH_3D_FIX_TICKET_101 1262 #if NH_3D_IV_MERGE 1263 #if H_3D_FCO 1264 if( !pcSlice->getIsDepth() && m_pcCamParsCollector ) 1185 }; 1186 m_cTrQuant.setFlatScalingList(maxLog2TrDynamicRange, pcSlice->getSPS()->getBitDepths()); 1187 m_cTrQuant.setUseScalingList(false); 1188 } 1189 1190 #if NH_3D 1191 if ( decProcAnnexI() ) 1192 { 1193 pcSlice->checkInCompPredRefLayers(); 1194 } 1195 #endif 1196 1197 // Decode a picture 1198 m_cGopDecoder.decompressSlice(&(nalu.getBitstream()), m_pcPic); 1199 1200 #if NH_3D 1201 if( m_pcCamParsCollector ) 1202 { 1203 m_pcCamParsCollector->setSlice( pcSlice ); 1204 } 1205 #endif 1206 1207 #if !NH_MV 1208 m_bFirstSliceInPicture = false; 1265 1209 #else 1266 if( pcSlice->getIsDepth() && m_pcCamParsCollector ) 1267 #endif 1268 { 1269 m_pcCamParsCollector->copyCamParamForSlice( pcSlice ); 1270 } 1271 #endif 1272 #endif 1273 // Decode a picture 1274 m_cGopDecoder.decompressSlice(&(nalu.getBitstream()), m_pcPic); 1275 1276 #if NH_3D 1277 if( m_pcCamParsCollector ) 1278 { 1279 m_pcCamParsCollector->setSlice( pcSlice ); 1280 } 1281 #endif 1282 1283 m_bFirstSliceInPicture = false; 1210 } 1211 #endif 1284 1212 m_uiSliceIdx++; 1285 1213 1214 #if !NH_MV 1286 1215 return false; 1287 } 1216 #endif 1217 } 1218 1288 1219 1289 1220 Void TDecTop::xDecodeVPS(const std::vector<UChar> &naluData) … … 1333 1264 1334 1265 #if NH_MV 1335 Bool TDecTop::decode (InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay, Bool newLayerFlag, Bool& sliceSkippedFlag)1266 Bool TDecTop::decodeNonVclNalu(InputNALUnit& nalu ) 1336 1267 #else 1337 1268 Bool TDecTop::decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay) … … 1354 1285 case NAL_UNIT_VPS: 1355 1286 xDecodeVPS(nalu.getBitstream().getFifo()); 1356 #if NH_MV1357 m_isLastNALWasEos = false;1358 #endif1359 1287 return false; 1360 1288 … … 1373 1301 1374 1302 case NAL_UNIT_SUFFIX_SEI: 1375 #if NH_MV1376 if ( nalu.m_nalUnitType == NAL_UNIT_SUFFIX_SEI )1377 {1378 assert( m_isLastNALWasEos == false );1379 }1380 #endif1381 1303 if (m_pcPic) 1382 1304 { … … 1410 1332 case NAL_UNIT_CODED_SLICE_RASL_R: 1411 1333 #if NH_MV 1412 if (nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_TRAIL_R || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_TRAIL_N || 1413 nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_TSA_R || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_TSA_N || 1414 nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_STSA_R || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_STSA_N || 1415 nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_RADL_R || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_RADL_N || 1416 nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N ) 1417 { 1418 assert( m_isLastNALWasEos == false ); 1419 } 1420 else 1421 { 1422 m_isLastNALWasEos = false; 1423 } 1424 return xDecodeSlice(nalu, iSkipFrame, iPOCLastDisplay, newLayerFlag, sliceSkippedFlag ); 1334 assert( false ); 1335 return 1; 1425 1336 #else 1426 1337 return xDecodeSlice(nalu, iSkipFrame, iPOCLastDisplay); … … 1429 1340 1430 1341 case NAL_UNIT_EOS: 1431 #if NH_MV 1432 assert( m_isLastNALWasEos == false ); 1433 //Check layer id of the nalu. if it is not 0, give a warning message and just return without doing anything. 1434 if (nalu.m_nuhLayerId > 0) 1435 { 1436 printf( "\nThis bitstream has EOS with non-zero layer id.\n" ); 1437 return false; 1438 } 1439 m_isLastNALWasEos = true; 1440 #endif 1342 #if !NH_MV 1441 1343 m_associatedIRAPType = NAL_UNIT_INVALID; 1442 1344 m_pocCRA = 0; … … 1445 1347 m_prevSliceSkipped = false; 1446 1348 m_skippedPOC = 0; 1349 #endif 1447 1350 return false; 1448 1351 … … 1465 1368 fdReader.parseFillerData(&(nalu.getBitstream()),size); 1466 1369 printf ("Note: found NAL_UNIT_FILLER_DATA with %u bytes payload.\n", size); 1467 #if NH_MV1468 assert( m_isLastNALWasEos == false );1469 #endif1470 1370 return false; 1471 1371 } … … 1528 1428 } 1529 1429 1430 #if !NH_MV 1530 1431 /** Function for checking if picture should be skipped because of association with a previous BLA picture 1531 1432 * \param iPOCLastDisplay POC of last picture displayed … … 1558 1459 * access point there is no guarantee that the decoder will not crash. 1559 1460 */ 1560 #if NH_MV1561 Bool TDecTop::isRandomAccessSkipPicture(Int& iSkipFrame, Int& iPOCLastDisplay, const TComVPS* vps)1562 #else1563 1461 Bool TDecTop::isRandomAccessSkipPicture(Int& iSkipFrame, Int& iPOCLastDisplay ) 1564 #endif1565 1462 { 1566 1463 if (iSkipFrame) … … 1569 1466 return true; 1570 1467 } 1571 #if NH_MV1572 else if ( !m_layerInitilizedFlag[ m_layerId ] ) // start of random access point, m_pocRandomAccess has not been set yet.1573 #else1574 1468 else if (m_pocRandomAccess == MAX_INT) // start of random access point, m_pocRandomAccess has not been set yet. 1575 #endif1576 1469 { 1577 1470 if ( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA … … 1581 1474 { 1582 1475 1583 #if NH_MV1584 if ( xAllRefLayersInitilized( vps ) )1585 {1586 m_layerInitilizedFlag[ m_layerId ] = true;1587 m_pocRandomAccess = m_apcSlicePilot->getPOC();1588 }1589 else1590 {1591 return true;1592 }1593 #else1594 1476 // set the POC random access since we need to skip the reordered pictures in the case of CRA/CRANT/BLA/BLANT. 1595 1477 m_pocRandomAccess = m_apcSlicePilot->getPOC(); 1596 #endif1597 1478 } 1598 1479 else if ( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP ) 1599 1480 { 1600 #if NH_MV1601 if ( xAllRefLayersInitilized( vps) )1602 {1603 m_layerInitilizedFlag[ m_layerId ] = true;1604 m_pocRandomAccess = -MAX_INT; // no need to skip the reordered pictures in IDR, they are decodable.1605 }1606 else1607 {1608 return true;1609 }1610 #else1611 1481 m_pocRandomAccess = -MAX_INT; // no need to skip the reordered pictures in IDR, they are decodable. 1612 #endif1613 1482 } 1614 1483 else 1615 1484 { 1616 #if NH_MV1617 static Bool warningMessage[MAX_NUM_LAYERS];1618 static Bool warningInitFlag = false;1619 1620 if (!warningInitFlag)1621 {1622 for ( Int i = 0; i < MAX_NUM_LAYERS; i++)1623 {1624 warningMessage[i] = true;1625 }1626 warningInitFlag = true;1627 }1628 1629 if ( warningMessage[getLayerId()] )1630 {1631 printf("\nLayer%3d No valid random access point. VCL NAL units of this layer are discarded until next layer initialization picture. ", getLayerId() );1632 warningMessage[m_layerId] = false;1633 }1634 #else1635 1485 if(!m_warningMessageSkipPicture) 1636 1486 { … … 1638 1488 m_warningMessageSkipPicture = true; 1639 1489 } 1640 #endif1641 1490 return true; 1642 1491 } … … 1649 1498 } 1650 1499 // if we reach here, then the picture is not skipped. 1651 #if NH_MV 1652 return !m_layerInitilizedFlag[ getLayerId() ]; 1500 return false; 1501 } 1502 1653 1503 #else 1654 return false; 1655 #endif 1656 } 1657 #if NH_MV 1658 TComPic* TDecTop::getPic( Int poc ) 1659 { 1660 xGetPic( m_layerId, poc ); 1661 TComList<TComPic*>* listPic = getListPic(); 1662 TComPic* pcPic = NULL; 1663 for(TComList<TComPic*>::iterator it=listPic->begin(); it!=listPic->end(); it++) 1664 { 1665 if( (*it)->getPOC() == poc ) 1666 { 1667 pcPic = *it ; 1668 break ; 1669 } 1670 } 1671 return pcPic; 1672 } 1673 1674 TComPic* TDecTop::xGetPic( Int layerId, Int poc ) 1504 1505 Int TDecTop::preDecodePoc( Bool firstPicInLayerDecodedFlag, Bool isFstPicOfAllLayOfPocResetPer, Bool isPocResettingPicture ) 1506 { 1507 //Output of this process is PicOrderCntVal, the picture order count of the current picture. 1508 // Picture order counts are used to identify pictures, for deriving motion parameters in merge mode and 1509 // motion vector prediction and for decoder conformance checking (see clause F.13.5). 1510 1511 // Each coded picture is associated with a picture order count variable, denoted as PicOrderCntVal. 1512 1513 TComSlice* slice = m_apcSlicePilot; 1514 const Int nuhLayerId = slice->getLayerId(); 1515 const TComVPS* vps = slice->getVPS(); 1516 const TComSPS* sps = slice->getSPS(); 1517 1518 Int pocDecrementedInDpbFlag = m_pocDecrementedInDpbFlag[ nuhLayerId ]; 1519 1520 if ( isFstPicOfAllLayOfPocResetPer ) 1521 { 1522 // When the current picture is the first picture among all layers of a POC resetting period, 1523 // the variable PocDecrementedInDPBFlag[ i ] is set equal to 0 for each value of i in the range of 0 to 62, inclusive. 1524 pocDecrementedInDpbFlag = false; 1525 } 1526 1527 // The variable pocResettingFlag is derived as follows: 1528 Bool pocResettingFlag; 1529 if ( isPocResettingPicture ) 1530 { 1531 //- If the current picture is a POC resetting picture, the following applies: 1532 if( vps->getVpsPocLsbAlignedFlag() ) 1533 { 1534 // - If vps_poc_lsb_aligned_flag is equal to 0, pocResettingFlag is set equal to 1. 1535 pocResettingFlag = true; 1536 } 1537 else if ( pocDecrementedInDpbFlag ) 1538 { 1539 // - Otherwise, if PocDecrementedInDPBFlag[ nuh_layer_id ] is equal to 1, pocResettingFlag is set equal to 0. 1540 pocResettingFlag = false; 1541 } 1542 else 1543 { 1544 // - Otherwise, pocResettingFlag is set equal to 1. 1545 pocResettingFlag = true; 1546 } 1547 } 1548 else 1549 { 1550 // - Otherwise, pocResettingFlag is set equal to 0. 1551 pocResettingFlag = false; 1552 } 1553 1554 Int picOrderCntMsb; 1555 Int picOrderCntVal; 1556 1557 // Depending on pocResettingFlag, the following applies: 1558 if ( pocResettingFlag ) 1559 { 1560 //- The PicOrderCntVal of the current picture is derived as follows: 1561 if( slice->getPocResetIdc() == 1 ) 1562 { 1563 picOrderCntVal = slice->getSlicePicOrderCntLsb(); 1564 } 1565 else if (slice->getPocResetIdc() == 2 ) 1566 { 1567 picOrderCntVal = 0; 1568 } 1569 else 1570 { 1571 picOrderCntMsb = xGetCurrMsb( slice->getSlicePicOrderCntLsb(), slice->getFullPocResetFlag() ? 0 : slice->getPocLsbVal(), 0, sps->getMaxPicOrderCntLsb() ); 1572 picOrderCntVal = picOrderCntMsb + slice->getSlicePicOrderCntLsb(); 1573 } 1574 } 1575 else 1576 { 1577 //- Otherwise (pocResettingFlag is equal to 0), the following applies: 1578 //- The PicOrderCntVal of the current picture is derived as follows: 1579 1580 if( slice->getPocMsbCycleValPresentFlag() ) 1581 { 1582 picOrderCntMsb = slice->getPocMsbCycleVal() * sps->getMaxPicOrderCntLsb(); 1583 } 1584 else if( !firstPicInLayerDecodedFlag || 1585 slice->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP || slice->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL ) 1586 { 1587 picOrderCntMsb = 0; // (F 62) 1588 } 1589 else 1590 { 1591 Int prevPicOrderCntLsb = m_prevPicOrderCnt & ( sps->getMaxPicOrderCntLsb() - 1 ); 1592 Int prevPicOrderCntMsb = m_prevPicOrderCnt - prevPicOrderCntLsb; 1593 picOrderCntMsb = xGetCurrMsb( slice->getSlicePicOrderCntLsb(), prevPicOrderCntLsb, prevPicOrderCntMsb, sps->getMaxPicOrderCntLsb() ); 1594 } 1595 picOrderCntVal = picOrderCntMsb + slice->getSlicePicOrderCntLsb(); 1596 } 1597 return picOrderCntVal; 1598 } 1599 1600 Void TDecTop::inferPocResetPeriodId() 1601 { 1602 // Infer PocResetPeriodId 1603 // When not present, the value of poc_reset_period_id is inferred as follows: 1604 1605 if ( !m_apcSlicePilot->getHasPocResetPeriodIdPresent() ) 1606 { 1607 if ( m_lastPresentPocResetIdc[ m_apcSlicePilot->getLayerId() ] != MIN_INT ) 1608 { 1609 // - If the previous picture picA that has poc_reset_period_id present in the slice segment header is present in the same layer 1610 // of the bitstream as the current picture, the value of poc_reset_period_id is inferred to be equal to the value of the 1611 // poc_reset_period_id of picA. 1612 1613 m_apcSlicePilot->setPocResetPeriodId( m_lastPresentPocResetIdc[ m_apcSlicePilot->getLayerId() ] ); 1614 } 1615 else 1616 { 1617 //- Otherwise, the value of poc_reset_period_id is inferred to be equal to 0. 1618 m_apcSlicePilot->setPocResetPeriodId( 0 ); 1619 } 1620 } 1621 else 1622 { 1623 m_lastPresentPocResetIdc[ m_apcSlicePilot->getLayerId() ] = m_apcSlicePilot->getPocResetPeriodId(); 1624 } 1625 } 1626 1627 1628 Void TDecTop::decodePocAndRps( ) 1675 1629 { 1676 return m_ivPicLists->getPic( layerId, poc ) ; 1677 } 1678 1679 Void TDecTop::xResetPocInPicBuffer() 1680 { 1681 TComList<TComPic*>::iterator iterPic = m_cListPic.begin(); 1682 while (iterPic != m_cListPic.end()) 1683 { 1684 TComPic* pic = *(iterPic++); 1685 if ( pic->getReconMark() ) 1686 { 1687 for( Int i = 0; i < pic->getNumAllocatedSlice(); i++) 1688 { 1689 TComSlice* slice = pic->getSlice( i ); 1690 slice->setPOC ( slice->getPOC() - m_apcSlicePilot->getPocBeforeReset() ); 1691 } 1692 } 1693 } 1694 } 1695 1696 Void TDecTop::xCeckNoClrasOutput() 1697 { 1698 // This part needs further testing! 1699 if ( getLayerId() == 0 ) 1630 assert( m_uiSliceIdx == 0 ); 1631 Int nuhLayerId = m_pcPic->getLayerId(); 1632 if ( m_decProcPocAndRps == CLAUSE_8 ) 1633 { 1634 // 8.1.3 Decoding process for a coded picture with nuh_layer_id equal to 0 1635 1636 // Variables and functions relating to picture order count are derived as 1637 // specified in clause 8.3.1. This needs to be invoked only for the first slice 1638 // segment of a picture. 1639 x831DecProcForPicOrderCount( ); 1640 1641 // The decoding process for RPS in clause 8.3.2 is invoked, wherein reference 1642 // pictures may be marked as "unused for reference" or "used for long-term 1643 // reference". This needs to be invoked only for the first slice segment of a 1644 // picture. 1645 x832DecProcForRefPicSet ( false ); 1646 } 1647 else if( m_decProcPocAndRps == ANNEX_F ) 1648 { 1649 // F.8.1.3 Common decoding process for a coded picture 1650 1651 if (nuhLayerId == 0 ) 1652 { 1653 // F.8.1.4 Decoding process for a coded picture with nuh_layer_id equal to 1654 // --> Clause 8.1.3 is invoked with replacments of 8.3.1, 8.3.2, and 8.3.3 by F.8.3.1, 8.3.2, and 8.3.3 1655 1656 // Variables and functions relating to picture order count are derived as 1657 // specified in clause 8.3.1. This needs to be invoked only for the first slice 1658 // segment of a picture. 1659 xF831DecProcForPicOrderCount( ); 1660 1661 // The decoding process for RPS in clause 8.3.2 is invoked, wherein reference 1662 // pictures may be marked as "unused for reference" or "used for long-term 1663 // reference". This needs to be invoked only for the first slice segment of a 1664 // picture. 1665 xF832DecProcForRefPicSet( ); 1666 } 1667 else 1668 { 1669 // F.8.1.5 Decoding process for starting the decoding of a coded picture with 1670 // nuh_layer_id greater than 0 1671 1672 // Variables and functions relating to picture order count are derived in clause F.8.3.1. 1673 // This needs to be invoked only for the first slice segment of a picture. It is a requirement 1674 // of bitstream conformance that PicOrderCntVal of each picture in an access unit shall have the 1675 // same value during and at the end of decoding of the access unit 1676 xF831DecProcForPicOrderCount( ); 1677 1678 // The decoding process for RPS in clause F.8.3.2 is invoked, wherein only reference pictures with 1679 // nuh_layer_id equal to that of CurrPic may be marked as "unused for reference" or "used for 1680 // long-term reference" and any picture with a different value of nuh_layer_id is not marked. 1681 // This needs to be invoked only for the first slice segment of a picture. 1682 xF832DecProcForRefPicSet( ); 1683 } 1684 } 1685 else 1686 { 1687 assert( false ); 1688 } 1689 } 1690 1691 Void TDecTop::genUnavailableRefPics( ) 1692 { 1693 assert( m_uiSliceIdx == 0 ); 1694 Int nuhLayerId = m_pcPic->getLayerId(); 1695 if ( m_decProcPocAndRps == CLAUSE_8 ) 1696 { 1697 // 8.1.3 Decoding process for a coded picture with nuh_layer_id equal to 0 1698 1699 if ( m_pcPic->isBla() || ( m_pcPic->isCra() && m_pcPic->getNoRaslOutputFlag() ) ) 1700 { 1701 // When the current picture is a BLA picture or is a CRA picture 1702 // with NoRaslOutputFlag equal to 1, the decoding process for generating 1703 // unavailable reference pictures specified in clause 8.3.3 is invoked, 1704 // which needs to be invoked only for the first slice segment of a picture. 1705 x8331GenDecProcForGenUnavilRefPics(); 1706 } 1707 } 1708 else if( m_decProcPocAndRps == ANNEX_F ) 1709 { 1710 // F.8.1.3 Common decoding process for a coded picture 1711 1712 if (nuhLayerId == 0 ) 1713 { 1714 // F.8.1.4 Decoding process for a coded picture with nuh_layer_id equal to 1715 // --> Clause 8.1.3 is invoked with replacments of 8.3.1, 8.3.2, and 8.3.3 by F.8.3.1, 8.3.2, and 8.3.3 1716 1717 if ( m_pcPic->isBla() || ( m_pcPic->isCra() && m_pcPic->getNoRaslOutputFlag() ) ) 1718 { 1719 // When the current picture is a BLA picture or is a CRA picture 1720 // with NoRaslOutputFlag equal to 1, the decoding process for generating 1721 // unavailable reference pictures specified in clause 8.3.3 is invoked, 1722 // which needs to be invoked only for the first slice segment of a picture. 1723 xF833DecProcForGenUnavRefPics(); 1724 } 1725 #if NH_MV_FIX_INIT_NUM_ACTIVE_REF_LAYER_PICS 1726 TComDecodedRps* decRps = m_pcPic->getDecodedRps(); 1727 decRps->m_numActiveRefLayerPics0 = 0; 1728 decRps->m_numActiveRefLayerPics1 = 0; 1729 #endif 1730 } 1731 else 1732 { 1733 // F.8.1.5 Decoding process for starting the decoding of a coded picture with 1734 // nuh_layer_id greater than 0 1735 1736 if ( !m_firstPicInLayerDecodedFlag[ nuhLayerId ] ) 1737 { 1738 // When FirstPicInLayerDecodedFlag[ nuh_layer_id ] is equal to 0, the decoding process for generating 1739 // unavailable reference pictures for pictures first in decoding order within a layer specified in 1740 // clause F.8.1.7 is invoked, which needs to be invoked only for the first slice segment of a picture. 1741 xF817DecProcForGenUnavRefPicForPicsFrstInDecOrderInLay(); 1742 } 1743 1744 if ( m_firstPicInLayerDecodedFlag[ nuhLayerId ] && ( m_pcPic->isIrap() && m_pcPic->getNoRaslOutputFlag() ) ) 1745 { 1746 // When FirstPicInLayerDecodedFlag[ nuh_layer_id ] is equal to 1 and the current picture is an IRAP 1747 // picture with NoRaslOutputFlag equal to 1, the decoding process for generating unavailable reference 1748 // pictures specified in clause F.8.3.3 is invoked, which needs to be invoked only for the first slice 1749 // segment of a picture. 1750 xF833DecProcForGenUnavRefPics(); 1751 } 1752 1753 if ( decProcAnnexG() ) 1754 { 1755 // G.1.2 --> G.1.3 1756 xG813DecProcForInterLayerRefPicSet(); 1757 } 1758 } 1759 } 1760 else 1761 { 1762 assert( false ); 1763 } 1764 1765 xCheckUnavailableRefPics(); 1766 } 1767 Void TDecTop::executeLoopFilters( ) 1768 { 1769 assert( m_pcPic != NULL ); 1770 if ( !m_pcPic->getHasGeneratedRefPics() && !m_pcPic->getIsGenerated() ) 1771 { 1772 m_cGopDecoder.filterPicture( m_pcPic ); 1773 } 1774 m_cCuDecoder.destroy(); 1775 } 1776 1777 Void TDecTop::finalizePic() 1778 { 1779 if( m_pcPic->isIrap() ) 1780 { 1781 m_prevIrapPoc = m_pcPic->getPOC(); 1782 m_prevIrapDecodingOrder = m_pcPic->getDecodingOrder(); 1783 } 1784 if( m_pcPic->isStsa() ) 1785 { 1786 m_prevStsaDecOrder = m_pcPic->getDecodingOrder(); 1787 m_prevStsaTemporalId = m_pcPic->getTemporalId() ; 1788 } 1789 } 1790 1791 1792 Void TDecTop::initFromActiveVps( const TComVPS* vps ) 1793 { 1794 setViewId ( vps->getViewId ( getLayerId() ) ); 1795 #if NH_3D 1796 setViewIndex( vps->getViewIndex( getLayerId() ) ); 1797 setIsDepth ( vps->getDepthId ( getLayerId() ) == 1 ); 1798 #endif 1799 1800 if ( !vps->getVpsExtensionFlag() ) 1801 { 1802 m_decodingProcess = CLAUSE_8; 1803 m_isInOwnTargetDecLayerIdList = ( getLayerId() == 0 ); 1804 } 1805 else 1806 { 1807 if ( m_targetOlsIdx == -1 ) 1808 { 1809 // Corresponds to specification by "External Means". (Should be set equal to 0, when no external means available. ) 1810 m_targetOlsIdx = vps->getVpsNumLayerSetsMinus1(); 1811 } 1812 1813 Int targetDecLayerSetIdx = vps->olsIdxToLsIdx( m_targetOlsIdx ); 1814 1815 if ( targetDecLayerSetIdx <= vps->getVpsNumLayerSetsMinus1() && vps->getVpsBaseLayerInternalFlag() ) 1816 { 1817 m_smallestLayerId = 0; 1818 } 1819 else if ( targetDecLayerSetIdx <= vps->getVpsNumLayerSetsMinus1() && !vps->getVpsBaseLayerInternalFlag() ) 1820 { 1821 m_smallestLayerId = 0; 1822 } 1823 else if ( targetDecLayerSetIdx > vps->getVpsNumLayerSetsMinus1() && vps->getNumLayersInIdList( targetDecLayerSetIdx) == 1 ) 1824 { 1825 1826 // m_smallestLayerId = 0; 1827 // For now don't do change of layer id here. 1828 m_smallestLayerId = vps->getTargetDecLayerIdList( targetDecLayerSetIdx )[ 0 ]; 1829 } 1830 else 1831 { 1832 m_smallestLayerId = vps->getTargetDecLayerIdList( targetDecLayerSetIdx )[ 0 ]; 1833 } 1834 1835 1836 // Set profile 1837 Int lsIdx = vps->olsIdxToLsIdx( m_targetOlsIdx ); 1838 Int lIdx = -1; 1839 for (Int j = 0; j < vps->getNumLayersInIdList( lsIdx ) ; j++ ) 1840 { 1841 if ( vps->getLayerSetLayerIdList( lsIdx, j ) == getLayerId() ) 1842 { 1843 lIdx = j; 1844 break; 1845 } 1846 } 1847 m_isInOwnTargetDecLayerIdList = (lIdx != -1); 1848 1849 if ( m_isInOwnTargetDecLayerIdList ) 1850 { 1851 Int profileIdc = vps->getPTL( vps->getProfileTierLevelIdx( m_targetOlsIdx, lIdx ) )->getGeneralPTL()->getProfileIdc(); 1852 assert( profileIdc == 1 || profileIdc == 6 || profileIdc == 8 ); 1853 1854 if ( profileIdc == 6 ) 1855 { 1856 m_decodingProcess = ANNEX_G; 1857 } 1858 else if (profileIdc == 7 ) 1859 { 1860 m_decodingProcess = ANNEX_H; 1861 } 1862 else if (profileIdc == 8 ) 1863 { 1864 m_decodingProcess = ANNEX_I; 1865 } 1866 } 1867 } 1868 } 1869 1870 1871 Bool TDecTop::getFirstSliceSegementInPicFlag() 1872 { 1873 return m_apcSlicePilot->getFirstSliceSegementInPicFlag(); 1874 } 1875 1876 Void TDecTop::x831DecProcForPicOrderCount() 1877 { 1878 ///////////////////////////////////////////////////// 1879 // 8.3.1 Decoding process for picture order count // 1880 ///////////////////////////////////////////////////// 1881 1882 // Output of this process is PicOrderCntVal, the picture order count of the current picture. 1883 // Picture order counts are used to identify pictures, for deriving motion parameters in merge mode and 1884 // motion vector prediction, and for decoder conformance checking (see clause C.5). 1885 // Each coded picture is associated with a picture order count variable, denoted as PicOrderCntVal. 1886 1887 const TComSlice* curSlice = m_pcPic->getSlice(0); 1888 1889 Int prevPicOrderCntLsb = MIN_INT; 1890 Int prevPicOrderCntMsb = MIN_INT; 1891 if (!(m_pcPic->isIrap() && m_pcPic->getNoRaslOutputFlag() ) ) 1892 { 1893 // When the current picture is not an IRAP picture with NoRaslOutputFlag equal to 1, 1894 // the variables prevPicOrderCntLsb and prevPicOrderCntMsb are derived as follows: 1895 1896 // - Let prevTid0Pic be the previous picture in decoding order that has TemporalId equal to 0 and that is not a RASL picture, 1897 // a RADL picture or an SLNR picture. 1898 1899 // - The variable prevPicOrderCntLsb is set equal to slice_pic_order_cnt_lsb of prevTid0Pic. 1900 prevPicOrderCntLsb = m_prevTid0PicSlicePicOrderCntLsb; 1901 1902 // - The variable prevPicOrderCntMsb is set equal to PicOrderCntMsb of prevTid0Pic. 1903 prevPicOrderCntMsb = m_prevTid0PicPicOrderCntMsb; 1904 } 1905 1906 // The variable PicOrderCntMsb of the current picture is derived as follows: 1907 1908 Int slicePicOrderCntLsb = curSlice->getSlicePicOrderCntLsb(); 1909 1910 Int picOrderCntMsb; 1911 1912 if (m_pcPic->isIrap() && m_pcPic->getNoRaslOutputFlag() ) 1913 { 1914 //- If the current picture is an IRAP picture with NoRaslOutputFlag equal to 1, PicOrderCntMsb is set equal to 0. 1915 picOrderCntMsb = 0; 1916 } 1917 else 1918 { 1919 Int maxPicOrderCntLsb = curSlice->getSPS()->getMaxPicOrderCntLsb(); 1920 1921 // - Otherwise, PicOrderCntMsb is derived as follows: 1922 1923 if( ( slicePicOrderCntLsb < prevPicOrderCntLsb ) && 1924 ( ( prevPicOrderCntLsb - slicePicOrderCntLsb ) >= ( maxPicOrderCntLsb / 2 ) ) ) 1925 { 1926 picOrderCntMsb = prevPicOrderCntMsb + maxPicOrderCntLsb; // (8 1) 1927 } 1928 else if( (slicePicOrderCntLsb > prevPicOrderCntLsb ) && 1929 ( ( slicePicOrderCntLsb - prevPicOrderCntLsb ) > ( maxPicOrderCntLsb / 2 ) ) ) 1930 { 1931 picOrderCntMsb = prevPicOrderCntMsb - maxPicOrderCntLsb; 1932 } 1933 else 1934 { 1935 picOrderCntMsb = prevPicOrderCntMsb; 1936 } 1937 } 1938 1939 //PicOrderCntVal is derived as follows: 1940 Int picOrderCntVal = picOrderCntMsb + slicePicOrderCntLsb; // (8 2) 1941 1942 // NOTE 1 - All IDR pictures will have PicOrderCntVal equal to 0 since slice_pic_order_cnt_lsb is inferred to be 0 for IDR 1943 // pictures and prevPicOrderCntLsb and prevPicOrderCntMsb are both set equal to 0. 1944 1945 m_pcPic->getSlice(0)->setPOC( picOrderCntVal ); 1946 1947 // Update prevTid0Pic 1948 // Let prevTid0Pic be the previous picture in decoding order that has TemporalId equal to 0 and that is not a RASL picture, a RADL picture or an SLNR picture. 1949 if( curSlice->getTemporalId() == 0 && !m_pcPic->isRasl() && !m_pcPic->isRadl() && !m_pcPic->isSlnr() ) 1950 { 1951 m_prevTid0PicSlicePicOrderCntLsb = slicePicOrderCntLsb; 1952 m_prevTid0PicPicOrderCntMsb = picOrderCntMsb; 1953 } 1954 } 1955 1956 Void TDecTop::xF831DecProcForPicOrderCount() 1957 { 1958 //Output of this process is PicOrderCntVal, the picture order count of the current picture. 1959 // Picture order counts are used to identify pictures, for deriving motion parameters in merge mode and 1960 // motion vector prediction and for decoder conformance checking (see clause F.13.5). 1961 1962 // Each coded picture is associated with a picture order count variable, denoted as PicOrderCntVal. 1963 1964 const TComSlice* slice = m_pcPic->getSlice(0); 1965 const Int nuhLayerId = m_pcPic->getLayerId(); 1966 const TComVPS* vps = slice->getVPS(); 1967 const TComSPS* sps = slice->getSPS(); 1968 if ( m_pcPic->getIsFstPicOfAllLayOfPocResetPer() ) 1969 { 1970 // When the current picture is the first picture among all layers of a POC resetting period, 1971 // the variable PocDecrementedInDPBFlag[ i ] is set equal to 0 for each value of i in the range of 0 to 62, inclusive. 1972 for (Int i = 0; i <= 62; i++) 1973 { 1974 m_pocDecrementedInDpbFlag[ i ] = 0; 1975 } 1976 } 1977 1978 // The variable pocResettingFlag is derived as follows: 1979 Bool pocResettingFlag; 1980 if (m_pcPic->getIsPocResettingPic() ) 1981 { 1982 //- If the current picture is a POC resetting picture, the following applies: 1983 if( vps->getVpsPocLsbAlignedFlag() ) 1984 { 1985 // - If vps_poc_lsb_aligned_flag is equal to 0, pocResettingFlag is set equal to 1. 1986 pocResettingFlag = true; 1987 } 1988 else if ( m_pocDecrementedInDpbFlag[ nuhLayerId ] ) 1989 { 1990 // - Otherwise, if PocDecrementedInDPBFlag[ nuh_layer_id ] is equal to 1, pocResettingFlag is set equal to 0. 1991 pocResettingFlag = false; 1992 } 1993 else 1994 { 1995 // - Otherwise, pocResettingFlag is set equal to 1. 1996 pocResettingFlag = true; 1997 } 1998 } 1999 else 2000 { 2001 // - Otherwise, pocResettingFlag is set equal to 0. 2002 pocResettingFlag = false; 2003 } 2004 2005 // The list affectedLayerList is derived as follows: 2006 std::vector<Int> affectedLayerList; 2007 if (! vps->getVpsPocLsbAlignedFlag() ) 2008 { 2009 //- If vps_poc_lsb_aligned_flag is equal to 0, affectedLayerList consists of the nuh_layer_id of the current picture. 2010 affectedLayerList.push_back( nuhLayerId ); 2011 } 2012 else 2013 { 2014 // - Otherwise, affectedLayerList consists of the nuh_layer_id of the current picture and the nuh_layer_id values 2015 // equal to IdPredictedLayer[ currNuhLayerId ][ j ] for all values of j in the range of 0 to NumPredictedLayers[ currNuhLayerId ] - 1, 2016 // inclusive, where currNuhLayerId is the nuh_layer_id value of the current picture. 2017 affectedLayerList.push_back( nuhLayerId ); 2018 Int currNuhLayerId = nuhLayerId; 2019 for (Int j = 0; j <= vps->getNumPredictedLayers( currNuhLayerId )-1; j++ ) 2020 { 2021 affectedLayerList.push_back( vps->getIdPredictedLayer(currNuhLayerId, j ) ); 2022 } 2023 } 2024 2025 Int picOrderCntMsb; 2026 Int picOrderCntVal; 2027 2028 // Depending on pocResettingFlag, the following applies: 2029 if ( pocResettingFlag ) 2030 { 2031 //- If pocResettingFlag is equal to 1, the following applies: 2032 if ( m_firstPicInLayerDecodedFlag[ nuhLayerId ] ) 2033 { 2034 //- The variables pocMsbDelta, pocLsbDelta and DeltaPocVal are derived as follows: 2035 Int pocMsbDelta; 2036 Int pocLsbDelta; 2037 Int deltaPocVal; 2038 2039 { 2040 Int pocLsbVal; 2041 Int prevPicOrderCntLsb; 2042 Int prevPicOrderCntMsb; 2043 2044 if( slice->getPocResetIdc() == 3 ) 2045 { 2046 pocLsbVal = slice->getPocLsbVal(); 2047 } 2048 else 2049 { 2050 pocLsbVal = slice->getSlicePicOrderCntLsb(); 2051 } 2052 2053 if( slice->getPocMsbCycleValPresentFlag() ) 2054 { 2055 pocMsbDelta = slice->getPocMsbCycleVal() * sps->getMaxPicOrderCntLsb(); // (F 60) 2056 } 2057 else 2058 { 2059 prevPicOrderCntLsb = m_prevPicOrderCnt & ( sps->getMaxPicOrderCntLsb() - 1 ); 2060 prevPicOrderCntMsb = m_prevPicOrderCnt - prevPicOrderCntLsb; 2061 2062 pocMsbDelta = xGetCurrMsb( pocLsbVal, prevPicOrderCntLsb, prevPicOrderCntMsb, sps->getMaxPicOrderCntLsb() ); 2063 } 2064 2065 if( slice->getPocResetIdc() == 2 || ( slice->getPocResetIdc() == 3 && slice->getFullPocResetFlag() ) ) 2066 { 2067 pocLsbDelta = pocLsbVal; 2068 } 2069 else 2070 { 2071 pocLsbDelta = 0; 2072 } 2073 deltaPocVal = pocMsbDelta + pocLsbDelta; 2074 } 2075 2076 //- The PicOrderCntVal of each picture that has nuh_layer_id value nuhLayerId for which PocDecrementedInDPBFlag[ nuhLayerId ] is equal to 0 2077 // and that is equal to any value in affectedLayerList is decremented by DeltaPocVal. 2078 for (Int i = 0; i < (Int) affectedLayerList.size(); i++ ) 2079 { 2080 if ( !m_pocDecrementedInDpbFlag[ affectedLayerList[i] ] ) 2081 { 2082 m_dpb->decrementPocsInSubDpb( affectedLayerList[i], deltaPocVal ); 2083 } 2084 } 2085 2086 //- PocDecrementedInDPBFlag[ nuhLayerId ] is set equal to 1 for each value of nuhLayerId included in affectedLayerList. 2087 for (Int i = 0; i < (Int) affectedLayerList.size(); i++ ) 2088 { 2089 m_pocDecrementedInDpbFlag[ affectedLayerList[i] ] = true; 2090 } 2091 } 2092 2093 //- The PicOrderCntVal of the current picture is derived as follows: 2094 if( slice->getPocResetIdc() == 1 ) 2095 { 2096 picOrderCntVal = slice->getSlicePicOrderCntLsb(); 2097 } 2098 else if (slice->getPocResetIdc() == 2 ) 2099 { 2100 picOrderCntVal = 0; 2101 } 2102 else 2103 { 2104 picOrderCntMsb = xGetCurrMsb( slice->getSlicePicOrderCntLsb(), slice->getFullPocResetFlag() ? 0 : slice->getPocLsbVal(), 0, sps->getMaxPicOrderCntLsb() ); 2105 picOrderCntVal = picOrderCntMsb + slice->getSlicePicOrderCntLsb(); 2106 } 2107 } 2108 else 2109 { 2110 //- Otherwise (pocResettingFlag is equal to 0), the following applies: 2111 //- The PicOrderCntVal of the current picture is derived as follows: 2112 2113 if( slice->getPocMsbCycleValPresentFlag() ) 2114 { 2115 picOrderCntMsb = slice->getPocMsbCycleVal() * sps->getMaxPicOrderCntLsb(); 2116 } 2117 else if( !m_firstPicInLayerDecodedFlag[ nuhLayerId ] || 2118 slice->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP || slice->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL ) 2119 { 2120 picOrderCntMsb = 0; // (F 62) 2121 } 2122 else 2123 { 2124 Int prevPicOrderCntLsb = m_prevPicOrderCnt & ( sps->getMaxPicOrderCntLsb() - 1 ); 2125 Int prevPicOrderCntMsb = m_prevPicOrderCnt - prevPicOrderCntLsb; 2126 picOrderCntMsb = xGetCurrMsb( slice->getSlicePicOrderCntLsb(), prevPicOrderCntLsb, prevPicOrderCntMsb, sps->getMaxPicOrderCntLsb() ); 2127 } 2128 picOrderCntVal = picOrderCntMsb + slice->getSlicePicOrderCntLsb(); 2129 } 2130 2131 m_pcPic->getSlice(0)->setPOC( picOrderCntVal ); 2132 2133 for (Int lId = 0; lId < (Int) affectedLayerList.size(); lId++ ) 2134 { 2135 // The value of PrevPicOrderCnt[ lId ] for each of the lId values included in affectedLayerList is derived as follows: 2136 2137 if (!m_pcPic->isRasl() && !m_pcPic->isRadl() && !m_pcPic->isSlnr() && slice->getTemporalId() == 0 && !slice->getDiscardableFlag() ) 2138 { 2139 //- If the current picture is not a RASL picture, a RADL picture or a sub-layer non-reference picture, and the current picture 2140 // has TemporalId equal to 0 and discardable_flag equal to 0, PrevPicOrderCnt[ lId ] is set equal to PicOrderCntVal. 2141 m_prevPicOrderCnt = picOrderCntVal; 2142 } 2143 else if ( slice->getPocResetIdc() == 3 && ( 2144 ( !m_firstPicInLayerDecodedFlag[ nuhLayerId ]) || 2145 ( m_firstPicInLayerDecodedFlag[ nuhLayerId ] && m_pcPic->getIsPocResettingPic() ) 2146 ) ) 2147 { 2148 // - Otherwise, when poc_reset_idc is equal to 3 and one of the following conditions is true, PrevPicOrderCnt[ lId ] is set equal to ( full_poc_reset_flag ? 0 : poc_lsb_val ): 2149 // - FirstPicInLayerDecodedFlag[ nuh_layer_id ] is equal to 0. 2150 // - FirstPicInLayerDecodedFlag[ nuh_layer_id ] is equal to 1 and the current picture is a POC resetting picture. 2151 m_prevPicOrderCnt = ( slice->getFullPocResetFlag() ? 0 : slice->getPocLsbVal() ); 2152 } 2153 } 2154 } 2155 2156 Int TDecTop::xGetCurrMsb( Int cl, Int pl, Int pm, Int ml ) 2157 { 2158 Int currMsb; 2159 if ((pl - cl) >= (ml/ 2)) 2160 { 2161 currMsb = pm + ml; 2162 } 2163 else if ( (cl - pl) > (ml / 2)) 2164 { 2165 currMsb = pm - ml; 2166 } 2167 else 2168 { 2169 currMsb = pm; 2170 } 2171 2172 return currMsb; 2173 } 2174 2175 2176 2177 Void TDecTop::x832DecProcForRefPicSet( Bool annexFModifications ) 2178 { 2179 /////////////////////////////////////////////////////////////////////////////////////// 2180 // 8.3.2 8.3.2 Decoding process for reference picture set 2181 /////////////////////////////////////////////////////////////////////////////////////// 2182 2183 TComSlice* slice = m_pcPic->getSlice( 0 ); 2184 const TComSPS* sps = slice->getSPS(); 2185 // This process is invoked once per picture, after decoding of a slice header but prior to the decoding of any coding unit and prior 2186 // to the decoding process for reference picture list construction for the slice as specified in clause 8.3.3. 2187 // This process may result in one or more reference pictures in the DPB being marked as "unused for reference" or 2188 // "used for long-term reference". 2189 2190 // The variable currPicLayerId is set equal to nuh_layer_id of the current picture. 2191 Int currPicLayerId = m_pcPic->getLayerId(); 2192 Int picOrderCntVal = m_pcPic->getPOC(); 2193 2194 if (m_pcPic->isIrap() && m_pcPic->getNoRaslOutputFlag() ) 2195 { 2196 // When the current picture is an IRAP picture with NoRaslOutputFlag equal to 1, 2197 // all reference pictures with nuh_layer_id equal to currPicLayerId currently in the 2198 // DPB (if any) are marked as "unused for reference". 2199 m_dpb->markSubDpbAsUnusedForReference( currPicLayerId ); 2200 } 2201 // Short-term reference pictures are identified by their PicOrderCntVal values. Long-term reference pictures are identified either by 2202 // their PicOrderCntVal values or their slice_pic_order_cnt_lsb values. 2203 2204 // Five lists of picture order count values are constructed to derive the RPS. These five lists are PocStCurrBefore, 2205 // PocStCurrAfter, PocStFoll, PocLtCurr and PocLtFoll, with NumPocStCurrBefore, NumPocStCurrAfter, NumPocStFoll, 2206 // NumPocLtCurr and NumPocLtFoll number of elements, respectively. The five lists and the five variables are derived as follows: 2207 2208 TComDecodedRps* decRps = m_pcPic->getDecodedRps(); 2209 2210 std::vector<Int>& pocStCurrBefore = decRps->m_pocStCurrBefore; 2211 std::vector<Int>& pocStCurrAfter = decRps->m_pocStCurrAfter; 2212 std::vector<Int>& pocStFoll = decRps->m_pocStFoll; 2213 std::vector<Int>& pocLtCurr = decRps->m_pocLtCurr; 2214 std::vector<Int>& pocLtFoll = decRps->m_pocLtFoll; 2215 2216 Int& numPocStCurrBefore = decRps->m_numPocStCurrBefore; 2217 Int& numPocStCurrAfter = decRps->m_numPocStCurrAfter; 2218 Int& numPocStFoll = decRps->m_numPocStFoll; 2219 Int& numPocLtCurr = decRps->m_numPocLtCurr; 2220 Int& numPocLtFoll = decRps->m_numPocLtFoll; 2221 2222 std::vector<Int> currDeltaPocMsbPresentFlag, follDeltaPocMsbPresentFlag; 2223 2224 if (m_pcPic->isIdr() ) 2225 { 2226 // - If the current picture is an IDR picture, PocStCurrBefore, PocStCurrAfter, PocStFoll, 2227 // PocLtCurr and PocLtFoll are all set to be empty, and NumPocStCurrBefore, 2228 // NumPocStCurrAfter, NumPocStFoll, NumPocLtCurr and NumPocLtFoll are all set equal to 0. 2229 2230 pocStCurrBefore.clear(); 2231 pocStCurrAfter .clear(); 2232 pocStFoll .clear(); 2233 pocLtCurr .clear(); 2234 pocLtFoll .clear(); 2235 numPocStCurrBefore = 0; 2236 numPocStCurrAfter = 0; 2237 numPocStFoll = 0; 2238 numPocLtCurr = 0; 2239 numPocLtFoll = 0; 2240 } 2241 else 2242 { 2243 const TComStRefPicSet* stRps = slice->getStRps( slice->getCurrRpsIdx() ); 2244 // - Otherwise, the following applies: 2245 2246 Int j = 0; 2247 Int k = 0; 2248 for( Int i = 0; i < stRps->getNumNegativePicsVar() ; i++ ) 2249 { 2250 if( stRps->getUsedByCurrPicS0Var( i ) ) 2251 { 2252 pocStCurrBefore.push_back( picOrderCntVal + stRps->getDeltaPocS0Var( i ) ); j++; 2253 } 2254 else 2255 { 2256 pocStFoll .push_back( picOrderCntVal + stRps->getDeltaPocS0Var( i ) ); k++; 2257 } 2258 } 2259 numPocStCurrBefore = j; 2260 2261 j = 0; 2262 for (Int i = 0; i < stRps->getNumPositivePicsVar(); i++ ) 2263 { 2264 if (stRps->getUsedByCurrPicS1Var( i ) ) 2265 { 2266 pocStCurrAfter.push_back( picOrderCntVal + stRps->getDeltaPocS1Var( i ) ); j++; 2267 } 2268 else 2269 { 2270 pocStFoll .push_back( picOrderCntVal + stRps->getDeltaPocS1Var( i ) ); k++; 2271 } 2272 } 2273 numPocStCurrAfter = j; 2274 numPocStFoll = k; // (8 5) 2275 2276 2277 j = 0; 2278 k = 0; 2279 for( Int i = 0; i < slice->getNumLongTermSps( ) + slice->getNumLongTermPics(); i++ ) 2280 { 2281 Int pocLt = slice->getPocLsbLtVar( i ); 2282 if( slice->getDeltaPocMsbPresentFlag( i ) ) 2283 { 2284 pocLt += picOrderCntVal - slice->getDeltaPocMsbCycleLtVar( i ) * sps->getMaxPicOrderCntLsb() - 2285 ( picOrderCntVal & ( sps->getMaxPicOrderCntLsb() - 1 ) ); 2286 } 2287 2288 if( slice->getUsedByCurrPicLtVar(i)) 2289 { 2290 pocLtCurr.push_back( pocLt ); 2291 currDeltaPocMsbPresentFlag.push_back( slice->getDeltaPocMsbPresentFlag( i ) ); j++; 2292 } 2293 else 2294 { 2295 pocLtFoll.push_back( pocLt ); 2296 follDeltaPocMsbPresentFlag.push_back( slice->getDeltaPocMsbPresentFlag( i ) ); k++; 2297 } 2298 } 2299 numPocLtCurr = j; 2300 numPocLtFoll = k; 2301 } 2302 2303 assert(numPocStCurrAfter == pocStCurrAfter .size() ); 2304 assert(numPocStCurrBefore == pocStCurrBefore .size() ); 2305 assert(numPocStFoll == pocStFoll .size() ); 2306 assert(numPocLtCurr == pocLtCurr .size() ); 2307 assert(numPocLtFoll == pocLtFoll .size() ); 2308 2309 // where PicOrderCntVal is the picture order count of the current picture as specified in clause 8.3.1. 2310 2311 // NOTE 2 - A value of CurrRpsIdx in the range of 0 to num_short_term_ref_pic_sets - 1, inclusive, 2312 // indicates that a candidate short-term RPS from the active SPS for the current layer is being used, 2313 // where CurrRpsIdx is the index of the candidate short-term RPS into the list of candidate short-term RPSs signalled 2314 // in the active SPS for the current layer. CurrRpsIdx equal to num_short_term_ref_pic_sets indicates that 2315 // the short-term RPS of the current picture is directly signalled in the slice header. 2316 2317 for (Int i = 0; i <= numPocLtCurr - 1; i++ ) 2318 { 2319 // For each i in the range of 0 to NumPocLtCurr - 1, inclusive, when CurrDeltaPocMsbPresentFlag[ i ] is equal to 1, 2320 // it is a requirement of bitstream conformance that the following conditions apply: 2321 if ( currDeltaPocMsbPresentFlag[i] ) 2322 { 2323 // - There shall be no j in the range of 0 to NumPocStCurrBefore - 1, inclusive, 2324 // for which PocLtCurr[ i ] is equal to PocStCurrBefore[ j ]. 2325 for (Int j = 0; j <= numPocStCurrBefore - 1; j++ ) 2326 { 2327 assert(!( pocLtCurr[ i ] == pocStCurrBefore[ j ] ) ); 2328 } 2329 2330 // - There shall be no j in the range of 0 to NumPocStCurrAfter - 1, inclusive, 2331 // for which PocLtCurr[ i ] is equal to PocStCurrAfter[ j ]. 2332 for (Int j = 0; j <= numPocStCurrAfter - 1; j++ ) 2333 { 2334 assert(!( pocLtCurr[ i ] == pocStCurrAfter[ j ] ) ); 2335 } 2336 2337 // - There shall be no j in the range of 0 to NumPocStFoll - 1, inclusive, 2338 // for which PocLtCurr[ i ] is equal to PocStFoll[ j ]. 2339 for (Int j = 0; j <= numPocStFoll - 1; j++ ) 2340 { 2341 assert(!( pocLtCurr[ i ] == pocStFoll[ j ] ) ); 2342 } 2343 2344 // - There shall be no j in the range of 0 to NumPocLtCurr - 1, inclusive, 2345 // where j is not equal to i, for which PocLtCurr[ i ] is equal to PocLtCurr[ j ]. 2346 for (Int j = 0; j <= numPocLtCurr - 1; j++ ) 2347 { 2348 if ( i != j ) 2349 { 2350 assert(!( pocLtCurr[ i ] == pocLtCurr[ j ] ) ); 2351 } 2352 } 2353 } 2354 } 2355 2356 for (Int i = 0; i <= numPocLtFoll - 1; i++ ) 2357 { 2358 // For each i in the range of 0 to NumPocLtFoll - 1, inclusive, when FollDeltaPocMsbPresentFlag[ i ] is equal to 1, 2359 // it is a requirement of bitstream conformance that the following conditions apply: 2360 if ( follDeltaPocMsbPresentFlag[i] ) 2361 { 2362 // - There shall be no j in the range of 0 to NumPocStCurrBefore - 1, inclusive, 2363 // for which PocLtFoll[ i ] is equal to PocStCurrBefore[ j ]. 2364 for (Int j = 0; j <= numPocStCurrBefore - 1; j++ ) 2365 { 2366 assert(!( pocLtFoll[ i ] == pocStCurrBefore[ j ] ) ); 2367 } 2368 2369 // - There shall be no j in the range of 0 to NumPocStCurrAfter - 1, inclusive, 2370 // for which PocLtFoll[ i ] is equal to PocStCurrAfter[ j ]. 2371 for (Int j = 0; j <= numPocStCurrAfter - 1; j++ ) 2372 { 2373 assert(!( pocLtFoll[ i ] == pocStCurrAfter[ j ] ) ); 2374 } 2375 2376 // - There shall be no j in the range of 0 to NumPocStFoll - 1, inclusive, 2377 // for which PocLtFoll[ i ] is equal to PocStFoll[ j ]. 2378 for (Int j = 0; j <= numPocStFoll - 1; j++ ) 2379 { 2380 assert(!( pocLtFoll[ i ] == pocStFoll[ j ] ) ); 2381 } 2382 2383 // - There shall be no j in the range of 0 to NumPocLtFoll - 1, inclusive, 2384 // where j is not equal to i, for which PocLtFoll[ i ] is equal to PocLtFoll[ j ]. 2385 for (Int j = 0; j <= numPocLtFoll - 1; j++ ) 2386 { 2387 if (j != i) 2388 { 2389 assert(!( pocLtFoll[ i ] == pocLtFoll[ j ] ) ); 2390 } 2391 } 2392 2393 // - There shall be no j in the range of 0 to NumPocLtCurr - 1, inclusive, 2394 // for which PocLtFoll[ i ] is equal to PocLtCurr[ j ]. 2395 for (Int j = 0; j <= numPocLtCurr - 1; j++ ) 2396 { 2397 assert(!( pocLtFoll[ i ] == pocLtCurr[ j ] ) ); 2398 } 2399 } 2400 } 2401 2402 Int maxPicOrderCntLsb = sps->getMaxPicOrderCntLsb(); 2403 for (Int i = 0; i <= numPocLtCurr - 1; i++ ) 2404 { 2405 // For each i in the range of 0 to NumPocLtCurr - 1, inclusive, when CurrDeltaPocMsbPresentFlag[ i ] is equal to 0, 2406 // it is a requirement of bitstream conformance that the following conditions apply: 2407 if ( currDeltaPocMsbPresentFlag[ i ] == 0 ) 2408 { 2409 // - There shall be no j in the range of 0 to NumPocStCurrBefore - 1, inclusive, 2410 // for which PocLtCurr[ i ] is equal to ( PocStCurrBefore[ j ] & ( MaxPicOrderCntLsb - 1 ) ). 2411 for (Int j = 0; j <= numPocStCurrBefore - 1; j++ ) 2412 { 2413 assert(!( pocLtCurr[ i ] == ( pocStCurrBefore[ j ] & ( maxPicOrderCntLsb - 1 ) ) ) ); 2414 } 2415 2416 // - There shall be no j in the range of 0 to NumPocStCurrAfter - 1, inclusive, 2417 // for which PocLtCurr[ i ] is equal to ( PocStCurrAfter[ j ] & ( MaxPicOrderCntLsb - 1 ) ). 2418 for (Int j = 0; j <= numPocStCurrAfter - 1; j++ ) 2419 { 2420 assert(!( pocLtCurr[ i ] == ( pocStCurrAfter[ j ] & ( maxPicOrderCntLsb - 1 ) ) ) ); 2421 } 2422 2423 // - There shall be no j in the range of 0 to NumPocStFoll - 1, inclusive, 2424 // for which PocLtCurr[ i ] is equal to ( PocStFoll[ j ] & ( MaxPicOrderCntLsb - 1 ) ). 2425 for (Int j = 0; j <= numPocStFoll - 1; j++ ) 2426 { 2427 assert(!( pocLtCurr[ i ] == ( pocStFoll[ j ] & ( maxPicOrderCntLsb - 1 ) ) ) ); 2428 } 2429 2430 // - There shall be no j in the range of 0 to NumPocLtCurr - 1, inclusive, 2431 // where j is not equal to i, for which PocLtCurr[ i ] is equal to ( PocLtCurr[ j ] & ( MaxPicOrderCntLsb - 1 ) ). 2432 for (Int j = 0; j <= numPocLtCurr - 1; j++ ) 2433 { 2434 if (j != i) 2435 { 2436 assert(!( pocLtCurr[ i ] == ( pocLtCurr[ j ] & ( maxPicOrderCntLsb - 1 ) ) ) ); 2437 } 2438 } 2439 } 2440 } 2441 2442 for (Int i = 0; i <= numPocLtFoll - 1; i++ ) 2443 { 2444 // For each i in the range of 0 to NumPocLtFoll - 1, inclusive, when FollDeltaPocMsbPresentFlag[ i ] is equal to 0, 2445 // it is a requirement of bitstream conformance that the following conditions apply: 2446 if ( follDeltaPocMsbPresentFlag[ i ] == 0 ) 2447 { 2448 // - There shall be no j in the range of 0 to NumPocStCurrBefore - 1, inclusive, 2449 // for which PocLtFoll[ i ] is equal to ( PocStCurrBefore[ j ] & ( MaxPicOrderCntLsb - 1 ) ). 2450 for (Int j = 0; j <= numPocStCurrBefore - 1; j++ ) 2451 { 2452 assert(!( pocLtFoll[ i ] == ( pocStCurrBefore[ j ] & ( maxPicOrderCntLsb - 1 ) ) ) ); 2453 } 2454 2455 // - There shall be no j in the range of 0 to NumPocStCurrAfter - 1, inclusive, 2456 // for which PocLtFoll[ i ] is equal to ( PocStCurrAfter[ j ] & ( MaxPicOrderCntLsb - 1 ) ). 2457 for (Int j = 0; j <= numPocStCurrAfter - 1; j++ ) 2458 { 2459 assert(!( pocLtFoll[ i ] == ( pocStCurrAfter[ j ] & ( maxPicOrderCntLsb - 1 ) ) ) ); 2460 } 2461 2462 // - There shall be no j in the range of 0 to NumPocStFoll - 1, inclusive, 2463 // for which PocLtFoll[ i ] is equal to ( PocStFoll[ j ] & ( MaxPicOrderCntLsb - 1 ) ). 2464 for (Int j = 0; j <= numPocStFoll - 1; j++ ) 2465 { 2466 assert(!( pocLtFoll[ i ] == ( pocStFoll[ j ] & ( maxPicOrderCntLsb - 1 ) ) ) ); 2467 } 2468 2469 // - There shall be no j in the range of 0 to NumPocLtFoll - 1, inclusive, 2470 // where j is not equal to i, for which PocLtFoll[ i ] is equal to ( PocLtFoll[ j ] & ( MaxPicOrderCntLsb - 1 ) ). 2471 for (Int j = 0; j <= numPocLtFoll - 1; j++ ) 2472 { 2473 if (j != i) 2474 { 2475 assert(!( pocLtFoll[ i ] == ( pocLtFoll[ j ] & ( maxPicOrderCntLsb - 1 ) ) ) ); 2476 } 2477 } 2478 2479 // - There shall be no j in the range of 0 to NumPocLtCurr - 1, inclusive, 2480 // for which PocLtFoll[ i ] is equal to ( PocLtCurr[ j ] & ( MaxPicOrderCntLsb - 1 ) ). 2481 for (Int j = 0; j <= numPocLtCurr - 1; j++ ) 2482 { 2483 assert(!( pocLtFoll[ i ] == ( pocLtCurr[ j ] & ( maxPicOrderCntLsb - 1 ) ) ) ); 2484 } 2485 } 2486 } 2487 2488 if ( !annexFModifications ) 2489 { 2490 // The variable NumPicTotalCurr is derived as specified in clause 7.4.7.2. 2491 2492 // It is a requirement of bitstream conformance that the following applies to the value of NumPicTotalCurr: 2493 if ( m_pcPic->isBla() || m_pcPic->isCra() ) 2494 { 2495 // - If the current picture is a BLA or CRA picture, the value of NumPicTotalCurr shall be equal to 0. 2496 assert( slice->getNumPicTotalCurr() == 0 ); 2497 } 2498 else 2499 { 2500 // - Otherwise, 2501 if ( slice->isInterP() || slice->isInterB() ) 2502 { 2503 // when the current picture contains a P or B slice, the value of NumPicTotalCurr shall not be equal to 0. 2504 assert( slice->getNumPicTotalCurr() != 0 ); 2505 } 2506 } 2507 } 2508 2509 // The RPS of the current picture consists of five RPS lists; RefPicSetStCurrBefore, RefPicSetStCurrAfter, RefPicSetStFoll, 2510 // RefPicSetLtCurr and RefPicSetLtFoll. RefPicSetStCurrBefore, RefPicSetStCurrAfter and RefPicSetStFoll are collectively 2511 // referred to as the short-term RPS. RefPicSetLtCurr and RefPicSetLtFoll are collectively referred to as the long-term RPS. 2512 2513 std::vector<TComPic*>& refPicSetStCurrBefore = decRps->m_refPicSetStCurrBefore; 2514 std::vector<TComPic*>& refPicSetStCurrAfter = decRps->m_refPicSetStCurrAfter ; 2515 std::vector<TComPic*>& refPicSetStFoll = decRps->m_refPicSetStFoll ; 2516 std::vector<TComPic*>& refPicSetLtCurr = decRps->m_refPicSetLtCurr ; 2517 std::vector<TComPic*>& refPicSetLtFoll = decRps->m_refPicSetLtFoll ; 2518 2519 std::vector<TComPic*>** refPicSetsCurr = decRps->m_refPicSetsCurr ; 2520 std::vector<TComPic*>** refPicSetsLt = decRps->m_refPicSetsLt ; 2521 std::vector<TComPic*>** refPicSetsAll = decRps->m_refPicSetsAll ; 2522 // NOTE 3 - RefPicSetStCurrBefore, RefPicSetStCurrAfter and RefPicSetLtCurr contain all reference pictures that may be 2523 // used for inter prediction of the current picture and one or more pictures that follow the current picture in decoding order. 2524 // RefPicSetStFoll and RefPicSetLtFoll consist of all reference pictures that are not used for inter prediction of the current 2525 // picture but may be used in inter prediction for one or more pictures that follow the current picture in decoding order. 2526 2527 // The derivation process for the RPS and picture marking are performed according to the following ordered steps: 2528 // 1. The following applies: 2529 2530 TComSubDpb* dpb = m_dpb->getSubDpb( getLayerId(), false ); 2531 assert( refPicSetLtCurr.empty() ); 2532 for( Int i = 0; i < numPocLtCurr; i++ ) 2533 { 2534 if( !currDeltaPocMsbPresentFlag[ i ] ) 2535 { 2536 refPicSetLtCurr.push_back( dpb->getPicFromLsb( pocLtCurr[ i ], maxPicOrderCntLsb ) ); 2537 } 2538 else 2539 { 2540 refPicSetLtCurr.push_back(dpb->getPic( pocLtCurr[ i ] )); 2541 } 2542 } 2543 2544 assert( refPicSetLtFoll.empty() ); 2545 for( Int i = 0; i < numPocLtFoll; i++ ) 2546 { 2547 if( !follDeltaPocMsbPresentFlag[ i ] ) 2548 { 2549 refPicSetLtFoll.push_back(dpb->getPicFromLsb(pocLtFoll[ i ], maxPicOrderCntLsb )); 2550 } 2551 else 2552 { 2553 refPicSetLtFoll.push_back(dpb->getPic( pocLtFoll[ i ] )); 2554 } 2555 } 2556 2557 // 2. All reference pictures that are included in RefPicSetLtCurr or RefPicSetLtFoll and have nuh_layer_id equal 2558 // to currPicLayerId are marked as "used for long-term reference". 2559 for (Int i = 0; i < numPocLtCurr; i++) 2560 { 2561 if ( refPicSetLtCurr[i] != NULL ) 2562 { 2563 refPicSetLtCurr[i]->markAsUsedForLongTermReference(); 2564 } 2565 } 2566 2567 for (Int i = 0; i < numPocLtFoll; i++) 2568 { 2569 if ( refPicSetLtFoll[i] != NULL ) 2570 { 2571 refPicSetLtFoll[i]->markAsUsedForLongTermReference(); 2572 } 2573 } 2574 2575 // 3. The following applies: 2576 assert( refPicSetStCurrBefore.empty() ); 2577 for( Int i = 0; i < numPocStCurrBefore; i++ ) 2578 { 2579 refPicSetStCurrBefore.push_back(dpb->getShortTermRefPic( pocStCurrBefore[ i ] )); 2580 } 2581 2582 assert( refPicSetStCurrAfter.empty() ); 2583 for( Int i = 0; i < numPocStCurrAfter; i++ ) 2584 { 2585 refPicSetStCurrAfter.push_back(dpb->getShortTermRefPic( pocStCurrAfter[ i ] )); 2586 } 2587 2588 assert( refPicSetStFoll.empty() ); 2589 for( Int i = 0; i < numPocStFoll; i++ ) 2590 { 2591 refPicSetStFoll.push_back(dpb->getShortTermRefPic( pocStFoll[ i ] )); 2592 } 2593 2594 // 4. All reference pictures in the DPB that are not included in RefPicSetLtCurr, RefPicSetLtFoll, RefPicSetStCurrBefore, 2595 // RefPicSetStCurrAfter, or RefPicSetStFoll and have nuh_layer_id equal to currPicLayerId are marked as "unused for reference". 2596 TComSubDpb picsToMark = (*dpb); 2597 for (Int j = 0; j < 5; j++ ) 2598 { 2599 picsToMark.removePics( *refPicSetsAll[j] ); 2600 } 2601 picsToMark.markAllAsUnusedForReference(); 2602 2603 // NOTE 4 - There may be one or more entries in the RPS lists that are equal to "no reference picture" because 2604 // the corresponding pictures are not present in the DPB. Entries in RefPicSetStFoll or RefPicSetLtFoll that are equal 2605 // to "no reference picture" should be ignored. An unintentional picture loss should be inferred for each entry in 2606 // RefPicSetStCurrBefore, RefPicSetStCurrAfter, or RefPicSetLtCurr that is equal to "no reference picture". 2607 2608 // NOTE 5 - A picture cannot be included in more than one of the five RPS lists. 2609 2610 2611 // It is a requirement of bitstream conformance that the RPS is restricted as follows: 2612 2613 2614 #if NH_MV_FIX_NO_REF_PICS_CHECK 2615 if ( !annexFModifications || m_firstPicInLayerDecodedFlag[ m_pcPic->getLayerId() ] ) 2616 { 2617 #endif 2618 for (Int j = 0; j < 3; j++ ) 2619 { 2620 // - There shall be no entry in RefPicSetStCurrBefore, RefPicSetStCurrAfter or RefPicSetLtCurr 2621 // for which one or more of the following are true: 2622 2623 std::vector<TComPic*>* currSet = refPicSetsCurr[j]; 2624 for (Int i = 0; i < currSet->size(); i++) 2625 { 2626 TComPic* pic = (*currSet)[i]; 2627 2628 // - The entry is equal to "no reference picture". 2629 assert( ! (pic == NULL ) ); 2630 2631 // - The entry is an SLNR picture and has TemporalId equal to that of the current picture. 2632 assert( !( pic->isSlnr() && pic->getTemporalId() == m_pcPic->getTemporalId() ) ); 2633 2634 // - The entry is a picture that has TemporalId greater than that of the current picture. 2635 assert( !( pic->getTemporalId() > m_pcPic->getTemporalId() ) ); 2636 } 2637 } 2638 #if NH_MV_FIX_NO_REF_PICS_CHECK 2639 } 2640 #endif 2641 2642 // - There shall be no entry in RefPicSetLtCurr or RefPicSetLtFoll for which the 2643 // difference between the picture order count value of the current picture and the picture order count 2644 // value of the entry is greater than or equal to 2^24. 2645 for (Int j = 0; j < 2; j++ ) 1700 2646 { 1701 NalUnitType nut = m_apcSlicePilot->getNalUnitType(); 1702 1703 Bool isBLA = ( nut == NAL_UNIT_CODED_SLICE_BLA_W_LP ) || ( nut == NAL_UNIT_CODED_SLICE_BLA_N_LP ) || ( nut == NAL_UNIT_CODED_SLICE_BLA_W_RADL ); 1704 Bool isIDR = ( nut == NAL_UNIT_CODED_SLICE_IDR_W_RADL ) || ( nut == NAL_UNIT_CODED_SLICE_IDR_N_LP ); 1705 Bool noClrasOutputFlag = isBLA || ( isIDR && m_apcSlicePilot->getCrossLayerBlaFlag() ); 1706 1707 if ( noClrasOutputFlag ) 1708 { 1709 for (Int i = 0; i < MAX_NUM_LAYER_IDS; i++) 1710 { 1711 m_layerInitilizedFlag[i] = false; 1712 } 1713 } 1714 } 1715 } 1716 1717 Bool TDecTop::xAllRefLayersInitilized( const TComVPS* vps ) 1718 { 1719 Bool allRefLayersInitilizedFlag = true; 1720 for (Int i = 0; i < vps->getNumDirectRefLayers( getLayerId() ); i++ ) 1721 { 1722 Int refLayerId = vps->getIdDirectRefLayer( m_layerId, i ); 1723 allRefLayersInitilizedFlag = allRefLayersInitilizedFlag && m_layerInitilizedFlag[ refLayerId ]; 1724 } 1725 1726 return allRefLayersInitilizedFlag; 1727 } 1728 1729 1730 Void TDecTop::initFromActiveVps( const TComVPS* vps ) 1731 { 1732 if ( m_targetOlsIdx == -1 ) 1733 { 1734 // Not normative! Corresponds to specification by "External Means". (Should be set equal to 0, when no external means available. ) 1735 m_targetOlsIdx = vps->getVpsNumLayerSetsMinus1(); 1736 } 1737 #if NH_3D 1738 // Set profile 1739 Int lsIdx = vps->olsIdxToLsIdx( m_targetOlsIdx ); 1740 Int lIdx = -1; 1741 for (Int j = 0; j < vps->getNumLayersInIdList( lsIdx ); j++ ) 1742 { 1743 if ( vps->getLayerSetLayerIdList( lsIdx, j ) == getLayerId() ) 1744 { 1745 lIdx = j; 1746 break; 1747 } 1748 } 1749 assert( lIdx != -1 ); 1750 1751 Int profileIdc = vps->getPTL( vps->getProfileTierLevelIdx( m_targetOlsIdx, lIdx ) )->getGeneralPTL()->getProfileIdc(); 1752 assert( profileIdc == 1 || profileIdc == 6 || profileIdc == 8 ); 1753 m_profileIdc = profileIdc; 1754 #endif 1755 } 2647 std::vector<TComPic*>* ltSet = refPicSetsLt[j]; 2648 for (Int i = 0; i < ltSet->size(); i++) 2649 { 2650 TComPic* pic = (*ltSet)[i]; 2651 if( pic != NULL ) 2652 { 2653 assert(!( abs( m_pcPic->getPOC() - pic->getPOC() ) >= (1 << 24) )); 2654 } 2655 } 2656 } 2657 2658 // - When the current picture is a temporal sub-layer access (TSA) picture, there shall be no picture 2659 // included in the RPS with TemporalId greater than or equal to the TemporalId of the current picture. 2660 if (m_pcPic->isTsa() ) 2661 { 2662 for (Int j = 0; j < 5; j++ ) 2663 { 2664 std::vector<TComPic*>* aSet = refPicSetsAll[j]; 2665 for (Int i = 0; i < aSet->size(); i++) 2666 { 2667 TComPic* pic = (*aSet)[i]; 2668 if( pic != NULL ) 2669 { 2670 assert( ! (pic->getTemporalId() >= m_pcPic->getTemporalId() ) ); 2671 } 2672 } 2673 } 2674 } 2675 2676 // - When the current picture is a step-wise temporal sub-layer access (STSA) picture, 2677 // there shall be no picture included in RefPicSetStCurrBefore, RefPicSetStCurrAfter or RefPicSetLtCurr that has 2678 // TemporalId equal to that of the current picture. 2679 if (m_pcPic->isStsa() ) 2680 { 2681 for (Int j = 0; j < 3; j++ ) 2682 { 2683 std::vector<TComPic*>* cSet = refPicSetsCurr[j]; 2684 for (Int i = 0; i < cSet->size(); i++) 2685 { 2686 TComPic* pic = (*cSet)[i]; 2687 if( pic != NULL ) 2688 { 2689 assert( ! (pic->getTemporalId() == m_pcPic->getTemporalId() ) ); 2690 } 2691 } 2692 } 2693 } 2694 2695 // - When the current picture is a picture that follows, in decoding order, an STSA picture 2696 // that has TemporalId equal to that of the current picture, there shall be no picture that has 2697 // TemporalId equal to that of the current picture included in RefPicSetStCurrBefore, RefPicSetStCurrAfter 2698 // or RefPicSetLtCurr that precedes the STSA picture in decoding order. 2699 if ( m_pcPic->getDecodingOrder() > m_prevStsaDecOrder && m_pcPic->getTemporalId() == m_prevStsaTemporalId ) 2700 { 2701 for (Int j = 0; j < 3; j++ ) 2702 { 2703 std::vector<TComPic*>* cSet = refPicSetsCurr[j]; 2704 for (Int i = 0; i < cSet->size(); i++) 2705 { 2706 TComPic* pic = (*cSet)[i]; 2707 if( pic != NULL ) 2708 { 2709 assert( ! (pic->getTemporalId() == m_pcPic->getTemporalId() && pic->getDecodingOrder() < m_prevStsaDecOrder ) ); 2710 } 2711 } 2712 } 2713 } 2714 2715 // - When the current picture is a CRA picture, there shall be no picture included in the RPS that 2716 // precedes, in output order or decoding order, any preceding IRAP picture in decoding order (when present). 2717 if ( m_pcPic->isCra() ) 2718 { 2719 for (Int j = 0; j < 5; j++ ) 2720 { 2721 std::vector<TComPic*>* aSet = refPicSetsAll[j]; 2722 for (Int i = 0; i < aSet->size(); i++) 2723 { 2724 // TBD check whether it sufficient to test only the last IRAP 2725 TComPic* pic = (*aSet)[i]; 2726 if( pic != NULL ) 2727 { 2728 assert( ! (pic->getPOC() < m_prevIrapPoc ) ); 2729 assert( ! (pic->getDecodingOrder() < m_prevIrapDecodingOrder ) ); 2730 } 2731 } 2732 } 2733 } 2734 2735 Bool isTrailingPicture = ( !m_pcPic->isIrap() ) && ( m_pcPic->getPOC() > m_prevIrapPoc ); 2736 // - When the current picture is a trailing picture, there shall be no picture in RefPicSetStCurrBefore, 2737 // RefPicSetStCurrAfter or RefPicSetLtCurr that was generated by the decoding process for generating unavailable 2738 // reference pictures as specified in clause 8.3.3. 2739 if ( isTrailingPicture ) 2740 { 2741 for (Int j = 0; j < 3; j++ ) 2742 { 2743 std::vector<TComPic*>* cSet = refPicSetsCurr[j]; 2744 for (Int i = 0; i < cSet->size(); i++) 2745 { 2746 TComPic* pic = (*cSet)[i]; 2747 if( pic != NULL ) 2748 { 2749 assert( ! (pic->getIsGeneratedCl833() ) ); 2750 } 2751 } 2752 } 2753 } 2754 2755 // - When the current picture is a trailing picture, there shall be no picture in the RPS that precedes the 2756 // associated IRAP picture in output order or decoding order. 2757 if ( isTrailingPicture ) 2758 { 2759 for (Int j = 0; j < 5; j++ ) 2760 { 2761 std::vector<TComPic*>* aSet = refPicSetsAll[j]; 2762 for (Int i = 0; i < aSet->size(); i++) 2763 { 2764 // TBD check whether it sufficient to test only the last IRAP 2765 TComPic* pic = (*aSet)[i]; 2766 if( pic != NULL ) 2767 { 2768 assert( ! (pic->getPOC() < m_prevIrapPoc ) ); 2769 assert( ! (pic->getDecodingOrder() < m_prevIrapDecodingOrder ) ); 2770 } 2771 } 2772 } 2773 } 2774 2775 // - When the current picture is a RADL picture, there shall be no picture included in RefPicSetStCurrBefore, 2776 // RefPicSetStCurrAfter or RefPicSetLtCurr that is any of the following: 2777 if ( m_pcPic->isRadl() ) 2778 { 2779 for (Int j = 0; j < 3; j++ ) 2780 { 2781 std::vector<TComPic*>* cSet = refPicSetsCurr[j]; 2782 for (Int i = 0; i < cSet->size(); i++) 2783 { 2784 TComPic* pic = (*cSet)[i]; 2785 if( pic != NULL ) 2786 { 2787 // - A RASL picture 2788 assert( ! (pic->isRasl() ) ); 2789 // - A picture that was generated by the decoding process for generating unavailable reference pictures 2790 // as specified in clause 8.3.3 2791 assert( ! (pic->getIsGeneratedCl833() ) ); 2792 // - A picture that precedes the associated IRAP picture in decoding order 2793 assert( ! (pic->getDecodingOrder() < m_prevIrapDecodingOrder ) ); 2794 } 2795 } 2796 } 2797 } 2798 2799 2800 if ( sps->getTemporalIdNestingFlag() ) 2801 { 2802 // - When sps_temporal_id_nesting_flag is equal to 1, the following applies: 2803 // - Let tIdA be the value of TemporalId of the current picture picA. 2804 TComPic* picA = m_pcPic; 2805 Int tIdA = picA->getTemporalId(); 2806 // - Any picture picB with TemporalId equal to tIdB that is less than or equal to tIdA shall not be included in 2807 // RefPicSetStCurrBefore, RefPicSetStCurrAfter or RefPicSetLtCurr of picA when there exists a picture picC that 2808 // has TemporalId less than tIdB, follows picB in decoding order, and precedes picA in decoding order. 2809 for (Int j = 0; j < 3; j++ ) 2810 { 2811 std::vector<TComPic*>* cSet = refPicSetsCurr[j]; 2812 for (Int i = 0; i < cSet->size(); i++) 2813 { 2814 TComPic* picB = (*cSet)[i]; 2815 if( picB != NULL ) 2816 { 2817 Int tIdB = picB->getTemporalId(); 2818 2819 if (tIdB <= tIdA) 2820 { 2821 for ( TComSubDpb::iterator itP = dpb->begin(); itP != dpb->end(); itP++ ) 2822 { 2823 TComPic* picC = (*itP); 2824 assert(! ( picC->getTemporalId() < tIdB && picC->getDecodingOrder() > picB->getDecodingOrder() && picC->getDecodingOrder() < picA->getDecodingOrder() ) ); 2825 } 2826 } 2827 } 2828 } 2829 } 2830 } 2831 } 2832 2833 2834 Void TDecTop::xF832DecProcForRefPicSet() 2835 { 2836 /////////////////////////////////////////////////////////////////////////////////////// 2837 // F.8.3.2 Decoding process for reference picture set 2838 /////////////////////////////////////////////////////////////////////////////////////// 2839 2840 // The specifications in clause 8.3.2 apply with the following changes: 2841 // - The references to clauses 7.4.7.2, 8.3.1, 8.3.3 and 8.3.4 are replaced with references to 2842 // clauses F.7.4.7.2, F.8.3.1, F.8.3.3 and F.8.3.4, respectively. 2843 2844 x832DecProcForRefPicSet( true ); 2845 2846 // - The following specifications are added: 2847 if (m_pcPic->isIrap() && m_pcPic->getLayerId() == m_smallestLayerId ) 2848 { 2849 // - When the current picture is an IRAP picture with nuh_layer_id equal to SmallestLayerId, 2850 // all reference pictures with any value of nuh_layer_id currently in the DPB (if any) are marked 2851 // as "unused for reference" when at least one of the following conditions is true: 2852 2853 if ( m_pcPic->getNoClrasOutputFlag() || m_pcPic->getActivatesNewVps() ) 2854 { 2855 // - The current picture has NoClrasOutputFlag is equal to 1. 2856 // - The current picture activates a new VPS. 2857 m_dpb->markAllSubDpbAsUnusedForReference( ); 2858 } 2859 } 2860 2861 // - It is a requirement of bitstream conformance that the RPS is restricted as follows: 2862 // - When the current picture is a CRA picture, there shall be no picture in RefPicSetStCurrBefore, RefPicSetStCurrAfter 2863 // or RefPicSetLtCurr. 2864 2865 std::vector<TComPic*>** refPicSetsCurr = m_pcPic->getDecodedRps()->m_refPicSetsCurr; 2866 2867 if ( m_pcPic->isCra() ) 2868 { 2869 for (Int j = 0; j < 3; j++ ) 2870 { 2871 std::vector<TComPic*>* cSet = refPicSetsCurr[j]; 2872 assert ( cSet->size() == 0 ); 2873 } 2874 } 2875 2876 // - The constraints specified in clause 8.3.2 on the value of NumPicTotalCurr are replaced with the following: 2877 // - It is a requirement of bitstream conformance that the following applies to the value of NumPicTotalCurr: 2878 Int numPicTotalCurr = m_pcPic->getSlice(0)->getNumPicTotalCurr(); 2879 Int currPicLayerId = m_pcPic->getLayerId(); 2880 const TComVPS* vps = m_pcPic->getSlice(0)->getVPS(); 2881 2882 if ( ( m_pcPic->isBla() || m_pcPic->isCra() ) && ( (currPicLayerId == 0 ) || ( vps->getNumDirectRefLayers( currPicLayerId ) == 0 ) ) ) 2883 { 2884 assert( numPicTotalCurr == 0 ); 2885 // - If the current picture is a BLA or CRA picture and either currPicLayerId is equal to 0 or 2886 // NumDirectRefLayers[ currPicLayerId ] is equal to 0, the value of NumPicTotalCurr shall be equal to 0. 2887 } 2888 else 2889 { 2890 // TBD: check all slices 2891 if ( m_pcPic->getSlice(0)->getSliceType() == P_SLICE || m_pcPic->getSlice(0)->getSliceType() == B_SLICE ) 2892 { 2893 // - Otherwise, when the current picture contains a P or B slice, the value of NumPicTotalCurr shall not be equal to 0. 2894 assert( numPicTotalCurr != 0 ); 2895 } 2896 } 2897 } 2898 2899 2900 Void TDecTop::xG813DecProcForInterLayerRefPicSet() 2901 { 2902 //////////////////////////////////////////////////////////////////// 2903 // G.8.1.3 Decoding process for inter-layer reference picture set // 2904 //////////////////////////////////////////////////////////////////// 2905 2906 // Outputs of this process are updated lists of inter-layer reference pictures RefPicSetInterLayer0 and RefPicSetInterLayer1 2907 // and the variables NumActiveRefLayerPics0 and NumActiveRefLayerPics1. 2908 2909 TComDecodedRps* decRps = m_pcPic->getDecodedRps(); 2910 TComSlice* slice = m_pcPic->getSlice( 0 ); 2911 const TComVPS* vps = slice->getVPS(); 2912 2913 Int& numActiveRefLayerPics0 = decRps->m_numActiveRefLayerPics0; 2914 Int& numActiveRefLayerPics1 = decRps->m_numActiveRefLayerPics1; 2915 2916 std::vector<TComPic*>& refPicSetInterLayer0 = decRps->m_refPicSetInterLayer0; 2917 std::vector<TComPic*>& refPicSetInterLayer1 = decRps->m_refPicSetInterLayer1; 2918 2919 // The variable currLayerId is set equal to nuh_layer_id of the current picture. 2920 Int currLayerId = getLayerId(); 2921 2922 // The lists RefPicSetInterLayer0 and RefPicSetInterLayer1 are first emptied, NumActiveRefLayerPics0 and NumActiveRefLayerPics1 2923 // are set equal to 0 and the following applies: 2924 2925 refPicSetInterLayer0.clear(); 2926 refPicSetInterLayer1.clear(); 2927 2928 numActiveRefLayerPics0 = 0; 2929 numActiveRefLayerPics1 = 0; 2930 2931 Int viewIdCurrLayerId = vps->getViewId( currLayerId ); 2932 Int viewId0 = vps->getViewId( 0 ); 2933 2934 for( Int i = 0; i < slice->getNumActiveRefLayerPics(); i++ ) 2935 { 2936 Int viewIdRefPicLayerIdi = vps->getViewId( slice->getRefPicLayerId( i ) ); 2937 2938 Bool refPicSet0Flag = 2939 ( ( viewIdCurrLayerId <= viewId0 && viewIdCurrLayerId <= viewIdRefPicLayerIdi ) || 2940 ( viewIdCurrLayerId >= viewId0 && viewIdCurrLayerId >= viewIdRefPicLayerIdi ) ); 2941 2942 TComPic* picX = m_dpb->getAu(slice->getPOC(), false )->getPic( slice->getRefPicLayerId( i ) ); 2943 if ( picX != NULL ) 2944 { 2945 // there is a picture picX in the DPB that is in the same access unit as the current picture and has 2946 // nuh_layer_id equal to RefPicLayerId[ i ] 2947 2948 if ( refPicSet0Flag ) 2949 { 2950 refPicSetInterLayer0.push_back( picX ); 2951 refPicSetInterLayer0[ numActiveRefLayerPics0++ ]->markAsUsedForLongTermReference(); 2952 } 2953 else 2954 { 2955 refPicSetInterLayer1.push_back( picX ); 2956 refPicSetInterLayer1[ numActiveRefLayerPics1++ ]->markAsUsedForLongTermReference(); 2957 } 2958 2959 // There shall be no picture that has discardable_flag equal to 1 in RefPicSetInterLayer0 or RefPicSetInterLayer1. 2960 assert( ! picX->getSlice(0)->getDiscardableFlag() ); 2961 2962 // If the current picture is a RADL picture, there shall be no entry in RefPicSetInterLayer0 or RefPicSetInterLayer1 2963 // that is a RASL picture. 2964 if ( m_pcPic->isRadl() ) 2965 { 2966 assert( ! picX->isRasl() ); 2967 } 2968 } 2969 else 2970 { 2971 if( refPicSet0Flag ) 2972 { 2973 refPicSetInterLayer0.push_back( NULL ); // "no reference picture" (G 1) 2974 numActiveRefLayerPics0++; 2975 } 2976 else 2977 { 2978 refPicSetInterLayer1.push_back( NULL ); // "no reference picture"; 2979 numActiveRefLayerPics1++; 2980 } 2981 // There shall be no entry equal to "no reference picture" in RefPicSetInterLayer0 or RefPicSetInterLayer1. 2982 assert( false ); 2983 } 2984 } 2985 } 2986 2987 2988 Void TDecTop::x8331GenDecProcForGenUnavilRefPics() 2989 { 2990 /////////////////////////////////////////////////////////////////////////////////////// 2991 // 8.3.3.1 General decoding process for generating unavailable reference pictures //// 2992 /////////////////////////////////////////////////////////////////////////////////////// 2993 2994 // This process is invoked once per coded picture when the current picture is a 2995 // BLA picture or is a CRA picture with NoRaslOutputFlag equal to 1. 2996 2997 assert( m_pcPic->isBla() || (m_pcPic->isCra() && m_pcPic->getNoRaslOutputFlag() ) ); 2998 TComDecodedRps* decRps = m_pcPic->getDecodedRps(); 2999 3000 std::vector<TComPic*>& refPicSetStFoll = decRps->m_refPicSetStFoll; 3001 std::vector<TComPic*>& refPicSetLtFoll = decRps->m_refPicSetLtFoll; 3002 3003 const std::vector<Int>& pocStFoll = decRps->m_pocStFoll; 3004 const std::vector<Int>& pocLtFoll = decRps->m_pocLtFoll; 3005 3006 const Int numPocStFoll = decRps->m_numPocStFoll; 3007 const Int numPocLtFoll = decRps->m_numPocLtFoll; 3008 3009 // When this process is invoked, the following applies: 3010 for ( Int i = 0 ; i <= numPocStFoll - 1; i++ ) 3011 { 3012 if ( refPicSetStFoll[ i ] == NULL ) 3013 { 3014 //- For each RefPicSetStFoll[ i ], with i in the range of 0 to NumPocStFoll - 1, inclusive, that is equal 3015 // to "no reference picture", a picture is generated as specified in clause 8.3.3.2, and the following applies: 3016 TComPic* genPic = x8332GenOfOneUnavailPic( true ); 3017 3018 // - The value of PicOrderCntVal for the generated picture is set equal to PocStFoll[ i ]. 3019 genPic->getSlice(0)->setPOC( pocStFoll[ i ] ); 3020 3021 //- The value of PicOutputFlag for the generated picture is set equal to 0. 3022 genPic->setPicOutputFlag( false ); 3023 3024 // - The generated picture is marked as "used for short-term reference". 3025 genPic->markAsUsedForShortTermReference(); 3026 3027 // - RefPicSetStFoll[ i ] is set to be the generated reference picture. 3028 refPicSetStFoll[ i ] = genPic; 3029 3030 // - The value of nuh_layer_id for the generated picture is set equal to nuh_layer_id of the current picture. 3031 genPic->setLayerId( m_pcPic-> getLayerId() ); 3032 3033 // Insert to DPB 3034 m_dpb->addNewPic( genPic ); 3035 } 3036 } 3037 3038 for ( Int i = 0 ; i <= numPocLtFoll - 1; i++ ) 3039 { 3040 if ( refPicSetLtFoll[ i ] == NULL ) 3041 { 3042 //- For each RefPicSetLtFoll[ i ], with i in the range of 0 to NumPocLtFoll - 1, inclusive, that is equal to 3043 // "no reference picture", a picture is generated as specified in clause 8.3.3.2, and the following applies: 3044 TComPic* genPic = x8332GenOfOneUnavailPic( true ); 3045 3046 //- The value of PicOrderCntVal for the generated picture is set equal to PocLtFoll[ i ]. 3047 genPic->getSlice(0)->setPOC( pocStFoll[ i ] ); 3048 3049 // - The value of slice_pic_order_cnt_lsb for the generated picture is inferred to be equal to ( PocLtFoll[ i ] & ( MaxPicOrderCntLsb - 1 ) ). 3050 genPic->getSlice(0)->setSlicePicOrderCntLsb( ( pocLtFoll[ i ] & ( m_pcPic->getSlice(0)->getSPS()->getMaxPicOrderCntLsb() - 1 ) ) ); 3051 3052 // - The value of PicOutputFlag for the generated picture is set equal to 0. 3053 genPic->setPicOutputFlag( false ); 3054 3055 // - The generated picture is marked as "used for long-term reference". 3056 genPic->markAsUsedForLongTermReference(); 3057 3058 // - RefPicSetLtFoll[ i ] is set to be the generated reference picture. 3059 refPicSetLtFoll[ i ] = genPic; 3060 3061 // - The value of nuh_layer_id for the generated picture is set equal to nuh_layer_id of the current picture. 3062 genPic->setLayerId( m_pcPic-> getLayerId() ); 3063 3064 // Insert to DPB 3065 m_dpb->addNewPic( genPic ); 3066 } 3067 } 3068 } 3069 3070 3071 TComPic* TDecTop::x8332GenOfOneUnavailPic( Bool calledFromCl8331 ) 3072 { 3073 /////////////////////////////////////////////////////////////////////////////////////// 3074 // 8.3.3.2 Generation of one unavailable picture 3075 /////////////////////////////////////////////////////////////////////////////////////// 3076 3077 TComPic* genPic = new TComPic; 3078 genPic->create( *m_pcPic->getSlice(0)->getSPS(), *m_pcPic->getSlice(0)->getPPS(), true ); 3079 genPic->setIsGenerated( true ); 3080 genPic->setIsGeneratedCl833( calledFromCl8331 ); 3081 return genPic; 3082 } 3083 3084 3085 Void TDecTop::xF817DecProcForGenUnavRefPicForPicsFrstInDecOrderInLay() 3086 { 3087 /////////////////////////////////////////////////////////////////////////////////////// 3088 // F.8.1.7 Decoding process for generating unavailable reference pictures for pictures 3089 // first in decoding order within a layer 3090 /////////////////////////////////////////////////////////////////////////////////////// 3091 3092 // This process is invoked for a picture with nuh_layer_id equal to layerId, when FirstPicInLayerDecodedFlag[layerId ] is equal to 0. 3093 assert( !m_firstPicInLayerDecodedFlag[ getLayerId() ] ); 3094 3095 3096 TComDecodedRps* decRps = m_pcPic->getDecodedRps(); 3097 3098 std::vector<TComPic*>& refPicSetStCurrBefore = decRps->m_refPicSetStCurrBefore; 3099 std::vector<TComPic*>& refPicSetStCurrAfter = decRps->m_refPicSetStCurrAfter; 3100 std::vector<TComPic*>& refPicSetStFoll = decRps->m_refPicSetStFoll; 3101 std::vector<TComPic*>& refPicSetLtCurr = decRps->m_refPicSetLtCurr; 3102 std::vector<TComPic*>& refPicSetLtFoll = decRps->m_refPicSetLtFoll; 3103 3104 3105 const std::vector<Int>& pocStCurrBefore = decRps->m_pocStCurrBefore; 3106 const std::vector<Int>& pocStCurrAfter = decRps->m_pocStCurrAfter; 3107 const std::vector<Int>& pocStFoll = decRps->m_pocStFoll; 3108 const std::vector<Int>& pocLtCurr = decRps->m_pocLtCurr; 3109 const std::vector<Int>& pocLtFoll = decRps->m_pocLtFoll; 3110 3111 const Int numPocStCurrBefore = decRps->m_numPocStCurrBefore; 3112 const Int numPocStCurrAfter = decRps->m_numPocStCurrAfter; 3113 const Int numPocStFoll = decRps->m_numPocStFoll; 3114 const Int numPocLtCurr = decRps->m_numPocLtCurr; 3115 const Int numPocLtFoll = decRps->m_numPocLtFoll; 3116 3117 Int nuhLayerId = m_pcPic-> getLayerId(); 3118 for ( Int i = 0 ; i <= numPocStCurrBefore - 1; i++ ) 3119 { 3120 if ( refPicSetStCurrBefore[ i ] == NULL ) 3121 { 3122 //- For each RefPicSetStCurrBefore[ i ], with i in the range of 0 to NumPocStCurrBefore - 1, inclusive, that is 3123 // equal to "no reference picture", a picture is generated as specified in clause 8.3.3.2 and the following applies: 3124 TComPic* genPic = x8332GenOfOneUnavailPic( false ); 3125 3126 //- The value of PicOrderCntVal for the generated picture is set equal to PocStCurrBefore[ i ]. 3127 genPic->getSlice(0)->setPOC( pocStCurrBefore[ i ] ); 3128 3129 // - The value of PicOutputFlag for the generated picture is set equal to 0. 3130 genPic->setPicOutputFlag( false ); 3131 3132 // - The generated picture is marked as "used for short-term reference". 3133 genPic->markAsUsedForShortTermReference(); 3134 3135 // - RefPicSetStCurrBefore[ i ] is set to be the generated reference picture. 3136 refPicSetStCurrBefore[ i ] = genPic; 3137 3138 // - The value of nuh_layer_id for the generated picture is set equal to nuh_layer_id. 3139 genPic->setLayerId( nuhLayerId ); 3140 3141 // Insert to DPB 3142 m_dpb->addNewPic( genPic ); 3143 } 3144 } 3145 3146 for ( Int i = 0 ; i <= numPocStCurrAfter - 1; i++ ) 3147 { 3148 if ( refPicSetStCurrAfter[ i ] == NULL ) 3149 { 3150 // - For each RefPicSetStCurrAfter[ i ], with i in the range of 0 to NumPocStCurrAfter - 1, inclusive, that is equal 3151 // to "no reference picture", a picture is generated as specified in clause 8.3.3.2 and the following applies: 3152 TComPic* genPic = x8332GenOfOneUnavailPic( false ); 3153 3154 // - The value of PicOrderCntVal for the generated picture is set equal to PocStCurrAfter[ i ]. 3155 genPic->getSlice(0)->setPOC( pocStCurrAfter[ i ] ); 3156 3157 // - The value of PicOutputFlag for the generated picture is set equal to 0. 3158 genPic->setPicOutputFlag( false ); 3159 3160 // - The generated picture is marked as "used for short-term reference". 3161 genPic->markAsUsedForShortTermReference(); 3162 3163 // - RefPicSetStCurrAfter[ i ] is set to be the generated reference picture. 3164 refPicSetStCurrAfter[ i ] = genPic; 3165 3166 // - The value of nuh_layer_id for the generated picture is set equal to nuh_layer_id. 3167 genPic->setLayerId( nuhLayerId ); 3168 3169 // Insert to DPB 3170 m_dpb->addNewPic( genPic ); 3171 3172 } 3173 } 3174 3175 for ( Int i = 0 ; i <= numPocStFoll - 1; i++ ) 3176 { 3177 if ( refPicSetStFoll[ i ] == NULL ) 3178 { 3179 // - For each RefPicSetStFoll[ i ], with i in the range of 0 to NumPocStFoll - 1, inclusive, that is equal to "no 3180 // reference picture", a picture is generated as specified in clause 8.3.3.2 and the following applies: 3181 TComPic* genPic = x8332GenOfOneUnavailPic( false ); 3182 3183 // - The value of PicOrderCntVal for the generated picture is set equal to PocStFoll[ i ]. 3184 genPic->getSlice(0)->setPOC( pocStFoll[ i ] ); 3185 3186 // - The value of PicOutputFlag for the generated picture is set equal to 0. 3187 genPic->setPicOutputFlag( false ); 3188 3189 // - The generated picture is marked as "used for short-term reference". 3190 genPic->markAsUsedForShortTermReference(); 3191 3192 // - RefPicSetStFoll[ i ] is set to be the generated reference picture. 3193 refPicSetStFoll[ i ] = genPic; 3194 3195 // - The value of nuh_layer_id for the generated picture is set equal to nuh_layer_id. 3196 genPic->setLayerId( nuhLayerId ); 3197 3198 // Insert to DPB 3199 m_dpb->addNewPic( genPic ); 3200 } 3201 } 3202 3203 Int maxPicOrderCntLsb = m_pcPic->getSlice(0)->getSPS()->getMaxPicOrderCntLsb(); 3204 for ( Int i = 0 ; i <= numPocLtCurr - 1; i++ ) 3205 { 3206 if ( refPicSetLtCurr[ i ] == NULL ) 3207 { 3208 // - For each RefPicSetLtCurr[ i ], with i in the range of 0 to NumPocLtCurr - 1, inclusive, that is equal to "no 3209 // reference picture", a picture is generated as specified in clause 8.3.3.2 and the following applies: 3210 TComPic* genPic = x8332GenOfOneUnavailPic( false ); 3211 3212 // - The value of PicOrderCntVal for the generated picture is set equal to PocLtCurr[ i ]. 3213 genPic->getSlice(0)->setPOC( pocLtCurr[ i ] ); 3214 3215 // - The value of slice_pic_order_cnt_lsb for the generated picture is inferred to be equal to ( PocLtCurr[ i ] & ( 3216 // MaxPicOrderCntLsb - 1 ) ). 3217 genPic->getSlice(0)->setSlicePicOrderCntLsb( ( pocLtCurr[ i ] & ( maxPicOrderCntLsb - 1 ) ) ); 3218 3219 // - The value of PicOutputFlag for the generated picture is set equal to 0. 3220 genPic->setPicOutputFlag( false ); 3221 3222 // - The generated picture is marked as "used for long-term reference". 3223 genPic->markAsUsedForLongTermReference(); 3224 3225 // - RefPicSetLtCurr[ i ] is set to be the generated reference picture. 3226 refPicSetLtCurr[ i ] = genPic; 3227 3228 // - The value of nuh_layer_id for the generated picture is set equal to nuh_layer_id. 3229 genPic->setLayerId( nuhLayerId ); 3230 3231 // Insert to DPB 3232 m_dpb->addNewPic( genPic ); 3233 } 3234 } 3235 3236 for ( Int i = 0 ; i <= numPocLtFoll - 1; i++ ) 3237 { 3238 if ( refPicSetLtFoll[ i ] == NULL ) 3239 { 3240 // - For each RefPicSetLtFoll[ i ], with i in the range of 0 to NumPocLtFoll - 1, inclusive, that is equal to "no 3241 // reference picture", a picture is generated as specified in clause 8.3.3.2 and the following applies: 3242 TComPic* genPic = x8332GenOfOneUnavailPic( false ); 3243 3244 // - The value of PicOrderCntVal for the generated picture is set equal to PocLtFoll[ i ]. 3245 genPic->getSlice(0)->setPOC( pocLtFoll[ i ] ); 3246 3247 // - The value of slice_pic_order_cnt_lsb for the generated picture is inferred to be equal to ( PocLtCurr[ i ] & ( 3248 // MaxPicOrderCntLsb - 1 ) ). 3249 genPic->getSlice(0)->setSlicePicOrderCntLsb( ( pocLtCurr[ i ] & ( maxPicOrderCntLsb - 1 ) ) ); 3250 3251 // - The value of PicOutputFlag for the generated picture is set equal to 0. 3252 genPic->setPicOutputFlag( false ); 3253 3254 // - The generated picture is marked as "used for long-term reference". 3255 genPic->markAsUsedForLongTermReference(); 3256 3257 // - RefPicSetLtFoll[ i ] is set to be the generated reference picture. 3258 refPicSetLtFoll[ i ] = genPic; 3259 3260 // - The value of nuh_layer_id for the generated picture is set equal to nuh_layer_id. 3261 genPic->setLayerId( nuhLayerId ); 3262 3263 // Insert to DPB 3264 m_dpb->addNewPic( genPic ); 3265 } 3266 } 3267 } 3268 3269 Void TDecTop::xF833DecProcForGenUnavRefPics() 3270 { 3271 /////////////////////////////////////////////////////////////////////////////////////// 3272 // F.8.3.3 Decoding process for generating unavailable reference picture 3273 /////////////////////////////////////////////////////////////////////////////////////// 3274 3275 x8331GenDecProcForGenUnavilRefPics(); 3276 } 3277 3278 Void TDecTop::xCheckUnavailableRefPics() 3279 { 3280 std::vector<TComPic*>** refPicSetsCurr = m_pcPic->getDecodedRps()->m_refPicSetsCurr; 3281 3282 Bool hasGeneratedRefPic = false; 3283 for (Int j = 0; j < 3; j++ ) 3284 { 3285 std::vector<TComPic*>* cSet = refPicSetsCurr[j]; 3286 for (Int i = 0 ; i < cSet->size(); i++ ) 3287 { 3288 assert( (*cSet)[i] != NULL ); 3289 if ((*cSet)[i]->getIsGenerated() ) 3290 { 3291 hasGeneratedRefPic = true; 3292 } 3293 } 3294 } 3295 m_pcPic->setHasGeneratedRefPics( hasGeneratedRefPic ); 3296 } 3297 1756 3298 #endif 1757 3299 -
branches/HTM-15.0-dev0/source/Lib/TLibDecoder/TDecTop.h
r1313 r1317 81 81 Int**** getBaseViewShiftLUTI() { return m_aiBaseViewShiftLUT; } 82 82 83 #if !NH_3D_FIX_TICKET_10184 #if NH_3D_IV_MERGE85 Void copyCamParamForSlice( TComSlice* pcSlice );86 #endif87 #endif88 89 83 private: 90 84 Void xResetReceivedIdc( Bool overWriteFlag ); … … 182 176 { 183 177 private: 184 Int m_iMaxRefPicNum; 185 186 NalUnitType m_associatedIRAPType; ///< NAL unit type of the associated IRAP picture 187 Int m_pocCRA; ///< POC number of the latest CRA picture 188 Int m_pocRandomAccess; ///< POC number of the random access point (the first IDR or CRA picture) 189 190 TComList<TComPic*> m_cListPic; // Dynamic buffer 191 #if NH_MV 192 Bool* m_layerInitilizedFlag; // initialization Layers 193 static ParameterSetManager m_parameterSetManager; // storage for parameter sets 194 Int m_targetOlsIdx; 195 #else 196 ParameterSetManager m_parameterSetManager; // storage for parameter sets 197 #endif 178 Int m_iMaxRefPicNum; 179 180 NalUnitType m_associatedIRAPType; ///< NAL unit type of the associated IRAP picture 181 #if !NH_MV 182 Int m_pocCRA; ///< POC number of the latest CRA picture 183 Int m_pocRandomAccess; ///< POC number of the random access point (the first IDR or CRA picture) 184 185 TComList<TComPic*> m_cListPic; // Dynamic buffer 186 ParameterSetManager m_parameterSetManager; // storage for parameter sets 187 #endif 188 198 189 TComSlice* m_apcSlicePilot; 199 190 … … 215 206 216 207 Bool isSkipPictureForBLA(Int& iPOCLastDisplay); 217 #if NH_MV 218 Bool isRandomAccessSkipPicture(Int& iSkipFrame, Int& iPOCLastDisplay, const TComVPS* vps); 219 #else 208 #if !NH_MV 220 209 Bool isRandomAccessSkipPicture(Int& iSkipFrame, Int& iPOCLastDisplay); 221 210 #endif 211 222 212 TComPic* m_pcPic; 223 213 UInt m_uiSliceIdx; 214 #if !NH_MV 224 215 Int m_prevPOC; 225 216 Int m_prevTid0POC; 226 Bool m_bFirstSliceInPicture; 217 Bool m_bFirstSliceInPicture; 227 218 Bool m_bFirstSliceInSequence; 228 219 Bool m_prevSliceSkipped; … … 232 223 Bool m_isNoOutputPriorPics; 233 224 Bool m_craNoRaslOutputFlag; //value of variable NoRaslOutputFlag of the last CRA pic 225 #endif 226 234 227 #if O0043_BEST_EFFORT_DECODING 235 228 UInt m_forceDecodeBitDepth; 236 229 #endif 230 231 237 232 std::ostream *m_pDecodedSEIOutputStream; 238 233 234 #if !NH_MV 239 235 Bool m_warningMessageSkipPicture; 236 #endif 237 240 238 #if NH_MV 241 Bool m_isLastNALWasEos; 242 #endif 243 244 #if NH_MV 245 // For NH_MV m_bFirstSliceInSequence indicates first slice in sequence of the particular layer 239 // Class interface 240 static ParameterSetManager m_parameterSetManager; // storage for parameter sets 241 TComPicLists* m_dpb; 242 #if NH_3D 243 CamParsCollector* m_pcCamParsCollector; 244 #endif 245 246 // Layer identification 246 247 Int m_layerId; 247 248 Int m_viewId; 248 TComPicLists* m_ivPicLists; 249 std::vector<TComPic*> m_refPicSetInterLayer0; 250 std::vector<TComPic*> m_refPicSetInterLayer1; 251 #if NH_3D 249 #if NH_3D 252 250 Int m_viewIndex; 253 251 Bool m_isDepth; 254 CamParsCollector* m_pcCamParsCollector; 255 Int m_profileIdc; 256 #endif 252 #endif 253 254 // Layer set 255 Int m_targetOlsIdx; 256 Int m_smallestLayerId; 257 Bool m_isInOwnTargetDecLayerIdList; 258 259 // Decoding processes 260 DecodingProcess m_decodingProcess; 261 DecodingProcess m_decProcPocAndRps; 262 263 // Decoding state 264 Bool* m_firstPicInLayerDecodedFlag; 265 266 Int m_prevPicOrderCnt; 267 Int m_prevTid0PicPicOrderCntMsb; 268 Int m_prevTid0PicSlicePicOrderCntLsb; 269 270 Int* m_lastPresentPocResetIdc; 271 Bool* m_pocDecrementedInDpbFlag; 272 273 Int m_prevIrapPoc; 274 Int64 m_prevIrapDecodingOrder; 275 Int64 m_prevStsaDecOrder; 276 Int m_prevStsaTemporalId; 257 277 #endif 258 278 … … 268 288 269 289 Void init(); 270 #if NH_MV 271 Bool decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay, Bool newLayer, Bool& sliceSkippedFlag ); 272 Bool decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay, Bool newLayer ); 273 #else 290 #if !NH_MV 274 291 Bool decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay); 275 #endif276 292 Void deletePicBuffer(); 277 293 278 #if NH_MV279 const TComVPS* getActiveVPS() { return m_parameterSetManager.getActiveVPS( ); }280 const TComSPS* getActiveSPS() { return m_parameterSetManager.getActiveSPS( m_layerId ); }281 #endif282 283 #if NH_MV284 Void endPicDecoding(Int& poc, TComList<TComPic*>*& rpcListPic, std::vector<Int>& targetDecLayerIdSet);285 #else286 294 Void executeLoopFilters(Int& poc, TComList<TComPic*>*& rpcListPic); 287 #endif288 295 Void checkNoOutputPriorPics (TComList<TComPic*>* rpcListPic); 289 296 290 297 Bool getNoOutputPriorPicsFlag () { return m_isNoOutputPriorPics; } 291 298 Void setNoOutputPriorPicsFlag (Bool val) { m_isNoOutputPriorPics = val; } 299 292 300 Void setFirstSliceInPicture (bool val) { m_bFirstSliceInPicture = val; } 301 293 302 Bool getFirstSliceInSequence () { return m_bFirstSliceInSequence; } 294 303 Void setFirstSliceInSequence (bool val) { m_bFirstSliceInSequence = val; } 304 #endif 305 295 306 #if O0043_BEST_EFFORT_DECODING 296 307 Void setForceDecodeBitDepth(UInt bitDepth) { m_forceDecodeBitDepth = bitDepth; } 297 308 #endif 309 298 310 Void setDecodedSEIMessageOutputStream(std::ostream *pOpStream) { m_pDecodedSEIOutputStream = pOpStream; } 299 311 UInt getNumberOfChecksumErrorsDetected() const { return m_cGopDecoder.getNumberOfChecksumErrorsDetected(); } 312 300 313 #if NH_MV 301 TComPic* getPic ( Int poc ); 302 TComList<TComPic*>* getListPic () { return &m_cListPic; } 303 Void setIvPicLists ( TComPicLists* picLists) { m_ivPicLists = picLists; } 304 Void setLayerInitilizedFlags( Bool* val ) { m_layerInitilizedFlag = val; } 305 Void setTargetOlsIdx ( Int targetOlsIdx ) { m_targetOlsIdx = targetOlsIdx; } 306 Int getTargetOlsIdx ( ) { return m_targetOlsIdx; } 307 Int getCurrPoc () { return m_apcSlicePilot->getPOC(); } 308 Void setLayerId ( Int layer) { m_layerId = layer; } 309 Int getLayerId () { return m_layerId; } 310 Void setViewId ( Int viewId ) { m_viewId = viewId; } 311 Int getViewId () { return m_viewId; } 312 Void initFromActiveVps ( const TComVPS* vps ); 314 315 ///////////////////////// 316 // For access from TAppDecTop 317 ///////////////////////// 318 319 // Non VCL decoding 320 Bool decodeNonVclNalu ( InputNALUnit& nalu ); 321 322 // Start picture decoding 323 Int preDecodePoc ( Bool firstPicInLayerDecodedFlag, Bool isFstPicOfAllLayOfPocResetPer, Bool isPocResettingPicture ); 324 Void inferPocResetPeriodId ( ); 325 Void decodeSliceHeader ( InputNALUnit &nalu ); 326 327 // Picture decoding 328 Void activatePSsAndInitPicOrSlice( TComPic* newPic ); 329 Void decodePocAndRps ( ); 330 Void genUnavailableRefPics ( ); 331 Void decodeSliceSegment ( InputNALUnit &nalu ); 332 333 // End Picture decoding 334 Void executeLoopFilters ( ); 335 Void finalizePic( ); 336 337 ////////////////////////// 338 // For access from slice 339 ///////////////////////// 340 Void initFromActiveVps ( const TComVPS* vps ); 341 342 ////////////////////////// 343 // General access 344 ///////////////////////// 345 346 // Picture identification 347 Void setLayerId ( Int layer ) { m_layerId = layer; } 348 Int getLayerId ( ) { return m_layerId; } 349 Void setViewId ( Int viewId ) { m_viewId = viewId; } 350 Int getViewId ( ) { return m_viewId; } 313 351 #if NH_3D 314 Void setViewIndex ( Int viewIndex ) { m_viewIndex = viewIndex; } 315 Int getViewIndex () { return m_viewIndex; } 316 Void setIsDepth ( Bool isDepth ) { m_isDepth = isDepth; } 317 Bool getIsDepth () { return m_isDepth; } 318 Void setCamParsCollector( CamParsCollector* pcCamParsCollector ) { m_pcCamParsCollector = pcCamParsCollector; } 319 320 321 Bool decProcAnnexI() { assert( m_profileIdc != -1 ); return ( m_profileIdc == 8); } 322 #endif 352 Void setViewIndex ( Int viewIndex ) { m_viewIndex = viewIndex; } 353 Int getViewIndex ( ) { return m_viewIndex; } 354 Void setIsDepth ( Bool isDepth ) { m_isDepth = isDepth; } 355 Bool getIsDepth ( ) { return m_isDepth; } 356 #endif 357 358 // Classes 359 Void setDpb ( TComPicLists* picLists) { m_dpb = picLists; } 360 #if NH_3D 361 Void setCamParsCollector ( CamParsCollector* pcCamParsCollector ) { m_pcCamParsCollector = pcCamParsCollector; } 362 #endif 363 364 // Slice pilot access 365 TComSlice* getSlicePilot ( ) { return m_apcSlicePilot; } 366 367 // Decoding state 368 Bool getFirstSliceSegementInPicFlag( ); 369 Void setFirstPicInLayerDecodedFlag(Bool* val ) { m_firstPicInLayerDecodedFlag = val; } 370 Void setPocDecrementedInDPBFlag (Bool* val ) { m_pocDecrementedInDpbFlag = val; } 371 Void setLastPresentPocResetIdc (Int* val ) { m_lastPresentPocResetIdc = val; } 372 373 // Layer sets 374 Void setTargetOlsIdx ( Int targetOlsIdx ) { m_targetOlsIdx = targetOlsIdx; } 375 Int getTargetOlsIdx ( ) { return m_targetOlsIdx; } 376 Int getSmallestLayerId ( ) { return m_smallestLayerId; } 377 Bool getIsInOwnTargetDecLayerIdList() { return m_isInOwnTargetDecLayerIdList; } 378 379 // Decoding processes identification 380 Bool decProcClause8( ) { return ( m_decodingProcess == CLAUSE_8 ); } 381 Bool decProcAnnexF ( ) { return ( decProcAnnexG() || decProcAnnexH() || decProcAnnexI() ); } 382 Bool decProcAnnexG ( ) { return ( m_decodingProcess == ANNEX_G || decProcAnnexI() ); } 383 Bool decProcAnnexH ( ) { return ( m_decodingProcess == ANNEX_H ); } 384 Bool decProcAnnexI ( ) { return ( m_decodingProcess == ANNEX_I ); } 385 386 DecodingProcess getDecodingProcess ( ) const { return m_decodingProcess; } 387 Void setDecProcPocAndRps( DecodingProcess decProc ) { m_decProcPocAndRps = decProc; } 323 388 #endif 324 389 325 390 protected: 326 Void xGetNewPicBuffer (const TComSPS &sps, const TComPPS &pps, TComPic*& rpcPic, const UInt temporalLayer); 327 Void xCreateLostPicture (Int iLostPOC); 328 391 392 #if !NH_MV 393 Void xGetNewPicBuffer (const TComSPS &sps, const TComPPS &pps, TComPic*& rpcPic, const UInt temporalLayer); 394 Void xCreateLostPicture (Int iLostPOC); 329 395 Void xActivateParameterSets(); 330 #if NH_MV 331 TComPic* xGetPic( Int layerId, Int poc ); 332 Bool xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay, Bool newLayerFlag, Bool& sliceSkippedFlag ); 333 Void xResetPocInPicBuffer(); 334 Void xCeckNoClrasOutput(); 335 336 Bool xAllRefLayersInitilized( const TComVPS* vps ); 337 #else 338 Bool xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay); 339 #endif 396 Bool xDecodeSlice (InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay); 397 #endif 398 340 399 Void xDecodeVPS(const std::vector<UChar> &naluData); 341 400 Void xDecodeSPS(const std::vector<UChar> &naluData); 342 Void xDecodePPS(const std::vector<UChar> &naluData); 401 Void xDecodePPS(const std::vector<UChar> &naluData); 402 #if !NH_MV 343 403 Void xUpdatePreviousTid0POC( TComSlice *pSlice ) { if ((pSlice->getTLayer()==0) && (pSlice->isReferenceNalu() && (pSlice->getNalUnitType()!=NAL_UNIT_CODED_SLICE_RASL_R)&& (pSlice->getNalUnitType()!=NAL_UNIT_CODED_SLICE_RADL_R))) { m_prevTid0POC=pSlice->getPOC(); } } 404 #endif 344 405 345 406 Void xParsePrefixSEImessages(); 346 407 Void xParsePrefixSEIsForUnknownVCLNal(); 347 408 409 #if NH_MV 410 // POC 411 Void x831DecProcForPicOrderCount ( ); 412 Void xF831DecProcForPicOrderCount ( ); 413 Int xGetCurrMsb ( Int cl, Int pl, Int pm, Int ml ); 414 415 //RPS 416 Void x832DecProcForRefPicSet ( Bool annexFModifications ); 417 Void xF832DecProcForRefPicSet ( ); 418 Void xG813DecProcForInterLayerRefPicSet ( ); 419 420 // Unavailable Pics 421 Void x8331GenDecProcForGenUnavilRefPics ( ); 422 TComPic* x8332GenOfOneUnavailPic ( Bool calledFromCl8331 ); 423 Void xF817DecProcForGenUnavRefPicForPicsFrstInDecOrderInLay(); 424 Void xF833DecProcForGenUnavRefPics ( ); 425 Void xCheckUnavailableRefPics ( ); 426 #endif 427 348 428 };// END CLASS DEFINITION TDecTop 349 429 350 430 351 431 //! \} 352 353 432 #endif // __TDECTOP__ 354 433 -
branches/HTM-15.0-dev0/source/Lib/TLibEncoder/TEncBinCoderCABAC.cpp
r1313 r1317 156 156 #if FAST_BIT_EST 157 157 m_fracBits = pcTEncBinCABAC->m_fracBits; 158 #if NH_MV 158 159 D_PRINT_INDENT(g_traceEncFracBits, "CopyState " + n2s(m_fracBits) ); 160 #endif 159 161 #endif 160 162 } … … 171 173 } 172 174 #if FAST_BIT_EST 175 #if NH_MV 173 176 D_PRINT_INDENT( g_traceEncFracBits, "Reset Bits Before" + n2s(m_fracBits) ); 177 #endif 174 178 m_fracBits &= 32767; 179 #if NH_MV 175 180 D_PRINT_INDENT( g_traceEncFracBits, "Reset Bits " + n2s(m_fracBits) ); 181 #endif 176 182 #endif 177 183 } -
branches/HTM-15.0-dev0/source/Lib/TLibEncoder/TEncBinCoderCABACCounter.cpp
r1313 r1317 59 59 m_pcTComBitIf->write(0, UInt(m_fracBits >> 15) ); 60 60 m_fracBits &= 32767; 61 #if NH_MV 61 62 D_PRINT_INDENT( g_traceEncFracBits, "Finish " + n2s(m_fracBits) ); 63 #endif 62 64 } 63 65 … … 81 83 m_uiBinsCoded += m_binCountIncrement; 82 84 m_fracBits += rcCtxModel.getEntropyBits( binValue ); 85 #if NH_MV 83 86 D_PRINT_INDENT( g_traceEncFracBits, "EncodeBin " + n2s(m_fracBits) ); 87 #endif 84 88 85 89 rcCtxModel.update( binValue ); … … 113 117 m_uiBinsCoded += m_binCountIncrement; 114 118 m_fracBits += 32768; 115 D_PRINT_INDENT( g_traceEncFracBits , "EncodeBinEP " + n2s(m_fracBits) ); 119 #if NH_MV 120 D_PRINT_INDENT( g_traceEncFracBits , "EncodeBinEP " + n2s(m_fracBits) ); 121 #endif 116 122 } 117 123 … … 126 132 m_uiBinsCoded += numBins & -m_binCountIncrement; 127 133 m_fracBits += 32768 * numBins; 134 #if NH_MV 128 135 D_PRINT_INDENT( g_traceEncFracBits , "EncodeBinsEP " + n2s(m_fracBits) ); 136 #endif 129 137 } 130 138 … … 138 146 m_uiBinsCoded += m_binCountIncrement; 139 147 m_fracBits += ContextModel::getEntropyBitsTrm( binValue ); 148 #if NH_MV 140 149 D_PRINT_INDENT( g_traceEncFracBits , "EncodeBinTrm " + n2s(m_fracBits) ); 150 #endif 141 151 } 142 152 … … 144 154 { 145 155 m_fracBits = (m_fracBits + 32767) & (~32767); 156 #if NH_MV 146 157 D_PRINT_INDENT( g_traceEncFracBits, "Align " + n2s(m_fracBits) ); 158 #endif 147 159 } 148 160 -
branches/HTM-15.0-dev0/source/Lib/TLibEncoder/TEncCavlc.cpp
r1313 r1317 40 40 #include "SEIwrite.h" 41 41 42 #if NH_ 3D42 #if NH_MV 43 43 #include "TEncTop.h" 44 44 #endif … … 53 53 { 54 54 fprintf( g_hTrace, "=========== Video Parameter Set ===========\n" ); 55 } 55 56 56 57 Void xTraceSPSHeader () … … 380 381 WRITE_CODE((pcPPS->getDLT()->getDepthViewBitDepth() - 8), 4, "pps_bit_depth_for_depth_layers_minus8"); 381 382 382 #if NH_3D_DLT_FIX383 383 for( Int i = 0; i <= pcPPS->getDLT()->getNumDepthViews()-1; i++ ) 384 #else385 for( Int i = 0; i <= pcPPS->getDLT()->getNumDepthViews(); i++ )386 #endif387 384 { 388 385 Int layerId = pcPPS->getDLT()->getDepthIdxToLayerId(i); … … 748 745 WRITE_UVLC( pcSPS->getMaxDecPicBuffering(i) - 1, "sps_max_dec_pic_buffering_minus1[i]" ); 749 746 WRITE_UVLC( pcSPS->getNumReorderPics(i), "sps_max_num_reorder_pics[i]" ); 747 #if NH_MV 748 WRITE_UVLC( pcSPS->getSpsMaxLatencyIncreasePlus1(i), "sps_max_latency_increase_plus1[i]" ); 749 #else 750 750 WRITE_UVLC( pcSPS->getMaxLatencyIncrease(i), "sps_max_latency_increase_plus1[i]" ); 751 #endif 751 752 if (!subLayerOrderingInfoPresentFlag) 752 753 { … … 814 815 codeShortTermRefPicSet( rps,false, i); 815 816 } 817 #if NH_MV 818 WRITE_FLAG( pcSPS->getLongTermRefPicsPresentFlag() ? 1 : 0, "long_term_ref_pics_present_flag" ); 819 if (pcSPS->getLongTermRefPicsPresentFlag()) 820 #else 816 821 WRITE_FLAG( pcSPS->getLongTermRefsPresent() ? 1 : 0, "long_term_ref_pics_present_flag" ); 817 822 if (pcSPS->getLongTermRefsPresent()) 823 #endif 818 824 { 819 825 WRITE_UVLC(pcSPS->getNumLongTermRefPicSPS(), "num_long_term_ref_pics_sps" ); … … 1747 1753 //write slice address 1748 1754 const Int sliceSegmentRsAddress = pcSlice->getPic()->getPicSym()->getCtuTsToRsAddrMap(ctuTsAddress); 1749 1755 #if NH_MV 1756 // This should actually be done somewhere else and not in writing process. 1757 pcSlice->setFirstSliceSegementInPicFlag( sliceSegmentRsAddress==0 ); 1758 WRITE_FLAG( pcSlice->getFirstSliceSegementInPicFlag() , "first_slice_segment_in_pic_flag" ); 1759 #else 1750 1760 WRITE_FLAG( sliceSegmentRsAddress==0, "first_slice_segment_in_pic_flag" ); 1761 #endif 1751 1762 if ( pcSlice->getRapPicFlag() ) 1752 1763 { … … 1760 1771 else 1761 1772 #endif 1762 1763 1773 WRITE_UVLC( pcSlice->getPPS()->getPPSId(), "slice_pic_parameter_set_id" ); 1764 1774 if ( pcSlice->getPPS()->getDependentSliceSegmentsEnabledFlag() && (sliceSegmentRsAddress!=0) ) … … 1772 1782 if ( !pcSlice->getDependentSliceSegmentFlag() ) 1773 1783 { 1774 1775 1784 #if NH_MV 1776 1785 Int esb = 0; //Don't use i, otherwise will shadow something below … … 1861 1870 } 1862 1871 } 1872 #if NH_MV 1873 if(pcSlice->getSPS()->getLongTermRefPicsPresentFlag()) 1874 #else 1863 1875 if(pcSlice->getSPS()->getLongTermRefsPresent()) 1876 #endif 1864 1877 { 1865 1878 Int numLtrpInSH = rps->getNumberOfLongtermPictures(); … … 2196 2209 Bool isDBFEnabled = (!pcSlice->getDeblockingFilterDisable()); 2197 2210 2198 if(pcSlice->getPPS()->getLoopFilterAcrossSlicesEnabledFlag() && ( isSAOEnabled || isDBFEnabled ))2211 if(pcSlice->getPPS()->getLoopFilterAcrossSlicesEnabledFlag() && ( isSAOEnabled || isDBFEnabled )) 2199 2212 { 2200 2213 WRITE_FLAG(pcSlice->getLFCrossSliceBoundaryFlag()?1:0, "slice_loop_filter_across_slices_enabled_flag"); … … 2204 2217 { 2205 2218 Int voiInVps = vps->getVoiInVps( pcSlice->getViewIndex() ); 2206 #if NH_3D_FIX_TICKET_1012207 2219 if( vps->getCpInSliceSegmentHeaderFlag( voiInVps ) ) 2208 #else2209 if( vps->getCpInSliceSegmentHeaderFlag( voiInVps ) && !pcSlice->getIsDepth() )2210 #endif2211 2220 { 2212 2221 for( Int m = 0; m < vps->getNumCp( voiInVps ); m++ ) … … 2257 2266 if( pcSlice->getPocMsbValRequiredFlag() ) 2258 2267 { 2259 pcSlice->setPocMsb ValPresentFlag( true );2268 pcSlice->setPocMsbCycleValPresentFlag( true ); 2260 2269 } 2261 2270 else 2262 2271 { 2263 pcSlice->setPocMsb ValPresentFlag( false );2264 } 2265 } 2266 2267 if( pcSlice->getPocMsb ValPresentFlag() )2272 pcSlice->setPocMsbCycleValPresentFlag( false ); 2273 } 2274 } 2275 2276 if( pcSlice->getPocMsbCycleValPresentFlag() ) 2268 2277 { 2269 2278 // Int iMaxPOClsb = 1<< pcSlice->getSPS()->getBitsForPOC(); currently unused 2270 2279 2271 2280 UInt lengthVal = 1; 2272 UInt tempVal = pcSlice->getPocMsb Val() + 1;2281 UInt tempVal = pcSlice->getPocMsbCycleVal() + 1; 2273 2282 assert ( tempVal ); 2274 2283 while( 1 != tempVal ) … … 2314 2323 if( !pcSlice->getPocMsbValRequiredFlag() && pcSlice->getVPS()->getVpsPocLsbAlignedFlag() ) 2315 2324 { 2316 WRITE_FLAG( pcSlice->getPocMsb ValPresentFlag( ) ? 1 : 0 , "poc_msb_val_present_flag" );2325 WRITE_FLAG( pcSlice->getPocMsbCycleValPresentFlag( ) ? 1 : 0 , "poc_msb_cycle_val_present_flag" ); 2317 2326 } 2318 2327 else 2319 2328 { 2320 assert( pcSlice->getPocMsb ValPresentFlag() == pcSlice->inferPocMsbValPresentFlag( ) );2329 assert( pcSlice->getPocMsbCycleValPresentFlag() == pcSlice->inferPocMsbCycleValPresentFlag( ) ); 2321 2330 } 2322 2331 2323 if( pcSlice->getPocMsb ValPresentFlag() )2324 { 2325 WRITE_UVLC( pcSlice->getPocMsb Val( ), "poc_msb_val" );2332 if( pcSlice->getPocMsbCycleValPresentFlag() ) 2333 { 2334 WRITE_UVLC( pcSlice->getPocMsbCycleVal( ), "poc_msb_cycle_val" ); 2326 2335 } 2327 2336 … … 2347 2356 for (Int i = 0; i < maxNumSubLayersMinus1; i++) 2348 2357 { 2349 #if !NH_MV2350 #endif2351 2358 WRITE_FLAG( pcPTL->getSubLayerProfilePresentFlag(i), "sub_layer_profile_present_flag[i]" ); 2352 #if !NH_MV2353 #endif2354 2359 WRITE_FLAG( pcPTL->getSubLayerLevelPresentFlag(i), "sub_layer_level_present_flag[i]" ); 2355 2360 } -
branches/HTM-15.0-dev0/source/Lib/TLibEncoder/TEncCavlc.h
r1313 r1317 66 66 67 67 protected: 68 #if NH_ 3D68 #if NH_MV 69 69 TEncTop* m_encTop; 70 70 #endif … … 179 179 Void codeExplicitRdpcmMode( TComTU &rTu, const ComponentID compID ); 180 180 181 #if NH_ 3D181 #if NH_MV 182 182 TEncTop* getEncTop() { return m_encTop; }; 183 183 Void setEncTop( TEncTop* et ) { m_encTop = et; }; -
branches/HTM-15.0-dev0/source/Lib/TLibEncoder/TEncCu.cpp
r1313 r1317 764 764 if( rpcBestCU->getSlice()->getDepthIntraSkipFlag() ) 765 765 { 766 xCheckRDCostDIS( rpcBestCU, rpcTempCU, SIZE_2Nx2N );766 xCheckRDCostDIS( rpcBestCU, rpcTempCU, SIZE_2Nx2N DEBUG_STRING_PASS_INTO(sDebug) ); 767 767 rpcTempCU->initEstData( uiDepth, iMinQP, isAddLowestQP ); 768 768 } … … 795 795 { 796 796 #if NH_3D_FAST_TEXTURE_ENCODING 797 xCheckRDCostInter( rpcBestCU, rpcTempCU DEBUG_STRING_PASS_INTO(sDebug), SIZE_NxN, bFMD );797 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_NxN DEBUG_STRING_PASS_INTO(sDebug), bFMD ); 798 798 #else 799 799 … … 1096 1096 1097 1097 if((rpcBestCU->getSlice()->getSliceType() == I_SLICE) || 1098 ((!m_pcEncCfg->getDisableIntraPUsInInterSlices()) && ( // avoid very complex intra if it is unlikely1098 ((!m_pcEncCfg->getDisableIntraPUsInInterSlices()) && ( 1099 1099 (rpcBestCU->getCbf( 0, COMPONENT_Y ) != 0) || 1100 1100 ((rpcBestCU->getCbf( 0, COMPONENT_Cb ) != 0) && (numberValidComponents > COMPONENT_Cb)) || 1101 ((rpcBestCU->getCbf( 0, COMPONENT_Cr ) != 0) && (numberValidComponents > COMPONENT_Cr)) 1101 ((rpcBestCU->getCbf( 0, COMPONENT_Cr ) != 0) && (numberValidComponents > COMPONENT_Cr)) // avoid very complex intra if it is unlikely 1102 1102 #if NH_3D_ENC_DEPTH 1103 1103 || rpcBestCU->getSlice()->getIsDepth() … … 1785 1785 } 1786 1786 1787 #if NH_MV 1787 1788 D_PRINT_INC_INDENT( g_traceModeCheck, "xCheckRDCostMerge2Nx2N" ); 1789 #endif 1788 1790 1789 1791 #if NH_3D_MLC … … 1970 1972 for( UInt uiNoResidual = 0; uiNoResidual < iteration; ++uiNoResidual ) 1971 1973 { 1974 #if NH_MV 1972 1975 D_PRINT_INC_INDENT ( g_traceModeCheck, "uiNoResidual: " + n2s( uiNoResidual) ); 1976 #endif 1973 1977 1974 1978 for( UInt uiMergeCand = 0; uiMergeCand < numValidMergeCand; ++uiMergeCand ) … … 1983 1987 } 1984 1988 #endif 1989 #if NH_MV 1985 1990 D_PRINT_INC_INDENT ( g_traceModeCheck, "uiMergeCand: "+ n2s(uiMergeCand) ); 1991 #endif 1986 1992 1987 1993 if(!(uiNoResidual==1 && mergeCandBuffer[uiMergeCand]==1)) … … 2173 2179 2174 2180 xCheckDQP( rpcTempCU ); 2175 xCheckBestMode( rpcBestCU, rpcTempCU, uhDepth );2181 xCheckBestMode( rpcBestCU, rpcTempCU, uhDepth DEBUG_STRING_PASS_INTO(bestStr) DEBUG_STRING_PASS_INTO(tmpStr) ); 2176 2182 } 2177 2183 } … … 2197 2203 } 2198 2204 } 2205 #if NH_MV 2199 2206 D_DEC_INDENT( g_traceModeCheck ); 2207 #endif 2200 2208 } 2201 2209 … … 2229 2237 } 2230 2238 } 2239 #if NH_MV 2231 2240 D_DEC_INDENT( g_traceModeCheck ); 2241 #endif 2232 2242 } 2233 2243 DEBUG_STRING_APPEND(sDebug, bestStr) … … 2239 2249 delete[] puhInterDirSP; 2240 2250 #endif 2251 #if NH_MV 2241 2252 D_DEC_INDENT( g_traceModeCheck ); 2253 #endif 2242 2254 } 2243 2255 … … 2265 2277 } 2266 2278 2279 #if NH_MV 2267 2280 D_PRINT_INC_INDENT(g_traceModeCheck, "xCheckRDCostInter; ePartSize:" + n2s( ePartSize) ); 2281 #endif 2268 2282 2269 2283 … … 2354 2368 { 2355 2369 #if NH_3D_ARP 2356 if( nARPWMax ) 2357 { 2358 continue; 2359 } 2360 else 2361 #endif 2362 { 2363 D_DEC_INDENT( g_traceModeCheck ); 2364 return; 2365 } 2370 if( nARPWMax ) 2371 { 2372 continue; 2373 } 2374 else 2375 #endif 2376 { 2377 #if NH_MV 2378 D_DEC_INDENT( g_traceModeCheck ); 2379 #endif 2380 return; 2381 } 2366 2382 } 2367 2383 #endif … … 2468 2484 2469 2485 xCheckDQP( rpcTempCU ); 2470 xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth );2486 xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth DEBUG_STRING_PASS_INTO(sDebug) DEBUG_STRING_PASS_INTO(sTest)); 2471 2487 } 2472 2488 … … 2479 2495 } 2480 2496 #endif 2497 #if NH_MV 2481 2498 D_DEC_INDENT( g_traceModeCheck ); 2499 #endif 2482 2500 } 2483 2501 … … 2683 2701 #endif 2684 2702 #if NH_3D_DIS 2685 Void TEncCu::xCheckRDCostDIS( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize eSize )2703 Void TEncCu::xCheckRDCostDIS( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize eSize DEBUG_STRING_FN_DECLARE(sDebug) ) 2686 2704 { 2705 DEBUG_STRING_NEW(sTest) 2687 2706 UInt uiDepth = rpcTempCU->getDepth( 0 ); 2688 2707 if( !rpcBestCU->getSlice()->getIsDepth() || (eSize != SIZE_2Nx2N)) … … 2691 2710 } 2692 2711 2712 #if NH_MV 2693 2713 D_PRINT_INC_INDENT(g_traceModeCheck, "xCheckRDCostDIS" ); 2714 #endif 2694 2715 2695 2716 #if NH_3D_VSO // M5 … … 2753 2774 xCheckDQP( rpcTempCU ); 2754 2775 xCheckBestMode(rpcBestCU, rpcTempCU, uiDepth DEBUG_STRING_PASS_INTO(sDebug) DEBUG_STRING_PASS_INTO(sTest) ); 2776 #if NH_MV 2755 2777 D_DEC_INDENT( g_traceModeCheck ); 2778 #endif 2756 2779 } 2757 2780 #endif … … 2777 2800 } 2778 2801 } 2802 #if NH_MV 2779 2803 D_PRINT_INC_INDENT (g_traceModeCheck, "xCheckRDCostIntra; eSize: " + n2s(eSize) ); 2780 2804 #endif 2805 2781 2806 UInt uiDepth = rpcTempCU->getDepth( 0 ); 2782 2807 #if NH_3D_VSO // M5 … … 2830 2855 m_pcEntropyCoder->encodeCUTransquantBypassFlag( rpcTempCU, 0, true ); 2831 2856 } 2832 #if NH_3D_DIS && !NH_3D_DIS_FIX 2857 m_pcEntropyCoder->encodeSkipFlag ( rpcTempCU, 0, true ); 2858 #if NH_3D_DIS 2833 2859 m_pcEntropyCoder->encodeDIS( rpcTempCU, 0, true ); 2834 2860 if(!rpcTempCU->getDISFlag(0)) 2835 2861 { 2836 2862 #endif 2837 m_pcEntropyCoder->encodeSkipFlag ( rpcTempCU, 0, true ); 2838 #if NH_3D_DIS_FIX 2839 m_pcEntropyCoder->encodeDIS( rpcTempCU, 0, true ); 2840 if(!rpcTempCU->getDISFlag(0)) 2841 { 2842 #endif 2843 m_pcEntropyCoder->encodePredMode( rpcTempCU, 0, true ); 2844 m_pcEntropyCoder->encodePartSize( rpcTempCU, 0, uiDepth, true ); 2845 m_pcEntropyCoder->encodePredInfo( rpcTempCU, 0 ); 2846 m_pcEntropyCoder->encodeIPCMInfo(rpcTempCU, 0, true ); 2863 m_pcEntropyCoder->encodePredMode( rpcTempCU, 0, true ); 2864 m_pcEntropyCoder->encodePartSize( rpcTempCU, 0, uiDepth, true ); 2865 m_pcEntropyCoder->encodePredInfo( rpcTempCU, 0 ); 2866 m_pcEntropyCoder->encodeIPCMInfo(rpcTempCU, 0, true ); 2847 2867 #if NH_3D_SDC_INTRA 2848 2868 m_pcEntropyCoder->encodeSDCFlag( rpcTempCU, 0, true ); 2849 2869 #endif 2850 2870 2851 // Encode Coefficients2852 Bool bCodeDQP = getdQPFlag();2853 Bool codeChromaQpAdjFlag = getCodeChromaQpAdjFlag();2854 m_pcEntropyCoder->encodeCoeff( rpcTempCU, 0, uiDepth, bCodeDQP, codeChromaQpAdjFlag );2855 setCodeChromaQpAdjFlag( codeChromaQpAdjFlag );2856 setdQPFlag( bCodeDQP );2871 // Encode Coefficients 2872 Bool bCodeDQP = getdQPFlag(); 2873 Bool codeChromaQpAdjFlag = getCodeChromaQpAdjFlag(); 2874 m_pcEntropyCoder->encodeCoeff( rpcTempCU, 0, uiDepth, bCodeDQP, codeChromaQpAdjFlag ); 2875 setCodeChromaQpAdjFlag( codeChromaQpAdjFlag ); 2876 setdQPFlag( bCodeDQP ); 2857 2877 #if NH_3D_DIS 2858 2878 } … … 2877 2897 xCheckBestMode(rpcBestCU, rpcTempCU, uiDepth DEBUG_STRING_PASS_INTO(sDebug) DEBUG_STRING_PASS_INTO(sTest)); 2878 2898 2899 #if NH_MV 2879 2900 D_DEC_INDENT( g_traceModeCheck ); 2880 } 2901 #endif 2902 } 2881 2903 2882 2904 … … 2912 2934 } 2913 2935 #endif 2914 2915 2936 rpcTempCU->setSkipFlagSubParts( false, 0, uiDepth ); 2916 2937 #if NH_3D_DIS -
branches/HTM-15.0-dev0/source/Lib/TLibEncoder/TEncCu.h
r1313 r1317 163 163 #endif 164 164 #if NH_3D_DIS 165 Void xCheckRDCostDIS ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize );165 Void xCheckRDCostDIS ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize DEBUG_STRING_FN_DECLARE(sDebug) ); 166 166 #endif 167 167 Void xCheckRDCostIntra ( TComDataCU *&rpcBestCU, -
branches/HTM-15.0-dev0/source/Lib/TLibEncoder/TEncEntropy.cpp
r1313 r1317 119 119 Void TEncEntropy::encodeDIS( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD ) 120 120 { 121 #if NH_3D_FIX_TICKET_98122 121 if( !pcCU->getSlice()->getDepthIntraSkipFlag() ) 123 #else124 if ( !pcCU->getSlice()->getIsDepth() )125 #endif126 122 { 127 123 return; -
branches/HTM-15.0-dev0/source/Lib/TLibEncoder/TEncEntropy.h
r1313 r1317 140 140 Void resetBits () { m_pcEntropyCoderIf->resetBits(); } 141 141 UInt getNumberOfWrittenBits () { 142 #if NH_MV 142 143 D_PRINT_INDENT(g_encNumberOfWrittenBits, "NumBits: " + n2s( m_pcEntropyCoderIf->getNumberOfWrittenBits() )) 144 #endif 143 145 return m_pcEntropyCoderIf->getNumberOfWrittenBits(); } 144 146 Void resetEntropy (const TComSlice *pSlice) { m_pcEntropyCoderIf->resetEntropy(pSlice); } -
branches/HTM-15.0-dev0/source/Lib/TLibEncoder/TEncGOP.cpp
r1313 r1317 1428 1428 if ( gopNum == MAX_GOP) 1429 1429 { 1430 printf( "\nError: FrameI_l%d cannot enable inter-component prediction .\n", pcSlice->getVPS()->getLayerIdInVps( getLayerId() ) );1430 printf( "\nError: FrameI_l%d cannot enable inter-component prediction on slice level. All reference layers need to be available and at least one tool using inter-component prediction must be enabled in the SPS. \n", pcSlice->getVPS()->getLayerIdInVps( getLayerId() ) ); 1431 1431 } 1432 1432 else 1433 1433 { 1434 printf( "\nError: Frame%d_l%d cannot enable inter-component prediction .\n", gopNum, pcSlice->getVPS()->getLayerIdInVps( getLayerId() ) );1434 printf( "\nError: Frame%d_l%d cannot enable inter-component prediction on slice level. All reference layers need to be available and at least one tool using inter-component prediction must be enabled in the SPS. \n", gopNum, pcSlice->getVPS()->getLayerIdInVps( getLayerId() ) ); 1435 1435 } 1436 1436 … … 1441 1441 pcSlice->checkInCompPredRefLayers(); 1442 1442 } 1443 1444 1443 #if NH_3D_IV_MERGE 1445 1444 // This needs to be done after initialization of 3D tool parameters. -
branches/HTM-15.0-dev0/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp
r1313 r1317 826 826 } 827 827 828 #if NH_MV 828 829 D_PRINT_INDENT( g_traceSAOCost, "SAO mode " + n2s( mode ) + " Cost: " + n2s( modeCost) ); 829 830 #endif 830 831 if(modeCost < minCost) 831 832 { -
branches/HTM-15.0-dev0/source/Lib/TLibEncoder/TEncSearch.cpp
r1313 r1317 1530 1530 ) 1531 1531 { 1532 #if NH_MV 1532 1533 D_PRINT_INC_INDENT( g_traceModeCheck, "xRecurIntraCodingLumaQT; zeroResiFlag " + n2s(zeroResiFlag) ) 1534 #endif 1533 1535 1534 1536 TComDataCU *pcCU = rTu.getCU(); … … 1713 1715 dSingleCost = 0.0; 1714 1716 #if NH_3D_ENC_DEPTH 1715 #if NH_3D_ENC_DEPTH_FIX1716 1717 xIntraCodingTUBlock( pcOrgYuv, pcPredYuv, pcResiYuv, resiLumaSingle, false, uiSingleDistLuma, COMPONENT_Y, rTu DEBUG_STRING_PASS_INTO(sDebug), 0, zeroResiFlag ); 1717 #else1718 xIntraCodingTUBlock( pcOrgYuv, pcPredYuv, pcResiYuv, resiLumaSingle, false, uiSingleDistLuma, COMPONENT_Y, rTu DEBUG_STRING_PASS_INTO(sDebug), zeroResiFlag );1719 #endif1720 1718 #else 1721 1719 pcCU ->setTransformSkipSubParts ( 0, COMPONENT_Y, uiAbsPartIdx, totalAdjustedDepthChan ); … … 1841 1839 } 1842 1840 } 1841 #if NH_MV 1843 1842 D_DEC_INDENT( g_traceModeCheck ); 1843 #endif 1844 1844 return; 1845 1845 } … … 1888 1888 ruiDistY += uiSingleDistLuma; 1889 1889 dRDCost += dSingleCost; 1890 #if NH_MV 1890 1891 D_DEC_INDENT( g_traceModeCheck ); 1892 #endif 1891 1893 } 1892 1894 … … 1907 1909 TComTURecurse rTu(pcCU, 0); 1908 1910 const ChromaFormat chFmt = rTu.GetChromaFormat(); 1909 1911 DEBUG_STRING_NEW(sTemp) 1910 1912 if ( uiPredMode == 0 ) 1911 1913 { … … 2031 2033 TComTURecurse tuRecurseCU(pcCU, 0); 2032 2034 TComTURecurse tuRecurseWithPU(tuRecurseCU, false, TComTU::DONT_SPLIT); 2033 2035 DEBUG_STRING_NEW(sTemp) 2034 2036 initIntraPatternChType( tuRecurseWithPU, COMPONENT_Y, false DEBUG_STRING_PASS_INTO(sTemp) ); 2035 2037 … … 2086 2088 2087 2089 //===== init pattern for luma prediction ===== 2088 2090 DEBUG_STRING_NEW(sTemp2) 2089 2091 initIntraPatternChType( tuRecurseWithPU, COMPONENT_Y, bUseFilter DEBUG_STRING_PASS_INTO(sTemp2) ); 2090 2092 … … 2212 2214 2213 2215 //===== determine distortion ===== 2214 #if NH_3D_INTRA_SDC_RD_FIX2215 2216 #if NH_3D_VSO 2216 2217 if( m_pcRdCost->getUseVSO() ) … … 2219 2220 } 2220 2221 else 2221 #endif2222 #else2223 #if NH_3D_VSO2224 if( m_pcRdCost->getUseVSO() )2225 {2226 if( m_pcRdCost->getUseEstimatedVSD() )2227 {2228 ruiDist = m_pcRdCost->getDistPartVSD( pcCU, uiAbsPartIdx, bitDepthY, piPred, uiStride, piOrg, uiStride, uiWidth, uiHeight, false );2229 }2230 else2231 {2232 ruiDist = m_pcRdCost->getDistPartVSO( pcCU, uiAbsPartIdx, bitDepthY, piPred, uiStride, piOrg, uiStride, uiWidth, uiHeight, false );2233 }2234 }2235 else2236 #endif2237 2222 #endif 2238 2223 { … … 2754 2739 Bool bLumaOnly ) 2755 2740 { 2741 #if NH_MV 2756 2742 D_PRINT_INC_INDENT(g_traceModeCheck, "estIntraPredDis"); 2743 #endif 2757 2744 2758 2745 UInt uiDepth = pcCU->getDepth(0); … … 2772 2759 for( UInt uiPredMode = 0; uiPredMode < 4 ; uiPredMode++ ) 2773 2760 { 2761 #if NH_MV 2774 2762 D_PRINT_INC_INDENT(g_traceModeCheck, "uiPredMode" + n2s(uiPredMode ) ); 2763 #endif 2775 2764 2776 2765 // set context models … … 2796 2785 pcPredYuv->copyPartToPartYuv(pcRecoYuv, 0, uiWidth, uiHeight); 2797 2786 } 2787 #if NH_MV 2798 2788 D_DEC_INDENT( g_traceModeCheck ); 2789 #endif 2799 2790 } 2800 2791 … … 2807 2798 //===== set distortion (rate and r-d costs are determined later) ===== 2808 2799 pcCU->getTotalDistortion() = uiBestDist; 2800 #if NH_MV 2809 2801 D_DEC_INDENT( g_traceModeCheck ); 2802 #endif 2810 2803 } 2811 2804 #endif … … 2826 2819 ) 2827 2820 { 2821 #if NH_MV 2828 2822 D_PRINT_INC_INDENT( g_traceModeCheck, "estIntraPredLumaQT"); 2823 #endif 2829 2824 2830 2825 const UInt uiDepth = pcCU->getDepth(0); … … 2882 2877 { 2883 2878 const UInt uiPartOffset=tuRecurseWithPU.GetAbsPartIdxTU(); 2879 #if NH_MV 2884 2880 D_PRINT_INC_INDENT(g_traceModeCheck, "uiPartOffset: " + n2s(uiPartOffset ) ); 2881 #endif 2885 2882 2886 2883 // for( UInt uiPU = 0, uiPartOffset=0; uiPU < uiNumPU; uiPU++, uiPartOffset += uiQNumParts ) … … 2927 2924 m_pcRdCost->setDistParam(distParam, sps.getBitDepth(CHANNEL_TYPE_LUMA), piOrg, uiStride, piPred, uiStride, puRect.width, puRect.height, bUseHadamard); 2928 2925 2929 #if NH_3D _IC_FIX2926 #if NH_3D 2930 2927 distParam.bUseIC = false; 2931 2928 #endif … … 2940 2937 Distortion uiSad = 0; 2941 2938 #endif 2939 #if NH_MV 2942 2940 D_PRINT_INC_INDENT(g_traceModeCheck, "preTest; uiMode " + n2s(uiMode) ); 2941 #endif 2943 2942 2944 2943 const Bool bUseFilter=TComPrediction::filteringIntraReferenceSamples(COMPONENT_Y, uiMode, puRect.width, puRect.height, chFmt, sps.getSpsRangeExtension().getIntraSmoothingDisabledFlag()); … … 2993 2992 2994 2993 CandNum += xUpdateCandList( uiMode, cost, numModesForFullRD, uiRdModeList, CandCostList ); 2994 #if NH_MV 2995 2995 D_DEC_INDENT( g_traceModeCheck ); 2996 #endif 2996 2997 } 2997 2998 … … 3193 3194 #endif 3194 3195 3196 #if NH_MV 3195 3197 D_PRINT_INC_INDENT(g_traceModeCheck, "Test; uiOrgMode: " + n2s(uiOrgMode) ); 3198 #endif 3196 3199 3197 3200 pcCU->setIntraDirSubParts ( CHANNEL_TYPE_LUMA, uiOrgMode, uiPartOffset, uiDepth + uiInitTrDepth ); … … 3395 3398 } // SDC loop 3396 3399 #endif 3400 #if NH_MV 3397 3401 D_DEC_INDENT( g_traceModeCheck ); 3402 #endif 3398 3403 } // Mode loop 3399 3404 … … 3554 3559 pcCU->setSDCFlagSubParts ( bBestUseSDC, uiPartOffset, uiDepth + uiInitTrDepth ); 3555 3560 #endif 3561 #if NH_MV 3556 3562 D_DEC_INDENT( g_traceModeCheck ); 3563 #endif 3557 3564 } while (tuRecurseWithPU.nextSection(tuRecurseCU)); 3558 3565 … … 3583 3590 //===== set distortion (rate and r-d costs are determined later) ===== 3584 3591 pcCU->getTotalDistortion() = uiOverallDistY; 3592 #if NH_MV 3585 3593 D_DEC_INDENT( g_traceModeCheck ); 3594 #endif 3586 3595 } 3587 3596 … … 3892 3901 ) 3893 3902 { 3903 #if NH_MV 3894 3904 D_PRINT_INC_INDENT(g_traceModeCheck, "xMergeEstimation" ); 3905 #endif 3895 3906 3896 3907 UInt uiAbsPartIdx = 0; … … 4014 4025 for( UInt uiMergeCand = 0; uiMergeCand < numValidMergeCand; ++uiMergeCand ) 4015 4026 { 4027 #if NH_MV 4016 4028 D_PRINT_INC_INDENT(g_traceModeCheck, "uiMergeCand: " + n2s(uiMergeCand) ); 4029 #endif 4017 4030 Distortion uiCostCand = std::numeric_limits<Distortion>::max(); 4018 4031 UInt uiBitsCand = 0; … … 4092 4105 uiCostCand = uiCostCand + m_pcRdCost->getCost( uiBitsCand ); 4093 4106 4107 #if NH_MV 4094 4108 D_PRINT_INDENT( g_traceRDCost, "IP RD Cost: " + n2s(uiCostCand)); 4109 #endif 4095 4110 4096 4111 if ( uiCostCand < ruiCost ) … … 4102 4117 uiMergeIndex = uiMergeCand; 4103 4118 } 4119 #if NH_MV 4104 4120 D_DEC_INDENT( g_traceModeCheck ); 4105 } 4121 #endif 4122 } 4123 #if NH_MV 4106 4124 D_DEC_INDENT( g_traceModeCheck ); 4125 #endif 4107 4126 } 4108 4127 … … 4142 4161 { 4143 4162 4163 #if NH_MV 4144 4164 D_PRINT_INC_INDENT(g_traceModeCheck, "predInterSearch"); 4165 #endif 4145 4166 4146 4167 for(UInt i=0; i<NUM_REF_PIC_LIST_01; i++) … … 4210 4231 for ( Int iPartIdx = 0; iPartIdx < iNumPart; iPartIdx++ ) 4211 4232 { 4233 #if NH_MV 4212 4234 D_PRINT_INC_INDENT(g_traceModeCheck, "iPartIdx: " + n2s(iPartIdx) ); 4235 #endif 4213 4236 4214 4237 Distortion uiCost[2] = { std::numeric_limits<Distortion>::max(), std::numeric_limits<Distortion>::max() }; … … 4258 4281 for ( Int iRefList = 0; iRefList < iNumPredDir; iRefList++ ) 4259 4282 { 4283 #if NH_MV 4260 4284 D_PRINT_INC_INDENT(g_traceModeCheck, "iRefList: " + n2s(iRefList) ); 4285 #endif 4261 4286 4262 4287 RefPicList eRefPicList = ( iRefList ? REF_PIC_LIST_1 : REF_PIC_LIST_0 ); … … 4264 4289 for ( Int iRefIdxTemp = 0; iRefIdxTemp < pcCU->getSlice()->getNumRefIdx(eRefPicList); iRefIdxTemp++ ) 4265 4290 { 4291 #if NH_MV 4266 4292 D_PRINT_INC_INDENT(g_traceModeCheck, "iRefIdxTemp: " + n2s(iRefIdxTemp) ); 4293 #endif 4267 4294 4268 4295 uiBitsTemp = uiMbBits[iRefList]; … … 4338 4365 refIdxValidList1 = iRefIdxTemp; 4339 4366 } 4367 #if NH_MV 4340 4368 D_DEC_INDENT( g_traceModeCheck ); 4341 } 4369 #endif 4370 } 4371 #if NH_MV 4342 4372 D_DEC_INDENT( g_traceModeCheck ); 4373 #endif 4343 4374 } 4344 4375 … … 4609 4640 xGetInterPredictionError( pcCU, pcOrgYuv, iPartIdx, uiMEError, m_pcEncCfg->getUseHADME() ); 4610 4641 uiMECost = uiMEError + m_pcRdCost->getCost( uiMEBits ); 4642 #if NH_MV 4611 4643 D_PRINT_INDENT( g_traceRDCost, "IP RD Cost: " + n2s(uiMECost)); 4644 #endif 4612 4645 } 4613 4646 #else … … 4756 4789 // MC 4757 4790 motionCompensation ( pcCU, pcPredYuv, REF_PIC_LIST_X, iPartIdx ); 4791 #if NH_MV 4758 4792 D_DEC_INDENT( g_traceModeCheck ); 4793 #endif 4759 4794 } // end of for ( Int iPartIdx = 0; iPartIdx < iNumPart; iPartIdx++ ) 4760 4795 4761 4796 setWpScalingDistParam( pcCU, -1, REF_PIC_LIST_X ); 4762 4797 4798 #if NH_MV 4763 4799 D_DEC_INDENT( g_traceModeCheck ); 4800 #endif 4764 4801 return; 4765 4802 } … … 4769 4806 Void TEncSearch::xEstimateMvPredAMVP( TComDataCU* pcCU, TComYuv* pcOrgYuv, UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMvPred, Bool bFilled, Distortion* puiDistBiP ) 4770 4807 { 4808 #if NH_MV 4771 4809 D_PRINT_INC_INDENT(g_traceModeCheck, "xEstimateMvPredAMVP"); 4810 #endif 4772 4811 4773 4812 AMVPInfo* pcAMVPInfo = pcCU->getCUMvField(eRefPicList)->getAMVPInfo(); … … 4847 4886 if(pcCU->getSlice()->getMvdL1ZeroFlag() && eRefPicList==REF_PIC_LIST_1) 4848 4887 { 4888 #if NH_MV 4849 4889 D_PRINT_INC_INDENT(g_traceModeCheck, "Init"); 4890 #endif 4850 4891 4851 4892 (*puiDistBiP) = xGetTemplateCost( pcCU, uiPartAddr, pcOrgYuv, &m_cYuvPredTemp, rcMvPred, 0, AMVP_MAX_NUM_CANDS, eRefPicList, iRefIdx, iRoiWidth, iRoiHeight); 4852 4893 4894 #if NH_MV 4853 4895 D_DEC_INDENT( g_traceModeCheck ); 4896 #endif 4854 4897 } 4855 4898 return; … … 4867 4910 for ( i = 0 ; i < pcAMVPInfo->iN; i++) 4868 4911 { 4912 #if NH_MV 4869 4913 D_PRINT_INC_INDENT(g_traceModeCheck, "Cand i=" + n2s(i) + " X: " + n2s( pcAMVPInfo->m_acMvCand[i].getHor() ) + " Y: " + n2s( pcAMVPInfo->m_acMvCand[i].getVer() )); 4914 #endif 4870 4915 4871 4916 Distortion uiTmpCost; … … 4879 4924 } 4880 4925 4926 #if NH_MV 4881 4927 D_DEC_INDENT( g_traceModeCheck ); 4928 #endif 4882 4929 } 4883 4930 … … 4889 4936 pcCU->setMVPNumSubParts( pcAMVPInfo->iN, eRefPicList, uiPartAddr, uiPartIdx, pcCU->getDepth(uiPartAddr)); 4890 4937 4938 #if NH_MV 4891 4939 D_DEC_INDENT( g_traceModeCheck ); 4940 #endif 4892 4941 4893 4942 return; … … 5094 5143 Void TEncSearch::xMotionEstimation( TComDataCU* pcCU, TComYuv* pcYuvOrg, Int iPartIdx, RefPicList eRefPicList, TComMv* pcMvPred, Int iRefIdxPred, TComMv& rcMv, UInt& ruiBits, Distortion& ruiCost, Bool bBi ) 5095 5144 { 5145 #if NH_MV 5096 5146 D_PRINT_INC_INDENT(g_traceModeCheck, "xMotionEstimation"); 5147 #endif 5097 5148 5098 5149 UInt uiPartAddr; … … 5227 5278 ruiCost = (Distortion)( floor( fWeight * ( (Double)ruiCost - (Double)m_pcRdCost->getCost( uiMvBits ) ) ) + (Double)m_pcRdCost->getCost( ruiBits ) ); 5228 5279 5280 #if NH_MV 5229 5281 D_PRINT_INDENT(g_traceRDCost, "ME Cost:" + n2s(ruiCost) ); 5230 5282 D_DEC_INDENT ( g_traceModeCheck ); 5283 #endif 5231 5284 } 5232 5285 … … 5788 5841 Bool bSkipResidual DEBUG_STRING_FN_DECLARE(sDebug) ) 5789 5842 { 5843 #if NH_MV 5790 5844 D_PRINT_INC_INDENT(g_traceModeCheck, "encodeResAndCalcRdInterCU; Skip residual: " + n2s(bSkipResidual)); 5845 #endif 5791 5846 5792 5847 assert ( !pcCU->isIntra(0) ); … … 5883 5938 } 5884 5939 #endif 5940 #if NH_MV 5885 5941 D_DEC_INDENT( g_traceModeCheck ); 5942 #endif 5886 5943 5887 5944 return; … … 6049 6106 } 6050 6107 #endif 6108 #if NH_MV 6051 6109 D_DEC_INDENT( g_traceModeCheck ); 6110 #endif 6052 6111 } 6053 6112 … … 6207 6266 DEBUG_STRING_FN_DECLARE(sDebug) ) 6208 6267 { 6268 #if NH_MV 6209 6269 D_PRINT_INC_INDENT(g_traceModeCheck, "xEstimateInterResidualQT"); 6270 #endif 6210 6271 6211 6272 TComDataCU *pcCU = rTu.getCU(); … … 6260 6321 if( bCheckFull ) 6261 6322 { 6323 #if NH_MV 6262 6324 D_PRINT_INC_INDENT(g_traceModeCheck, "bCheckFull" ); 6325 #endif 6263 6326 6264 6327 Double minCost[MAX_NUM_COMPONENT][2/*0 = top (or whole TU for non-4:2:2) sub-TU, 1 = bottom sub-TU*/]; … … 6349 6412 for (Int transformSkipModeId = 0; transformSkipModeId < transformSkipModesToTest; transformSkipModeId++) 6350 6413 { 6414 #if NH_MV 6351 6415 D_PRINT_INC_INDENT( g_traceModeCheck && ( transformSkipModeId > 0) , "TransformSkipModeId: " + n2s(transformSkipModeId) ); 6416 #endif 6352 6417 6353 6418 pcCU->setTransformSkipPartRange(transformSkipModeId, compID, subTUAbsPartIdx, partIdxesPerSubTU); … … 6358 6423 const Bool bUseCrossCPrediction = crossCPredictionModeId != 0; 6359 6424 6425 #if NH_MV 6360 6426 D_PRINT_INC_INDENT( g_traceModeCheck, "Zero" ); 6427 #endif 6361 6428 6362 6429 m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[ uiDepth ][ CI_QT_TRAFO_ROOT ] ); … … 6511 6578 } 6512 6579 6580 6513 6581 DEBUG_STRING_NEW(sSingleStringTest) 6514 6515 D_DEC_INDENT( g_traceModeCheck );6516 6582 #if NH_MV 6583 D_DEC_INDENT( g_traceModeCheck ); 6584 #endif 6517 6585 if( currAbsSum > 0 ) //if non-zero coefficients are present, a residual needs to be derived for further prediction 6518 6586 { 6587 #if NH_MV 6519 6588 D_PRINT_INC_INDENT(g_traceModeCheck, "NonZero"); 6589 #endif 6520 6590 6521 6591 if (isFirstMode) … … 6611 6681 currCompCost = nonCoeffCost; 6612 6682 } 6683 #if NH_MV 6613 6684 D_DEC_INDENT( g_traceModeCheck ); 6685 #endif 6614 6686 6615 6687 // evaluate … … 6689 6761 } 6690 6762 } 6763 #if NH_MV 6691 6764 D_DEC_INDENT( g_traceModeCheck ); 6765 #endif 6692 6766 } 6693 6767 … … 6700 6774 } // component loop 6701 6775 6776 #if NH_MV 6702 6777 D_PRINT_INC_INDENT(g_traceModeCheck, "Final"); 6778 #endif 6703 6779 6704 6780 for(UInt ch = 0; ch < numValidComp; ch++) … … 6758 6834 dSingleCost = m_pcRdCost->calcRdCost( uiSingleBits, uiSingleDist ); 6759 6835 6836 #if NH_MV 6760 6837 D_DEC_INDENT( g_traceModeCheck ); 6761 6838 D_DEC_INDENT( g_traceModeCheck ); 6839 #endif 6762 6840 } // check full 6763 6841 … … 6765 6843 if( bCheckSplit ) 6766 6844 { 6845 #if NH_MV 6767 6846 D_PRINT_INC_INDENT(g_traceModeCheck, "bCheckSplit" ); 6847 #endif 6768 6848 if( bCheckFull ) 6769 6849 { … … 6935 7015 m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[ uiDepth ][ CI_QT_TRAFO_TEST ] ); 6936 7016 } 7017 #if NH_MV 6937 7018 D_DEC_INDENT( g_traceModeCheck ); 7019 #endif 6938 7020 } 6939 7021 else … … 6955 7037 #endif 6956 7038 } 7039 #if NH_MV 6957 7040 D_DEC_INDENT( g_traceModeCheck ); 7041 #endif 6958 7042 DEBUG_STRING_APPEND(sDebug, debug_reorder_data_inter_token[MAX_NUM_COMPONENT]) 7043 6959 7044 } 6960 7045 -
branches/HTM-15.0-dev0/source/Lib/TLibEncoder/TEncSearch.h
r1313 r1317 351 351 #endif 352 352 353 #if NH_3D_DMM 353 354 // ------------------------------------------------------------------------------------------------------------------- 354 355 // Depth intra search 355 356 // ------------------------------------------------------------------------------------------------------------------- 356 #if NH_3D_DMM 357 357 358 Void xCalcBiSegDCs ( Pel* ptrSrc, UInt srcStride, Bool* biSegPattern, Int patternStride, Pel& valDC1, Pel& valDC2, Pel defaultVal, Bool subSamp = false ); 358 359 Void xSearchDmmDeltaDCs ( TComDataCU* pcCU, UInt uiAbsPtIdx, Pel* piOrig, Pel* piPredic, UInt uiStride, Bool* biSegPattern, Int patternStride, UInt uiWidth, UInt uiHeight, Pel& rDeltaDC1, Pel& rDeltaDC2 ); -
branches/HTM-15.0-dev0/source/Lib/TLibEncoder/TEncTop.cpp
r1313 r1317 83 83 m_aICEnableNum = NULL; 84 84 #endif 85 #if NH_ 3D85 #if NH_MV 86 86 m_cCavlcCoder.setEncTop(this); 87 87 #endif … … 350 350 m_cPreanalyzer.xPreanalyze( dynamic_cast<TEncPic*>( pcPicCurr ) ); 351 351 } 352 #if NH_MV353 352 pcPicCurr->setLayerId( getLayerId()); 354 #endif355 353 #if NH_3D 356 354 pcPicCurr->setScaleOffset( m_cameraParameters->getCodedScale(), m_cameraParameters->getCodedOffset() ); … … 361 359 Void TEncTop::deletePicBuffer() 362 360 { 361 362 #if !NH_MV 363 363 TComList<TComPic*>::iterator iterPic = m_cListPic.begin(); 364 364 Int iSize = Int( m_cListPic.size() ); 365 366 365 for ( Int i = 0; i < iSize; i++ ) 367 366 { … … 372 371 pcPic = NULL; 373 372 } 373 #endif 374 374 } 375 375 … … 404 404 if( gopId == 0) 405 405 { 406 m_cGOPEncoder.initGOP(m_iPOCLast, m_iNumPicRcvd, m_cListPic, rcListPicYuvRecOut, accessUnitsOut);406 m_cGOPEncoder.initGOP(m_iPOCLast, m_iNumPicRcvd, *(m_ivPicLists->getSubDpb( getLayerId(), false )), rcListPicYuvRecOut, accessUnitsOut); 407 407 #else 408 408 if (pcPicYuvOrg != NULL) … … 434 434 #if NH_MV 435 435 } 436 m_cGOPEncoder.compressPicInGOP(m_iPOCLast, m_iNumPicRcvd, m_cListPic, rcListPicYuvRecOut, accessUnitsOut, false, false, snrCSC, m_printFrameMSE, gopId);436 m_cGOPEncoder.compressPicInGOP(m_iPOCLast, m_iNumPicRcvd, *(m_ivPicLists->getSubDpb(getLayerId(), false) ), rcListPicYuvRecOut, accessUnitsOut, false, false, snrCSC, m_printFrameMSE, gopId); 437 437 438 438 if( gopId + 1 == m_cGOPEncoder.getGOPSize() ) … … 574 574 // At this point, the SPS and PPS can be considered activated - they are copied to the new TComPic. 575 575 576 #if NH_MV 577 TComList<TComPic*>& cListPic = *(m_ivPicLists->getSubDpb(getLayerId(), false) ); 578 TComSlice::sortPicList(cListPic); 579 #else 576 580 TComSlice::sortPicList(m_cListPic); 577 578 581 #endif 582 583 584 #if NH_MV 585 if (cListPic.size() >= (UInt)(m_iGOPSize + getMaxDecPicBuffering(MAX_TLAYER-1) + 2) ) 586 { 587 TComList<TComPic*>::iterator iterPic = cListPic.begin(); 588 Int iSize = Int( cListPic.size() ); 589 #else 579 590 if (m_cListPic.size() >= (UInt)(m_iGOPSize + getMaxDecPicBuffering(MAX_TLAYER-1) + 2) ) 580 591 { 581 592 TComList<TComPic*>::iterator iterPic = m_cListPic.begin(); 582 593 Int iSize = Int( m_cListPic.size() ); 594 #endif 583 595 for ( Int i = 0; i < iSize; i++ ) 584 596 { … … 604 616 } 605 617 618 #if NH_MV 619 cListPic.pushBack( rpcPic ); 620 #else 606 621 m_cListPic.pushBack( rpcPic ); 622 #endif 607 623 } 608 624 rpcPic->setReconMark (false); … … 1056 1072 m_cPPS.setOutputFlagPresentFlag( false ); 1057 1073 #if NH_MV 1058 #if NH_MV_FIX_TICKET_1001059 1074 m_cPPS.setNumExtraSliceHeaderBits( 2 ); 1060 #else1061 m_cPPS.setNumExtraSliceHeaderBits( 3 );1062 #endif1063 1075 #endif 1064 1076 m_cPPS.setSignHideFlag(getSignHideFlag()); -
branches/HTM-15.0-dev0/source/Lib/TLibEncoder/TEncTop.h
r1313 r1317 76 76 Int m_iNumPicRcvd; ///< number of received pictures 77 77 UInt m_uiNumAllPicCoded; ///< number of coded pictures 78 #if !NH_MV 78 79 TComList<TComPic*> m_cListPic; ///< dynamic list of pictures 80 #endif 79 81 80 82 #if NH_MV … … 170 172 // ------------------------------------------------------------------------------------------------------------------- 171 173 174 #if NH_MV 175 TComList<TComPic*>* getListPic () { return m_ivPicLists->getSubDpb( getLayerId(), false); } 176 #else 172 177 TComList<TComPic*>* getListPic () { return &m_cListPic; } 178 #endif 173 179 TEncSearch* getPredSearch () { return &m_cSearch; } 174 180
Note: See TracChangeset for help on using the changeset viewer.