Ticket #635: j0033.patch

File j0033.patch, 5.6 KB (added by gordon, 12 years ago)
  • source/Lib/TLibDecoder/TDecSlice.cpp

     
    200200    uiTileWidth = rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(iCUAddr))->getTileWidth();
    201201    uiTileHeight = rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(iCUAddr))->getTileHeight();
    202202    uiCol     = iCUAddr % uiWidthInLCUs;
    203     uiLin     = iCUAddr / uiWidthInLCUs;
     203    // The 'line' is now relative to the 1st line in the slice, not the 1st line in the picture.
     204    uiLin     = (iCUAddr/uiWidthInLCUs)-(iStartCUAddr/uiWidthInLCUs);
    204205    // inherit from TR if necessary, select substream to use.
    205206#if DEPENDENT_SLICES
    206207    if( (pcSlice->getPPS()->getNumSubstreams() > 1) || ( bAllowDependence  && (uiCol == uiTileLCUX)&&(pcSlice->getPPS()->getTilesOrEntropyCodingSyncIdc()==2) ))
  • source/Lib/TLibDecoder/TDecGop.cpp

     
    229229    m_pcSbacDecoder->init( (TDecBinIf*)m_pcBinCABAC );
    230230    m_pcEntropyDecoder->setEntropyDecoder (m_pcSbacDecoder);
    231231   
    232     UInt uiNumSubstreams = pcSlice->getPPS()->getNumSubstreams();
     232    UInt uiNumSubstreams = pcSlice->getPPS()->getTilesOrEntropyCodingSyncIdc() == 2 ? pcSlice->getNumEntryPointOffsets()+1 : pcSlice->getPPS()->getNumSubstreams();
    233233
    234234    //init each couple {EntropyDecoder, Substream}
    235235    UInt *puiSubstreamSizes = pcSlice->getSubstreamSizes();
  • source/Lib/TLibDecoder/TDecCAVLC.cpp

     
    22452245    }
    22462246    else if ( tilesOrEntropyCodingSyncIdc == 2 ) // wavefront
    22472247    {
    2248       Int numSubstreams = pps->getNumSubstreams();
     2248      Int numSubstreams = rpcSlice->getNumEntryPointOffsets()+1;
    22492249      rpcSlice->allocSubstreamSizes(numSubstreams);
    22502250      UInt *pSubstreamSizes       = rpcSlice->getSubstreamSizes();
    22512251      for (Int idx=0; idx<numSubstreams-1; idx++)
  • source/Lib/TLibEncoder/TEncGOP.cpp

     
    11171117#if !REMOVE_TILE_MARKERS
    11181118          UInt uiAccumulatedLength = 0;
    11191119#endif
    1120           for ( UInt ui = 0 ; ui < pcSlice->getPPS()->getNumSubstreams(); ui++ )
     1120          Int offs = 0;
     1121          Int nss = pcSlice->getPPS()->getNumSubstreams();
     1122          if (pcSlice->getPPS()->getTilesOrEntropyCodingSyncIdc() == 2)
    11211123          {
    1122             pcOut->addSubstream(&pcSubstreamsOut[ui]);
     1124            // 1st line present for WPP.
     1125            offs = pcSlice->getSliceCurStartCUAddr()/pcSlice->getPic()->getNumPartInCU()/pcSlice->getPic()->getFrameWidthInCU();
     1126            nss  = pcSlice->getNumEntryPointOffsets()+1;
     1127          }
     1128          for ( UInt ui = 0 ; ui < nss; ui++ )
     1129          {
     1130            pcOut->addSubstream(&pcSubstreamsOut[ui+offs]);
    11231131
    11241132#if !REMOVE_TILE_MARKERS
    11251133            // Update tile marker location information
  • source/Lib/TLibEncoder/TEncCavlc.cpp

     
    11001100  }
    11011101
    11021102  UInt numEntryPointOffsets = 0, offsetLenMinus1 = 0, maxOffset = 0;
     1103  Int  numZeroSubstreamsAtStartOfSlice  = 0;
    11031104  UInt *entryPointOffset = NULL;
    11041105  if (tilesOrEntropyCodingSyncIdc == 1) // tiles
    11051106  {
     
    11241125  }
    11251126  else if (tilesOrEntropyCodingSyncIdc == 2) // wavefront
    11261127  {
    1127     Int  numZeroSubstreamsAtEndOfSlice  = 0;
    11281128    UInt* pSubstreamSizes               = pSlice->getSubstreamSizes();
    1129     // Find number of zero substreams at the end of slice
    1130     for (Int idx=pSlice->getPPS()->getNumSubstreams()-2; idx>=0; idx--)
    1131     {
    1132       if ( pSubstreamSizes[ idx ] ==  0 )
    1133       {
    1134         numZeroSubstreamsAtEndOfSlice++;
    1135       }
    1136       else
    1137       {
    1138         break;
    1139       }
    1140     }
    1141     numEntryPointOffsets       = pSlice->getPPS()->getNumSubstreams() - 1 - numZeroSubstreamsAtEndOfSlice;
     1129    Int maxNumParts                       = pSlice->getPic()->getNumPartInCU();
     1130    numZeroSubstreamsAtStartOfSlice       = pSlice->getSliceCurStartCUAddr()/maxNumParts/pSlice->getPic()->getFrameWidthInCU();
     1131    Int  numZeroSubstreamsAtEndOfSlice    = pSlice->getPic()->getFrameHeightInCU()-1 - ((pSlice->getSliceCurEndCUAddr()-1)/maxNumParts/pSlice->getPic()->getFrameWidthInCU());
     1132    numEntryPointOffsets                  = pSlice->getPPS()->getNumSubstreams() - numZeroSubstreamsAtStartOfSlice - numZeroSubstreamsAtEndOfSlice - 1;
     1133    pSlice->setNumEntryPointOffsets(numEntryPointOffsets);
    11421134    entryPointOffset           = new UInt[numEntryPointOffsets];
    11431135    for (Int idx=0; idx<numEntryPointOffsets; idx++)
    11441136    {
    1145       entryPointOffset[ idx ] = ( pSubstreamSizes[ idx ] >> 3 ) ;
     1137      entryPointOffset[ idx ] = ( pSubstreamSizes[ idx+numZeroSubstreamsAtStartOfSlice ] >> 3 ) ;
    11461138      if ( entryPointOffset[ idx ] > maxOffset )
    11471139      {
    11481140        maxOffset = entryPointOffset[ idx ];