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


Ignore:
Timestamp:
29 Aug 2014, 23:48:19 (11 years ago)
Author:
seregin
Message:

port rev 4061 from RExt to solve WPP problem related to ticket #35, macro is WPP_FIX

File:
1 edited

Legend:

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

    r834 r880  
    146146  UInt uiTilesAcross   = rpcPic->getPicSym()->getNumColumnsMinus1()+1;
    147147  TComSlice*  pcSlice = rpcPic->getSlice(rpcPic->getCurrSliceIdx());
     148#if !WPP_FIX
    148149  Int  iNumSubstreams = pcSlice->getPPS()->getNumSubstreams();
     150#endif
    149151
    150152  // delete decoders if already allocated in previous slice
     
    193195  UInt uiWidthInLCUs  = rpcPic->getPicSym()->getFrameWidthInCU();
    194196  //UInt uiHeightInLCUs = rpcPic->getPicSym()->getFrameHeightInCU();
     197
     198#if WPP_FIX
     199  UInt uiTileCol;
     200  UInt uiTileLCUX;
     201  const Bool depSliceSegmentsEnabled = rpcPic->getSlice(rpcPic->getCurrSliceIdx())->getPPS()->getDependentSliceSegmentsEnabledFlag();
     202  const UInt startTileIdx=rpcPic->getPicSym()->getTileIdxMap(iStartCUAddr);
     203  TComTile *pCurrentTile=rpcPic->getPicSym()->getTComTile(startTileIdx);
     204  UInt uiTileStartLCU = pCurrentTile->getFirstCUAddr(); // Code tidy
     205
     206  // The first LCU of the slice is the first coded substream, but the global substream number, as calculated by getSubstreamForLCUAddr may be higher.
     207  // This calculates the common offset for all substreams in this slice.
     208  const UInt subStreamOffset=rpcPic->getSubstreamForLCUAddr(iStartCUAddr, true, pcSlice);
     209#else
    195210  UInt uiCol=0, uiLin=0, uiSubStrm=0;
    196211
     
    201216  Bool depSliceSegmentsEnabled = rpcPic->getSlice(rpcPic->getCurrSliceIdx())->getPPS()->getDependentSliceSegmentsEnabledFlag();
    202217  uiTileStartLCU = rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(iStartCUAddr))->getFirstCUAddr();
     218#endif
    203219  if( depSliceSegmentsEnabled )
    204220  {
     221#if WPP_FIX
     222    if( (!rpcPic->getSlice(rpcPic->getCurrSliceIdx())->isNextSlice()) && iStartCUAddr != uiTileStartLCU)  // Code tidy // Is this a dependent slice segment and not the start of a tile?
     223#else
    205224    if( (!rpcPic->getSlice(rpcPic->getCurrSliceIdx())->isNextSlice()) &&
    206225       iStartCUAddr != rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(iStartCUAddr))->getFirstCUAddr())
     226#endif
    207227    {
    208228      if(pcSlice->getPPS()->getEntropyCodingSyncEnabledFlag())
    209229      {
     230#if WPP_FIX
     231        uiTileCol = startTileIdx % (rpcPic->getPicSym()->getNumColumnsMinus1()+1); // Code tidy
     232#else
    210233        uiTileCol = rpcPic->getPicSym()->getTileIdxMap(iStartCUAddr) % (rpcPic->getPicSym()->getNumColumnsMinus1()+1);
     234#endif
    211235        m_pcBufferSbacDecoders[uiTileCol].loadContexts( CTXMem[1]  );//2.LCU
     236#if WPP_FIX
     237        if ( pCurrentTile->getTileWidth() < 2)
     238        {
     239          CTXMem[0]->loadContexts(pcSbacDecoder); // If tile width is less than 2, need to ensure CTX states get initialised to un-adapted CABAC. Set here, to load a few lines later (!)
     240        }
     241#else
    212242        if ( (iStartCUAddr%uiWidthInLCUs+1) >= uiWidthInLCUs  )
    213243        {
     
    219249          }
    220250        }
     251#endif
    221252      }
    222253      pcSbacDecoder->loadContexts(CTXMem[0] ); //end of depSlice-1
     254#if WPP_FIX
     255      pcSbacDecoders[0].loadContexts(pcSbacDecoder); // The first substream used for the slice will always be 0. (The original code was equivalent)
     256#else
    223257      pcSbacDecoders[uiSubStrm].loadContexts(pcSbacDecoder);
     258#endif
    224259    }
    225260    else
     
    239274    uiTileStartLCU = rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(iCUAddr))->getFirstCUAddr();
    240275    uiTileLCUX = uiTileStartLCU % uiWidthInLCUs;
     276#if WPP_FIX
     277    UInt uiCol     = iCUAddr % uiWidthInLCUs;
     278    UInt uiSubStrm=rpcPic->getSubstreamForLCUAddr(iCUAddr, true, pcSlice)-subStreamOffset;
     279#else
    241280    uiCol     = iCUAddr % uiWidthInLCUs;
    242281    // The 'line' is now relative to the 1st line in the slice, not the 1st line in the picture.
    243282    uiLin     = (iCUAddr/uiWidthInLCUs)-(iStartCUAddr/uiWidthInLCUs);
     283#endif
    244284    // inherit from TR if necessary, select substream to use.
    245285    if( (pcSlice->getPPS()->getNumSubstreams() > 1) || ( depSliceSegmentsEnabled  && (uiCol == uiTileLCUX)&&(pcSlice->getPPS()->getEntropyCodingSyncEnabledFlag()) ))
    246286    {
     287#if !WPP_FIX
    247288      // independent tiles => substreams are "per tile".  iNumSubstreams has already been multiplied.
    248289      iNumSubstreamsPerTile = iNumSubstreams/rpcPic->getPicSym()->getNumTiles();
    249290      uiSubStrm = rpcPic->getPicSym()->getTileIdxMap(iCUAddr)*iNumSubstreamsPerTile
    250291                  + uiLin%iNumSubstreamsPerTile;
     292#endif
    251293      m_pcEntropyDecoder->setBitstream( ppcSubstreams[uiSubStrm] );
    252294      // Synchronize cabac probabilities with upper-right LCU if it's available and we're at the start of a line.
     
    280322      pcSbacDecoder->load(&pcSbacDecoders[uiSubStrm]);  //this load is used to simplify the code (avoid to change all the call to pcSbacDecoders)
    281323    }
     324#if !WPP_FIX
    282325    else if ( pcSlice->getPPS()->getNumSubstreams() <= 1 )
    283326    {
     
    285328      iNumSubstreamsPerTile = 1;
    286329    }
     330#endif
    287331
    288332    if ( (iCUAddr == rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(iCUAddr))->getFirstCUAddr()) && // 1st in tile.
Note: See TracChangeset for help on using the changeset viewer.