Ticket #554: tile_idx_minus_1_patch.patch

File tile_idx_minus_1_patch.patch, 8.4 KB (added by ChristianFeldmann, 12 years ago)

encode/decode tile_idx_minus_1 as u(v)

  • source/Lib/TLibDecoder/TDecGop.cpp

     
    294294    }
    295295
    296296    m_pcSbacDecoders[0].load(m_pcSbacDecoder);
    297     m_pcSliceDecoder->decompressSlice( pcBitstream, ppcSubstreams, rpcPic, m_pcSbacDecoder, m_pcSbacDecoders);
     297    m_pcSliceDecoder->decompressSlice( pcBitstream, ppcSubstreams, rpcPic, m_pcSbacDecoder, m_pcSbacDecoders, m_pcCavlcDecoder );
    298298    m_pcEntropyDecoder->setBitstream(  ppcSubstreams[uiNumSubstreams-1] );
    299299    // deallocate all created substreams, including internal buffers.
    300300    for (UInt ui = 0; ui < uiNumSubstreams; ui++)
  • source/Lib/TLibDecoder/TDecSbac.cpp

     
    188188  }
    189189#endif
    190190  m_pcBitstream->readOutTrailingBits();
    191   m_cCUSplitFlagSCModel.initBuffer       ( eSliceType, iQp, (UChar*)INIT_SPLIT_FLAG );
    192   m_cCUSkipFlagSCModel.initBuffer        ( eSliceType, iQp, (UChar*)INIT_SKIP_FLAG );
    193   m_cCUMergeFlagExtSCModel.initBuffer    ( eSliceType, iQp, (UChar*)INIT_MERGE_FLAG_EXT );
    194   m_cCUMergeIdxExtSCModel.initBuffer     ( eSliceType, iQp, (UChar*)INIT_MERGE_IDX_EXT );
    195   m_cCUAlfCtrlFlagSCModel.initBuffer     ( eSliceType, iQp, (UChar*)INIT_ALF_CTRL_FLAG );
    196   m_cCUPartSizeSCModel.initBuffer        ( eSliceType, iQp, (UChar*)INIT_PART_SIZE );
    197   m_cCUAMPSCModel.initBuffer             ( eSliceType, iQp, (UChar*)INIT_CU_AMP_POS );
    198   m_cCUPredModeSCModel.initBuffer        ( eSliceType, iQp, (UChar*)INIT_PRED_MODE );
    199   m_cCUIntraPredSCModel.initBuffer       ( eSliceType, iQp, (UChar*)INIT_INTRA_PRED_MODE );
    200   m_cCUChromaPredSCModel.initBuffer      ( eSliceType, iQp, (UChar*)INIT_CHROMA_PRED_MODE );
    201   m_cCUInterDirSCModel.initBuffer        ( eSliceType, iQp, (UChar*)INIT_INTER_DIR );
    202   m_cCUMvdSCModel.initBuffer             ( eSliceType, iQp, (UChar*)INIT_MVD );
    203   m_cCURefPicSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_REF_PIC );
    204   m_cCUDeltaQpSCModel.initBuffer         ( eSliceType, iQp, (UChar*)INIT_DQP );
    205   m_cCUQtCbfSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_QT_CBF );
    206   m_cCUQtRootCbfSCModel.initBuffer       ( eSliceType, iQp, (UChar*)INIT_QT_ROOT_CBF );
    207   m_cCUSigCoeffGroupSCModel.initBuffer   ( eSliceType, iQp, (UChar*)INIT_SIG_CG_FLAG );
    208   m_cCUSigSCModel.initBuffer             ( eSliceType, iQp, (UChar*)INIT_SIG_FLAG );
    209   m_cCuCtxLastX.initBuffer               ( eSliceType, iQp, (UChar*)INIT_LAST );
    210   m_cCuCtxLastY.initBuffer               ( eSliceType, iQp, (UChar*)INIT_LAST );
    211   m_cCUOneSCModel.initBuffer             ( eSliceType, iQp, (UChar*)INIT_ONE_FLAG );
    212   m_cCUAbsSCModel.initBuffer             ( eSliceType, iQp, (UChar*)INIT_ABS_FLAG );
    213   m_cMVPIdxSCModel.initBuffer            ( eSliceType, iQp, (UChar*)INIT_MVP_IDX );
    214   m_cALFFlagSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_ALF_FLAG );
    215   m_cALFUvlcSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_ALF_UVLC );
    216   m_cALFSvlcSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_ALF_SVLC );
    217   m_cSaoFlagSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_SAO_FLAG );
    218   m_cSaoUvlcSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_SAO_UVLC );
    219 #if !(SAO_OFFSET_MAG_SIGN_SPLIT && SAO_RDO_FIX)
    220   m_cSaoSvlcSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_SAO_SVLC );
    221 #endif
    222   m_cSaoMergeLeftSCModel.initBuffer      ( eSliceType, iQp, (UChar*)INIT_SAO_MERGE_LEFT_FLAG );
    223   m_cSaoMergeUpSCModel.initBuffer        ( eSliceType, iQp, (UChar*)INIT_SAO_MERGE_UP_FLAG );
    224   m_cSaoTypeIdxSCModel.initBuffer        ( eSliceType, iQp, (UChar*)INIT_SAO_TYPE_IDX );
    225   m_cCUTransSubdivFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_TRANS_SUBDIV_FLAG );
    226 #if INTRA_TRANSFORMSKIP
    227   m_cTransformSkipSCModel.initBuffer     ( eSliceType, iQp, (UChar*)INIT_TRANSFORMSKIP_FLAG );
    228 #endif
    229   m_pcTDecBinIf->start();
    230191}
    231192
    232193Void TDecSbac::readTileMarker( UInt& uiTileIdx, UInt uiBitsUsed )
    233194{
    234   UInt uiSymbol;
    235   uiTileIdx = 0;
    236   for (Int iShift=uiBitsUsed-1; iShift>=0; iShift--)
    237   {
    238     m_pcTDecBinIf->decodeBinEP ( uiSymbol );
    239     if (uiSymbol)
    240     {
    241       uiTileIdx |= (1<<iShift);
    242     }
    243   }
     195  assert(0);
    244196}
    245197
    246198Void TDecSbac::parseTerminatingBit( UInt& ruiBit )
  • source/Lib/TLibDecoder/TDecSlice.cpp

     
    9090  m_pcCuDecoder       = pcCuDecoder;
    9191}
    9292
    93 Void TDecSlice::decompressSlice(TComInputBitstream* pcBitstream, TComInputBitstream** ppcSubstreams, TComPic*& rpcPic, TDecSbac* pcSbacDecoder, TDecSbac* pcSbacDecoders)
     93Void TDecSlice::decompressSlice(TComInputBitstream* pcBitstream, TComInputBitstream** ppcSubstreams, TComPic*& rpcPic, TDecSbac* pcSbacDecoder, TDecSbac* pcSbacDecoders, TDecCavlc* pcCavlcDecoder)
    9494{
    9595  TComDataCU* pcCU;
    9696  UInt        uiIsLast = 0;
     
    251251
    252252      for (UInt uiIdx=0; uiIdx<pcTmpPtr->getTileMarkerLocationCount(); uiIdx++)
    253253      {
    254         if ( pcTmpPtr->getByteLocation() == (pcTmpPtr->getTileMarkerLocation( uiIdx )+2) )
     254        if ( pcTmpPtr->getByteLocation() == (pcTmpPtr->getTileMarkerLocation( uiIdx )) )
    255255        {
    256256          bTileMarkerFoundFlag = true;
    257257          break;
     
    262262      {
    263263        UInt uiTileIdx;
    264264        // Read tile index
     265        m_pcEntropyDecoder->setEntropyDecoder( pcCavlcDecoder );
     266        m_pcEntropyDecoder->setBitstream( ppcSubstreams[uiSubStrm] );
    265267        m_pcEntropyDecoder->readTileMarker( uiTileIdx, rpcPic->getPicSym()->getBitsUsedByTileIdx() );
     268        m_pcEntropyDecoder->setEntropyDecoder( pcSbacDecoder );
    266269      }
     270      m_pcEntropyDecoder->resetEntropy( pcSlice );
    267271    }
    268272
    269273#if ENC_DEC_TRACE
  • source/Lib/TLibDecoder/TDecSlice.h

     
    4848#include "TDecEntropy.h"
    4949#include "TDecCu.h"
    5050#include "TDecSbac.h"
     51#include "TDecCAVLC.h"
    5152#include "TDecBinCoderCABAC.h"
    5253
    5354//! \ingroup TLibDecoder
     
    7980  Void  create            ( TComSlice* pcSlice, Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth );
    8081  Void  destroy           ();
    8182 
    82   Void  decompressSlice   ( TComInputBitstream* pcBitstream, TComInputBitstream** ppcSubstreams,   TComPic*& rpcPic, TDecSbac* pcSbacDecoder, TDecSbac* pcSbacDecoders );
     83  Void  decompressSlice   ( TComInputBitstream* pcBitstream, TComInputBitstream** ppcSubstreams, TComPic*& rpcPic, TDecSbac* pcSbacDecoder, TDecSbac* pcSbacDecoders, TDecCavlc* pcCavlcDecoder );
    8384};
    8485
    8586
  • source/Lib/TLibEncoder/TEncSbac.cpp

     
    292292
    293293Void TEncSbac::writeTileMarker( UInt uiTileIdx, UInt uiBitsUsed )
    294294{
    295   for (Int iShift=uiBitsUsed-1; iShift>=0; iShift--)
    296   {
    297     m_pcBinIf->encodeBinEP ( (uiTileIdx & (1 << iShift)) >> iShift );
    298   }
     295  assert(0);
    299296}
    300297
    301298void TEncSbac::codeSEI(const SEI&)
  • source/Lib/TLibEncoder/TEncSlice.cpp

     
    10991099          UInt uiMarkerCount = pcSubstreams[uiSubStrm].getTileMarkerLocationCount();
    11001100          pcSubstreams[uiSubStrm].setTileMarkerLocation     ( uiMarkerCount, pcSubstreams[uiSubStrm].getNumberOfWrittenBits() >> 3 );
    11011101          pcSubstreams[uiSubStrm].setTileMarkerLocationCount( uiMarkerCount + 1 );
     1102         
    11021103          // Write tile index
     1104          m_pcEntropyCoder->setEntropyCoder( m_pcCavlcCoder, pcSlice );
     1105          m_pcEntropyCoder->setBitstream( &pcSubstreams[uiSubStrm] );
    11031106          m_pcEntropyCoder->writeTileMarker(iTileIdx, rpcPic->getPicSym()->getBitsUsedByTileIdx()); // Tile index
     1107          m_pcEntropyCoder->setEntropyCoder( m_pcSbacCoder, pcSlice );
    11041108        }
    11051109
    11061110