Changeset 1321 in 3DVCSoftware for trunk/source/Lib/TLibDecoder
- Timestamp:
- 7 Sep 2015, 18:16:33 (9 years ago)
- Location:
- trunk/source/Lib/TLibDecoder
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/Lib/TLibDecoder/TDecCAVLC.cpp
r1313 r1321 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 -
trunk/source/Lib/TLibDecoder/TDecCAVLC.h
r1313 r1321 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 ); -
trunk/source/Lib/TLibDecoder/TDecCu.cpp
r1313 r1321 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 -
trunk/source/Lib/TLibDecoder/TDecEntropy.cpp
r1313 r1321 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 ); -
trunk/source/Lib/TLibDecoder/TDecEntropy.h
r1313 r1321 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); } -
trunk/source/Lib/TLibDecoder/TDecSbac.h
r1313 r1321 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); -
trunk/source/Lib/TLibDecoder/TDecTop.cpp
r1313 r1321 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 -
trunk/source/Lib/TLibDecoder/TDecTop.h
r1313 r1321 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
Note: See TracChangeset for help on using the changeset viewer.