Changeset 1317 in 3DVCSoftware for branches/HTM-15.0-dev0/source/Lib/TLibDecoder/TDecCAVLC.cpp
- Timestamp:
- 4 Sep 2015, 21:28:58 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-15.0-dev0/source/Lib/TLibDecoder/TDecCAVLC.cpp
r1313 r1317 66 66 fprintf( g_hTrace, "=========== Picture Parameter Set ===========\n"); 67 67 } 68 69 Void xTraceSliceHeader () 70 { 71 fprintf( g_hTrace, "=========== Slice ===========\n"); 72 } 73 68 74 #endif 69 75 #endif … … 85 91 // ==================================================================================================================== 86 92 93 #if NH_MV 94 Void TDecCavlc::parseShortTermRefPicSet( TComSPS* sps, TComStRefPicSet* stRps, Int stRpsIdx ) 95 { 96 UInt uiCode; 97 if( stRpsIdx != 0 ) 98 { 99 READ_FLAG( uiCode, "inter_ref_pic_set_prediction_flag" ); stRps->setInterRefPicSetPredictionFlag( uiCode == 1 ); 100 } 101 if( stRps->getInterRefPicSetPredictionFlag() ) 102 { 103 if( stRpsIdx == sps->getNumShortTermRefPicSets() ) 104 { 105 READ_UVLC( uiCode, "delta_idx_minus1" ); stRps->setDeltaIdxMinus1( uiCode ); 106 } 107 READ_FLAG( uiCode, "delta_rps_sign" ); stRps->setDeltaRpsSign( uiCode == 1 ); 108 READ_UVLC( uiCode, "abs_delta_rps_minus1" ); stRps->setAbsDeltaRpsMinus1( uiCode ); 109 for( Int j = 0; j <= sps->getStRefPicSet( stRps->getRefRpsIdx( stRpsIdx ) )->getNumDeltaPocs() ; j++ ) 110 { 111 READ_FLAG( uiCode, "used_by_curr_pic_flag" ); stRps->setUsedByCurrPicFlag( j, uiCode == 1 ); 112 if( !stRps->getUsedByCurrPicFlag( j ) ) 113 { 114 READ_FLAG( uiCode, "use_delta_flag" ); stRps->setUseDeltaFlag( j, uiCode == 1 ); 115 } 116 } 117 } 118 else 119 { 120 READ_UVLC( uiCode, "num_negative_pics" ); stRps->setNumNegativePics( uiCode ); 121 READ_UVLC( uiCode, "num_positive_pics" ); stRps->setNumPositivePics( uiCode ); 122 for( Int i = 0; i < stRps->getNumNegativePics( ); i++ ) 123 { 124 READ_UVLC( uiCode, "delta_poc_s0_minus1" ); stRps->setDeltaPocS0Minus1( i, uiCode ); 125 READ_FLAG( uiCode, "used_by_curr_pic_s0_flag" ); stRps->setUsedByCurrPicS0Flag( i, uiCode == 1 ); 126 } 127 for( Int i = 0; i < stRps->getNumPositivePics( ); i++ ) 128 { 129 READ_UVLC( uiCode, "delta_poc_s1_minus1" ); stRps->setDeltaPocS1Minus1( i, uiCode ); 130 READ_FLAG( uiCode, "used_by_curr_pic_s1_flag" ); stRps->setUsedByCurrPicS1Flag( i, uiCode == 1 ); 131 } 132 } 133 stRps->inferRps( stRpsIdx, sps, false ); 134 } 135 #else 87 136 Void TDecCavlc::parseShortTermRefPicSet( TComSPS* sps, TComReferencePictureSet* rps, Int idx ) 88 137 { … … 180 229 #endif 181 230 } 231 #endif 182 232 183 233 Void TDecCavlc::parsePPS(TComPPS* pcPPS) … … 507 557 { 508 558 READ_CODE(6, uiCode, "pps_depth_layers_minus1"); 509 #if NH_3D_VER141_DEC_COMP_FLAG510 pcDLT->setNumDepthViews( uiCode );511 #else512 559 pcDLT->setNumDepthViews( uiCode+1 ); 513 #endif514 560 515 561 READ_CODE(4, uiCode, "pps_bit_depth_for_depth_layers_minus8"); 516 562 pcDLT->setDepthViewBitDepth( (uiCode+8) ); 517 563 518 #if NH_3D_DLT_FIX519 564 for( Int i = 0; i <= pcDLT->getNumDepthViews()-1; i++ ) 520 #else521 for( Int i = 0; i <= pcDLT->getNumDepthViews(); i++ )522 #endif523 565 { 524 566 Int layerId = pcDLT->getDepthIdxToLayerId(i); … … 866 908 #if NH_MV 867 909 pcSPS->getPTL()->inferGeneralValues ( true, 0, NULL ); 868 pcSPS->getPTL()->inferSubLayerValues( pcSPS->get MaxTLayers() - 1, 0, NULL );910 pcSPS->getPTL()->inferSubLayerValues( pcSPS->getSpsMaxSubLayersMinus1(), 0, NULL ); 869 911 } 870 912 #endif … … 972 1014 pcSPS->setNumReorderPics(uiCode, i); 973 1015 READ_UVLC ( uiCode, "sps_max_latency_increase_plus1[i]"); 1016 #if NH_MV 1017 pcSPS->setSpsMaxLatencyIncreasePlus1( uiCode, i ); 1018 #else 974 1019 pcSPS->setMaxLatencyIncrease( uiCode, i ); 1020 #endif 975 1021 976 1022 if (!subLayerOrderingInfoPresentFlag) … … 980 1026 pcSPS->setMaxDecPicBuffering(pcSPS->getMaxDecPicBuffering(0), i); 981 1027 pcSPS->setNumReorderPics(pcSPS->getNumReorderPics(0), i); 1028 #if NH_MV 1029 pcSPS->setSpsMaxLatencyIncreasePlus1(pcSPS->getSpsMaxLatencyIncreasePlus1(0), i); 1030 #else 982 1031 pcSPS->setMaxLatencyIncrease(pcSPS->getMaxLatencyIncrease(0), i); 1032 #endif 983 1033 } 984 1034 break; … … 1053 1103 1054 1104 READ_UVLC( uiCode, "num_short_term_ref_pic_sets" ); 1105 1055 1106 assert(uiCode <= 64); 1107 #if NH_MV 1108 pcSPS->setNumShortTermRefPicSets( uiCode ); 1109 pcSPS->initStRefPicSets(); 1110 1111 for(Int i=0; i< pcSPS->getNumShortTermRefPicSets(); i++ ) 1112 { 1113 parseShortTermRefPicSet(pcSPS,pcSPS->getStRefPicSet(i),i); 1114 } 1115 1116 READ_FLAG( uiCode, "long_term_ref_pics_present_flag" ); pcSPS->setLongTermRefPicsPresentFlag(uiCode); 1117 if (pcSPS->getLongTermRefPicsPresentFlag() ) 1118 #else 1056 1119 pcSPS->createRPSList(uiCode); 1057 1120 … … 1064 1127 parseShortTermRefPicSet(pcSPS,rps,i); 1065 1128 } 1129 1066 1130 READ_FLAG( uiCode, "long_term_ref_pics_present_flag" ); pcSPS->setLongTermRefsPresent(uiCode); 1067 1131 if (pcSPS->getLongTermRefsPresent()) 1132 #endif 1068 1133 { 1069 1134 READ_UVLC( uiCode, "num_long_term_ref_pics_sps" ); … … 2149 2214 #endif 2150 2215 2216 #if NH_MV 2217 Void TDecCavlc::parseFirstSliceSegmentInPicFlag(TComSlice* pcSlice ) 2218 { 2219 #if ENC_DEC_TRACE 2220 #if NH_MV 2221 tracePSHeader( "Slice", pcSlice->getLayerId() ); 2222 #else 2223 xTraceSliceHeader(); 2224 #endif 2225 #endif 2226 2227 UInt uiCode; 2228 READ_FLAG( uiCode, "first_slice_segment_in_pic_flag" ); 2229 pcSlice->setFirstSliceSegementInPicFlag( uiCode ); 2230 } 2231 2232 Void TDecCavlc::parseSliceHeader (TComSlice* pcSlice, ParameterSetManager *parameterSetManager ) 2233 #else 2151 2234 Void TDecCavlc::parseSliceHeader (TComSlice* pcSlice, ParameterSetManager *parameterSetManager, const Int prevTid0POC) 2235 #endif 2152 2236 { 2153 2237 UInt uiCode; 2154 2238 Int iCode; 2155 2239 2240 #if !NH_MV 2156 2241 #if ENC_DEC_TRACE 2157 #if NH_MV2158 tracePSHeader( "Slice", pcSlice->getLayerId() );2159 #else2160 2242 xTraceSliceHeader(); 2161 2243 #endif … … 2167 2249 #endif 2168 2250 2251 #if NH_MV 2252 // This has been parsed before in parseFirstSliceSegmentFlag(TComSlice* pcSlice ) 2253 UInt firstSliceSegmentInPic = pcSlice->getFirstSliceSegementInPicFlag(); 2254 #else 2169 2255 UInt firstSliceSegmentInPic; 2170 2256 READ_FLAG( firstSliceSegmentInPic, "first_slice_segment_in_pic_flag" ); 2257 #endif 2171 2258 if( pcSlice->getRapPicFlag()) 2172 2259 { … … 2184 2271 vps = parameterSetManager->getVPS(sps->getVPSId()); 2185 2272 assert( vps != NULL ); 2273 2186 2274 m_decTop->initFromActiveVps( vps ); 2275 2276 if ( !m_decTop->getIsInOwnTargetDecLayerIdList() ) 2277 { 2278 return; 2279 } 2280 2281 pcSlice->setDecodingProcess( m_decTop->getDecodingProcess() ); 2187 2282 Int targetOlsIdx = m_decTop->getTargetOlsIdx(); 2188 2283 … … 2241 2336 pcSlice->setSliceSegmentCurStartCtuTsAddr( sliceSegmentAddress );// this is actually a Raster-Scan (RS) address, but we do not have the RS->TS conversion table defined yet. 2242 2337 pcSlice->setSliceSegmentCurEndCtuTsAddr(numCTUs); // Set end as the last CTU of the picture. 2243 2244 #if NH_MV2245 UInt slicePicOrderCntLsb = 0;2246 #endif2247 2338 2248 2339 … … 2303 2394 2304 2395 #if NH_MV 2305 Int iPOClsb = slicePicOrderCntLsb; // Needed later2306 2396 if ( (pcSlice->getLayerId() > 0 && !vps->getPocLsbNotPresentFlag( pcSlice->getLayerIdInVps())) || !pcSlice->getIdrPicFlag() ) 2307 2397 { 2308 READ_CODE(sps->getBitsForPOC(), slicePicOrderCntLsb, "slice_pic_order_cnt_lsb"); 2309 } 2310 pcSlice->setSlicePicOrderCntLsb( slicePicOrderCntLsb ); 2311 2312 Bool picOrderCntMSBZeroFlag = false; 2313 2314 // as in HM code. However are all cases for IRAP picture with NoRaslOutputFlag equal to 1 covered?? 2315 picOrderCntMSBZeroFlag = picOrderCntMSBZeroFlag || ( pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP ); 2316 picOrderCntMSBZeroFlag = picOrderCntMSBZeroFlag || ( pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL ); 2317 picOrderCntMSBZeroFlag = picOrderCntMSBZeroFlag || ( pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ); 2318 picOrderCntMSBZeroFlag = picOrderCntMSBZeroFlag || pcSlice->getIdrPicFlag(); 2319 2320 // TBD picOrderCntMSBZeroFlag = picOrderCntMSBZeroFlag || ( rpcSlice->getLayerId() > 0 && !rpcSlice->getFirstPicInLayerDecodedFlag() ); 2321 2322 Int picOrderCntMSB = 0; 2323 2324 if ( !picOrderCntMSBZeroFlag ) 2325 { 2326 Int prevPicOrderCnt = prevTid0POC; 2327 Int maxPicOrderCntLsb = 1 << sps->getBitsForPOC(); 2328 Int prevPicOrderCntLsb = prevPicOrderCnt & (maxPicOrderCntLsb - 1); 2329 Int prevPicOrderCntMsb = prevPicOrderCnt - prevPicOrderCntLsb; 2330 2331 if( ( slicePicOrderCntLsb < prevPicOrderCntLsb ) && ( ( prevPicOrderCntLsb - slicePicOrderCntLsb ) >= ( maxPicOrderCntLsb / 2 ) ) ) 2332 { 2333 picOrderCntMSB = prevPicOrderCntMsb + maxPicOrderCntLsb; 2334 } 2335 else if( (slicePicOrderCntLsb > prevPicOrderCntLsb ) && ( (slicePicOrderCntLsb - prevPicOrderCntLsb ) > ( maxPicOrderCntLsb / 2 ) ) ) 2336 { 2337 picOrderCntMSB = prevPicOrderCntMsb - maxPicOrderCntLsb; 2338 } 2339 else 2340 { 2341 picOrderCntMSB = prevPicOrderCntMsb; 2342 } 2343 } 2344 2345 pcSlice->setPOC( picOrderCntMSB + slicePicOrderCntLsb ); 2346 if ( pcSlice->getPocResetFlag() ) 2347 { 2348 pcSlice->setPocBeforeReset ( pcSlice->getPOC() ); 2349 pcSlice->setPOC ( 0 ); 2350 } 2351 #endif 2352 2353 if( pcSlice->getIdrPicFlag() ) 2354 { 2355 #if !NH_MV 2356 pcSlice->setPOC(0); 2357 #endif 2358 TComReferencePictureSet* rps = pcSlice->getLocalRPS(); 2359 (*rps)=TComReferencePictureSet(); 2360 pcSlice->setRPS(rps); 2361 #if NH_MV 2362 pcSlice->setEnableTMVPFlag(false); 2363 #endif 2364 } 2398 READ_CODE(sps->getBitsForPOC(), uiCode, "slice_pic_order_cnt_lsb"); pcSlice->setSlicePicOrderCntLsb( uiCode ); 2399 } 2365 2400 else 2366 2401 { 2367 #if !NH_MV 2368 READ_CODE(sps->getBitsForPOC(), uiCode, "slice_pic_order_cnt_lsb"); 2369 Int iPOClsb = uiCode; 2370 Int iPrevPOC = prevTid0POC; 2371 Int iMaxPOClsb = 1<< sps->getBitsForPOC(); 2372 Int iPrevPOClsb = iPrevPOC & (iMaxPOClsb - 1); 2373 Int iPrevPOCmsb = iPrevPOC-iPrevPOClsb; 2374 Int iPOCmsb; 2375 if( ( iPOClsb < iPrevPOClsb ) && ( ( iPrevPOClsb - iPOClsb ) >= ( iMaxPOClsb / 2 ) ) ) 2376 { 2377 iPOCmsb = iPrevPOCmsb + iMaxPOClsb; 2378 } 2379 else if( (iPOClsb > iPrevPOClsb ) && ( (iPOClsb - iPrevPOClsb ) > ( iMaxPOClsb / 2 ) ) ) 2380 { 2381 iPOCmsb = iPrevPOCmsb - iMaxPOClsb; 2382 } 2383 else 2384 { 2385 iPOCmsb = iPrevPOCmsb; 2386 } 2387 if ( pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 2388 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL 2389 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) 2390 { 2391 // For BLA picture types, POCmsb is set to 0. 2392 iPOCmsb = 0; 2393 } 2394 pcSlice->setPOC (iPOCmsb+iPOClsb); 2395 #endif 2396 TComReferencePictureSet* rps; 2397 rps = pcSlice->getLocalRPS(); 2398 (*rps)=TComReferencePictureSet(); 2399 2400 pcSlice->setRPS(rps); 2401 READ_FLAG( uiCode, "short_term_ref_pic_set_sps_flag" ); 2402 if(uiCode == 0) // use short-term reference picture set explicitly signalled in slice header 2403 { 2404 parseShortTermRefPicSet(sps,rps, sps->getRPSList()->getNumberOfReferencePictureSets()); 2405 #if NH_MV 2406 if ( !rps->getInterRPSPrediction( ) ) 2407 { // check sum of num_positive_pics and num_negative_pics 2408 rps->checkMaxNumPics( 2409 vps->getVpsExtensionFlag(), 2410 MAX_INT, // To be replaced by MaxDbpSize 2411 pcSlice->getLayerId(), 2412 sps->getMaxDecPicBuffering( sps->getSpsMaxSubLayersMinus1() ) - 1 ); 2413 } 2414 #endif 2415 2416 } 2417 else // use reference to short-term reference picture set in PPS 2418 { 2419 Int numBits = 0; 2420 while ((1 << numBits) < sps->getRPSList()->getNumberOfReferencePictureSets()) 2421 { 2422 numBits++; 2423 } 2424 if (numBits > 0) 2425 { 2426 READ_CODE( numBits, uiCode, "short_term_ref_pic_set_idx"); 2427 } 2428 else 2429 { 2430 uiCode = 0; 2431 2432 } 2433 *rps = *(sps->getRPSList()->getReferencePictureSet(uiCode)); 2434 } 2435 if(sps->getLongTermRefsPresent()) 2436 { 2437 Int offset = rps->getNumberOfNegativePictures()+rps->getNumberOfPositivePictures(); 2438 UInt numOfLtrp = 0; 2439 UInt numLtrpInSPS = 0; 2440 if (sps->getNumLongTermRefPicSPS() > 0) 2441 { 2442 READ_UVLC( uiCode, "num_long_term_sps"); 2443 numLtrpInSPS = uiCode; 2444 numOfLtrp += numLtrpInSPS; 2445 rps->setNumberOfLongtermPictures(numOfLtrp); 2446 } 2447 Int bitsForLtrpInSPS = 0; 2448 while (sps->getNumLongTermRefPicSPS() > (1 << bitsForLtrpInSPS)) 2449 { 2450 bitsForLtrpInSPS++; 2451 } 2452 READ_UVLC( uiCode, "num_long_term_pics"); rps->setNumberOfLongtermPictures(uiCode); 2453 numOfLtrp += uiCode; 2454 rps->setNumberOfLongtermPictures(numOfLtrp); 2455 Int maxPicOrderCntLSB = 1 << sps->getBitsForPOC(); 2456 Int prevDeltaMSB = 0, deltaPocMSBCycleLT = 0; 2457 for(Int j=offset+rps->getNumberOfLongtermPictures()-1, k = 0; k < numOfLtrp; j--, k++) 2458 { 2459 Int pocLsbLt; 2460 if (k < numLtrpInSPS) 2402 pcSlice->setSlicePicOrderCntLsb( 0 ); 2403 } 2404 2405 if( pcSlice->getNalUnitType() != NAL_UNIT_CODED_SLICE_IDR_W_RADL && pcSlice->getNalUnitType() != NAL_UNIT_CODED_SLICE_IDR_N_LP ) 2406 { 2407 READ_FLAG( uiCode, "short_term_ref_pic_set_sps_flag" ); pcSlice->setShortTermRefPicSetSpsFlag( uiCode == 1 ); 2408 if( !pcSlice->getShortTermRefPicSetSpsFlag() ) 2409 { 2410 parseShortTermRefPicSet( sps, pcSlice->getLocalStRps( ), sps->getNumShortTermRefPicSets() ); 2411 } 2412 else if( sps->getNumShortTermRefPicSets() > 1 ) 2413 { 2414 READ_CODE( pcSlice->getShortTermRefPicSetIdxLen() , uiCode, "short_term_ref_pic_set_idx" ); pcSlice->setShortTermRefPicSetIdx( uiCode ); 2415 } 2416 if( sps->getLongTermRefPicsPresentFlag() ) 2417 { 2418 if( sps->getNumLongTermRefPicsSps() > 0 ) 2419 { 2420 READ_UVLC( uiCode, "num_long_term_sps" ); pcSlice->setNumLongTermSps( uiCode ); 2421 } 2422 READ_UVLC( uiCode, "num_long_term_pics" ); pcSlice->setNumLongTermPics( uiCode ); 2423 for( Int i = 0; i < pcSlice->getNumLongTermSps() + pcSlice->getNumLongTermPics( ); i++ ) 2424 { 2425 if( i < pcSlice->getNumLongTermSps() ) 2461 2426 { 2462 uiCode = 0; 2463 if (bitsForLtrpInSPS > 0) 2427 if( sps->getNumLongTermRefPicsSps() > 1 ) 2464 2428 { 2465 READ_CODE( bitsForLtrpInSPS, uiCode, "lt_idx_sps[i]");2429 READ_CODE( pcSlice->getLtIdxSpsLen() , uiCode, "lt_idx_sps" ); pcSlice->setLtIdxSps( i, uiCode ); 2466 2430 } 2467 Bool usedByCurrFromSPS=sps->getUsedByCurrPicLtSPSFlag(uiCode);2468 2469 pocLsbLt = sps->getLtRefPicPocLsbSps(uiCode);2470 rps->setUsed(j,usedByCurrFromSPS);2471 2431 } 2472 2432 else 2473 2433 { 2474 READ_CODE( sps->getBitsForPOC(), uiCode, "poc_lsb_lt"); pocLsbLt= uiCode;2475 READ_FLAG( uiCode, "used_by_curr_pic_lt_flag" ); rps->setUsed(j,uiCode);2434 READ_CODE( pcSlice->getPocLsbLtLen() , uiCode, "poc_lsb_lt" ); pcSlice->setPocLsbLt( i, uiCode ); 2435 READ_FLAG( uiCode, "used_by_curr_pic_lt_flag" ); pcSlice->setUsedByCurrPicLtFlag( i, uiCode == 1 ); 2476 2436 } 2477 READ_FLAG(uiCode,"delta_poc_msb_present_flag"); 2478 Bool mSBPresentFlag = uiCode ? true : false; 2479 if(mSBPresentFlag) 2437 READ_FLAG( uiCode, "delta_poc_msb_present_flag" ); pcSlice->setDeltaPocMsbPresentFlag( i, uiCode == 1 ); 2438 if( pcSlice->getDeltaPocMsbPresentFlag( i ) ) 2480 2439 { 2481 READ_UVLC( uiCode, "delta_poc_msb_cycle_lt[i]" ); 2482 Bool deltaFlag = false; 2483 // First LTRP || First LTRP from SH 2484 if( (j == offset+rps->getNumberOfLongtermPictures()-1) || (j == offset+(numOfLtrp-numLtrpInSPS)-1) ) 2485 { 2486 deltaFlag = true; 2487 } 2488 if(deltaFlag) 2489 { 2490 deltaPocMSBCycleLT = uiCode; 2491 } 2492 else 2493 { 2494 deltaPocMSBCycleLT = uiCode + prevDeltaMSB; 2495 } 2496 2497 Int pocLTCurr = pcSlice->getPOC() - deltaPocMSBCycleLT * maxPicOrderCntLSB 2498 - iPOClsb + pocLsbLt; 2499 rps->setPOC (j, pocLTCurr); 2500 rps->setDeltaPOC(j, - pcSlice->getPOC() + pocLTCurr); 2501 rps->setCheckLTMSBPresent(j,true); 2440 READ_UVLC( uiCode, "delta_poc_msb_cycle_lt" ); pcSlice->setDeltaPocMsbCycleLt( i, uiCode ); 2502 2441 } 2503 else 2504 { 2442 } 2443 } 2444 if( sps->getSpsTemporalMvpEnabledFlag() ) 2445 { 2446 READ_FLAG( uiCode, "slice_temporal_mvp_enabled_flag" ); pcSlice->setSliceTemporalMvpEnabledFlag( uiCode == 1 ); 2447 } 2448 } 2449 #else 2450 if( pcSlice->getIdrPicFlag() ) 2451 { 2452 pcSlice->setPOC(0); 2453 TComReferencePictureSet* rps = pcSlice->getLocalRPS(); 2454 (*rps)=TComReferencePictureSet(); 2455 pcSlice->setRPS(rps); 2456 } 2457 else 2458 { 2459 READ_CODE(sps->getBitsForPOC(), uiCode, "slice_pic_order_cnt_lsb"); 2460 Int iPOClsb = uiCode; 2461 Int iPrevPOC = prevTid0POC; 2462 Int iMaxPOClsb = 1<< sps->getBitsForPOC(); 2463 Int iPrevPOClsb = iPrevPOC & (iMaxPOClsb - 1); 2464 Int iPrevPOCmsb = iPrevPOC-iPrevPOClsb; 2465 Int iPOCmsb; 2466 if( ( iPOClsb < iPrevPOClsb ) && ( ( iPrevPOClsb - iPOClsb ) >= ( iMaxPOClsb / 2 ) ) ) 2467 { 2468 iPOCmsb = iPrevPOCmsb + iMaxPOClsb; 2469 } 2470 else if( (iPOClsb > iPrevPOClsb ) && ( (iPOClsb - iPrevPOClsb ) > ( iMaxPOClsb / 2 ) ) ) 2471 { 2472 iPOCmsb = iPrevPOCmsb - iMaxPOClsb; 2473 } 2474 else 2475 { 2476 iPOCmsb = iPrevPOCmsb; 2477 } 2478 if ( pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 2479 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL 2480 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) 2481 { 2482 // For BLA picture types, POCmsb is set to 0. 2483 iPOCmsb = 0; 2484 } 2485 pcSlice->setPOC (iPOCmsb+iPOClsb); 2486 2487 TComReferencePictureSet* rps; 2488 rps = pcSlice->getLocalRPS(); 2489 (*rps)=TComReferencePictureSet(); 2490 2491 pcSlice->setRPS(rps); 2492 READ_FLAG( uiCode, "short_term_ref_pic_set_sps_flag" ); 2493 if(uiCode == 0) // use short-term reference picture set explicitly signalled in slice header 2494 { 2495 parseShortTermRefPicSet(sps,rps, sps->getRPSList()->getNumberOfReferencePictureSets()); 2496 } 2497 else // use reference to short-term reference picture set in PPS 2498 { 2499 Int numBits = 0; 2500 while ((1 << numBits) < sps->getRPSList()->getNumberOfReferencePictureSets()) 2501 { 2502 numBits++; 2503 } 2504 if (numBits > 0) 2505 { 2506 READ_CODE( numBits, uiCode, "short_term_ref_pic_set_idx"); 2507 } 2508 else 2509 { 2510 uiCode = 0; 2511 } 2512 *rps = *(sps->getRPSList()->getReferencePictureSet(uiCode)); 2513 } 2514 if(sps->getLongTermRefsPresent()) 2515 { 2516 Int offset = rps->getNumberOfNegativePictures()+rps->getNumberOfPositivePictures(); 2517 UInt numOfLtrp = 0; 2518 UInt numLtrpInSPS = 0; 2519 if (sps->getNumLongTermRefPicSPS() > 0) 2520 { 2521 READ_UVLC( uiCode, "num_long_term_sps"); 2522 numLtrpInSPS = uiCode; 2523 numOfLtrp += numLtrpInSPS; 2524 rps->setNumberOfLongtermPictures(numOfLtrp); 2525 } 2526 Int bitsForLtrpInSPS = 0; 2527 while (sps->getNumLongTermRefPicSPS() > (1 << bitsForLtrpInSPS)) 2528 { 2529 bitsForLtrpInSPS++; 2530 } 2531 READ_UVLC( uiCode, "num_long_term_pics"); rps->setNumberOfLongtermPictures(uiCode); 2532 numOfLtrp += uiCode; 2533 rps->setNumberOfLongtermPictures(numOfLtrp); 2534 Int maxPicOrderCntLSB = 1 << sps->getBitsForPOC(); 2535 Int prevDeltaMSB = 0, deltaPocMSBCycleLT = 0; 2536 for(Int j=offset+rps->getNumberOfLongtermPictures()-1, k = 0; k < numOfLtrp; j--, k++) 2537 { 2538 Int pocLsbLt; 2539 if (k < numLtrpInSPS) 2540 { 2541 uiCode = 0; 2542 if (bitsForLtrpInSPS > 0) 2543 { 2544 READ_CODE(bitsForLtrpInSPS, uiCode, "lt_idx_sps[i]"); 2545 } 2546 Bool usedByCurrFromSPS=sps->getUsedByCurrPicLtSPSFlag(uiCode); 2547 2548 pocLsbLt = sps->getLtRefPicPocLsbSps(uiCode); 2549 rps->setUsed(j,usedByCurrFromSPS); 2550 } 2551 else 2552 { 2553 READ_CODE(sps->getBitsForPOC(), uiCode, "poc_lsb_lt"); pocLsbLt= uiCode; 2554 READ_FLAG( uiCode, "used_by_curr_pic_lt_flag"); rps->setUsed(j,uiCode); 2555 } 2556 READ_FLAG(uiCode,"delta_poc_msb_present_flag"); 2557 Bool mSBPresentFlag = uiCode ? true : false; 2558 if(mSBPresentFlag) 2559 { 2560 READ_UVLC( uiCode, "delta_poc_msb_cycle_lt[i]" ); 2561 Bool deltaFlag = false; 2562 // First LTRP || First LTRP from SH 2563 if( (j == offset+rps->getNumberOfLongtermPictures()-1) || (j == offset+(numOfLtrp-numLtrpInSPS)-1) ) 2564 { 2565 deltaFlag = true; 2566 } 2567 if(deltaFlag) 2568 { 2569 deltaPocMSBCycleLT = uiCode; 2570 } 2571 else 2572 { 2573 deltaPocMSBCycleLT = uiCode + prevDeltaMSB; 2574 } 2575 2576 Int pocLTCurr = pcSlice->getPOC() - deltaPocMSBCycleLT * maxPicOrderCntLSB 2577 - iPOClsb + pocLsbLt; 2578 rps->setPOC (j, pocLTCurr); 2579 rps->setDeltaPOC(j, - pcSlice->getPOC() + pocLTCurr); 2580 rps->setCheckLTMSBPresent(j,true); 2581 } 2582 else 2583 { 2505 2584 rps->setPOC (j, pocLsbLt); 2506 2585 rps->setDeltaPOC(j, - pcSlice->getPOC() + pocLsbLt); 2507 rps->setCheckLTMSBPresent(j,false); 2508 2509 // reset deltaPocMSBCycleLT for first LTRP from slice header if MSB not present 2510 if( j == offset+(numOfLtrp-numLtrpInSPS)-1 ) 2511 { 2512 deltaPocMSBCycleLT = 0; 2513 } 2514 } 2515 prevDeltaMSB = deltaPocMSBCycleLT; 2516 } 2517 offset += rps->getNumberOfLongtermPictures(); 2518 rps->setNumberOfPictures(offset); 2519 } 2520 #if NH_MV 2521 if ( !rps->getInterRPSPrediction( ) ) 2522 { // check sum of NumPositivePics, NumNegativePics, num_long_term_sps and num_long_term_pics 2523 rps->checkMaxNumPics( 2524 vps->getVpsExtensionFlag(), 2525 MAX_INT, // To be replaced by MaxDbpsize 2526 pcSlice->getLayerId(), 2527 sps->getMaxDecPicBuffering( sps->getSpsMaxSubLayersMinus1() ) - 1 ); 2528 } 2529 #endif 2530 2531 if ( pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 2532 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL 2533 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) 2534 { 2535 // In the case of BLA picture types, rps data is read from slice header but ignored 2536 rps = pcSlice->getLocalRPS(); 2537 (*rps)=TComReferencePictureSet(); 2538 pcSlice->setRPS(rps); 2539 } 2540 if (sps->getTMVPFlagsPresent()) 2541 { 2542 #if NH_MV 2543 READ_FLAG( uiCode, "slice_temporal_mvp_enabled_flag" ); 2544 #else 2545 READ_FLAG( uiCode, "slice_temporal_mvp_enabled_flag" ); 2546 #endif 2547 pcSlice->setEnableTMVPFlag( uiCode == 1 ? true : false ); 2548 } 2549 else 2550 { 2551 pcSlice->setEnableTMVPFlag(false); 2552 } 2553 } 2586 rps->setCheckLTMSBPresent(j,false); 2587 2588 // reset deltaPocMSBCycleLT for first LTRP from slice header if MSB not present 2589 if( j == offset+(numOfLtrp-numLtrpInSPS)-1 ) 2590 { 2591 deltaPocMSBCycleLT = 0; 2592 } 2593 } 2594 prevDeltaMSB = deltaPocMSBCycleLT; 2595 } 2596 offset += rps->getNumberOfLongtermPictures(); 2597 rps->setNumberOfPictures(offset); 2598 } 2599 2600 if ( pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 2601 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL 2602 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) 2603 { 2604 // In the case of BLA picture types, rps data is read from slice header but ignored 2605 rps = pcSlice->getLocalRPS(); 2606 (*rps)=TComReferencePictureSet(); 2607 pcSlice->setRPS(rps); 2608 } 2609 if (sps->getTMVPFlagsPresent()) 2610 { 2611 READ_FLAG( uiCode, "slice_temporal_mvp_enabled_flag" ); 2612 pcSlice->setEnableTMVPFlag( uiCode == 1 ? true : false ); 2613 } 2614 else 2615 { 2616 pcSlice->setEnableTMVPFlag(false); 2617 } 2618 } 2619 #endif 2620 2554 2621 #if NH_MV 2555 2622 Bool interLayerPredLayerIdcPresentFlag = false; … … 2649 2716 } 2650 2717 // } 2718 #if NH_MV 2719 2720 const Int numPicTotalCurr = pcSlice->getNumPicTotalCurr(); 2721 if( pcSlice->getSliceType() == P_SLICE || pcSlice->getSliceType() == B_SLICE ) 2722 { 2723 if( pps->getListsModificationPresentFlag() && numPicTotalCurr > 1 ) 2724 { 2725 TComRefPicListModification* rplMod = pcSlice->getRefPicListModification(); 2726 READ_FLAG( uiCode, "ref_pic_list_modification_flag_l0" ); rplMod->setRefPicListModificationFlagL0( uiCode == 1 ); 2727 if( rplMod->getRefPicListModificationFlagL0() ) 2728 { 2729 for( Int i = 0; i <= pcSlice->getNumRefIdxL0ActiveMinus1( ); i++ ) 2730 { 2731 READ_CODE( rplMod->getListEntryLXLen( numPicTotalCurr ) , uiCode, "list_entry_l0" ); rplMod->setListEntryL0( i, uiCode ); 2732 } 2733 } 2734 2735 if( pcSlice->getSliceType() == B_SLICE ) 2736 { 2737 READ_FLAG( uiCode, "ref_pic_list_modification_flag_l1" ); rplMod->setRefPicListModificationFlagL1( uiCode == 1 ); 2738 if( rplMod->getRefPicListModificationFlagL1() ) 2739 { 2740 for( Int i = 0; i <= pcSlice->getNumRefIdxL1ActiveMinus1( ); i++ ) 2741 { 2742 READ_CODE( rplMod->getListEntryLXLen( numPicTotalCurr ), uiCode, "list_entry_l1" ); rplMod->setListEntryL1( i, uiCode ); 2743 } 2744 } 2745 } 2746 } 2747 } 2748 #else 2651 2749 TComRefPicListModification* refPicListModification = pcSlice->getRefPicListModification(); 2652 2750 if(!pcSlice->isIntra()) … … 2735 2833 refPicListModification->setRefPicListModificationFlagL1(0); 2736 2834 } 2835 #endif 2836 2737 2837 if (pcSlice->isInterB()) 2738 2838 { … … 2898 2998 { 2899 2999 Int voiInVps = vps->getVoiInVps( pcSlice->getViewIndex() ); 2900 #if NH_3D_FIX_TICKET_1012901 3000 if( vps->getCpInSliceSegmentHeaderFlag( voiInVps ) ) 2902 #else2903 if( vps->getCpInSliceSegmentHeaderFlag( voiInVps ) && !pcSlice->getIsDepth() )2904 #endif2905 3001 { 2906 3002 for( Int m = 0; m < vps->getNumCp( voiInVps ); m++ ) … … 2952 3048 pcSlice->checkPocResetIdc(); 2953 3049 3050 #if NH_MV 3051 if ( pcSlice->getVPS()->getPocLsbNotPresentFlag(pcSlice->getLayerId()) && pcSlice->getSlicePicOrderCntLsb() > 0 ) 3052 #else 2954 3053 if ( pcSlice->getVPS()->getPocLsbNotPresentFlag(pcSlice->getLayerId()) && slicePicOrderCntLsb > 0 ) 3054 #endif 2955 3055 { 2956 3056 assert( pcSlice->getPocResetIdc() != 2 ); … … 2959 3059 if( pcSlice->getPocResetIdc() != 0 ) 2960 3060 { 2961 READ_CODE( 6, uiCode, "poc_reset_period_id" ); pcSlice->setPocResetPeriodId( uiCode ); 3061 READ_CODE( 6, uiCode, "poc_reset_period_id" ); pcSlice->setPocResetPeriodId( uiCode ); 3062 pcSlice->setHasPocResetPeriodIdPresent( true ); 2962 3063 } 2963 3064 else 2964 3065 { 2965 3066 // TODO Copy poc_reset_period from earlier picture 3067 #if NH_MV 3068 pcSlice->setHasPocResetPeriodIdPresent( false); 3069 #else 2966 3070 pcSlice->setPocResetPeriodId( 0 ); 3071 #endif 2967 3072 } 2968 3073 … … 2972 3077 READ_CODE( pcSlice->getPocLsbValLen() , uiCode, "poc_lsb_val" ); pcSlice->setPocLsbVal( uiCode ); 2973 3078 } 2974 pcSlice->checkPocLsbVal(); 2975 2976 // Derive the value of PocMs8bValRequiredFlag 3079 pcSlice->checkPocLsbVal(); 2977 3080 2978 3081 if( !pcSlice->getPocMsbValRequiredFlag() && pcSlice->getVPS()->getVpsPocLsbAlignedFlag() ) 2979 3082 { 3083 #if NH_MV 3084 READ_FLAG( uiCode, "poc_msb_cycle_val_present_flag" ); pcSlice->setPocMsbCycleValPresentFlag( uiCode == 1 ); 3085 #else 2980 3086 READ_FLAG( uiCode, "poc_msb_val_present_flag" ); pcSlice->setPocMsbValPresentFlag( uiCode == 1 ); 3087 #endif 2981 3088 } 2982 3089 else 2983 3090 { 3091 #if NH_MV 3092 pcSlice->setPocMsbCycleValPresentFlag( pcSlice->inferPocMsbCycleValPresentFlag( ) ); 3093 #else 2984 3094 pcSlice->setPocMsbValPresentFlag( pcSlice->inferPocMsbValPresentFlag( ) ); 3095 #endif 2985 3096 } 2986 3097 2987 3098 3099 #if NH_MV 3100 if( pcSlice->getPocMsbCycleValPresentFlag() ) 3101 #else 2988 3102 if( pcSlice->getPocMsbValPresentFlag() ) 2989 { 3103 #endif 3104 { 3105 #if NH_MV 3106 READ_UVLC( uiCode, "poc_msb_val" ); pcSlice->setPocMsbCycleVal( uiCode ); 3107 #else 2990 3108 READ_UVLC( uiCode, "poc_msb_val" ); pcSlice->setPocMsbVal( uiCode ); 3109 #endif 2991 3110 } 2992 3111
Note: See TracChangeset for help on using the changeset viewer.