Ignore:
Timestamp:
4 Sep 2015, 21:28:58 (9 years ago)
Author:
tech
Message:

Clean-ups. HLS.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-15.0-dev0/source/Lib/TLibDecoder/TDecCAVLC.cpp

    r1313 r1317  
    6666  fprintf( g_hTrace, "=========== Picture Parameter Set  ===========\n");
    6767}
     68
     69Void  xTraceSliceHeader ()
     70{
     71  fprintf( g_hTrace, "=========== Slice ===========\n");
     72}
     73
    6874#endif
    6975#endif
     
    8591// ====================================================================================================================
    8692
     93#if NH_MV
     94Void 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
    87136Void TDecCavlc::parseShortTermRefPicSet( TComSPS* sps, TComReferencePictureSet* rps, Int idx )
    88137{
     
    180229#endif
    181230}
     231#endif
    182232
    183233Void TDecCavlc::parsePPS(TComPPS* pcPPS)
     
    507557  {
    508558    READ_CODE(6, uiCode, "pps_depth_layers_minus1");
    509 #if NH_3D_VER141_DEC_COMP_FLAG
    510     pcDLT->setNumDepthViews( uiCode );
    511 #else
    512559    pcDLT->setNumDepthViews( uiCode+1 );
    513 #endif
    514560   
    515561    READ_CODE(4, uiCode, "pps_bit_depth_for_depth_layers_minus8");
    516562    pcDLT->setDepthViewBitDepth( (uiCode+8) );
    517563   
    518 #if NH_3D_DLT_FIX
    519564    for( Int i = 0; i <= pcDLT->getNumDepthViews()-1; i++ )
    520 #else
    521     for( Int i = 0; i <= pcDLT->getNumDepthViews(); i++ )
    522 #endif
    523565    {
    524566      Int layerId = pcDLT->getDepthIdxToLayerId(i);
     
    866908#if NH_MV
    867909    pcSPS->getPTL()->inferGeneralValues ( true, 0, NULL );
    868     pcSPS->getPTL()->inferSubLayerValues( pcSPS->getMaxTLayers() - 1, 0, NULL );
     910    pcSPS->getPTL()->inferSubLayerValues( pcSPS->getSpsMaxSubLayersMinus1(), 0, NULL );
    869911  }
    870912#endif
     
    9721014    pcSPS->setNumReorderPics(uiCode, i);
    9731015    READ_UVLC ( uiCode, "sps_max_latency_increase_plus1[i]");
     1016#if NH_MV
     1017    pcSPS->setSpsMaxLatencyIncreasePlus1( uiCode, i );
     1018#else
    9741019    pcSPS->setMaxLatencyIncrease( uiCode, i );
     1020#endif
    9751021
    9761022    if (!subLayerOrderingInfoPresentFlag)
     
    9801026        pcSPS->setMaxDecPicBuffering(pcSPS->getMaxDecPicBuffering(0), i);
    9811027        pcSPS->setNumReorderPics(pcSPS->getNumReorderPics(0), i);
     1028#if NH_MV
     1029        pcSPS->setSpsMaxLatencyIncreasePlus1(pcSPS->getSpsMaxLatencyIncreasePlus1(0), i);
     1030#else
    9821031        pcSPS->setMaxLatencyIncrease(pcSPS->getMaxLatencyIncrease(0), i);
     1032#endif
    9831033      }
    9841034      break;
     
    10531103
    10541104  READ_UVLC( uiCode, "num_short_term_ref_pic_sets" );
     1105
    10551106  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
    10561119  pcSPS->createRPSList(uiCode);
    10571120
     
    10641127    parseShortTermRefPicSet(pcSPS,rps,i);
    10651128  }
     1129
    10661130  READ_FLAG( uiCode, "long_term_ref_pics_present_flag" );          pcSPS->setLongTermRefsPresent(uiCode);
    10671131  if (pcSPS->getLongTermRefsPresent())
     1132#endif
    10681133  {
    10691134    READ_UVLC( uiCode, "num_long_term_ref_pics_sps" );
     
    21492214#endif
    21502215
     2216#if NH_MV
     2217Void 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
     2232Void TDecCavlc::parseSliceHeader (TComSlice* pcSlice, ParameterSetManager *parameterSetManager )
     2233#else
    21512234Void TDecCavlc::parseSliceHeader (TComSlice* pcSlice, ParameterSetManager *parameterSetManager, const Int prevTid0POC)
     2235#endif
    21522236{
    21532237  UInt  uiCode;
    21542238  Int   iCode;
    21552239
     2240#if !NH_MV
    21562241#if ENC_DEC_TRACE
    2157 #if NH_MV
    2158   tracePSHeader( "Slice", pcSlice->getLayerId() );
    2159 #else
    21602242  xTraceSliceHeader();
    21612243#endif
     
    21672249#endif
    21682250
     2251#if NH_MV
     2252  // This has been parsed before in parseFirstSliceSegmentFlag(TComSlice* pcSlice )
     2253  UInt firstSliceSegmentInPic = pcSlice->getFirstSliceSegementInPicFlag();   
     2254#else
    21692255  UInt firstSliceSegmentInPic;
    21702256  READ_FLAG( firstSliceSegmentInPic, "first_slice_segment_in_pic_flag" );
     2257#endif
    21712258  if( pcSlice->getRapPicFlag())
    21722259  {
     
    21842271  vps = parameterSetManager->getVPS(sps->getVPSId());
    21852272  assert( vps != NULL ); 
     2273 
    21862274  m_decTop->initFromActiveVps( vps );
     2275 
     2276  if ( !m_decTop->getIsInOwnTargetDecLayerIdList() )
     2277  {
     2278    return;
     2279  }
     2280
     2281  pcSlice->setDecodingProcess( m_decTop->getDecodingProcess() );
    21872282  Int targetOlsIdx = m_decTop->getTargetOlsIdx();
    21882283
     
    22412336  pcSlice->setSliceSegmentCurStartCtuTsAddr( sliceSegmentAddress );// this is actually a Raster-Scan (RS) address, but we do not have the RS->TS conversion table defined yet.
    22422337  pcSlice->setSliceSegmentCurEndCtuTsAddr(numCTUs);                // Set end as the last CTU of the picture.
    2243 
    2244 #if NH_MV
    2245     UInt slicePicOrderCntLsb = 0;
    2246 #endif
    22472338
    22482339
     
    23032394
    23042395#if NH_MV
    2305     Int iPOClsb = slicePicOrderCntLsb;  // Needed later
    23062396    if ( (pcSlice->getLayerId() > 0 && !vps->getPocLsbNotPresentFlag( pcSlice->getLayerIdInVps())) || !pcSlice->getIdrPicFlag() )
    23072397    {
    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    }
    23652400    else
    23662401    {
    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() )
    24612426          {
    2462             uiCode = 0;
    2463             if (bitsForLtrpInSPS > 0)
     2427            if( sps->getNumLongTermRefPicsSps() > 1 )
    24642428            {
    2465               READ_CODE(bitsForLtrpInSPS, uiCode, "lt_idx_sps[i]");
     2429              READ_CODE( pcSlice->getLtIdxSpsLen() , uiCode, "lt_idx_sps" ); pcSlice->setLtIdxSps( i, uiCode );
    24662430            }
    2467             Bool usedByCurrFromSPS=sps->getUsedByCurrPicLtSPSFlag(uiCode);
    2468 
    2469             pocLsbLt = sps->getLtRefPicPocLsbSps(uiCode);
    2470             rps->setUsed(j,usedByCurrFromSPS);
    24712431          }
    24722432          else
    24732433          {
    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 );
    24762436          }
    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 ) )
    24802439          {
    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 );
    25022441          }
    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
     2450if( pcSlice->getIdrPicFlag() )
     2451{
     2452  pcSlice->setPOC(0);
     2453  TComReferencePictureSet* rps = pcSlice->getLocalRPS();
     2454  (*rps)=TComReferencePictureSet();
     2455  pcSlice->setRPS(rps);
     2456}
     2457else
     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      {
    25052584            rps->setPOC     (j, pocLsbLt);
    25062585            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
    25542621#if NH_MV
    25552622    Bool interLayerPredLayerIdcPresentFlag = false;
     
    26492716    }
    26502717    // }
     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
    26512749    TComRefPicListModification* refPicListModification = pcSlice->getRefPicListModification();
    26522750    if(!pcSlice->isIntra())
     
    27352833      refPicListModification->setRefPicListModificationFlagL1(0);
    27362834    }
     2835#endif
     2836
    27372837    if (pcSlice->isInterB())
    27382838    {
     
    28982998    {
    28992999      Int voiInVps = vps->getVoiInVps( pcSlice->getViewIndex() );
    2900 #if NH_3D_FIX_TICKET_101
    29013000      if( vps->getCpInSliceSegmentHeaderFlag( voiInVps ) )
    2902 #else
    2903       if( vps->getCpInSliceSegmentHeaderFlag( voiInVps ) && !pcSlice->getIsDepth() )
    2904 #endif
    29053001      {
    29063002        for( Int m = 0; m < vps->getNumCp( voiInVps ); m++ )
     
    29523048    pcSlice->checkPocResetIdc();
    29533049
     3050#if NH_MV
     3051    if ( pcSlice->getVPS()->getPocLsbNotPresentFlag(pcSlice->getLayerId()) && pcSlice->getSlicePicOrderCntLsb() > 0 )
     3052#else
    29543053    if ( pcSlice->getVPS()->getPocLsbNotPresentFlag(pcSlice->getLayerId()) && slicePicOrderCntLsb > 0 )
     3054#endif
    29553055    {
    29563056      assert( pcSlice->getPocResetIdc() != 2 );
     
    29593059    if( pcSlice->getPocResetIdc() !=  0 )
    29603060    {
    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 );
    29623063    }
    29633064    else
    29643065    {
    29653066      // TODO Copy poc_reset_period from earlier picture
     3067#if NH_MV
     3068      pcSlice->setHasPocResetPeriodIdPresent( false);
     3069#else
    29663070      pcSlice->setPocResetPeriodId( 0 );
     3071#endif
    29673072    }
    29683073   
     
    29723077      READ_CODE( pcSlice->getPocLsbValLen() , uiCode, "poc_lsb_val" ); pcSlice->setPocLsbVal( uiCode );
    29733078    }         
    2974     pcSlice->checkPocLsbVal();
    2975 
    2976     // Derive the value of PocMs8bValRequiredFlag
     3079    pcSlice->checkPocLsbVal();       
    29773080
    29783081    if( !pcSlice->getPocMsbValRequiredFlag() && pcSlice->getVPS()->getVpsPocLsbAlignedFlag() )
    29793082    {
     3083#if NH_MV
     3084      READ_FLAG( uiCode, "poc_msb_cycle_val_present_flag" ); pcSlice->setPocMsbCycleValPresentFlag( uiCode == 1 );
     3085#else
    29803086      READ_FLAG( uiCode, "poc_msb_val_present_flag" ); pcSlice->setPocMsbValPresentFlag( uiCode == 1 );
     3087#endif
    29813088    }
    29823089    else
    29833090    {
     3091#if NH_MV
     3092      pcSlice->setPocMsbCycleValPresentFlag( pcSlice->inferPocMsbCycleValPresentFlag( ) );
     3093#else
    29843094      pcSlice->setPocMsbValPresentFlag( pcSlice->inferPocMsbValPresentFlag( ) );
     3095#endif
    29853096    }
    29863097
    29873098   
     3099#if NH_MV
     3100    if( pcSlice->getPocMsbCycleValPresentFlag() )
     3101#else
    29883102    if( pcSlice->getPocMsbValPresentFlag() )
    2989     {
     3103#endif
     3104    {
     3105#if NH_MV
     3106      READ_UVLC( uiCode, "poc_msb_val" ); pcSlice->setPocMsbCycleVal( uiCode );
     3107#else
    29903108      READ_UVLC( uiCode, "poc_msb_val" ); pcSlice->setPocMsbVal( uiCode );
     3109#endif
    29913110    }
    29923111
Note: See TracChangeset for help on using the changeset viewer.