Ignore:
Timestamp:
13 Nov 2013, 23:25:47 (11 years ago)
Author:
nokia
Message:

Integration of O0194: Support different bit-depth values for different layers, enable weighted prediction for ILR for color gamut scalability.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-4.0-dev/source/Lib/TLibEncoder/TEncSlice.cpp

    r442 r466  
    22 * License, included below. This software may be subject to other third party
    33 * and contributor rights, including patent rights, and no such rights are
    4  * granted under this license. 
     4 * granted under this license.
    55 *
    66 * Copyright (c) 2010-2013, ITU/ISO/IEC
     
    5151  m_apcPicYuvPred = NULL;
    5252  m_apcPicYuvResi = NULL;
    53  
     53
    5454  m_pdRdPicLambda = NULL;
    5555  m_pdRdPicQp     = NULL;
     
    6969}
    7070
    71 Void TEncSlice::initCtxMem(  UInt i )               
    72 {   
     71Void TEncSlice::initCtxMem(  UInt i )
     72{
    7373  for (std::vector<TEncSbac*>::iterator j = CTXMem.begin(); j != CTXMem.end(); j++)
    7474  {
    7575    delete (*j);
    7676  }
    77   CTXMem.clear(); 
    78   CTXMem.resize(i); 
     77  CTXMem.clear();
     78  CTXMem.resize(i);
    7979}
    8080
     
    8787    m_apcPicYuvPred->create( iWidth, iHeight, iMaxCUWidth, iMaxCUHeight, uhTotalDepth );
    8888  }
    89  
     89
    9090  // create residual picture
    9191  if( m_apcPicYuvResi == NULL )
     
    105105    m_apcPicYuvPred  = NULL;
    106106  }
    107  
     107
    108108  // destroy residual picture
    109109  if ( m_apcPicYuvResi )
     
    113113    m_apcPicYuvResi  = NULL;
    114114  }
    115  
     115
    116116  // free lambda and QP arrays
    117117  if ( m_pdRdPicLambda ) { xFree( m_pdRdPicLambda ); m_pdRdPicLambda = NULL; }
     
    139139#if SVC_EXTENSION
    140140  m_ppcTEncTop        = pcEncTop->getLayerEnc();
    141 #endif 
     141#endif
    142142  m_pcGOPEncoder      = pcEncTop->getGOPEncoder();
    143143  m_pcCuEncoder       = pcEncTop->getCuEncoder();
    144144  m_pcPredSearch      = pcEncTop->getPredSearch();
    145  
     145
    146146  m_pcEntropyCoder    = pcEncTop->getEntropyCoder();
    147147  m_pcCavlcCoder      = pcEncTop->getCavlcCoder();
     
    149149  m_pcBinCABAC        = pcEncTop->getBinCABAC();
    150150  m_pcTrQuant         = pcEncTop->getTrQuant();
    151  
     151
    152152  m_pcBitCounter      = pcEncTop->getBitCounter();
    153153  m_pcRdCost          = pcEncTop->getRdCost();
    154154  m_pppcRDSbacCoder   = pcEncTop->getRDSbacCoder();
    155155  m_pcRDGoOnSbacCoder = pcEncTop->getRDGoOnSbacCoder();
    156  
     156
    157157  // create lambda and QP arrays
    158158  m_pdRdPicLambda     = (Double*)xMalloc( Double, m_pcCfg->getDeltaQpRD() * 2 + 1 );
     
    187187  Double dQP;
    188188  Double dLambda;
    189  
     189
    190190  rpcSlice = pcPic->getSlice(0);
    191191  rpcSlice->setSPS( pSPS );
     
    202202  rpcSlice->setPicOutputFlag( true );
    203203  rpcSlice->setPOC( pocCurr );
    204  
     204
    205205  // depth computation based on GOP size
    206206  Int depth;
     
    230230    }
    231231  }
    232  
     232
    233233  // slice type
    234234  SliceType eSliceType;
    235  
     235
    236236  eSliceType=B_SLICE;
    237237  eSliceType = (pocLast == 0 || pocCurr % m_pcCfg->getIntraPeriod() == 0 || m_pcGOPEncoder->getGOPSize() == 0) ? I_SLICE : eSliceType;
    238  
     238
    239239  rpcSlice->setSliceType    ( eSliceType );
    240  
     240
    241241  // ------------------------------------------------------------------------------------------------------------------
    242242  // Non-referenced frame marking
    243243  // ------------------------------------------------------------------------------------------------------------------
    244  
     244
    245245  if(pocLast == 0)
    246246  {
     
    252252  }
    253253  rpcSlice->setReferenced(true);
    254  
     254
    255255  // ------------------------------------------------------------------------------------------------------------------
    256256  // QP setting
    257257  // ------------------------------------------------------------------------------------------------------------------
    258  
     258
    259259  dQP = m_pcCfg->getQP();
    260260  if(eSliceType!=I_SLICE)
    261261  {
    262262#if REPN_FORMAT_IN_VPS
    263     if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getQpBDOffsetY() ) && (rpcSlice->getSPS()->getUseLossless()))) 
    264 #else
    265     if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getSPS()->getQpBDOffsetY() ) && (rpcSlice->getSPS()->getUseLossless()))) 
     263    if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getQpBDOffsetY() ) && (rpcSlice->getSPS()->getUseLossless())))
     264#else
     265    if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getSPS()->getQpBDOffsetY() ) && (rpcSlice->getSPS()->getUseLossless())))
    266266#endif
    267267    {
     
    269269    }
    270270  }
    271  
     271
    272272  // modify QP
    273273  Int* pdQPs = m_pcCfg->getdQPs();
     
    285285  // Lambda computation
    286286  // ------------------------------------------------------------------------------------------------------------------
    287  
     287
    288288  Int iQP;
    289289  Double dOrigQP = dQP;
     
    294294    // compute QP value
    295295    dQP = dOrigQP + ((iDQpIdx+1)>>1)*(iDQpIdx%2 ? -1 : 1);
    296    
     296
    297297    // compute lambda value
    298298    Int    NumberBFrames = ( m_pcCfg->getGOPSize() - 1 );
     
    326326#endif
    327327    }
    328    
     328
    329329    // if hadamard is used in ME process
    330330    if ( !m_pcCfg->getUseHADME() && rpcSlice->getSliceType( ) != I_SLICE )
     
    332332      dLambda *= 0.95;
    333333    }
    334    
     334
    335335#if REPN_FORMAT_IN_VPS
    336336    iQP = max( -rpcSlice->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );
     
    343343    m_piRdPicQp    [iDQpIdx] = iQP;
    344344  }
    345  
     345
    346346  // obtain dQP = 0 case
    347347  dLambda = m_pdRdPicLambda[0];
    348348  dQP     = m_pdRdPicQp    [0];
    349349  iQP     = m_piRdPicQp    [0];
    350  
     350
    351351  if( rpcSlice->getSliceType( ) != I_SLICE )
    352352  {
     
    359359    Int nCurLayer = rpcSlice->getLayerId();
    360360    Double gamma = xCalEnhLambdaFactor( m_ppcTEncTop[nCurLayer-1]->getQP() - m_ppcTEncTop[nCurLayer]->getQP() ,
    361       1.0 * m_ppcTEncTop[nCurLayer]->getSourceWidth() * m_ppcTEncTop[nCurLayer]->getSourceHeight() 
     361      1.0 * m_ppcTEncTop[nCurLayer]->getSourceWidth() * m_ppcTEncTop[nCurLayer]->getSourceHeight()
    362362      / m_ppcTEncTop[nCurLayer-1]->getSourceWidth() / m_ppcTEncTop[nCurLayer-1]->getSourceHeight() );
    363363    dLambda *= gamma;
     
    392392#endif
    393393
    394 #if RDOQ_CHROMA_LAMBDA 
     394#if RDOQ_CHROMA_LAMBDA
    395395// for RDOQ
    396   m_pcTrQuant->setLambda( dLambda, dLambda / weight );   
     396  m_pcTrQuant->setLambda( dLambda, dLambda / weight );
    397397#else
    398398  m_pcTrQuant->setLambda( dLambda );
     
    401401#if SAO_CHROMA_LAMBDA
    402402// For SAO
    403   rpcSlice   ->setLambda( dLambda, dLambda / weight ); 
     403  rpcSlice   ->setLambda( dLambda, dLambda / weight );
    404404#else
    405405  rpcSlice   ->setLambda( dLambda );
    406406#endif
    407  
     407
    408408#if HB_LAMBDA_FOR_LDC
    409409  // restore original slice type
    410410  eSliceType = (pocLast == 0 || pocCurr % m_pcCfg->getIntraPeriod() == 0 || m_pcGOPEncoder->getGOPSize() == 0) ? I_SLICE : eSliceType;
    411  
     411
    412412#if SVC_EXTENSION
    413413  if(m_pcCfg->getLayerId() > 0)
     
    418418  rpcSlice->setSliceType        ( eSliceType );
    419419#endif
    420  
     420
    421421  if (m_pcCfg->getUseRecalculateQPAccordingToLambda())
    422422  {
    423423    dQP = xGetQPValueAccordingToLambda( dLambda );
    424424#if REPN_FORMAT_IN_VPS
    425     iQP = max( -rpcSlice->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );   
    426 #else
    427     iQP = max( -pSPS->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );   
     425    iQP = max( -rpcSlice->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );
     426#else
     427    iQP = max( -pSPS->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );
    428428#endif
    429429  }
     
    438438  rpcSlice->setNumRefIdx(REF_PIC_LIST_0,m_pcCfg->getGOPEntry(iGOPid).m_numRefPicsActive);
    439439  rpcSlice->setNumRefIdx(REF_PIC_LIST_1,m_pcCfg->getGOPEntry(iGOPid).m_numRefPicsActive);
    440  
     440
    441441  if ( m_pcCfg->getDeblockingFilterMetric() )
    442442  {
     
    479479
    480480  rpcSlice->setDepth            ( depth );
    481  
     481
    482482  pcPic->setTLayer( m_pcCfg->getGOPEntry(iGOPid).m_temporalId );
    483483#if TEMP_SCALABILITY_FIX
     
    493493  assert( m_apcPicYuvPred );
    494494  assert( m_apcPicYuvResi );
    495  
     495
    496496  pcPic->setPicYuvPred( m_apcPicYuvPred );
    497497  pcPic->setPicYuvResi( m_apcPicYuvResi );
     
    557557#endif
    558558
    559 #if RDOQ_CHROMA_LAMBDA 
     559#if RDOQ_CHROMA_LAMBDA
    560560  // for RDOQ
    561561  m_pcTrQuant->setLambda( lambda, lambda / weight );
     
    665665#endif
    666666
    667 #if RDOQ_CHROMA_LAMBDA 
     667#if RDOQ_CHROMA_LAMBDA
    668668  // for RDOQ
    669   m_pcTrQuant->setLambda( lambda, lambda / weight );   
     669  m_pcTrQuant->setLambda( lambda, lambda / weight );
    670670#else
    671671  m_pcTrQuant->setLambda( lambda );
     
    674674#if SAO_CHROMA_LAMBDA
    675675  // For SAO
    676   pcSlice   ->setLambda( lambda, lambda / weight ); 
     676  pcSlice   ->setLambda( lambda, lambda / weight );
    677677#else
    678678  pcSlice   ->setLambda( lambda );
     
    692692  Int iMaxSR = m_pcCfg->getSearchRange();
    693693  Int iNumPredDir = pcSlice->isInterP() ? 1 : 2;
    694  
     694
    695695  for (Int iDir = 0; iDir <= iNumPredDir; iDir++)
    696696  {
     
    726726  }
    727727#endif
    728  
     728
    729729  TComSlice* pcSlice        = rpcPic->getSlice(getSliceIdx());
    730730  Double     dPicRdCostBest = MAX_DOUBLE;
    731731  UInt       uiQpIdxBest = 0;
    732  
     732
    733733  Double dFrameLambda;
    734734#if FULL_NBIT
     
    737737  Int    SHIFT_QP = 12;
    738738#endif
    739  
     739
    740740  // set frame lambda
    741741  if (m_pcCfg->getGOPSize() > 1)
     
    748748  }
    749749  m_pcRdCost      ->setFrameLambda(dFrameLambda);
    750  
     750
    751751  // for each QP candidate
    752752  for ( UInt uiQpIdx = 0; uiQpIdx < 2 * m_pcCfg->getDeltaQpRD() + 1; uiQpIdx++ )
     
    776776#endif
    777777
    778 #if RDOQ_CHROMA_LAMBDA 
     778#if RDOQ_CHROMA_LAMBDA
    779779    // for RDOQ
    780780    m_pcTrQuant   ->setLambda( m_pdRdPicLambda[uiQpIdx], m_pdRdPicLambda[uiQpIdx] / weight );
     
    784784#if SAO_CHROMA_LAMBDA
    785785    // For SAO
    786     pcSlice       ->setLambda              ( m_pdRdPicLambda[uiQpIdx], m_pdRdPicLambda[uiQpIdx] / weight ); 
     786    pcSlice       ->setLambda              ( m_pdRdPicLambda[uiQpIdx], m_pdRdPicLambda[uiQpIdx] / weight );
    787787#else
    788788    pcSlice       ->setLambda              ( m_pdRdPicLambda[uiQpIdx] );
    789789#endif
    790    
     790
    791791    // try compress
    792792    compressSlice   ( rpcPic );
    793    
     793
    794794    Double dPicRdCost;
    795795    UInt64 uiPicDist        = m_uiPicDist;
    796796    UInt64 uiALFBits        = 0;
    797    
     797
    798798    m_pcGOPEncoder->preLoopFilterPicAll( rpcPic, uiPicDist, uiALFBits );
    799    
     799
    800800    // compute RD cost and choose the best
    801801    dPicRdCost = m_pcRdCost->calcRdCost64( m_uiPicTotalBits + uiALFBits, uiPicDist, true, DF_SSE_FRAME);
    802    
     802
    803803    if ( dPicRdCost < dPicRdCostBest )
    804804    {
     
    807807    }
    808808  }
    809  
     809
    810810  // set best values
    811811  pcSlice       ->setSliceQp             ( m_piRdPicQp    [uiQpIdxBest] );
     
    832832#endif
    833833
    834 #if RDOQ_CHROMA_LAMBDA 
    835   // for RDOQ 
    836   m_pcTrQuant   ->setLambda( m_pdRdPicLambda[uiQpIdxBest], m_pdRdPicLambda[uiQpIdxBest] / weight ); 
     834#if RDOQ_CHROMA_LAMBDA
     835  // for RDOQ
     836  m_pcTrQuant   ->setLambda( m_pdRdPicLambda[uiQpIdxBest], m_pdRdPicLambda[uiQpIdxBest] / weight );
    837837#else
    838838  m_pcTrQuant   ->setLambda              ( m_pdRdPicLambda[uiQpIdxBest] );
     
    840840#if SAO_CHROMA_LAMBDA
    841841  // For SAO
    842   pcSlice       ->setLambda              ( m_pdRdPicLambda[uiQpIdxBest], m_pdRdPicLambda[uiQpIdxBest] / weight ); 
     842  pcSlice       ->setLambda              ( m_pdRdPicLambda[uiQpIdxBest], m_pdRdPicLambda[uiQpIdxBest] / weight );
    843843#else
    844844  pcSlice       ->setLambda              ( m_pdRdPicLambda[uiQpIdxBest] );
     
    862862
    863863  UInt uiEncCUOrder;
    864   uiCUAddr = rpcPic->getPicSym()->getCUOrderMap( uiStartCUAddr /rpcPic->getNumPartInCU()); 
     864  uiCUAddr = rpcPic->getPicSym()->getCUOrderMap( uiStartCUAddr /rpcPic->getNumPartInCU());
    865865  for( uiEncCUOrder = uiStartCUAddr/rpcPic->getNumPartInCU();
    866866       uiEncCUOrder < (uiBoundingCUAddr+(rpcPic->getNumPartInCU()-1))/rpcPic->getNumPartInCU();
     
    898898  TComSlice* pcSlice            = rpcPic->getSlice(getSliceIdx());
    899899  xDetermineStartAndBoundingCUAddr ( uiStartCUAddr, uiBoundingCUAddr, rpcPic, false );
    900  
     900
    901901  // initialize cost values
    902902  m_uiPicTotalBits  = 0;
    903903  m_dPicRdCost      = 0;
    904904  m_uiPicDist       = 0;
    905  
     905
    906906  // set entropy coder
    907907  if( m_pcCfg->getUseSBACRD() )
     
    921921    m_pcEntropyCoder->setBitstream    ( m_pcBitCounter );
    922922  }
    923  
     923
    924924  //------------------------------------------------------------------------------
    925925  //  Weighted Prediction parameters estimation.
     
    930930    xCalcACDCParamSlice(pcSlice);
    931931  }
     932#if O0194_WEIGHTED_PREDICTION_CGS
     933  else{
     934    // Calculate for the base layer to be used in EL as Inter layer reference
     935    xCalcACDCParamSlice(pcSlice);
     936    wpACDCParam * temp_weightACDCParam;
     937
     938    pcSlice->getWpAcDcParam(temp_weightACDCParam);
     939    g_refWeightACDCParam = (void *) temp_weightACDCParam;
     940  }
     941#endif
    932942
    933943  Bool bWp_explicit = (pcSlice->getSliceType()==P_SLICE && pcSlice->getPPS()->getUseWP()) || (pcSlice->getSliceType()==B_SLICE && pcSlice->getPPS()->getWPBiPred());
     
    10211031        m_pcBufferSbacCoders[uiTileCol].loadContexts( CTXMem[1] );
    10221032        Int iNumSubstreamsPerTile = iNumSubstreams/rpcPic->getPicSym()->getNumTiles();
    1023         uiCUAddr = rpcPic->getPicSym()->getCUOrderMap( uiStartCUAddr /rpcPic->getNumPartInCU()); 
     1033        uiCUAddr = rpcPic->getPicSym()->getCUOrderMap( uiStartCUAddr /rpcPic->getNumPartInCU());
    10241034        uiLin     = uiCUAddr / uiWidthInLCUs;
    10251035        uiSubStrm = rpcPic->getPicSym()->getTileIdxMap(rpcPic->getPicSym()->getCUOrderMap(uiCUAddr))*iNumSubstreamsPerTile
     
    10981108          pcCUTR = rpcPic->getCU( uiCUAddr - uiWidthInCU + 1 );
    10991109        }
    1100         if ( ((pcCUTR==NULL) || (pcCUTR->getSlice()==NULL) || 
     1110        if ( ((pcCUTR==NULL) || (pcCUTR->getSlice()==NULL) ||
    11011111             (pcCUTR->getSCUAddr()+uiMaxParts-1 < pcSlice->getSliceCurStartCUAddr()) ||
    11021112             ((rpcPic->getPicSym()->getTileIdxMap( pcCUTR->getAddr() ) != rpcPic->getPicSym()->getTileIdxMap(uiCUAddr)))
     
    11371147      m_pcEntropyCoder->setEntropyCoder ( m_pcRDGoOnSbacCoder, pcSlice );
    11381148      m_pcEntropyCoder->setBitstream( &pcBitCounters[uiSubStrm] );
    1139      
     1149
    11401150      ((TEncBinCABAC*)m_pcRDGoOnSbacCoder->getEncBinIf())->setBinCountingEnableFlag(true);
    11411151
     
    12421252        m_pcRdCost->setLambda(oldLambda);
    12431253#if RATE_CONTROL_INTRA
    1244         m_pcRateCtrl->getRCPic()->updateAfterLCU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda, 
     1254        m_pcRateCtrl->getRCPic()->updateAfterLCU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda,
    12451255          pcCU->getSlice()->getSliceType() == I_SLICE ? 0 : m_pcCfg->getLCULevelRC() );
    12461256#else
     
    12501260#endif
    12511261#endif
    1252      
     1262
    12531263      // restore entropy coder to an initial stage
    12541264      m_pcEntropyCoder->setEntropyCoder ( m_pppcRDSbacCoder[0][CI_CURR_BEST], pcSlice );
     
    12751285      {
    12761286         ppppcRDSbacCoders[uiSubStrm][0][CI_CURR_BEST]->load( m_pppcRDSbacCoder[0][CI_CURR_BEST] );
    1277        
     1287
    12781288         //Store probabilties of second LCU in line into buffer
    12791289         if ( ( uiCol == uiTileLCUX+1) && (depSliceSegmentsEnabled || (pcSlice->getPPS()->getNumSubstreams() > 1)) && m_pcCfg->getWaveFrontsynchro())
     
    13251335
    13261336#if RATE_CONTROL_INTRA
    1327         m_pcRateCtrl->getRCPic()->updateAfterLCU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda, 
     1337        m_pcRateCtrl->getRCPic()->updateAfterLCU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda,
    13281338          pcCU->getSlice()->getSliceType() == I_SLICE ? 0 : m_pcCfg->getLCULevelRC() );
    13291339#else
     
    13501360      }
    13511361    }
    1352    
     1362
    13531363    m_uiPicTotalBits += pcCU->getTotalBits();
    13541364    m_dPicRdCost     += pcCU->getTotalCost();
     
    14011411    m_pcEntropyCoder->setEntropyCoder ( m_pcSbacCoder, pcSlice );
    14021412  }
    1403  
     1413
    14041414  m_pcCuEncoder->setBitCounter( NULL );
    14051415  m_pcBitCounter = NULL;
     
    14271437      m_pcBufferSbacCoders[ui].load(m_pcSbacCoder); //init. state
    14281438    }
    1429    
     1439
    14301440    for (Int iSubstrmIdx=0; iSubstrmIdx < iNumSubstreams; iSubstrmIdx++)
    14311441    {
     
    15241534        }
    15251535        if ( (true/*bEnforceSliceRestriction*/ &&
    1526              ((pcCUTR==NULL) || (pcCUTR->getSlice()==NULL) || 
     1536             ((pcCUTR==NULL) || (pcCUTR->getSlice()==NULL) ||
    15271537             (pcCUTR->getSCUAddr()+uiMaxParts-1 < pcSlice->getSliceCurStartCUAddr()) ||
    15281538             ((rpcPic->getPicSym()->getTileIdxMap( pcCUTR->getAddr() ) != rpcPic->getPicSym()->getTileIdxMap(uiCUAddr)))
     
    15791589    }
    15801590
    1581     TComDataCU*& pcCU = rpcPic->getCU( uiCUAddr );   
     1591    TComDataCU*& pcCU = rpcPic->getCU( uiCUAddr );
    15821592    if ( pcSlice->getSPS()->getUseSAO() && (pcSlice->getSaoEnabledFlag()||pcSlice->getSaoEnabledFlagChroma()) )
    15831593    {
     
    16131623        if (allowMergeLeft)
    16141624        {
    1615           m_pcEntropyCoder->m_pcEntropyCoderIf->codeSaoMerge(mergeLeft); 
     1625          m_pcEntropyCoder->m_pcEntropyCoderIf->codeSaoMerge(mergeLeft);
    16161626        }
    16171627        else
     
    16761686#if ENC_DEC_TRACE
    16771687    g_bJustDoIt = g_bEncDecTraceDisable;
    1678 #endif   
     1688#endif
    16791689    if( m_pcCfg->getUseSBACRD() )
    16801690    {
    16811691       pcSbacCoders[uiSubStrm].load(m_pcSbacCoder);   //load back status of the entropy coder after encoding the LCU into relevant bitstream entropy coder
    1682        
     1692
    16831693
    16841694       //Store probabilties of second LCU in line into buffer
     
    17331743  UInt uiNumberOfCUsInFrame = rpcPic->getNumCUsInFrame();
    17341744  uiBoundingCUAddrSlice     = uiNumberOfCUsInFrame;
    1735   if (bEncodeSlice) 
     1745  if (bEncodeSlice)
    17361746  {
    17371747    UInt uiCUAddrIncrement;
     
    17691779      uiBoundingCUAddrSlice    = uiNumberOfCUsInFrame*rpcPic->getNumPartInCU();
    17701780      break;
    1771     } 
     1781    }
    17721782    // WPP: if a slice does not start at the beginning of a CTB row, it must end within the same CTB row
    17731783    if (pcSlice->getPPS()->getNumSubstreams() > 1 && (uiStartCUAddrSlice % (rpcPic->getFrameWidthInCU()*rpcPic->getNumPartInCU()) != 0))
     
    18091819      uiBoundingCUAddrSlice    = uiNumberOfCUsInFrame*rpcPic->getNumPartInCU();
    18101820      break;
    1811     } 
     1821    }
    18121822    // WPP: if a slice does not start at the beginning of a CTB row, it must end within the same CTB row
    18131823    if (pcSlice->getPPS()->getNumSubstreams() > 1 && (uiStartCUAddrSlice % (rpcPic->getFrameWidthInCU()*rpcPic->getNumPartInCU()) != 0))
     
    18191829
    18201830  Bool tileBoundary = false;
    1821   if ((m_pcCfg->getSliceMode() == FIXED_NUMBER_OF_LCU || m_pcCfg->getSliceMode() == FIXED_NUMBER_OF_BYTES) && 
     1831  if ((m_pcCfg->getSliceMode() == FIXED_NUMBER_OF_LCU || m_pcCfg->getSliceMode() == FIXED_NUMBER_OF_BYTES) &&
    18221832      (m_pcCfg->getNumRowsMinus1() > 0 || m_pcCfg->getNumColumnsMinus1() > 0))
    18231833  {
     
    18321842    }
    18331843    tileBoundingCUAddrSlice = lcuEncAddr*rpcPic->getNumPartInCU();
    1834    
     1844
    18351845    if (tileBoundingCUAddrSlice < uiBoundingCUAddrSlice)
    18361846    {
     
    18451855  startCUAddrSliceSegment    = pcSlice->getSliceSegmentCurStartCUAddr();
    18461856  boundingCUAddrSliceSegment = uiNumberOfCUsInFrame;
    1847   if (bEncodeSlice) 
     1857  if (bEncodeSlice)
    18481858  {
    18491859    UInt uiCUAddrIncrement;
     
    18801890      boundingCUAddrSliceSegment    = uiNumberOfCUsInFrame*rpcPic->getNumPartInCU();
    18811891      break;
    1882     } 
     1892    }
    18831893    // WPP: if a slice segment does not start at the beginning of a CTB row, it must end within the same CTB row
    18841894    if (pcSlice->getPPS()->getNumSubstreams() > 1 && (startCUAddrSliceSegment % (rpcPic->getFrameWidthInCU()*rpcPic->getNumPartInCU()) != 0))
     
    19191929      boundingCUAddrSliceSegment    = uiNumberOfCUsInFrame*rpcPic->getNumPartInCU();
    19201930      break;
    1921     } 
     1931    }
    19221932    // WPP: if a slice segment does not start at the beginning of a CTB row, it must end within the same CTB row
    19231933    if (pcSlice->getPPS()->getNumSubstreams() > 1 && (startCUAddrSliceSegment % (rpcPic->getFrameWidthInCU()*rpcPic->getNumPartInCU()) != 0))
     
    19271937    pcSlice->setSliceSegmentCurEndCUAddr( boundingCUAddrSliceSegment );
    19281938  }
    1929   if ((m_pcCfg->getSliceSegmentMode() == FIXED_NUMBER_OF_LCU || m_pcCfg->getSliceSegmentMode() == FIXED_NUMBER_OF_BYTES) && 
     1939  if ((m_pcCfg->getSliceSegmentMode() == FIXED_NUMBER_OF_LCU || m_pcCfg->getSliceSegmentMode() == FIXED_NUMBER_OF_BYTES) &&
    19301940    (m_pcCfg->getNumRowsMinus1() > 0 || m_pcCfg->getNumColumnsMinus1() > 0))
    19311941  {
     
    19791989  }
    19801990  UInt uiRealStartAddress = rpcPic->getPicSym()->getPicSCUEncOrder(uiExternalAddress*rpcPic->getNumPartInCU()+uiInternalAddress);
    1981  
     1991
    19821992  pcSlice->setSliceSegmentCurStartCUAddr(uiRealStartAddress);
    19831993  startCUAddrSliceSegment=uiRealStartAddress;
    1984  
     1994
    19851995  //calculate real slice start address
    19861996  uiInternalAddress = rpcPic->getPicSym()->getPicSCUAddr(pcSlice->getSliceCurStartCUAddr()) % rpcPic->getNumPartInCU();
     
    20072017  }
    20082018  uiRealStartAddress = rpcPic->getPicSym()->getPicSCUEncOrder(uiExternalAddress*rpcPic->getNumPartInCU()+uiInternalAddress);
    2009  
     2019
    20102020  pcSlice->setSliceCurStartCUAddr(uiRealStartAddress);
    20112021  uiStartCUAddrSlice=uiRealStartAddress;
    2012  
     2022
    20132023  // Make a joint decision based on reconstruction and dependent slice bounds
    20142024  startCUAddr    = max(uiStartCUAddrSlice   , startCUAddrSliceSegment   );
     
    20222032    if ( (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_LCU && m_pcCfg->getSliceSegmentMode()==FIXED_NUMBER_OF_LCU)
    20232033      || (m_pcCfg->getSliceMode()==0 && m_pcCfg->getSliceSegmentMode()==FIXED_NUMBER_OF_LCU)
    2024       || (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_LCU && m_pcCfg->getSliceSegmentMode()==0) 
     2034      || (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_LCU && m_pcCfg->getSliceSegmentMode()==0)
    20252035      || (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_TILES && m_pcCfg->getSliceSegmentMode()==FIXED_NUMBER_OF_LCU)
    2026       || (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_TILES && m_pcCfg->getSliceSegmentMode()==0) 
     2036      || (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_TILES && m_pcCfg->getSliceSegmentMode()==0)
    20272037      || (m_pcCfg->getSliceSegmentMode()==FIXED_NUMBER_OF_TILES && m_pcCfg->getSliceMode()==0)
    20282038      || tileBoundary
Note: See TracChangeset for help on using the changeset viewer.