Ticket #645: RPS_COUNTER_BUGFIX_r2613.patch

File RPS_COUNTER_BUGFIX_r2613.patch, 4.1 KB (added by adarsh, 12 years ago)

Patch for RPS_COUNTER_BUGFIX

  • App/TAppDecoder/TAppDecTop.cpp

     
    197197#if RPS_COUNTER
    198198  printf("\nRPS related bits in SPS: %d\n", m_cTDecTop.getSPS()->getBitsForSPS());
    199199  printf("RPS related bits in PPS: %d\n", m_cTDecTop.getPPS()->getBitsForPPS());
     200#if RPS_COUNTER_BUGFIX
     201  int shbits = (m_cTDecTop.getPPS()->getBitsForSliceHeader()+2); //The first intra costs 2 bits.
     202#else
    200203  int shbits = (m_cTDecTop.getPPS()->getBitsForSliceHeader()+2)/2; //All slice headers except for the first intra picture are counted twice. The first intra costs 2 bits.
     204#endif
    201205  printf("RPS related bits in slice headers: %d\n", shbits);
    202206  printf("RPS related bits in total: %d\n\n",m_cTDecTop.getPPS()->getBitsForPPS()+m_cTDecTop.getSPS()->getBitsForSPS()+shbits);
    203207#endif
  • Lib/TLibCommon/TComSlice.h

     
    301301  UInt        m_tilesOrEntropyCodingSyncIdc;
    302302  Int         m_numSubstreams;
    303303#endif
     304#if RPS_COUNTER_BUGFIX
     305  Bool m_firstRunFlag;
     306#endif
    304307
    305308public:
    306309  TComSPS();
    307310  virtual ~TComSPS();
    308 
     311#if RPS_COUNTER_BUGFIX
     312  Void        setFirstRunFlag(Bool x)       { m_firstRunFlag = x;}
     313  Bool        getFirstRunFlag()             { return m_firstRunFlag;}
     314  Void        flipFirstRunFlag()            { m_firstRunFlag = !m_firstRunFlag;}
     315#endif
    309316  Int  getSPSId       ()         { return m_SPSId;          }
    310317  Void setSPSId       (Int i)    { m_SPSId = i;             }
    311318  Int  getProfileIdc  ()         { return m_ProfileIdc;     }
  • Lib/TLibCommon/TypeDef.h

     
    4040
    4141//! \ingroup TLibCommon
    4242//! \{
    43 
     43#define RPS_COUNTER_BUGFIX               1  ///< To fix the bug in bit count of RPS-related parameters in the slice header
    4444#define REMOVE_TILE_MARKERS              1
    4545#define EXPLICITLY_SIGNAL_ENTRY_POINTS   1  ///< I0273: Explicitly signal all tiles/wavefront entry points
    4646
  • Lib/TLibDecoder/TDecCAVLC.cpp

     
    17371737#endif
    17381738    }
    17391739#if RPS_COUNTER
     1740#if RPS_COUNTER_BUGFIX
     1741     rpcSlice->getPPS()->setBitsForSliceHeader( (rpcSlice->getPPS()->getBitsForSliceHeader()+bitsBefore-m_pcBitstream->getNumBitsLeft()) * rpcSlice->getSPS()->getFirstRunFlag() );
     1742#else
    17401743    rpcSlice->getPPS()->setBitsForSliceHeader(rpcSlice->getPPS()->getBitsForSliceHeader()+bitsBefore-m_pcBitstream->getNumBitsLeft());
    17411744#endif
     1745#endif
    17421746#if DBL_HL_SYNTAX
    17431747    if(sps->getUseSAO() || sps->getUseALF())
    17441748#else
     
    19131917      refPicListModification->setRefPicListModificationFlagL1(0);
    19141918    }
    19151919#if RPS_COUNTER
     1920#if RPS_COUNTER_BUGFIX
     1921     rpcSlice->getPPS()->setBitsForSliceHeader( (rpcSlice->getPPS()->getBitsForSliceHeader()+bitsBefore-m_pcBitstream->getNumBitsLeft()) * rpcSlice->getSPS()->getFirstRunFlag() );
     1922#else
    19161923    rpcSlice->getPPS()->setBitsForSliceHeader(rpcSlice->getPPS()->getBitsForSliceHeader()+bitsBefore-m_pcBitstream->getNumBitsLeft());
    19171924#endif
     1925#endif
    19181926  }
    19191927  else
    19201928  {
  • Lib/TLibDecoder/TDecTop.cpp

     
    324324  {
    325325    m_apcSlicePilot->copySliceInfo( pcPic->getPicSym()->getSlice(m_uiSliceIdx-1) );
    326326  }
    327 
     327#if RPS_COUNTER_BUGFIX
     328  if(m_apcSlicePilot->getSliceCurStartCUAddr() == 0)
     329  {
     330    m_apcSlicePilot->getSPS()->flipFirstRunFlag();
     331  }
     332  else
     333  {
     334    m_apcSlicePilot->getSPS()->setFirstRunFlag(1);
     335  }
     336#endif
    328337  m_apcSlicePilot->setNalUnitType(nalu.m_nalUnitType);
    329338  m_apcSlicePilot->setReferenced(nalu.m_nalRefFlag);
    330339  m_apcSlicePilot->setTLayerInfo(nalu.m_temporalId);