Changeset 798 in SHVCSoftware for branches/SHM-6-dev/source/Lib/TLibDecoder


Ignore:
Timestamp:
10 Jun 2014, 01:10:15 (12 years ago)
Author:
qualcomm
Message:

JCTVC-P0041: Signalling and decoding of POC (Several macros)

The following macros describe the code each contains:

  1. POC_RESET_IDC_SIGNALLING - signalling of POC-related syntax elements
  2. POC_RESET_IDC_ENCODER - support for POC reset at encoder
  3. POC_RESET_IDC_DECODER - support for POC reset at decoder

In addition two bugfixes, under macros ALIGN_IRAP_BUGFIX and UNAVAILABLE_PIC_BUGFIX are also submitted.

From: Adarsh K. Ramasubramonian <aramasub@…>

Location:
branches/SHM-6-dev/source/Lib/TLibDecoder
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-6-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp

    r796 r798  
    26162616    {
    26172617      READ_CODE(sps->getBitsForPOC(), uiCode, "pic_order_cnt_lsb");
     2618#if POC_RESET_IDC_DECODER
     2619      rpcSlice->setPicOrderCntLsb( uiCode );
     2620#endif
    26182621#if SHM_FIX7
    26192622      iPOClsb = uiCode;
     
    26502653#if SHM_FIX7
    26512654      }
     2655#endif
     2656#if POC_RESET_IDC_DECODER
     2657    else
     2658    {
     2659      rpcSlice->setPicOrderCntLsb( 0 );
     2660    }
    26522661#endif
    26532662      if( !rpcSlice->getIdrPicFlag() )
     
    33423351    }
    33433352
     3353#if !POC_RESET_IDC_DECODER
    33443354    Int maxPocLsb  = 1 << rpcSlice->getSPS()->getBitsForPOC();
     3355#endif
    33453356    if( rpcSlice->getPocMsbValPresentFlag() )
    33463357    {
    33473358      READ_UVLC( uiCode,    "poc_msb_val");             rpcSlice->setPocMsbVal( uiCode );
     3359
     3360#if !POC_RESET_IDC_DECODER
    33483361      // Update POC of the slice based on this MSB val
    33493362      Int pocLsb     = rpcSlice->getPOC() % maxPocLsb;
     
    33533366    {
    33543367      rpcSlice->setPocMsbVal( rpcSlice->getPOC() / maxPocLsb );
     3368#endif
    33553369    }
    33563370
  • branches/SHM-6-dev/source/Lib/TLibDecoder/TDecTop.cpp

    r797 r798  
    9696  m_subDpbIdx = -1;
    9797#endif
     98#if POC_RESET_IDC_DECODER
     99  m_parseIdc = -1;
     100  m_lastPocPeriodId = -1;
     101  m_prevPicOrderCnt = 0;
     102#endif
    98103#if Q0048_CGS_3D_ASYMLUT
    99104  m_pColorMappedPic = NULL;
     
    11041109  }
    11051110#endif
     1111#if POC_RESET_IDC_DECODER
     1112  if( m_parseIdc != -1 ) // Second pass for a POC resetting picture
     1113  {
     1114    m_parseIdc++; // Proceed to POC decoding and RPS derivation
     1115  }
     1116 
     1117  if( m_parseIdc == 2 )
     1118  {
     1119    bNewPOC = false;
     1120  }
     1121
     1122  if( (bNewPOC || m_layerId!=m_uiPrevLayerId) && (m_parseIdc == -1) ) // Will be true at the first pass
     1123  {
     1124  //if (bNewPOC || m_layerId!=m_uiPrevLayerId)
     1125  // Check if new reset period has started - this is needed just so that the SHM decoder which calls slice header decoding twice
     1126  // does not invoke the output twice
     1127  //if( m_lastPocPeriodId[m_apcSlicePilot->getLayerId()] == m_apcSlicePilot->getPocResetPeriodId() )
     1128    // Update CurrAU marking
     1129    if(( m_layerId < m_uiPrevLayerId) ||( ( m_layerId == m_uiPrevLayerId) && bNewPOC)) // Decoding a lower layer than or same layer as previous - mark all earlier pictures as not in current AU
     1130    {
     1131      markAllPicsAsNoCurrAu();
     1132    }
     1133
     1134    if( m_apcSlicePilot->getPocResetIdc() && m_apcSlicePilot->getSliceIdx() == 0 )
     1135    {
     1136      Int pocResetPeriodId = m_apcSlicePilot->getPocResetPeriodId();
     1137      if ( m_apcSlicePilot->getPocResetIdc() == 1 || m_apcSlicePilot->getPocResetIdc() == 2 ||
     1138        ( m_apcSlicePilot->getPocResetIdc() == 3 && pocResetPeriodId != getLastPocPeriodId() ) )
     1139      {
     1140        setLastPocPeriodId(pocResetPeriodId);
     1141        m_parseIdc = 0;
     1142      }
     1143    }
     1144    else
     1145    {
     1146      m_parseIdc = 3; // Proceed to decoding POC and RPS
     1147    } 
     1148  }
     1149#endif
    11061150
    11071151#if ALIGNED_BUMPING
     1152#if POC_RESET_IDC_DECODER
     1153  //if(  (bNewPOC || m_layerId != m_uiPrevLayerId) && ( m_parseIdc != 1) )
     1154  if( m_parseIdc == 1 )
     1155  {
     1156
     1157    // Invoke output of pictures if the current picture is a POC reset picture
     1158    bNewPOC = true;
     1159    /* Include reset of all POCs in the layer */
     1160
     1161  // This operation would do the following:
     1162  // 1. Update the other picture in the DPB. This should be done only for the first slice of the picture.
     1163  // 2. Update the value of m_pocCRA.
     1164  // 3. Reset the POC values at the decoder for the current picture to be zero - will be done later
     1165  // 4. update value of POCLastDisplay
     1166     
     1167  //Do the reset stuff here
     1168    Int maxPocLsb = 1 << m_apcSlicePilot->getSPS()->getBitsForPOC();
     1169    Int pocLsbVal;
     1170    if( m_apcSlicePilot->getPocResetIdc() == 3 )
     1171    {
     1172      pocLsbVal = m_apcSlicePilot->getPocLsbVal() ;
     1173    }
     1174    else
     1175    {
     1176      pocLsbVal = (m_apcSlicePilot->getPOC() % maxPocLsb);
     1177    }
     1178
     1179    Int pocMsbDelta = 0;
     1180    if ( m_apcSlicePilot->getPocMsbValPresentFlag() )
     1181    {
     1182      pocMsbDelta = m_apcSlicePilot->getPocMsbVal() * maxPocLsb;
     1183    }
     1184    else
     1185    {
     1186      //This MSB derivation can be made into one function. Item to do next.
     1187      Int prevPoc     = this->getPrevPicOrderCnt();
     1188      Int prevPocLsb  = prevPoc & (maxPocLsb - 1);
     1189      Int prevPocMsb  = prevPoc - prevPocLsb;
     1190
     1191      pocMsbDelta = m_apcSlicePilot->getCurrMsb( pocLsbVal, prevPocLsb, prevPocMsb, maxPocLsb );
     1192    }
     1193
     1194    Int pocLsbDelta;
     1195    if( m_apcSlicePilot->getPocResetIdc() == 2 ||  ( m_apcSlicePilot->getPocResetIdc() == 3 && m_apcSlicePilot->getFullPocResetFlag() ))
     1196    {
     1197      pocLsbDelta = pocLsbVal;
     1198    }
     1199    else
     1200    {
     1201      pocLsbDelta = 0;
     1202    }
     1203
     1204    Int deltaPocVal  =  pocMsbDelta + pocLsbDelta;
     1205
     1206    //Reset all POC for DPB -> basically do it for each slice in the picutre
     1207    TComList<TComPic*>::iterator  iterPic = m_cListPic.begin(); 
     1208
     1209    // Iterate through all picture in DPB
     1210    while( iterPic != m_cListPic.end() )
     1211    {
     1212      TComPic *dpbPic = *iterPic;
     1213      // Check if the picture pointed to by iterPic is either used for reference or
     1214      // needed for output, are in the same layer, and not the current picture.
     1215      if( /*  ( ( dpbPic->getSlice(0)->isReferenced() ) || ( dpbPic->getOutputMark() ) )
     1216          &&*/ ( dpbPic->getLayerId() == m_apcSlicePilot->getLayerId() )
     1217            && ( dpbPic->getReconMark() ) && ( dpbPic->getPicSym()->getSlice(0)->getPicOutputFlag() ))
     1218      {
     1219        for(Int i = dpbPic->getNumAllocatedSlice()-1; i >= 0; i--)
     1220        {
     1221
     1222          TComSlice *slice = dpbPic->getSlice(i);
     1223          TComReferencePictureSet *rps = slice->getRPS();
     1224          slice->setPOC( slice->getPOC() - deltaPocVal );
     1225
     1226          // Also adjust the POC value stored in the RPS of each such slice
     1227          for(Int j = rps->getNumberOfPictures(); j >= 0; j--)
     1228          {
     1229            rps->setPOC( j, rps->getPOC(j) - deltaPocVal );
     1230          }
     1231          // Also adjust the value of refPOC
     1232          for(Int k = 0; k < 2; k++)  // For List 0 and List 1
     1233          {
     1234            RefPicList list = (k == 1) ? REF_PIC_LIST_1 : REF_PIC_LIST_0;
     1235            for(Int j = 0; j < slice->getNumRefIdx(list); j++)
     1236            {
     1237              slice->setRefPOC( slice->getRefPOC(list, j) - deltaPocVal, list, j);
     1238            }
     1239          }
     1240        }
     1241      }
     1242      iterPic++;
     1243    }
     1244    // Update the value of pocCRA
     1245    m_pocCRA -= deltaPocVal;
     1246
     1247    // Update value of POCLastDisplay
     1248    iPOCLastDisplay -= deltaPocVal;
     1249  }
     1250  Int maxPocLsb = 1 << m_apcSlicePilot->getSPS()->getBitsForPOC();
     1251  Int slicePicOrderCntLsb = m_apcSlicePilot->getPicOrderCntLsb();
     1252
     1253  if( m_parseIdc == 1 || m_parseIdc == 2 ) // TODO This should be replaced by pocResettingFlag.
     1254  {
     1255    // Set poc for current slice
     1256    if( m_apcSlicePilot->getPocResetIdc() == 1 )
     1257    {       
     1258      m_apcSlicePilot->setPOC( slicePicOrderCntLsb );
     1259    }
     1260    else if( m_apcSlicePilot->getPocResetIdc() == 2 )
     1261    {
     1262      m_apcSlicePilot->setPOC( 0 );
     1263    }
     1264    else
     1265    {
     1266      Int picOrderCntMsb = m_apcSlicePilot->getCurrMsb( slicePicOrderCntLsb, m_apcSlicePilot->getFullPocResetFlag() ? 0 : m_apcSlicePilot->getPocLsbVal(), 0 , maxPocLsb );
     1267      m_apcSlicePilot->setPOC( picOrderCntMsb + slicePicOrderCntLsb );
     1268    }
     1269  }
     1270  else if (m_parseIdc == 3)
     1271  {
     1272    Int picOrderCntMsb = 0;
     1273    if( m_apcSlicePilot->getPocMsbValPresentFlag() )
     1274    {
     1275      picOrderCntMsb = m_apcSlicePilot->getPocMsbVal() * maxPocLsb;
     1276    }
     1277    else if( m_apcSlicePilot->getIdrPicFlag() )
     1278    {
     1279      picOrderCntMsb = 0;
     1280    }
     1281    else
     1282    {
     1283      Int prevPicOrderCntLsb = this->getPrevPicOrderCnt() & ( maxPocLsb - 1);
     1284      Int prevPicOrderCntMsb  = this->getPrevPicOrderCnt() - prevPicOrderCntLsb;
     1285      picOrderCntMsb = m_apcSlicePilot->getCurrMsb(slicePicOrderCntLsb, prevPicOrderCntLsb, prevPicOrderCntMsb, maxPocLsb );
     1286    }
     1287    m_apcSlicePilot->setPOC( picOrderCntMsb + slicePicOrderCntLsb );
     1288  }
     1289
     1290  if( m_parseIdc == 1 || m_parseIdc == 3)
     1291  {
     1292    // Adjust prevPicOrderCnt
     1293    if(    !m_apcSlicePilot->getRaslPicFlag()
     1294        && !m_apcSlicePilot->getRadlPicFlag()
     1295        && (m_apcSlicePilot->getNalUnitType() % 2 == 1)
     1296        && ( nalu.m_temporalId == 0 )
     1297        && !m_apcSlicePilot->getDiscardableFlag() )
     1298    {
     1299      this->setPrevPicOrderCnt( m_apcSlicePilot->getPOC() );
     1300    }
     1301    else if ( m_apcSlicePilot->getPocResetIdc() == 3 )
     1302    {
     1303      this->setPrevPicOrderCnt( m_apcSlicePilot->getFullPocResetFlag()
     1304                                            ? 0 : m_apcSlicePilot->getPocLsbVal() );
     1305    }
     1306#else
    11081307  if (bNewPOC || m_layerId!=m_uiPrevLayerId)
    11091308  {
     1309#endif
    11101310    m_apcSlicePilot->applyReferencePictureSet(m_cListPic, m_apcSlicePilot->getRPS());
    11111311  }
    11121312#endif
     1313#if POC_RESET_IDC_DECODER
     1314  if (m_apcSlicePilot->isNextSlice() && (bNewPOC || m_layerId!=m_uiPrevLayerId || m_parseIdc == 1) && !m_bFirstSliceInSequence )
     1315#else
    11131316  if (m_apcSlicePilot->isNextSlice() && (bNewPOC || m_layerId!=m_uiPrevLayerId) && !m_bFirstSliceInSequence )
     1317#endif
    11141318  {
    11151319    m_prevPOC = m_apcSlicePilot->getPOC();
     
    11191323  }
    11201324
     1325#if POC_RESET_IDC_DECODER
     1326  m_parseIdc = -1;
     1327#endif
     1328
    11211329  // actual decoding starts here
    1122   xActivateParameterSets();
     1330    xActivateParameterSets();
    11231331
    11241332#if REPN_FORMAT_IN_VPS
     
    12011409  }
    12021410#endif
    1203 
    12041411  // Alignment of TSA and STSA pictures across AU
    12051412  if( m_apcSlicePilot->getLayerId() > 0 )
     
    14011608    //  Get a new picture buffer
    14021609    xGetNewPicBuffer (m_apcSlicePilot, pcPic);
     1610
     1611#if POC_RESET_IDC_DECODER
     1612  pcPic->setCurrAuFlag( true );
     1613#endif
    14031614
    14041615    Bool isField = false;
     
    25052716}
    25062717#endif
    2507 
     2718#if POC_RESET_IDC_DECODER
     2719Void TDecTop::markAllPicsAsNoCurrAu()
     2720{
     2721  for(Int i = 0; i < MAX_LAYERS; i++)
     2722  {
     2723    TComList<TComPic*>* listPic = this->getLayerDec(i)->getListPic();
     2724    TComList<TComPic*>::iterator  iterPic = listPic->begin();
     2725    while ( iterPic != listPic->end() )
     2726    {
     2727      TComPic *pcPic = *(iterPic);
     2728      pcPic->setCurrAuFlag( false );
     2729      iterPic++;
     2730    }
     2731  }
     2732}
     2733#endif
    25082734#if Q0048_CGS_3D_ASYMLUT
    25092735Void TDecTop::initAsymLut(TComSlice *pcSlice)
  • branches/SHM-6-dev/source/Lib/TLibDecoder/TDecTop.h

    r747 r798  
    204204  Bool                    m_firstPicInLayerDecodedFlag;
    205205#endif
     206#if POC_RESET_IDC_DECODER
     207  Int                     m_parseIdc;
     208  Int                     m_lastPocPeriodId;
     209  Int                     m_prevPicOrderCnt;
     210#endif
    206211#if RESOLUTION_BASED_DPB
    207212  Int                     m_subDpbIdx;     // Index to the sub-DPB that the layer belongs to.
     
    244249#if EARLY_REF_PIC_MARKING
    245250  Void earlyPicMarking(Int maxTemporalLayer, std::vector<Int>& targetDecLayerIdList);
     251#endif
     252#if POC_RESET_IDC_DECODER
     253  Int getParseIdc() { return m_parseIdc;}
     254  Void        setParseIdc(Int x) { m_parseIdc = x;}
     255  Void        markAllPicsAsNoCurrAu();
     256
     257  Int   getLastPocPeriodId() { return m_lastPocPeriodId; }
     258  Void  setLastPocPeriodId(Int x)    { m_lastPocPeriodId = x; }
     259
     260  Int   getPrevPicOrderCnt() { return m_prevPicOrderCnt; }
     261  Void  setPrevPicOrderCnt(Int const x) { m_prevPicOrderCnt = x; }
    246262#endif
    247263  UInt      getLayerId            () { return m_layerId;              }
Note: See TracChangeset for help on using the changeset viewer.